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
1402.0240
4
1402
2016-03-26T22:52:52
Graph Cuts with Interacting Edge Costs - Examples, Approximations, and Algorithms
[ "cs.DS", "cs.CV", "cs.DM", "math.OC" ]
We study an extension of the classical graph cut problem, wherein we replace the modular (sum of edge weights) cost function by a submodular set function defined over graph edges. Special cases of this problem have appeared in different applications in signal processing, machine learning, and computer vision. In this paper, we connect these applications via the generic formulation of "cooperative graph cuts", for which we study complexity, algorithms, and connections to polymatroidal network flows. Finally, we compare the proposed algorithms empirically.
cs.DS
cs
Graph Cuts with Interacting Edge Costs – Examples, Approximations, and Algorithms Stefanie Jegelka and Jeff Bilmes Abstract We study an extension of the classical graph cut problem, wherein we replace the modular (sum of edge weights) cost function by a submodular set function defined over graph edges. Special cases of this problem have appeared in different applications in signal processing, machine learning, and computer vision. In this paper, we connect these applications via the generic formulation of "cooperative graph cuts", for which we study complexity, algorithms, and connections to polymatroidal network flows. Finally, we compare the proposed algorithms empirically. 1 Introduction Graphs have been a ubiquitous modeling tool in areas as diverse as operations re- search, signal processing and machine learning. Graphical representations reveal structure in the problem that is often the key to obtaining efficient algorithms for real-world data analysis problems. As a prominent example, the Minimum (s, t)-Cut problem underlies important problems in low-level computer vision [Boykov and Veksler, 2006] (e.g., image segmentation and regularization), prob- abilistic inference in graphical models [Greig et al., 1989, Ramalingam et al., 2008], and for representing pseudo-boolean functions in computer vision and constraint satisfaction problems [Kolmogorov and Boykov, 2005, Ramalingam et al., 2011, Zivn´y et al., 2009]. The reduction to cuts has had a tremendous practical impact. The algorithmic efficiency of cuts comes at the price of reduced modeling power: graph cuts model problems that correspond to a special class of functions (a sub-class of submodular functions defined on the nodes of the graph [Zivn´y et al., 2009]). Section 2 lists applications that do not fall into this category. Motivated by these limitations, this paper studies a non-additive generalization of Minimum (s, t)-Cut, where the cut cost function is a submodular set function over graph edges. A set function f : 2E → R defined on subsets of a ground set E is submodular if it satisfies diminishing marginal costs: for all sets A ⊂ B ⊆ E and e ∈ E \ B, it holds that f (A ∪ {e}) − f (A) ≥ f (B ∪ {e}) − f (B). (1) 1 This generalization – we refer to it as Cooperative Cut – introduces dependencies between edges, and expresses a wider set of functions than graph cuts. 1.1 Minimum Cut and Minimum Cooperative Cut The Minimum (s, t)-Cut problem is defined as follows. Problem 1 (Minimum (s, t)-Cut). Given a weighted graph G = (V,E, w) with e∈C w(e). A cut is a set of edges whose removal disconnects all paths between s and t. terminal nodes s, t ∈ V, find a cut C ⊆ E of minimum cost w(C) =(cid:80) In graph cuts, the cost of any given cut C ⊆ E is a sum w(C) =(cid:80) We assume throughout that w ≥ 0. Many very efficient algorithms are known to solve Minimum (s, t)-Cut; the reader is referred to [Ahuja et al., 1993, Schrijver, 2004] for an overview. nodes at a time. That is, the additive contribution w(e) to the cost(cid:80) e∈C w(e) of edge weights. This function is said to be modular or, equivalently, additive on the edge set E. It implies two important modeling characteristics for graph cuts: First, the nonnegativity of the weights can only penalize two nodes for being separated - this introduces a form of positive correlation between nodes, also hence this is sometimes referred to as attractive potentials in the computer vision community. Second, modular edge weights express interactions of only two e∈C w(e) of a cut C by a given edge e ∈ C is the same regardless of the cut in which the edge e is considered. Several applications, however, are more accurately modeled when allowing non-additive interactions between edge weights. We survey some examples and applications in Section 2. These examples are captured when replacing the modular cost function w by a nonnegative and nondecreasing submodular set function over graph edges. The definition (1) implies that with submodular edge weights, the cost of an additional edge depends on which other edges are contained in the cut. This non-additivity allows specific long-range dependencies between multiple (pairs of) nodes simultaneously that cannot be expressed by graph cuts. These observations motivate the definition of cooperative graph cuts. Problem 2 (Minimum cooperative cut (MinCoopCut)). Given a graph G = (V,E, f ) with terminal nodes s, t ∈ V and a nonnegative, monotone nondecreas- ing submodular function f : 2E → R+ defined on subsets of edges, find an (s, t)-cut C ⊆ E of minimum cost f (C). A set function f is nondecreasing if A ⊆ B ⊆ E implies that f (A) ≤ f (B). MinCoopCut is a constrained submodular minimization problem: minimize f (C) subject to C ⊆ E is an (s, t)-cut in G. (2) As cooperative cuts employ the same graph structures as standard graph cuts, they easily integrate into and extend many of the applications of graph cuts. We note, however, that the graph G need not have any relationship to the sub- modular function f other than the fact that the edges of the graph G constitute the ground set of f . 2 1.2 Relation to the literature Cooperative graph cuts relate to the recent literature in two aspects. First, a number of models in signal processing, computer vision, security, and machine learning are special cases of cooperative cuts, as is discussed in Section 2. Second, recent interest has emerged in the literature regarding the implica- tions of extending classical combinatorial problems (such as Shortest Path, Minimum Spanning Tree, or Set Cover) from a sum-of-weights to submod- ular cost functions [Svitkina and Fleischer, 2008, Iwata and Nagano, 2009, Goel et al., 2009, 2010, Jegelka and Bilmes, 2011a,b, Koufogiannakis and Young, 2009, Hassin et al., 2007, Zhang et al., 2011, Baumann et al., 2013]. None of this work, however, has addressed cuts. In this work, we provide lower and upper bounds on the approximation factor of MinCoopCut. One approach to solving MinCoopCut is via relaxations. For Minimum (s, t)-Cut, a celebrated result of [Ford and Fulkerson, 1956, Dantzig and Fulk- erson, 1955] states that the dual of the linear programming relaxation is a Max- imum Flow problem, and that their optimal values coincide. We refer to the ratio between the maximum flow value (i.e., the optimal value of the relaxation), and the optimal value of the discrete cut, as the flow-cut gap. For Minimum (s, t)-Cut, this ratio is one. In Section 4, we formulate a convex relaxation of MinCoopCut whose dual problem is a generalized flow problem, where sub- modular capacity constraints are placed not only on individual edges but on arbitrary sets of edges simultaneously. The flow-cut gap for this problem can be on the order of n, the number of nodes. In contrast, the related polymatroidal maximum flow problem [Lawler and Martel, 1982, Hassin, 1982] (defined in Sec- tion 5.1.3) still has a flow-cut gap of one. Polymatroidal flows are equivalent to submodular flows, and have recently gained attention for modeling information flow in wireless networks [Kannan et al., 2011, Kannan and Viswanath, 2011, Chekuri et al., 2012]. Their dual problem is a minimum cut problem where the edge weights are defined by a convolution of local submodular functions [Lov´asz, 1983]. Such convolutions are generally not submodular (see Equation (28)). 1.3 Summary of main contributions In this paper, we survey diverse examples of cooperative cuts in different appli- cations, and provide a detailed theoretical analysis: • We show a lower bound of Ω(√n) on the approximation factor for the general MinCoopCut problem. • We analyze two families of approximation algorithms. The first relies on substituting the submodular cost function by a tractable approxima- tion. The second family consists of rounding algorithms that build on the relaxation of the problem. Both families contain algorithms that use a partitioning of edges into node incidence sets, but in different ways. • We provide a lower bound of n − 1 on the flow-cut gap, and relate it to different families of submodular functions. 3 In Section 5.1.3 we draw connections to polymatroidal flows [Lawler and Martel, 1982, Hassin, 1982]. The non-additive cut cost function used in the resulting approximation is solvable exactly and may itself be interesting to consider as an exactly solvable class of e.g. higher-order potentials in computer vision. The paper concludes with a discussion of open problems. In particular, the results of this paper motivate a wider and more refined study of the complexity and expressive power of non-additive graph cut problems. The paper is structured as follows. In Section 2 we discuss various instances of cooperative cuts and their properties. The complexity of MinCoopCut is addressed in Section 3, convex relaxations in Section 4, and algorithmic ap- proaches in Section 5. 1.4 Notation and technical preliminaries Throughout this paper, we are given a directed graph1 G = (V,E) with n nodes and m edges, and terminal nodes s, t ∈ V. The function f : 2E → R+ is sub- modular and monotone nondecreasing, where by 2E we denote the power set of E. We assume f to be normalized, i.e., f (∅) = 0. Equivalently to Definition (1), the function f is submodular if for all A, B ⊆ E, it holds that f (A) + f (B) ≥ f (A ∪ B) + f (A ∩ B). (3) The function f generalizes commonly used modular edge weight functions w : E → R+ that satisfy Equation 3 with equality. We denote the marginal cost of an element e ∈ E with respect to a set A ⊆ E by f (e A) (cid:44) f (A∪{e})−f (A). A function f (A) = g(w(A)) for a nonnegative modular function w and a concave scalar function g is always submodular. For any node v ∈ V, let δ+(v) = {(v, u) ∈ E} be the set of edges directed out of v, and δ−(v) = {(u, v) ∈ E} be the set of edges into v. Together, these two directed sets form the (undirected) incidence set δ(v) = δ+(v) ∪ δ−(v). for a set S ⊆ V of nodes, These definitions directly extend to sets of nodes: δ+(S) = {(v, u) ∈ E : v ∈ S, u /∈ S} is the set of edges leaving S. Without loss of generality, we assume all graphs are simple. The Lov´asz extension f : [0, 1]m → R of the submodular function f is x = (cid:80) its lower convex envelope and is defined as follows [Lov´asz, 1983]. Given a vector x ∈ [0, 1]m, we can uniquely decompose x into its level sets {Bj}j as e ∈ B, and χB(e) = 0 otherwise. Then f (x) =(cid:80) j λjχBj where B1 ⊂ B2 ⊂ . . . are distinct subsets. Here and in the following, χB ∈ [0, 1]m is the characteristic vector of the set B, with χB(e) = 1 if j λjf (Bj). This construction illustrates that f (χB) = f (B) for any set B. The Lov´asz extension can be computed by sorting the entries of the argument x in O(m log m) time and calling f m times. A separator of a submodular function f is a set S ⊆ E with the property that f (S) + f (E \ S) = f (E), implying that for any B ⊆ E, f (B) = f (B ∩ S) + f (B ∩ (E \ S)). If S is a minimal separator, then we say that f couples all 1Undirected graphs can be reduced to bidirected graphs. 4 Let f (A) =(cid:112)(cid:80) (cid:113)(cid:80) e∈A w(e), so h(X) = e∈δ+(X) w(e). Then h is not submodular: h({s, x1}) + h({s, x2}) = √19.9 + √0.2 < 2√10 = h({s}) + h({s, x1, x2}) Figure 1: The node function induced by a cooperative cut is in general not submodular. The above h violates inequality (3) for A = {s, x1}, B = {s, x2} but satisfies it (strictly) for A = {t, x1}, B = {t, x2}. edges in S. For the edges within a minimal separator, f is strictly subadditive: e∈S f (e) > f (S) for S > 1. That means, the joint cost of this set of edges is smaller than the sum of their individual costs. (cid:80) 1.5 Node functions induced by submodular edge weights Every cost function f on graph edges defines a cut function h : 2V → R+ on sets X ⊆ V of nodes: h(X) (cid:44) f (δ+(X)). (4) It is well known that if f is a (modular) sum of nonnegative edge weights, then h is submodular [Schrijver, 2004]. In fact, the following is true: Proposition 1. The function f is a non-negative modular function on the edge set if and only if h(X) = f (δ+(X)) is a submodular function on the nodes for all edge-induced sub-graphs of G = (V,V × V). If, however, f is an arbitrary nondecreasing submodular function, then this is not always the case, as Figure 1 illustrates. Proposition 2, proven in Appendix B, summarizes some key properties of h. Proposition 2. Let h : 2V → R, h(X) (cid:44) f (δ+(X)) be the node function induced by a cooperative cut with nonnegative nondecreasing submodular cost function f . Then: 1. h is not always submodular, and 2. h is subadditive, i.e., h(A) + h(B) ≥ h(A ∪ B) for any A, B ⊆ V. The non-submodularity of h shows that cooperative cuts are strictly more general than (modular-weight) graph cuts. In some cases, the function h is sub- modular. One obvious sufficient condition is that f is nonnegative and modular, but this condition is not necessary as shown in the following. 5 0.10.10.19.99.9stx1x2 Proposition 3. Let f be monotone submodular and permutation symmetric in the sense that f (A) = f (σ(A)) for any permutation σ of the set E. If G is a complete graph, then h is submodular. Proof. Symmetry implies that f is of the form f (A) = g(A) for a scalar func- tion g. Submodularity of f implies that there is always a function g(cid:48) that interpolates g on R \ {0, 1, . . . , m}, i.e., f (A) = g(cid:48)(A) = g(A), and g(cid:48) is a piecewise linear concave function. Let EXY be the edges between sets X and Y . The submodularity of h is identical to the condition that for all X ⊆ V, x, y /∈ X, it holds that h(X ∪ x) + h(X ∪ y) ≥ h(X) + h(X ∪ x ∪ y). (5) Let R = V \ (X ∪ x ∪ y). By the concavity and monotonicity of g(cid:48) we have h(X) + h(X ∪ x ∪ y) = g(cid:48)(EXR + EXx + EXy) + g(cid:48)(EXR + ERx + ERy) = g(cid:48)(XR + 2X) + g(cid:48)(XR + 2R) ≤ 2g(cid:48)(XR + X + R) ≤ g(cid:48)(EXR + EXy + ERx + Exy) + g(cid:48)(EXR + EXx + ERy + Exy) = h(X ∪ x) + h(X ∪ y), and hence submodularity of h follows. Note that if G is not complete, then h might no longer be submodular. An exact (possibly algebraic or graph-theoretic) characterization of the conditions on G and f that imply submodularity of h is currently an open problem. 2 Motivation and special cases We begin by surveying special cases of cooperative cuts from applications in signal processing, machine learning, and computer vision. Notably, some of these applications lead to submodular node functions h as defined in (4) and are hence polynomial-time solvable, while for others h is not submodular. We first discuss the latter case which motivated this paper, and then special submodular cases. Additional special cases are discussed in Section 6. 2.1 General, non-submodular examples Image segmentation. The classical task of segmenting an image into a fore- ground object and its background is commonly formulated as a maximum a posteriori (MAP) inference problem in a Markov Random Field (MRF) or Con- ditional Random Field (CRF). If the potential functions of the random field are submodular functions (of the node variables), then the MAP solution can be computed efficiently via the minimum cut in an auxiliary graph [Greig et al., 1989, Boykov and Jolly, 2001, Kolmogorov and Zabih, 2004]. 6 While these graph cut models have been very successful in computer vision, they suffer from known shortcomings. For example, the cut model implicitly penalizes the length of the object boundary, or equivalently the length of a cor- responding graph cut around the object. As a result, MAP solutions (minimum cuts) tend to truncate fine parts of an object (such as branches of trees, or animal hair), and to neglect carving out holes (such as the mesh grid of a fan, or written letters on paper). This tendency is aggravated if the image has re- gions of low contrast, where local information is insufficient to determine correct object boundaries. A solution to both of these problems is proposed in [Jegelka and Bilmes, 2011a]. It relies on the continuation of "obvious" object boundaries: one aims to reduce the cut cost if the cut consists of edges (pairs of pixels) with similar appearance. This aim is impossible to model with a modular-cost graph cut where edges are independent. Hence, Jegelka and Bilmes [2011a] replace the graph cut by a cooperative cut that lowers the cost for sets of similar edges. Specifically, the edges in the image graph are partitioned into groups Si of similar edges, where similarity is defined via the adjacent pixels (nodes), and the cut cost is k(cid:88) i=1 f (C) = gi(w(C ∩ Si)), is a sum of nonnegative weights. where the gi are increasing, strictly concave functions, and w(C) =(cid:80) e∈C w(e) From the viewpoint of graphical models, the function h induced by (6) is a higher-order potential, i.e., a polynomial of degree much larger than 2. The model (6) also applies to multi-label (scene labeling) problems and other com- puter vision tasks [Kohli et al., 2013, Silberman et al., 2014, Taniai et al., 2015]. An alternative cooperative cut function has been studied to improve image (6) segmentation results: f (C) = max e∈C w(e). (7) Contrary to the cost function (6), the function (7) couples all edges in the grid graph uniformly, without any similarity constraints or grouping. As a result, the cost of any long cut is discounted. Sinop and Grady [2007] and All`ene et al. [2009] derive this function as the (cid:96)∞ norm of the (gradient) vector of pixel differences; this vector is the edge indicator vector y in the relaxation we define in Section 4. Conversely, the relaxation of the cooperative cut problem leads to new, possibly non-uniform and group-structured regularization terms [Jegelka, 2012]. Label Cuts. In computer security, attack graphs are state graphs modeling the steps of an intrusion. Each transition edge is labeled by an atomic action a, and blocking an action a blocks the set of all associated edges Sa ⊆ E that carry label a. To prevent an intrusion, one must separate the initial state s from the goal state t by blocking (cutting) appropriate edges. The cost of cutting a set of edges is the cost of blocking the associated actions (labels), and paying for 7 one action a accounts for all edges in Sa. If each action has a cost c(a), then a minimum label cut that minimizes the submodular cost function (cid:88) f (C) = c(a) min{1,C ∩ Sa} (8) a indicates the lowest-cost prevention of an intrusion [Jha et al., 2002]. Sparse separators of Dynamic Bayesian Networks. A graphical model G = (V, E) defines a family of probability distributions. It has a node vi for each random variable xi, and any represented distribution p(x) must factor with respect to the edges of the graph as p(x) ∝ (vi,vj )∈E ψij(xi, xj). A dy- namic graphical model (DGM) [Bilmes, 2010] consists of three template parts: a prologue Gp = (Vp, Ep), a chunk Gc = (Vc, Ec) and an epilogue Ge = (Ve, Ee). Given a length τ , an unrolling of the template is a model that begins with Gp on the left, followed by τ + 1 repetitions of the "chunk" part Gc and ending in the epilogue Ge. (cid:81) To perform inference efficiently, a periodic section of the partially unrolled model is identified on which an effective inference strategy (e.g., a graph triangu- lation, an elimination order, or an approximate inference method) is developed and then repeatedly used for the complete duration of the model unrolled to any length. This periodic section has boundaries corresponding to separators in the original model [Bilmes, 2010] which are called the interface separators. Importantly, the efficiency of any inference algorithm derived within the peri- odic section depends critically on properties of the interface, since the variables within must become a clique. In general, the computational cost of inference is lower bounded, and the memory cost of inference is exactly given, by the size of the joint state space of the interface variables. A "small" separator corresponds to a minimum vertex cut in the graphical model, where the cost function measures the size of the joint state space. Vertex cuts can be rephrased as standard edge cuts. Often, a modular cost function suffices for good results. Sometimes, however, a more general cost function is needed. In Bilmes and Bartels [2003], for example (which is our original motivation for studying MinCoopCut), a state space function that considers deterministic relationships between variables is found to significantly decrease inference costs. An example of a function that respects determinism is the following. In a Bayesian network possessing determinism, let D be the subset of fully de- terministic nodes. That means any xi ∈ D is a deterministic function of the variables corresponding to its parent nodes par(i) meaning p(xixpar(i)) = 1[xi = g(xpar(i))] for some deterministic function g. Let Di be the state space of variable xi. Furthermore, given a set A of variables, let AD = {xi ∈ A∩ D par(i) ⊆ A} be its subset of fully determined variables. If the state space of a deterministic variable is not restricted by fixing a subset of its parents, then the function xi∈A\AD Di. The logarithm of this function is a submodular function, and therefore the problem of finding a good separator is a cooperative (vertex) cut problem. In fact, this measuring the state space of a set of variables A is f (A) =(cid:81) 8 function is a lower bound on the computational complexity of inference, and corresponds exactly to the memory complexity since memory need be retained only at the boundaries between repeated sections in a DGM. More generally, a similar slicing mechanism applies for partitioning a graph for use on a parallel computer - we may seek separators that require little information to be transferred from one processor to another. A reasonable proxy for such "compressibility" is the entropy of a set of random variables, a well-known submodular function. The resulting optimization problem of finding a minimum-entropy separator is a cooperative cut that is different from any known special cases. Robust optimization. Assume we are given a graph where the weight of each edge e ∈ E is noisy and distributed as N (µ(e), σ2(e)) for nonnegative mean weights µ(e). The noise on different edges is independent, and the cost of a cut is the sum of edge weights of an unknown draw from that distribution. In such a case, we might want to not only minimize the expected cost, but also take the variance into consideration. This is the aim in mean-risk minimization (which is equivalent to a probability tail model or value-at-risk model), where we aim to minimize (cid:88) (cid:115)(cid:88) f (C) = µ(e) + λ σ2(e). (9) e∈C e∈C This is a cooperative cut, and this special case admits an FPTAS [Nikolova, 2010]. 2.2 Special cases that lead to submodular functions h Curiously, some instances of cooperative cuts provably yield submodular node functions h and are hence easier. In the first two examples below, f is defined over edges in a complete graph and is symmetric. Here, symmetry is meant in the sense of [Vondr´ak, 2013] and Proposition 3, the function is indifferent to permutations of the arguments. Higher-order potentials in computer vision. A number of higher-order potentials (pseudo-boolean functions) from computer vision, i.e., potential func- tions that introduce dependencies between more than two variables at a time, can be reformulated as cooperative cuts. As an example, P n Potts functions [Kohli et al., 2009a] and robust P n potentials [Kohli et al., 2009b] bias image labelings to assign the same label to larger patches of pixels (of uniform appear- ance). The potential is low if all nodes in a given patch take the same label, and high if a large fraction deviates from the majority label. These potential functions correspond to a complete graph with a cooperative cut cost function f (C) = g(C), 9 (10) for a concave function g. The larger the fraction of deviating nodes, the more edges are cut between labels, leading to a higher penalty. The function g makes this robust by capping the maximum penalty. Regularization and Total Variation. A popular regularization term in sig- nal processing, and in particular for image denoising, has been the Total Vari- ation (TV) and its discretization [Rudin et al., 1992]. The setup commonly includes a pixel variable (say xj or xij) corresponding to each pixel or node in the image graph G, and an objective that consists of a loss term and the regularization. The discrete TV for variables xij corresponding to pixels vij in an M × M grid with coordinates i, j is given as TV1(x) = (xi+1,j − xij)2 + (xi,j+1 − xij)2. (11) If x is constrained to be a {0, 1}-valued vector, then this is an instance of cooperative cut - the pixels valued at unity correspond to the selected elements X ⊆ V, and the edge submodular function corresponds to f (C) =(cid:80) for C ⊆ E where Sij = {(vi+1,jvij), (vi,j+1, vij)} ⊆ E ranges over all relevant neighborhood pairs of edges. Discrete versions of other variants of total variation are also cooperative cuts. Examples include the combinatorial total variation of Couprie et al. [2011]: (cid:112)C ∩ Sij ij M(cid:88) (cid:113) i,j=1 TV2(x) = ν2 i (xi − xj)2, (12) and the submodular oscillations in [Chambolle and Darbon, 2009], for instance, (cid:88) (cid:115) (cid:88) i (vi,vj )∈E (cid:88) (cid:88) 1≤i,j≤M 1≤i,j≤M TV3(x) = = max{xi,j, xi+1,j, xi,j+1, xi+1,j+1} − min{xi,j, xi+1,j, xi,j+1, xi+1,j+1} max (cid:96),r∈Uij×Uij x(cid:96) − xk, (13) (14) where for notational convenience we used Uij = {(i, j), (i + 1, j), (i, j + 1), (i + 1, j + 1)}. The latter term (14), like P n potentials, corresponds to a symmet- ric submodular function on a complete graph, and both (10) and (14) lead to submodular node functions h(X). Approximate submodular minimization. Graph cuts have been useful optimization tools but cannot represent any arbitrary set function, not even all submodular functions [Zivn´y et al., 2009]. But, using a decomposition theorem by Cunningham [1983], any submodular function can be phrased as a coopera- tive graph cut. As a result, any fast algorithm that computes an approximate minimum cooperative cut can be used for (faster) approximate minimization of certain submodular functions [Jegelka et al., 2011]. 10 2.3 General Cooperative Cut The above examples indicate that certain special cases reduce MinCoopCut to a submodular minimization problem, or result in a simpler optimization prob- lem than the general form of MinCoopCut with an arbitrary non-negative submodular cost function f and an arbitrary graph G. We will discuss such examples in further detail in Section 6. Yet, there are many reasons for studying the optimization landscape of gen- eral MinCoopCut. First, not all of the examples in Section 2.1 fall into one of the "easier" classes. Second, applications often benefit from learning the submodular function rather than specifying it a priori. While learning a sub- modular function is hard in general [Goemans et al., 2009, Balcan and Harvey, 2012], learning can be practically viable for sub-classes of submodular functions [Lin and Bilmes, 2012, Fix et al., 2013, Stobbe and Krause, 2012, Tschiatschek et al., 2014]. Applications such as those in computer vision [Jegelka and Bilmes, 2011a] would likely benefit from learning too, but the resulting cooperative cut problem would not necessarily fall into an easy sub-class. Moreover, applications often benefit from combining different objective terms. In computer vision, this may be a cooperative cut potential for encouraging object boundaries of homo- geneous appearance, combined with terms that express the data likelihood for different object classes, terms that encourage the coherence of uniform patches of pixels, e.g. the potentials in [Kohli et al., 2009b], and possibly others. All of these terms are cooperative cuts, but together they quickly exceed special sub-classes of the problem. In fact, empirical results enabled by general algorithms may hint at the existence of further, easier special cases that help map the complexity landscape. The empirical results in Section 7, for example, are based on the results in this paper and open up questions for further study. Hence, this paper deliberately takes a general viewpoint to connect the many examples from a spectrum of areas to a common optimization problem. 3 Complexity and lower bounds In this section, we address the hardness of the general MinCoopCut problem. Assuming that the cost function is given as an oracle, we show a lower bound of Ω(√n) on the approximation factor. In addition, we include a proof of NP- hardness. NP-hardness holds even if the cost function is completely known and polynomially computable and representable. Our results complement known lower bounds for related combinatorial prob- lems having submodular cost functions. Table 1 provides an overview of known results from the literature. In addition, Zhang et al. [2011] show a lower bound for the special case of Minimum Label Cut via a reduction from Minimum Label Cover. Their lower bound is 2(log ¯m)1−(log log ¯m)−c for c < 0.5, where ¯m is the input length of the instance. Their proof is based on the PCP theorem. In contrast, the proof of the lower bound in Theorem 1 is information-theoretic. 11 Problem Set Cover Minimum Spanning Tree Shortest Path Perfect Matching Minimum Cut Lower Bound Ω(lnU) Ω(n) Ω(n2/3) Ω(n) √ n) Ω( Reference Iwata and Nagano [2009] Goel et al. [2009] Goel et al. [2009] Goel et al. [2009] Theorem 1 Table 1: Hardness results for combinatorial problems with submodular costs, where n is the number of nodes, and U the universe to cover. These results assume oracle access to the cost function. (cid:112) Theorem 1. No polynomial-time algorithm can solve MinCoopCut with an approximation factor of o( V/ log V). The proof relies on constructing two submodular cost functions f , h that are almost indistinguishable, except that they have quite differently valued minima. In fact, with high probability they cannot be distinguished with a polynomial number of function queries. If the optima of h and f differ by a factor larger than α, then any solution for f within a factor α of the optimum would be enough evidence to discriminate between f and h. As a result, a polynomial-time algo- rithm that guarantees an approximation factor α would lead to a contradiction. The proof technique follows along the lines of the proofs in [Goemans et al., 2009, Svitkina and Fleischer, 2008]. One of the functions, f , depends on a hidden random set R ⊆ E that will be its optimal cut. We will use the following lemma that assumes f will depend on a random set R. Lemma 1 (Svitkina and Fleischer [2008], Lemma 2.1). If for any fixed set Q ⊆ E, chosen without knowledge of R, the probability of f (Q) (cid:54)= h(Q) over the random choice of R is m−ω(1), then any algorithm that makes a polyno- mial number of oracle queries has probability at most m−ω(1) of distinguishing between f and h. Consequently, the two functions f and h in Lemma 1 cannot be distinguished with high probability within a polynomial number of queries, i.e., within poly- nomial time. Hence, it suffices to construct two functions for which Lemma 1 holds. Theorem 1. We will prove the bound in terms of the number m = E of edges in the graph. The graph we construct has n = m − (cid:96) + 2 nodes, and therefore the proof also shows the lower bound in terms of nodes. Construct a graph G = (V,E) with (cid:96) parallel disjoint paths from s to t, where each path has k edges. The random set R ⊂ E is always a cut consisting of R = (cid:96) edges, and contains one edge from each path uniformly at random. 12 Figure 2: Graph for the proof of Theorem 1. We define β = 8(cid:96)/k < (cid:96) (for k > 8), and, for any Q ⊆ E, h(Q) = min{Q, (cid:96)} f (Q) = min{Q \ R + min{Q ∩ R, β}, (cid:96)}. (15) (16) The functions differ only for the relatively few sets Q with Q ∩ R > β and Q \ R < (cid:96) − β, with minA∈C h(A) = h(C) = (cid:96), minA∈C f (A) = f (R) = β, where C is the set of cuts, and C is any cut. We must have k(cid:96) = m, so define  such that 2 = 8/7 log m, and set k = 8√m/ and (cid:96) = √m/8. We compute the probability that f and h differ for a given query set Q. Probabilities are over the random unknown R. Since f ≤ h, the probability of a difference is Pr(f (Q) < h(Q)). If Q ≤ (cid:96), then f (Q) < h(Q) only if β < Q∩ R, and the probability Pr(f (Q) < h(Q)) = Pr(Q ∩ R > β) increases as Q grows. If, on the other hand, Q ≥ (cid:96), then since h(Q) = (cid:96) the probability Pr(f (Q) < h(Q)) = Pr(Q \ R + min{Q ∩ R, β} < (cid:96)) = Pr(Q ∩ R > β) decreases as Q grows. Hence, the probability of a difference is largest when Q = (cid:96). So let Q = (cid:96). If Q spreads over b ≤ k edges of a path P , then the probability that Q includes the edge in P ∩ R is b/k. The expected overlap between Q and R is the sum of hits on all paths: E[ Q ∩ R ] = Q/k = (cid:96)/k. Since the edges in R are independent across different paths, we may bound the probability of a large intersection by a Chernoff bound (with δ = 7 in [56]): Pr(cid:0) f (Q) (cid:54)= h(Q)(cid:1) ≤ Pr(cid:0) Q ∩ R ≥ 8(cid:96)/k(cid:1) ≤ 2−7(cid:96)/k = 2−72/8 = 2−ω(log m) = m−ω(1). (17) (18) With this result, Lemma 1 applies. No polynomial-time algorithm can guarantee to be able to distinguish f and h with high probability. A polynomial algorithm with approximation factor better than the ratio of optima h(R)/f (R) would discriminate the two functions and thus lead to a contradiction. As a result, the lower bound is determined by the ratio of optima of h and f . The optimum of f is f (R) = β, and h has uniform cost (cid:96) for all minimal cuts. Hence, the ratio is h(R)/f (R) = (cid:96)/β = √m/ = o( m/ log m). (cid:112) 13 St...stk`Figure2:GraphfortheproofofTheorem1.Oneofthefunctions,f,dependsonahiddenrandomsetR✓Ethatwillbeitsoptimalcut.WewillusethefollowingLemmathatassumesftodependonarandomsetR.Lemma1(SvitkinaandFleischer[2008],Lemma2.1).IfforanyfixedsetQ✓E,chosenwithoutknowledgeofR,theprobabilityoff(Q)6=h(Q)overtherandomchoiceofRism!(1),thenanyalgorithmthatmakesapolyno-mialnumberoforaclequerieshasprobabilityatmostm!(1)ofdistinguishingbetweenfandh.Consequently,thetwofunctionsfandhinLemma1cannotbedistinguishedwithhighprobabilitywithinapolynomialnumberofqueries,i.e.,withinpoly-nomialtime.Hence,itsucestoconstructtwofunctionsforwhichLemma1holds.Proof(Theorem1).Wewillprovetheboundintermsofthenumberm=Eofedgesinthegraph.Thegraphweconstructhasn=m`+2nodes,andthereforetheproofalsoshowsthelowerboundintermsofnodes.ConstructagraphG=(V,E)with`paralleldisjointpathsfromstot,whereeachpathhaskedges.OurrandomsetR⇢EisalwaysbeacutconsistingofR=`edges,andcontainsoneedgefromeachpathuniformlyatrandom.Wedefine=8`/k<`(fork>8),and,foranyQ✓E,h(Q)=min{Q,`}(12)f(Q)=min{Q\R+min{Q\R,},`}.(13)Thefunctionsdi↵eronlyfortherelativelyfewsetsQwithQ\R>andQ\R<`,withminA2Ch(A)=h(C)=`,minA2Cf(A)=f(R)=,Cthesetofcuts,andCisanycut.Wemusthavek`=m,sodefine✏suchthat✏2=8/7logm,andsetk=8pm/✏and`=✏pm/8.Wecomputetheprobabilitythatfandhdi↵erforagivenquerysetQ.ProbabilitiesareovertherandomunknownR.Sincefh,theprobabilityofadi↵erenceisP(f(Q)<h(Q)).IfQ`,thenf(Q)<h(Q)onlyif<Q\R,andtheprobabilityP(f(Q)<h(Q))=P(Q\R>)increasesasQgrows.If,ontheotherhand,Q`,thensinceh(Q)=`theprobabilityP(f(Q)<h(Q))=P(Q\R+min{Q\R,}<`)=P(Q\R>)11stk`Figure2:GraphfortheproofofTheorem1.Oneofthefunctions,f,dependsonahiddenrandomsetR✓Ethatwillbeitsoptimalcut.WewillusethefollowingLemmathatassumesftodependonarandomsetR.Lemma1(SvitkinaandFleischer[2008],Lemma2.1).IfforanyfixedsetQ✓E,chosenwithoutknowledgeofR,theprobabilityoff(Q)6=h(Q)overtherandomchoiceofRism!(1),thenanyalgorithmthatmakesapolyno-mialnumberoforaclequerieshasprobabilityatmostm!(1)ofdistinguishingbetweenfandh.Consequently,thetwofunctionsfandhinLemma1cannotbedistinguishedwithhighprobabilitywithinapolynomialnumberofqueries,i.e.,withinpoly-nomialtime.Hence,itsucestoconstructtwofunctionsforwhichLemma1holds.Proof(Theorem1).Wewillprovetheboundintermsofthenumberm=Eofedgesinthegraph.Thegraphweconstructhasn=m`+2nodes,andthereforetheproofalsoshowsthelowerboundintermsofnodes.ConstructagraphG=(V,E)with`paralleldisjointpathsfromstot,whereeachpathhaskedges.OurrandomsetR⇢EisalwaysbeacutconsistingofR=`edges,andcontainsoneedgefromeachpathuniformlyatrandom.Wedefine=8`/k<`(fork>8),and,foranyQ✓E,h(Q)=min{Q,`}(12)f(Q)=min{Q\R+min{Q\R,},`}.(13)Thefunctionsdi↵eronlyfortherelativelyfewsetsQwithQ\R>andQ\R<`,withminA2Ch(A)=h(C)=`,minA2Cf(A)=f(R)=,Cthesetofcuts,andCisanycut.Wemusthavek`=m,sodefine✏suchthat✏2=8/7logm,andsetk=8pm/✏and`=✏pm/8.Wecomputetheprobabilitythatfandhdi↵erforagivenquerysetQ.ProbabilitiesareovertherandomunknownR.Sincefh,theprobabilityofadi↵erenceisP(f(Q)<h(Q)).IfQ`,thenf(Q)<h(Q)onlyif<Q\R,andtheprobabilityP(f(Q)<h(Q))=P(Q\R>)increasesasQgrows.If,ontheotherhand,Q`,thensinceh(Q)=`theprobabilityP(f(Q)<h(Q))=P(Q\R+min{Q\R,}<`)=P(Q\R>)11 Building on the construction in the above proof with (cid:96) = n1/3 and a different cut cost function, Balcan and Harvey [2012] proved that if the data structure used by an algorithm (even with an arbitrary number of queries) has poly- nomial size, then this data structure cannot represent the minimizers of their cooperative cut problem to an approximation factor of o(n1/3/ log n). In addition, we mention that a reduction from Graph Bisection serves to prove that MinCoopCut is NP-hard. We defer the proof to Appendix C, but point out that in the reduction, the cost function is fully accessible and given as a polynomial-time computable formula. Theorem 2. Minimum Cooperative (s, t)-Cut is NP-hard. 4 Relaxation and the flow dual As a first step towards approximation algorithms, we formulate a relaxation of MinCoopCut and analyze the flow-cut gap. The minimum cooperative cut problem can be relaxed to a continuous convex optimization problem using the convex Lov´asz extension f of f : min y∈RE, x∈RV f (y) s.t. − x(u) + x(v) + y(e) ≥ 0 x(s) − x(t) ≥ 1 y ≥ 0 (19) for all e = (u, v) ∈ E The dual of this problem can be derived by writing the Lov´asz extension as a maximum f (y) = maxz∈P(f ) z(cid:62)y of linear functions. The maximum is taken over the submodular polyhedron P(f ) = {y y(e) ≤ f (A) ∀A ⊆ E}. (20) The resulting dual problem is a flow problem with non-local capacity constraints: (cid:88) e∈A ν max ν∈R,ϕ∈RE ϕ(A) (cid:44)(cid:88) (cid:88) e∈A s.t. (cid:88) e∈δ+u ϕ(e) ≤ f (A) for all A ⊆ E ϕ(e) − ϕ(e(cid:48)) = d(u)ν for all u ∈ V e(cid:48)∈δ−u ϕ ≥ 0, (21) (22) where d(u) = 1 if u = s, d(u) = −1 if u = t, and d(u) = 0 otherwise. Con- straint (22) demands that ϕ must, in addition to satisfying the common flow conservation, reside within the submodular polyhedron P(f ). This more re- strictive constraint replaces the edge-wise capacity constraints that occur when f is a sum of weights. 14 As an alternative to (19), the constraints can be stated in terms of paths: a set of edges is a cut if it intersects all (s, t)-paths in the graph. min f (y) s.t. (cid:88) y ∈ [0, 1]E . e∈P y(e) ≥ 1 for all (s, t)-paths P ⊆ E (23) We will use this form in Section 5.2.1, and the relaxation (19) in Section 5.2.2. 4.1 Flow-cut gap The relaxation (19) of the discrete problem (2) is not tight. This becomes evident when analyzing the ratio f (C∗)/ f (y∗) between the optimal value of the discrete problem and the relaxation (19) (i.e., the integrality gap). This ratio is, by strong duality between Problems (19) and (21), also the flow-cut gap f (C∗)/ν∗ of the optimal cut and maximal flow values. Lemma 2. Let P be the set of all (s, t)-paths in the graph. The flow-cut gap f (C∗)/ν∗ can be upper and lower bounded as follows: (cid:80) f (C∗) minP (cid:48)⊆P f (P (cid:48)) P (cid:48) f (C∗) ν∗ ≤ ≤ f (C∗) maxP∈P minP (cid:48)⊆P . f (P (cid:48)) P (cid:48) P∈P f (P ) Proof. The Lemma straightforwardly follows from bounding the optimal flow ν∗. The flow through a single path P ∈ P, if all other edges e /∈ P are empty, is restricted by the minimum average capacity for any subset of edges within the path, i.e., minP (cid:48)⊆P . Moreover, we obtain a family of feasible solutions as those that send nonzero flow only along one path and remain within that path's capacity. Hence, the maximum flow must be at least as big as the flow for any of those single-path solutions. This observation yields the upper bound on the ratio. (cid:48) P (cid:48) minP (cid:48)⊆P constraint is upper bounded by f (A) = (cid:80) (cid:80) A similar argumentation shows the lower bound: the total joint capacity f (A ∩ P ) ≥ f (A). Hence, is the value of the maximum flow with capacity f if each edge is only contained in one path, and is an upper bound on the flow other- wise. Corollary 1. The flow-cut gap for MinCoopCut can be as large as n − 1. Proof. Corollary 1 can be shown via an example where the upper and lower bound of Lemma 2 coincide. The worst-case example for the flow-cut gap is a simple graph that consists of one single path from s to t with n − 1 edges. For this graph one of the capacity constraints is that P∈P f (P (cid:48) P (cid:48) P∈P ) ϕ(E) = ϕ(e) ≤ f (E). (24) (cid:88) e∈E 15 approximating f √ generic (§5.1.1) semigradient (§5.1.2) polymatroidal flow (§5.1.3) O( m log m) C∗ (C∗−1)(1−κf )+1 min{∆s, ∆t} relaxation randomized (§5.2.1) rounding I (§5.2.2) rounding II (§5.2.2) Pmax Pmax V − 1 Table 2: Overview of the algorithms and their approximation factors. Constraint (24) is the only relevant capacity constraint if the capacity (and cut cost) function is f (A) = maxe∈A w(e) with weights w(e) = γ for all e ∈ E and some constant γ > 0 and, consequently, f (E) = γ. By Constraint (24), the maximum flow is ν∗ = γ n−1 . The optimum cooperative cut C∗, by contrast, consists of any single edge and has cost f (C∗) = γ. Single path graphs as used in the previous proof can provide worst-case if f is such that f (e) ≥ f (E)/E for all examples for rounding methods too: edges e in the path, then the solution to the relaxed cut problem is maximally uninformative: all entries of the vector y are y(e) = f (E) n−1 . 5 Approximation algorithms We next address approximation algorithms whereby we consider two comple- mentary approaches. The first approach is to substitute the submodular cost function f by a simpler function f . Appropriate candidate functions f that ad- mit an exact cut optimization are the approximation by Goemans et al. [2009] (Section 5.1.1), semi-gradient based approximations (Section 5.1.2), or approx- imations by making f separable across local neighborhoods (Section 5.1.3). The second approach is to solve the relaxations from Section 4 and round the resulting optimal fractional solution (Section 5.2.2). Conceptually very close to the relaxation approach, we offer another algorithm that solves the mathemat- ical program (23) via a randomized greedy algorithm (Section 5.2.1). The relaxations approaches are affected by the flow-cut gap, or, equivalently, the length of the longest path in the graph. The approximations that use a surrogate cost function are complementary and not affected by the "length", but by a notion of the "width" of the graph. 5.1 Approximating the cost function We begin with algorithms that use a suitable approximation f to f , for which the problem minimize f (C) s.t. C ⊆ E is a cut (25) is solvable exactly in polynomial time. The following lemma will be the basis for the approximation bounds. 16 5.1.1 A generic approximation f ((cid:98)S) ≤ αf (S∗). Lemma 3. Let (cid:98)S = argminS∈S f (S). If for all S ⊆ E, it holds that f (S) ≤ αf (S∗), then (cid:98)S is an α-approximate solution to Problem (2): f (S), and if for the optimal solution S∗ to Problem (2), it holds that f (S∗) ≤ Proof. Since f ((cid:98)S) ≤ f (S∗), it follows that f ((cid:98)S) ≤ f ((cid:98)S) ≤ f (S∗) ≤ αf (S∗). function2 that has the functional form fea(A) = (cid:112)(cid:80) Goemans et al. [2009] define a generic approximation of a monotone submodular e∈A wf (e). The weights wf (e) depend on f . When using fea, we compute a minimum cut for the cost f 2 ea, which is a modular sum of weights and hence results in a standard Minimum (s, t)-Cut problem. In practice, the bottleneck lies in computing the weights wf . Goemans et al. [2009] show how to compute weights such that f (A) ≤ f (A) ≤ αf (A) with α = O(√m) for a matroid rank function, and α = O(√m log m) otherwise. We add that for an integer polymatroid rank function bounded by M = maxe∈E f (e), the logarithmic factor can be replaced by a constant to yield α = O(√mM ) (if one approximates the matroid expansion3 of the polymatroid instead of f directly). Together with Lemma 3, this yields the following approximation bounds. Lemma 4. Let (cid:98)C = argminC∈C C∗ = argminC∈C f (C). Then f ((cid:98)C) = O(√m log m)f (C∗). If f is integer-valued and we approximate its matroid expansion, then f ((cid:98)C) = O(√mM )f (C∗), where fea(C) be the minimum cut for cost fea, and M ≤ maxe f (e). The lower bound in Theorem 1 suggests that for sparse graphs, the bound in Lemma 4 is tight up to logarithmic factors. 5.1.2 Approximations via semigradients For any monotone submodular function f and any set A, there is a simple way to compute a modular upper bound fs to f that agrees with f at A. In other words, fs is a discrete supergradient of f at A. We define fs as [Jegelka and Bilmes, 2011a, Iyer et al., 2013a] (cid:88) (cid:88) fs(B; A) = f (A) + f (e A) − f (e E \ e). (26) e∈B\A e∈A\B 2We will also call it the ellipsoidal approximation since it is based on approximating a symmetrized version of the submodular polyhedron by an ellipsoid. 3The expansion is described in Section 10.3 in [Narayanan, 1997]. In short, we replace each element e by a set e of f (e) parallel elements. Thereby we extend f to a submodular function i ei. The desired rank function is now the convolution r(·) = f (·) ∗ · and f on subsets of(cid:83) it satisfies f (S) = r((cid:83) e∈S e). 17 fpf (C) =f ({(v1, v4), (v2, v4)}) + f ({(v3, v4), (v3, v5)}) + f ({(v3, v6)}) Figure 3: Approximation of a cut cost. Red edges are in C Π edges in C Π v3 (tail), and the green dash-dotted edge in C Π v4 (head), blue dashed v6 (head). Lemma 5. Let (cid:98)C ∈ argminC∈C f ((cid:98)C) ≤ (cid:0)1 − f (eE\e) where κf = maxe f (e) fs(C;∅). Then C∗ (C∗ − 1)(1 − κf ) + 1 (cid:1) is the curvature of f . f (C∗), (cid:40) Lemma 5 was shown in [Iyer et al., 2013a]. As m (and correspondingly C∗) gets large, the bound eventually no longer depends on m and instead only In practice, results are best when the supergradient on the curvature of f . is used in an iterative algorithm: starting with C0 = ∅, one computes Ct ∈ fs(C; Ct−1) until the solution no longer changes between iterations. argminC∈C The minimum cut for the cost function fs(C; A) can be computed as a minimum cut with edge weights w(e) = f (e E \ e) f (e A) if e ∈ A if e /∈ A. (27) Consequently, the semigradient approximation yields a very easy and practical algorithm that iteratively uses standard minimum cut as a subroutine. This algorithm was used e.g. in [Jegelka and Bilmes, 2011a], and the visual results in [Kohli et al., 2013] show that it typically yields very good solutions in practice on certain problem instances where the optimum solution can be computed exactly. 5.1.3 Approximations by introducing separation The approximations in Section 5.1.1 and 5.1.2 are indifferent to the structure of the graph, while following approximation is not. One may say that Problem (2) is hard because f introduces non-local dependencies between edges that might be anywhere in the graph. Indeed, the problem is easier if dependencies between edges are restricted to local neighborhoods defined by the graph, for example, edges that might be incident to the same vertex. Hence, we define an approximation fpf that is globally separable but locally exact. To measure the cost of an edge set C ⊆ E, we partition C into groups Π(C) = {C Π v must be incident to node v (C Π v may be empty). That is, we assign each edge either to its head or to its tail v }v∈V , where the edges in set C Π 18 Stv1v2v5v6v4v3 node in any partition, as illustrated in Figure 3. Let PC be the family of all such partitions (which vary over the head or tail assignment of each edge). We define an approximation (cid:88) fpf (C) = min Π(C)∈PC f (C Π v ) v∈V (28) that (once the partition is fixed) decomposes across different node incidence edge sets, but is accurate within a group C Π v . Thanks to the subadditivity of f , the function fpf is an upper bound on f . It is a convolution of submodular functions and always is the tightest approximation that is a direct sum over any partition in PC. Perhaps surprisingly, even though the approximation (28) looks difficult to compute and is in general not even a submodular function (an example is in Appendix D), it is possible to solve a minimum cut with cost fpf exactly. To do so, we exploit its duality to a generalized maximum flow problem, namely polymatroidal network flows. Polymatroidal network flows. Polymatroidal network flows [Lawler and Martel, 1982, Hassin, 1982] generalize the capacity constraint of traditional flow problems. They retain the constraint of flow conservation (a function ϕ : E → R+ is a flow if the inflow at each node v ∈ V \ {s, t} equals the outflow). The edge-wise capacity constraint ϕ(e) ≤ cap(e) for all e ∈ E, given a capacity function cap : E → R+ is replaced by local submodular capacities over sets of edges incident at each node v: capin for outgoing edges. The capacity constraints at each v ∈ V are v for incoming edges, and capout v ϕ(A) ≤ capin ϕ(A) ≤ capout v (A) (A) v for all A ⊆ δ−(v) (incoming edges), and for all A ⊆ δ+(v) (outgoing edges). Each edge (u, v) belongs to two incidence sets, δ+u and δ−v. A maximum flow with such constraints can be found in time O(m4τ ) by the layered augmenting path algorithm by Tardos et al. [1986], where τ is the time to minimize a sub- modular function on any set δ+v, δ−v for any v. Hence, the incidence sets are in general much smaller than E. A special polymatroidal maximum flow turns out to be dual to the cut problem we are interested in. To see this, we will use the restriction f A of the function f to a subset A. For ease of reading we drop the explicit restriction notation later. We assume throughout that the desired cut is minimal4, since additional edges can only increase its cost. Lemma 6. Minimum (s, t)-cut with cost function fpf is dual to a polymatroidal network flow with capacities capin v = f δ+v at each node v ∈ V. v = f δ−v and capout The proof is provided in Appendix E. It uses, with some additional consid- erations, the dual problem to a polymatroidal maxflow, which can be stated 4A cut C ⊆ E is minimal if no proper subset B ⊂ C is a cut. 19 capin(C) =(cid:80) as follows. Let capin : 2E → R+ be the joint incoming capacity function, i.e., v (C∩δ−v), and let equivalently capout be the correspond- ing joint outgoing capacity. The dual of the polymatroidal maximum flow is a minimum cut problem whose cost is a convolution of edge capacities [Lov´asz, 1983]: v∈V capin (cid:104) (cid:105) capin(A) + capout(C \ A) . (29) cap(C) = (capin ∗ capout)(C) (cid:44) min A⊆C This convolution is in general not a submodular function. Lemma 6 implies that we can solve the approximate MinCoopCut via its dual flow problem. The primal cut solution will be given by a set of full edges, i.e., edges whose joint flow equals their joint capacity. We can now state the resulting approximation bound for MinCoopCut. Let C∗ be the optimal cut for cost f . We define ∆s to be the tail nodes of the edges in C∗: ∆s = {v ∃(v, u) ∈ C∗}, and similarly, ∆t = {v ∃(u, v) ∈ C∗}. Theorem 3. Let (cid:98)C be the minimum cut for cost fpf , and C∗ the optimal cut The sets ∆s, ∆t provide a measure of the "width" of the graph. for cost f . Then f ((cid:98)C) ≤ min{∆s,∆t} f (C∗) ≤ V 2 f (C∗). Proof. To apply Lemma 3, we need to show that f (C) ≤ fpf (C) for all C ⊆ E, and find an α such that fpf (C∗) ≤ αf (C∗). The first condition follows from the subadditivity of f . To bound α, we use Lemma 6 and Equation 29: fpf (C∗) = (capin ∗ capout)(C∗) (cid:88) ≤ min{capin(C∗), capout(C∗)} f (C∗ ∩ δ+v), ≤ min f (C∗ ∩ δ+v), ≤ min (cid:110)(cid:88) (cid:110) ≤ min(cid:8) v∈∆s ∆s max v∈∆s ∆s, ∆t (cid:9) f (C∗). (cid:111) (cid:111) f (C∗ ∩ δ−v) f (C∗ ∩ δ−v) v∈∆t ∆t max v∈∆t Thus, Lemma 3 implies an approximation bound α ≤ min(cid:8) ∆s, ∆t ≤ (30) (31) (32) (33) (34) (cid:9) V/2. Iyer et al. [2013b] show that the bound in Theorem 3 can be tightened to V 2+(V−2)(1−κf ) by taking into account the curvature κf of f . 5.2 Relaxations An alternative approach to approximating the edge weight function f is to relax the cut constraints via the formulations (23) and (19). We analyze two 20 Algorithm 1 Greedy randomized path cover Input: graph G = (V,E), terminal nodes s, t ∈ V, cost function f : 2E → R+ while(cid:80) C = ∅, y = 0 e∈Pmin y(e) < 1 for the current shortest path Pmin do choose β within the interval β ∈ (0, mine∈Pmin f (eC)] for e in Pmin do with probability β/f (eC), set C = C ∪ {e}, y(e) = 1. end for end while prune C to C(cid:48) and return C(cid:48) algorithms: the first, a randomized algorithm, maintains a discrete solution, while the second is a simple rounding method. Both cases remove the constraint that the cut must be minimal: any set B is feasible that has a subset C ⊆ B that is a cut. Relaxing the minimality constraint makes the feasible set up-monotone (equivalently up-closed). This is not major problem, however, since any superset of a cut can easily be pruned to a minimal cut while only, if anything, improving the solution due to the monotonicity of f . 5.2.1 Randomized greedy covering The constraints in the path-based relaxation (23) suggest that a minimum (s, t)- cut problem is also a min-cost cover problem: a cut must intersect or "cover" each (s, t)-path in the graph. The covering formulation of the constraints in (23) clearly show the relaxation of the minimality constraint. Algorithm 1 solves a discrete variant of the formulation (23) and maintains a discrete y ∈ {0, 1}, i.e., y is eventually the indicator vector of a cut. Since a graph can have exponentially many (s, t)-paths, there can be expo- nentially many constraints. But all that is needed in the algorithm is to find a violated constraint, and this is possible by computing the shortest path Pmin, using y as the (additive) edge lengths. If Pmin's weight is at least one, then y is feasible. Otherwise, Pmin defines a violated constraint in formulation (23). Owing to the form of the constraints, we can adapt a randomized greedy cover algorithm [Koufogiannakis and Young, 2009] to Problem (23) and obtain Algorithm 1. In each step, we compute the shortest path with weights y to find a possibly uncovered path. Ties are resolved arbitrarily. To cover the path, we randomly pick edges from Pmin. The probability of picking edge e is inversely proportional to the marginal cost f (eC) of adding e to the current selection of edges5. We must also specify an appropriate β. With the maximal allowed β = mine∈Pmin f (eC), the cheapest edges are selected deterministically, and others randomly. In that case, C grows by at least one edge in each iteration, 5If mine∈Pmin f (eC) = 0, then we greedily pick all such edges with zero marginal cost, because they do not increase the cost. Otherwise we sample as indicated in the algorithm. 21 and the algorithm terminates after at most m iterations. If the algorithm returns a set C that is feasible but not a minimal cut, it is easy to prune it to a minimal cut C(cid:48) ⊆ C without any additional approximation error, since monotonicity of f implies that f (C(cid:48)) ≤ f (C). Such pruning can for example be done via breadth-first search. Let Vs be the set of nodes reachable from s after the edges in C have been removed. Then we set C(cid:48) = δ+(Vs). The set C(cid:48) must be a subset of C, since if there was an edge (u, v) ∈ C(cid:48) \ C, then v would also be in Vs, and then (u, v) cannot be in C(cid:48), a contradiction. The approximation bound for Algorithm 1 is the length of the longest path, like that of the rounding methods in Section 5.2.2. This is not a coincidence, since both algorithms essentially use the same relaxation. Lemma 7. In expectation (over the probability of sampling edges), Algorithm 1 simple (s, t)-path in G. Indeed, randomization is important. Consider a deterministic algorithm that always picks the edge with minimum marginal cost in the next path to cover. a greedy randomized procedure like Algorithm 1 yields in expectation an α- approximation for a cover, where α is the maximum number of variables in any constraint. Here, α is the maximum number of edges in any simple path, returns a solution (cid:98)C(cid:48) with E[f ((cid:98)C(cid:48))] ≤ Pmaxf (C∗), where Pmax is the longest Proof. Let (cid:98)C be the cut before pruning. Since f is nondecreasing, it holds that f ((cid:98)C(cid:48)) ≤ f ((cid:98)C). By Theorem 7 in [Koufogiannakis and Young, 2009], i.e., the length of the longest path. This implies that E[f ((cid:98)C(cid:48))] ≤ E[f ((cid:98)C)] ≤ Pmaxf (C∗). The solution (cid:98)Cd returned by this algorithm can be much worse. As an example, consider a graph consisting of a clique V of n nodes, with nodes s and t. Let the cost function be a sum of edge weights, f (C) =(cid:80) S ⊆ V be a set of size n/2. Node s is connected to all nodes in S, and node t is connected to the clique only by a distinct node v(cid:48) ∈ V \ S via edge (v(cid:48), t). Let e∈C w(e). Edge (v(cid:48), t) has weight γ > 0, all edges in δ+(S) have weight γ(1 − ) for a small  > 0, and return (cid:98)Cd = δ+(S) as the solution, with cost n2γ all remaining edges have weight γ(1 − /2). The deterministic algorithm will of (cid:98)Cd(1 − ) = n2 4 (1 − ), which is by a factor 4 (1 − ) worse than the optimal cut, f ({(v(cid:48), t)}) = γ. Hence, for the deterministic variant of Algorithm 1, we can only show the following Lemma 8. For the solution (cid:98)Cd returned by the greedy deterministic heuristic, approximation bound: it holds that f ((cid:98)Cd) ≤ (cid:98)Cdf (C∗). This approximation factor cannot be improved Proof. To each edge e ∈ (cid:98)Cd assign the path P (e) which it was chosen to cover. By the nature of the algorithm, it must hold that f (e) ≤ f (C∗ ∩ P (e)), because otherwise an edge in C∗ ∩ P (e) would have been chosen. Since C∗ is a cut, the in general. 22 Algorithm 2 Rounding procedure given y∗ order E such that y∗(e1) ≥ y∗(e2) ≥ . . . ≥ y∗(em) for i = 1, . . . , m do prune Ci to (cid:98)C and return (cid:98)C let Ci = {ej y∗(ej) ≥ y∗(ei)} if Ci is a cut then end if end for f ((cid:98)Cd) ≤ (cid:88) e∈(cid:98)C (cid:88) e∈(cid:98)Cd set C∗ ∩ P (e) must be non-empty. These observations imply that f (C∗ ∩ P (e)) ≤ (cid:98)Cd max e∈(cid:98)Cd f (C∗ ∩ P (e)) ≤ (cid:98)Cdf (C∗). f (e) ≤ Tightness follows from the worst-case example described above. 5.2.2 Rounding Our last approach is to solve the convex program (19) and round the continuous to a discrete solution. We describe two types of rounding, each of which achieves a worst-case approximation factor of n − 1. This factor equals the general flow- cut gap in Lemma 1. Let x∗, y∗ be the optimal solution to the relaxation (19) (equivalently, to (23)). We assume w.l.o.g. that x∗ ∈ [0, 1]n, y∗ ∈ [0, 1]m. Rounding by thresholding edge lengths. The first technique uses the edge weights y∗. We pick a threshold θ and include all edges e whose entry y∗(e) is larger than θ. Algorithm 2 shows how to select θ, namely the largest edge length that when treated as a threshold yields a cut. Lemma 9. Let (cid:98)C be the rounded solution returned by Algorithm 2, θ the thresh- old at the last iteration i, and C∗ the optimal cut. Then f ((cid:98)C) ≤ 1 θ f (C∗) ≤ Pmaxf (C∗) ≤ (n − 1)f (C∗), where Pmax is the longest simple path in the graph. Proof. The proof is analogous to that for covering problems [Iwata and Nagano, 2009]. In the worst case, y∗ is uniformly distributed along the longest path, i.e., y∗(e) = Pmax−1 for all e ∈ Pmax as y∗ must sum to at least one along each path. Then θ must be at least Pmax−1 to include at least one of the edges in Pmax. Since f is nondecreasing like f and also positively homogeneous, it holds that f ((cid:98)C) ≤ f (Ci) = f (χCi) ≤ f (θ−1y∗) = θ−1 f (y∗) ≤ θ−1 f (χC∗ ) = θ−1f (C∗). The first inequality follows from monotonicity of f and the fact that (cid:98)C ⊆ Ci. Similarly, the relation between f (χCi) and f (θ−1y∗) holds because f is 23 nondecreasing: by construction, y∗(e) ≥ θχCi(e) for all e ∈ E, and hence χCi(e) ≤ θ−1y∗(e). Finally, we use the optimality of y∗ to relate the cost to f (C∗); the vector χC∗ is also feasible, but y∗ optimal. The lemma follows since θ−1 ≤ Pmax. Rounding by node distances. Alternatively, we can use x∗ to obtain a discrete solution. We pick a threshold θ uniformly at random from [0, 1] (or find the best one), and choose all nodes u with x∗(u) ≥ θ (call this Vθ). This induces the cut Cθ = δ(Vθ). Since the node labels x∗ can also be considered as distances from s, we refer to this rounding methods as distance rounding. Lemma 10. The worst-case approximation factor for a solution Cθ obtained with distance rounding is Eθ[f (Cθ)] ≤ (n − 1) f (y∗) ≤ (n − 1)f (C∗). Proof. To upper bound the quantity Eθ[f (Cθ)], we partition the set of edges into (n − 1) sets δ+(v), that is, each set corresponds to the outgoing edges of a node v ∈ V. We sort the edges in each δ+(v) in nondecreasing order by their values y∗(e). Consider one specific incidence set δ+(u) with edges eu,1, . . . , eu,h and y∗(eu,1) ≤ y∗(eu,2) ≤ . . . ≤ y∗(eu,h). Edge eu,i is in the cut if θ ∈ [x∗(u), x∗(u) + y∗(eu,i)). Therefore, it holds for each node u that Eθ[f (Cθ ∩ δ+(u))] = = (cid:90) 1 h(cid:88) (y∗(eu,j) − y∗(eu,j−1))f ({eu,j, . . . eu,h}) f (Cθ ∩ δ+(u))dθ 0 j=1 (37) where we define y∗(eu,0) = 0 for convenience, and assume that f (∅) = 0. This implies that = f (y∗(δ+(u))), (35) (36) (38) (39) (cid:88) Eθ[f (Cθ)] ≤ Eθ[ (cid:88) = v∈V f (Cθ ∩ δ+(v))] v∈V f (y∗(δ+(v))) ≤ (n − 1) f (y∗) ≤ (n − 1)f (C∗). (cid:80) v f (y (δ+(v))) ∗ f (y∗) . A more precise approximation factor is 6 Special cases The complexity of MinCoopCut is not always as bad as the worst-case bound in Theorem 1. While it is useful to consider this most general case (see Sec- tion 2.3), we next discuss properties of the submodular cost function and the graph structure that lead to better approximation factors. Our discussion is not specific to cooperative cuts; it is rather a survey of properties that make a number of submodular optimization problems easier. 24 generic (§5.1.1) semigradient (§5.1.2) polymatroidal flow (§5.1.3) deterministic greedy (§5.2.1) O(maxi (cid:112)Bi log Bi) maxi (cid:98)Cd ∩ Bi C∗∩Bi (C∗∩Bi−1)(1−κfi maxi maxi min{∆s ∩ Bi, ∆t ∩ Bi} )+1 (cid:80)k Table 3: Improved approximation bounds for functions of the form f (A) = i=1 fi(A ∩ Bi). The bounds are now determined by the largest support maxi Bi, but not by k. 6.1 Separability and sums with bounded support An important factor for tractability and approximations is the separability of the cost function, that is, whether there are separators of f whose structure aligns with the graph. Definition 1 (Separator of f ). A set S ⊆ E is called a separator of f : 2E → R if for all B ⊆ E, it holds that f (B) = f (B ∩ S) + f (B \ S). The set of separators of f is closed under union and intersection. v v E+ v ∪ (cid:83) f form a partition E = (cid:83) becomes obvious from the proof of Lemma 10, since ((cid:80) The structure of the separators strongly affects the complexity of MinCoop- Cut. First and obviously, the extreme case that f is a modular function (and each e ∈ E is a separator) can be solved exactly. Second, if the separators of v E−v that aligns with node neighborhoods v ⊆ δ+(v), and E−v ⊆ δ−(v), then both fpf and distance round- such that E+ ing solve the problem exactly. No change in the algorithm is needed, i.e., the exact partition need not be known. In that case, the flow-cut gap is zero, as f (y∗Ev ))/ f (y∗) = 1. These separators respect the graph structure and rule out any non-local edge interactions. of separators are functions that are a sum f (A) =(cid:80) Sums of functions with bounded support. A generalization of the case i fi(A∩ Bi) of functions fi, each of which has bounded support Bi. The Bi can be overlapping. In this case, the approximation bounds improve for many of the algorithms in Section 5.1 that rely on a surrogate function, and for the greedy approximation in Lemma 8. Those bounds, summarized in Table 3, can be shown by approximating each fi separately by fi with approximation factor αi that now depends on Bi, and fi(A). This separate approximation is implicit in using f (A) ≤ maxj αj all those algorithms except the approximation from Section 5.1.1. In those implicit cases, no changes need to be made in the implementation and the partition need not be known. For the generic approximation in Section 5.1.1, one can approximate each fi explicitly and separately, if the partition is known. fi or its square is however no longer a minimum Optimizing the resulting sum(cid:80) (cid:80) i i cut problem. It admits an FPTAS [Nikolova, 2010, Kohli et al., 2013]. 25 For the relaxations, it is not immediately clear that the decomposition always leads to improvements. Consider for example a function f (A) = f1(A ∩ B1) + f2(A ∩ B2), where f1(B1) = f2(B2), P (cid:44) Pmax = B1 ∪ B2 and B1 = B2 = Pmax/2. Then f ( 1 χB1 ). In that case, the proof of Lemma 9 P may still require θ−1 = Pmax. 6.2 Symmetry and "unstructured" functions χP ) = f ( 1 B1 tions fi(A) = g((cid:80) contains all functions f (A) =(cid:80)k Going one step further, one may consider sums of that do not necessarily have bounded support but are of a simpler form. An important such class are func- e∈A wi(e)) = g(wi(A)) for nonnegative weights wi(e) and a nondecreasing concave function g. We refer to the submodular functions g(w(A)) as unstructured, because they only consider a sum of weights, but oth- erwise do not make any distinction between edges (unlike, e.g., graphic matroid rank functions). One may classify such functions into a hierarchy, where F(k) j=1 gj(wj(A)) with at most k such components. The functions F(k) are special cases of low-rank quasi-concave functions, where k is the rank of the function. If k = 1, then it suffices to minimize w1(C) directly and the problem reduces to Minimum (s, t)-Cut. For k > 1, several combinatorial problems admit an FPTAS with running time exponential in k [Goyal and Ravi, 2008, Mittal and Schulz, 2012]. This holds for cooperative cuts too [Kohli et al., 2013]. A special w2(A) [Nikolova, case for k = 2 is the mean-risk objective f (A) = w1(A) + 2010]. Goel et al. [2010] show that these functions can yield better bounds in combinatorial multi-agent problems than general polymatroid rank functions, if each agent has a cost function in F(1). Even for general, unconstrained submodular minimization6, the class F(k) admits specialized improved optimization algorithms [Kohli et al., 2009a, Sto- bbe and Krause, 2010, Kolmogorov, 2012, Jegelka et al., 2013]. The complexity of those faster specialized algorithms depends on the rank k as well. An inter- esting question arising from the above observations is whether F(k) contains all submodular functions if k is large enough? The answer is no: even if k is allowed to be exponentially large in the ground set size, this class is a strict sub-class of all submodular functions. If the addition of auxiliary variables is allowed, this class coincides with the class of graph-representable functions in the sense of [Zivn´y et al., 2009]: any graph cut function h : 2V → R+ is in F(E), and any function in F(k) can be represented as a graph cut function in an extended auxiliary graph [Jegelka et al., 2011]. However, not all submodular functions can be represented in this way [Zivn´y et al., 2009]. (cid:112) proved for label cost functions of the form f (A) = (cid:80)k The parameter k is a measure of complexity. If k is not fixed, then Min- CoopCut is NP-hard; for example, the reduction in Section C uses such func- tions. Even more, unrestricted k may induce large lower bounds, as has been j=1 wj min{1,A ∩ Bj} 6For unconstrained submodular function minimization we drop the constraint that the functions gj are nondecreasing. 26 [Zhang et al., 2011]. A subclass of unstructured submodular functions are the aforementioned permutation symmetric submodular functions7 that are indifferent to any per- mutation of the ground set: f (A) = f (σ(A)) for all permutations σ (possibly within a group). This symmetry makes submodular optimization problems eas- ier, as shown in Proposition 3 and work on submodular maximization [Vondr´ak, 2013] and partitioning problems [Ene et al., 2013]. 6.3 Symmetry and graph structure Proposition 3 shows that symmetry and the graph structure can work together to make the cut problem easier, in fact, a submodular minimization problem on graph nodes. Section 2 outlines some examples that come from applications. 6.4 Curvature The curvature κf ∈ [0, 1] of a submodular function f is defined as κf = max e∈E f (e E \ e) f (e) , 1 − (40) and characterizes the deviation from being a modular function. Curvature is known to affect the approximation bounds for submodular maximization [Con- forti and Cornu´ejols, 1984, Vondr´ak, 2008], and also for submodular minimiza- tion problems, approximating and learning submodular functions [Iyer et al., 2013b]. The lower the curvature, the better the approximation factors. For MinCoopCut and many other combinatorial minimization problems with sub- modular costs, the approximation factor is affected as follows. If αn is the worst-case factor (e.g., for the semigradient approximation), then the tightened factor is (αn−1)(1−κf )+1 . The lower bounds can be tightened accordingly. αn 6.5 Flow-cut gaps revisited The above properties that facilitate MinCoopCut reduce the flow-cut gaps in some cases. The proof of Lemma 1 illustrates that the flow-cut gap is in- tricately linked to the edge cooperation (non-separability) along paths in the graph. Therefore, the separability described in Section 6.1 affects the flow-cut gap if it breaks up cooperation along paths: the gap depends only on the longest cooperating path within any separator of f , and this can be much smaller than n. If, however, an instance of MinCoopCut is better solvable because the cost function is a member of F((cid:96)) for small constant (cid:96), then the gap may still be as large as in Lemma 1. In fact, the example in Lemma 1 belongs to F(1): it is equivalent to the function f (A) = γ min{1,A}. Two variants of a final example may serve to better understand the flow- cut (and integrality) gap. The first has a large gap, but the rounding methods 7These are distinct from the other previously-used notion of symmetric submodular func- tions Queyranne [1998] where, for all A ⊆ E, f (A) = f (E \ A). 27 still find an optimal solution. The second has a gap of one, but the rounding methods may return solutions with a large approximation factor. Consider a graph with m edges consisting of m/k disjoint paths of length k each (as in Figure 2), with a cost function f (C) = maxe∈C w(e). The edges are partitioned into a cut B ⊂ E with B = m/k and the remaining edges E \ B. Let w(e) = γ for e /∈ B and w(e) = β for e ∈ B. For the first variant, let β = γ; so that for k = 1, we obtain the graph in Lemma 1. With β = γ (for any k), any minimal cut is optimal, and all rounding methods find an optimal solution. The maximum flow in Problem (21) is ν∗ = γ/k (γ/k flow on one path or γ/m flow on each edge in m/k paths in parallel). Hence, the flow-cut gap is γ/(γ/k) = k despite the optimality of the rounded (and pruned) solutions. For the second variant, let β = γ/k. The maximum flow remains ν∗ = γ/k, and the optimal cut is B with f (B) = γ/k, so f (C∗) = ν∗. An optimal solution y∗ to Program (19) is the uniform vector y∗ = (γ/m)1m. Despite the zero gap, for such y∗ the rounding methods return an arbitrary cut, which can be by a factor k worse than the optimal solution B. In contrast, the approximation algorithms in Sections 5.1.2, 5.1.3 based on substitute cost functions do return an optimal solution. 7 Experiments We provide a summary of benchmark experiments that compare the proposed algorithms empirically. We use two types of data sets. The first is a collection of average-case submodular cost functions on two types of graph structures, clus- tered graphs and regular grids. The second consists of a few difficult examples that show the limits of some of the proposed methods. The task is to find a minimum cooperative cut in an undirected graph8. This problem can be solved directly or via n − 1 minimum (s, t)-cuts. Most of the algorithms solve the (s, t) version. The above approximation bounds still apply, as the minimum cut is the minimum (s, t)-cut for at least one pair of source and sink. We observe that, in general, the algorithms perform well, typically much better than their theoretical worst-case bounds. Which algorithm is best depends on the cost function and graph at hand. Algorithms and baselines. Apart from the algorithms discussed in this ar- ticle, we test some baseline heuristics. First, to test the benefit of the more sophisticated approximations fea and fpf we define the simple approximation (cid:88) fadd(C) = f (e). (41) 8An undirected graph can easily be turned into a directed one by replacing each edge by two opposing directed ones that have the same cost. A cut will always only include one of those edges e∈C 28 with respect to fadd and then selects (cid:98)C = argminC∈C f (C). The minimum cut The first baseline (MC) simply returns the minimum cut with respect to fadd. The second baseline (MB) computes the minimum cut basis C = {C1, . . . , Cn−1} basis can be computed via a Gomory-Hu tree [Bunke et al., 2007]. As a last baseline, we apply an algorithm (QU) by Queyranne [1998] to h(X) = f (δ(X)). This algorithm minimizes symmetric submodular functions in O(n3) time. How- ever, h not always submodular (e.g., see Props. 1, 2, and 3), and therefore this algorithm cannot provide any approximation guarantees in general. In fact, we will see in Section 7.2 that it can perform arbitrarily poorly. Of the algorithms described in this article, EA denotes the generic (ellipsoid- based) approximation of Section 5.1.1. The iterative semigradient approxima- tion from Section 5.1.2 is initialized with a random cut basis (RI) or a minimum- weight cut basis (MI). PF is the approximation via polymatroidal network flows (Section 5.1.3). These three approaches approximate the cost functions. In ad- dition, we use algorithms that solve relaxations of Problems (23) and (19): CR solves the convex relaxation using Matlab's fmincon, and applies Algorithm 2 for rounding. DB implements the distance rounding by thresholding x∗. Finally, we test the randomized greedy algorithm from Section 5.2.1 with the maximum possible β = βmax (GM) and an almost maximal β = 0.9βmax (GA). GH denotes the deterministic greedy heuristic. All algorithms were implemented in Matlab, with the help of a graph cut toolbox [Bagon, 2006, Boykov and Kolmogorov, 2004] and the SFM toolbox [Krause, 2010]. 7.1 Average-case The average-case benchmark data has two components: graphs and cost func- tions. We first describe the graphs, then the functions. Grid graphs. The benchmark contains three variants of regular grid graphs of degree four or six. Type I is a plane grid with horizontal and vertical edges displayed as solid edges in Figure 4(a). Type II is similar, but has additional diagonal edges (dashed in Figure 4(a)). Type III is a cube with plane square grids on four faces (sparing the top and bottom faces). Different from Type I, the nodes in the top row are connected to their counterparts on the opposite side of the cube. The connections of the bottom nodes are analogous. Clustered graphs. The clustered graphs consist of a number of cliques that are connected to each other by few edges, as depicted in Figure 4(b). Cost functions. The benchmark includes four families of functions. The first group (Matrix rank I,II, Labels I, II ) consists of matroid rank functions or sums of three such functions. The functions used here are either based on matrix rank or ranks of partition matroids. We summarize those functions as rank-like costs. 29 (a) Grids I and II (b) Clustered graph Figure 4: Examples of the test graph structures. The grid (a) was used with and without the dashed diagonal edges, and also with a variation of the connections in the first and last row. The clustered graphs were similar to the example shown in (b). The second group (Unstructured I, II ) contains two variants of unstructured functions g(w(C)), where g is either a logarithm or a square root. These func- tions are designed to favor a certain random optimal cut. The construction ensures that the minimum cut will not be one that separates out a single node, but one that cuts several edges. The third family (Bestcut I, II ) is constructed to make a cut optimal that has many edges and that is therefore different from the cut that uses fewest edges. For such a cut, we expect fadd to yield relatively poor solutions. The fourth set of functions (Truncated rank ) is inspired by the difficult trun- cated functions that can be used to establish lower bounds on approximation factors. These functions "hide" an optimal set, and interactions are only visible when guessing a large enough part of this hidden set. The following is a detailed description of all cost functions: Matrix rank I. Each element e ∈ E indexes a column in matrix X ∈ Rd×m. The cost of A ⊆ E is the rank of the sub-matrix XA of the columns indexed by the e ∈ A: fmrI(A) = rank(XA). The matrix X is of the form [ I(cid:48) R ], where R ∈ {0, 1}d×(m−d) is a random binary matrix with d = 0.9√m, and Matrix rank II. The function fmrII(A) = 0.33(cid:80)3 I(cid:48) is a column-wise permutation of the identity matrix. i=1 f (i) mrI(A) sums up three functions f (i) (cid:83) Labels I. This class consists of functions of the form f(cid:96)I(A) = mrI of type matrix rank I with different random matrices X. e∈A (cid:96)(e). Each element e is assigned a random label (cid:96)(e) from a set of 0.8√m possible labels. The cost counts the number of labels in A. Labels II. These functions f(cid:96)II(A) = 0.33(cid:80)3 Unstructured I. These are functions fdpI(A) = log(cid:80) functions of type labels I with different random labels. e∈A w(e), where weights w(e) are chosen randomly as follows. Sample a set X ⊂ V with X = 0.4n, i=1 f (i) (cid:96)I (A) are the sum of three 30 and set w(e) = 1.001 for all e ∈ δX. Then randomly assign some "heavy" weights in [n/2, n2/4] to some edges not in δX, so that each node is incident to one or two heavy edges. The remaining edges get random (mostly integer) weights between 1.001 and n2/4 − n + 1. Unstructured II. These are functions fdpII(A) =(cid:112)(cid:80) define the cost fbcI(A) = 1[A∩ δX∗ ≥ 1] +(cid:80) assigned as for unstructured function II. e∈A w(e) with weights Bestcut I. We randomly pick a connected subset X∗ ⊆ V of size 0.4n and e∈A\δX∗ w(e). The edges in E \ δX∗ are assigned random weights w(e) ∈ [1.5, 2]. If there is still a cut C (cid:54)= δX∗ with cost one or lower, we correct w by increasing the weight of one e ∈ C to w(e) = 2. The optimal cut is then δX∗, but it is usually not the one with fewest edges. Then fbcII(A) = 1[A∩ δX∗ ≥ 1] +(cid:80) Bestcut II. Similar to bestcut I (δX∗ is again optimal), but with submodu- larity on all edges: E is partitioned into three sets, E = (δX∗) ∪ B ∪ C. e∈A∩(B∪C) w(e) + maxe∈A∩B w(e) + maxe∈A∩C w(e). The weights of two edges in B and two edges in C are set to w(e) ∈ (2.1, 2.2). Truncated rank. This function is similar to the truncated rank in the proof of the lower bound (Theorem 1). Sample a connected X ⊆ V with X = 0.3V and set R = δX. The cost is ftr(A) = min{A ∩ R + min{A ∩ R, λ1}, λ2} for λ1 = R and λ2 = 2R. Here, R is not necessarily the optimal cut. (cid:112) To estimate the approximation factor on one problem instance (one graph and one cost function), we divide by the cost of the best solution found by any of the algorithms, unless the optimal solution is known (this is the case for Bestcut I and II ). 7.1.1 Results Figure 5 shows average empirical approximation factors and also the worst ob- served factors. The first observation is that all algorithms remain well below their theoretical approximation bounds9. That means the theoretical bounds are really worst-case results. For several instances we obtain optimal solutions. The general performance depends much on the actual problem instance; the truncated rank functions with hidden structure are, as may be expected, the most difficult. The simple benchmarks relying on fadd perform worse than the more sophisticated algorithms. Queyranne's algorithm performs surprisingly well here. 9Most of the bounds proved above are absolute, and not asymptotic. The only exception is fea. For simplicity, it is here treated as an absolute bound. 31 grid graphs clustered graphs rank-like cost functions (average over 61 (left), 80 (right) instances) unstructured functions (average over 30 (left), 40 (right) instances) bestcut functions (average over 15 (left), 20 (right) instances) truncated rank (average over 15 (left), 20 (right) instances) Figure 5: Results for average-case experiments. The bars show the mean em- pirical approximation factors, and red crosses mark the maximum observed empirical approximation factor. The left column refers to grid graphs, the right column to clustered graphs. The first three algorithms (bars) are baselines, the next four approximate f , the next four solve a relaxation, and the last is the deterministic greedy heuristic. 32 QUMCMBRIMIEAPFCRDBGMGAGH01234approx. factorQUMCMBRIMIEAPFCRDBGMGAGH0123approx. factorQUMCMBRIMIEAPFCRDBGMGAGH00.511.52approx. factorQUMCMBRIMIEAPFCRDBGMGAGH00.511.5approx. factorQUMCMBRIMIEAPFCRDBGMGAGH01234approx. factorQUMCMBRIMIEAPFCRDBGMGAGH01234approx. factorQUMCMBRIMIEAPFCRDBGMGAGH01234approx. factorQUMCMBRIMIEAPFCRDBGMGAGH01234approx. factorQUMCMBRIMIEAPFCRDBGMGAGH00.511.52approx. factorQUMCMBRIMIEAPFCRDBGMGAGH00.511.522.5approx. factor 7.2 Difficult instances Lastly, we show two difficult instances. More examples may be found in [Jegelka, 2012, Ch. 4]. The example demonstrates the drawbacks of using approximations like fadd and Queyranne's algorithm. Our instance is a graph with n = 10 modes, shown in Figure 6. The graph edges are partitioned into n/2 sets, indicated by colors. The black set Ek makes up the cut with the maximum number of edges. The remaining edge sets are constructed as Ei =(cid:8)(vi, vj) ∈ E i < j ≤ n/2(cid:9) A ∩ Ek ≥ 1(cid:3) + fa(A) = 1(cid:2) ∪ (cid:8)(vn/2+i, vj) ∈ E n/2 + i < j ≤ n(cid:9) (42) n/2−1(cid:88) b · 1(cid:2) A ∩ Ei ≥ 1(cid:3) + A ∩ Ek, (43) for each 1 ≤ i < n/2. In Figure 6, set E1 is red, set E2 is blue, and so on. The cost function is i=1 with b = n/2. The function 1[·] denotes the indicator function. The cost of the optimal solution is f (C∗) = f (Ek) = 1 + n2 4  ≈ 1. The second-best solution is the cut δ(v1) with cost f (δv1) = 1 + n2 2 = 6, i.e., it is by a factor of almost b = n/2 worse than the optimal solution. Finally, MC finds the solution δ(vn) with f (δvn) = 1 + n2 4  + b( n Variant (b) uses the cost function 4  + b ≈ 1 + n 2 − 1) ≈ n2 4 = 21. n/2−1(cid:88) fb(A) = 1[A ∩ Ek ≥ 1] + b · 1[A ∩ Ei ≥ 1] i=1 (44) with a large constant b = n2 = 100. For any b > n/2, any solution other than C∗ is more than n2/4 = C∗ > n times worse than the optimal solution. Hence, thanks to the upper bounds on their approximation factors, all algorithms except for QU find the optimal solution. The result of the latter depends on how it selects a minimizer of f (B ∪ e) − f (e) in the search for a pendent pair; this quantity often has several minimizers here. Variant (b) uses a specific adversarial permutation of node labels, for which QU always returns the same solution δv1 with cost b + 1, no matter how large b is: its solution can become arbitrarily poor. 8 Discussion In this work, we have defined and analyzed the MinCoopCut problem, that is, a minimum (s, t)-cut problem with a submodular cost function on graph edges. This problem unifies a number of non-additive graph cut problems in the literature that have arisen in different application areas. We showed an information-theoretic lower bound of Ω(√n) for the general MinCoopCut problem if the function is given as an oracle, and NP-hardness 33 (a) (b) Figure 6: Difficult instance and empirical approximation factors with n = 10 nodes. White bars illustrate theoretical approximation bounds where appli- In (b), the second-best cut δv1 has cost fb(δv1) = b + 1 = 101 (cid:29) cable. max{C∗, n,√m log m}. even if the cost function is fully known and polynomially representable. We propose and compare complementary approximation algorithms that either rely on representing the cost function by a simpler function, or on solving a relaxation of the mathematical program. The latter are closely tied to the longest path of cooperating edges in the graph, as is the flow-cut gap. We also show that the flow-cut gap may be as large as n − 1, and therefore larger than the best approximation factor possible. The lower bound and analysis of the integrality gap use a particular graph structure, a graph with parallel disjoint paths of equal length. Taken all pro- posed algorithms together, all instances of MinCoopCut on graphs with par- allel paths of the same length can be solved within an approximation bound at most √n. This leaves the question whether there is an instance that makes all approximations worse than √n. Section 6 outlined properties of submodular functions that facilitate sub- modular minimization under combinatorial constraints, and also submodular minimization in general. Apart from separability, we defined the hierarchy of function classes F(k). The F(k) are related to graph-representability and might therefore build a bridge between recent results about limitations of represent- ing submodular functions as graph cuts [Zivn´y et al., 2009] (and, even stricter, the limitations of polynomial representability) and the results discussed in Sec- tion 6.2 that provide improved algorithms whose complexity depends on k. 8.1 Open problems This paper is part of a growing collection of work that studies submodular cost functions in combinatorial optimization problems over cuts, trees, matchings, and so on. Such problems are not only of theoretical interest: they occur in a 34 v1vn/2vnvn/2+1QUMCMBRIMIEAPFCRDBGMGAGH0510152025approx. factorQUMCMBRIMIEAPFCRDBGMGAGH020406080100approx. factor spectrum of problems in computer vision [Jegelka and Bilmes, 2011a, Shelhamer et al., 2014, Heng et al., 2015, Taniai et al., 2015] and machine learning [Iyer et al., 2013a, Iyer and Bilmes, 2013, Khalil et al., 2014]. In several cases, the functions used do not directly fall into any of the "easier" sub-classes (e.g., the entropy cuts outlined in Section 2, and also see the discussion in Section 2.3). At the same time, the empirical results in this paper and others [Iyer et al., 2013a] suggest that in many cases, the results of approximate algorithms can still be good, even though in the worst case they are not. Section 6 outlines beneficial properties. Is there a more precise quantification of the complexity of these problems? Do there exist other properties that lead to better algorithms? One direction that is less explored is the interaction of the graph structure with the cost function. Specific to this work, cut functions induce a function on nodes. Proposi- tions 2 and 3 imply that the node function can be submodular, but in very many cases it is not. Yet, the results for Queyranne's algorithm in Section 7 suggest that often the function h may remain close to submodular. This could be the case, for example, if the graph is almost complete and f symmetric, or if the symmetry of f is more restricted. A deeper study of the functions h induced by cooperative cuts could reveal insights about a refined complexity of the problem, and explain the good empirical results. One particular interesting example was the polymatroidal flow case where the function f defined in Eqn. (28) was not necessarily submodular (see Proposition 5), but where the resulting h (also not necessarily submodular) could be optimized exactly in polynomial time. This suggests an interesting future direction, namely to fully characterize a class of functions f for which polytime algorithms can be obtained to solve minimum "interacting cut" problems (i.e., cut problems where the edges may interact but not necessarily in a purely submodular or supermodular fashion). The dual polymatroidal flow case shows one instance of interacting cut that can be solved exactly. Finally, finding optimal bounds and algorithms for related cut problems with submodular edge weights is an open problem. Appendix A outlines some initial results for cooperative multi-way and sparsest cut. References R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Network Flows. Prentice Hall, 1993. C. All`ene, J.-Y. Audibert, M. Couprie, and R. Keriven. Some links between Image and Vision extremum spanning forests, watersheds, and min-cuts. Computing, 2009. S. Bagon. Matlab wrapper for graph cut, December 2006. http://www.wisdom. weizmann.ac.il/~bagon. 35 N. Balcan and N. Harvey. Submodular functions: Learnability, structure, and optimization. arXiv:0486478, 2012. F. Baumann, S. Berckey, and C. Buchheim. Facets of Combinatorial Opti- mization - Festschrift for Martin Grotschel, chapter Exact Algorithms for Combinatorial Optimization Problems with Submodular Objective Functions, pages 271–294. Springer, 2013. J. Bilmes. Dynamic graphical models – an overview. IEEE Signal Processing Magazine, 27(6):29–42, 2010. J. Bilmes and C. Bartels. On triangulating dynamic graphical models. In Uncertainty in Artificial Intelligence, pages 47–56, Acapulco, Mexico, 2003. Morgan Kaufmann Publishers. Y. Boykov and M.-P. Jolly. Interactive graph cuts for optimal boundary and In Int. Conf. on Computer region segmentation of objects in n-d images. Vision (ICCV), 2001. Y. Boykov and V. Kolmogorov. An experimental comparison of min-cut/max- flow algorithms for energy minimization in vision. IEEE Trans. on Pattern Analysis and Machine Intelligence, 26(9):1124–1137, 2004. Y. Boykov and O. Veksler. Handbook of Mathematical Models in Computer Vi- sion, chapter Graph Cuts in Vision and Graphics: Theories and Applications. Springer, 2006. F. Bunke, H. W. Hamacher, F. Maffioli, and A. Schwahn. Minimum cut bases in undirected networks. Report in Wirtschaftsmathematik (WIMA Report) 108, Universitat Kaiserslautern, 2007. A. Chambolle and J. Darbon. On total variation minimization and surface evolution using parametric maximum flows. Int. Journal of Computer Vision, 84(3), 2009. C. Chekuri, S. Kannan, A. Raja, and P. Viswanath. Multicommodity flows and cuts in polymatroidal networks. In Innovations in Theoretical Computer Science (ITCS), 2012. M. Conforti and G. Cornu´ejols. Submodular set functions, matroids and the greedy algorithm: tight worst-case bounds and some generalizations of the Rado-Edmonds theorem. Discrete Applied Mathematics, 7(3):251–274, 1984. C. Couprie, L. Grady, H. Talbot, and L. Najman. Combinatorial continuous maximum flow. SIAM Journal on Imaging, pages 905–930, 2011. W. H. Cunningham. Decomposition of submodular functions. Combinatorica, 3(1):53–68, 1983. G. Dantzig and D. Fulkerson. On the max flow min cut theorem of networks. Technical Report P-826, The RAND Corporation, 1955. 36 A. Ene, J. Vondr´ak, and Y. Wu. Local distribution and the symmetry gap: In Proc. SIAM-ACM Approximability of multiway partitioning problems. Symp. on Discrete Algorithms (SODA), 2013. A. Fix, T. Joachims, S. M. Park, and R. Zabih. Structured learning of sum-of- submodular higher order energy functions. In Int. Conf. on Computer Vision (ICCV), 2013. L. Ford and D. Fulkerson. Maximal flow through a network. Canadian Journal of Mathematics, 8:399–404, 1956. M. R. Garey, D. S. Johnson, and L. Stockmeyer. Some simplified NP-complete graph problems. Theoretical Computer Science, 1(3):237–267, 1976. G. Goel, C. Karande, P. Tripati, and L. Wang. Approximability of combinatorial problems with multi-agent submodular cost functions. In Proc. IEEE Symp. on Foundations of Computer Science (FOCS), 2009. G. Goel, P. Tripathi, and L. Wang. Combinatorial problems with discounted price functions in multi-agent systems. In Foundations of Software Technology and Theoretical Computer Science (FSTTCS), 2010. M. Goemans, N. J. A. Harvey, S. Iwata, and V. S. Mirrokni. Approximating submodular functions everywhere. In Proc. SIAM-ACM Symp. on Discrete Algorithms (SODA), 2009. M. X. Goemans, N. J. A. Harvey, R. Kleinberg, and V. S. Mirrokni. On learning submodular functions – a preliminary draft. Unpublished Manuscript. V. Goyal and R. Ravi. An FPTAS for minimizing a class of low-rank quasi- concave functions over a convex domain. Technical Report 366, Tepper School of Business, Carnegie Mellon University, 2008. D. M. Greig, B. T. Porteous, and A. H. Seheult. Exact maximum a posteriori estimation for binary images. Journal of the Royal Statistical Society, 51(2), 1989. R. Hassin. Minimum cost flow with set constraints. Networks, 12:1–21, 1982. R. Hassin, J. Monnot, and D. Segev. Approximation algorithms and hardness results for labeled connectivity problems. J. Comb. Optim., 14(4):437–453, 2007. L. Heng, A. Gotovos, A. Krause, and M. Pollefeys. Efficient visual exploration and coverage with a micro aerial vehicle in unknown environments. In IEEE Int. Conf. on Robotics and Automation (ICRA), 2015. S. Iwata and K. Nagano. Submodular function minimization under covering con- straints. In Proc. IEEE Symp. on Foundations of Computer Science (FOCS), 2009. 37 R. Iyer and J. Bilmes. Submodular optimization with submodular cover and submodular knapsack constraints. In Neural Information Processing Society (NIPS), 2013. R. Iyer, S. Jegelka, and J. Bilmes. Fast semidifferential-based submodular func- tion optimization. In Proc. Int. Conf. on Machine Learning (ICML), 2013a. R. Iyer, S. Jegelka, and J. Bilmes. Curvature and optimal algorithms for learn- ing and minimizing submodular functions. In Neural Information Processing Society (NIPS), 2013b. S. Jegelka. Combinatorial Problems with submodular coupling in machine learn- ing and computer vision. PhD thesis, ETH Zurich, 2012. S. Jegelka and J. Bilmes. Submodularity beyond submodular energies: cou- pling edges in graph cuts. In IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2011a. S. Jegelka and J. Bilmes. Approximation bounds for inference using cooperative cuts. In Proc. Int. Conf. on Machine Learning (ICML), 2011b. S. Jegelka, H. Lin, and J. Bilmes. On fast approximate submodular minimiza- tion. In Neural Information Processing Society (NIPS), 2011. S. Jegelka, F. Bach, and S. Sra. Reflection methods for user-friendly submodular optimization. In Neural Information Processing Society (NIPS), 2013. S. Jha, O. Sheyner, and J. Wing. Two formal analyses of attack graphs. In Proc. of the 15th Computer Security Foundations Workshop, pages 49–63, 2002. S. Kannan and P. Viswanath. Multiple-unicast in fading wireless networks: A In IEEE Int. Symposium on separation scheme is approximately optimal. Information Theory (ISIT), 2011. S. Kannan, A. Raja, and P. Viswanath. Local phy + global flow: A layering In IEEE Int. Symposium on Information principle for wireless networks. Theory (ISIT), 2011. E. B. Khalil, B. Dilkina, and L. Song. Scalable diffusion-aware optimization of network topology. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 1226–1235. ACM, 2014. P. Kohli, M. Kumar, and P. Torr. P3 & beyond: Move making algorithms for solving higher order functions. IEEE Trans. on Pattern Analysis and Machine Intelligence, pages 1645–1656, 2009a. P. Kohli, L. Ladick´y, and P. Torr. Robust higher order potentials for enforcing label consistency. International Journal of Computer Vision, 82(3):302–324, 2009b. 38 P. Kohli, A. Osokin, and S. Jegelka. A principled deep random field for image segmentation. In IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2013. V. Kolmogorov. Minimizing a sum of submodular functions. Discrete Applied Mathematics, 160(15), 2012. V. Kolmogorov and Y. Boykov. What metrics can be approximated by geo-cuts, or global optimization of length/area and flux. In Int. Conf. on Computer Vision (ICCV), 2005. V. Kolmogorov and R. Zabih. What energy functions can be minimized via graph cuts? IEEE Trans. on Pattern Analysis and Machine Intelligence, 26 (2):147–159, 2004. C. Koufogiannakis and N. E. Young. Greedy ∆-approximation algorithm for covering with arbitrary constraints and submodular costs. In Int. Colloquium on Automata, Languages and Programming (ICALP), 2009. A. Krause. SFO: A toolbox for submodular function optimization. Journal of Machine Learning Research, 11:1141–1144, 2010. E. L. Lawler and C. U. Martel. Computing maximal "Polymatroidal" network flows. Mathematics of Operations Research, 7(3):334–347, 1982. H. Lin and J. Bilmes. Learning mixtures of submodular shells with application to document summarization. In Uncertainty in Artificial Intelligence (UAI), 2012. L. Lov´asz. Mathematical programming – The State of the Art, chapter Submod- ular Functions and Convexity, pages 235–257. Springer, 1983. S. Mittal and A. Schulz. An FPTAS for optimizing a class of low-rank functions over a polytope. Mathematical Programming, 2012. M. Mitzenmacher and E. Upfal. Probability and Computing: Randomized Algo- rithms and Probabilistic Analysis. Cambridge University Press, 2005. H. Narayanan. Submodular Functions and Electrical Networks. Elsevier Science, 1997. E. Nikolova. Approximation algorithms for reliable stochastic combinatorial optimization. In APPROX, 2010. M. Queyranne. Minimizing symmetric submodular functions. Mathematical Programming, 82:3–12, 1998. S. Ramalingam, P. Kohli, K. Alahari, and P. Torr. Exact inference in multi- label CRFs with higher order cliques. In IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2008. 39 S. Ramalingam, C. Russell, L. Ladicky, and P. H. S. Torr. Efficient minimiza- tion of higher order submodular functions using monotonic boolean functions. ArXiv 1109.2304, 2011. L. I. Rudin, S. Osher, and E. Fatemi. Nonlinear total variation based noise removal algorithms. Physica D, (60), 1992. A. Schrijver. Combinatorial Optimization. Springer, 2004. E. Shelhamer, S. Jegelka, and T. Darrell. Communal cuts: Sharing cuts across images. In NIPS workshop on Discrete Optimization in Machine Learning, 2014. N. Silberman, L. Shapira, R. Gal, and P. Kohli. A contour completion model for augmenting surface reconstructions. In Europ. Conf. on Computer Vision (ECCV), 2014. A. Sinop and L. Grady. A seeded image segmentation framework unifying graph In Int. Conf. on cuts and random walker which yields a new algorithm. Computer Vision (ICCV), 2007. R. P. Stanley. Enumerative Combinatorics, volume I of Cambridge Studies in Advanced Mathematics. Cambridge University Press, 1997. P. Stobbe and A. Krause. Efficient minimization of decomposable submodular functions. In Neural Information Processing Society (NIPS), 2010. P. Stobbe and A. Krause. Learning Fourier sparse set functions. In Conference on Artificial Intelligence and Statistics (AISTATS), 2012. Z. Svitkina and L. Fleischer. Submodular approximation: Sampling-based algo- rithms and lower bounds. In Proc. IEEE Symp. on Foundations of Computer Science (FOCS), 2008. T. Taniai, Y. Matsushita, and T. Naemura. Superdifferential cuts for binary en- ergies. In IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2015. E. Tardos, C. A. Tovey, and M. A. Trick. Layered augmenting path algorithms. Mathematics of Operations Research, 11(2), 1986. S. Tschiatschek, R. Iyer, H. Wei, and J. Bilmes. Learning mixtures of submod- In Neural Information ular functions for image collection summarization. Processing Society (NIPS), 2014. J. Vondr´ak. Submodularity and curvature: the optimal algorithm. RIMS Kokyuroku Bessatsu, 2008. J. Vondr´ak. Symmetry and approximability of submodular maximization prob- lems. SIAM J on Computing, 42(1):265–304, 2013. 40 P. Zhang, C. J.-Y, L.-Q. Tang, and W.-B. Zhao. Approximation and hardness results for label cut and related problems. Journal of Combinatorial Opti- mization, 2011. S. Zivn´y, D. A. Cohen, and P. G. Jeavons. The expressive power of binary sub- modular functions. Discrete Applied Mathematics, 157(15):3347–3358, 2009. A Cooperative multi-cut and sparsest cut An extension of MinCoopCut is the problem of cooperative multi-way cut and sparsest cut. Using the approximation fea from Section 5.1.3, we can transform any multi-way or sparsest cut problem with a submodular cost function on edges (instead of a sum of edge weights) into a cut problem whose cut cost is a convolution of local submodular functions. The relaxation of this cut problem is dual to the polymatroidal flow problems considered by Chekuri et al. [2012]. Combining their results with ours, we get the following Lemma. Lemma 11. Let α be the approximation factor for solving a sparsest cut / multi-way cut in a polymatroidal network. If we solve a cooperative sparsest cut / multi-way cut by first approximating the cut cost f by a function fea and, on this instance, using the method with factor α, we get an O(αn)-approximation for cooperative sparsest cut / multi-way cut. Using Theorems 6 and 8 in [Chekuri et al., 2012], we obtain the following bounds: Corollary 2. There is an O(n log k) approximation for cooperative sparsest cut in undirected graphs that is dual to a maximum multicommodity flow problem with k pairs, and an O(n log k) approximation for cooperative multi-way cut. We leave it as an open problem whether these bounds are optimal. B Proof of Proposition 2 The first part of Proposition 2 is proven by Figure 1. Here, we show the second part that the function h(X) = f (δ+(X)) is subadditive if f is nondecreasing and submodular. Let X, Y ⊆ V. Then it holds that h(X) + h(Y ) = f (δ+(X)) + f (δ+(Y )) ≥ f (δ+(X) ∪ δ+(Y )) + f (δ+(X) ∩ δ+(Y )) ≥ f (δ+(X) ∪ δ+(Y )) ≥ f (δ+(X ∪ Y )) = h(X ∪ Y ). (45) (46) (47) (48) (49) In Inequality (46), we used that f is submodular, and in Inequality (47), we used that f is nonnegative. 41 (a) graph G with Es (blue), Et (red) and GB (black) (b) graph Hσ (c) hσ(φ(C)) = 5 connected components (d) balanced cut C: hσ(φ(C)) = 3 con- nected components Figure 7: Graph for the reduction and examples for the definition of fbal In (c), Cs = {(s, v1), (s, v2)} and Ct = via ranks hσ, with nB = 6. {(v3, t), (v4, t), (v5, t), (v6, t)}; in (d), Cs = {(s, v1), (s, v4), (s, v5)} and Ct = {(v2, t), (v3, t), (v6, t)}. Connected components are indicated by dashed lines. C Reduction from Graph Bisection to MinCoop- Cut In this section, we prove Theorem 2 via a reduction from Graph Bisection, which is known to be NP-hard [Garey et al., 1976]. Definition 2 (Graph Bisection). Given a graph GB = (VB,EB) with edge weights wB : EB → R+, find a partition V1 ∪V2 = VB with V1 = V2 = VB/2 with minimum cut weight w(δ(V1)). Proof. To reduce Graph Bisection to MinCoopCut, we construct an auxil- iary graph G = (VB ∪ {s, t},EB ∪ Es ∪ Et) that contains an unchanged copy of GB and two additional terminal nodes s, t. The submodular weights on the edges adjacent to the terminal nodes will express the balance constraint V1 = V2 = VB/2. In G, we retain the modular costs w on EB and connect s, t to every vertex in GB with corresponding new edge sets Es and Et, as illus- trated in Figure 7(a). The cost of a cut in G is measured by the submodular function (50) (cid:88) f (C) = w(e) + βfbal(C ∩ (Es ∪ Et)), e∈C∩EB where β is an appropriately large constant, and fbal will be defined later. Obvi- ously, any minimal (s, t)-cut C must include nB = VB edges from Es ∪ Et, and partitions VB. Moreover, the cardinality of Cs = C ∩ Es is the number of nodes in VB assigned to t. Hence, in an equipartition, Cs = Ct = nB/2, where Ct = C ∩ Et. 42 st(s,v1)(v1,t)(s,v2)(s,v3)(s,v4)(s,v5)(s,v6)(v2,t)(v3,t)(v4,t)(v5,t)(v6,t)(s,v1)(v1,t)(s,v2)(s,v3)(s,v4)(s,v5)(s,v6)(v2,t)(v3,t)(v4,t)(v5,t)(v6,t)CsCt(s,v1)(v1,t)(s,v2)(s,v3)(s,v4)(s,v5)(s,v6)(v2,t)(v3,t)(v4,t)(v5,t)(v6,t)CsCt It remains to define fbal as a nondecreasing submodular function that im- plements the equipartition constraint. The function will be an expectation over matroid rank functions hσ. Let Hσ = (Es,Et,Fσ) be a bipartite graph with nodes Es ∪ Et whose edges Fσ form a derangement between Es and Et, as illus- trated in Fig. 7(b). Let φ(Cs ∪ Ct) be the image of Cs ∪ Ct in the set of nodes of Hσ. The function hσ : 2φ(Es∪Et) → N0 counts the number of connected components in the subgraph induced by the nodes φ(Cs ∪ Ct), and is the rank of a partition matroid. Figure 7 shows some examples. Let S be the set of all derangements σ of nB elements, i.e., all possible edge configurations in Hσ. We define fbal to be the expectation (under uniform draws of σ) fbal(C) = Eσ[hσ(φ(C))] = S−1(cid:88) hσ(φ(C)). (51) σ∈S For a fixed derangement σ(cid:48) and a fixed size Cs∪Ct = nB, the value hσ(cid:48)(Cs∪Ct) is minimal if σ(cid:48)(Cs) = Ct and Cs = Ct. For a fixed σ, the rank hσ(C) is φ(Cs ∪ Ct) = Cs + Ct minus the matching nodes. Denoting (s, vi) in Hσ by xi and (vi, t) by yi, the rank is (cid:88) σ∈S hσ(φ(Cs) ∪ φ(Ct)) = Cs + Ct − Hence, the sum in (51) becomes (cid:0) (cid:0) hσ(C) = S Cs + Ct Cs + Ct − − = S i=1 ∩ (φ(Cs) × φ(Ct)) (cid:12)(cid:12)(cid:12)(cid:8)(xi, yσ(i))(cid:9)n (cid:88) (cid:12)(cid:12)(cid:8)(xi, yσ(i))(cid:9)n (cid:88) (cid:88) (cid:12)(cid:12)(cid:12). (52) i=1 ∩ (φ(Cs) × φ(Ct))(cid:12)(cid:12) (53) (cid:12)(cid:12)(xi, yσ(i)) ∩ ({xi} × φ(Ct))(cid:12)(cid:12) (54) σ∈S xi∈φ(Cs) σ∈S (cid:1) (cid:1) To compute the sum over σ in the second term, let Cs∩t (cid:44) {(s, v){(s, v), (v, t)} ⊆ C} be the set of s-edges whose counterpart on the t side is also contained in C. Let further D(cid:48)(nB − 1) denote the number of permutations of nB − 1 elements (pair (xi, yk), i.e., σ(i) = k, is fixed), where one specific element xk can be mapped to any other of the nB − 1 elements, and the remaining elements must not be mapped to their counterparts (σ(j) (cid:54)= j). Then there are D(cid:48)(nB − 1) derangements σ realizing a specific mapping σ(i) = k. Denoting the number of derangements of n elements by D(n), the sum above becomes D(nB)fbal(C) = (Cs + Ct)D(nB) (cid:88) (cid:88) (cid:1) − xi∈Cs\Cs∩t yk∈Ct = (Cs + Ct)D(nB) Cs − Cs∩t (cid:0) − (cid:88) (cid:88) xi∈Cs∩t yk∈Ct,k(cid:54)=i (55) D(cid:48)(nB − 1) D(cid:48)(nB − 1) − (56) CtD(cid:48)(nB − 1) − Cs∩t(Ct − 1)D(cid:48)(nB − 1) (57) = (Cs + Ct)D(nB) − (CsCt − Cs∩t)D(cid:48)(nB − 1), 43 with D(n) = S = n!(cid:80)n k=0(−1)k/k! [Stanley, 1997], and D(cid:48)(n−1) =(cid:80)n−1 k=0 (n− 2)!(n − 1 − k)!(−1)k by Proposition 4 below. Given that Cs +Ct must cut at least nB edges and that fbal is increasing, fbal is minimized if Cs = Ct = nB/2. As a result, if β is large enough such that fbal dominates the cost, then a minimum cooperative cut in G bisects the GB subgraph of G optimally. Proposition 4. Let D(cid:48)(n) be the number of permutations of n elements where for one fixed element i(cid:48) we allow σ(i(cid:48)) ∈ {1, . . . , n}, but σ(i) (cid:54)= i for all i (cid:54)= i(cid:48). Proof. D(cid:48)(n) can be derived by the method of the forbidden board [Stanley, 1997, pp. 71-73]. Let, without loss of generality, i(cid:48) = n, so the forbidden board is B = {(1, 1), (2, 2), . . . , (n − 1, n − 1)}. Let Nj be the number of permutations Then D(cid:48)(n) =(cid:80)n i=1 ∩ B(cid:12)(cid:12) = j, and let rk be the number of k-subsets of B σ for which(cid:12)(cid:12){(i, σ(i)}n such that no two elements have a coordinate in common. Here, rk = (cid:0)n−1 (cid:1). n(cid:88) Then D(cid:48)(n) = N0 = Nn(0) for (n − k)!(−1)k. (cid:88) k (n−1)! k! k=0 rk(n − k)!(x − 1)k = k=0 (n − 1)! k! (n − k)(x − 1)k, n(cid:88) k=0 Nn(x) = Njxj = j and hence D(cid:48)(n) =(cid:80)n (n−1)! k! (n − k)!(−1)k. (58) k=0 D Convolutions of submodular functions are not always submodular The non-submodularity of convolutions was mentioned already in [Lov´asz, 1983]. For completeness, we show an explicit example that illustrates that non-submodularity also holds for the special case of polymatroidal flows. Proposition 5. The convolution of two submodular functions (f ∗ g)(A) = minB⊆A f (B) + g(A \ B) is not in general submodular. In particular, this also holds for the cut cost functions occurring in the dual problems of polymatroidal maximum flows. To show Proposition 5, consider the graph in Figure 5 with a submodular edge cost function f (A) = maxe∈A w(e). The two submodular functions that are convolved in the corresponding polymatroidal flow are the decompositions capout(A) = capin(A) = f (A ∩ δ+(v)) f (A ∩ δ−(v)). (59) (60) (cid:88) (cid:88) v∈V v∈V 44 Let f (A) = maxe∈A w(e) and w(e1) = w(e2) = a, w(e3) = b, w(e4) = w(e5) = . Figure 8: Example showing that the convolution of submodular functions is not always submodular, e.g., for a = 1.5, b = 2 and  = 0.001. Both capout and capin are submodular functions from 2E to R+. Their convo- lution h is h(A) = (capout ∗ capin)(A) = min B⊆A capout(B) + capin(A \ B) = fpf (A). (61) For h to be submodular, it must satisfy the condition of diminishing marginal costs, i.e., for any e and A ⊆ B ⊆ E \ e, it must hold that h(e A) ≥ h(e B). Now, let A = {e2} and B = {e1, e2}. The convolution here means to pair e3 either with e1 or e2. Then, if a < b, h(e3 A) = min{a + b, b} − a = b − a h(e3 B) = a + b − min{a + a, a} = b. (62) (63) Hence, h(e3 A) < h(e3 B), disproving submodularity of h. E Cooperative Cuts and Polymatroidal Networks We next prove Lemma 6 that relates the approximation fpf to maxflow problems in polymatroidal networks. Proof. (Lemma 6) The first step is the dual of the polymatroidal flow. Let v (C ∩ δ−v), and let equivalently capout be the joint outgoing capacity. The dual of the polymatroidal maximum flow is a minimum cut problem whose cost is a convolution of edge capacities [Lov´asz, 1983]: capin : 2E → R+ be the joint incoming capacity, capin(C) = (cid:80) (cid:2)capin(A) + capout(C \ A)(cid:3). cap(C) = (capin ∗ capout)(C) (cid:44) min A⊆C v∈V capin (64) We will relate this dual to the approximation fpf . Given a minimal (s, t)-cut C, let Π(C) be a partition of C, and C in v . The cut C partitions the nodes into two sets Vs containing s and Vt containing t. Since C is a minimal directed cut, it contains only edges from the s side Vs to the t side Vt of the graph. In consequence, C in v = ∅ if v is on the s side, and C out v = ∅ otherwise. Hence, C in , and since v ∩ δ−v and C out is equal to either C in v ∪ C out v or C out v = C Π v = C Π v ∩ δ+ v v 45 s1t2e1e2e3e4e5 v ) v∈V ) = f (C in v ) + f (C out v v∈V f (C in f (C Π v ) (cid:88) (cid:88) (cid:88) )(cid:3) (cid:88) (cid:2)capin(C in) + capout(C out)(cid:3) (cid:2)capin(C in) + capout(C \ C in)(cid:3) v ∪ C out v ) + f (C out (cid:2)f (C in (cid:2)capin v ) + capout v (C in v∈V v∈V v (C out v v fpf (C) = min Π(C)∈PC = min Π(C)∈PC = min Π(C)∈PC = min Π(C)∈PC = min Cin,Cout = min Cin⊆C )(cid:3) (65) (66) (67) (68) (69) (70) (71) f (∅) = 0, it holds that f (C in the definition of fpf , v ∪ C out v ). Then, starting with = (capin ∗ capout)(C). tion C in = (cid:83) (cid:83) The minimum in Equation (67) is taken over all feasible partitions Π(C) and their resulting intersections with the sets δ+v, δ−v. Then we use the nota- for all edges assigned to their head nodes, and C out = . The minima in Equations (69) and (70) are again taken over all v∈V partitions in PC. The final equality follows from the above definition of a con- volution of submodular functions. C out C in v v∈V v 46
1701.08517
1
1701
2017-01-30T09:22:08
The Intermittent Traveling Salesman Problem with Different Temperature Profiles: Greedy or not?
[ "cs.DS" ]
In this research, we discuss the intermittent traveling salesman problem (ITSP), which extends the traditional traveling salesman problem (TSP) by imposing temperature restrictions on each node. These additional constraints limit the maximum allowable visit time per node, and result in multiple visits for each node which cannot be serviced in a single visit. We discuss three different temperature increase and decrease functions, namely a linear, a quadratic and an exponential function. To solve the problem, we consider three different solution representations as part of a metaheuristic approach. We argue that in case of similar temperature increase and decrease profiles, it is always beneficial to apply a greedy approach, i.e. to process as much as possible given the current node temperature.
cs.DS
cs
The Intermittent Traveling Salesman Problem with Different Temperature Profiles: Greedy or not? Pieter Leyman, San Tu Pham and Patrick De Causmaecker CODeS, Department of Computer Science & imec-ITEC, KU Leuven KULAK Etienne Sabbelaan 53, 8500 Kortrijk (Belgium) Email: [email protected], [email protected], [email protected] 7 1 0 2 n a J 0 3 ] S D . s c [ 1 v 7 1 5 8 0 . 1 0 7 1 : v i X r a Abstract -- In this research, we discuss the intermittent trav- eling salesman problem (ITSP), which extends the traditional traveling salesman problem (TSP) by imposing temperature restrictions on each node. These additional constraints limit the maximum allowable visit time per node, and result in multiple visits for each node which cannot be serviced in a single visit. We discuss three different temperature increase and decrease functions, namely a linear, a quadratic and an exponential function. To solve the problem, we consider three different solution representations as part of a metaheuristic approach. We argue that in case of similar temperature increase and decrease profiles, it is always beneficial to apply a greedy approach, i.e. to process as much as possible given the current node temperature. I. INTRODUCTION In industry, drilling operations on pieces of material often increase the temperature of the component. In order to avoid overheating the material at any one point, the processing operation is split into multiple parts. This implies that nodes may need to be visited more than once. Additionally, there may be a waiting time at some nodes to be able to continue processing. Similar to [7], we translate the problem to a traveling salesman problem (TSP) variant, with multiple visits per node. The resulting problem is called the intermittent traveling salesman problem (ITSP), due to the required time between different visits of a node to avoid overheating. The TSP has been studied in depth in the field of combi- natorial optimization [3], [4], but several variants exist. To clearly distinguish the ITSP from existing extensions, we briefly discuss the most similar problems. • The TSP with multiple visits (TSPM) [3]: similar to the ITSP each node has to be visited several times, but unlike in the ITSP no time constraints exist between multiple visits. • The TSP with time windows (TSPTW) [2]: time windows within which the node has to be visited are associated to each node, but multiple visits are not required. • The inventory routing problem (IRP) [1]: in the IRP, the goal is to find the best shipping policy to supply several retailers (nodes) with a common product subject to ve- hicle capacities, minimum required demand and limited storage capacity at the retailers. The major difference with the ITSP lies in the effect of traveling time on inventory levels. Whereas in the ITSP the temperature at a node decreases during travel time, in the IRP traveling routes compose one discrete period. In the remainder of this paper, we first discuss the problem definition with different temperature profiles in section II, before going into detail about the proposed metaheuristic approach in section III. Preliminary results for the temperature profiles and metaheuristic variations are the focus of section IV, whereas we finish with a conclusion and future work in section V. II. PROBLEM DEFINITION A network of nodes can be represented by an undirected graph G = (N, A), with N the nodes or points and A the arcs or routes between different points. Each node i (i ∈ N = {1, . . . , n}) has a processing time pi, and the distance between each pair of nodes (i, j) is dij. It is explicitly assumed that dij = dji and that the triangle inequality holds. Due to the temperature constraint (maximum temperature of B at each node), nodes may have to be visited more than once. The goal is to minimize the total completion time, i.e. the time at which all nodes have been fully processed and the "salesman" has returned to its starting node. The objective function value consists of the total processing time of each node, the distances of the selected routes between the nodes, and any waiting time required in case the temperature at a node is too high but we want to process anyway (section III). As a result, the corresponding TSP without temperature constraints serves as a lower bound for the ITSP. To model the temperature of a node i at a time t, we use equations (1) and (2). The first equation determines the number of consecutive time units that have been processed for node i at time t (cit), based on yit which is a binary variable equal to one if node i is processed at time t and zero otherwise. If job i is processed at time t equation (1) increases by one, whereas otherwise it decreases by one with a minimum value of zero for cit. ci0 is equal to zero for all nodes i. cit = (cit−1 + 1) · yit + max(cit−1 − 1; 0) · (1 − yit), ∀t > 0,∀i ∈ N (1) Equation (2) sets the temperature Bit of a node i at time t based on the corresponding value of cit. An increase function f1 and a decrease function f2, which determine the A. Solution representation The choice of solution representation is important since we not only have to determine the order in which the different nodes are visited, but also the amount of time processed for each visit. Since, to the best of our knowledge, no previous research exists on the impact of solution representations for the ITSP, we employ three different approaches in order to determine their impact on the solution quality. (cid:109) (cid:98)f (cid:108) 1) A single list (1L) representation consisting of a node list (NL). The NL contains the node numbers in the order in which they are processed, but due to the nature of the times. This func- ITSP each node i occurs tion determines the maximum required number of splits for each node, depending on pi, B and the temperature increase function f1(t). The maximum required number of splits corresponds with a greedy approach since in this case we choose to always process as much as possible during a visit given the current node temperature. Only for the final visit is waiting included if required. pi −1 1 (B)(cid:99) 2) A two list (2L) representation with a NL and a process- ing time list (PTL). The NL again contains the order in which the nodes are processed, but each node i occurs pi times instead of just a single time. The PTL then holds the actual processing times at each occurrence of a node i, with a total value over all occurrences equal to pi. PTL values may be equal to zero to signify that less than pi splits are used for node i. As a result, these visits without processing time may increase the total duration because of distances traveled. 3) A three list (3L) representation with a NL, a PTL and a split list (SL). The third list is the number of visits or splits for each node, and its value lies within the interval {1; pi} for each node i. A value of 1 means that this node is only visited once for a duration of pi, whereas a value of pi implies as many visits each with a duration of 1. The NL and PTL are similar as for the second representation, with the major difference that both lists are only as long as the sum of the job splits in the SL. As a result, the PTL does not contain any zero values. Recall that in the second representation the PTL could have zero values and that both the NL and PTL sizes equal the sum of the job durations. It can be stated that the 3L representation constitutes a middle ground between the other two. It is less naive than the second one, since no unused visits with a processing time of zero are included. It does, however, allow for more and different splits than the greedy approach, by incorporating more information. Fig. 1. Example of profiles. rate at which the temperature changes, are also defined. We employ three variants for the temperature profile changes, namely a linear (f (t) = t), a quadratic (f (t) = t2) and an exponential (f (t) = et) function. In the linear variant the temperature increase or decrease is the same as the change in cit, namely it increases or decreases by 1. For the quadratic case the temperature is the cube of the number of consecutively processed time units, and in case of the exponential function the base number e is used with the time as exponent. Bit = f1(cit) · yit + f2(cit) · (1 − yit),∀t ≥ 0,∀i ∈ N (2) Allow us to illustrate the application of both functions with a simple example. Assume that we have a node with a total processing time of 6, a quadratic increase and decrease temperature function, and that the maximum temperature B equals 16. We start processing the job at time 3 and process for 3 time units until time 6 (node temperature equal to 9 or 32), after which no processing occurs for 2 time units. We then process the remaining 3 time units until time 11 (node temperature of 16 or (3 − 2 + 3)2). The resulting consecutive time units and temperature profiles are shown in Figure 1. We can observe that the temperature is indeed a function of the number of consecutively processed time units, and that the temperature decreases when no processing occurs. Based on the three possible temperature increase and de- crease profiles, nine combinations exist. In the remainder of this manuscript, we assume that the same function is used for both the increase and decrease of the temperature, but in our presentation we will discuss combinations as well. III. METHODOLOGY In this section, we discuss our solution approach for the ITSP. We propose to use three different applications of a genetic algorithm (GA) based on three different solution rep- resentations. We first go into detail about the representations, before giving an overview of the employed metaheuristic. In the remainder of this paper we refer to 1L, 2L and 3L as three types of solution representations, whereas NL, PTL and SL are lists which can be part of the representations. To illustrate the three representations, consider the example network in Figure 2, with three jobs and a maximum tem- perature B of 3. We furthermore assume a linear temperature increase and decrease function for each job, which implies that for each job 3 time units can be processed consecutively without exceeding the maximum temperature. 1) With the single list we first calculate the number of splits based on the processing times and the maximum temperature. This results in 2 splits for job 1, 2 for job 2 and 1 for job 3. Assume that we have NL equal to (2, 1, 3, 1, 2). We process job 2 for a duration of 3 (the maximum amount possible), then process job 1 for 3 time units as well, move on to job 3 for a duration of 2, return to 1 for another 2 time units and finish with 3 time units for job 2. The total duration is equal to the sum of the job durations, the distances traveled and any waiting time. The first equals 13, the second 14 and the third 0 since no waiting times are needed. As a result, the total duration is equal to 27. 2) For the two list representation, assume a NL of (1, 1, 2, 2, 2, 1, 3, 3, 2, 2, 1, 1, 2) and a PTL of (2, 0, 1, 0, 1, 2, 2, 0, 1, 3, 0, 1, 0). Consider that the length of both lists is equal to 13, or to the sum of the individual job durations, that several zeros are included in the PTL, and that the sum of the corresponding visit durations equals pi for each job. The total duration is equal to 13 (the total job duration, the same as before) + 25 (the total distance traveled, including returning to node 1 where the tour started) + 0 (the total waiting time) = 38. Due to the increase in total distance the objective function for this NL and PTL combination is worse than for the greedy NL. 3) In case of the three lists, we use the NL (1, 2, 1, 2, 3, 2), PTL (3, 1, 2, 2, 2, 3) and SL (2, 3, 1). Each job is included as many times in the NL and PTL as the number of splits in the SL. The sum of the PTL values is again equal to pi for each of the three jobs. The total completion time equals 13 + 16 + 0 = 29. In the example we have explicitly assumed linear temperature profiles, which in this case resulted in no waiting time for the given lists. However, if the profiles would increase and decrease in a quadratic manner, then only 1 time unit can be processed before a node has to cool down. In the 3L example this results in repeatedly processing 1 time unit and waiting for 1 time unit. For instance, the first visit to node 1 involves 3 time units of processing time, which results in a total time of 5 (= 3 x 1 processing, 2 x 1 waiting). The same logic applies for the other visits in the tour. Hence, in the example the total duration increases from 29 to 36 due to 7 time units of waiting. B. Genetic algorithm An overview of our GA can be found in Figure 3. The population P is initialized by generating P random 1L, 2L or 3L respectively. This includes any relevant repair method and the evaluation of the solution value (cf. infra). The selection operator is the elite selection of [5], which selects one parent based on a four-tournament selection and the other one at random from the subset R of best solutions in P . In the population update the best R elements of the previous Fig. 2. Example network. Select p1 and p2 from P Crossover* p1 and p2 → o1 and o2 Repair* o1 and o2 For each offspring o do 1: Initialize population P 2: Repeat 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: Until stopping criterion met Mutate* o Repair* o Evaluate* o End for Update P : remove P − R worst, add R best offspring, update R Fig. 3. GA outline generation are retained, and the rest is replaced by the best children. Afterwards, the set R is updated based on the new P . It has been shown that due to the elite selection and population update, the GA contains elements of both scatter search and evolutionary path relinking [6]. However, for the sake of simplicity we refer to the algorithm as a GA, although the more general term evolutionary algorithm (EA) would also be correct. The asterisks (*) indicate that the corresponding steps differ based on the solution representation used (1L, 2L or 3L), since these parts require different applications of some operators. We also distinguish between the three types of lists used (NL, PTL and SL) when discussing the operators with an * in more detail, since it are these lists which result in differences between the operators used. Recall that 1L consists only of a NL, 2L of a NL and PTL, and 3L of a NL, PTL and SL. In Table I an overview of the differences in terms of operators between the NL, PTL and SL is displayed, whereas Table II shows the repair and solution evaluation employed for the three solution representations. • NL: We apply a one-point crossover and a two-activity swap as crossover and mutation operator with a mutation rate of mN L respectively. No repair method is required, and the evaluation consists of processing as much as possible of a node during each visit. Only the final visit to a node may include waiting time to ensure that the temperature constraint is not violated. • PTL: We again use a one-point crossover. Consider that the NL and PTL always have the same length, so the same crossover point can be used for both lists. However, TABLE I GA OPERATORS. TABLE III DATA PARAMETERS. Operator Crossover Mutation NL 1-point 2-swap PTL 1-point SL 1-point' Random change Random change TABLE II REPAIR & SOLUTION EVALUATION. Lists Repair 1L NL / Evaluation Greedy 2L NL, PTL Repair 1 PTL-based 3L NL, PTL, SL Repair 1 & 2 PTL-based the PTL requires a repair method to ensure that for each job the sum of the corresponding PTL values equals pi. In case the sum is too large (small), this repair method randomly decreases (increases) PTL values of the job i until the condition is met. In terms of mutation, we have chosen a random change operator which randomly selects a different PTL value. The mutation rate mP T L is used for each job in the list, rather than for the PTL as a whole. Also after the mutation, we have to apply the same repair method to ensure that the PTL is feasible. Finally, in terms of solution evaluation we process the corresponding values in the PTL during each visit to a node. Hence, waiting time is included if this is required based on the PTL value. • SL: The crossover operator is an adjusted version of the one-point crossover due to the different length of the SL on the one hand and the NL and PTL on the other hand, and uses a different crossover point. Additionally, the crossover of NL and PTL takes the different lengths of the parents' lists into account. The mutation of the SL is similar to that of the PTL; a random change is applied to each job with a rate of mSL. The use of a SL requires a second repair method to ensure that the number of splits of a job in the SL corresponds with the number of job occurrences in the other two lists. This method adjusts the NL and PTL by removing (adding) job occurrences in the NL and increasing (decreasing) values in the PTL at random. This way the total length of both lists corresponds with the sum of the SL values. The repair method is applied after both the crossover and the mutation. Finally, the usage of a SL (3L representation) has no effect on the evaluation of the solution, so the same PTL-based technique can be used as without a SL (2L representation). IV. RESULTS To test our approach, we have generated our own data. Table III shows the selected values for different data parameters. For each combination we generate 10 variations, which results in Parameter Number of nodes (N) Processing time (pi) Distance (dij) Maximum temperature (B) Values 10, 50 [10;20], [10;100] [10;20], [10;100] 20, 40, 60, 80, 100 TABLE IV ALGORITHM PARAMETERS. Parameter P R mN L mP T L mSL 1L 50 5 0.90 / / 2L 50 5 0.90 0.05 / 3L 50 5 0.10 0.02 0.01 a total of 400 (= 10 x 2 x 2 x 2 x 5) instances. In terms of temperature profiles, we test the three variants discussed, and assume that the increase and decrease functions of each node are the same, i.e. linear, quadratic or exponential. We use a stopping criterion of 5000 tours for each instance. In Table IV we show the best found parameter values for each of the metaheuristic's parameters. We distinguish between the three solution representations 1L, 2L and 3L. We can conclude that the values for the population size P and retention rate R are in line with those of [5], whereas the mutation rates depend on the solution representation used. As more lists are included in a representation, our results indicate that it is better to use lower mutation rates. The comparative results of the three different solution rep- resentations are displayed in Table V, in terms of the average total duration (AvDur) required to complete the processing of the material. We distinguish between the three solution representations and between the three temperature profiles linear (L), quadratic (Q) and exponential (E). Two main conclusions can be drawn based on the table. First, there is a large difference in performance between the three representations. 1L always has the best performance, whereas 2L always performs worst. The explanation for these results lies in the size of the solution space employed in the GA. Especially in the 2L representation, a huge number of possible (feasible) combinations exist. For instance in case of 10 jobs with each a duration of 10, both the NL and PTL already have a length of 100, whereas the 1L may be as short as 10. This comparative result confirms that it is indeed best to apply a greedy approach in case of similar temperature increase and decrease profiles. However, given the results for 3L, it can be stated that the latter representation should be investigated further, since it shows potential. In particular in case of different increase and decrease profiles, the 3L may how much should be best processed during a visit given the current node temperature. Finally, we currently assume a uniform surface and density of the material (section I), where all the points or nodes are similar. It might prove interesting to investigate the impact of the shape and density of the material surface, and what the link might be with the temperature profiles. Acknowledgements: This research was supported by the Belgian Science Policy Office (BELSPO) in the Interuniversity Attraction Pole COMEX. REFERENCES [1] A. Campbell, L. Clarke, A. Kleywegt and M. Savelsbergh, The inventory routing problem, In T.G. Crainic and G. Laporte, eds., Fleet Management and Logistics, 95-113, Springer, 1998. [2] Y. Dumas, J. Desrosiers, E. Gelinas and M.M. Solomon, An optimal algo- rithm for the traveling salesman problem with time windows, Operations Research 43(2): 367-371, 1995. [3] G. Gutin and A.P. Punnen, eds., The traveling salesman problem and its variations, Vol. 12, Springer, 2007. [4] D.S. Johnson and L.A. McGeoch, The traveling salesman problem: A case study in local optimization, Local Search in Combinatorial Optimization 1: 215-310, 1997. [5] P. Leyman and M. Vanhoucke, A new scheduling technique for the resource-constrained project scheduling problem with discounted cash flows, International Journal of Production Research 53(9): 2771-2786, 2015. [6] P. Leyman and M. Vanhoucke, Capital- and resource-constrained project scheduling with discounted cash flows, European Journal of Operational Research 256: 757-776, 2017. [7] S.T. Pham, P. Leyman and P. De Causmaecker, The intermittent traveling salesman problem, Working paper, 2017. COMPARISON OF SOLUTION REPRESENTATIONS (AvDur). TABLE V Function 1L L Q E 1089.62 2076.63 3521.63 2L 10,866.05 13,564.22 16,620.25 3L 1743.50 3037.27 4672.14 TABLE VI IMPACT TEMPERATURE PROFILES. L L Greedy Increase Q E ? ? Decrease Q Greedy Greedy ? E Greedy Greedy Greedy prove a valuable alternative to the 1L. Second, the increases in temperature profiles have a pro- foundly negative impact on the total duration. This observation is important from a managerial perspective, since it can be used to show that operations with a limited temperature increase and decrease are preferable compared to those with a more steeper increase and decrease. V. CONCLUSIONS & FUTURE WORK In this paper, we have discussed the intermittent traveling salesman problem (ITSP). This problem imposes additional temperature constraints on the nodes in the network, such that the maximum allowable processing time on a node is limited. We have employed a linear, a quadratic and an exponential function for the temperature increase and decrease profiles. A metaheuristic which employs three different solution represen- tations has been proposed, and it was shown that in case the increase and decrease functions for the node temperatures are the same, it is best to apply a greedy approach and process as much as possible. In the future, we aim to investigate the impact if different temperature increase and decrease profiles are used. We expect that as long as the temperature in a node always decreases at least as fast as it increases, it will be beneficial to process as much as possible during each visit. However, in case the temperature decreases slower than it increases it becomes less obvious what is best course of action. Table VI shows the (expected) impact of temperature profiles for linear (L), quadratic (Q) and exponential (E) functions. A second interesting research avenue concerns the shape of the temperature functions. In this manuscript we explic- itly assumed that these functions were straightforward (i.e. f (t) = t, f (t) = t2 and f (t) = et), which resulted in a clear distinction between them, since e.g. the linear function was never larger than the quadratic one for the same value of t. However, employing functions such as f (t) = 4 · t (increase) and f (t) = t2/2 (decrease) would make it harder to determine
1508.05968
1
1508
2015-08-24T20:48:33
Formulations and algorithms for the multiple depot, fuel-constrained, multiple vehicle routing problem
[ "cs.DS" ]
We consider a multiple depot, multiple vehicle routing problem with fuel constraints. We are given a set of targets, a set of depots and a set of homogeneous vehicles, one for each depot. The depots are also allowed to act as refueling stations. The vehicles are allowed to refuel at any depot, and our objective is to determine a route for each vehicle with a minimum total cost such that each target is visited at least once by some vehicle, and the vehicles never run out fuel as it traverses its route. We refer this problem as Multiple Depot, Fuel-Constrained, Multiple Vehicle Routing Problem (FCMVRP). This paper presents four new mixed integer linear programming formulations to compute an optimal solution for the problem. Extensive computational results for a large set of instances are also presented.
cs.DS
cs
Formulations and algorithms for the multiple depot, fuel-constrained, multiple vehicle routing problem Kaarthik Sundar†, Saravanan Venkatachalam∗, Sivakumar Rathinam‡ 5 1 0 2 g u A 4 2 ] S D . s c [ 1 v 8 6 9 5 0 . 8 0 5 1 : v i X r a Abstract— We consider a multiple depot, multiple vehicle routing problem with fuel constraints. We are given a set of targets, a set of depots and a set of homogeneous vehicles, one for each depot. The depots are also allowed to act as refueling stations. The vehicles are allowed to refuel at any depot, and our objective is to determine a route for each vehicle with a minimum total cost such that each target is visited at least once by some vehicle, and the vehicles never run out fuel as it traverses its route. We refer this problem as Multiple Depot, Fuel-Constrained, Multiple Vehicle Routing Problem (FCMVRP). This paper presents four new mixed integer linear programming formulations to compute an optimal solution for the problem. Extensive computational results for a large set of instances are also presented. Index Terms— fuel constraints; green vehicle routing; electric vehicles; mixed-integer linear programming; unmanned vehicle routing I. INTRODUCTION In this paper, we extend the classic multiple depot, mul- tiple vehicle routing problem (MDMVRP) to include fuel constraints for the vehicles. We are given sets of targets, a set of depots, and a set of vehicles, with each vehicle initially stationed at a distinct depot. The depots also perform the role of refueling stations, and it is reasonable to assume that whenever a vehicle visits a depot, it refuels to its full capacity. Given this, the objective of FCMVRP is to determine a route for each vehicle starting and ending at its corresponding depot such that (i) each target is visited at least once by some vehicle, (ii) no vehicle runs out of fuel as it traverses its path, and (iii) the sum total cost of the routes for the vehicles is minimum. Some of the applications for the FCMVRP are path-planning for Unmanned Aerial Vehicles (UAVs) [1], [2], [3], routing for electric vehicles based on the locations of recharging stations [4], [5], and routing for green vehicles [6]. Some of these application domains are elaborated on the following sections. A. Path-planning for UAVs Small UAVs are being used routinely in military applica- tions such as border patrol, reconnaissance, and surveillance expeditions, and civilian applications like remote sensing, † Graduate Student, Dept. of Mechanical Engg., Texas A&M University, ∗ Assistant Professor, Dept. of Industrial and Systems Engg., Wayne State ‡ Assistant Professor, Dept. of Mechanical Engg., Texas A&M University, College Station, TX 77843. [email protected] University, Detroit, MI 48202. College Station, TX 77843. traffic monitoring, and weather and hurricane monitoring [7], [8], [9]. Even though there are several advantages due to small platforms for UAVs, there are resource constraints due to their size and limited payload. It may not be possible for a small UAV to complete a surveillance mission before refueling at one of the depots due to the fuel constraints. For example, consider a typical surveillance mission with multiple vehicles each starting at a depot and together are required to monitor a set of targets. To complete this mission, the vehicles might have to start at their respective depot, then visit a subset of targets and reach one of the depots for refueling before starting a new route for the rest of the targets. This can be modeled as a FCMVRP with the depots acting as refueling stations. B. Routing problem for green and electric vehicles Green vehicle routing problem is a variant of the Vehicle Routing Problem (VRP) and was introduced by authors in [6] to account for the challenges associated with operating a fleet of alternate-fuel vehicles (AFVs). The US transporta- tion sector accounts for 28% of national greenhouse gas emissions [10]. Several efforts over many decades focusing towards the introduction of cleaner fuels (e.g. ultra low sulfur diesel) and efficient engine technologies have lead to reduced emissions and greater mileage per gallon of fuel used. Government organizations, municipalities, and private companies are converting their fleet of vehicles to AFVs either voluntarily to alleviate the environmental impact of fossil based fuels or to meet environmental regulations. For instance, FedEx, in its overseas operations, employs AFVs that run on biodiesel, liquid natural gas, or compressed natural gas. A major challenge that hinders the increase in usage of AFVs is the number of alternate-fuel stations available for refueling. The FCMVRP is a natural problem that arises in such a scenario. An algorithm to compute an optimal solution to the FCMVRP would generate low cost routes for the vehicles, while respecting their fuel constraints. Increasing concerns about climate changes and rising green house gas emissions drive the research in sustainable and energy efficient mobility. One such example is the introduction of electrically-powered vehicles. One of the main operational challenges for electric vehicles in transport applications is their limited range and the availability of recharging stations. The number of electric stations in the US is a mere 9,571 with a total of 24,631 charging outlets in [13]. Variants of the classic VRP that are closely related to the FCMVRP include the distance constrained VRP [14], [15], [16], [17], [18], the orienteering problem [19], [20], and the capacitated version of the arc routing problem [21], [22]. The distance constrained VRP is a special case of the FCMVRP with a single vehicle and single depot that can be considered as a fuel station. The FCMVRP is also quite different and more general compared to orienteering problem where one is interested in maximizing the number of targets visited by the vehicle subject to its fuel constraints. Lastly, the arc routing problem is a single depot VRP given a set of intermediate facilities, and the vehicle has to cover a subset of edges along which targets are present. The vehicle is required to collect goods from the targets as it traverses the given set of edges and unloads the goods at the intermediate facilities. The goal of this problem is to find a tour of minimum length that starts and ends at the depot such that the vehicle visits the given subset of edges, and the total amount of goods carried by the vehicle does not exceed the capacity of the vehicle along the tour. One of the key differences between the arc routing problem and the FCMVRP is that there is no requirement that any subset of edges must be visited in the FCMVRP. The aim of this paper is to introduce and compare four different formulations for the FCMVRP and present branch- and-cut algorithms for the formulations. The first two for- mulations are arc-based, and the rest are node-based formu- lations that use the Miller-Tucker-Zemlin (MTZ) constraints [23]. The major contributions of this paper are as follow: (1) present four new formulations for the FCMVRP, (2) compare the formulations both analytically and empirically, and (3) through extensive computational experiments, show that instances with maximum of 40 targets are within the computational reach of a branch-and-cut algorithm based on the best of the four formulations. The rest of the paper is organized as follows. Sec. III states the formal definition of the problem and introduces notations. In Sec. IV, we develop the four mixed integer linear pro- gramming formulations. The first two formulations are arc- based and the rest are node-based formulations i.e., decision variables for enforcing the fuel constraints are introduced for each edge and each target for the arc-based and the node- based formulations, respectively. The linear programming relaxations of the formulations are analytically compared in this section. In Sec. V, we present the computational results followed by conclusions and possible extensions. III. PROBLEM DEFINITION Let T denote the set of targets {t1, . . . , tn} . Let D denote the set of depots or refueling stations {d1, . . . , dk}; each depot dk is equipped with a vehicle vk. The FCMVRP is defined on a directed graph G = (V, E) where V = T ∪ D and E is the set of edges joining any two vertices in V . We assume that G does not contain any self-loops. Each Fig. 1. Electric station locations in Texas, USA [11] [11]. Fig. 1 shows a map with the locations of the electric stations in Texas, USA; observe that the distribution of the electric stations is very sparse except in the four major cities Dallas, Houston, Austin, and San Antonio. Successful adaption of electric vehicles will strongly depend on the methods alleviating the range and recharging limitations. If we consider the range and the recharging stations for the electric vehicles as analogues to the fuel capacity and refueling stations of vehicles that run on fossil-based or alternate fuels respectively, then the problem of electric vehicle routing subject to the range constraints and lim- ited availability of electric stations can be modeled as an FCMVRP. Clearly, any feasible solution to the FCMVRP can be used to implement a feasible route for an electric vehicle. II. RELATED WORK The FCMVRP is NP-hard because it contains the VRP as a special case. The existing literature on the FCMVRP is quite scarce. The multiple depot, single vehicle variant of the FCMVRP was first introduced by authors in [12]. When the travel costs are symmetric and satisfy the triangle inequality, authors in [12] provide an approximation algorithm for this variant. They assume that the minimum fuel required to travel from any target to its nearest depot is at most equal to F α/2 units, where α is a constant in the interval [0, 1) and F is the fuel capacity of the vehicle. This is a reasonable assumption as, in any case, one cannot have a feasible tour if there is a target that cannot be visited from any of the depots. Using these assumptions, Khuller et al. [12] present a (3(1+ α))/(2(1 − α)) approximation algorithm for the problem. Authors in [1] formulate this multiple depot single vehicle variant as a mixed-integer linear program and present k-opt based exchange heuristics to obtain feasible solutions within 7% of the optimal, on an average. Later, Sundar et al. [2] extend the approximation algorithm in [12] to the asymmetric case and also present heuristics to solve the asymmetric version of this variant. Furthermore, variable neighborhood search heuristics for FCMVRP with heterogeneous vehicles, i.e., vehicles with different fuel capacities, are presented by Levy et al. [3]. More recently, an approximation algorithm and heuristics are developed for the FCMVRP by the authors edge (i, j) ∈ E is associated with a non-negative cost cij required to travel from vertex i to vertex j and fij, the fuel spent by traveling from i to j. It is assumed that the cost of traveling from vertex i to vertex j is directly proportional to the fuel spent in traversing the edge (i, j) i.e., cij = K · fij (cij and cji may be different, but for the purpose of this paper, we assume cij = cji). It is also assumed that travel costs satisfy the triangle inequality i.e., for every i, j, k ∈ V , cij + cjk ≥ cik. Furthermore, let F denote the fuel capacity of all the vehicles. The FCMVRP consists of finding a route for each vehicle such that the vehicle vk starts and ends its route at its depot dk, each target is visited at least once by some vehicle, the fuel required by any vehicle to travel any segment of the route which joins two consecutive depots in the route must be at most equal to F , and the sum of the cost of all the edges present in the routes is a minimum. IV. MATHEMATICAL FORMULATIONS This section presents four formulations for the FCMVRP. The first two formulations are arc based, and the remaining formulations are node based. The arc based and edge based formulations have additional decision variables for each edge and vertex respectively, to impose the fuel constraints. For any given formulation F, let F L denote its linear program- ming relaxation obtained by allowing the integer variables to take continuous values within the lower and upper integer bounds, and opt(F) denote the cost of its optimal solution. A. Arc-based formulations We first present an arc based formulation F1 for the FCMVRP, inspired by the models for standard routing prob- lems [24], [17]. Each edge (i, j) ∈ E is associated with a variable xij, which equals 1 if the edge (i, j) is traversed by the vehicle, and 0 otherwise. Also, associated with each edge (i, j) is a flow variable zij which denotes the total fuel consumed by any vehicle as it starts from a depot to the vertex j, when the predecessor of j is i. Using the above variables, the formulation F1 is given as follows: (6) xij ∈ {0, 1} ∀ (i, j) ∈ E. In the above formulation the Eqs. (1) – (2) impose the degree constraints on the depots and the targets. The constraints in (3) are the connectivity constraints; they eliminate sub tours of the targets. (4) and (5) together impose 0 ≤ zij ≤ F and they ensure that the fuel consumed by the vehicle to travel up to a depot does not exceed the fuel capacity F . Finally, the constraints in Eqs. (6) impose the binary restrictions on the variables. Now, we present another arc-based formulation F2 which is a strengthened version of F1. The following proposition is a modified version of the Prop. 1 presented in [17] for the distance constrained vehicle routing problem; it strengthens the bounds given by the constraints in (4). Proposition 1. The inequalities in (4) can be strengthened as follows: zij ≤ (F − tj)xij ∀j ∈ T, (i, j) ∈ E zid ≤ F xid ∀i ∈ T and d ∈ D zij ≥ (si + fij)xij ∀i ∈ T, (i, j) ∈ E where, ti = mind∈D fid and si = mind∈D fdi. Proof. When j is a depot, the constraints in (8) and (4) coincide. We now discuss the case when both i and j are targets. When xij = 1, any vehicle that traverses this edge (i, j) consumes at least (si +fij) amount of fuel. As a result, the constraint in (9) strengthens the lower bound of zij in (4). Similarly, the total fuel consumed by any vehicle that traverses the edge (i, j) cannot be greater that (F−tj), where tj is the minimum amount of fuel required by any vehicle to reach a depot from target j. Therefore, the constraint in (7) strengthens the upper bound of zij in (4). (7) (8) (9) Hence, the second arc-based formulation is as follows: (F2) Minimize (cid:88) cijxij (i,j)∈E subject to: (1) – (3), (5) – (6), and (7) – (9). Corollary 1. opt(F L 2 ) ≥ opt(F L 1 ). B. Node-based formulations In this section, we present a node-based formulation for the FCMVRP based on the models for the distance con- strained VRP in [25], [16]. For the node based formulation, apart from the binary variable xij for each edge (i, j) ∈ E, we have an auxiliary variable ui for each vertex i, that indicates the amount of fuel spent by a vehicle when it reaches the vertex i. We assume ud = 0 as the vehicles are refueled to their capacity when they reach a depot. In addition, we will also use the following two parameters: ti = mind∈D fid and si = mind∈D fdi for every vertex (1) (2) (3) (4) (5) cijxij (i,j)∈E (cid:88) (F1) Minimize (cid:88) subject to:(cid:88) xij = 1 and (cid:88) (cid:88) (cid:88) zij −(cid:88) (cid:88) xdi = zji = i∈V i∈V i∈V i∈V xid ∀ d ∈ D, j∈V j∈V j∈V 0 ≤ zij ≤ F xij ∀ (i, j) ∈ E, zdi = fdixdi ∀ i ∈ T, d ∈ D, and xji = 1 ∀ j ∈ T, fijxij ∀ i ∈ T, i ∈ V . For any d ∈ D, td = 0 and sd = 0. Using the above notations, the formulation F3 is given as follows: (F3) Minimize (cid:88) cijxij (i,j)∈E subject to: (1), (2), and (6), ui − uj + M xij ≤ M − fij ∀i ∈ V, j ∈ T, ui ≥ si + (fdi − si)xdi ∀i ∈ T, and (cid:88) ui ≤ F − ti −(cid:88) d∈D (fid − ti)xid ∀i ∈ T. d∈D (10) (11) (12) The constraint in Eq. (10) serves both as sub tour elimination and fuel constraints. It eliminates sub tours of the targets and ensures any route that starts and ends at a depot consumes at most F amount of fuel. This can be easily observed by aggregating the constraints for any sub tour of the targets and for any route starting and ending at a depot [25]. The value of M in the constraint is given by M = max(i,j)∈E{F − sj − ti + fij}. The constraints in Eqs. (11) and (12) specify the upper and lower bounds on ui, for every vertex i. The following proposition strengthens the fuel constraints and the bounds on ui. Proposition 2. The inequalities in (10), (11), and (12) can be strengthened as follows: ui − uj + M xij + (M − fij − fji)xji ≤ M − fij ∀i, j ∈ T, (sj + fji)xji ∀i ∈ T, j∈V ui ≥(cid:88) ui ≤ F −(cid:88) ui ≤ F − ti −(cid:88) j∈V d∈D (tj + fij)xij ∀i ∈ T, and (F − ti − fdi)xdi ∀i ∈ T. (13) (14) (15) (16) where, xii = 0 and xij = 0 whenever si + fij + tj > F . Proof. The constraint in Eq. (13) can be obtained by lifting the variable xji in Eq. (10). A constraint is said to be “valid” if it does not remove any feasible solution to the FCMVRP. We compute the value of the coefficient α that makes the following constraint valid: ui − uj + M xij + αxji ≤ M − fij. The equation is valid when xji = 0, as it reduces to (10). When xji = 1, we have xij = 0 and uj + fji = ui. Hence, the best value of α that makes the equation valid is given by M − fij − fji. Similarly, Eq. (14) can be obtained by lifting every xji variable for j ∈ T in any order. We will illustrate the lifting procedure for one of the xji variables. This involves com- puting the coefficient α that makes the following constraint valid: ui ≥ si + (fdi − si)xdi + αxji. (cid:88) d∈D The above equation is valid when xji = 0, and when xji = 1, we have xdi = 0 and α ≤ ui − si. The best value of α that does not remove any feasible FCMVRP is hence given by sj + fji − si. Similarly, the coefficients of the other xji variables can be computed. The resulting constraint is given by ui ≥ si + (sj + fji − si)xji ∀i ∈ V. (cid:88) j∈V In the above equation, sj = 0 for j ∈ D. The above equation reduces to Eq. (14) due to the degree constraints in (2). The constraints in Eq. (15) are similarly obtained from (12) by lifting the xij variable for every j ∈ T . The proof is omitted as it is similar to the previous ones in the proposition. The constraints in Eq. (16) are valid bounding constraints for the FCMVRP when the target i is the first target that is visited by any vehicle as it leaves the depot. In this case, the Eq. (12) reduces to ui ≤ F − ti. We further strengthen this constraint by lifting the variable xdi for every d ∈ D. The lifting coefficient α for xdi takes the value −(F − ti − fdi) and the resulting constraint is given by Eq. (16). Hence, the second node-based formulation is as follows: (F4) Minimize (cid:88) cijxij (i,j)∈E subject to: (1), (2), (6), and (13) – (16). Corollary 2. opt(F L 4 ) ≥ opt(F L 3 ). V. COMPUTATIONAL RESULTS In this section, we discuss the computational performance of the four formulations presented in the previous section. The mixed integer linear programs were implemented in Java, using the traditional branch-and-cut framework of CPLEX version 12.4. All the simulations were performed on a Dell Precision T5500 workstation (Intel Xeon E5630 processor @2.53 GHz, 12 GB RAM). The computation times reported are expressed in seconds, and we imposed a time limit of 3,600 seconds for each run of the algorithm. The performance of the algorithm was tested with randomly generated test instances. Instance generation The problem instances were randomly generated in a square grid of size [100,100] with 5 fixed depot locations. The number of targets varies from 10 to 40 in steps of five, while their locations were uniformly distributed in the square grid; for each T ∈ {10, 15, 20, 25, 30, 25, 40}, we generate five random instances. Each depot contains a vehicle. The travel costs and the fuel consumed to travel between any pair of vertices are assumed to be equal to the euclidean distances between the pair. For each of these problems, we generate four possible fuel capacities F as a function of the the distance to the farthest target from any depot λ. The fuel capacity F of the vehicles gets the values 2.25λ, 2.5λ, 2.75λ and 3λ. In total, we generate 140 instances and run the branch-and-cut algorithm for all the formulations. i ): linear programming relaxation solution for formu- Tables I and II, and Fig. 2–3 summarize the computational behavior of the algorithms for all the 140 instances. The following nomenclature is used throughout the rest of the paper: #: instance number; opt(F L lation i; n: instance size i.e., number of targets in the instance; %-LB: percentage LB/opt, where LB is the objective value of the linear programming relaxation computed at the root node of the branch and bound tree and opt is the cost of the optimal solution to the instance; total: total number of test instances of a given size; succ: number of instances for which optimal solutions were computed within a time limit of 3,600 seconds. Table I compares the cost of the linear programming (LP) relaxations of the four formulations presented in Sec. IV for the 40 target instances. The results in table I provide an empirical comparison of the formulations presented in IV; the observed behavior is expected because the formulations F2 and F4 are strengthened versions of F1 and F3, respec- tively (see corollaries 1 and 2). As for the LP relaxations of formulations F2 and F4, it is difficult to conclude that one is better than the other since F4 produces better relaxation values than F2 only for 60% of the instances. Hence, the rest of the computational results compares the formulations F2 and F4. Table II shows the number of instances of different sizes solved to optimality by the formulations F2 and F4 within the time limit of 3600 seconds. The plot in Fig. 2 shows the average time taken by the two formulations to compute the optimal solution to the FCMVRP. The table II and Fig. 2 indicate that the arc-based formulation F2 outperforms the node-based formulation F4 for the larger instances. For the smaller sized instances, it is difficult to differentiate between the two formulations. The plot in Fig. 3 shows the percentage LB/opt for both the formulations (LB is the objective value of the linear programming relaxation computed at the root node of the branch and bound tree and opt is the cost of the optimal solution to the instance; for the instances not solved to optimality, opt represents the cost of the best feasible solution obtained at the end of 3,600 seconds). We observe that the %LB is consistently better for formulation F2. This plot also provides empirical evidence to the claim COST OF THE LP RELAXATION FOR THE 40 TARGET INSTANCES. TABLE I # opt(F L 1 ) 496.42 1 487.31 2 480.55 3 4 475.23 444.35 5 435.45 6 428.44 7 423.06 8 9 396.10 392.87 10 390.42 11 388.40 12 481.22 13 14 469.76 461.16 15 454.80 16 503.19 17 494.98 18 489.64 19 20 485.92 opt(F L 2 ) 509.24 496.39 487.40 480.33 458.01 445.70 436.47 429.97 403.96 398.72 394.66 391.85 493.64 479.81 469.20 461.47 516.58 504.84 496.31 489.99 opt(F L 3 ) 426.17 426.17 426.17 426.17 389.08 389.08 389.08 389.08 367.11 367.11 367.11 367.11 427.04 427.04 427.04 427.04 461.07 461.07 461.07 461.07 opt(F L 4 ) 518.00 518.00 518.00 518.00 434.00 434.00 434.00 434.00 452.00 452.00 452.00 452.00 461.00 461.00 461.00 461.00 523.00 523.00 523.00 523.00 TABLE II COMPARISON OF FORMULATIONS F2 AND F4. F2 succ F4 succ total 20 20 20 20 20 20 20 20 20 20 20 20 20 19 20 20 20 14 5 15 1 n 10 15 20 25 30 35 40 that the arc based formulation F2 outperforms the node based formulation F4. VI. CONCLUSIONS AND FUTURE WORK In this paper, we have presented four different mixed integer linear programming formulations for the multiple depot fuel constrained multiple vehicle routing problem. The problem arises frequently in the context of path planning for UAVs, green vehicle routing and routing electric vehicles. The formulations have been compared both analytically and empirically, and it is observed that a strengthened arc based formulation (F2) performs the best in terms of computing optimal solutions to the problem. Computational experiments on a large number of test instances corroborates this observa- tion. Future work can be directed towards developing similar mixed integer linear programming formulations and branch- and-cut algorithms to solve a heterogeneous variant of the problem i.e., with vehicles having different fuel capacities. REFERENCES [1] K. Sundar and S. Rathinam, “Route planning algorithms for unmanned aerial vehicles with refueling constraints,” in American Control Con- ference (ACC), 2012. IEEE, 2012, pp. 3266–3271. tions Conference, Salt Lake City, UT, 2006. [10] US EPA. (2009) Environment Protection Agency, Inventory of US Greenhouse Gas Emissions and Sinks: 1990-2007, EPA 430-R-09-004. [Online]. Available: [11] US DOE. Alternate Fuels Data Center. http://www.afdc.energy.gov/fuels/electricity locations.html [12] S. Khuller, A. Malekian, and J. Mestre, “To fill or not to fill: the gas station problem,” in Algorithms–ESA 2007. Springer, 2007, pp. 534–545. [13] D. Mitchell, M. Corah, N. Chakraborty, K. Sycara, and N. Michael, “Multi-robot long-term persistent coverage with fuel constrained robots,” in Robotics and Automation (ICRA), 2015 IEEE International Conference on. IEEE, 2015, pp. 1093–1099. [14] G. Laporte, M. Desrochers, and Y. Nobert, “Two exact algorithms for the distance-constrained vehicle routing problem,” Networks, vol. 14, no. 1, pp. 161–172, 1984. [15] C.-L. Li, D. Simchi-Levi, and M. Desrochers, “On the distance constrained vehicle routing problem,” Operations research, vol. 40, no. 4, pp. 790–799, 1992. [16] I. Kara, “On the miller-tucker-zemlin based formulations for the distance constrained vehicle routing problems,” in ICMS international conference on Mathematical Science, vol. 1309, no. 1. AIP Publish- ing, 2010, pp. 551–561. [17] ——, “Arc based integer programming formulations for the distance constrained vehicle routing problem,” in Logistics and Industrial Informatics (LINDI), 2011 3rd IEEE International Symposium on. IEEE, 2011, pp. 33–38. [18] V. Nagarajan and R. Ravi, “Approximation algorithms for distance constrained vehicle routing problems,” Networks, vol. 59, no. 2, pp. 209–214, 2012. [19] M. Fischetti, J. J. S. Gonzalez, and P. Toth, “Solving the orienteering problem through branch-and-cut,” INFORMS Journal on Computing, vol. 10, no. 2, pp. 133–148, 1998. [20] P. Vansteenwegen, W. Souffriau, and D. Van Oudheusden, “The orienteering problem: A survey,” European Journal of Operational Research, vol. 209, no. 1, pp. 1–10, 2011. [21] G. Ghiani, F. Guerriero, G. Laporte, and R. Musmanno, “Tabu search heuristics for the arc routing problem with intermediate facilities under capacity and length restrictions,” Journal of Mathematical Modelling and Algorithms, vol. 3, no. 3, pp. 209–223, 2004. [22] M. Polacek, K. F. Doerner, R. F. Hartl, and V. Maniezzo, “A variable neighborhood search for the capacitated arc routing problem with intermediate facilities,” Journal of Heuristics, vol. 14, no. 5, pp. 405– 423, 2008. [23] C. E. Miller, A. W. Tucker, and R. A. Zemlin, “Integer programming formulation of traveling salesman problems,” Journal of the ACM (JACM), vol. 7, no. 4, pp. 326–329, 1960. [24] P. Toth and D. Vigo, The vehicle routing problem. Siam, 2001. [25] M. Desrochers and G. Laporte, “Improvements and extensions to the miller-tucker-zemlin subtour elimination constraints,” Operations Research Letters, vol. 10, no. 1, pp. 27–36, 1991. F2 F4 3,000 2,000 1,000 ) s d n o c e s ( e m T i 0 15 20 25 30 35 40 n Fig. 2. Average time taken to compute the optimal solution. F2 F4 B L % 90 85 80 75 15 20 25 n 30 35 40 Fig. 3. Average % LB. [2] ——, “Algorithms for routing an unmanned aerial vehicle in the presence of refueling depots,” Automation Science and Engineering, IEEE Transactions on, vol. 11, no. 1, pp. 287–294, 2014. [3] D. Levy, K. Sundar, and S. Rathinam, “Heuristics for routing het- erogeneous unmanned vehicles with fuel constraints,” Mathematical Problems in Engineering, vol. 2014, 2014. [4] M. Schneider, A. Stenger, and D. Goeke, “The electric vehicle-routing problem with time windows and recharging stations,” Transportation Science, vol. 48, no. 4, pp. 500–520, 2014. [5] G. Hiermann, J. Puchinger, and R. F. Hartl, “The electric fleet size and mix vehicle routing problem with time windows and recharging stations,” Tech. Rep., 2014. [6] S. Erdogan and E. Miller-Hooks, “A green vehicle routing problem,” Transportation Research Part E: Logistics and Transportation Review, vol. 48, no. 1, pp. 100–114, 2012. [7] E. W. Frew and T. X. Brown, “Networking issues for small unmanned aircraft systems,” Journal of Intelligent and Robotic Systems, vol. 54, pp. 21–37, March 2009. [8] J. A. Curry, J. Maslanik, G. Holland, and J. Pinto, “Applications of aerosondes in the arctic.” Bulletin of the American Meteorological Society, vol. 85, no. 12, pp. 1855 – 1861, 2004. [9] E. J. Zajkowski T, Dunagan S, “Small UAS communications mission,” in Eleventh Biennial USDA Forest Service Remote Sensing Applica-
1009.5227
1
1009
2010-09-27T11:33:39
The Straight-Line RAC Drawing Problem is NP-Hard
[ "cs.DS" ]
Recent cognitive experiments have shown that the negative impact of an edge crossing on the human understanding of a graph drawing, tends to be eliminated in the case where the crossing angles are greater than 70 degrees. This motivated the study of RAC drawings, in which every pair of crossing edges intersects at right angle. In this work, we demonstrate a class of graphs with unique RAC combinatorial embedding and we employ members of this class in order to show that it is NP-hard to decide whether a graph admits a straight-line RAC drawing.
cs.DS
cs
The Straight-Line RAC Drawing Problem is NP-Hard Evmorfia N. Argyriou1, Michael A. Bekos1, and Antonios Symvonis1 School of Applied Mathematical & Physical Sciences, National Technical University of Athens, Greece {fargyriou,mikebekos,symvonis}@math.ntua.gr Abstract. Recent cognitive experiments have shown that the negative im- pact of an edge crossing on the human understanding of a graph drawing, tends to be eliminated in the case where the crossing angles are greater than 70 degrees. This motivated the study of RAC drawings, in which every pair of crossing edges intersects at right angle. In this work, we demonstrate a class of graphs with unique RAC combinatorial embedding and we employ members of this class in order to show that it is N P-hard to decide whether a graph admits a straight-line RAC drawing. Date: September 27, 2010. 1 Introduction In the graph drawing literature, the problem of finding aesthetically pleasant drawings of graphs has been extensively studied. The graph drawing community has introduced and studied several criteria that judge the quality of a graph drawing, such as the number of crossings among pairs of edges, the number of edge bends, the maximum edge length, the total area occupied by the drawing and so on (see the books [4,17]). Motivated by the fact that the edge crossings have negative impact on the human understanding of a graph drawing [21,22,23], a great amount of research effort has been devoted on the problem of finding drawings with minimum number of edge crossings. Unfortunately, this problem is N P-complete in general [12]. However, recent eye- tracking experiments by Huang et al. [15,16] indicate that the negative impact of an edge crossing is eliminated in the case where the crossing angle is greater than 70 degrees. These results motivated the study of a new class of drawings, called right- angle drawings or RAC drawings for short [1,6,7,8]. A RAC drawing of a graph is a polyline drawing in which every pair of crossing edges intersects at right angle. Didimo, Eades and Liota [7] proved that it is always feasible to construct a RAC drawing of a given graph with at most three bends per edge. In this work, we prove that the problem of determining whether an input graph admits a straight-line RAC drawing is N P-hard. 1.1 Related Work Didimo et al. [7] initiated the study of RAC drawings and showed that any straight- line RAC drawing with n vertices has at most 4n − 10 edges and that any graph admits a RAC drawing with at most three bends per edge. A slightly weaker bound on the number of edges of an n-vertices RAC drawing was given by Arikushi et al. [3], who proved that any straight-line RAC drawing with n vertices may have 4n − 8 edges. Angelini et al. [1] showed that the problem of determining whether an acyclic planar digraph admits a straight-line upward RAC drawing is N P-hard. Furthermore, they constructed digraphs admitting straight-line upward RAC drawings, that require exponential area. Di Giacomo et al. [6] studied the interplay between the crossing resolution, the maximum number of bends per edges and the required area. Didimo et al. [8] presented a characterization of complete bipartite graphs that admit a straight- line RAC drawing. Arikushi et al. [3] studied polyline RAC drawings in which each edge has at most one or two bends and proved that the number of edges is at most O(n) and O(n log2 n), respectively. Dujmovic et al. [9] studied α Angle Crossing (or αAC for short) drawings, i.e., drawings in which the smallest angle formed by an edge crossing is at least α. In their work, they presented upper and lower bounds on the number of edges. Van Kreveld [18] studied how much better (in terms of area required, edge-length and angular resolution) a RAC drawing of a planar graph can be than any planar drawing of the same graph. Closely related to the RAC drawing problem, is the angular resolution maximiza- tion problem, i.e., the problem of maximizing the smallest angle formed by any two adjacent edges incident to a common vertex. Note that both problems correlate the resolution of a graph with the visual distinctiveness of the edges in a graph drawing. Formann et al. [10] introduced the notion of the angular resolution of straight-line drawings. In their work, they proved that determining whether a graph of maximum degree d admits a drawing of angular resolution 2π d (i.e., the obvious upper bound) is N P-hard. They also presented upper and lower bounds on the angular resolution for several types of graphs of maximum degree d. Malitz and Papakostas [20] proved that for any planar graph of maximum degree d, it is possible to construct a planar straight-line drawing with angular resolution Ω( 1 7d ). Garg and Tamassia [13] pre- sented a continuous tradeoff between the area and the angular resolution of planar straight-line drawings. For the case of connected planar graphs with n vertices and maximum degree d, Gutwenger and Mutzel [14] presented a linear time algorithm that constructs planar polyline grid drawings on a (2n − 5) × ( 3 2 ) grid with at most 5n−15 bends and minimum angle greater than 2 d . Bodlaender and Tel [5] showed that planar graphs with angular resolution at least π 2 are rectilinear. Recently, Lin and Yen [19] presented a force-directed algorithm based on edge-edge repulsion that constructs drawings with high angular resolution. Argyriou et al. [2] studied a generalization of the crossing and angular resolution maximization problems, in which the minimum of these quantities is maximized and presented optimal algorithms for complete graphs and a force-directed algorithm for general graphs. 2 n − 7 The rest of this paper is structured as follows: In Section 2, we introduce prelimi- nary properties and notation. In Section 3, we present a class of graphs with unique RAC combinatorial embedding. In Section 4, we show that the straight-line RAC drawing problem is N P-hard. We conclude in Section 5 with open problems. 2 Preliminaries Let G = (V, E) be a simple, undirected graph drawn in the plane. We denote by Γ (G) the drawing of G. Given a drawing Γ (G) of a graph G, we denote by ℓu,v the line passing through vertices u and v. By ℓ′ u,v, we refer to the semi-line that emanates 2 from vertex u, towards vertex v. Similarly, we denote by ℓu,v,w (ℓ′ u,v,w) the line (semi- line) that coincides (emanates from) vertex u and is perpendicular to edge (v, w). The following properties are used in the rest of this paper. Property 1 (Didimo, Eades and Liota [7]). In a straight-line RAC drawing there can- not be three mutually crossing edges. Property 2 (Didimo, Eades and Liota [7]). In a straight-line RAC drawing there can- not be a triangle T and two edges (a, b) and (a, b′), such that a lies outside T and b, b′ lie inside T . 3 A Class of Graphs with Unique RAC Combinatorial Embedding The N P-hardness proof employs a reduction from the well-known 3-SAT problem [11]. However, before we proceed with the reduction details, we first provide a graph, referred to as augmented square antiprism graph, which has the following property: All RAC drawings of this graph have two "symmetric" combinatorial embeddings. Fig- ures 1a and 1b illustrate this property. Observe that the augmented square antiprism graph consists of a "central" vertex v0, which is incident to all vertices of the graph, and two quadrilaterals (refer to the dashed and bold drawn squares in Figure 1b), that are denoted by Q1 and Q2 in the remainder of this paper. Removing the central vertex, the remaining graph corresponds to the skeleton of a square antiprism, and, it is commonly referred to as square antiprism graph. vab vbc vb va v0 vc (a) vad va vd vab vcd vb vd vcd vab vc vad v0 vbc (b) vad va vd v0 vb (c) vcd vc vbc Fig. 1: (a)-(b) Two different RAC drawings of the augmented square antiprism graph with different combinatorial embeddings. (a)-(c) Two different RAC drawing with the same combinatorial embedding. If we replace the two quadrilaterals with two triangles, then the implied graph is the augmented triangular antiprism graph. Didimo et al. [7], who showed that any n-vertex graph which admits a RAC-drawing can have at most 4n − 10 edges, used the augmented triangular antiprism graph, as an example of a graph that achieves the bound of 4n − 10 edges (see Figure 1.c in [7]). In contrast to the augmented triangular antiprism graph, the augmented square antiprism graph does not achieve this upper 3 bound. In general, the class of the augmented k-gon antiprism graphs, k ≥ 3, is a class of non-planar graphs, that all admit RAC drawings. Recall that any planar n-vertices graph, should have 3n − 6 edges, and since an augmented k-gon antiprism graph has 2k + 1 vertices and 5k edges, it is not planar for the entire class of these graphs. Lemma 1. There does not exist a RAC drawing of the augmented square antiprism graph in which the central vertex v0 lies on the exterior of quadrilateral Qi, i = 1, 2, and an edge connecting v0 with a vertex of Qi crosses an edge of Qi. Proof. Let Q be one of quadrilaterals Qi, i = 1, 2 and let va, vb, vc and vd be its vertices, consecutive along quadrilateral Q. Assume to the contrary that vertex v0 lies on the exterior of quadrilateral Q and there exists an edge, say (v0, va), that emanates from vertex v0 towards a vertex of quadrilateral Q, such that it crosses an edge, say (vb, vc)1, of quadrilateral Q. Vertices vb and vc have the following properties: (a) they are both connected to vertex v0, and, (b) have a common neighbor vbc, which is incident to vertex v0 and vbc /∈ Q (see Figure 1). Observe that if vertex vbc lies in the non-colored regions of Figure 2, then at least one of the edges incident to vbc crosses either (v0, va) or (vb, vc), which are already involved in a right-angle crossing. This leads to a situation where three edges mutually cross, which, by Property 1 is not permitted. Hence, vertex vbc should lie in the interior of the dark-gray colored regions R1, R2 or R3 of Figure 2. We consider each of these cases separately in the following. Note that, there exist cases where R2 ∪ R3 = ∅ (i.e., vertex v0 is close to the intersection point of (v0, va) and (vb, vc)), or R2 = ∅ (i.e., vertex vc is close to the intersection point of (v0, va) and (vb, vc)), or R3 = ∅ (i.e., vertex vb is close to the intersection point of (v0, va) and (vb, vc)). R3 ℓ′ vb,va vbc R2 ℓ′ vc,va va vb vc v0 ℓ′ vc,v0 R1 ℓ′ vb,v0 Fig. 2: Vertex vbc should lie in the interior of R1 or R2 or R3. Case i: Vertex vbc is in the interior of R1. This case is depicted in Figure 3a. Let Tvbc be the region formed by vertices vbc, vb and vc (i.e., the dark-gray colored region of Figure 3a). Vertex vd, which has to be connected to vertices va and vc, 1 The case where, it crosses edge (vc, vd) is symmetric. 4 and, the central vertex v0, cannot lie within Tvbc, since edge (va, vd) would have to cross edge (vb, vc), which is already involved in a right-angle crossing. Since vertex vd has to be connected to vertex v0, has to coincide with semi-line ℓ′ v0,vc,vbc, as illustrated in Figure 3a. However, under this restriction, the common neighbor vcd of vertices vc and vd cannot be connected to vertex v0, since edge (v0, vcd) should be perpendicular to one of the edges of Tvbc, which cannot be accomplished without introducing an edge overlap with edge (v0, vd). va Q vc vb This crossing is non right-angle. ℓ′ va,vb,vbc ℓ′ vc,va R3 vbc ℓ′ vb,vb,a Tvbc u va This vertex cannot be connected to v0 Tvbc vd v0 vcd vbc R1 ℓ′ vc,v0 ℓ′ vb,v0 (a) vd ℓ′ v0,vc,vbc vb vc ℓ′ va,vc,vbc v0 (b) Fig. 3: (a) Vertex vbc lies in the interior of R1. (b) Vertex vbc lies in the interior of R3. Case ii: Vertex vbc is in the interior of either R2 or R3. Say without loss of generality that vertex vbc is in the interior of R3. This case is depicted in Figure 3b. Let u be a vertex of the augmented antiprism graph (except va) and assume that u lies in the interior of the triangular face, say Tvbc, formed by vertices vb, vc and vbc. Vertex u has to be connected to the central vertex v0. Edge (v0, u) should not be involved in crossings with edges (v0, va) and (vb, vc), since they are already involved in a right- angle crossing. If edge (v0, u) crosses edge (v0, vbc), then the three vertices vb, vc and vbc that define triangle Tvbc must be collinear, which leads to a contradiction. Therefore, triangle Tvbc cannot accommodate any other vertex (except va). Now observe that each vertex of quadrilateral Q has degree five and there do not exist three vertices of quadrilateral Q, that have a common neighbor (see Figure 1). These properties trivially hold for vertex va, since va ∈ Q. Based on the above properties, each neighbor of vertex va can lie either in the interior of the dark-gray region of Figure 3b, or, on the external face of the already constructed drawing (along the dashed semi-lines ℓ′ va,vb,vbc of Figure 3b, respectively). This implies that we can route only four vertices out of those incident to vertex va, i.e., one of them should lie in the light-gray colored region of Figure 3b and ⊓⊔ thus, it cannot be connected to vertex v0. va,vc,vbc and ℓ′ Lemma 2. In any RAC drawing of the augmented square antiprism graph, quadri- lateral Qi, i = 1, 2 is drawn planar. 5 Proof. Let Q be one of quadrilaterals Qi, i = 1, 2, and let, as in the previous lemma, va, vb, vc and vd be its vertices, consecutive along quadrilateral Q. Assume to the contrary that in a RAC drawing of the augmented square antiprism graph, quadrilat- eral Q is not drawn planar, and say that edges (va, vb) and (vc, vd) form a right-angle crossing. This case is illustrated in Figure 4. In the following, we will lead to a con- tradiction the cases, where central vertex v0 lies (i) in the interior of a triangular face of quadrilateral Q, and, (ii) on the external face of quadrilateral Q. Note that it is not feasible a non-planar RAC drawing of a quadrilateral to contain more than one (right-angle) crossing. Hence, its bounded faces are triangular. -- Case i: Vertex v0 lies in the interior of a triangular face of quadrilateral Q. Assume without loss of generality that vertex v0 (which is incident to all vertices of quadrilateral Q) lies in the interior of the triangular face formed by vertices vb, vc and the intersection point of edges (va, vb) and (vc, vd), as in Figure 4a. In this case, edges (v0, va), (va, vb) and (vc, vd) mutually cross, which leads to a contradiction, due to Property 1. ℓ′ v0,va ℓ′ vb,va va ℓ′ v0,vd ℓ′ vc,vd vd va vc v0 vd vb ℓvb,vc vc vab vb vcd ℓ′ vb,v0,vc vbc ℓ′ vc,v0,vb v0 (a) Vertex v0 lies in the interior of a tri- (b) Vertex v0 lies on the external face of quadri- angular face. lateral Q. Fig. 4: Quadrilateral Q is not drawn planar. -- Case ii: Vertex v0 lies on the external face of quadrilateral Q. This case is illus- trated in Figure 4b. Recall that by Lemma 1, vertex v0 cannot introduce additional crossings on quadrilateral Q. We will first show that the common neighbor vab of vertices va and vb cannot lie in the region "above" line ℓvb,vc. In the case, where vertex vab lies in the region "above" ℓvb,vc and to the "left" of both edge (vc, vd) and semi-line ℓ′ v0,vd , edge (vb, vab) would cross edge (vc, vd), which is not per- mitted by Property 1. Symmetrically, vertex vab cannot lie in the region "above" ℓvb,vc and to the "right" of both edge (va, vb) and semi-line ℓ′ v0,va. If vertex vab lies within the left gray-colored unbounded region of Figure 4b (that is formed by semi-lines ℓ′ vb,va ), then, edge (vab, vb) crosses two non-parallel edges (va, vd) v0,va , ℓ′ 6 v0,vd , ℓ′ and (va, vd). In the case where, vab lies in the right gray-colored unbounded re- gion of Figure 4b (that is formed by semi-lines ℓ′ vc,vd ), then (va, vab) either crosses both (va, vd) and (vc, vd) which are non-parallel, or crosses edge (v0, vd) forming a non-right angle crossing. In the case, where vertex vab lies in the interior of the triangle formed by vertices vb, vc and the intersection point of edges (va, vb) and (vc, vd), edge (va, vab) would cross edge (vc, vd), which leads to a violation Property 1. Therefore, vertex vab should be "below" ℓvb,vc. We continue our reasoning on vertex vab. Vertex vab cannot lie to the "left" of edge (v0, va), since edge (vb, vab) or (va, vab) would cross more than one (non-parallel) edges incident to vertex v0. If vertex vab lies to the "right" of edge (v0, vb), then edge (va, vab) either crosses edge (vc, vd), that it is not permitted by Property 1, or, both edges (v0, vb) and (v0, vc), that are non-parallel. We complete our reasoning on vertex vab by the triangle formed by vertices v0, vb and vc. In this case, (va, vab) should be perpendicular to edge (v0, vc). This suggests that the angle formed by edges (vc, vd) and (v0, vc) is greater that 180o and therefore, edge (v0, vd) either crosses (va, vb), or another edge of quadrilateral Q, which trivially leads to a contradiction, due to Property 1, or due to Lemma 1, respectively. Based on the above, vertex vab should be within the left gray-colored region of Figure 4b, along semi-line ℓ′ vb,vc,v0 . Following a similar reasoning scheme, as for vertex vab, we can prove that the common neighbor vcd of vertices vc and vd should lie within the right light-gray colored region of Figure 4b, along semi-line ℓ′ vc,v0,vb. However, in this case, a common neighbor of vertices vab and vcd, say vbc, should lie on the intersection of semi-lines ℓ′ vc,v0,vb, which leads to edge overlaps. Thus, ⊓⊔ there exists no feasible placement for vertex vbc. vb,v0,vc and ℓ′ Lemma 3. In any RAC drawing of the augmented square antiprism graph, the central vertex v0 lies in the interior of quadrilateral Qi, i = 1, 2. Proof. From Lemma 2, it follows that quadrilateral Qi should be drawn planar, for each i = 1, 2. In order to prove this lemma, we assume to the contrary that central vertex v0 lies on the exterior of one of the two quadrilaterals. Say, w.l.o.g., on the exterior of quadrilateral Q1. Let va, vb, vc and vd be Q1's vertices, consecutive along quadrilateral Q1. Then, by Lemma 1, vertex v0 cannot contribute additional crossings on quadrilateral Q1. This suggests that the drawing of the graph induced by quadri- lateral Q1 and vertex v0 will resemble the one depicted in Figure 5. We denote by Tv0 the triangle formed by vertex v0 and the two vertices, which are on the convex hall of Q1∪v0 (refer to the gray-colored triangle of Figure 5). Before we proceed with the detailed proof of this lemma, we recall some properties of the augmented square antiprism graph. Two consecutive vertices of Q1 (Q2) share a common vertex of quadrilateral Q2 (Q1). Each vertex of quadrilateral Q1 (Q2) should be connected to two consecutive vertices of quadrilateral Q2 (Q1). We will prove that (i) no vertex of Q2 lies outside Tv0, (ii) Q2 cannot entirely lie in the interior of Q1, (iii) Q2 cannot entirely lie in the interior of a triangular face of Tv0, (iv) Q2 cannot entirely lie within two adjacent triangular faces of Tv0 , (v) Q2 cannot cross Q1, such that some of the vertices of Q2 reside within a triangular face of Tv0 , whereas the remaining ones within Q1. Note that quadrilateral Q2 cannot entirely lie within three triangular faces of Tv0 incident to vertex v0. Case i: We prove that no vertex of quadrilateral Q2 lies on the external face of the graph induced by quadrilateral Q1 and vertex v0, i.e., outside Tv0. For the 7 Q1 Tv0 v0 Fig. 5: Any drawing of the graph induced by Q1 and v0 has to resemble to this one. sake of contradiction, assume that there exists a vertex of quadrilateral Q2, say vab, that lies on the external face of the graph induced by quadrilateral Q1 and vertex v0 (see Figure 6). Vertex vab should be connected to vertices va and vb of quadrilateral Q1, and to the central vertex v0. If both vertices va and vb are inside triangle Tv0, then vertex vab, which is assumed to lie on the external face of this graph, would violate Property 2, since vertices va and vb would lie in the interior of Tv0, whereas vertex vab outside. Therefore, at least one of vertices va and vb should be a corner of Tv0 . Then, vertex vab contributes either none (see Figure 6b), or a single right-angle crossing (see Figure 6a). va Q1 vab vd vb vc Tv0 vab vbc This crossing is non right-angle. v0 (a) va Q1 vd ℓ′ vd,v0,va vb vc vbc v0 (b) Fig. 6: Vertex vab of quadrilateral Q2 lies on the external face of the graph induced by quadrilateral Q1 and vertex v0. Let now vbc be a vertex of quadrilateral Q2, which is incident to vertex vab. Vertex vbc is also incident to two consecutive vertices of quadrilateral Q1, i.e., vb and vc. We first turn our attention in the case where vab contributes a single right-angle crossing on the graph induced by quadrilateral Q1 and vertex v0 (see Figure 6a). Then, by Property 2, vertex vbc should lie in the interior of triangle Tv0. This immediately leads to a contradiction, since edge (vab, vbc) should cross edge (v0, va), which is already involved in a right-angle crossing (see Figure 6a). 8 Consider now the case where vertex vab contributes no crossing on Tv0. Observe that vertex vbc, which is adjacent to vertex vab, vertices vb and vc of Q1, and the central vertex v0 cannot lie in the dark-gray region of Figure 6b, since in this case, edge (va, vb) would be crossed by more than one (non-parallel) edges, incident to vbc. The case where vertex vbc lies within the light-gray colored region of Figure 6b, leads to a situation similar to the one depicted in Figure 6a. Therefore, vertex vbc should lie "somewhere" in the interior of Tv0. Let vad be the common neighbor of vertices va and vd of Q1, and vertex vab. This vertex cannot lie within the dark- gray region of Figure 6b, for the same reason that vertex vbc couldn't. In addition, vertex vad cannot lie in the interior of Tv0, since in this case, both vertices vbc and vad (that are in Tv0), should be connected to vab (that is not in Tv0 ), which trivially violates Property 2. Therefore, vertex vad should be on the external face of the graph induced by Q1 and vertices v0 and vad, along semi-line ℓ′ vd,v0,va . However, in this case, we are also led to a situation similar to the one depicted in Figure 6a, and subsequently, to a contradiction. Case ii: Say that quadrilateral Q2 entirely lies within quadrilateral Q1 (see Fig- ure 7a). In this case, its vertices should be connected to vertex v0. For three vertices of quadrilateral Q2, this can be accomplished using the three available edges of quadrilateral Q1 (refer to the dotted edges of Figure 7a), such that the right-angle crossings occur along them. However, the fourth vertex cannot be connected to vertex v0, since only three edges of quadrilateral Q1 can be used to realize connections with vertex v0 (see the topmost edge of Figure 7a). Q1 Q2 v0 (a) Crossing of non-parallel edges. Q1 q Q2 TQ1 v0 (b) Q1 q T 1 Q1 T 2 Q1 Q2 This crossing is non right-angle. v0 (c) Fig. 7: Quadrilateral Q2 lies (a) in the interior of Q1, (b) in the interior of a triangular face TQ2 incident to vertex v0, and (c) within two adjacent triangular faces incident to vertex v0. Case iii: Assume now that quadrilateral Q2 entirely lies within a triangular face, say TQ1, incident to vertex v0 (see Figure 7b). Then, there exists at least one vertex of quadrilateral Q1, say vertex q, which is incident to two vertices of quadrilateral Q2, and is not identified with a vertex at the corners of TQ1 (see Figure 7b). Vertex q has to be connected to two vertices of quadrilateral Q2. However, vertex q is external to triangle TQ1, whereas its two incident vertices in the interior of this triangle, which leads to a violation of Property 2. Case iv: Say that quadrilateral Q2 entirely lies within two adjacent triangular faces, Q1, incident to vertex v0 (see Figure 7c). Then, quadrilateral Q1 and T 2 say T 1 9 Q1 and T 2 Q2 should be "perpendicular" to the common edge of T 1 Q1. Recall that two consecutive vertices of quadrilateral Q2 share a common vertex of quadrilat- eral Q1. Hence, we can find a vertex q of quadrilateral Q1, which is not identified with the common vertex of T 1 Q1, and is incident to a pair of vertices of quadrilateral Q2, that do not lie in the same triangular face (i.e., the topmost vertices of quadrilateral Q2 or the bottommost vertices of quadrilateral Q2 in Figure 7c). This leads to a contradiction, since the common edge of T 1 Q1 and T 2 Q4 cannot be crossed, as it is already involved in a right-angle crossing (refer to the dotted-edges of Figure 7c). Q1 and T 2 Case v: We consider the case where quadrilateral Q2 crosses quadrilateral Q1, such that some of the vertices of quadrilateral Q2 reside within a triangular face of Tv0, whereas the remaining ones within quadrilateral Q1. We will lead to a contradic- tion the cases where: (i) Two vertices of Q2 lie in the interior of a single triangular face incident to v0, (ii) two vertices of Q2 lie in the interior of two adjacent trian- gular faces, (iii) three vertices of Q2 lie in the interior of two adjacent triangular faces and two of them lie in the same triangular face of Tv0 , (iv) three vertices of Q2 lie in the interior of three pairwise-adjacent triangular faces incident to vertex v0. Recall that none of the vertices of Q2 lies in the external face of the graph induced by quadrilateral Q1 and vertex v0. Let, with a slight abuse of notation, qa, qb, qc and qd be the vertices of quadrilateral Q2. Assume first that vertices qa and qb are in the interior of a single triangular face, whereas vertices qc and qd in the interior of quadrilateral Q1 (see Figure 8). In this case, edges (qa, qd) and (qb, qc) should perpendicularly cross quadrilateral Q1. The connections between vertices qc and qd with vertex v0 can be accomplished using two of the available edges of quadrilateral Q1, such that the right-angle crossings occur along them (refer to dotted edges of Figure 8). Thus, the triangular faces that are adjacent to the one that accommodates vertices qa and qb (refer to the light-gray faces of Figure 8) cannot be further used to connect vertices of quadrilateral Q1 to vertices of quadrilateral Q2. Then, there exists a vertex of quadrilateral Q1, say q, that it is not identified with any of the vertices of the face that accommodates vertices qa and qb, and either qa or qb has to be connected to vertex q. However, this cannot be accomplished, since the edge from either qa or qb to vertex q would cross more than one non-parallel edges (refer to the dashed edge of Figure 8). q Crossings on non-parallel edges. Q1 qd qc Q2 qa qb v0 Fig. 8: Vertices qa and qb are in the interior of a single triangular face incident to v0. 10 Say now that vertices qa and qb are in the interior of two adjacent triangular faces incident to vertex v0, whereas vertices qc and qb within quadrilateral Q1. This case is illustrated in Figure 9a. Then, one of the vertices that lie in the interior of quadrilateral Q1, say vertex qd, can be connected to vertex v0 using one of the available edges of quadrilateral Q1 (refer to the dotted edge of Figure 9a). However, vertex qc cannot be connected to vertex v0, since only three of the edges of quadrilateral Q1 can be used to realize connections from the vertices that lie within quadrilateral Q1, to vertex v0. Consider now the case where three vertices, say qa, qb and qc of quadrilateral Q2 are in the interior of two adjacent triangular faces incident to vertex v0, and two of vertices qa, qb and qc, say w.l.o.g., qb and qc, lie in the same triangular face (see Figure 9b). Then, vertex qd, as in the previous case, can be connected to vertex v0 using the "last" available edge of quadrilateral Q1 (refer to the dotted edge of Figure 9b). However, in this case, there exists a vertex of quadrilateral Q1, say q, that it is not identified with any of the vertices of the face that accommodates vertices qa, qb and qc, which has to be connected to one of the vertices qa, qb or qc. However, this cannot be accomplished, since an edge from either vertex qa, or qb, or qc, to vertex q would cross more than one non-parallel edges (refer to the dashed edge of Figure 9b). Q1 qd Q2 qc qa qb v0 (a) q Q1 qd Q2 qc qa qb v0 (b) Q1 qd Q2 qa qb qc v0 (c) Fig. 9: (a) Vertices qa and qb are in the interior of two adjacent triangular faces incident to vertex v0. Vertices qa and qb are not in the same triangular face incident to vertex v0. (b) Vertices qa, qb and qc are in the interior of two adjacent triangular faces incident to vertex v0, and qb and qc lie in the same triangular face. (c) Vertices qa, qb and qc are in the interior of three pairwise-adjacent triangular faces incident to vertex v0. The last case we have to consider is the one where three vertices, say qa, qb and qc of quadrilateral Q2 are in the interior of three pairwise-adjacent triangular faces incident to vertex v0, whereas the fourth vertex qd resides within quadrilateral Q2 (see Figure 9c). In this case, vertex qd has to use the fourth edge of quadrilateral Q1 to reach vertex v0, which leads to a contradiction, since only three of the edges of quadrilateral Q1 can be used to realize connections from the vertices that lie within quadrilateral Q1, to vertex v0. Thus, we have considered all possible placements of Q2, with vertex v0 outside of Q1, and are all led to a contradiction. We conclude that vertex v0 is in the interior of quadrilateral Q1 (and symmetrically in the interior of Q2, too). ⊓⊔ 11 Lemma 4. There does not exist a RAC drawing of the augmented square antiprism graph where an edge emanating from vertex v0 towards a vertex of quadrilateral Qi, i = 1, 2, crosses quadrilateral Qi. Proof. By Lemma 3, vertex v0 should lie in the interior of quadrilateral Qi, i = 1, 2, which is drawn planar due to Lemma 2. Assume to the contrary that in a RAC drawing of the augmented square antiprism graph, an edge emanating from vertex v0 towards a vertex of quadrilateral Q1, say va, crosses an edge, say (vc, vd), of quadrilateral Q1 (see Figure 10). Consider vertex vcd, which is incident to vertices vc and vd of quadrilateral Q2. Vertex vcd cannot lie "above" line ℓvc,vd and to the "left" of semi-line ℓ′ vd,va, since it cannot be connected to vertex v0. In addition, it cannot lie "above" line ℓvc,vd and to the "right" of semi-line ℓ′ vd,va, since in this case it cannot be connected to either vertex vc or v0. Furthermore, vertex vcd cannot be in the interior of the triangle formed by vertices v0, vc and vd, as it would not be feasible to be connected either to vertex vc or vd, since in either case, it crosses edge (v0, va). Also, vcd cannot be in the region formed by line ℓvc,vd and edges (v0, vd) and (v0, vb), as it could not be connected to vertex vc. Thus, vertex vcd should lie in the light-gray triangular face of Figure 10, along semi-line ℓvd,vc,vb. Following a similar reasoning scheme, we can prove that vertex vad, which is incident to vertices va, vd of quadrilateral Q1 and vertex vab of quadrilateral Q2, due to its adjacency with va, vd, can lie in the face formed by vertices va, vb, vd and the intersection point of edges (vd, vcd) and (v0, vb). However, under this restriction, vertex vad cannot be connected to vertex vcd, without crossing edge (v0, vb), which is already involved in a right-angle crossing (refer to the ⊓⊔ dashed edge of Figure 10). ℓ′ vd,va va Q1 vc v0 ℓvc,vd vad vd vcd ℓ′ vd,vc,vb vb Fig. 10: An edge emanating from vertex v0 towards a vertex of Q1, cannot cross Q1. Lemma 5. There does not exist a RAC drawing of the augmented square antiprism graph in which quadrilateral Q1 intersects Q2. Proof. From Lemmata 2, 3 and 4, it follows that the graph induced by quadrilateral Q1 and vertex v0 is drawn planar with vertex v0 in the interior of both quadrilaterals Q1 and Q2. Therefore, it should resemble the one illustrated in Figure 11a. 12 Q1 v0 (a) Q2 Q1 Q1 1 Q2 1 eq v0 (b) Fig. 11: (a) The graph induced by quadrilateral Q1 and vertex v0 is drawn planar with vertex v0 in the interior of quadrilateral Q1. (b) Q1 and Q2 cross and none of the vertices of Q2 is in the interior of Q1. In order to prove this lemma, we will contradict the following cases: (i) Q1 and Q2 cross and none of the vertices of Q2 is in the interior of quadrilateral Q1, (ii) two vertices of Q2 lie in the interior of Q1 and Q2 crosses either a single edge of Q1, or two edges of Q1, (iii) three vertices of Q2 lie in the interior of Q1, (iv) only one vertex of Q2 lies in the interior of Q1. We first assume that quadrilateral Q1 and quadrilateral Q2 cross and none of the vertices of quadrilateral Q2 is in the interior of quadrilateral Q1 (see Figure 11b). In this case, an edge of quadrilateral Q2, say eq, which is involved in the crossing, divides quadrilateral Q1 into two regions, say Q1 1. Obviously, edge eq should cross parallel edges of quadrilateral Q1. Then, vertex v0, which lies in the interior of quadrilateral Q1 and is incident to all vertices of quadrilateral Q1 cannot reside to none of Q1 1, without introducing a non-right angle crossing with edge eq. 1 and Q2 1 and Q2 We proceed to consider the case where quadrilaterals Q1 and Q2 cross and some of the vertices of quadrilateral Q2 are in the interior of quadrilateral Q1, whereas the remaining ones on its exterior. Let qa, qb, qc and qd be the vertices of quadri- lateral Q2. Assume that qa and qb lie within quadrilateral Q1, whereas qc and qd on its external face, such that edges (qa, qd) and (qb, qc) are perpendicular either to one edge of quadrilateral Q1 (see Figure 12a), or to two edges of Q1 (see Figure 12b). Note that edges (qa, qd) and (qb, qc) cannot be crossed by any other edge incident to both quadrilaterals, since they are already involved in right-angle crossings. However, all vertices of quadrilateral Q1 have to be connected to vertex v0. Assuming that one vertex of quadrilateral Q1 can utilize the "last" available edge of quadrilateral Q2 (i.e., edge (qa, qb)) to reach vertex v0 (refer to the dotted edges of Figures 12a and 12b), there exists at least one vertex of Q1, say vertex q, that cannot be connected to v0, without introducing non right-angle crossing (refer to the dashed edges of Fig- ures 12a and 12b). Following a similar reasoning scheme as for the previous cases, we can prove that the cases where (i) three vertices of Q2, say w.l.o.g., qa, qb and qc, lie in the interior of Q1 (see Figure 13a) , and (ii) only one vertex of Q2, say w.l.o.g, vertex qb, lies in the interior of Q1 (see Figure 13b), are led to a contradiction. ⊓⊔ Theorem 1. Any straight-line RAC drawing of the augmented square antiprism graph has two combinatorial embeddings. 13 qc qd qa Q2 v0 q This crossing is non right-angle. Q1 qd Q2 qc v0 qa Q1 q qb This crossing is non right-angle. qb (a) (b) Fig. 12: Vertices qa and qb are in the interior of Q1 and Q2 crosses (i) a single edge of Q1, or (ii) two edges of Q1. qd Q2 q qa qc Q1 v0 qb This crossing is non right-angle. (a) qc qd v0 qb qa q This crossing is non right-angle. (b) Fig. 13: (i) Vertices qa, qb and qc are in the interior of Q1. (ii) Vertex qb is in the interior of Q1. Proof. So far, we have managed to prove that both quadrilaterals Q1 and Q2 are drawn planar, do not cross, and have central vertex v0 to their interior. This suggests that either quadrilateral Q1 is in the interior of Q2, or quadrilateral Q2 is in the interior of Q1. However, in both cases, vertex v0, which has to be connected to the four vertices of the "external" quadrilateral, should inevitably perpendicularly cross the four edges of the "internal" quadrilateral, and this trivially implies only two feasible ⊓⊔ combinatorial embeddings. We extend the augmented square antiprism graph, by appropriately "glueing" mul- tiple instances of it, the one next to the other, either horizontally or vertically. Fig- ure 14a demonstrates how a horizontal extension of two instances, say G and G′, is realized, i.e., by identifying two "external" vertices, say v and v′, of G with two "exter- nal" vertices of G′ (refer to the gray-colored vertices of Figure 14a), and by employing an additional edge (refer to the dashed drawn edge of Figure 14a), which connects an "internal" vertex, say u, of G with the corresponding "internal" vertex, say u′, of G′. Let G ⊕ G′ be the graph produced by a horizontal or vertical extension of G and G′. Since each of G and G′ has two RAC combinatorial embeddings each, one would expect that G ⊕ G′ would have four possible RAC combinatorial embeddings. We will show that this is not true and, more precisely, that there only exists a single RAC combinatorial embedding. 14 v v′ G v u u′ ⇒ G′ G ⊕ G′ α β (a) u The bold drawn edges cannot be crossed v u′ u α β u′ G ⊕ G′ (b) v′ G′ u′ v v′ v′ e (c) v u ′ u ′ v (d) Fig. 14: (a) Horizontal extension of two instances of the augmented square antiprism graph, (b) The additional (dashed) edge does not permit the second instance to be drawn in the interior of the first one. (c) The vertices which are identified, during a horizontal or vertical extension (v and v′ in Figure), should be on the external face of each augmented square antiprism graph. (d) At each extension step the new instance of the augmented square antiprism graph may introduce a "turn". Theorem 2. Let G and G′ be two instances of the augmented square antiprism graph. Then, G ⊕ G′ has a unique RAC combinatorial embedding. Proof. Assume first that in a RAC drawing of G ⊕ G′, vertices v and v′ are on the external quadrilateral of G and graph G′ is drawn completely in the interior of G (see Figure 14b; since v and v′ are on the external face of G′, vertices α and β in Figure 14b should also be on the external face of G′). First observe that vertex u′ of G′, which is incident to vertices v and v′, cannot reside to the "left" of both edges (u, v) and (u, v′) (refer to the bold drawn edges of Figure 14b), since this would lead to a situation where three edges mutually cross and, subsequently, to a violation of Property 1 (see the gray-colored square vertex of Figure 14b). Therefore, vertex u′ should lie within the triangular face of G formed by vertices u, v and v′. The same similarly holds for the central vertex of G′, which is also incident to vertices v and v′. 15 By Property 2, any common neighbor of vertices u′ and v should also lie within the same triangular face of G, which progressively implies that entire graph G′ should reside within this face, as in Figure 14b. However, in this case and since u′ is incident to v and v′, edge (u, u′), which is used on a horizontal or a vertical extension, crosses the interior of G′, which is not permitted. This suggests that graph G′ should be on the exterior of G. Now assume that vertices v and v′, which are identified, during a horizontal or ver- tical extension, are along the internal quadrilateral of G in a RAC drawing of G ⊕ G′. This is illustrated in Figure 14c. Then, the edge, say e, which perpendicularly crosses edge (v, v′) and emanates from the external quadrilateral towards the central vertex of G (refer to the bold solid edge of Figure 14c) will be involved in crossings with G′. More precisely, we focus on vertex u′ of G′, which is incident to vertices v and v′. These edges will inevitably introduce non-right angle crossings, since one of them should cross edge e. Therefore, the vertices that are identified, during a horizontal or vertical extension, should always be on the external face of each augmented square antiprism graph and, subsequently, the drawing of the graph produced by a horizontal or vertical extension will resemble the one of Figure 14a, i.e., it has a unique embed- ⊓⊔ ding. Note that the extension which is given in Figure 14a, is ideal. In the general case, at each extension step the new instance of the augmented square antiprism graph may introduce a "turn", as in Figure 14d. We observe that by "glueing" a new instance of the augmented square antiprism graph on G ⊕ G′ either by a horizontal or a vertical extension, we obtain another graph of unique RAC combinatorial embedding. In this way, we can define an infinite class of graphs of unique RAC combinatorial embedding. This is summarized in the following theorem. Theorem 3. There exists a class of graphs of unique RAC combinatorial embedding. 4 The Straight-Line RAC Drawing Problem is NP-hard Theorem 4. It is N P-hard to decide whether an input graph admits a straight-line RAC drawing. Proof. We will reduce the well-known 3-SAT problem [11] to the straight-line RAC drawing problem. In a 3-SAT instance, we are given a formula φ in conjunctive normal form with variables x1, x2, . . . , xn and clauses C1, C2, . . . , Cm, each with three literals. We show how to construct a graph Gφ that admits a straight-line RAC drawing Γ (Gφ) if and only if formula φ is satisfiable. Figure 15 illustrates the gadgets of our construction. Each gray-colored square in these drawings corresponds to an augmented square antiprism graph. Adjacent gray squares form an extension (refer, for example, to the topmost gray squares of Figure 15a, which form a "horizontal" extension). There also exist gray squares that are not adjacent, but connected with edges. The legend in Figure 15 describes how the connections are realized. The gadget that encodes variable xi of formula φ is given in Figure 15a. The gad- get of variable xi consists of a combination of augmented square antiprism graphs, and, "horizontal" and "vertical" edges, which form a tower, whose RAC drawing has 16 xi−1 xi+1 Legend xi,m xi,m Corridor xi,1 xi,1 xi−1 xi+1 ⇔ ⇔ xk,i xl,i xj,i Ci xl xk xj (a) (b) (c) Fig. 15: Gadgets of our construction: (a) Variable gadget, (b) Dummy variable gadget, (c) Clause gadget 17 unique combinatorial embedding. One side of the tower accommodates multiple ver- tices that correspond to literal xi, whereas its opposite side accommodates vertices that correspond to literal xi (refer to vertices xi,1, . . . , xi,m and xi,1, . . . , xi,m in Fig- ure 15a). These vertices are called variable endpoints. Then, based on whether on the final drawing the negated vertices will appear to the "left" or to the "right" side of the tower, we will assign a true or a false value to variable xi, respectively. Pairs of con- secutive endpoints xi,j and xi,j+1 are separated by a corridor (see Figure 15a), which allows perpendicular edges to pass through it (see the bottommost dashed arrow of Figure 15a). Note that this is not possible through a "corridor" formed on a variable endpoint, since there exist four non-parallel edges that "block" any other edge passing through them (see the topmost dashed arrow of Figure 15a). The corridors can have variable height. In the variable gadget of variable xi, there are also two vertices (they are drawn as gray circles in Figure 15a), which have degree four. These vertices serve as "connectors" among consecutive variable gadgets, i.e., these vertices should be con- nected to their corresponding vertices on the variable gadgets of variables xi−1 and xi+1. Note that the connector vertices of the variable gadgets associated with vari- ables x1 and xn are connected to connectors of the variable gadgets that correspond to variables x2 and xn−1, respectively, and to connectors of dummy variable gadgets. Figure 15b illustrates a dummy variable gadget, which (similarly to the variable gadget) consists of a combination of augmented square antiprism graphs, and, "hor- izontal" and "vertical" edges, which form a tower. Any RAC drawing of this gadget has also unique combinatorial embedding. A dummy variable gadget does not support vertices that correspond to literals. However, it contains connector vertices (they are drawn as gray circles in Figure 15b). In our construction, we use exactly two dummy variable gadgets. The connector vertices of each dummy variable gadget should be connected to their corresponding connector vertices on the variable gadgets associ- ated with variables x1 and xn, respectively. The gadget that encodes the clauses of formula φ is illustrated in Figure 15c and resembles to a valve. Let Ci = (xj ∨ xk ∨ xl) be a clause of φ. As illustrated in Figure 15c, the gadget which corresponds to clause Ci contains three vertices2, say xj, xk, and xl, such that: xj has to be connected to xj,i, xk to xk,i and xl to xl,i by paths of length two. These vertices, referred to as the clause endpoints, encode the literals of each clause. Obviously, if a clause contains a negated literal, it should be connected to the negated endpoint of the corresponding variable gadget. The clause endpoints are incident to a vertex "trapped" within two parallel edges (refer to the bold drawn edges of Figure 15c). Therefore, in a RAC drawing of Gφ, only two of them can perpendicularly cross these edges, one from top (top endpoint ) and one from bottom (bottom endpoint ). The other one (right endpoint ) should remain in the interior of the two parallel edges. The one that will remain "trapped" on the final drawing will correspond to the true literal of this clause. The gadgets, which correspond to variables and clauses of φ, are connected to- gether by the skeleton of graph Gφ, which is depicted in Figure 16a. The skeleton consists of two main parts, i.e., one "horizontal" and one "vertical". The vertical part accommodates the clause gadgets (see Figure 16a). The horizontal part will be used in order to "plug" the variable gadgets. The long edges that perpendicularly cross (refer 2 With slight abuse of notation, the same term is used to denote variables of φ and vertices of Gφ. 18 to the crossing edges slightly above the horizontal part in Figure 16a), imply that the vertical part should be perpendicular to the horizontal part. The horizontal part of the skeleton is separately illustrated in Figure 16b. Observe that it contains one set of horizontal lines. Vertical Part Variable Gadgets Cm C2 C1 Horizontal Part (a) (b) Fig. 16: Illustration of the skeleton of the construction. Figure 17 shows how the variable gadgets are attached to the skeleton. More precisely, this is accomplished by a single edge, which should perpendicularly cross the set of the horizontal edges of the horizontal part. Therefore, each variable gadget is perpendicularly attached to the skeleton, as in Figure 17. Note that each variable gadget should be drawn completely above of these horizontal edges, since otherwise the connections among variable endpoints and clause endpoints would not be feasible. The connector vertices of the dummy variable gadgets, the variable gadgets and the vertical part of the construction, ensure that the variable gadgets will be parallel to each other (i.e., they are not allowed to bend) and parallel to the vertical part of the construction. We now proceed to investigate some properties of our construction. Any path of length two that emanates from a top- or bottom-clause endpoint can reach a variable endpoint either on the left or on the right side of its associated variable gadget. The first edge of this path should perpendicularly cross the vertical edges of the vertical 19 C3 = x1 ∨ x2 ∨ x3 x3 3 , x3 3 , x2 3 , x2 3 , x1 3 , x1 3 , C2 = x1 ∨ x2 ∨ x3 x3 2 , x3 2 , x2 2 , x2 2 , x1 2 , x1 2 , C1 = x1 ∨ x2 ∨ x3 x2 1 , x2 1 , x1 1 , x1 1 , x3 1 , x3 1 , Fig. 17: The reduction from 3-SAT to the straight-line RAC drawing problem. The input formula is φ = (x1 ∨x2 ∨x3)∧(x1 ∨x2 ∨x3)∧(x1 ∨x2 ∨x3). The drawing corresponds to the truth assignment x1=x3=true, x2=false. 20 part of the construction and pass through some corridors3, whereas the second edge will be used to realize the "final" connection with the variable gadget endpoint (see Figure 17). However, the same doesn't hold for the paths that emanate from a right- clause endpoint. These paths can only reach variable endpoints on the right side of their associated variable gadgets. More precisely, the first edge of the 2-length path should cross one of the two parallel edges (refer to the bold drawn edges of Figure 15c) that "trap" it, whereas the other one should be used to reach (passing through variable corridors) its variable endpoint (see Figure 17). Our construction ensures that up to translations, rotations and stretchings any RAC drawing of Gφ resembles the one of Figure 16. It is clear that the construction can be completed in O(nm) time. Assume now that there is a RAC drawing Γ (Gφ) of Gφ. If the negated vertices of the variable gadget that corresponds to xi, i = 1, 2, . . . , n, lie to the "left" side in Γ (Gφ), then variable xi is set to true, otherwise xi is set to false. We argue that this assignment satisfies φ. To realize this, observe that there exist three paths that emanate from each clause gadget. The one that emanates from the right endpoint of each clause gadget can never reach a false value. Therefore, each clause of φ must contain at least one true literal, which implies that φ is satisfiable. Conversely, suppose that there is a truth assignment that satisfies φ. We proceed to construct a RAC drawing Γ (Gφ) of Gφ, as follows: In the case where, in the truth assignment, variable xi, i = 1, 2, . . . , n is set to true, we place the negated vertices of the variable gadget that corresponds to xi, to its left side in Γ (Gφ), otherwise to its right side. Since each clause of φ contains at least one true literal, we choose this as the right endpoint of its corresponding clause gadget. As mentioned above, it is always feasible to be connected to its variable gadgets by paths of length two. This ⊓⊔ completes our proof. 5 Conclusions In this paper, we proved that it is N P-hard to decide whether a graph admits a straight-line RAC drawing. Didimo et al. [7] proved that it is always feasible to con- struct a RAC drawing of a given graph with at most three bends per edge. If we permit two bends per edge, does the problem remain N P-hard? It is also interesting to continue the study on the interplay between the number of edges and the required area in order to fill the gaps between the known upper and lower bounds. References 1. Angelini, P., Cittadini, L., Di Battista, G., Didimo, W., Frati, F., Kaufmann, M., Symvo- nis, A.: On the perspectives opened by right angle crossing drawings. In: Proc. of 17th International Sympsioum on Graph Drawing (GD09). LNCS, vol. 5849, pp. 21 -- 32 (2009) 2. Argyriou, E.N., Bekos, M.A., Symvonis, A.: Maximizing the total resolution of graphs. In: Proc. of 18th International Sympsioum on Graph Drawing (GD10) (2010), to appear 3. Arikushi, K., Fulek, R., Keszegh, B., Moric, F., Toth, C.: Drawing graphs with orthog- onal crossings. In: Proc. 36th International Workshop on Graph Theoretic Concepts in Computer Science (WG 2010) (2010), to appear 3 In Figure 17, the corridors are the gray-colored regions that reside at each variable gadget. 21 4. Battista, G.D., Eades, P., Tamassia, R., Tollis, I.G.: Algorithms for drawing graphs: an annotated bibliography. Compututational Geometry 4, 235 -- 282 (1994) 5. Bodlaender, H.L., Tel, G.: A note on rectilinearity and angular resolution. Journal of Graph Algorithms and Applications 8, 89 -- 94 (2004) 6. Di Giacomo, E., Didimo, W., Liotta, G., Meijer, H.: Area, curve complexity, and crossing resolution of non-planar graph drawings. In: Proc. of 17th International Sympsioum on Graph Drawing (GD09). LNCS, vol. 5849, pp. 15 -- 20 (2009) 7. Didimo, W., Eades, P., Liotta, G.: Drawing graphs with right angle crossings. In: Proc. of 12th International Symposium, Algorithms and Data Structures (WADS09). LNCS, vol. 5664, pp. 206 -- 217 (2009) 8. Didimo, W., Eades, P., Liotta, G.: A characterization of complete bipartite graphs. Information Processing Letters 110(16), 687 -- 691 (2010) 9. Dujmovic, V., Gudmundsson, J., Morin, P., Wolle, T.: Notes on large angle crossing graphs. In: Computing: Theory of Computing 2010. Australian Computer Society (2010) 10. Formann, M., Hagerup, T., Haralambides, J., Kaufmann, M., Leighton, F., Symvonis, A., Welzl, E., Woeginger, G.: Drawing graphs in the plane with high resolution. SIAM Journal of Computing 22(5), 1035 -- 1052 (1993) 11. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman (1979) 12. Garey, M., Johnson, D.: Crossing number is NP-complete. SIAM Journal of Algebraic Discrete Methods 4, 312 -- 316 (1983) 13. Garg, A., Tamassia, R.: Planar drawings and angular resolution: Algorithms and bounds (extended abstract). In: Proc. 2nd Annual European Symposium on Algorithms. pp. 12 -- 23 (1994) 14. Gutwenger, C., Mutzel, P.: Planar polyline drawings with good angular resolution. In: Proc. of 6th International Symposium on Graph Drawing. LNCS, vol. 1547, pp. 167 -- 182 (1998) 15. Huang, W.: Using eye tracking to investigate graph layout effects. Asia-Pacific Sympo- sium on Visualization pp. 97 -- 100 (2007) 16. Huang, W., Hong, S.H., Eades, P.: Effects of crossing angles. In: PacificVis. pp. 41 -- 46 (2008) 17. Kaufmann, M., Wagner, D. (eds.): Drawing Graphs: Methods and Models, LNCS, vol. 2025. Springer-Verlag (2001) 18. van Kreveld, M.: The quality ratio of RAC drawings and planar drawings of planar graphs. In: Proc. of 18th International Sympsioum on Graph Drawing (GD10) (2010), to appear 19. Lin, C.C., Yen, H.C.: A new force-directed graph drawing method based on edge-edge repulsion. In: Proc. of the 9th International Conference on Information Visualization. pp. 329 -- 334. IEEE (2005) 20. Malitz, S.M., Papakostas, A.: On the angular resolution of planar graphs. In: Proc. of the 24th Annual ACM Symposium on Theory of Computing (STOC92). pp. 527 -- 538. ACM (1992) 21. Purchase, H.C.: Effective information visualisation: a study of graph drawing aesthetics and algorithms. Interacting with Computers 13(2), 147 -- 162 (2000) 22. Purchase, H.C., Carrington, D.A., Allder, J.A.: Empirical evaluation of aesthetics-based graph layout. Empirical Software Engineering 7(3), 233 -- 255 (2002) 23. Ware, C., Purchase, H., Colpoys, L., McGill, M.: Cognitive measurements of graph aes- thetics. Information Visualization 1(2), 103 -- 110 (2002) 22
1211.1506
1
1211
2012-11-07T10:39:24
Fast Hamiltonicity checking via bases of perfect matchings
[ "cs.DS", "cs.CC", "cs.DM" ]
For an even integer t \geq 2, the Matchings Connecivity matrix H_t is a matrix that has rows and columns both labeled by all perfect matchings of the complete graph K_t on t vertices; an entry H_t[M_1,M_2] is 1 if M_1\cup M_2 is a Hamiltonian cycle and 0 otherwise. Motivated by the computational study of the Hamiltonicity problem, we present three results on the structure of H_t: We first show that H_t has rank at most 2^{t/2-1} over GF(2) via an appropriate factorization that explicitly provides families of matchings X_t forming bases for H_t. Second, we show how to quickly change representation between such bases. Third, we notice that the sets of matchings X_t induce permutation matrices within H_t. Subsequently, we use the factorization to obtain an 1.888^n n^{O(1)} time Monte Carlo algorithm that solves the Hamiltonicity problem in directed bipartite graphs. Our algorithm as well counts the number of Hamiltonian cycles modulo two in directed bipartite or undirected graphs in the same time bound. Moreover, we use the fast basis change algorithm from the second result to present a Monte Carlo algorithm that given an undirected graph on n vertices along with a path decomposition of width at most pw decides Hamiltonicity in (2+\sqrt{2})^{pw}n^{O(1)} time. Finally, we use the third result to show that for every \epsilon >0 this cannot be improved to (2+\sqrt{2}-\epsilon)^{pw}n^{O(1)} time unless the Strong Exponential Time Hypothesis fails, i.e., a faster algorithm for this problem would imply the breakthrough result of a (2-\epsilon)^n time algorithm for CNF-Sat.
cs.DS
cs
Fast Hamiltonicity checking via bases of perfect matchings Marek Cygan University of Warsaw Poland [email protected] Stefan Kratsch∗ Max-Planck-Institute Saarbrucken, Germany [email protected] Jesper Nederlof† Utrecht University The Netherlands [email protected] November 8, 2012 Abstract For an even integer t ≥ 2, the Matching Connectivity matrix Ht is a matrix that has rows and columns both labeled by all perfect matchings of the complete graph Kt on t vertices; an entry Ht [M1 , M2 ] is 1 if M1 ∪ M2 is a Hamiltonian cycle and 0 otherwise. Motivated by the computational study of the Hamiltonicity problem, we present three results on the structure of Ht : We first show that Ht has rank at most 2t/2−1 over GF(2) via an appropriate factorization that explicitly provides families of matchings Xt forming bases for Ht . Second, we show how to quickly change representation between such bases. Third, we notice that the sets of matchings Xt induce permutation matrices within Ht . Subsequently, we use the factorization to obtain an 1.888nnO(1) time Monte Carlo al- gorithm that solves the Hamiltonicity problem in directed bipartite graphs. Our algorithm as well counts the number of Hamiltonian cycles modulo two in directed bipartite or undi- rected graphs in the same time bound. Moreover, we use the fast basis change algorithm from the second result to present a Monte Carlo algorithm that given an undirected graph on n vertices along with a path decomposition of width at most pw decides Hamiltonicity in (2 + √2)pwnO(1) time. Finally, we use the third result to show that for every  > 0 this cannot be improved to (2 + √2 − )pwnO(1) time unless the Strong Exponential Time Hy- pothesis fails, i.e., a faster algorithm for this problem would imply the breakthrough result of a (2 − )n time algorithm for CNF-Sat. 1 Introduction The Hamiltonicity problem and its generalization to the traveling salesman problem are widely acknowledged to be two of the most famous NP-complete problems. Many classical algorithms were invented to tackle these problems (and variants thereof ), among them Cristofides’ approx- imation algorithm [12], the Lin-Kernighan heuristic [31], and a polynomial time approximation scheme for Euclidean TSP [1]. A very early and classical result belonging to this list is due to Bellman [4, 5] and, indepen- dently, Held and Karp [23]; it demonstrates that the traveling salesman problem can be solved in O(n22n ) time, where n denotes the number of vertices of the input graph. In order to get this result they introduced dynamic programming over subsets, which became a fundamental design ∗Part of the work was done at Utrecht University supported by the Nederlandse Organisatie voor Weten- schappelijk Onderzoek (NWO), pro ject: ’KERNELS’. †Supported by the Nederlandse Organisatie voor Wetenschappelijk Onderzoek (NWO), pro ject: ’Space and Time Efficient Structural Improvements of Dynamic Programming Algorithms’. 1 paradigm for obtaining exact exponential time algorithms (see for example [17] and [20, Chap- ter 3]). Considerable effort has been taken to improve these algorithms: More space efficient algorithms were already given independently by several authors [3, 27, 30]. In his influential survey, Woeginger [38] brought renewed attention to a question suggesting itself already from the 60’s: Can either the traveling salesman problem or the Hamiltonicity problem be solved in (2 − )nnO(1) for some  > 0? An affirmative answer was given for the special cases of bounded degree [18, 7, 26, 21] and claw-free graphs [11]. In a breakthrough result, Bjorklund [6] partially resolved the open question by giving an 1.66nnO(1) time Monte Carlo algorithm deciding undirected Hamiltonicity, using as a first step a 2n/2nO(1) time algorithm for bipartite graphs. Unfortunately, it seems hard to derandomize this result or to extend it to the traveling salesman problem without incurring a pseudo-polynomial dependence on the input weights. The algorithm of [6] instead of keeping track of all the vertices along the so far constructed path (as Bellman, Held and Karp), labels only some vertices and some edges used on the path. Bjorklund’s algorithm uses counting modulo two as a tool for canceling unwanted self-crossing walks, however it relies on the assumption that the Hamiltonian cycles under consideration satisfy particular counting invariants concerning the number of vertices and edges used. For this reason the algorithm of [6], to the best of our knowledge, can not determine the parity of the number of all Hamiltonian cycles. Recall that the algorithm of [4, 5, 23] uses dynamic programming based on the observation that if we have constructed a path from va to vb , then the only additional information needed is the set of vertices used along the way. Hence the essential information required to store for all subpaths is their endpoints and the set of visited vertices, leading to O(n2n ) table entries. Recall that for designing a fast dynamic programming algorithm, it is essential that one chooses the right strategy of decomposing a candidate solution. For example, if G has a small balanced separator1 of size 0.1V it seems impossible to modify the above algorithm in order to exploit this fact. In this work we study the following way to decompose a Hamiltonian cycle H : Consider an arbitrary ordering e1 , . . . , em of the edges E and decompose H for every i into H1 = {e1 , . . . , ei} ∩ H and H2 = {ei+1 , . . . , en} ∩ H . This suggests another dynamic programming strategy alternative to [4, 5, 23] that was much less well-studied, mainly because it seemed a priori that the essential information needed to store for a set of partial solutions H1 is 2θ(n lg n) : The degrees (zero, one, or two) of each vertex with respect to H1 and the pairing in which vertices of degree one are connected by H1 . The informed reader will notice that this way of decomposing solutions is inherent to dynamic programming algorithms that operate on tree decompositions or path decompositions. The notions of pathwidth /treewidth proved to be an excellent tool for dealing with many NP- hard problems on graphs. In the 1970s and 1980s, several groups of researchers discovered the concept independently. In their fundamental work on graph minors, Robertson and Seymour [37] introduced the notions path/treewidth and path/tree decomposition, and these became the dominant terminology. A graph having small path/treewidth means informally that it can be decomposed efficiently in a path/tree-like manner. Many problems can be solved using dynamic programming by decomposing a solution according to the given path/tree decomposition. We refer to [8] for more information on these notions. In early work, such as the influential result of Courcelle [13], algorithms with running times of the type f (pw)n were given2 . Later it was noticed that for many such algorithms the function f (pw) can be substantially improved, greatly improving the tractability as well. For example for many problems whose solutions can be verified by separately considering its intersection with all 1A vertex set X such after removing X , all connected components have size at most V /2. 2Assuming an input graph G on n vertices along with a path decomposition of G width pw is given. 2 neighborhoods of the vertices of the input graph (see [22]), we can obtain 2O(pw)nO(1) by employ- ing dynamic programming. For example the Independent Set, or equivalently, Vertex Cover, problem can be solved in 2pwn time [28, 34]. From the work of [25] and standard Karp-reduction it follows that this dependence cannot be improved to sub-exponential algorithms unless the Exponential Time Hypothesis fails, i.e., unless CNF-SAT has a subexponential algorithm. In [32] it was shown that under a stronger assumption (the so-called Strong Exponential Time Hy- pothesis (SETH)), the current algorithms are optimal even with respect to polynomial jumps, that is, problems with current best running time f (tw)nO(1) cannot be solved in f (tw)1−nO(1) for positive  where f (tw) is 2tw , 3tw for respectively Independent Set and Dominating Set. For the Traveling Salesman problem, or even the Hamiltonian cycle problem, the situa- tion is different since they are not local problems (see for example [22, Section 5]). In [16], the notion of a Catalan structure was introduced to give an algorithm that solves the k-path problems on H -minor free graphs in 2O(tw) time. To obtain this, their result works for ‘pairing- encodable’ problems (i.e. problems where the connectivity properties can be encoded by a matching/pairing) since it bounds the number of ways paths can intersect with a part of the tree decomposition. However, in [15] it was shown that along with many other connectivity problems, Hamiltonian cycle can be solved by a Monte Carlo algorithm in 4O(tw)nO(1) time. For many of these algorithms with running time f (tw)nO(1) , it was shown that an algorithm running in time f (tw)1−nO(1) would violate SETH. Nevertheless, the exact complexity of the Hamiltonian cycle problem remained elusive. Recently, a superset of the current authors, found a connection of the optimal substructure of a dynamic programming algorithm with the rank of a certain matrix [9]: Consider a matrix H with rows and columns indexed by partial solutions, with a 1 if and only if the two partial solutions combined give a valid solution, then if we have more than rk(H) partial solutions, one will be redundant in the sense that we can safely forget it. This leads to deterministic 2O(tw)nO(1) time algorithms for many connectivity problems, in a sense derandomizing the work of Cygan et al. [15], but the used techniques do not match their runtimes, e.g., the 4twnO(1) time for Hamiltonian cycle. Our contribution Inspired by the mentioned result from [9], we study a matrix that we call the Matching Con- nectivity matrix. We present a family of perfect matchings Xt , which we show to be a basis of the Matching Connectivity matrix, therefore we establish its rank. All further results of the paper use the basis Xt and its properties as its key tool, which we now elaborate on. Determining rank of the Matching Connectivity matrix. For an even integer t ≥ 2, the Matching Connectivity matrix Ht is a matrix that has rows and columns both labeled by all perfect matchings of the complete graph Kt on t vertices; an entry Ht [M1 , M2 ] is 1 if M1 ∪ M2 is a Hamiltonian cycle and 0 otherwise. The centerpiece of our work is that Ht has rank exactly 2t/2−1 over GF(2). To establish this result, we define an explicit family Xt of 2t/2−1 perfect matchings on Kt and show that its columns (or rows) form a basis of Ht over GF(2): First, essentially by design, each matching M ∈ Xt has a unique partner M (cid:48) ∈ Xt such that their union is a Hamiltonian cycle. Thus, the rows and columns labeled by Xt induce a permutation matrix, which implies the required rank lower bound. Second, we give an explicit factorization of Ht into a product of two rectangular matrices with inner dimensions indexed by Xt in Theorem 3.4. This proves that Xt is indeed a basis, provides an explicit formula for linear combinations, and completes the claimed rank bound (see Section 3). (cid:48) In [36] a matrix H t is studied that is obtained by restricting Ht to all perfect matchings of the 3 t is exactly (cid:0) t−1 (cid:1) using group representation theory. Using this complete bipartite graph with independent sets of size t/2. There it is shown that when taken (cid:48) t/2−1 over the reals, the rank of H the authors disprove the original3 ‘log-rank conjecture’ in communication complexity since they also showed that the non-deterministic communication complexity of determining whether two such matchings give a Hamiltonian cycle is Ω(n log log n). In [9, Lemma 3.13] a factorization of a matrix that contains Ht as submatrix into two matrices with inner dimension 2t−1 was given. Exact algorithms for Hamiltonicity. By exploiting the peculiar form of the basis Xn we show that the number of distinct subsets of all the matchings of Xn is O(1.888n ). Together with Theorem 3.4 this allows us to show deterministic algorithms computing the parity of the number of Hamiltonian cycles in undirected graphs and directed bipartite graphs (section 3.2.2) in 1.888nnO(1) time. By combining those results with the Isolation Lemma we obtain Monte Carlo algorithms solving the decision version of Hamiltonicity in both undirected and directed bipartite graphs within the same running time. Even though our algorithm for undirected graphs is slower than the algorithm of Bjorklund [6], we believe it is of interest as it uses very much different tools and allows solving the problem also in directed bipartite graphs. We would like to recall that solving the Hamiltonicity problem on undirected bipartite graphs in O((2 − )n ) time was the first step of Bjorklund on the way to the algorithm for general undirected graphs. For this reason we believe that studying directed bipartite graphs is justified. Algorithm for bounded pathwidth. Using the set of perfect matchings Xt we obtain a faster algorithm for solving the Hamiltonian cycle problem via a non-trivial pathwidth dynamic programming routine. Regarding the algorithm, already from the rank bound it can be argued that only (2 + √2)pw space is needed to solve Hamiltonian cycle on a graph with given path decomposition of width pw. The key idea is to replace memoization of all partial solutions by storing only fingerprints of groups of solutions that encode how many partial solutions are consistent with a given basis matching. In fact, these numbers are stored only modulo two which requires only one bit per basis matching. To achieve also time (2 + √2)pwnO(1) we show in Lemma 4.1 how to efficiently convert these fingerprints from one basis to another, which permits us to perform the needed dynamic programming table computations (in particular insertion of edges into partial solutions); this crucially depends on the structure of Xt . Notably, Lemma 4.1 gives a second proof of the rank upper bound for Ht , but it does so in a more implicit way; in particular it does not provide an explicit factorization (see Section 4). Let us point out the main differences to the related algorithmic results obtained by Bod- laender et al. [9]: The present faster algorithm for Hamiltonicity parameterized by pathwidth required a new dynamic programming strategy, unlike the results of [9] that speed up existing formulations. Furthermore, we require randomization (for the Isolation Lemma [33]) to guar- antee a unique solution, in order for the fingerprinting approach to work. Finally, achieving time (2 + √2)pwnO(1) depends crucially on the structure of our basis matchings Xt (to allow for Lemma 4.1) and does not appear to follow directly from the rank. (Similarly, the subsequent lower bound requires the existence of a sufficiently large permutation/identity matrix in Ht and does not follow directly from the rank lower bound.) Matching lower bound assuming SETH. We show that if the running time of our algo- rithm can be significantly improved, then satisfiability of CNF-Sat formula’s of m clauses and n 3A weakened version is still a standing open problem in communication complexity [2, Section 13.2]. 4 vertices can be determined in (2 − )nmO(1) time. The latter would contradict the Strong Expo- nential Time Hypothesis (SETH) introduced in [25]. Although there is not consensus about it’s truth, a number of results have been given assuming SETH [35, 14, 32, 15]. As with previous results, this result should be interpreted that there is a boundary to significantly improving our algorithm, namely finding the so far elusive (2 − )nmO(1) algorithm for CNF-Sat. For the tight runtime lower bound we use our basis as a part of a gadget in a reduction from CNF-Sat. Although the basic setup is similar to previous lower bounds [32, 15] our reduction is different in the sense that we require a very generic gadget (the induced subgraph gadget, discussed in Subsection 5.1). Using this, we can exploit the crucial property that the submatrix of the Matching Connectivity matrix that is induced by the columns and rows of Xt is a permutation matrix, i.e., each basis matching has a unique partner in Xt such that their union is a Hamiltonian cycle. Then, in a similar but technically challenging vein to the reductions of [32, 15], choices can be transferred through a series of gadgets (see Section 5). Further algorithmic conclusions. As a corollary of our bounded pathwidth algorithm in Section 4 (Corollary 4.5) we also obtain a (2 + √2)n/6nO(1) = 1.1583nnO(1) time Monte Carlo algorithm for Hamiltonicity in cubic graphs, which to the best of our knowledge is the fastest known algorithm in this class of graphs. 2 Preliminaries Graphs. We use standard graph notation. For a graph G = (V , E ) we denote V (G) and E (G) for its vertex and edge set respectively. For X, Y ⊆ V we let E (X, Y ) be the set of all edges with one endpoint in X and one in Y . A Hamiltonian cycle is the edge set of a simple cycle that visits each vertex exactly once. A cycle cover is a set of edges F ⊆ E such that each vertex of G is incident with at exactly two of these edges (i.e., the edges form cycles). In a partial cycle cover each vertex is incident with at most two edges (i.e., the edges form paths and cycles). Perfect matchings. A perfect matching of a graph is a set of edges such that each vertex is incident with exactly one of them. It is well known that the union of any two perfect matchings in a graph forms a cycle cover of the graph (where some cycles are potentially of length 2). Given some base set U , we use Π2 (U ) for the set of all perfect matchings of U (i.e., if U has no graph structure then all partitions into sets of size two each is included). Borrowing from the partition lattice partially ordered by refinement, we use M1 (cid:117) M2 = {U }, for M1 , M2 ∈ Π2 (U ), to express the fact that the union of the two perfect matchings M1 and M2 is a Hamiltonian cycle; for two perfect matchings this is equivalent to getting the trivial partition {U } into a single set as the outcome of the meet-operation (cid:117) . We do not require any further tools or notation from the partition lattice. that (cid:83) Bx = V and the following properties hold: Pathwidth and path decompositions. A path decomposition of a graph G = (V , E ) is a path P in which each node x has an associated set of vertices Bx ⊆ V (called a bag ) such 1. For each edge {u, v} ∈ E (G) there is a node x in P such that u, v ∈ Bx . 2. If v ∈ Bx ∩ By then v ∈ Bz for all nodes z on the (unique) path from x to y in P. The pathwidth of P is the size of the largest bag minus one, and the pathwidth of a graph G is the minimum pathwidth over all possible path decompositions of G. Since our focus here is on dynamic programming over a path decomposition we only mention in passing that the 5 related notion of treewidth can be defined in the same way, except for letting the nodes of the decomposition form a tree instead of a path. It is common for the presentation of dynamic programming to use path and tree decom- positions that adhere to some simplifying properties, in order to make the description easier to follow. The most commonly used notion is that of a nice tree decomposition, introduced by Kloks [29]; the main idea is that adjacent nodes can be assumed to have bags differing by at most one vertex (this can be achieved without increasing the treewidth). For an overview of tree decompositions and dynamic programming on tree decompositions see [10, 24]. In a similar way, but using also the extension of introduce edge bags from [15] we define nice path decompositions as follows. Definition 2.1 (Nice Path Decomposition). A nice path decomposition is a path decomposition where the underlying path of nodes is ordered from left to right (the predecessor of any node is its left neighbor) and in which each bag is of one of the following types: • First (leftmost) bag: the bag associated with the leftmost node x is empty, Bx = ∅. • Introduce vertex bag: an internal node x of P with predecessor y such that Bx = By ∪ {v} for some v /∈ By . This bag is said to introduce v . • Introduce edge bag: an internal node x of P labeled with an edge {u, v} ∈ E (G) with one predecessor y for which u, v ∈ Bx = By . This bag is said to introduce uv . • Forget bag: an internal node x of P with one predecessor y for which Bx = By \ {v} for some v ∈ By . This bag is said to forget v . • Last (rightmost) bag: the bag associated with the rightmost node x is empty, Bx = ∅. It is easy to verify that any given path decomposition of pathwidth pw can be transformed in time V (G)pwO(1) into a nice path decomposition without increasing the width. otherwise. If ω : U → {1, . . . , N }, we shorthand ω(S ) = (cid:80) Further notation. For two integers a, b we use a ≡ b to indicate that a is even if and only if b is even. We use Iverson’s bracket notation: if p is a predicate we let [p] be 1 if p if true and 0 e∈S ω(e) for S ⊆ U . 3 Structure of the Matching Connectivity matrix and applica- tions The section is outlined as follows: We will first determine the structure of the Matching Con- nectivity matrix Ht in Subsection 3.1. More specifically, we give a basis and determine the rank exactly through an explicit matrix factorization. In Subsection 3.2 we will give an application of the matrix factorization to exact exponential algorithms for Hamiltonicity. 3.1 Bases and factorization of Matching Connectivity matrix. Recall that the matrix Ht has rows and columns both labeled by all perfect matchings of the complete graph Kt on t vertices; an entry Ht [M1 , M2 ] is 1 if M1 ∪ M2 is a Hamiltonian cycle and 0 otherwise. The dimension of the matrix is t! ( t 2 )! · 2 2 × t t! ( t 2 )! · 2 . t 2 6 Figure 1: The matrix H6 . Letting the baseset be {0, . . . , 5} matching 1 indexing row and column 1 equals {{0, 1}, {2, 3}, {4, 5}}. The set Xt = {1, 2, 4, 5} from Definition 3.1 is easily seen to be a row basis; the linear combinations are depicted in the last column. Let us point our some small cases: For t = 2 we have only one perfect matching on the two vertices, and with the union of two such matchings being considered as a Hamiltonian cycle (in all other cases, where t ≥ 4, there cannot be a Hamiltonian cycle if the two perfect matchings have at least one edge in common). For t = 4, there are 3 perfect matchings and H3 is easily seen to be the complement of the 3 × 3 identity matrix. The matrix H6 is a 15 × 15 matrix shown in Figure 1. To prove the exact value of the rank we introduce for each even t ≥ 2 a family Xt of 2t/2−1 perfect matchings with the goal of proving that the corresponding columns (or rows) of Ht form a basis over GF(2). The definition of Xt requires the vertices to be ordered, say 0, 1, . . . , t − 1, and edges in the matchings are very local, i.e., their endpoints are at most at distance three with respect to the ordering. From the structure of the matchings it will be easy to see that they give a lower bound for the rank of Ht : The submatrix of Ht induced by rows and columns from Xt is a permutation matrix, which already has rank 2t/2−1 itself. This property will be of the essence for our lower bound on the runtime of pathwidth-based dynamic programming for the Hamiltonian cycle problem in Section 5. Getting the matching upper bound is more involved. We obtain this result by giving a concrete factorization of Ht in terms of two rectangular submatrices of Ht induced by the rows respectively columns Xt in Ht ; this is done by a rather technical inductive argumentation. This will form the basis of our algorithm from Subsection 3.2. Let us begin by introducing the families Xt . For a perfect matching M ∈ Π2 (U ) we define a function αM : U → U with αM (i) = j if and only if {i, j } ∈ M , i.e., αM maps each element of U to its partner in the perfect matching M . We shorthand Ut := {0, 1, . . . , t − 1}. 7 Nr.123456789101112131415LC100001101111011012000101110011101230001101011010111+2401100001110110145101000101011110561100001101100114+570110110000110111+481101010001011102+4+591011100001101011+2+5101011010110000112+5111100111010001011+4+5120111101100001101+2+4131101100110110001+2+4+5141010111101010001+5150111011011100002+4 Definition 3.1. Let ε denote the empty string. We let X (2, ε) := {{0, 1}} and X2 := {X (2, ε)}. Let t ≥ 4 be an even integer and let a be a bit-string of length t 2 − 2. We define perfect matchings X (t, a0) and X (t, a1) of Ut = {0, . . . , t − 1} as follows: X (t, a1) := X (t − 2, a) ∪ {{t − 2, t − 1}}, X (t, a0) := (X (t − 2, a) \ {{t − 3, α(t − 3)}}) ∪ {{t − 2, α(t − 3)}, {t − 3, t − 1}}. We shorthand X (a) for X (2a + 2, a) since the bitstring a determines the size t of the base set (namely Ut ). We use a to denote the binary complement of a bit-string a. Finally, we let Xt be the set of all perfect matchings X := X (t, a) for any bitstring a of length t 2 − 1. Unfortunately, the formal definition is not very enlightening regarding the actual structure of the perfect matchings X (t, a) in Xt . Let us clarify their structure by first showing the matchings for t = 4 and t = 6; recall that X (2, ε) = {{0, 1}}. X (4, 0) = {{0, 2}, {1, 3}} X (4, 1) = {{0, 1}, {2, 3}} X (6, 10) = {{0, 1}, {2, 4}, {3, 5}} X (6, 11) = {{0, 1}, {2, 3}, {4, 5}} X (6, 00) = {{0, 2}, {1, 4}, {3, 5}} X (6, 01) = {{0, 2}, {1, 3}, {4, 5}} When recursively constructing further perfect matchings for some even integer t ≥ 4, we always either add another edge on the two new elements (when the new bit is 1) or we replace the last edge (i.e., the one matching t − 3 to t − 4 or t − 5; note that t − 3 is the last element for t(cid:48) = t − 2) by matching its vertices to the two new elements (when the new bit is 0). Let us explain the intuition behind the bitstrings: Let t = 6 and group the elements as 0 1, 2 3, 4 5. Observe that the matchings X (t, ·) are exactly all choices of matching the elements such that each edge connects two elements that have exactly one dividing vertical line between them, i.e., all choices of perfect matchings that match only elements from adjacent groups. Now the first bit in the bitstring determines whether the first edge is {0, 1} or {0, 2} (these are all possible options for matching 0 under the group restriction). Depending on this either 2 or 1 still needs to be matched to 3 or 4; the latter choice is determined by the second bit. The last edge must always go to element t − 1 (i.e., 5 in this example), so there are only t 2 − 1 bits. Proposition 3.2. Let t ≥ 2 be an even integer, and group the elements {0, . . . , t − 1} into 0 1, 2 . . . t − 3, t − 2 t − 1. The family Xt consists of al l perfect matchings that match only elements from different, but adjacent groups. There are 2t/2−1 such perfect matchings. Clearly, the presented families of perfect matchings, one for each even integer t, have a very particular and symmetric structure. Our aim is to show that the 2t/2−1 perfect matchings form a basis for the Matching Connectivity matrix Ht . Regarding any two such matchings X (t, a) and X (t, b) it is not hard to show that their union is a Hamiltonian cycle if and only if a = b. Proposition 3.3. Let t ≥ 4 be an even integer and let a and b be bit-strings of length t 2 − 1. Then X (t, a) ∪ X (t, b) is a Hamiltonian cycle of Kt , or equivalently, X (t, a) (cid:117) X (t, b) = {Ut}, if and only if b = a. Proof. Consider the first position, say i, such that a[i] = b[i] (we consider a and b to be indexed from left to right, starting with 0). All earlier positions j < i are hence different, and following the definition of X (t, ·) this means that they prescribe exactly opposite choices. E.g., one matching will match 0 to 1 and the other matches it to 2, without loss of generality {0, 1} ∈ X (a) and {0, 2} ∈ X (b). Consequently, the next bit specifies the matching for 2 in X (a) and the matching for 1 in X (b). This pattern continues and effectively we obtain two alternating paths 8 that start from 0 and follow edges from X (a) and X (b) alternatingly. If the paths meet only at t − 1 (for which there is no bit that allows an alternate choice of matching) then together they give a Hamiltonian cycle. Since we assumed that a[i] = b[i], the paths meet when the bits prescribe that both matchings match to the same element (it can be verified that bit i decides whether the so far unmatched element of 2i − 1 and 2i is matched to 2i + 1 or 2i + 2). Thus, we have found a closed cycle in the union of X (a) and X (b) which does not contain all vertices, hence they do not form a Hamiltonian cycle. (Note the special case of a[0] = b[0] which indicates that both matchings contain {0, p} for p ∈ {1, 2}.) From Proposition 3.3 we directly get a rank lower bound of 2t/2−1 since the submatrix given by all rows and columns of matchings X (t, ·) is a permutation matrix of size 2t/2−1 × 2t/2−1 . Now we state the main theorem of this section. Due to its technicality, the proof is deferred to Section A. The statement of the theorem is equivalent to saying that the Matching Connectivity matrix Ht can be written as the product of two rectangular submatrices of Ht whose rows respectively columns are labeled by matchings from Xt . This implies that the set of those rows/columns forms a basis for Ht and that its rank is 2t/2−1 . (cid:88) Theorem 3.4. Let t ≥ 2 be an even integer and let M1 , M2 ∈ Π2 (Ut ). It holds that [M1 (cid:117) M2 = {Ut}] ≡ [M1 (cid:117) X (t, a) = {Ut}] · [M2 (cid:117) X (t, a) = {Ut}], a∈{0,1}t/2−1 where X (t, a), X (t, a) ∈ Xt according to Definition 3.1. (Each matching in Xt occurs exactly twice, once as X (t, a) and once as X (t, a).) Corollary 3.5. The rank of the Matching Connectivity matrix Ht over GF(2) is 2t/2−1 for al l even integer t ≥ 2. Proof. It follows from Proposition 3.3 that the rank is at least 2t/2−1 : The Matching Connec- tivity matrix Ht contains a 2t/2−1 × 2t/2−1 submatrix induced by the columns and rows of all perfect matchings in Xt which is a permutation matrix. From Theorem 3.4 we immediately get that the rank is at most 2t/2−1 : We can read the theorem statement as a factorization of Ht as the product of two submatrices of Ht . The first submatrix has rows labeled by all perfect matchings on Ut and columns labeled by basis match- ings X (t, a) for lexicographically ordered bitstrings a. The second matrix has columns labeled by all perfect matchings of Ut and rows labeled by basis matchings X (t, a) for lexicographi- cally ordered bitstrings a. The rank upper bound follows immediately from the fact that both matchings have rank at most 2t/2−1 (corresponding to their smaller dimension). 3.2 Exact exponential algorithms for Hamiltonicity In this section we present Monte Carlo algorithms for solving the Hamiltonian cycle problem in time O(1.888npoly(n)) in undirected graphs and directed bipartite graphs. These algorithms are based on further ideas and insights about the families Xt of perfect matchings, and in particular we greatly rely on Theorem 3.4. First,we show that to solve the decision version it is enough to solve the problem of computing the parity of the number of Hamiltonian cycles modulo two. The main part of our algorithm lies in the proofs of the following two lemmas (the proofs are provided in Section 3.2.2). Lemma 3.6. There is an algorithm, which given an undirected graph G = (V , E ) together with a weight function ω : E → {1, . . . , ωmax} finds the parity of the number of Hamiltonian cycles of weight w for every w ∈ [0, . . . , nωmax ] in O(1.888npoly(n + ωmax )) time. 9 Lemma 3.7. There is an algorithm, which given a directed bipartite graph G = (V , A) together with a weight function ω : A → {1, . . . , ωmax} finds the parity of the number of Hamiltonian cycles of weight w for every w ∈ [0, . . . , nωmax ] in O(1.888npoly(n + ωmax )) time. Now, by an application of the Isolation Lemma, we can show that our modulo two counting of solutions suffices to determine (with high probability) whether or not G is Hamiltonian. Definition 3.8. A function ω : U → Z isolates a set family F ⊆ 2U if there is a unique S (cid:48) ∈ F with ω(S (cid:48) ) = minS∈F ω(S ). Lemma 3.9 (Isolation Lemma, [33]). Let F ⊆ 2U be a set family over a universe U with F > 0. For each u ∈ U , choose a weight ω(u) ∈ {1, 2, . . . , N } uniformly and independently at random. Then prob[ω isolates F ] ≥ 1 − U /N . Theorem 3.10. There exists a Monte Carlo algorithm solving the Hamiltonian cycle problem in O(1.888npoly(n)) time in undirected graphs and directed bipartite graphs. Proof. Given a graph G (either undirected, or directed bipartite) with m edges (arcs), for each edge (arc) assign an integer weight from the interval [1, . . . , 2m] uniformly and independently at random. Then we use Lemma 3.6 (Lemma 3.7) to calculate the parity of the number of Hamiltonian cycles of each weight w ∈ [0, . . . , nωmax ]. If for some w there is an odd number of Hamiltonian cycles, then our algorithm returns YES, otherwise it returns NO. The running time of the algorithm follows from the running time of the black-box usage of the parity calculating algorithm. If there is no Hamiltonian cycle in our graph, then our algorithm certainly returns NO. However, if the graph contains at least one Hamiltonian cy- cle, then by Lemma 3.9 with probability at least 1/2 our weight function isolates the family of all Hamiltonian cycles of G and consequently for some weight there is an odd number of Hamiltonian cycles and our algorithm returns YES. Therefore we have obtained a Monte Carlo algorithm. 3.2.1 Further uses of the basis matchings In this section we give two technical lemmas that form the core of our two algorithms, which are based on the families Xn of perfect matchings introduced in Section 3. First, we show that the number of subsets of all matchings in Xn is bounded by O(1.888n ) (Lemma 3.11). Second, we show how to compute the number of extensions of basis matchings to Hamiltonian cycles (Lemma 3.14); for this we use dynamic programming over the mentioned subsets of basis matchings. Lemma 3.11. The set of al l subsets of al l matchings from the basis Xn contains O(1.888n ) distinct matchings. Proof. Recall that Xn = {X (n, a) a ∈ {0, 1}n/2−1}. For an even integer n define: t(n) = {S ⊆ X (n, a) a ∈ {0, 1}n/2−1} t2 (n) = {S ⊆ X (n + 2, a) a ∈ {0, 1}n/2 ∧ S ∩ {{n, n + 1}, {n − 1, n + 1}} = ∅} . Less formally, t(n) is the number of distinct matchings being subsets of the basis, whereas for t2 (n) we consider longer bitstrings, and additionally we assume that the subset does not contain an edge incident to the last element of the universe, i.e., to n + 1. In what follows we prove the following inequalities: t(n) ≤ 2t(n − 2) + t2 (n − 2) , t2 (n) ≤ 4t(n − 2) + t2 (n − 2) . 10 The first inequality follows from the case analysis of the last bit of the string a and whether S contains the edge incident with n − 1 or not (which we refer to as the last edge). When we analyze t(n) we have 4 cases: • the last bit of a is 0, the set S contains the last edge, • the last bit of a is 1, the set S contains the last edge, • the last bit of a is 0, the set S does not contain the last edge, • the last bit of a is 1, the set S does not contain the last edge. Note that all the subsets S from the first two cases can be upper bounded by 2t(n − 2), and the from the second two cases by t2 (n − 2), which follows directly from the definition of t2 . Now we analyze t2 (n), here we have 8 cases to consider, depending on the last two bits of a (4 choices), and whether S contains the edge between {n − 3, n − 2} and {n − 1, n} (2 choices), which we call the penultimate edge (note that the edge incident to n + 1 is definitely not contained in S ). When S contains the penultimate edge, then we bound each of the 4 cases depending on the last two bits of a independently by t(n − 2). Observe that so far we made no savings and no cases we considered identical. However the key case is when S does not contain the penultimate edge, which means that S contains neither the penultimate nor the last edge. All 4 such cases (cid:19) (cid:18)2 4 can be upper bounded by t2 (n − 2), as the last bit of a does not matter anymore. Observe that t(2) = 2 and t2 (2) = 3. Moreover if we multiply the horizontal vector we obtain (a, b) where a ≥ t(n + 2) and b ≥ t2 (n + 2). (t(n), t2 (n)) by the matrix A = 1 1 (cid:32) 1−√ (cid:33) (cid:32) (cid:33) (cid:32) 3−√ (cid:33) At the same time A = BDB−1 , where √ 17 −1 = 2 2 2 , D = 1 1 0 (cid:16) 3−√  Consequently An = BDnB−1 where 2 Dn = (cid:17)n/2 (cid:16) 3+ 0 √ 17 therefore t(n) = O( ) and the claimed upper bound follows, since matrices B and 2 B−1 contain only fixed constants which are hidden inside the O-notation. In fact one can show that our analysis is tight, since we do not overcount any subsets S neither in t(n) nor in t2 (n) in our case analysis. 0 √ 3+ 2 (cid:17)n (cid:16) 3+ 0 √ 2 √ √ − 1√ 1+ 17 17 − 1−√ 17 2 17 √ 1√ 17 2 17 (cid:17)n B = , B 17 17 1+ 17 17 . 17 Definition 3.12 (perfect matchings). For an undirected graph H by Π2 (H ) we detote the set of perfect matchings in H . Recall that by Π2 (V ) we denote the set of all matchings in the complete graph on V . Definition 3.13 (extensions to Hamiltonian cycle). For an undirected graph H = (V , E ), a weight function ω : E → {0, . . . , ωmax}, a matching M ∈ Π2 (V ) and an integer w by ext(M , w, H, ω) we denote the number of perfect matchings in H of weight w which together (cid:88) with M form a Hamiltonian cycle, i.e., M (cid:48)∈Π2 (H ),ω(M (cid:48) )=w (cid:117) M = {V }]. ext(M , w, H, ω) = [M (cid:48) 11 Lemma 3.14. Given an undirected graph G = (V , E ) and a weight function ω : E → {0, . . . , ωmax} one can in O(1.888npoly(n+ωmax )) time compute al l the (nωmax+1)2n/2−1 values ext(X (n, a), w, G, ω) for a ∈ {0, 1}n/2−1 and 0 ≤ w ≤ nωmax . Proof. For a (not necessarily perfect) matching M in G, a vertex v and weight 0 ≤ w ≤ nωmax let t[M ][v ][w] be the number of walks in the complete graph on V from an arbitrary fixed vertex v1 to the vertex v which (i) contain an even number of edges, (ii) start with an edge of M , (iii) alternately contain an edge of M and an edge of E , (iv) use each edge of M exactly once (v) the total weight of edges from E equals w. Observe that ext(M , w, G, ω) = t[M ][v1 ][w], hence it is enough to describe a dynamic programming routine computing all the values t[X (n, a)][v1 ][w] for a ∈ {0, 1}n/2−1 , 0 ≤ w ≤ nωmax . (cid:88) We use the recursive formula uu(cid:48)∈M u∈N (v) (cid:48) t[M \ {uu t[M ][v ][w] = (cid:48) }][u ][w − ω(u, v)] . We also define a corner case t[∅][v ][w] = [v = v1 ∧ w = 0] for v ∈ V . By Lemma 3.11 the above formulas together with memoization proved the claimed algorithm. 3.2.2 Proofs of Lemmas 3.6 and 3.7 In this section we prove Lemmas 3.6 and 3.7, that is we focus on computing the number of weighted Hamiltonian cycles modulo two. Proof of Lemma 3.6. First, we iterate over pairs of distinct edges e1 , e2 incident to some arbi- trary fixed vertex v1 . We want to find the parity of the number of Hamiltonian cycles containing both e1 and e2 . Note that for a different pair of edges incident to v1 we count different Hamil- tonian cycles and each Hamiltonian cycle is counted exactly once. Since we need an additional assumption that n is even, if this is not the case we subdivide the edge e1 , resulting in two new 1 ) = ω(e1 ), ω(e(cid:48)(cid:48) 1 , e(cid:48)(cid:48) 1 and we set ω(e(cid:48) 1 ) = 0, where e(cid:48) edges e(cid:48) 1 is incident to v1 . We somewhat abuse notation and by e1 denote the edge e(cid:48) 1 . Observe that there is a bijection between weighted Hamiltonian cycles before the subdivision and after the subdivision. Note that any Hamiltonian cycle containing e1 and e2 can be uniquely decomposed into two perfect matchings M1 , M2 in G where e1 ∈ M1 and e2 ∈ M2 . Let us fix a weight 0 ≤ w ≤ nωmax . Our goal is to compute the number of pairs (M1 , M2 ), where M1 , M2 are perfect matchings in G, e1 ∈ M1 , e2 ∈ M2 , ω(M1 ) + ω(M2 ) = w and M1 ∪ M2 is a Hamiltonian cycle. Formally, we (cid:88) (cid:88) want to calculate the following sum modulo two M2∈Π2 (G) M1∈Π2 (G) e2∈M2 e1∈M1 ω(M1 )+ω(M2 )=w [M1 (cid:117) M2 = {V }] . 12 = [M1 (cid:117) X (n, a) = {V }] · [M2 (cid:117) X (n, a) = {V }] (cid:88) M2∈Π2 (G) e2∈M2 ω(M1 )+ω(M2 )=w ext(X (n, a), w1 , (V , E1 ), ω) · ext(X (n, a), w2 , (V , E2 ), ω). (cid:88) (cid:88) (cid:88) By Theorem 3.4 the above formula is equivalent (modulo two) to M2∈Π2 (G) M1∈Π2 (G) a∈{0,1}n/2−1 (cid:88) (cid:88) e2∈M2 e1∈M1 ω(M1 )+ω(M2 )=w [M1 (cid:117) X (n, a) = {V }] M1∈Π2 (G) a∈{0,1}n/2−1 (cid:88) (cid:88) e1∈M1 a∈{0,1}n/2−1 w1+w2=w In the above, we first change the summation order, and then for i = 1, 2 denote Ei = (E \ E (v1 , V )) ∪ {ei}. Note that all perfect matchings contributing to ext(X (n, a), w1 (V , E1 ), ω) (and analogously for E2 ) contain the edge e1 , as this is the only edge in the graph (V , E1 ) incident to v1 . By Lemma 3.14 we can find all the needed values in the claimed running time, hence the proof of Lemma 3.6 follows. [M2 (cid:117) X (n, a) = {V }] = In the proof of Lemma 3.7 we have to deal with directed graphs, while still using Lemma 3.14 which can only handle undirected graphs. However as we will show one can exploit the bipar- titeness to harness the directedness of the graph. Proof of Lemma 3.7. Let G = (V1 (cid:93) V2 , A) be a directed bipartite graph. Clearly we can assume V1 = V2 , since otherwise there are no Hamiltonian cycles in G. We create two auxiliary weighted undirected bipartite graphs G(cid:96) = (V1 (cid:93) V2 , E(cid:96) , ω(cid:96) ) and Gr = (V1 (cid:93) V2 , Er , ωr ) where E(cid:96) = {uv : u ∈ V1 , v ∈ V2 , (v , u) ∈ A}, Er = {uv : u ∈ V1 , v ∈ V2 , (u, v) ∈ A} and for u ∈ V1 , v ∈ V2 we have ωr (uv) = ω(u, v) and ω(cid:96) (uv) = ω(v , u). That is we split the arcs of A depending on whether they have their start-point in V1 or V2 and take the two underlying undirected graphs after the split. Note that each Hamiltonian cycle in G can be uniquely split into two sets of arcs, one of which corresponds to a perfect matching in G(cid:96) and the other in Gr . Moreover any pair of a perfect matching in G(cid:96) and a perfect matching in Gr together forms a cycle cover in G, which might consists of several cycles. Our goal is to consider all pairs of perfect matchings in G(cid:96) and Gr which together form a Hamiltonian cycle in the underlying undirected graph of G, which guarantees that we count exactly the Hamiltonian cycles in the directed bipartite graph G. Let the graph G. (cid:88) (cid:88) us fix an integer 0 ≤ w ≤ nωmax and count the number of Hamiltonian cycles of weight w in [M1 (cid:117) M2 = {V }] (cid:88) (cid:88) (cid:88) M2∈Π2 (Gr ) M1∈Π2 (G(cid:96) ) ω(cid:96) (M1 )∪ωr (M2 )=w (cid:88) (cid:88) M1∈Π2 (G(cid:96) ) M2∈Π2 (Gr ) a∈{0,1}n/2−1 ω(cid:96) (M1 )∪ωr (M2 )=w [M1 (cid:117) X (n, a) = {V }] (cid:88) (cid:88) M1∈Π2 (G(cid:96) ) a∈{0,1}n/2−1 a∈{0,1}n/2−1 w1+w2=w By Lemma 3.14 the proof of Lemma 3.7 follows. [M1 (cid:117) X (n, a) = {V }] · [M2 (cid:117) X (n, a) = {V }] (cid:88) M2∈Π2 (Gr ) ω(cid:96) (M1 )∪ωr (M2 )=w ext(X (n, a), w1 , G(cid:96) , ω(cid:96) ) · ext(X (n, a), w2 , Gr , ωr ). [M2 (cid:117) X (n, a) = {V }] (Thm 3.4) ≡ = = 13 4 Solving Hamiltonian cycle fast on pathdecompositions In this section we present an n3 (2 + √2)pwpwO(1) -time algorithm for solving Hamiltonian cycle on a graph G with a given path decomposition of width pw. Recall that partial solutions for Hamiltonian cycle are sets of paths such that all vertices before the current bag are internal in some path, and vertices in the current bag may be endpoints, internal, or unused. It then suffices to remember for each such partition of the current bag, in what way the endpoints are connected into pairs (these arrangements are perfect matchings on the set of endpoints); it is well-known that any further information about the paths is not needed. The downside is that this involves roughly pwpw many partial solutions which dominates the runtime. The key idea for our much faster algorithm is as follows: Instead of storing for all partitions into endpoints, internal, and unused vertices all the possible perfect matchings of the endpoints, we only store, intuitively, a combined “fingerprint” of all matchings together. Indeed, we fix an ordering of the vertices and store for each matching of the resulting family Xt the number of partial solutions that give a single cycle together with this matching. (These matchings abstract away the need of connecting through all so far unused vertices since this is covered by the partitions.) In fact, since our basis works only over GF(2) we count those solutions modulo two. This however still useful since we can essentially ensure the existence of a unique Hamiltonian cycle of minimum weight via the Isolation Lemma (and we need to solve a weighted version of our modulo two counting problem). Given this setup, let us solve the following problem by dynamic programming on a path decomposition: Given a graph G = (V , E ) along with a path decomposition of pathwidth pw, and non-negative edge weights ω : E → {1, . . . , ωmax}. The task is to compute for each ω∗ ∈ {1, . . . , n · ωmax} the parity of the number of Hamiltonian cycles of G with weight exactly ω∗ . We assume that we are given a nice path decomposition for G of width at most pw; we treat the decomposition as a sequence of bags that are ordered from left to right. To solve this problem we proceed as outlined above: For each partition into internal, endpoints, and unused vertices we take a basis for the perfect matchings on the endpoints and compute (and store) the number of partial solutions that are consistent with each perfect matching. We maintain and process this information throughout the dynamic programming; the main work is spent (unsurprisingly) on bags that introduce edges since this causes a rather involved recomputation of fingerprints (as we cannot work explicitly on separate partial solutions). For technical convenience our algorithm “guesses” one edge incident on a vertex of degree at most pw to be used in the Hamiltonian cycle. Given a nice path decomposition it can be easily seen that the rightmost introduce vertex bag can only introduce a vertex v of degree at most pw: all its neighbors must be in the current bag and no additional possible neighbors can be added on the right. It can be easily verified that all remaining bags, namely introduce edge and forget vertex bags, can be reordered freely under the constraint that no vertex is forgotten before all its edges were introduced. Thus, picking any edge incident on v , say {u, v}, we can reorder such that the last bags are: 1) introduce {u, v} (with current vertex set {u, v}, 2) forget vertex u, 3) forget vertex v . Our computation (from left to right) may then stop at bag 1) and (for some choice ω∗ of total weight) check the parity of the number of partial cycle covers that would form a Hamiltonian cycle of weight ω∗ when augmented with the edge {u, v}. Let the vertices of G = (V , E ) be ordered arbitrarily, say V = {v1 , . . . , vn}, and let the weight of any edge {vi , vj } be given by ω(vi , vj ). We perform dynamic programming on the given path decomposition, proceeding from left to right (until we reach the introduce edge bag of the “guessed“ edge). At each bag, with some vertex set B , we compute table en- tries t[B0 , B1 , B2 , w, M ] for all partitions B = B0 ∪ B1 ∪ B2 , all integers ω ∈ {0, . . . , n · ωmax}, and all perfect matchings M from a basis for B1 (the latter is according to Definition 3.1 with 14 a standard arbitrarily fixed ordering induced from V ). Each entry contains the partity of the number of partial cycle covers C of the graph induced by all vertices left of and including the current bag and all edges introduced so far, such that 1. C ∪ M is a single cycle, 2. the total weight of the edges in C is equal to ω , 3. the vertices in Bi have degree exactly i in C , 4. and all vertices that only occur left of the current bag have degree two; we denote those by B(cid:96) . We call C a (B0 , B1 , B2 , B(cid:96) , ω)-cycle cover if it respects 2., 3., and 4. If it respects all four properties then we call it a (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle cover, i.e., if additionally the union with M is a single cycle. The main technical difficulty in the dynamic programming lies in handling the information stored with respect to the basis for perfect matchings of B1 , in particular when introducing a new edge in the path decomposition. It is crucial that we can efficiently compute a representation of the same information with respect to a different ordering. Intuitively, the following lemma allows us to change the basis of our representation. Since we apply the lemma separately for each partition B = B0 ∪B1 ∪B2 , set of previous vertices B(cid:96) , and choice of weight ω , we state it in terms of a simplified table with one entry T [M ] for each basis matching M . The lemma applies to our dynamic programming application by letting C be the set of all (B0 , B1 , B2 , B(cid:96) , ω)-partial cycle covers and letting S = B1 . Lemma 4.1. Let C denote an arbitrary set of partial cycle covers and let X denote a family of basis matchings on some total ly ordered set S = {v0 , . . . , vt−1} of vertices of even size. Furthermore, for each M ∈ X, let T [M ] denote the number of partial cycle covers C ∈ C such that M ∪ C is a single cycle. For any X(cid:48) with respect to any other ordering of S , the corresponding values T (cid:48) [M (cid:48) ] for M (cid:48) ∈ X(cid:48) can be computed in time 2t/2−1 tO(1) . Proof. Clearly, any permutation of the ordering of S can be achieved by at most t2 swaps of two consecutive elements. Thus, it suffices to show how to move some vertex v one step to the “right” by swapping it with its successor in the order. We are able to show that the computation of any value T (cid:48) [M (cid:48) ] requires only the contents of at most three other entries in T [·]. Recall the grouping of {v0 , . . . , vt−1} into v0 v1 , v2 . . . vt−3 , vt−2 vt−1 . We have to distinguish a few cases about the position of v (odd or even) and a few of the edges in M that involve elements close to v in the ordering. For brevity we shorthand a little: we use a b, c d, e f to denote a part of the ordering (and its groups), with a matched to b or c and f matched to d or e. This includes that we do not specify the positions of a and f in their groups, since it can be checked that they are immaterial for the discussion below (we know that one of the elements in the preceding and one in the subsequent group are matched like that). If v ∈ {v1 , v3 , . . . , vt−1} (i.e., odd number and even position), then we have a v , c d, e f (and v cannot be in the first group since that only contains v0 ). Consider the same ordering but with c and v flipped, i.e., (locally) we have a c, v d, e f , and let M be a basis matching for that ordering. It is easy to see that M is also in the basis for the initial ordering, and the corresponding bitstring is obtained by inverting the bit that corresponds to the choice of matching a to v or c. (The bit effectively decides whether a is matched to the first or second element of the group c, v ; flipping the order in the group as well as the bit cancels out.) The case of an odd position is, unfortunately, more involved since v moves to a different group. Let v be in an odd position, i.e., v ∈ {v0 , v2 , v4 , . . . , vt−2}. Thus we have a b, v d, e f 15 (for now let us assume that v is not the first element in the ordering). Moving v one step to the right results in a b, d v , e f ; let M be some basis matching for this ordering. There are four ways in which M can match the vertices a, b, d, v , e, f taking into account our choice of a and f , and they have to be treated differently (the cases are equivalent to the four matchings in the basis X6 for six vertices). i) If {a, b}, {d, v}, {e, f } ∈ M , then M is also in the basis for the initial ordering, and with the same bitstring. Hence (cid:48) [M ] ≡ T [M ]. T ii) If {a, b}, {d, e}, {v , f } ∈ M , then consider the following two matchings M1 and M2 which are obtained by replacing the matching on d, e, v , f by either of the other two possible options (there are three different perfect matchings on 4 elements). M1 := (M \ {{d, e}, {v , f }}) ∪ {{d, v}, {e, f }, M2 := (M \ {{d, e}, {v , f }}) ∪ {{d, f }, {e, v}. It is easy to see that M1 and M2 are basis matchings for the initial ordering a b, v d, e f , since all their edges connect adjacent groups. Crucially, any partial cycle cover C ∈ C gives a single cycle with M if and only if this is true for exactly one of M1 and M2 . To see this, it suffices to consider the ways in which a, b, v , d, e, f are connected (the connection through C can be abstracted to simply a perfect matching on these six vertices). (cid:48) [M ] ≡ T [M1 ] + T [M2 ] T iii) If {a, d}, {b, v}, {e, f } ∈ M , then we use the same edge-flipping argument, but on {a, d} and {b, v}. We obtain M1 := (M \ {{a, d}, {b, v}}) ∪ {{a, b}, {d, v}, M2 := (M \ {{a, d}, {b, v}}) ∪ {{a, v}, {b, d}, which are both in the basis with respect to the initial ordering. Thus, the desired table value can be computed as [M ] ≡ T [M1 ] + T [M2 ]. T iv) Finally, we have {a, d}, {b, e}, {v , f }. In this case we use three basis matchings from the previous ordering, namely (cid:48) M1 := (M \ {{a, d}, {b, e}, {v , f }}) ∪ {{a, b}, {d, f }, {e, v}}, M2 := (M \ {{a, d}, {b, e}, {v , f }}) ∪ {{a, v}, {b, d}, {e, f }}, M3 := (M \ {{a, d}, {b, e}, {v , f }}) ∪ {{a, v}, {b, e}, {d, f }}. Again, these matchings are in the basis for the initial ordering since all edges are between adjacent groups. It can be checked that the desired table entry is exactly the sum modulo two of the table entries corresponding to these three matchings. To see this consider Table 1, and identify (a, d, b, e, v , f ) with (0, 1, 2, 3, 4, 5). Then {a, d}, {b, e}, {v , f } corresponds to matching 1, M1 to matching 6, M2 to matchings 10 and M3 to matching 12, and the corresponding rows are easily seen to be linearly dependent. (cid:48) [M ] ≡ T [M1 ] + T [M2 ] + T [M3 ] T Since there are 2t/2−1 perfect matchings in the basis for any ordering of S and each entry takes only O(1) operations the claimed total time follows by computing all intermediate tables (only the most recent one needs to be stored). 16 Now we can return to the description of our algorithm. The dynamic programming on the path decomposition proceeds from “left” to “right”, using the table of the previous bag, denoted t(cid:48) [], to compute the table of the current bag, denoted t[]. We use t(cid:48) uv and tuv for the corresponding tables that are obtained by changing ordering and basis in such a way that u and v are the last two vertices in the total order. For introduce and forget vertex bags there is not much work required since by themselves vertices do not affect our partial solutions. The main work lies in the computations required for the introduce edge bags: Partial solutions that use the new edge have a different set B1 of degree-1 vertices, which comes with a different basis. First bag: For the first bag the vertex set B is empty and we only get a single trivial table entry t[∅, ∅, ∅, 0, ∅] ≡ 0. Introduce vertex bag: We have a current bag with vertex set B that introduces a vertex v . Accordingly the previous bag has vertex set B \ {v}. Furthermore, the set of vertices that occur only on the left is the same for both bags. Clearly, in the subgraph given by all vertices of the current and preceding bags plus all edges introduced so far no partial cycle cover can include edges incident on v . Thus t[B0 , B1 , B2 , ·, ·] ≡ 0, for all partitions B = B0 ∪ B1 ∪ B2 with v ∈ B1 ∪ B2 . For partitions with v ∈ B0 and any choice of weight ω and B1 -basis matching M we already have the correct number in the table for the previous bag, namely (cid:48) t[B0 , B1 , B2 , ω , M ] ≡ t [B0 \ {v}, B1 , B2 , ω , M ]. Forget vertex bag: We have a current bag with vertex set B that “forgets” vertex v ; the previous bag has vertex set B ∪ {v}. Let B(cid:96) be the vertices that occur only left of the current bag and note that B(cid:96) \ {v} occur only left of the previous bag. Fix any partition B = B0 ∪ B1 ∪ B2 , a matching M from the B1 -basis (with standard ordering), and a weight ω . If C is a (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle cover, then v must have degree two in C by definition. Conversely, any (B0 , B1 , B2 ∪ {v}, B(cid:96) \ {v}, ω , M )-cycle cover C (cid:48) (whose number modulo two is stored in the previous bag) is also a (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle cover. Hence (cid:48) t[B0 , B1 , B2 , ω , M ] ≡ t [B0 , B1 , B2 ∪ {v}, ω , M ]. Introduce edge bag: We have a current bag with vertex set B that introduces an edge {u, v} with u, v ∈ B . The previous bag has the same vertex set B (but its partial solutions cannot make use of {u, v}), and both bags have the same set B(cid:96) of vertices that occur only left of them. First, we compute from the table t(cid:48) [] of the previous bag the table t(cid:48) uv []; i.e., the information is represented with respect to a basis that has u and v as the last two vertices in the ordering using Lemma 4.1. We will proceed by computing tuv [] which will subsequently be transformed to t[]; this completes the procedure for an introduce edge bag. We explain the computation of tuv [B0 , B1 , B2 , ω , M ] from t(cid:48) uv [] for an arbitrary partition B = B0 ∪ B1 ∪ B2 , integer weight ω , and perfect matching M ; the latter is from the basis for B1 with modified ordering of V (u and v are last two elements). We need to consider different cases depending on which sets Bi contains u and v . 17 i) u ∈ B0 or v ∈ B0 : In this simple case no (B0 , B1 , B2 , ω)-cycle cover may contain the edge {u, v} and the same is true for all perfect matchings M on B1 (in particular for those from a basis). Thus, directly from the definition of our tables we get that (cid:48) uv [B0 , B1 , B2 , ω , M ], tuv [B0 , B1 , B2 , ω , M ] ≡ t for all basis matchings M . ii) u, v ∈ B1 : Since M is a perfect matching from a basis on B1 it may contain the edge {u, v}. If {u, v} ∈ M then no (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle cover C can contain {u, v} (since the two copies of {u, v} would already give a separate cycle). (In the final introduce edge bag we do not need to perform this computation since we only check for a solution.) We already know the parity of the number of (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle covers avoiding the edge {u, v} from t(cid:48) uv [] and get (cid:48) tuv [B0 , B1 , B2 , ω , M ] ≡ t uv [B0 , B1 , B2 , ω , M ]. Otherwise we have {u, v} /∈ M which implies that {p, u}, {q , v} ∈ M for some p, q ∈ B1 \ {u, v} (with p (cid:54)= q) since M is a perfect matching of B1 . As before we already know the parity of the number of (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle covers that do not contain {u, v} from t(cid:48) uv []. Consider a (B0 , B1 , B2 , B(cid:96) , ω)-cycle cover C that does contain {u, v}. Thus C ∪M contains a cycle S = (x1 , . . . , xr , p, u, v , q , x1 ). Intuitively, we want to compare this to partial cycle covers without {u, v}; we effectively move the edge into the matching: Let C (cid:48) := C \ {{u, v}} and let M (cid:48) := (M \ {{p, u}, {q , v}}) ∪ {{p, q}} (the additional edge in M is modeled by contract- ing p, u, v , q into just p, q). Observe that C (cid:48) is a (B0 ∪ {u, v}, B1 \ {u, v}, B2 , B(cid:96) , ω − ω(u, v))-cycle cover. Clearly, C (cid:48) ∪ M (cid:48) contains a cycle S (cid:48) = (x1 , . . . , xr , p, q , x1 ), and all further cycles (if they exist) are the same as in C ∪ M . Thus C is a (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle cover if and only if C (cid:48) is a (B0 ∪ {u, v}, B1 \ {u, v}, B2 , B(cid:96) , ω − ω(u, v), M (cid:48) )-cycle cover. This fact is useful for the computation, provided that M (cid:48) is in the basis for B1 with modified ordering, which will check next. Let us see that M (cid:48) is indeed in the basis for B1 : First of all, since u and v are at the end of the ordering of B1 , when we remove these two vertices the remaining vertices keep their current ordering. Second, due to the structure of bases for B1 , we see that the edges {p, u}, {q , v} ∈ M imply that the ordering of B1 ends either with . . . , p, q , u, v or with . . . , p, r, q , u, v (to see this, recall the grouping of the elements and the fact that the basis matchings are exactly all ways of pairing up elements from adjacent groups). Accordingly the ordering for B1 \ {u, v} ends in . . . , p, q or . . . , p, r, q . If we have . . . , p, q , u, v then M = X (B1 , a10) and M (cid:48) = X (B1 − If we have . . . , p, r, q , u, v then M = X (B1 , a00) and M (cid:48) = 2, a1), for some bitstring a. X (B1 − 2, a0). In both cases, M (cid:48) is part of the basis for B1 \ {u, v} (in fact, its corresponding bitstring is the same as the one for M minus the last position). Thus, taking into account the contribution for cycle covers without {u, v}, we can compute tuv [B0 , B1 , B2 , ω , M ] as follows (cid:48) tuv [B0 , B1 , B2 , ω , M ] ≡ t uv [B0 , B1 , B2 , ω , M ] (cid:48) uv [B0 ∪ {u, v}, B1 \ {u, v}, B2 , ω − ω(u, v), M + t iii) u ∈ B1 and v ∈ B2 : We get that {u, v} /∈ M , but there must be some p ∈ B1 \ {u} with {p, u} ∈ M since M is a perfect matching of B1 . Again we get the contri- bution of t(cid:48) uv [B0 , B1 , B2 , ω , M ] for all (B0 , B1 , B2 , B(cid:96) , ω , M )-cycle covers that do not contain the edge {u, v}. If a (B0 , B1 , B2 , B(cid:96) , ω)-cycle cover C contains the edge {u, v}, then C ∪ M contains a cy- cle (x1 , . . . , xr , v , u, p, x1 ). Again, we effectively move the edge {u, v} “into“ M : Consider C (cid:48) := 18 ]. (cid:48) C \ {{u, v}} and M (cid:48) := (M \ {{p, u}}) ∪ {{p, v}}. Observe that C (cid:48) is a (B0 ∪ {u}, (B1 \ {u}) ∪ {v}, B2\{v}, B(cid:96) , ω−ω(u, v))-cycle cover. Furthermore, C (cid:48) ∪M (cid:48) contains a cycle (x1 , . . . , xr , v , p, x1 ), and all further cycles (if there are any) are the same as in C ∪ M . Thus M ∪ C is a single cycle if and only if M (cid:48) ∪ C (cid:48) is a single cycle. Again we need to check that M (cid:48) is in the basis for (B1 \ {u}) ∪ {v}. In the present case this is straightforward: Since u and v are last in the modified ordering of V , they both occupy the last position on B1 and (B1 \ {u}) ∪ {v} respectively. Since M and M (cid:48) differ exactly by replacing u with v , we get that M (cid:48) is in the basis for (B1 \ {u}) ∪ {v} and, in fact, corresponds to the same bitstring as M for B1 . We get (cid:48) tuv [B0 , B1 , B2 , ω , M ] ≡ t uv [B0 , B1 , B2 , ω , M ] (cid:48) uv [B0 ∪ {u}, (B1 \ {u}) ∪ {v}, B2 \ {v}, ω − ω(u, v), M + t iv) u ∈ B2 and v ∈ B1 : This case is symmetric to the previous one. Despite u being second to last and v being last in the modified ordering, this requires no change of argumentation since we always have only one of them in the set of matched vertices. ]. (cid:48) v) u, v ∈ B2 : Clearly no perfect matching M on B1 can contain {u, v} or any other edge incident with u or v . However, (B0 , B1 , B2 , B(cid:96) , ω)-cycle covers C may contain the edge {u, v}. The parity of the number of such partial cycle covers that do not use {u, v} and that are consistent with M is already stored in t(cid:48) uv [B0 , B1 , B2 , ω , M ]. Let us consider a (B0 , B1 , B2 , B(cid:96) , ω)-cycle cover C that does contain {u, v}. Let C (cid:48) := C \ {{u, v}} and M (cid:48) = M ∪{{u, v}}. Observe that C (cid:48) is a (B0 , B1∪{u, v}, B2 \{u, v}, B(cid:96) , ω−ω(u, v))- cycle cover. It is easy to see that C ∪ M is a single cycle if and only if C (cid:48) ∪ M (cid:48) is a single cycle, since C ∪ M = C (cid:48) ∪ M (cid:48) . Let us check that M (cid:48) is in the basis for B1 ∪ {u, v} with modified ordering. Let the end of the ordering of B1 be . . . , p, q , r. If M = X (B1 , a0) then {p, r} ∈ M , and we get M (cid:48) = X (B1 + 2, a01). Else, if M = X (B1 , a1) then {q , r} ∈ M and we get M (cid:48) = X (B1 + 2, a11). (Note that we basically only need to append a 1 to the bitstring for M to enforce that p or q is matched to r and not to u; the edge {u, v} ∈ M (cid:48) is then implied.) Thus M (cid:48) is indeed in the basis for B1 ∪ {u, v} with modified ordering. We get (cid:48) tuv [B0 , B1 , B2 , ω , M ] ≡ t uv [B0 , B1 , B2 , ω , M ] (cid:48) uv [B0 , B1 ∪ {u, v}, B2 \ {u, v}, ω − ω(u, v), M ∪ {{u, v}}]. + t Now we have handled all cases for computing tuv [B0 , B1 , B2 , ω , M ]. It remains to apply Lemma 4.1 again to compute the table t[] that represents the data with respect to the standard ordering. This completes the necessary work for an introduce edge bag. Runtime. Let us now analyze the time required to compute all table entries for one bag. We already know how to compute t[B0 , B1 , B2 , ω , ·] in time 2B1 /2−1 B1 O(1) , spending effec- O(1) per table entry (each entry corresponds to one basis matching on B1 ). For every tively B1 weight 1 ≤ ω ≤ nwmax the number of tuples (B0 , B1 , B2 , M ) where B0 , B1 , B2 partitions of the bag B and M is one of the 2B1 /2−1 basis matchings equals (2 + √2)B by the multinomial theorem, and hence we have proved the following: Lemma 4.2. There is an algorithm that given a graph G along with a path decomposition of width pw computes the table entries t[] corresponding to the rightmost introduce edge bag of the path decomposition in (2 + √2)pwwmax (n · pw)O(1) time. Now, we can wrap up by completing our algorithm. 19 Theorem 4.3. There exists a Monte-Carlo algorithm that given a graph G along with a path decomposition of width pw solves the Hamiltonian cycle problem in (2 + √2)pw (n · pw)O(1) time. The algorithm cannot give false positives and may give false negatives with probability at most 1/2. Proof. The algorithm is the following: First guess an edge {u, v} in the solution that is inci- dent on the vertex v introduced in the rightmost introduce vertex bag, and reorder the path decomposition as described above. (The guessing is of course implemented by trying all of these at most pw many edges.) Assign for each edge e ∈ E a weight ω(u) ∈ {1, 2, . . . , 2E } uniformly and independently at random. Then use Lemma 4.2 to compute the table entry t[∅, {u, v}, ∅, {{u, v}}, w] corresponding to the rightmost introduce edge bag for every weight w ≤ n · wmax ≤ n2E in 2t/2 (nt)O(1) ; Return YES if one of these values is 1 and NO otherwise. This procedure clearly runs in the claimed running time. If the algorithm return YES, there exists a Hamiltonian cycle including the edge {u, v} since there exists a Hamiltonian cycle by the definition of t. Otherwise, suppose that there exists a Hamiltonian cycle. Then with probability at least 1 − E /2E = 1/2 we have by Lemma 3.9 that ω isolates the family of all Hamiltonian cycles of G. Hence with probability at least 1/2 there exists a unique minimum weight Hamiltonian cycle H minimizing ω(H ). Let {u, v} be the edge incident to v contained in H . Then we have that t[∅, {u, v}, ∅, {(u, v)}, ω(H ) − ω({u, v})] = 1 since H is the only Hamiltonian cycle of weight ω(H ). Further results Combining the ideas from the proof of Theorem 4.3 with Lemma 4.4 and a trick from [15], we will now give an application to fast exponential time algorithms for the Hamiltonian cycle problems on graphs of degree at most 3. To obtain this we require the following result: Theorem 4.4 ([19]). For any  > 0 there exists an integer n such that for any graph G with n > n vertices, 1 13 1 n5 + n≥6 + n, pw(G) ≤ n3 + n4 + 30 3 6 where ni is the number of vertices of degree i in G for any i ∈ {3, . . . , 5} and n≥6 is the number of vertices of degree at least 6. This theorem is constructive, and the corresponding path decomposition (and, consequently, tree decomposition) can be found in polynomial time. The observation from [15] is that on cubic graphs, we know that the degree of a vertex in a partial cycle cover of the type used in the our table entries cannot be 2 if at most 1 incident edges is introduced, and it cannot be 0 if at least 2 edges are introduced. Hence these states can be safely ignored since they will be empty. Summarizing, we obtain the following: Corollary 4.5. There exists a Monte-Carlo algorithm that given a graph G of maximum degree three solves the Hamiltonian cycle problem in (1 + √2)n/6nO(1) ≤ 1.1583nnO(1) time. The algorithm cannot give false positives and may give false negatives with probability at most 1/2. Again the proof idea similar to proof of Theorem 4.3 we can also rather easily obtained the following result: Theorem 4.6. There exist algorithms that given a graph G and integer k finds a path of length k in time n(2 + √2)pw (k + pw)O(1) time if a path decomposition of width pw of G is given. 20 The idea is to slightly modify the table entries defined in this section: In the definition we considered partial cycle covers visiting all already forgotten vertices. We allow to not visit some vertices and keep track of the number of visited vertices with an additional counter, and hence the formula in the forget bag has to be altered to t[B0 , B1 , B2 , ω , M , (cid:96)] ≡ t(cid:48) [B0 , B1 , B2 ∪ {v}, ω , M , (cid:96)] + t(cid:48) [B0 ∪ {v}, B1 , B2 , ω , M , (cid:96)] where (cid:96) is the additional counter. The additional counted can be bounded by the observation that a non-zero entry with (cid:96) ≥ pw · k directly guarantees a solution. 5 Lower bound for Hamiltonian cycle In this section we prove that the runtime of our algorithm from Section 4 is essentially tight. We show that no algorithm can achieve a significantly better dependence on the pathwidth of the input graph (even at the cost of a larger polynomial factor in the input size), without giving also a breakthrough result for solving CNF-Sat; this is expressed by the main theorem of this section. Theorem 5.1. If any algorithm solves the Hamiltonian cycle problem in (2 + √2 − )pw V O(1) time, then there exists an algorithm that solves the CNF-Sat problem in (2 − )nmO(1) time. Recall the definition of the Matching Connectivity matrix Ht : All rows and columns are indexed by perfect matchings M1 , M2 of the complete graph on t vertices and Ht [M1 , M2 ] = [M1 ∪ M2 is a Hamiltonian cycle]. Our proof, namely a reduction from CNF-Sat, uses the lower bound on the rank of Ht , in particular, the fact that the family of basis matchings Xt from Section 3 induce a permutation submatrix in Ht (see Proposition 3.3). 5.1 Gadgets In this section we will introduce three gadgets used for the final construction. Since our gadgets accept some parameters we will call a graph that contains some gadgets an annotated graph. Vertices with labeled incident edges. The following two gadgets allow to label incident edges of a vertex v with a labeling function λv , ensuring that every Hamiltonian cycle enters and leaves a vertex with edges of the same label. Definition 5.2. A label gadget is a pair (v , λv ) where λv is a labeling of the edges incident to v . A Hamiltonian cycle C is consistent with a label gadget (v , λv ) if λv (e) = λv (e(cid:48) ) where e, e(cid:48) are the two edges of C incident to v . The first gadget is for a vertex whose incident edges have only two distinct labels, denoted by dotted and normal lines in figures. It is shown at the left-hand size in Figure 2. We have to ensure that any Hamiltonian cycle contains exactly two edges of the set of edges leaving the gadget and that they are of the same label, and this can be seen to hold by a simple case analysis: If the cycle enters v1 , it must continue with v2 , v3 . Then it cannot leave the gadget, because then it is impossible to visit all six remaining vertices. Hence it must continue with v6 and then v5 , v4 , v9 , v8 , v7 is forced. The cases where it enters at a different vertex are symmetric. Let us continue with the multilabel gadget, which we will first formally describe. Given a vertex v in a graph G with incident edges X and a labeling λv : X → [k ], we obtain G(cid:48) by replacing v as follows: 2 , . . . , v c 2 , v c 2 , v b 1 , va 1 , v c 1 , v b • Create a cycle of 3k vertices consecutively denoted by va k . 21 Figure 2: Gadget for vertices with labeled incident edges. On the left-hand side the 2-label gadget is shown. The two label classes are denoted by normal and dotted lines. On the right- hand side the multi-labeled gadget for six labels is shown. The black vertices represent 2-label gadgets and the labels of their incident edges are denoted by normal and dotted lines. A number i next to a leaving edge indicates the edge represents an edge in the original graph with label i. • For every 1 ≤ i ≤ k , and every vertex w (cid:54)= v incident to an edge e ∈ X such that λv (e) = i, add the edges va i w and v b i w. • For every 1 ≤ i < k add a 2-label gadget consisting of vertex gi , edges giva i , giv b i labeled by 1 and the edges giva i+1 , giv b i+1 labeled by 2. The gi are called guard vertices. An instructive example with k = 6 is shown on the right-hand side of Figure 2. Lemma 5.3. There is a Hamiltonian cycle of G consistent with (v , λv ) if and only if G(cid:48) has a Hamiltonian cycle. i and v b Proof. Note that in a Hamiltonian cycle a guard vertex gi is either adjacent to both va i or to both va i+1 and v b i+1 , and all the pairs can be adjacent to at most one guard vertex since otherwise there is a cycle on four vertices. Moreover, since each vertex v c i is of degree two, any Hamiltonian cycle of G(cid:48) contains the edges v b i v c i for 1 ≤ i ≤ k , as well as the edges v c i va i+1 for 1 ≤ i < k and finally the edge v c k va 1 . Therefore, since all guard vertices must be visited, any Hamiltonian cycle of G(cid:48) contains only two edges leaving the gadget and they must be incident to va i and v b i for some i. For the forward direction, let there be a Hamiltonian cycle of G that enters and leaves at edges incident of v with label i. Then we have to show there is a Hamiltonian path P in the i to v b gadget from va i , ignoring edges leaving it. Notice that such a P exist in which (i) gj is j+1 and v b j for j < i, and (ii) gj is adjacent to va j and v b adjacent to va j+1 for j ≥ i. Induced subgraph gadget. We will now discuss the induced subgraph gadget, which is shown in Figure 3. The function of the gadget is described as follows: 22 v1v2v3v4v5v6v7v8v9va1vb1vc1va2vb2vc2va3vb3vc3va4vb4vc4va5vb5vc5va6vb6vc6g1g2g3g4g5111111222222333333444444555555666666 Figure 3: Example of the induced subgraph gadget, with X = {v1 , . . . , v10} and F = {{v1v3 , v2v6 , v1v6 , v4v5}, {v3v6 , v5v7 , v6v8 , v9v10}, {v6v10 , v8v9 , v7v10}}. The double triangles at the IF indicate that in fact there are edges to every vertex in IF . Label 1 edges are drawn dotted while label 2 edges are drawn normally. 23 IFv1v2v3v4v5v6v7v8v9v10p11p21p31p41p12p22p32p42p13p23p33abX Definition 5.4. An induced subgraph gadget in a graph G = (V , E ) is described by a tuple (X, a, b, F ) where X ⊆ V , a, b ∈ V \ X , F ⊆ 2E (X,X ) and ∅ (cid:54)∈ F . A Hamiltonian cycle C of G is consistent with (X, a, b, F ) if ab ∈ C and C ∩ E (X, X ) ∈ F . The gadget is implemented with the following construction, obtaining a modified graph G(cid:48) from G: • remove all edges E (X, X ) from the graph G, • add a set IF , i.e. an independent set of F vertices to G, and make all its vertices adjacent to both a and b, • Let F = {F1 , . . . , F(cid:96)}, and for i = 1, . . . , (cid:96) do the following: – Let Fi = {e1 , . . . , ez }. Fi – Add a path of 2-label gadgets Pi = {p1 i }, with all edges having label 1. i , . . . , p – For every vertex v of the independent set IF , add an edge with label 1 to p1 i and Fi p . i i x and pj – For j = 1, . . . , Fi add edges pj i y with label 2, where ej = xy . We will now prove the function of the gadget. The vertices a and b are not useful for using the gadget but are required to be able to implement it. Lemma 5.5. There exists a Hamiltonian cycle C in G that is consistent with (X, a, b, F ) if and only if there exists a Hamiltonian cycle in G(cid:48) . The intuition of this is that in a Hamiltonian cycle of the graph the part of the cycle that goes from a to b visits all vertices from the independent set IF and all paths except the one corresponding to corresponding to the element of F that is chosen. Proof. For the forward direction, let Fi ∈ F be the intersection of C with E (X, X ). Then the Hamiltonian cycle in G can be extended to a Hamiltonian cycle in G(cid:48) by replacing every edge ej ∈ Fi with two edges upj i and pj i v where ej = uv and by replacing the edge ab by the path a, g1 , P1 , g2 , P2 , . . . , Pi−1 , gi , Pi+1 , gi+1 , . . . , PF gF , b, where g1 , . . . , gF is an arbitrary ordering of IF . For the reverse direction, let C (cid:48) be a Hamiltonian cycle of G(cid:48) . Observe that since IF is independent, the Hamiltonian cycle C (cid:48) contains exactly 2F edges between IF and NG(cid:48) (IF ) = Fi {p1 : 1 ≤ i ≤ F } ∪ {a, b}. By the 2-label gadgets, we know that if for some 1 ≤ i ≤ F i , p i Fi i }, then C (cid:48) contains exactly the Hamiltonian cycle C (cid:48) contains an edge between IF and {p1 i , p Fi . However C (cid:48) one edge between IF and p1 i as well as exactly one edge between IF and p i Fi cannot contain 2F edges between IF and {p1 : 1 ≤ i ≤ F }, because then it would i , p i not visit any other vertices. Furthermore C (cid:48) cannot contain two edges between a (or b) and IF , since then it would have to contain either zero or two edges between b (or a) and IF , making it impossible to visit the original vertices of G. Consequently C (cid:48) contains exactly one edge between a and IF , exactly one edge between b and IF , and exactly two edges between Pi and IF for F − 1 indices i ∈ [F ]. So there is exactly one index 1 ≤ i0 ≤ F such that Fi are not connected with an edge of IF . Since C (cid:48) visits all the vertices of Pi0 by p1 i and p i label 2 edges only, we can obtain a Hamiltonian cycle C in G by removing all the edges of the gadget and adding the edge ab together with edges of Fi0 . Note that the Hamiltonian cycle C is consistent with (X, a, b, F ) as it does not contain any edge of E (X, X ) \ Fi0 since the graph G(cid:48) has the edges E (X, X ) removed. 24 Figure 4: The total construction for the Hamiltonian path lower bound. The Kβ denote cliques of β vertices. The black circles ci are multilabel gadgets (see Figure 2) and the rectangles Gij are induced subgraph gadgets, used as further illustrated in Figure 5. 5.2 Construction We will now describe the construction of the reduction, see also Figure 4. After the formal definition we will provide some intuition. Our construction is parameterized by two integer (cid:19) (cid:18) β (cid:88) constants β and γ , which will be chosen later, such that √2 i0 , i1 , i2 i0+i1+i2=β i1 is even i1 ≥ 2γ . (1) Assume we are given a CNF-formula φ = C1 ∧ . . . ∧ Cm on variables x1 , . . . , xn with n being a multiple of γ ; let q = n γ . Partition the set {x1 , . . . , xn} into n/γ blocks of size γ , denoted X1 , . . . , Xn/γ . Also, denote Xi = {xi1 , . . . , xiγ }. Intuitively, we will represent the 2γ assignments of a block of variables by the states of group of vertices in a bag of the to be constructed path decomposition. In Subsection 5.5, we will discuss how to fix β and γ such that the number of these states, represented on the left hand side of Equation (1) is at least 2γ . In the following we will use the family of matchings Xt defined in Definition 3.1. For ease of notation we denote X(S ) for the family obtained from XS by replacing the elements of Ut 25 K1βc1K1βc2c3cmK2βK2βKqβKqβy01y02y0q−1G11G12G13G1mG21G22G23G2mGq1Gq2Gq3Gqmy0q Figure 5: An edgeset from F in an induced subgraph gadget G11 is shown here. For convenience, v1,10 and v2,10 are denoted by v10 and v20 . The edgeset shown is constructed from the coloring s with s(v112 ) = s(v117 ) = 0, s(v114 ) = s(v115 ) = s(v116 ) = s(v118 ) = 2 and the matching (v111 , v113 ), (v119 , v11,10 ). one to one with elements of S (using an arbitrary but fixed ordering), for any set S of even cardinality. 1. For every i = 1, . . . , q , j = 1, . . . , m + 1 and k = 1, . . . , β add vertices vi,j,k ; for i = 1, . . . , q and j = 1, . . . , m + 1 denote Vij = {vij 1 , . . . , vijβ }. 2. For every i = 1, . . . , q add a clique on β vertices K i β , and add an edge between all vertices of the clique K i β and all vertices from Vi,1 . 3. For every i = 1, . . . , q add a clique on β vertices K i β , and add an edge between all vertices of the clique K i β and all vertices from Vi,m+1 . 4. For every i = 1, . . . , q − 1 add a vertex y (cid:48) i and make it adjacent to all vertices of K i β and . Furthermore, a vertex y (cid:48) q is added and made adjacent all vertices of K q K i+1 β and K 1 β . β 5. For every i = 1, . . . , q and j = 1, . . . , m we use an induced subgraph gadget Gij (the special j and bi vertices ai j from Definition 5.4 are included in Gij ) as follows (see also Figure 5): 26 aijbijv111v112v113v114v115v116v117v118v119v11,10v121v122v123v124v125v126v127v128v129v12,10cijdijy1y2αi1αi‘z1z2βi01βi0‘ (a) Add four vertices ai j , bi j , ci j , di j and the edge (ai j , bi j ), where the edge (ai j , bi j ) is guaran- teed to be in any Hamiltonian cycle (by for example subdividing it) as required by the gadget. j ,di (b) The set X consists of the vertices Vij ∪ Vi,j+1 and the vertices ci j . (c) Given a vector s ∈ {0, 1, 2}β and a matching M ∈ X(s−1 (1)) we denote s(cid:104)i,j (cid:105) as the coloring of Vij and M(cid:104)i,j (cid:105) as the matching of Vij obtained by identifying the sets {1, . . . , β } and Vij . (Equivalently, we may take s(cid:104)i,j (cid:105) ∈ {0, 1, 2}Vij and M(cid:104)i,j (cid:105) ∈ −1(cid:104)i,j (cid:105) (1)).) X(s (d) For a every vector s ∈ {0, 1, 2}β and a matching M ∈ X(s−1 (1)), add an edgeset ηij (s, M ) constructed as follows to the family F used for the induced subgraph gadget: i. add the edges of the path α1 , . . . , α(cid:96) where {α1 , . . . , α(cid:96)} are the elements of −1(cid:104)i,j (cid:105) (2) sorted ascendantly (the ordering is in fact immaterial so long as we have s a simple path through these vertices); ii. add the edges of the path β1 , . . . , β(cid:96)(cid:48) where {β1 , . . . , β(cid:96)(cid:48) } are the elements of −1(cid:104)i,j+1(cid:105) (0) sorted ascendantly; s −1(cid:104)i,j (cid:105) (1); iii. let e = (y1 , y2 ) be the edge of M(cid:104)ij (cid:105) incident with the smallest element of s iv. add all edges of M(cid:104)ij (cid:105) not equal to e; v. let M (cid:48) ∈ X(s−1 (1)) be the unique matching such that M ∪ M (cid:48) is a Hamiltonian cycle (this exists and is unique due to Proposition 3.3); vi. let e(cid:48) = (z1 , z2 ) be the edge of M (cid:48) (cid:104)i,j+1(cid:105) incident with the smallest element of −1(cid:104)i,j (cid:105) (1); s (cid:104)i,j+1(cid:105) not equal to e(cid:48) ; vii. add all edges of M (cid:48) j ), (di j ), (z2 , di j , α1 ); (z1 , bi viii. add the edges (y1 , ai j ), (y2 , ci j ), (ci j , β1 ); (α(cid:96) , β(cid:96)(cid:48) ). (cid:12)(cid:12)(cid:12) s ∈ {0, 1, 2}β ∧ s (cid:110) (cid:111) 6. Fix arbitrarily an injective mapping −1 (1)) −1 (1) is even ∧ M ∈ X(s (s, M ) ψ : {0, 1}γ → . 7. For j = 1, . . . , m: (a) Add a multilabel gadget cj . (b) For every i = 1, . . . , q and every partial assignment x ∈ {0, 1}Xi of the variables Xi that satisfies Cj , consider the first vertex ρ of the path in the induced subgraph gadget Gij corresponding with the element ηij (ψ(x)) of F . (c) Let (ρ, σ) be an edge with label 1 in the construction of the induced subgraph gadget. Add an edge (ρ, cj ) and (cj , σ) such that with respect to ρ and σ the edges again have label 1 and with respect to the multilabel gadget cj the edges have a label that has not been used yet in the interval [j · 2γ + 1, (j + 1) · 2γ ], which must exist since there are at most this many assignments of Xi . The intuition behind the construction is as follows: Vij are blocks of vertices whose joint states encode a joint assignment of Xi . In Step 2 − 4 vertices are added to ensure that a set of disjoint paths visiting all vertices in the remainder of the graph can be completed into a Hamiltonian cycle. In Step 5 we create graphs Gij on Vij and Vi,j+1 such that any for any set of these disjoint paths, the intersection of Gij and Gi,j+1 is similar. To do this we use the induced subgraph gadget and for every state (s, M ) we allow exactly one edgeset in F that induces state 27 (s, M ). In Step 6 we fix an encoding ψ of partial assignments in states of the group of vertices Vij . As mentioned before, this encoding exists due to (1). Finally, we check in Step 7 whether clause j is satisfied by adding a multilabel gadget cj that can be visited if and only if in some −1 graph Gij the intersection X from the family F induces a state (c, M ) = η ij (X ) such that the partial assignment ψ−1 (s, M ) satisfies clause Cj . The labels to the clause gadget are chosen consecutively in 7c to ensure adding the labels only increases the pathwidth by a constant. E = (2) ηij (ψ(Xi )) 5.3 From a satisfying assignment to a Hamiltonian cycle Suppose that x ∈ {0, 1}n satisfies the formula φ. Then we first claim that for every i = 1, . . . , q m(cid:91) the set j=1 is a set of disjoint paths in the constructed graph G, in which all vertices of ∪m j=1Gij are visited and all endpoints are in Vi,1 ∪ Vi,m+1 . To this end we first need to zoom in at the application of the induced subgraph gadget in Step 6. of the construction (see also Figure 5). Note that effectively, in a set ηi,j (s, M ), the first vertex y1 of s(cid:104)ij (cid:105) (−1) is connected to the first vertex z1 of s(cid:104)i,j+1(cid:105) (−1) through ai j , bi j . Recall that y2 is the second vertex of the lexicographically first edge of M(cid:104)i,j (cid:105) . Suppose that y2 = vij k . Then, to show the claim on E , it is sufficient to show that the second vertex y2 is connected −1(cid:104)ij (cid:105) (2) ∪ s −1(cid:104)i,j+1(cid:105) ({0, 1}) ∪ ci j , di to vι+1,j by a path with internal vertices s j . This follows by construction: in Vi+1 we use two matchings on the vertices with label one that are guaranteed to form a Hamiltonian cycle so since we left out the edges (z1 , z2 ) in one matching and the edge (z1 , vi,j+1,k ) they must now form a path between the z2 and vi,j+1,k . It is easily seen that the further extension of the path meets the claim. (cid:48) to visit all clause multilabel gadgets as follows: since Now we alter the set E to a set E x satisfies the formula, we know by construction that for every j = 1, . . . , m there exists i = 1, . . . , q such a variable of Xi is satisfying Cj . We take one such i and we know that in the path created in the induced subgraph gadget corresponding to the element η(ψ(Xij )) of F we added in Step 7.C the two edges to the clauses gadget with the same label between a vertex ρ of X used and the first vertex σ of the created path. Since we know (ρ, σ) ∈ E we can safely replace (ρ, σ) with (ρ, cj ) (cj , σ). (cid:48) is a set of disjoint paths, with endpoints in ∪q Hence now E i=1Vi,1 ∪ Vi,m+1 , all vertices c1 , . . . , cm and vertices from ∪i,j Gij are visited, and by construction it is consistent with all the multilabel and induced subgraph gadgets. After contracting the internal points of these paths, it is easy to see we are left with a graph that has a Hamiltonian cycle: for every i = 1, . . . , q (cid:48) to a path between two vertices of K i we can use the cliques to extend the paths from E β that (cid:48) with endpoints in ∪q β ∪ K i i=1Vi,1 ∪ Vi,m+1 that visits K i contains all paths from E β and does not visit y (cid:48) i−1 and y (cid:48) i such that the vertices y (cid:48) i then can be used to connect these paths into a complete Hamiltonian cycle. By construction it is easily seen to be consistent with all gadgets. 5.4 From a Hamiltonian cycle to a satisfying assignment Suppose we are given a Hamiltonian cycle C of G, consistent with all the induced subgraph and multilabel gadgets. Contract edges to clause gadgets obtaining C (cid:48) . By the multilabel gadget and the labeling, the edges resulting from the contraction will be contained in an induced subgraph gadget. Let us denote Xij for the vertex set of Gij minus aij , bij . 28 Lemma 5.6. For every i and j it holds that η −1 −1 (cid:48) (cid:48) ∩ (Xij × Xij )) = η ∩ (Xi,j+1 × Xi,j+1 )). ij (C i,j+1 (C −1 −1 ∩ (Xij × Xij )) and (s(cid:48) , M (cid:48) ) = η ij (C (cid:48) i,j+1 (C (cid:48) Proof. Let (s, M ) = η ∩ (Xi,j+1 × Xi,j+1 )). First, we know that for every si + s(cid:48) i = 2 since otherwise the vertices of Vi will not have degree 2 in C (cid:48) . Hence, we know that s−1 (1) = (s(cid:48) )−1 (1). If M (cid:54)= M (cid:48) then we know by Proposition 3.3 that M ∪ M (cid:48) is not a Hamiltonian cycle since the matchings are by construction from X(s−1 (1)). Hence we have that M ∪ M (cid:48) contains two subcycles and the one avoiding the element 1 will give a subcycle of C (cid:48) , contradicting that C is a Hamiltonian cycle. Hence, the cycle C (cid:48) must represent an assignment of the variables x1 , . . . , xn . Furthermore, since C visits all multilabel gadgets, it must represent a satisfying assignment by construction. 5.5 Pathwidth and efficiency bound (cid:109) (cid:108) n We will first argue that the pathwidth of the constructed graph (after expanding all gadgets) G is β + f (β , γ ) for some function f and then set the parameters β and γ in order to prove γ the theorem. Let κ = 1, . . . , q and j = 1, . . . , m. In the multilabel gadget cj , recall there is a vertex va 1 , adjacent to some vertex in the induced subgraph gadget G1j . Similarly, let (cid:96) be the maximum integer such that in this multilabel gadget, va (cid:96) is adjacent to a vertex in one of the induced κ(cid:91) q(cid:91) subgraph gadgets G1j , . . . , Gκ,j . Then note that Vij ) ∪ ( Sκ,j = ( i=1 κ=i+1 1 , g(cid:96) , v c Vi,j+1 ) ∪ {va (cid:96) }, is a separator since the labels in the multilabel gadget are ordered such that labels coming from (cid:108) n (cid:109) the induced subgraph gadget are adjacent. Then the claimed upper bound on the pathwidth follows easily by using the above separators as bags consecutively for every j = 1, . . . , m and κ = 1, . . . , q since the size of every union of two consecutive separators is β + f (β , γ ) and γ the components to the left of S1,1 and to the right of Sq ,m are of constant pathwidth. (cid:18) β (cid:19) (cid:88) (cid:88) Now we will discuss how to fix the constants β and γ . Note that by splitting summations we obtain √2 √2 i1 2β−i1 , i1 = i0 , i1 , i2 0≤i1≤β i0+i1+i2=β i1 even i1 is even i1 2β−i1 ≤ √2 and since for every odd i1 , we have √2 i1 2β−i1−1 we know by the multinomial (cid:19) (cid:18) β (cid:19) (cid:18) β (cid:88) theorem that (cid:88) √2 1 i0 , i1 , i2 i0 , i1 , i2 2 i0+i1+i2=β i0+i1+i2=β i1 is even i1 = (2 + √2)β−1 . √2 i1 ≥ √ γ Hence, we satisfy Equation 1 by setting β = + 1. Running the assumed algorithm that 2) lg(2+ solves the Hamiltonian cycle problem in (2 + √2 − )pw V O(1) algorithm then takes time (cid:108) n (cid:109)(cid:16) (cid:16) (cid:17) (cid:17) (cid:17) (cid:16) lg(2+ √ √ √ (cid:16) lg(2+ (cid:17) 2−) 2−) 2−) n+1 (2 + √2 − ) √ √ √ + lg(2+ γ γ +1 lg(2+ (n+1) +1 ≤ 2 = 2 γ γ γ 2) lg(2+ 2) lg(2+ 2) lg(2+ √ √ 2−) 2−) √ + lg(2+ < 1 is sufficient and gives a So choosing γ large enough such that γ lg(2+ 2) (2 − (cid:48) )nmO(1) algorithm for CNF-Sat, concluding the proof of Theorem 5.1. 29 6 Conclusions We have presented a set of matchings Xn , which forms a basis of the Matching Connectivity matrix Hn . In particular we have obtained a factorization theorem (Theorem 3.4) which shows an explicit way of expressing any perfect matching as a linear combination of matchings of Xn . As a consequence we obtained deterministic algorithms for computing the parity of the number of Hamiltonian cycles in undirected graphs and directed bipartite graphs in O(1.888n ), which together with the Isolation Lemma lead to Monte Carlo algorithms solving the decision versions of Hamiltonicity within the same running time. Moreover, using the basis Xn , we presented an algorithm which given an undirected graph on n vertices along with a path decomposition of width at most pw, decides Hamiltonicity in (2 + √2)pwnO(1) time. Somewhat surprisingly we use the same tool, i.e. the basis Xn , to show by an involved reduction from CNF-Sat that our bounded pathwidth algorithm is optimal under the Strong Exponential Time Hypothesis. Our results lead to several natural open problems. Can the basis Xn be used to obtain a deterministic O((2 − )n ) time algorithm for Hamiltonicity? Can we handle directed graphs without the bipartiteness assumption? Can we extend our bounded pathwidth algorithm to a bounded treewidth algorithm with the same complexity? Finally we would like to note that the row space of the Matching Connectivity matrix Hn clearly has several different bases. We have investigated a particular one, which proved to have several interesting properties and applications, however there might be different ones which are also worth exploring. Acknowledgements We would like to thank Marcin Pilipczuk, Micha(cid:32)l Pilipczuk, Johan van Rooij and Jakub Onufry Wo jtaszczyk for early discussions on Section 5. References [1] Sanjeev Arora. Polynomial time approximation schemes for Euclidean traveling salesman and other geometric problems. J. ACM, 45(5):753–782, September 1998. [2] Sanjeev Arora and Boaz Barak. Computational complexity: a modern approach. Citeseer, 2009. [3] Eric T. Bax. Inclusion and exclusion algorithm for the Hamiltonian path problem. Infor- mation Processing Letters, 47(4):203 – 207, 1993. [4] R.E. Bellman. Combinatorial processes and dynamic programming. 1958. [5] Richard Bellman. Dynamic programming treatment of the travelling salesman problem. J. ACM, 9(1):61–63, 1962. [6] Andreas Bjorklund. Determinant sums for undirected Hamiltonicity. 173–182. IEEE Computer Society, 2010. In FOCS, pages [7] Andreas Bjorklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto. Trimmed Mobius inversion and graphs of bounded degree. Theory Comput. Syst., 47(3):637–654, 2010. [8] Hans Bodlaender. Treewidth: Structure and algorithms. In Giuseppe Prencipe and Shmuel Zaks, editors, Structural Information and Communication Complexity, volume 4474 of Lec- ture Notes in Computer Science, pages 11–25. Springer Berlin / Heidelberg, 2007. 30 [9] Hans L. Bodlaender, Marek Cygan, Stefan Kratsch, and Jesper Nederlof. Solving weighted and counting variants of connectivity problems parameterized by treewidth deterministi- cally in single exponential time. 2012. [10] Hans L. Bodlaender and Arie M. C. A. Koster. Combinatorial Optimization on Graphs of Bounded Treewidth. The Computer Journal, 51(3):255–269, 2008. [11] Ha jo Broersma, Fedor V. Fomin, Pim van ’t Hof, and Daniel Paulusma. Fast exact algo- rithms for Hamiltonicity in claw-free graphs. In Christophe Paul and Michel Habib, editors, WG, volume 5911 of Lecture Notes in Computer Science, pages 44–53, 2009. [12] Nicos Christofides. Worst-case analysis of a new heuristic for the travelling salesman prob- lem. Technical Report 388, Graduate School of Industrial Administration, Carnegie Mellon University, 1976. [13] Bruno Courcelle. The monadic second-order logic of graphs. i. recognizable sets of finite graphs. Inf. Comput., 85(1):12–75, 1990. [14] Marek Cygan, Holger Dell, Daniel Lokshtanov, D´aniel Marx, Jesper Nederlof, Yoshio Okamoto, Ramamohan Paturi, Saket Saurabh, and Magnus Wahlstrom. On problems as hard as CNF-SAT. In IEEE Conference on Computational Complexity, pages 74–84. IEEE, 2012. [15] Marek Cygan, Jesper Nederlof, Marcin Pilipczuk, Michal Pilipczuk, Johan M. M. van Rooij, and Jakub Onufry Wo jtaszczyk. Solving connectivity problems parameterized by treewidth in single exponential time. In Rafail Ostrovsky, editor, FOCS, pages 150–159. IEEE, 2011. [16] Frederic Dorn, Fedor V. Fomin, and Dimitrios M. Thilikos. Catalan structures and dynamic programming in H -minor-free graphs. pages 631–640, 2008. [17] Stuart E. Dreyfus and Robert A. Wagner. The Steiner problem in graphs. Networks, 1:195–207, 1972. [18] David Eppstein. The traveling salesman problem for cubic graphs. 11(1):61–81, 2007. [19] Fedor V. Fomin, Serge Gaspers, Saket Saurabh, and Alexey A. Stepanov. On two techniques of combining branching and treewidth. 54(2):181–207, 2009. [20] Fedor V. Fomin and Dieter Kratsch. Exact Exponential Algorithms. Springer-Verlag New York, Inc., New York, NY, USA, 1st edition, 2010. [21] Heidi Gebauer. On the number of Hamilton cycles in bounded degree graphs. pages 241– 248, 2008. [22] Mika Goos and Jukka Suomela. Locally checkable proofs. Fraigniaud, editors, PODC, pages 159–168. ACM, 2011. In Cyril Gavoille and Pierre [23] Michael Held and Richard M. Karp. A dynamic programming approach to sequencing problems. In Proceedings of the 1961 16th ACM national meeting, ACM ’61, pages 71.201– 71.204, New York, NY, USA, 1961. ACM. [24] Illya V. Hicks, Arie M. C. A. Koster, and Elif Kolotoglu. Branch and tree decomposition techniques for discrete optimization. Tutorials in Operations Research 2005, pages 1–19, 2005. 31 [25] Russell Impagliazzo, Ramamohan Paturi, and Francis Zane. Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63(4):512–530, 2001. [26] Kazuo Iwama and Takuya Nakashima. An improved exact algorithm for cubic graph TSP. pages 108–117, 2007. [27] Richard M. Karp. Dynamic programming meets the principle of inclusion and exclusion. Oper. Res. Lett., 1:49–51, 1982. [28] Jon Kleinberg and ´Eva Tardos. Algorithm Design. 2005. [29] Ton Kloks. Treewidth, Computations and Approximations, volume 842 of Lecture Notes in Computer Science. Springer, 1994. [30] Samuel Kohn, Allan Gottlieb, and Meryle Kohn. A generating function approach to the traveling salesman problem. In ACM ’77: Proceedings of the 1977 annual conference, pages 294–300, New York, NY, USA, 1977. ACM. [31] S. Lin and B. W. Kernighan. An effective heuristic algorithm for the traveling-salesman problem. Operations Research, 21(2):pp. 498–516, 1973. [32] Daniel Lokshtanov, Daniel Marx, and Saket Saurabh. Known algorithms on graphs of bounded treewidth are probably optimal. pages 777–789, 2011. [33] Ketan Mulmuley, Umesh V. Vazirani, and Vijay V. Vazirani. Matching is as easy as matrix inversion. 7(1):105–113, 1987. [34] Rolf Niedermeier. Invitation to Fixed-Parameter Algorithms. 2002. [35] Mihai Patra¸scu and Ryan Williams. On the possibility of faster SAT algorithms. In Proc. 21st ACM/SIAM Symposium on Discrete Algorithms (SODA), 2010. To appear. [36] Ran Raz and Boris Spieker. On the “log rank”-conjecture in communication complexity. Combinatorica, 15(4):567–588, 1995. [37] Neil Robertson and Paul D. Seymour. Graph minors. III. Planar tree-width. J. Comb. Theory, 36(1):49–64, 1984. [38] Gerhard J. Woeginger. Exact algorithms for NP-hard problems: A survey. In Michael Junger, Gerhard Reinelt, and Giovanni Rinaldi, editors, Combinatorial Optimization, vol- ume 2570 of Lecture Notes in Computer Science, pages 185–208. Springer, 2001. 32 A Omitted proofs of Section 3 A.1 Proof of Theorem 3.4 This section provides a proof for Theorem 3.4, which itself implies that each family Xt gives a basis for the Matching Connectivity matrix Ht . The proof will be by induction. As a first tool we define a pro jection that maps any perfect matching of Ut to a certain perfect matching of Ut−2 ; this is controlled by an additional parameter b ∈ {0, 1}. For matchings X (t, ·), depending on b, this will either be equivalent to undoing the last step in the recursive definition of X (t, ·) or yield ∅ (see Proposition A.2). Definition A.1 (Pro jection to t − 2 first vertices). Let t ≥ 4 be an even integer. We define a function shrinkt : (Π2 (Ut ) ∪ {∅}) × {0, 1} → Π2 (Ut−2 ) ∪ {∅} as follows. For b ∈ {0, 1} we let shrinkt (∅, b) := ∅. For M (cid:54)= ∅, the definition is as follows; we let α(i) := αM (i): 1. {t − 1, t − 2} ∈ M : shrinkt (M , 1) := ∅ shrinkt (M , 0) := M \ {{t − 1, t − 2}} 2. {t − 1, t − 3} ∈ M : shrinkt (M , 1) := (M \ {{t − 1, t − 3}, {t − 2, α(t − 2)}}) ∪ {{t − 3, α(t − 2)}} shrinkt (M , 0) := ∅ 3. {t − 2, t − 3} ∈ M : shrinkt (M , b) := (M \ {{t − 1, α(t − 1)}, {t − 2, t − 3}}) ∪ {{t − 3, α(t − 1)}} 4. {t − 1, t − 2}, {t − 1, t − 3}, {t − 2, t − 3} /∈ M : shrinkt (M , 1) := (M \ {{t − 1, α(t − 1)}, {t − 2, α(t − 2)}}) ∪ {{α(t − 1), α(t − 2)}} shrinkt (M , 0) := (M \ {{t − 1, α(t − 1)}, {t − 2, α(t − 2)}, {t − 3, α(t − 3)}}) ∪ ∪ {{t − 3, α(t − 2)}, {α(t − 1), α(t − 3)}} We omit the subscript t when it is clear from context. (cid:40) Proposition A.2. The behavior of shrinkt for matchings X (t, ab) is a fol lows X (t − 2, a) ∅ Now we show how our shrinkt operation interacts with the fact whether or not two match- ings of Ut form a Hamiltonian cycle. Recall the (cid:117) -operator: We have that the union of two perfect matchings M and M (cid:48) of Ut is a Hamiltonian cycle if and only if M (cid:117) M (cid:48) = {Ut}, i.e., if the connectivity provided by the edges of the two matchings creates a single connected com- ponent that contains all vertices Ut . (We do not make further use of the meet operator but we find it convenient for specifying also the set of vertices on which we have a Hamiltonian cycle.) The main fact about this interaction is given by the following lemma. It shows that the fact whether perfect matchings M1 and M2 form a Hamiltonian cycle depends directly on two pairs of pro jections of the two matchings. Note that the main statement of the lemma is given using addition modulo two. shrinkt (X (t, ab), c) = if b = c, else. 33 Lemma A.3. Let t ≥ 4 be an even integer and let M1 , M2 ∈ Π2 (Ut ). Let M j i := shrink(Mi , j ). Then 1 (cid:117) M 0 2 = {Ut−2}] + [M 1 1 (cid:117) M 1 [M1 (cid:117) M2 = {Ut}] ≡ [M 0 2 = {Ut−2}]. In other words, M1 ∪ M2 is a Hamiltonian cycle on Ut if and only if exactly one of M 0 1 ∪ M 1 2 2 is a Hamiltonian cycle on Ut−2 . and M 1 1 ∪ M 0 Proof. Unfortunately, there are quite a few cases that have to be considered. Each case is defined by the intersection of the set {{t − 1, t − 2}, {t − 1, t − 3}, {t − 2, t − 3}} with the two matchings; the cases are labeled by those of the edges that are contained in the two matchings. Due to symmetry via flipping the roles of M1 and M2 a couple of cases are omitted. Let us clarify and recall a few things. The union of two perfect matchings on some vertex set is known to always give a disjoint union of cycles plus possibly a set of edges (the single edges are obtained when both matchings agree on the inclusion of some edges; we could regard them also as cycles of length two using a double edge). For the shrink-operator it is only important which of the incident edges are in M1 and M2 . For our subsequent arguments we also need to consider how the cycles in M1 and M2 traverse the elements t − 1, −2, and t − 3, and whether there are further connected components not containing any of these three elements. We let α := αM1 and β := αM2 be the corresponding functions for M1 and M2 that for any element return the one that it is matched to. Accordingly, the cycles in M1 ∪ M2 will contain subpaths (α(t−1), t−1, β (t−1)), (α(t−2), t−2, β (t−2)), and (α(t−3), t−3, β (t−3)). Depending on the edges incident on t − 1, t − 2, and t − 3, we may get fewer paths: E.g., if {t − 1, t − 2} ∈ M1 then α(t − 1) = t − 2 and α(t − 2) = t − 1; we get paths (β (t − 2), t − 2, t − 1, β (t − 1) and (α(t − 3), t − 3, β (t − 3)). The shrink-operator will only change the edges with both endpoints in {t − 1, t − 2, t − 3, α(t − 1), α(t − 2), α(t − 3), β (t − 1), β (t − 2), β (t − 3)}, i.e., all other edges are preserved in the pro jection/image. Thus, the way that the above paths are connected into cycles in M1 ∪ M2 is preserved in M 0 1 ∪ M 0 2 and M 1 1 ∪ M 1 2 . In particular, we may assume that M1 ∪ M2 contains no cycle disjoint from t − 1, t − 2, t − 3 since it would be preserved too; in that case neither of the three pairs can form a Hamiltonian cycle and there is nothing left to show. Otherwise, clearly, the way that α(t − 1), α(t − 2), . . . , β (t − 3) are connected affects directly whether M1 ∪ M2 is a Hamiltonian cycle. For the other two pairs of matchings created by shrink these connections are the same but the shrink-operator leads to different connections around t − 1, t − 2, and t − 3 (in particular it removes t − 1 and t − 2), hence the total number of cycles may (and will) differ. 1) {t − 1, t − 2} ∈ M1 ∩ M2 : Clearly M1 ∪ M2 is no Hamiltonian cycle as both matchings 1 = shrink(M1 , 1) = ∅ and M 1 contain {t − 1, t − 2}. We observe that M 1 2 = shrink(M2 , 1) = ∅. Hence neither M 0 1 ∪ M 1 2 nor M 1 1 ∪ M 0 2 is a Hamiltonian cycle; this implies our claim. 2) {t − 1, t − 3} ∈ M1 ∩ M2 : Clearly M1 ∪ M2 is no Hamiltonian cycle as both matchings contain {t − 1, t − 3}. We observe that M 0 1 = shrink(M1 , 0) = ∅ and M 0 2 = shrink(M2 , 0) = ∅. Hence neither M 0 1 ∪ M 1 2 nor M 1 1 ∪ M 0 2 is a Hamiltonian cycle; this implies our claim. 3) {t − 2, t − 3} ∈ M1 ∩ M2 : Clearly M1 ∪ M2 is no Hamiltonian cycle as both matchings contain {t − 2, t = 3}. We will see that either both or none of M 0 1 ∪ M 1 2 and M 1 1 ∪ M 0 2 form a Hamiltonian cycle. By Definition A.1 we have shrinkt (M , b) := (M \ {{t − 1, αM (t − 1)}, {t − 2, t − 3}}) ∪ {{t − 3, αM (t − 1)}}, 1 ∪ M 1 when {t − 2, t − 3} ∈ M . Thus M 0 1 = M 1 1 and M 1 2 = M 0 It follows that M 0 2 . 2 is a 1 ∪ M 0 Hamiltonian cycle if and only if M 1 2 is a Hamiltonian cycle, as needed. 34 4) {t − 1, t − 2} ∈ M1 : We observe that M1 ∪ M2 contains subpaths (α(t − 3), t − 3, β (t − 3)) and (β (t − 1), t − 1, t − 2, β (t − 2)). By Definition A.1 we get M 0 1 = M1 \ {{t − 1, t − 2}}, M 1 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, β (t − 2)}}) ∪ {{β (t − 1), β (t − 2)}}, M 1 1 = ∅, M 0 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, β (t − 2)}, {t − 3, β (t − 3)}}) ∪ ∪ {{t − 3, β (t − 2)}, {β (t − 1), β (t − 3)}}. Hence, we know that M 1 1 ∪ M 0 2 cannot form a Hamiltonian cycle (and in the following, we will omit M j if its partner is the empty matching). Further, we get that M 0 1 ∪ M 1 2 contains i subpaths (α(t − 3), t − 3, β (t − 3)) and (β (t − 1), β (t − 2)). Since these subpaths require the same configuration of the remaining vertices, as the subpaths of M1 ∪ M2 we get that M1 ∪ M2 is a Hamiltonian cycle if and only if M 0 1 ∪ M 1 2 is a Hamiltonian cycle; this implies our claim. 5) {t − 1, t − 3} ∈ M1 : We observe that M1 ∪ M2 contains subpaths (α(t − 2), t − 2, β (t − 2)) and (β (t − 1), t − 1, t − 3, β (t − 3)). By Definition A.1 we get M 0 1 = ∅, M 1 1 = (M1 \ {{t − 1, t − 3}, {t − 2, α(t − 2)}}) ∪ {{t − 3, α(t − 2)}}, M 0 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, β (t − 2)}, {t − 3, β (t − 3)}}) ∪ ∪ {{t − 3, β (t − 2)}, {β (t − 1), β (t − 3)}}. This time M 0 1 ∪ M 0 1 = ∅. For M 1 2 cannot form a Hamiltonian cycle, since M 0 1 ∪ M 1 2 we get subpaths (α(t − 2), t − 3, β (t − 2)) and (β (t − 1), β (t − 3)). Hence, the remaining edges com- plete M1 ∪ M2 to a Hamiltonian cycle if and only if the same is true for M 1 1 ∪ M 0 2 . 6) {t − 2, t − 3} ∈ M1 : We observe that M1 ∪ M2 contains subpaths (α(t − 1), t − 1, β (t − 1)) and (β (t − 2), t − 2, t − 3, β (t − 3)). By Definition A.1 we get M 0 1 = (M1 \ {{t − 1, α(t − 1)}, {t − 2, t − 3}}) ∪ {{t − 3, α(t − 1)}}, M 1 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, β (t − 2)}}) ∪ {{β (t − 1), β (t − 2)}}, M 1 1 = (M1 \ {{t − 1, α(t − 1)}, {t − 2, t − 3}}) ∪ {{t − 3, α(t − 1)}}, M 0 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, β (t − 2)}, {t − 3, β (t − 3)}}) ∪ ∪ {{t − 3, β (t − 2)}, {β (t − 1), β (t − 3)}}. 1 ∪ M 1 Now, for M 0 2 we get subpaths (α(t − 1), t − 3, β (t − 3)) and (β (t − 1), β (t − 2)), and for M 1 1 ∪ M 0 2 we get subpaths (α(t − 1), t − 3, β (t − 2)) and (β (t − 1), β (t − 3)). If the remaining edges contain any cycles, then none of M1 ∪ M2 , M 0 1 ∪ M 0 1 ∪ M 1 2 , and M 1 2 form a Hamiltonian cycle (in the following we will tacitly ignore this case). Otherwise, all remaining edges form two vertex-disjoint paths that start and end in different vertices of {α(t − 1), β (t − 1), β (t − 2), β (t − 3)}; for convenience, if, e.g., α(t − 1) = β (t − 2) then we take this as a trivial path from α(t − 1) to β (t − 2). There are three ways in which those paths can connect the four vertices: 1. (α(t − 1), . . . , β (t − 1)) and (β (t − 2), . . . , β (t − 3)): In this case M1 ∪ M2 is no Hamiltonian cycle, but both M 0 1 ∪ M 1 2 and M 1 1 ∪ M 0 2 are Hamiltonian cycles. (This can be easily seen by combining the corresponding two subpaths with the two paths through the remaining edges: Either we get a single (Hamiltonian) cycle, or there are two cycles.) 35 2. (α(t − 1), . . . , β (t − 2)) and (β (t − 1), . . . , β (t − 3)): In this case M1 ∪ M2 and M 0 1 ∪ M 1 2 are Hamiltonian cycles, and M 1 1 ∪ M 0 2 is no Hamiltonian cycle. 3. (α(t − 1), . . . , β (t − 3)) and (β (t − 1), . . . , β (t − 2)): In this case M1 ∪ M2 and M 1 1 ∪ M 0 2 1 ∪ M 1 are Hamiltonian cycles, and M 0 2 is no Hamiltonian cycle. Thus, for all configurations of the remaining edges we get that M1 ∪ M2 forms a Hamiltonian cycle if and only if exactly one of M 0 1 ∪ M 1 2 and M 1 1 ∪ M 0 2 is a Hamiltonian cycle. 7) {t − 1, t − 2} ∈ M1 and {t − 1, t − 3} ∈ M2 : We observe that M1 ∪ M2 contains a subpath (α(t − 3), t − 3, t − 1, t − 2, β (t − 2)). By Definition A.1 we get M 0 1 = M1 \ {{t − 1, t − 2}}, M 1 2 = (M2 \ {{t − 1, t − 3}, {t − 2, β (t − 2)}}) ∪ {{t − 3, β (t − 2)}}, M 1 1 = ∅, M 0 2 = ∅. 1 ∪ M 1 2 is no Hamiltonian cycle. For M 0 Thus, M 1 1 ∪ M 0 2 we get a single subpath (α(t − 3), t − 3, β (t − 2)). It follows easily that M1 ∪ M2 is a Hamiltonian cycle if and only if M 0 1 ∪ M 1 2 is a Hamiltonian cycle. 8) {t − 1, t − 2} ∈ M1 and {t − 2, t − 3} ∈ M2 : We observe that M1 ∪ M2 contains a subpath (α(t − 3), t − 3, t − 2, t − 1, β (t − 1)). By Definition A.1 we get M 0 1 = M1 \ {{t − 1, t − 2}}, M 1 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, t − 3}}) ∪ {{t − 3, β (t − 1)}}, M 1 1 = ∅. 1 ∪ M 1 2 is no Hamiltonian cycle. For M 0 Thus M 1 1 ∪ M 0 2 we get a single subpath (α(t − 3), t − 3, β (t − 1)). This implies that M1 ∪ M2 is a Hamiltonian cycle if and only if M 0 1 ∪ M 1 2 is a Hamiltonian cycle. 9) {t − 1, t − 3} ∈ M1 and {t − 2, t − 3} ∈ M2 : We observe that M1 ∪ M2 contains a subpath ( alpha(t − 2), t − 2, t − 3, t − 1, β (t − 1)). By Definition A.1 we get M 0 1 = ∅, M 1 1 = (M1 \ {{t − 1, t − 3}, {t − 2, α(t − 2)}}) ∪ {{t − 3, α(t − 2)}}, M 0 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, t − 3}}) ∪ {{t − 3, β (t − 1)}}. 1 ∪ M 0 1 ∪ M 1 Thus M 0 2 is no Hamiltonian cycle. For M 1 2 we get a single subpath (α(t − 2), t − 3, β (t − 1)). This implies that M1 ∪ M2 is a Hamiltonian cycle if and only if M 1 1 ∪ M 0 2 is a Hamiltonian cycle. 10) {{t − 1, t − 2}, {t − 1, t − 3}, {t − 2, t − 3}} ∩ (M1 ∪ M2 ) = ∅: In this final case we can only observe the trivial subpaths in M1 ∪ M2 , namely (α(t − 1), t − 1, β (t − 1)), (α(t − 36 2), t − 2, β (t − 2)), and (α(t − 3), t − 3, β (t − 3)). By Definition A.1 we get M 0 1 = (M1 \ {{t − 1, α(t − 1)}, {t − 2, α(t − 2)}, {t − 3, α(t − 3)}}) ∪ ∪ {{t − 3, α(t − 2)}, {α(t − 1), α(t − 3)}}, M 1 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, β (t − 2)}}) ∪ {{β (t − 1), β (t − 2)}}, M 1 1 = (M1 \ {{t − 1, α(t − 1)}, {t − 2, α(t − 2)}}) ∪ {{α(t − 1), α(t − 2)}}, M 0 2 = (M2 \ {{t − 1, β (t − 1)}, {t − 2, β (t − 2)}, {t − 3, β (t − 3)}}) ∪ ∪ {{t − 3, β (t − 2)}, {β (t − 1), β (t − 3)}}. 1 ∪ M 1 Thus, M 0 2 has subpaths (α(t − 1), α(t − 3)), (α(t − 2), t − 3, β (t − 3)), (β (t − 1), β (t − 2)), and M 1 1 ∪ M 0 2 has subpaths (α(t − 1), α(t − 2)), (α(t − 3), t − 3, β (t − 2)), (β (t − 1), β (t − 3)). Thus, whether any of the three unions of perfect matchings is a Hamiltonian cycle depends again on the paths given by all remaining edges. As before, if those edges give rise to cycles disjoint from t − 1, t − 2, t − 3 then none of the three unions is a Hamiltonian cycle and we are done. Else, the remaining edges serve exactly to create three vertex disjoint paths between the vertices α(t − 1), α(t − 2), α(t − 3), β (t − 1), β (t − 2), and β (t − 3); there are 15 configurations of such paths (i.e., partitions of this set of endpoints into three pairs of connected vertices). Note that again we treat cases like α(t − 1) = β (t − 2) has a path connecting α(t − 1) and β (t − 2). It can be easily verified that for each of the 15 configurations we get the desired property that M1 ∪ M2 is a Hamiltonian cycle if and only if exactly one of M 0 1 ∪ M 1 2 and M 1 1 ∪ M 0 2 is a Hamiltonian cycle. For completeness, we provide a table containing all 15 cases; see Table 1. This completes the proof. As a special case of Lemma A.3 when the second matching is in our intended basis, we get the following lemma. Both lemmas are used for proving the main theorem of this section. Lemma A.4. Let t be an even integer t ≥ 6 and let M ∈ Π2 (Ut ). Furthermore let X = X (t, ab) where b ∈ {0, 1} and a denotes a 0, 1-string of length t 2 − 2. Then M ∪ X is a Hamiltonian cycle if and only if shrink(M , b) ∪ X (t − 2, a) is a Hamiltonian cycle, i.e., [M (cid:117) X (t, ab) = {Ut}] = [shrink(M , b) (cid:117) X (t − 2, a) = {Ut−2}]. We are now set up to prove Theorem 3.4; let us recall the theorem statement first. (cid:88) Theorem A.5. 3.4 Let t ≥ 2 be an even integer and let M1 , M2 ∈ Π2 (Ut ). It holds that [M1 (cid:117) M2 = {Ut}] ≡ [M1 (cid:117) X (t, a) = {Ut}] · [M2 (cid:117) X (t, a) = {Ut}], a∈{0,1}t/2−1 where X (t, a), X (t, a) ∈ Xt according to Definition 3.1. (Each matching in Xt occurs exactly twice, once as X (t, a) and once as X (t, a).) We establish a factorization of the Matching Connectivity matrix as the product of two smaller rectangular matrices: The first matrix has rows labeled by (all) perfect matchings and columns labeled by basis matchings X (t, a). The second matrix has rows labeled basis match- ings X (t, a) and columns labeled by (all) perfect matchings. The entries of both rectangular 37 configuration of remaining edges as paths between α(t − 1), α(t − 2), α(t − 3), β (t − 1), β (t − 2), β (t − 3) α(t − 1)-α(t − 2), α(t − 3)-β (t − 1), β (t − 2)-β (t − 3) α(t − 1)-α(t − 2), α(t − 3)-β (t − 2), β (t − 1)-β (t − 3) α(t − 1)-α(t − 2), α(t − 3)-β (t − 3), β (t − 1)-β (t − 2) α(t − 1)-α(t − 3), α(t − 2)-β (t − 1), β (t − 2)-β (t − 3) α(t − 1)-α(t − 3), α(t − 2)-β (t − 2), β (t − 1)-β (t − 3) α(t − 1)-α(t − 3), α(t − 2)-β (t − 3), β (t − 1)-β (t − 2) α(t − 1)-β (t − 1), α(t − 2)-α(t − 3), β (t − 2)-β (t − 3) α(t − 1)-β (t − 1), α(t − 2)-β (t − 2), α(t − 3)-β (t − 3) α(t − 1)-β (t − 1), α(t − 2)-β (t − 3), α(t − 3)-β (t − 2) α(t − 1)-β (t − 2), α(t − 2)-α(t − 3), β (t − 1)-β (t − 3) α(t − 1)-β (t − 2), α(t − 2)-β (t − 1), α(t − 3)-β (t − 3) α(t − 1)-β (t − 2), α(t − 2)-β (t − 3), α(t − 3)-β (t − 1) α(t − 1)-β (t − 3), α(t − 2)-α(t − 3), β (t − 1)-β (t − 2) α(t − 1)-β (t − 3), α(t − 2)-β (t − 1), α(t − 3)-β (t − 2) α(t − 1)-β (t − 3), α(t − 2)-β (t − 2), α(t − 3)-β (t − 1) Table 1: All 15 configurations for paths connecting the vertices α(t − 1), α(t − 2), α(t − 3), β (t − 1), β (t − 2), and β (t − 3), and their effect on whether M1 ∪ M2 , M 0 1 ∪ M 0 2 , and M 1 1 ∪ M 1 2 form a Hamiltonian cycle (denoted by 1 and 0 otherwise. 1 ∪ M 0 M1 ∪ M2 M 0 1 ∪ M 1 2 M 1 2 is H-cycle is H-cycle is H-cycle 0 1 1 0 1 1 0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 0 matrices are as in the large one: we have 1 if the two matchings form a Hamiltonian cycle and 0 else (so in fact they are submatrices of the large matrix). Note that the two perfect matchings from Xt in each summand are exactly the unique pairs that give Hamiltonian cycles (among basis matchings). Also note that the main statement of the theorem is given in arithmetic modulo two. Proof. Let us quickly verify the theorem for the base case t = 2. There is a unique perfect matching {{0, 1}} for U2 = {0, 1}. Thus, we can only pick M1 = M2 = {{0, 1}}. Hence, for the left hand side of the theorem statement we get LH S = [M1 (cid:117) M2 = {U2}] = 1. Regarding the right hand side the only choice for a ∈ {0, 1}t/2−1 in the sum is a = ε (of course ε = ε). We recall that X (2, ε) = {{0, 1}}, thus we get RH S = [M1 (cid:117) X (2, ε) = {U2}] · [M2 (cid:117) X (2, ε) = {U2}] = 1. This completes the base case t = 2. Now, we will perform an inductive argument to show that the theorem holds also for all even t ≥ 4. We start from the right hand side of the theorem statement and apply Lemmas A.3 and A.4 to transform it into the left hand side. As a first step, we split the right hand side sum into two parts, depending on the last position of a (to do so formally we shorten a by one (cid:88) position and explicitely specify 0 or 1 to be appended). (cid:88) a∈{0,1}t/2−2 [M1 (cid:117) X (t, a1) = {Ut}] · [M2 (cid:117) X (t, a1) = {Ut}] a∈{0,1}t/2−2 [M1 (cid:117) X (t, a0) = {Ut}] · [M2 (cid:117) X (t, a0) = {Ut}] RH S = + 38 Note that a0 = a1 and a1 = a0. Let us recall the statement of Lemma A.4: + RH S = [M (cid:117) X (t, ab) = {Ut}] = [shrinkt (M , b) (cid:117) X (t − 2, a) = {Ut−2}]. (cid:88) Using the shorthand M j i := shrinkt (Mi , j ) we can thus rewrite the RHS as follows. (cid:88) 1 (cid:117) X (t − 2, a) = {Ut−2}] · [M 1 [M 0 2 (cid:117) X (t − 2, a) = {Ut−2}] a∈{0,1}t/2−2 1 (cid:117) X (t − 2, a) = {Ut−2}] · [M 0 [M 1 2 (cid:117) X (t − 2, a) = {Ut−2}] a∈{0,1}t/2−2 2 − 2 = t−2 We note that both sums go over all bitstrings a of length t 2 − 1. Thus, after brief inspection of the summands, we see that we can apply the inductive assumption to both sums since M j i ∈ Π2 (Ut−2 ). We obtain 1 (cid:117) M 0 2 = {Ut−2}] + [M 1 1 (cid:117) M 1 RH S = [M 0 2 = {Ut−2}]. Finally, by a direct application of Lemma A.3 we obtain RH S = [M1 (cid:117) M2 = {Ut}] = LH S, which is what we intended to prove. Thus, the theorem holds for all even integer t ≥ 2, as claimed. 39
1809.09330
2
1809
2019-08-20T19:40:27
Improved Parallel Cache-Oblivious Algorithms for Dynamic Programming and Linear Algebra
[ "cs.DS" ]
Emerging non-volatile main memory (NVRAM) technologies provide byte-addressability, low idle power, and improved memory-density, and are likely to be a key component in the future memory hierarchy. However, a critical challenge in achieving high performance is in accounting for the asymmetry that NVRAM writes can be significantly more expensive than NVRAM reads. In this paper, we consider a large class of cache-oblivious algorithms for dynamic programming (DP) and linear algebra, and try to reduce the writes in the asymmetric setting while maintaining high parallelism. To achieve that, our key approach is to show the correspondence between these problems and an abstraction for their computation, which is referred to as the $k$-d grids. Then by showing lower bound and new algorithms for computing $k$-d grids, we show a list of improved cache-oblivious algorithms of many DP recurrences and in linear algebra in the asymmetric setting, both sequentially and in parallel. Surprisingly, even without considering the read-write asymmetry (i.e., setting the write cost to be the same as the read cost in the algorithms), the new algorithms improve the existing cache complexity of many problems. We believe the reason is that the extra level of abstraction of $k$-d grids helps us to better understand the complexity and difficulties of these problems. We believe that the novelty of our framework is of interests and leads to many new questions for future work.
cs.DS
cs
Improved Parallel Cache-Oblivious Algorithms for Dynamic Programming and Linear Algebra Guy Blelloch Carnegie Mellon University Yan Gu Massachusetts Institute of Technology Abstract Emerging non-volatile main memory (NVRAM) technologies provide byte-addressability, low idle power, and improved memory-density, and are likely to be a key component in the future memory hierarchy. However, a critical challenge in achieving high performance is in accounting for the asymmetry that NVRAM writes can be significantly more expensive than NVRAM reads. In this paper, we consider a large class of cache-oblivious algorithms for dynamic programming (DP) and linear algebra, and try to reduce the writes in the asymmetric setting while maintaining high parallelism. To achieve that, our key approach is to show the correspondence between these problems and an abstraction for their computation, which is referred to as the k-d grids. Then by showing lower bound and new algorithms for computing k-d grids, we show a list of improved cache-oblivious algorithms of many DP recurrences and in linear algebra in the asymmetric setting, both sequentially and in parallel. Surprisingly, even without considering the read-write asymmetry (i.e., setting the write cost to be the same as the read cost in the algorithms), the new algorithms improve the existing cache complexity of many problems. We believe the reason is that the extra level of abstraction of k-d grids helps us to better understand the complexity and difficulties of these problems. We believe that the novelty of our framework is of interests and leads to many new questions for future work. 1 Introduction The ideal-cache model [46] is widely used in designing algorithms that optimize the communication between CPU and memory. The model is comprised of an unbounded memory and a cache of size M. Data are transferred between the two levels using cache lines of size B, and all computation occurs on data in the cache. An algorithm is cache-oblivious if it is unaware of both M and B. The goal of designing such algorithms is to reduce the cache complexity1 (or the I/O cost indistinguishably) of an algorithm, which is the number of cache lines transferred between the cache and the main memory assuming an optimal (offline) cache replacement policy. Sequential cache-oblivious algorithms are flexible and portable, and adapt to all levels of a multi-level memory hierarchy. Such algorithms are well studied [8, 28, 39], and in many cases they asymptotically match the best cache complexity for cache-aware algorithms. Regarding parallelism, Blelloch et al. [20] suggest that analyzing the depth and sequential cache complexity of an algorithm is sufficient for deriving upper bounds on parallel cache complexity. Recently, emerging non-volatile main memory (NVRAM) technologies, such as Intel's Optane DC Persistent Memory, are readily available on the market, and provide byte-addressability, low idle power, and improved memory-density. Due to these advantages, NVRAMs are likely to be the dominant main memories in the near future, or at least be a key component in the memory hierarchy. However, a significant programming challenge arises due to an underlying asymmetry between reads and writes -- reads are much 1In this paper, we refer to it as symmetric cache complexity to distinguish from the case when reads and writes have different costs. 1 Dimension Problems k = 2 LWS/GAP*/RNA/knapsack recurrences k = 3 Combinatorial matrix multiplication, Kleene's algorithm (APSP), Parenthesis recurrence Θ (cid:18) C (cid:18) C √ BM Θ (cid:19) (cid:19) B M Cache Complexity Symmetric Asymmetric (cid:33) (cid:33) (cid:32) (cid:32) Θ Θ ω1/2C BM ω1/3C √ B M Table 1: Cache complexity of the algorithms based on the k-d grid computation structures. Here C is the number of algorithmic instructions in the corresponding computation. (*) For the GAP recurrence, the upper bounds have addition terms as shown in Section 7.2. cheaper than writes in terms of both latency and throughput. This property requires researchers to rethink the design of algorithms and software, and optimize the existing ones accordingly to reduce the writes. Such algorithms are referred to as the write-efficient algorithms [52]. Many cache-oblivious algorithms are affected by this challenge. Taking matrix multiplication as an example, the cache-aware tiling-based algorithm [4] uses Θ(n3/B M ) cache-line reads and Θ(n2/B) cache-line writes for square matrices with size n-by-n. The cache-oblivious algorithm [46], despite the advantages described above, uses Θ(n3/B M ) cache-line reads and writes. When considering the more expensive writes, the cache-oblivious algorithm is no longer asymptotically optimal. Can we asymptotically improve the cache complexity of these cache-oblivious algorithms? Can they match the best counterpart without considering cache-obliviousness? These remain to be open problems in the very beginning of the study of write-efficiency of algorithms [16, 29]. √ √ In this paper, we provide the answers to these questions for a large class of cache-oblivious algorithms that have computation structures similar to matrix multiplication and can be coded up in nested for-loops. Their implementations are based on a divide-and-conquer approach that partitions the ranges of the loops and recurses on the subproblems until the base case is reached. Such algorithms are in the scope of dynamic programming (e.g., the LWS/GAP/RNA/Parenthesis problems) and linear algebra (e.g., matrix multiplication, Gaussian elimination, LU decomposition) [46, 34, 36, 31, 20, 60, 77, 74, 83, 78]. Since we try to cover many problems and algorithms, in this paper we propose a level of abstraction of the computation in these cache-oblivious algorithms, which is referred to as the k-d grid computation structures (short for the k-d grids). A more formal definition is given Section 3. This structure and similar ones are first used by Hong and Kung [56] (implicitly) in their seminal paper in 1981, and then by a subsequence of later work (e.g., [9, 2, 59, 10, 36]), mostly on analyzing the lower bounds of matrix multiplication and linear algebra problems in a variety of settings. In this paper, we show the relationship of the k-d grids and many other dynamic programming problems, and new results (algorithms and lower bounds) related to the k-d grids. The first intellectual contribution of this paper is to draw the connection between many dynamic program- ming (DP) problems and the k-d grids. Previous DP algorithms are usually designed and analyzed based on the number of nested loops, or the number of the dimensions of which the input and output are stored and organized. However, we observe that the key underlying factor in determining the cache complexity of these computations is the number of input entries involved in each basic computation cell, and such relationship will be defined formally later in Section 3. A few examples (e.g., matrix multiplication, tensor multiplication, RNA and GAP recurrences) are also provided in Section 3 to illustrate the idea. This property is reflected by the nature of the k-d grids, and the correspondence between the problems and the k-d grids is introduced in Section 8 and 7. We note that such relationship can be much more complicated than the linear algebra 2 algorithms, and in many cases the computation of one algorithm consists of many (e.g., O(n)) k-d grids associated with restrictions of the order of computing. The second intellectual contribution of this paper is a list of new results for the k-d grids. We first discuss the lower bounds to compute such k-d grids considering the asymmetric cost between writes and reads (in Section 4). Based on the analysis of the lower bounds, we also propose algorithms with the matching bound to compute a k-d grid (in Section 5). Finally, we also show how to parallelize the algorithm in Section 6. We note that the approach for parallelism is independent of the asymmetric read-write cost, so the parallel algorithms can be applied to both symmetric and asymmetric algorithms. In summary, we have shown the correspondence between the problems and the k-d grids, new lower and upper cache complexity bounds for computing the k-d grids in asymmetric setting, and parallel algorithms in both symmetric and asymmetric settings. Putting all pieces together, we can show lower and upper cache complexity bounds of the original problems in both the symmetric and asymmetric settings, as well as spans (length of dependence) for the algorithms. The cache complexity bounds are summarized in Table 1, and the results for the asymmetric setting answer the open problem in [16]. The span bound is analyzed for each specific problem and given in Section 7, 8 and appendices. Surprisingly, even without considering the read-write asymmetry (i.e., setting the write cost to be the same as the read cost in the algorithms), the new algorithms proposed in this paper improve the existing cache complexity of many DP problems. We believe the reason is that the extra level of abstraction of k-d grids helps us to better understand the complexity and difficulties of these problems. Since k-d grids are used as a tool for lower bounds, they decouple the computation structures from the complicated data dependencies, which exposes some techniques to improve the bounds that were previously obscured. Also, k-d grids reveal the similarities and differences between these problems, which allows the optimizations in some algorithms to apply to other problems. In summary, we believe that the framework for analyzing cache-oblivious algorithms based on k-d grids provides a better understanding of these algorithms. In particular, the new theoretical results in this paper include: • We provide write-efficient cache-oblivious algorithms (i.e., in the asymmetric setting) for all problems we discussed in this paper, including matrix multiplication and several linear algebra algorithms, all-pair shortest-paths, and a number of dynamic programming recurrences. If a write costs ω times more than a read (the formal computational model shown in Section 2), the asymmetric cache complexity is improved by a factor of Θ(ω1/2) or Θ(ω2/3) on each problem compared to the best previous results [18]. In some cases, we show that this improvement is optimal under certain assumptions (the CBCO paradigm, defined in Section 4.2). • We show algorithms with improved symmetric cache complexity on many problems, including the GAP recurrence, protein accordion folding, and the RNA recurrence. We show that the previous cache √ complexity bound O(n3/B M ) for the GAP recurrence and protein accordion folding is not optimal, and we improve the bound to O(n2/B · (n/M + log min{n/ M})) and Θ(n2/B · (1 + n/M )) respectively2. For RNA recurrence, we show an optimal cache complexity of Θ(n4/BM ), which improves the best existing result by Θ(M 3/4). √ √ M , • We show the first race-free linear-span cache-oblivious algorithms solving all-pair shortest-paths, LWS recurrences, and protein accordion folding. Some previous algorithms [75, 41] have linear span, but they are not race-free and rely on a much stronger model (discussion in Section 2). Our approaches √ √ √ √ √ 2The improvement is O( M ) from an asymptotic perspective (i.e., n approaching infinity). For smaller range of n that M ) ≤ n ≤ O(M ), the improvement is O(n/ M )) and O(n/ M ) respectively for the two cases. (The M / log(n/ √ O( computation fully fit into the cache when n < O( M ).) 3 are under the standard nested-parallel model, race-free, and arguably simpler. Our algorithms are not in-place, but we discuss in Section 6.1 about the extra storage needed. We believe that the analysis framework is concise. In this single paper, we discuss the lower bounds and parallel algorithms on a dozen or so computations and DP recurrences, which can be further applied to dozens of real-world problems3. The results are shown in both settings with or without considering the asymmetric cost between reads and writes. 2 Preliminaries and Related Work Ideal-cache model and cache-oblivious algorithms. In modern computer architecture, a memory access is much more expensive compared to an arithmetic operation due to larger latency and limited bandwidth (especially in the parallel setting). To capture the cost of an algorithm on memory access, the ideal-cache model, a widely-used cost model, is a two-level memory model comprised of an unbounded memory and a cache of size M.4 Data are transferred between the two levels using cache lines of size B, and all computation occurs on data in the cache. The cache complexity (or the I/O cost indistinguishably) of an algorithm is the number of cache lines transferred between the cache and the main memory assuming an optimal (offline) cache replacement policy. An algorithm on this model is cache-oblivious with the additional feature that it is not aware of the value of M and B. In this paper, we refer to this cost as the symmetric cache complexity (as opposed to asymmetric memory as discussed later). Throughout the paper, we assume that the input and output do not fit into the cache since otherwise the problems become trivial. We usually make the tall-cache assumption that M = Ω(B2), which holds for real-world hardware and is used in the analysis in Section 7.3. The nested-parallel model and work-span analysis. In this paper, the parallel algorithms are within the standard nested-parallel model, which is a computation model and provides an easy analysis of the work- efficiency and parallelism. In this model, a computation starts and ends with a single root task. Each task has a constant number of registers and runs a standard instruction set from a random access machine, except it has one additional instruction called FORK, which can create two independent tasks one at a time that can be run in parallel. When the two tasks finish, they join back and the computation continues. A computation can be viewed as a (series-parallel) DAG in the standard way. The cost measures on this model are the work and span -- work W to be the total number of operations in this DAG and span (depth) D equals to the longest path in the DAG. The randomized work-stealing scheduler can execute such a computation on the PRAM model with p processors in W/p + O(D) time with high probability [26]. All algorithms in this paper are race-free [43] -- no logically parallel parts of an algorithm access the same memory location and one of the accesses is a write. Here we do not distinguish the extra write cost for asymmetric memory on W and D to simplify the description of the results, and we only capture this asymmetry using cache complexity. Regarding parallel cache complexity, Blelloch et al. [20] suggest that analyzing the span and sequential cache complexity of an algorithm is sufficient for deriving upper bounds on parallel cache complexity. In particular, let Q1 be the sequential cache complexity. Then for a p-processor shared-memory machine with private caches (i.e., each processor has its own cache) using a work-stealing scheduler, the total number of cache misses Qp across all processors is at most Q1 + O(pDM/B) with high probability [1]. For a p-processor shared-memory machine with a shared cache of size M + pBD using a parallel-depth-first (PDF) scheduler, Qp ≤ Q1 [15]. We can extend these bounds to multi-level hierarchies of private or shared caches, respectively [20]. 3Like in this paper we abstract the "2-knapsack recurrence", which fits into our k-d grid computation structure and applies to many algorithms. 4In this paper, we often assume the cache size to be O(M ) since it simplifies the description and only affects the bounds by a constant factor. 4 Parallel and cache-oblivious algorithms for dynamic programming and linear algebra. Dynamic Pro- gramming (DP) is an optimization strategy that decomposes a problem into subproblems with optimal substructure. It has been studied for over sixty years [12, 5, 38]. For the problems that we consider in this paper, the parallel DP algorithms were already discussed by a rich literature in the eighties and nighties (e.g., [49, 51, 42, 58, 57, 72]). Later work not only considers parallelism, but also optimizes symmetric cache complexity (e.g., [46, 34, 36, 31, 20, 60, 77, 74, 75, 41, 73, 32]). The algorithms in linear algebra that share the similar computation structures (but with different orders in the computation) are also discussed (e.g., [36, 41, 83, 78, 25, 40, 11, 65]). Problem definitions. Since we are showing many optimal cache-oblivious algorithms, we need formal problem definitions. It is hard to show general lower bounds that any type of operations is allowed. For example, for matrix multiplication on a semiring, the only known lower bound of operations is just Ω(n3−o(1)) for Boolean matrix multiplication assuming SETH (more details of fine-grain complexity in [82]). Here we make no assumptions of the set of the ring other than "+" and "×" to be atomic using unit cost and unable to be decomposed or batched (i.e., using integer tricks). We borrow the term combinatorial matrix multiplication to indicate this specific problem. Such an algorithm requires Θ(n3) operations on square matrices of size n (n2 inner products). Regarding dynamic programming in Section 7, we discuss the recurrences rather than the problems, and make assumptions shown in Section 3 and Section 7. Algorithms with asymmetric read and write costs. Intel has already announced the new product of the Optane DC Persistent Memory, which can be bought from many retailers. The new memories sit on the main memory bus and are byte-addressable. As opposed to DRAMs, the new memories are persistent, so we refer to them as non-volatile RAMs (NVRAMs). In addition, compared to DRAMs, NVRAMs require significantly lower energy, and have good read latencies and higher density. Due to these advantages, NVRAMs are likely to be the dominant main memories in the near future, or at least be a key component in the memory hierarchy. However, a new property of NVRAMs is the asymmetric read and write cost -- write operations are more expensive than reads regarding energy, bandwidth, and latency (benchmarking results in [79]). This property requires researchers to rethink the design of algorithms and software, and motivates the need for write-efficient algorithms [52] that reduce the number of writes compared to existing algorithms. Blelloch et al. [13, 16, 17] formally defined and analyzed several sequential and parallel computation models that take asymmetric read-write costs into account. The model Asymmetric RAM (ARAM) extends the two-level memory model and contains a parameter ω, which corresponds to the cost of a write relative to a read to the non-volatile main memory. In this paper, we refer to the asymmetric cache complexity Q as the number of write transfers to the main memory multiplied by ω, plus the number of read transfers. This model captures different system consideration (latency, bandwidth, or energy) by simply plugging in a different value of ω, and also allows algorithms to be analyzed theoretically and practically. Similar scheduling results (upper bounds) on parallel running time and cache complexity are discussed in [13, 17] based on work W , span D and asymmetric cache complexity Q of an algorithm. Based on this idea, many interesting algorithms and lower bounds are designed and analyzed by various recent works [13, 16, 17, 23, 61, 14, 21, 19, 53]. In the analysis, we always assume that the input size is much larger than the cache size (which is usually the case in practice). Otherwise, both the upper and the lower bounds on cache complexity also include the term for output -- ω times the output size. For simplicity, this term is ignored in the asymptotic analysis. Carson et al. [29] also discussed algorithms using less writes. Their results are under some different assumptions that disallow the use of more reads, and we discuss how the assumptions affect the algorithms in the Appendix E. Discussions of previous work. We now discuss several possible confusions of this paper. The k-d grid computation structure in this paper is similar to the structure in Hong and Kung [56], and some subsequence work in linear algebra (e.g., [9, 2, 59, 10, 36]). Several recent papers on DP algorithms are also based on grid structure (e.g., [31, 60, 77]), but the definitions in those paper are different from the 5 Figure 1: An illustration of a 2d and a 3d grid. The left figure shows the 2d case where the input I1 and output O are 1d arrays, and each computation cell g(·) requires exactly one entry in I1 as input, and update one entry in O. For the 3d case on the right, the inputs and output are 2d arrays, and each computation cell g(·) requires one entry from input I1 and one from input I2. The input/output entries of each cell are the projections of this cell on different 2d arrays. k-d grids in this paper. In the k-d grid, the dimension of the grid is related to the number of entries per basic computation unit (formal definition in Section 3), not the dimension of the input/output arrays. However, in the special case when the number of input entries per basic computation cell is the same as the dimension of the input/output arrays, the analysis based on k-d grid provides the same sequential symmetric cache complexity as the previous work. One such example is matrix multiplication [46], and in these cases we still provide new lower and upper asymmetric cache bounds as well as parallel approaches (new span bounds). For other problems (GAP, RNA, protein accordion folding, knapsack), the bounds in the symmetric setting are also improved. Some previous work [75, 41] achieves the linear span in several problems. We note that they assume a much stronger model to guarantee the sequential and parallel execution order, so their algorithms need specially designed schedulers [41, 30]. Our algorithms are much simpler and under the nested-parallel model. Also, all algorithms in this paper are race-free, while previous algorithms heavily rely on concurrent-writes to improve span. The space issue of algorithms is discussed in Section 6.1. The dynamic programming recurrences discussed in this paper have non-local dependencies (definition given in [51]), and we point out that they are pretty different from the problems like edit distance or stencil computations (e.g., [33, 47, 54, 67]) that only have local dependencies. We did not consider other types of dynamic programming approaches like rank convergence or hybrid r-way DAC algorithms [69, 70, 35] that cannot guarantee processor- and cache-obliviousness simultaneously. 3 k-d Grid Computation Structure The k-d grid computation structure (short for the k-d grid) is defined as a k-dimensional grid C of size n1 × n2 × ··· × nk. Here we consider k to be a small constant greater than 1. This computation requires k − 1 input arrays I1,··· , Ik−1 and generates one output array O. Each array has dimension k − 1 and is the projection of the grid removing one of the dimensions. Each cell in the grid represents some certain computation that requires k − 1 inputs and generates a temporary value. This temporary value is "added" to the corresponding location in the output array using an associative operation ⊕. The k − 1 inputs of this cell are the projections of this cell removing each (but not the last) dimensions, and the output is the projection removing the last dimension. They are referred to as the input and output entries of this cell. Figure 1 illustrates such a computation in 2 and 3 dimensions. This structure (mostly the special case for 3d as defined below) is used implicitly and explicitly by Hong and Kung [56] and some subsequence works 6 Input 𝐼1Output 𝑂Output 𝑂Input 𝐼1Input 𝐼2 (e.g., [9, 2, 59, 10, 36]). In this paper, we will use it as a building block to prove lower bounds and design new algorithms for dynamic programming problems. When showing the cache complexity, we assume the input and output entries must be in the cache when computing each cell. We refer to a k-d grid computation structure as a square grid computation structure (short for a square grid) of size n if it has size n1 = ··· = nk = n. More concisely, we say a k-d grid has size n if it is square and of size n. A formal definition of a square 3d grid of size n is as follows: (cid:88) k Oi,j = g((I1)i,k(I2)k,j, i, j, k) where 1 ≤ i, j, k ≤ n. g(·) computes a value based on the two inputs (I1)i,k and (I2)k,j the indices, and some constant amount of data that is associated to the indices. We assume that computing g(·) takes unit cost. Each application of g(·) corresponds to a cell, and (I1)i,k, (I2)k,j and Oi,j are entries associated with this cell. The sum(cid:80) is based on the associative operator ⊕. Similarly, the definition for the 2d case is: (cid:88) Oi = g(Ij, i, j) and we can extend it to non-square cases and for k > 3 accordingly. j We allow the output O to be the same array as the input array(s) I. This is used for all DP recurrences. In these algorithms, some of the cells are empty to avoid cyclic dependencies. For example, in a 2d grid, we may want to restrict 1 ≤ j < i. In these cases, a constant fraction of the grid cells are empty. We call such a grid an α-full grid for some constant 0 < α < 1 if at least an α ± o(1) fraction of the cells are non-empty. We will show that all properties we show for a k-d grid also work for the α-full case, since the constant α affects neither the lower bounds nor the algorithms. on a semiring (·, +) (i.e., Oi,j =(cid:80) case is when computing a matrix-vector multiplication Oi =(cid:80) We now show some examples that can be matched to k-d grids. Multiplying two matrices of size n-by-n k (I1)i,k(I2)k,j) exactly matches a 3d square grid. A corresponding 2d j Ij · f (i, j) where f (i, j) does not need to be stored. Such applications are commonly seen in dynamic programming algorithms. For example, the widely used LWS recurrence (Section 7.1) that computes Dj = min0≤i<j{Di + w(i, j)} is a 2d grid, and the associative operator ⊕ is min. In this case the input is the same array as the output. These are the simple cases, so even without using the k-d grid, the algorithms for them in the symmetric setting are already studied in [34, 46]. However, not all DP recurrences can be viewed as k-d grids straightforwardly. As shown above, the key aspect of deciding the dimension of a computation is the number of inputs that each basic cell g(·) requires. For example, when multiplying two dense tensors, although each tensor may have multiple dimensions, each multiplication operation is only based on two entries and can be written in the previous 3d form, so the computation is a 3d grid. Another example is the RNA recurrence that computes a 2D array {Dp,q + w(p, q, i, j)}. Assuming w(p, q, i, j) can be queried on-the-fly, the computation Di,j = is the simplest 2d grid. Despite that the DP table has size O(n2) and O(n4) updates in total, the computation is no harder than the simplest LWS recurrence mentioned in the previous paragraph. Similarly, in the GAP recurrence in Section 7.2, each element in the DP table is computed using many other elements similar to matrix multiplication. However, each update only requires the value of one input element and can be represented by a set of 2d grids, unlike matrix multiplication that is a 3d grid and uses the values of two input elements in each update. The exact correspondence between the k-d grid and the DP recurrences are usually more sophisticated than their classic applications in linear algebra problems, as shown in Section 7, 8 and appendices. The cache-oblivious algorithms discussed in this paper are based on k-d grids with k = 2 min 0≤p<i,0≤q<j 7 or 3, but we can also find applications with larger k (e.g., a Nim game with some certain rules on multiple piles [27]). We note that our definition of the k-d grid cannot abstract all possible recurrences and computations, but it is sufficient to analyze the DP recurrences and algorithms shown in Section 7, 8 and appendices. Also the k-d grid is designed to analyze computations with non-local dependencies [51], so it is not useful to problems such as the classic edit distance and matrix addition. 4 Lower Bounds We first discuss the lower bounds of the cache complexities for a k-d grid computation structure, which sets the target to design the algorithms in the following sections. In Section 4.1 we show the symmetric cache complexity. This is a direct extension of the classic result by Hong and Kong [56] to an arbitrary dimension. Then in Section 4.2 we discuss the asymmetric cache complexity when writes are more expensive than reads, which is more interesting and has a more involved analyses. (cid:18) Ω nk (cid:19) . 4.1 Symmetric Cache Complexity The symmetric cache complexity of a k-d grid is simple to analyze, yielding to the following result: Theorem 4.1 ([56]). The symmetric cache complexity of a k-d grid computation structure with size n is M 1/(k−1)B The following proof is an extension of the proof by Hong and Kong [56] and we show it here again for the completeness and to help to understand the proof in Section 4.2 which has a similar outline. Proof. In a k-d grid computation structure with size n there are nk cells. Let's sequentialize these cells in a list and consider each block of cells that considers S = 2kM k/(k−1) consecutive cells in the list. The number of input entries required of each block is the projection of all cells in this block along one of the first k − 1 dimensions (see Figure 1), and this is similar for the output. Loomis-Whitney inequality [68, 10] indicates that the overall number of input and output entries is minimized when the cells are in a square k-d cuboid, giving a total of kS(k−1)/k = k ·(cid:0)2M 1/(k−1)(cid:1)k−1 ≥ 4M input and output entries. Since only a total of M entries can be held in the cache at the beginning of the computation of this block, the number of cache-line transfer for the input/output during the computation for such a block is Ω(M/B). Since there are nk/S = Θ(nkM−k/(k−1)) such blocks, the cache complexity of the entire computation is Ω(M/B) · nk/S = Ω(nk/(M 1/(k−1)B)). Notice that the proof does not assume cache-obliviousness, but the lower bound is asymptotically tight by applying a sequential cache-oblivious algorithm that is based on 2k-way divide-and-conquer [46]. 4.2 Asymmetric Cache Complexity We now consider the asymmetric cache complexity of a k-d grid computation structure assuming writes are more expensive. Unfortunately, this case is significantly harder than the symmetric setting. Again for simplicity we first analyze the square grid of size n, which can be extended to the more general cases similar to [46]. Interestingly, there is no specific pattern that a cache-oblivious algorithm has to follow. Some existing algorithms use "buffers" to support cache-obliviousness (e.g., [7]), and many others use a recursive divide- and-conquer framework. For the recursive approaches, when the cache complexity of the computation is not 8 √ leaf-dominated (like various sorting algorithms [46, 16]), a larger fan-out in the recursion is more preferable (usually set to O( n)). Otherwise, when it is leaf-dominated, existing efficient algorithms all pick a constant fan-out in the recursion in order to reach the base case and fit in the cache with maximal possible subproblem size. All problems we discuss in this paper are in this category, so we make our analysis under the following constraints. More discussion about this constraint in given in Section 9. Definition 1 (CBCO paradigm). We say a divide-and-conquer algorithm is under the constant-branching cache-oblivious (CBCO) paradigm if it has an input-value independent computational DAG, such that each task has constant5 fan-outs of its recursive subtasks until the base cases, and the partition of each task is decided by the ratio of the ranges in all dimensions of the (sub)problem and independent of the cache parameters (M and B). Notice that ω is a parameter of the main memory, instead of a cache parameter, so the algorithms can be aware of it. One can define resource-obliviousness [37] so that the value of ω is not exposed to the algorithms, but this is out of the scope of this paper. We now prove the (sequential) lower bound on the asymmetric cache complexity of a k-d grid under the CBCO paradigm. The constant branching and the partition based on the ratio of the ranges in all dimensions restrict the computation pattern and lead to the "scale-free" property of the cache-oblivious algorithms: the structure or the "shape" of each subproblem in the recursive levels is similar, and only the size varies. The proof references this property when it is used. The CBCO paradigm also restricts the shape of the computation, which is a stronger assumption than the Loomis-Whitney inequality used in the previous proof. (cid:33) (cid:32) nkω1/k M 1/(k−1)B Theorem 4.2. The asymmetric cache complexity of k-d grid is Ω under the CBCO paradigm. Proof. We prove the lower bound using the same approach in Section 4.1 -- putting all operations (cells) executed by the algorithm in a list and analyzing blocks of S cells. The cache can hold M entries as temporary space for the computation. For the lower bound, we only consider the computation in each cell without considering the step of adding the calculated value back into the output array, which only makes the problem easier. Again when applying the computation of each cell, the k input and output entries have to be in the cache. For a block of cells with size S, the cache needs to hold the entries in I1,··· , Ik−1 and O corresponding to the cells in this block at least once during the computation. Similar to the symmetric setting discussed above, the number of entries is minimized when the sequence of operations are within a k-d cuboid of size S = a1 × a2 × ··· × ak where the projections on Ii and O are (k − 1)-d arrays with sizes a1 × ··· × ai−1 × ai+1 × ··· × ak and a1 × ··· × ak−1. Namely, the number of entries is at least S/B · 1/ai for the corresponding input or output array. Note that the input arrays are symmetric to each other regarding the access cost, but in the asymmetric setting storing the output entries is more expensive since they have to be written back to the asymmetric memory. As a result, the cache complexity is minimized when a1 = ··· = ak−1 = a, and let's denote ak = ar where r is the ratio between ak and other ai. Here we assume r ≥ 1 since reads are cheaper. Due to the scale-free property that M and n are arbitrary, r should be fixed (within a small constant range) for the entire recursion. Similar to the analysis for Theorem 4.1, for a block of size S, the read transfers required by the cache is , where nk/S is the number of such blocks, and max{ak−1r − M, 0}/B Ω lower bounds the number of reads per block because at most M entries can be stored in the cache from the · max{ak−1r − M, 0} SB (cid:18) nk (cid:19) 5It can exponentially depend on k since we assume k is a constant. 9 previous block. Similarly, the write cost is Ω . In total, the cost is: ·(cid:16) (cid:32) (cid:18) nk (cid:32) SB nk SB Q = Ω = Ω · max{ak−1 − M, 0} max{ak−1r − M, 0} + ω max{ak−1 − M, 0}(cid:17)(cid:19) SB max{S(k−1)/kr1/k − M, 0} + ω max (cid:41)(cid:33)(cid:33) S(k−1)/k r(k−1)/k − M, 0 (cid:18) ωnk (cid:19) (cid:40) The second step is due to S = Θ(akr). S2 = M k/(k−1)r. Therefore, The cost decreases as the increase of S, but it has two discontinuous points S1 = M k/(k−1)/r1/(k−1) and (cid:32) (cid:33)(cid:33) nk S1B (cid:32) (cid:32) (cid:18) nk (cid:33) nk S1/k 1 B M 1/kB Q = Ω = Ω = Ω (cid:32) nkω1/k M 1/(k−1)B ωS(k−1)/k r(k−1)/k 2 S(k−1)/k 1 (cid:17)(cid:33) nk S2B S(k−1)/k r1/k + (cid:16) r1/k + r1/k + 2 ω r1/k + (cid:16) (cid:17)(cid:19) (cid:1). In this case, the lower bound of the asymmetric cache (cid:0)r1/k + ω nk S1/k 2 B ω r r(k−1)/k r1/k + Setting r = ω(k−1)/k minimizes nk M 1/kB r complexity Q is Ω , and this leads to the theorem. 5 A Matching Upper Bound on Asymmetric Memory In the sequential and symmetric setting, the classic cache-oblivious divide-and-conquer algorithms to compute the k-d grid (e.g., 3D case shown in [46]) is optimal. In the asymmetric setting, the proof of Theorem 4.2 indicates that the classic algorithm is not optimal and off by a factor of ω(k−1)/k. This gap is captured by the balancing factor r in the proof, which leads to more cheap reads and less expensive writes in each sub-computation. We now show that the lower bound in Theorem 4.2 is tight by a (sequential) cache-oblivious algorithm with such asymmetric cache complexity. The algorithm is given in Algorithm 1, which can be viewed as a variant of the classic approach with minor modifications on how to partition the computation. Notice that in line 6 and 10, "conceptually" means the partitions are used for the ease of algorithm description. In practice, we can just pass the ranges of indices of the subtask in the recursion, instead of actually partitioning the arrays. Compared to the classic approaches (e.g., [46]) that partition the largest input dimension among ni, the only underlying difference in the new algorithm is in line 4 -- when partitioning the dimension not related to the output array O (line 6 -- 8), nk has to be ω(k−1)/k times larger than n1,··· , nk−1. This modification introduces an asymmetry between the input size and output size of each subtask, which leads to fewer writes in total and an improvement in the cache efficiency. For simplicity, we show the asymmetric cache complexity for square grids (i.e., n1 = ··· = nk) and n = Ω(ω(k−1)/kM ), and the general case can be analyzed similar to [46]. Theorem 5.1. Algorithm 1 computes the k-d grid of size n with asymmetric cache complexity Θ 10 (cid:32) (cid:33) . nkω1/k M 1/(k−1)B Algorithm 1: ASYM-ALG(I1,··· , Ik−1, O) Input: k − 1 input arrays I1,··· , Ik−1, read/write asymmetry ω Output: Output array O 1 The computation has size n1 × n2 × ··· × nk 2 if I1,··· , Ik−1, O are small enough then 3 4 i ← arg max1≤i≤k{nixi} where xk = ω−(k−1)/k and xj = 1 for 1 ≤ j < k 5 if i = k then 6 Solve the base case and return (Conceptually) equally partition I1,··· , Ik−1 into {I1,a, I1,b},··· ,{Ik−1,a, Ik−1,b} on k-th dimension ASYM-ALG(I1,a,··· , Ik−1,a, O) ASYM-ALG(I1,b,··· , Ik−1,b, O) (Conceptually) equally partition I1,··· , Ii−1, Ii+1,··· , Ik−1, O into {I1,a, I1,b},··· ,{Ik−1,a, Ik−1,b},{Oa, Ob} on i-th dimension ASYM-ALG(I1,a,··· , Ii−1,a, Ii, Ii+1,a,··· , Ik−1,a, Oa) ASYM-ALG(I1,b,··· , Ii−1,b, Ii, Ii+1,b,··· , Ik−1,b, Ob) 7 8 9 else 10 11 12 Proof. We separately analyze the numbers of reads and writes in Algorithm 1. In the sequential execution of Algorithm 1, each recursive function call only requires O(1) extra temporary space. Also, our analysis ignores rounding issues since they will not affect the asymptotic bounds. When starting from the square grid at the beginning, the algorithm first partitions in the first k − 1 dimensions (via line 10 to 12) into ω(k−1)2/k subproblems (referred to as second-phase subproblems) each with size (n/ω(k−1)/k) × ··· × (n/ω(k−1)/k) × n, and then partition k dimensions in turn until the base case is reached. The number of writes of the algorithm W (n) (to array O) follows the recurrences: W (cid:48)(n) = 2kW (cid:48)(n/2) + O(1) W (cid:48)(n/ω(k−1)/k) + O(1) where W (cid:48)(n) is the number of writes of the second-phase subproblems with the size of O being n × ··· × n. The base case is when W (cid:48)(M 1/(k−1)) = O(M/B). Solving the recurrences gives W (cid:48)(n/ω(k−1)/k) = (cid:18) nkω1−k (cid:19) O , and W (n) = O M 1/(k−1)B We can analyze the reads similarly by defining R(n) and R(cid:48)(n). The recurrences are therefore: and R(cid:48)(n) = 2kR(cid:48)(n/2) + O(1) R(cid:48)(n/ω(k−1)/k) + O(1) The difference from the write cost is in the base case since the input fits into the cache sooner when n = M 1/(k−1)/ω1/k. Namely, R(cid:48)(M 1/(k−1)/ω1/k) = O(M/B). By solving the recurrences, we have R(cid:48)(n/ω(k−1)/k) = O (cid:18) nkω2−k and R(n) = O nkω1/k (cid:33) . M 1/(k−1)B M 1/(k−1)B (cid:17) (cid:17) W (n) = (ω(k−1)/k)k−1 ·(cid:16) (cid:33) (cid:32) nkω(1−k)/k M 1/(k−1)B . R(n) = (ω(k−1)/k)k−1 ·(cid:16) (cid:32) (cid:19) 11 The overall (sequential) asymmetric cache complexity for Algorithm 1 is: (cid:33) Q(n) = R(n) + ωW (n) = O (cid:32) nkω1/k M 1/(k−1)B and combining with the lower bound of Theorem 4.2 proves the theorem. Comparing to the classic approach, the new algorithm improves the asymmetric cache complexity by a factor of O(ω(k−1)/k), since the classic algorithm requires Θ(nk/(M 1/(k−1)B)) reads and writes. Again here we assume nk−1 is much larger than M. Otherwise, the lower and upper bounds should include Θ(ωnk−1/B) for storing the output O on the memory. 6 Parallelism We now show the parallelism in computing the k-d grids. The parallel versions of the cache-oblivious algorithms only have polylogarithmic span, indicating that they are highly parallelized. 6.1 The Symmetric Case We first discuss how to parallelize the classic algorithm on symmetric memory. For a square grid, the algorithm partitions the k-dimensions in turn until the base case is reached. Notice that in every k consecutive partitions, there are no dependencies in k − 1 of them, so we can fully parallelize these levels with no additional cost. The only exception is during the partition in the k-th dimension, whereas both subtasks share the same output array O and cause write concurrence. If such two subtasks are sequentialized (like in [46]), the span is D(n) = 2D(n/2) + O(1) = O(n). We now introduce the algorithm with logarithmic depth. As just explained, to avoid the two subtasks from modifying the same elements in the output array O, our algorithm works as follows when partitioning the k-th dimension: 1. Allocating two stack-allocated temporary arrays with the same size of the output array O before the two recursive function calls. 2. Applying computation for the k-d grid in two subtasks using different output arrays that are just allocated (no concurrency to the other subtask). 3. When both subtasks finish, the computed values are merged (added) back in parallel, with work proportional to the output size and O(log n) span. 4. Deallocating the temporary arrays. Notice that the algorithm also works if we only allocate temporary space for one of the subtasks, while the other subtask still works on the original space for the output array. This can be a possible improvement in practice, but in high dimensional case (k > 2) it requires complicated details to pass the pointers of the output arrays to descendant nodes, aligning arrays to cache lines, etc. Theoretically, this version does not change the bounds except for the stack space in Lemma 6.1 when k = 2. We first analyze the cost of square grids of size n in the symmetric setting, and will discuss the asymmetric setting later. Lemma 6.1. The overall stack space for a subtask of size n is O(nk−1). 12 Proof. The parallel algorithm allocates memory only when partitioning the output (k-th) dimension. In this case, it allocates and computes two subtasks of size n/2 where n is the size of the output dimension. This leads to the following recurrence: S(n) = 2S(n/2) + O(nk−1) The recurrence solves to S(n) = O(nk−1) when k > 2 since the recurrence is root-dominated. When k = 2, we can apply the version that only allocates temporary space for one subtask, which decreases the constant before S(n/2) to 1, and yields S(n) = O(n). Note that we only need to analyze one of the branches, since the temporary spaces that are not allocated in the direct ancestor of this subtask have already been deallocated, and will be reused for later computations for the current branch. With the lemma, we have the following corollary: Corollary 6.2. A subtask of size n ≤ M 1/(k−1) can be computed within a cache of size O(M ). This corollary indicates that this modified parallel algorithm has the same sequential cache complexity since it fits into the cache in the same level as the classic algorithm (the only minor difference is the required cache size increases by a small constant factor). Therefore we can apply the a similar analysis in [46] (k = 3 in the paper) to show the following lemma: Lemma 6.3. The sequential symmetric cache complexity of the parallel cache-oblivious algorithm to compute a k-d grid of size n is O(nk/M 1/(k−1)B). Assuming that we can allocate a chunk of memory in constant time, the span of this approach is simply O(log2 n) -- O(log n) levels of recursion, each with O(log n) span for the additions [20]. We have shown the parallel span and symmetric cache complexity. By applying the scheduling theorem in Section 2, we have the following result for parallel symmetric cache complexity. Corollary 6.4. The k-d grid of size n can be computed with the parallel symmetric cache complexity of O(nk/M 1/(k−1)B + pM log2 n) with private caches, or O(nk/M 1/(k−1)B) with a share cache of size M + pB log2 n. We now analyze the overall space requirement for this algorithm. Lemma 6.1 shows that the extra space required is S1 = O(nk−1) for sequentially running the parallel algorithm. Naıvely the parallel space requirement is pS1, which can be very large. We now show a better upper bound for the extra space. Lemma 6.5. The overall space requirement of the parallel algorithm to compute the k-d grid is O(p1/knk−1). Proof. We analyze the total space allocated for all processors. Lemma 6.1 indicates that if the root of the computation on one processor has the output array of size (n(cid:48))k−1, then the space requirement for this task is O((n(cid:48))k−1). There are in total p processors. There can be at most 2k processors starting with their computations of size nk−1/2k−1, (2k)2 of size nk−1/(2k−1)2, until (2k)q processors of size nk−1/(2k−1)q where q = log2k p. This case maximizes the overall space requirement for p processors, which is: log2k p(cid:88) (cid:18) nk−1 (cid:19) (cid:18) (cid:19) O (2k−1)h · (2k)h = p · O nk−1 (2k−1)log2k p = O(p1/knk−1) h=1 This shows the stated bound. Combining all results gives the following theorem: 13 (cid:18) (cid:19) Theorem 6.6. There exists a cache-oblivious algorithm to compute a k-d grid of size n that requires Θ(nk) symmetric cache complexity, O(log2 n) span, and O(p1/knk−1) main memory size. work, Θ nk M 1/(k−1)B Additional space required. The following discussion is purely on the practical side and does not affect the theoretical analysis of all the theorems in this paper. We believe the space requirement for the parallel cache-oblivious algorithm is acceptable since it is asymptotically the same as the most intuitively (non-cache-oblivious) parallel algorithm that partitions the computation into p square subtasks each with size n/p1/k. In practice nowadays it is easy to fit several terabyte main memory onto a single powerful machine such that the space requirement can usually be satisfied. For example, a Dell PowerEdge R940 has about p = 100 and the main memory can hold more than 1012 integers, while the new NVRAMs will have even more capacity (up to 512GB per DIMM). On such machines, when k = 2, the grid needs to contain more than 1022 cells to exceed the memory size -- such computation takes too long to run on a single shared-memory machine. For k = 3, we need about 1017 cells to exceed the main memory size, which will take weeks to execute on a highest-end shared-memory machine. Hence, throughout the paper we focus on cache complexity and span. Even if one wants to run such a computation, we can use the following approach to slightly change the algorithm to bound the extra space as a practical fix. We can first partition the input dimensions for log2 p rounds to bound the largest possible output size to be O(nk−1/p) (similar to the case discussed in Section 6.2). Then the overall extra space for all p processors is limited to O(nk−1), the same as the input/output size. If needed, the constant in the big-O can also be bounded. Such a change will not affect the cache complexity and the span as long as the main memory size is larger than pM where M is the cache size. This is because the changes of partition order do not affect the recurrence depth, and the I/O cost is still dominated by when the subproblems fitting the cache. In practice, DRAM size is always several orders of magnitude larger than pM. 6.2 The Asymmetric Case Algorithm 1 considers the write-read asymmetry, which involves some minor changes to the classic cache- oblivious algorithm. Regarding parallelism, the changes in Algorithm 1 only affect the order of the partitioning of the k-d grid in the recurrence, but not the parallel version and the analysis in Section 6.1. As a result, the span of the parallel variant of Algorithm 1 is also O(log2 n). The extra space upper bound is actually reduced, because the asymmetric algorithm has a higher priority in partitioning the input dimensions that does not requires allocation temporary space. Lemma 6.7. The space requirement of Algorithm 1 on p processors is O(nk−1(1 + p1/k/ω(k−1)/k)). Proof. Algorithm 1 first partition the input dimensions until q = O(ω(k−1)2/k) subtasks are generated. Then the algorithm will partition k dimensions in turn. If p < q, then each processor requires no more than O(nk−1/q) extra space at any time, so the overall extra space is O(p · nk−1/q) = O(n). Otherwise, the worst case appears when O(p/q) processors work on each of the subtasks. Based on Lemma 6.5, the extra space is bounded by O((p/q)1/k · q · nk−1/q) = O(p1/knk−1/ω(k−1)/k). Combining the two cases gives the stated bounds. Lemma 6.7 indicates that Algorithm 1 requires extra space no more than the input/output size asymptoti- cally when p = O(ωk−1), which should always be true in practice. The challenge arises in scheduling this computation. The scheduling theorem for the asymmetric case [13] constraints on the non-leaf stack memory to be a constant size. This contradicts the parallel version in Section 6.1. This problem can be fixed based on Lemma 6.1 that upper bounds the overall extra memory on one task. Therefore the stack-allocated array can be moved to the heap space. Once a task is stolen, the 14 first allocation will annotate a chunk of memory with size order of O where O is the current output. Then all successive heap-based memory allocation can be simulated on this chunk of memory. In this manner, the stack memory of each node corresponding to a function call is constant, which allows us to apply the scheduling theorem in [13]. (cid:32) (cid:33) Theorem 6.8. Algorithm 1 with input size n requires Θ(nk) work, Θ complexity, and O(log2 n) span to compute a k-d grid of size n. 7 Dynamic Programming Recurrences nkω1/k M 1/(k−1)B asymmetric cache In this section we discuss a number of new results on dynamic programming (DP). To show lower and upper bounds on parallelism and cache efficiency in either symmetric and asymmetric setting, we focus on the specific DP recurrences instead of the problems. We assume each update in the recurrences takes unit cost, just like the k-d grid in Section 3. The goal of this section is to show how the DP recurrences can be viewed as and decomposed into the k-d grids. Then the lower and upper bounds discussed in Section 4 and 5, as well as the analysis of parallelism in Section 6, can be easily applied to the computation of these DP recurrences. When the dimension of the input/output is the same as the number of entries in each grid cell, then the sequential and symmetric versions of the algorithms in this section are the same as the existing ones discussed in [46, 34, 36, 31, 77], but the others are new. Also, the asymmetric versions and most parallel versions are new. We improve the existing results on symmetric/asymmetric cache complexity, as well as parallel span. Symmetric cache complexity. We show improved algorithms for a number of problems when the number of entries per cell differs from the dimension of input/output arrays. Such algorithms are for the GAP recurrence, protein accordion folding, and the RNA recurrence. We show that the previous cache bound O(n3/B M ) for the GAP recurrence and protein accordion folding is not optimal, and we improve the bounds in Theorem 7.2 and 7.3. For the RNA recurrence, we show an optimal cache complexity of Θ(n4/BM ) in Theorem 7.2, which improves the best existing result by O(M 3/4). Asymmetric cache complexity. By applying the asymmetric version for the k-d grid computation discussed in Section 5, we show a uniform approach to provide write-efficient algorithms for all DP recurrences in this section. We also shown the optimality of all these algorithms regarding asymmetric cache complexity, expect for the one for the GAP recurrence. Parallelism. The parallelism of these algorithms is provided by the parallel algorithms discussed in Section 6. Polylogarithmic span can be achieved in computing the 2-knapsack recurrence, and linear span in LWS recurrence and protein accordion folding. The linear span for LWS can be achieved by previous work [75, 41], but they are not race-free and in the nested-parallel model. Meanwhile, our algorithms are arguably simpler. √ 7.1 LWS Recurrence We start with the simple example of the LWS recurrence where optimal sequential upper bound in the symmetric setting is known [34]. We show new results for lower bounds, write-efficient cache-oblivious algorithms, and new span bound. in practice. Given a real-valued function w(i, j) for integers 0 ≤ i < j ≤ n and D0, for 1 ≤ j ≤ n, The LWS (least-weighted subsequence) recurrence [55] is one of the most commonly-used DP recurrences Dj = min 0≤i<j {Di + w(i, j)} 15 This recurrence is widely used as a textbook algorithm to compute optimal 1D clustering [63], line break- ing [64], longest increasing sequence, minimum height B-tree, and many other practical algorithms in molecular biology and geology [50, 51], computational geometry problems [3], and more applications in [66]. Here we assume that w(i, j) can be computed in constant work based on a constant size of input associated to i and j, which is true for all these applications. Although different special properties of the weight function w can lead to specific optimizations, the study of recurrence itself is interesting, especially regarding cache efficiency and parallelism. We note that the computation of this recurrence is a standard 2d grid. Each cell g(Di, i, j) = Di + w(i, j) and updates Dj as the output entry, so Theorem 4.1 and 4.2 show lower bounds on cache complexity on this recurrence (the grid is (1/2)-full). We now introduce cache-oblivious implementation considering the data dependencies. Chowdhury and Ramachandran [34] solves the recurrence with O(n2) work and O(n2/BM ) symmetric cache complexity. The algorithm is simply a divide-and-conquer approach and we describe and extend it based on k-d grids. A task of range (p, q) computes the cells (i, j) such that p ≤ i < j ≤ q. To compute it, the algorithm generates two equal-size subtasks (p, r) and (r + 1, q) where r = (p + q)/2, solves the first subtask (p, r) recursively, then computes the cells corresponding to w(i, j) for p ≤ i ≤ r < j ≤ q, and lastly solves the subtask (r + 1, q) recursively. Note that the middle step also matches a 2d grid with no dependencies between the cells, which can be directly solved using the algorithms in Section 5. This leads to the cache complexity and span to be: Q(n) = 2Q(n/2) + Q2C(n/2) D(n) = 2D(n/2) + D2C(n/2) Here 2C denotes the computation of a 2d grid. The recurrence is root-dominated with base cases Q(M ) = Θ(M/B) and D(1) = 1. This solves to the following theorem. (cid:18) n2 (cid:19) BM (cid:32) (cid:33) ω1/2n2 BM optimal Theorem 7.1. The LWS recurrence can be computed in Θ(n2) work, Θ and Θ symmetric and asymmetric cache complexity respectively, and O(n) span. 7.2 GAP Recurrence We now consider the GAP recurrence that the analysis of the lower bounds and the new algorithm make use of multiple grid computation. The GAP problem [49, 51] is a generalization of the edit distance problem that has many applications in molecular biology, geology, and speech recognition. Given a source string X and a target string Y , other than changing one character in the string, we can apply a sequence of consecutive deletes that corresponds to a gap in X, and a sequence of consecutive inserts that corresponds to a gap in Y . For simplicity here we assume both strings have length n, but the algorithms and analyses can easily be adapted to the more general case. Since the cost of such a gap is not necessarily equal to the sum of the costs of each individual deletion (or insertion) in that gap, we define w(p, q) (0 ≤ p < q ≤ n) as the cost of deleting the substring of X from (p + 1)-th to q-th character, w(cid:48)(p, q) for inserting the substring of Y accordingly, and r(i, j) as the cost to change the i-th character in X to j-th character in Y . Let Di,j be the minimum cost for such transformation from the prefix of X with i characters to the prefix of Y with j characters, the recurrence for i, j > 0 is: min0≤q<j{Di,q + w(cid:48)(q, j)} min0≤p<i{Dp,j + w(p, i)} Di−1,j−1 + r(i, j) Di,j = min corresponding to either replacing a character, inserting or deleting a substring. The boundary is set to be D0,0 = 0, D0,j = w(0, j) and Di,0 = w(cid:48)(0, i). The diagonal dependency from Di−1,j−1 will not affect the 16 Figure 2: The new cache-oblivious algorithm for GAP recurrences (n is the input size). The algorithm has five steps. Step (a) first recursively solves the D00 quadrant, then Step (b) apply n/2 inter-quadrant column updates and n/2 row updates, each corresponding to a 2d grid. After that, Step (c) recursively solves D01 and D10, Step (d) applies another n inter-quadrant updates, and finally Step (e) recursively solves D11. More details about maintaining cache-efficiency is described in Section 7.2 in details. asymptotic analysis since it will at most double the memory footprint, so it will not show up in the following √ analysis. The best existing algorithms on GAP Recurrence [34, 74] have symmetric cache complexity of O(n3/B M ). This upper bound seems to be reasonable, since in order to compute Di,j, we need the input of two vectors Di,q and Dp,j, which is similar to matrix multiplication and other algorithms in Section 8. However, as indicated in Section 3, each update in GAP only requires one entry, while matrix multiplication has two. Therefore, if we ignore the data dependencies, the first line of the GAP recurrence can be viewed as n LWS recurrences, independent of the dimension of i (similarly for the second line). This derives a lower bound on cache complexity to be that of an LWS recurrence multiplied by 2n, which is Ω(n3/BM ) (assuming n > M). Hence, the gap between the lower and upper bounds is Θ( M ). √ We now discuss an I/O-efficient algorithm to close this gap. This algorithm is not optimal, but reduce it to 1 + o(1). How to remove the low-order term remains as an open problem. The new algorithm is similar to Chowdhury and Ramachandran's approach [34] based on divide-and-conquer to compute the output D. The algorithm recursively partitions D into four equal-size quadrants D00, D01, D10 and D11, and starts to compute D00 recursively. After this is done, it uses the computed value in D00 to update D01 and D10. Then the algorithm computes D01 and D10 within their own ranges, updates D11 using the results from D01 and D10, and solves D11 recursively at the end. The high-level idea is shown in Figure 2. We note that in Steps (b) and (d), the inter-quadrant updates compute 2 × (n(cid:48)/2) LWS recurrences (with no data dependencies) each with size n(cid:48)/2 (assuming D has size n(cid:48) × n(cid:48)). Therefore, our new algorithm reorganizes the data layout and the order of computation to take advantage of our I/O-efficient and parallel algorithm on 2d grids. Since the GAP recurrence has two independent sections one in a column and the other in a row, we keep two copies of D, one organized in column major and the other in row major. Then when computing on the inter-quadrant updates as shown in Steps (b) and (d), we start 2 × (n(cid:48)/2) parallel tasks each with size n(cid:48)/2 and compute a 2d grid on the corresponding row or column, taking the input and output with the correct representation. These updates require work and cache complexity shown in Theorem 7.1. We also need to keep the consistency of the two copies. After the update of a quadrant D01 or D10 is finished, we apply a matrix transpose [20] to update the other copy of this quadrant by taking a min as the associative operator ⊕, so that the two copies of D are consistent before Steps (c) and (e). The cost of the transpose is a lower-order term. For the quadrant D11, we wait until the two updates from D01 and D10 finish, and then apply the matrix transpose to update the values in each other. It is easy to check that by induction, the values in both copies in a quadrant are update-to-date at the beginning of each recursion in Step (c) and (e). 17 𝐷00𝐷01𝐷10𝐷11𝐷00𝐷01𝐷10𝐷11𝐷00𝐷01𝐷10𝐷11Recursively solve 𝐷00Recursively solve 𝐷01, 𝐷10Recursively solve 𝐷11(a)(b)(c)(d)(e) Our new algorithm still requires Θ(n3) work since it does not require extra asymptotic work. The cache complexity and span satisfy: Q(n) = 4Q(n/2) + 4(n/2) · Q2C(n/2) D(n) = 3D(n/2) + 2D2C(n/2) √ √ The coefficients are easily shown by Figure 2. We first discuss the symmetric setting. The base cases M ) = O(M/B) and Q2C(m) = O(m/B) for m ≤ M. This is a "balanced" recurrence with are Q( O(M/B) I/O cost per level for log2 M ). The top- level computation is root dominated since the overall number of cells in a level decreases by a half after every recursion. Therefore, if n > M, Q(n) = O(n2Q(M )/M )+O(n)·Q2C(n) = O(n2/B·(n/M +log2 M )), which is the base-case cost plus the top-level cost. Otherwise, all input/output for each 2d grid in the inter- √ quadrant update fit in the cache, so we just need to pay O(n2/B) I/O cost for log2(n/ M ) rounds of recursion, leading to Q(n) = O(n2 log2(n/ M )/B). Similarly we can show the asymmetric results by plugging in different base cases. M levels. This indicates Q(M ) = O((M/B) log2 √ √ √ Theorem 7.2. The GAP recurrence can be computed in Θ(n3) work, O(nlog2 3) span, symmetric cache complexity of (cid:18) n M · (cid:18) n2 (cid:32) O (cid:32) , (cid:26) n√ (cid:26) n√ M √ M (cid:27)(cid:19)(cid:19) (cid:27)(cid:33)(cid:33) B and asymmetric cache complexity of + log2 min O · n2 B ω1/2n M + ω log2 min √ , M M √ √ √ M ).) M / log(n/ M ) (i.e., n approaching infinity). For smaller range of n that O( Compared to the previous results [34, 36, 31, 60, 77, 74], the improvement on the symmetric cache M ) ≤ M )). (The computation fully fit into the cache when √ complexity is asymptotically O( n ≤ O(M ), the improvement is O(n/ √ n < O( Protein accordion folding. The recurrence for protein accordion folding [77] is Di,j = max1≤k<j−1{Dj−1,k+ w(i, j, k)} for 1 ≤ j < i ≤ n, with O(n2/B) cost to precompute w(i, j, k). Although there are some minor differences, from the perspective of the computation structure, the recurrence can basically be viewed as only containing the first section of the GAP recurrence. As a result, the same lower bounds of GAP can also apply to this recurrence. In terms of the algorithm, we can compute n 2d grids with the increasing order of j from 1 to n, such that the input are Dj−1,k for 1 ≤ k < j − 1 and the output are Di,j for j < i ≤ n. For short, we refer to a 2d grid as a task. However, the input and output arrays are in different dimensions. To handle it, we use a imilar method to the GAP algorithm that keeps two separate copies for D, one in column-major and one in row-major. They are used separately to provide the input and output for the 2d grid. We apply the transpose in a divide-and-conquer manner -- once the first half of the tasks finish, we transpose all computed values from the output matrix to the input matrix (which is a square matrix), and then compute the second half of the task. Both matrix transposes in the first and second halves are applied recursively with geometrically decreasing sizes. The correctness of this algorithm can be verified by checking the data dependencies so that all required values are computed and moved to the correct positions before they are used for further computations. The cache complexity is from two subroutines: the computations of 2d grids and matrix transpose. The cost of 2d grids is simply upper bounded by n times the cost of each task, which is O(n2/B · (1 + n/M )) 18 and O(n2/B · (ω + ω1/2n/M )) for symmetric and asymmetric cache complexity, and O(n log2 n) span. For matrix transpose, the cost can be verified in the following recursions. Q(n) = 2Q(n/2) + QTr(n/2) √ where Tr indicates the matrix transpose. The base case is Q( bound for matrix transpose [20] provides the following theorem. Theorem 7.3. Protein accordion folding can be computed in O(n3) work, symmetric and asymmetric cache M ) = O(M/B) and D(1) = 1. Applying the D(n) = 2D(n/2) + DTr(n/2) (cid:17)(cid:19) (cid:32) (cid:32) (cid:33)(cid:33) (cid:18) n2 (cid:16) B complexity of Θ 1 + n M and Θ n2 B ω + ω1/2n M respectively, and O(n log2 n) span. The cache bounds in both symmetric and asymmetric cases are optimal with respect to the recurrence. 7.3 RNA Recurrence The RNA problem [51] is a generalization of the GAP problem. In this problem a weight function w(p, q, i, j) is given, which is the cost to delete the substring of X from (p + 1)-th to i-th character and insert the substring of Y from (q + 1)-th to j-th character. Similar to GAP, let Di,j be the minimum cost for such transformation from the prefix of X with i characters to the prefix of Y with j characters, the recurrence for i, j > 0 is: {Dp,q + w(p, q, i, j)} Di,j = min 0≤p<i 0≤q<j with the boundary values D0,0, D0,j and Di,0. This recurrence is widely used in computational biology, like to compute the secondary structure of RNA [81]. While the cache complexity of this recurrence seems to be hard to analyze in previous papers, it fits into the framework of this paper straightforwardly. Since each computation in the recurrence only requires one input value, the whole recurrence can be viewed as a 2d grid, with both the input and output as D. The 2d grid is (1/4)-full, so we can apply the lower bounds in Section 5 here. Again for a matching upper bound, we need to consider the data dependencies. We can apply the similar technique as in the GAP algorithm to partition the output D into four quadrants, compute D00, then D01 and D10, and finally D11. Each inter-quadrant update corresponds to a 1/2-full 2d grid. Here maintaining two copies of the array is not necessary with the tall-cache assumption M = Ω(B2). Applying the similar analysis in GAP gives the following result: Theorem 7.4. The RNA recurrence can be computed in Θ(n4) work, optimal symmetric and asymmetric cache complexity of Θ and Θ respectively, and O(nlog2 3) span. (cid:18) n4 (cid:19) BM (cid:33) (cid:32) ω1/2n4 BM 7.4 Parenthesis Recurrence The Parenthesis recurrence solves the following problem: given a linear sequence of objects, an associative binary operation on those objects, and the cost of performing that operation on any two given (consecutive) objects (as well as all partial results), the goal is to compute the min-cost way to group the objects by applying the operations over the sequence. Let Di,j be the minimum cost to merge the objects indexed from i + 1 to j (1-based), the recurrence for 0 ≤ i < j ≤ n is: Di,j = min i<k<j {Di,k + Dk,j + w(i, k, j)} 19 where w(i, k, j) is the cost to merge the two partial results of objects indexed from i + 1 to k and those from k + 1 to j. Here the cost function is only decided by a constant-size input associated to indices i, j and k. Di,i+1 is initialized, usually as 0. The applications of this recurrence include the matrix chain product, construction of optimal binary search trees, triangulation of polygons, and many others shown in [38, 50, 51, 84]. The computation of this recurrence (without considering dependencies) is a (1/3)-full 3d grid, which has the same lower bound shown in Corollary 8.1. The divide-and-conquer algorithm that computes this recurrence is usually hard to describe (e.g., it takes several pages in [31, 60] although they also describe their systems simultaneously). We claim that under the view of our k-d grids, this algorithm is conceptually as simple as the other algorithms. Again this divide-and-conquer algorithm partitions the state D into quadrants, but at this time one of them (D10) is empty since Di,j does not make sense when i > j. The quadrant D01 depends on the other two. The algorithm first recursively computes D00 and D11, then updates D01 using the computed values in D00 and D11, and finally recursively computes D01. Here D01 is square, so the recursive computation of D01 is almost identical to that in RNA or GAP recurrence (although the labeling of the quadrants is slightly changed): breaking a subtask into four quadrants, recursively solving each of them in the correct order while applying inter-quadrant updates in the middle. The only difference is when the inter-quadrant updates are processed, each update requires two values, one in D01 and another in D00 or D11. This is the reason that Parenthesis is 3d while RNA and GAP are 2d. The correctness of this algorithm can be shown inductively. Theorem 7.5. The Parenthesis recurrence can be computed in Θ(n3) work, optimal symmetric and asymmet- ric cache complexity of Θ and Θ respectively, and O(nlog2 3) span. (cid:19) (cid:18) n3 √ B M (cid:33) (cid:32) √ ω1/3n3 B M 2-Knapsack Recurrence 7.5 Given Ai and Bi for 0 ≤ i ≤ n, the 2-knapsack recurrence computes: Di = min 0≤j≤i {Aj + Bi−j + w(j, i − j, i)} for 0 ≤ i ≤ n. The cost function w(j, i − j, i) relies on constant input values related on indices i, i − j and j. To the best of our knowledge, this recurrence is first discussed in this paper. We name is the "2-knapsack recurrence" since it can be interpreted as the process of finding the optimal strategy in merging two knapsacks, given the optimal local arrangement of each knapsack stored in A and B. Although this recurrence seems trivial, the computation structure of this recurrence actually forms some more complicated DP recurrence. For example, many problems on trees6 can be solved using dynamic programming, such that the computation essentially applies the 2-knapsack recurrence a hierarchical (bottom-up) manner. We start by analyzing the lower bound on cache complexity of the 2-knapsack recurrence. The computa- tional grid has two dimensions, corresponding to i and j in the recurrence. If we ignore B in the recurrence, then the recurrence is identical to LWS (with no data dependencies), so we can apply the lower bounds in Section 7.1 here. Note that each update requires two input values Aj and Bi−j, but they are not independent. When computing a subtask that corresponding to (i, j) ∈ [i0, i0 + ni] × [j0, j0 + nj], the projection sizes on input and output arrays A, B and D are no more than nj, ni + nj and ni. This indicates that the computation of this recurrence is a variant of 2d grid, so we can use the same algorithm discussed in Section 5. 6Such problems can be: (1) computing a size-k independent vertex set on a tree that maximizes overall neighbor size, total vertex weights, etc.; (2) tree properties such that the number of subtrees of certain size, tree edit-distance, etc.; (3) many approximation algorithms on tree embeddings of an arbitrary metric [22, 24]; and many more. 20 Corollary 7.6. 2-knapsack recurrence can be computed using O(n2) work, optimal symmetric and asymmet- ric cache complexity of Θ and Θ , and O(log2 n) span. (cid:18) n2 (cid:19) BM (cid:33) (cid:32) ω1/2n2 BM 8 Matrix Multiplication and All-Pair Shortest Paths In this section we discuss matrix multiplication, Kleene's algorithm on all pair shortest-paths, and some linear algebra algorithms including Strassen algorithm, Gaussian elimination (LU decomposition), and triangular system solver. The common theme in these algorithms is that their computation structures are very similar to that of matrix multiplication, which is a 3d grid. Strassen algorithm is slightly different and introduced separately in Appendix A. Other algorithms are summarized in Section 8.2 and the details are given in Appendix B -- D. We show improved asymmetric cache complexity for all problems. For Gaussian elimination and triangular system solver, we show linear-depth race-free algorithms in both symmetric and asymmetric settings which are based on the parallel algorithm discussed in Section 6. There exist work-optimal and sublinear depth algorithm for APSP [76], but we are unaware of how to make it I/O-efficient. Compared to previous linear-span algorithms [75, 41], our new algorithms are race-free and in the nested-parallel model. 8.1 Matrix Multiplication The combinatorial matrix multiplication (definition in Section 2) is one of the simplest cases of the 3d grid. Given a semiring (×, +), in matrix multiplication each cell corresponds to a "×" operation of the two corresponding input values and the "+" operation is associative. Since there are no dependencies between the operations, we can simply apply Theorem 6.6 and 6.8 to get the following result. Corollary 8.1. Combinatorial matrix multiplication of size n can be solved in Θ(n3) work, optimal symmetric and asymmetric cache complexity of Θ and Θ respectively, and O(log2 n) span. (cid:19) (cid:18) n3 √ B M (cid:33) (cid:32) √ ω1/3n3 M B The result for the symmetric case is well-known, but that for the asymmetric case is new. 8.2 All-Pair Shortest Paths, Gaussian Elimination, and Triangular System Solver We now discuss the well-known cache-oblivious algorithms to solve all-pair shortest paths (APSP) on a graph, Gaussian elimination (LU decomposition), and triangular system solver. These algorithms share similar computation structures and can usually be discussed together. Chowdhury and Ramachandran [34, 36] categorized matrix multiplication, APSP, and Gaussian Elimination into the Gaussian Elimination Paradigm (GEP) and discussed a unified framework to analyze complexity, parallelism and actual performance. We show how the parallel depth and the asymmetric cache complexity can be improved using the algorithms we just introduced in Section 5 and 6. We discuss the details of these cache-oblivious algorithms in the appendix. The common theme in these algorithms is that, the computation takes one or two square matrix(ces) of size n × n as input, applies n3 operations, and generates output as a square matrix of size n × n. Each output entry is computed by an inner product of one column and one row of either the input matrices or the output matrix in some intermediate state. Namely, the output Ai,j requires input Bi,k and Ck,j for 1 ≤ k ≤ n (A, B and C may or may not be the same matrix). Therefore, we can apply the results of 3d grids on these problems.7 Note that some of 7For Gaussian Elimination Ak,k is also required, but Ak,k is only on the diagonal, which requires a lower-order of cache complexity to load when computing a sub-cubic of a 3d grid. 21 Algorithm 2: KLEENE(A) Input: Distance matrix A initialized based on the input graph G = (V, E) Output: Computed Distance matrix A 1 A00 ← KLEENE(A00) 2 A01 ← A01 + A00A01 3 A10 ← A10 + A10A00 4 A11 ← A11 + A10A01 5 A11 ← KLEENE(A11) 6 A01 ← A01 + A01A11 7 A10 ← A10 + A11A10 8 A00 ← A00 + A10A01 9 return A the grids are full (e.g., Kleene's algorithm) while others are not, but they are all α-full and contain O(n3) operations. The data dependencies in these algorithms are quite different from each other, but the recursions for cache complexity Q(n) and depth D(n) for APSP, Gaussian elimination and triangular system solver are all in the following form: Q(n) = β Q(n/2) + γ Q3C(n/2) D(n) = 2 D(n/2) + δ D3C(n/2) where Q3C(n) and D3C(n) are the cache complexity and depth of a 3d grid of size n. Here, as long as the the recursive subtask fits into the cache together with the 3d grid computation and the β, γ and δ are constants and satisfy β < 8, we can show the following bounds. Theorem 8.2. Kleene's algorithm for APSP, Gaussian elimination and triangular system solver of size n can (cid:32) (cid:33) (cid:19) (cid:18) n3 √ B M and O √ ω1/3n3 M B be computed in Θ(n3) work, symmetric and asymmetric cache complexity of O respectively, and O(n) depth. We now discuss the cache-oblivious algorithms to solve all-pair shortest paths (APSP) on a graph with improved asymmetric cache complexity and linear span. Regarding the span, Chowdhury and Ra- machandran [36] showed an algorithm using O(n log2 n) span. There exist work-optimal and sublinear span algorithm for APSP [76], but we are unaware of how to make it I/O-efficient while maintaining the same span. Compared to previous linear span algorithms in [41], our algorithm is race-free and in the classic nested-parallel model. Also, we believe our algorithms are simpler. The improvement is from plugging in the algorithms introduced in Section 5 and 6 to Kleene's Algorithm. An all-pair shortest-paths (APSP) problem takes a (usually directed) graph G = (V, E) (with no negative cycles) as input. Here we discuss the Kleene's algorithm (first mentioned in [62, 71, 44, 48], discussed in full details in [6]). Kleene's algorithm has the same computational DAG as Floyd-Washall algorithm [45, 80], but it is described in a divide-and-conquer approach, which is already I/O-efficient, cache-oblivious and highly parallelized. The pseudocode of Kleene's algorithm is provided in Algorithm 3. The matrix A is partitioned into . The matrix multiplication is defined in a closed semi-ring with 4 submatrices indexed as (cid:20)A00 A01 (cid:21) A10 A11 22 (+, min). Kleene's algorithm is a divide-and-conquer algorithm to compute APSP. Its high-level idea is to first compute the APSP between the first half of the vertices only using the paths between these vertices. Then by applying some matrix multiplication we update the shortest-paths between the second half of the vertices using the computed distances from the first half. We then apply another recursive subtask on the second half vertices. The computed distances are finalized, and we use them to again update the shortest-paths from the first-half vertices. The cache complexity Q(n) and span D(n) of this algorithm follow the recursions: Q(n) = 2Q(n/2) + 6QMM(n/2) D(n) = 2D(n/2) + 2DMM(n/2) where QMM(n) is the I/O cost of a matrix multiplication of input size n. The recursion of Q(n) is root- dominated, which indicates that computing all-pair shortest paths of a graph has the same upper bound on cache complexity as matrix multiplication. Theorem 8.3. Kleene's Algorithm to compute all-pair shortest paths of a graph of size n uses Θ(n3) work, has symmetric and asymmetric cache complexity of Θ span. nk M 1/(k−1)B and Θ nkω1/k M 1/(k−1)B (cid:18) (cid:19) (cid:32) (cid:33) , and O(n) Similar to some other problems in this paper, the symmetric cache complexity is well-known, but the results in the asymmetric setting as well as the parallel approach are new. 9 Conclusions and Future Work In this paper, we shown improved cache-oblivious algorithm of many DP recurrences and in linear algebra, in the symmetric and asymmetric settings, both sequentially and in parallel. Our key approach is to show the correspondence between the recurrences and algorithms and the k-d grid, and new results for computing the k-d grid. We believe that this abstraction provides a simpler and intuitive framework on better understanding these algorithms, proving lower bounds, and designing algorithms that are both I/O-efficient and highly parallelized. It also provides a unified framework to bound the asymmetric cache complexity of these algorithms. Based on the new perspective, we provide many new results, but we also observe many new open problems. Among them are: 1. The only non-optimal algorithm regarding cache complexity in this paper is for the GAP recurrence. The I/O cost has an additional low-order term of O((n2 log M )/B). Although in practice this term will not dominate the running time (the computation has O(n3) arithmetic operations), it is theoretically interesting to know if we can remove this term (even without the constraints of being cache-oblivious or based on divide-and-conquer). 2. We show our algorithms in the asymmetric setting are optimal under the assumption of constant- branching (the CBCO paradigm). Since the cache-oblivious algorithms discussed in this paper are leaf-dominate, we believe this assumption is always true. We wonder if this assumption is necessary (i.e., if there exists a proof without using it, or if there are cache-oblivious algorithms on these problems with non-constant branching but still I/O-optimal). 3. The parallel symmetric cache complexity Qp on p processors is Q1 + O(pDM/B), which is a loose upper bound when D is large. Although it might be hard to improve this bound on any general 23 computation under randomized work-stealing, it can be a good direction to show tighter bounds on more regular computation structures like the k-d grids or other divide-and-conquer algorithms. We conjecture that the additive term can be shown to be optimal (i.e., O(pM/B)) for the k-d grid computation structures. 4. Due to the page limit, in this paper we mainly discussed the lower bounds and algorithms for square grid computation structures, which is the setting of the problems in this paper (e.g., APSP, dynamic programming recurrences). It is interesting to see a more general analysis on k-d grids with arbitrary shape, and such results may apply to other applications like the computation of tensor algebra. Acknowledgments This work is supported by the National Science Foundation under CCF-1314590 and CCF-1533858. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation. The authors thanks Yihan Sun for valuable discussions on various ideas, and Yihan Sun and Yuan Tang for the preliminary version of the algorithm in Section 5. References [1] U. A. Acar, G. E. Blelloch, and R. D. Blumofe. The data locality of work stealing. Theory Comput. Sys., 35(3), 2002. [2] Alok Aggarwal, Ashok K. Chandra, and Marc Snir. Communication complexity of prams. Theor. Comput. Sci., 71(1):3 -- 28, 1990. [3] Alok Aggarwal and Maria Klawe. Applications of generalized matrix searching to geometric algorithms. Discrete Applied Mathematics, 27(1-2), 1990. [4] Alok Aggarwal and Jeffrey S. Vitter. The Input/Output complexity of sorting and related problems. Communications of the ACM, 31(9), 1988. [5] Alfred V Aho and John E Hopcroft. The design and analysis of computer algorithms. Pearson Education India, 1974. [6] Alfred V. Aho, John E. Hopcroft, and Jeffrey D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, Reading, MA, 1974. [7] Lars Arge. The buffer tree: A technique for designing batched external data structures. Algorithmica, 37(1), 2003. [8] Lars Arge, Gerth Stølting Brodal, and Rolf Fagerberg. Cache-oblivious data structures. Handbook of Data Structures and Applications, 27, 2004. [9] Grey Ballard, James Demmel, Olga Holtz, and Oded Schwartz. Communication-optimal parallel and sequential cholesky decomposition. SIAM J. Scientific Computing, 32(6):3495 -- 3523, 2010. [10] Grey Ballard, James Demmel, Olga Holtz, and Oded Schwartz. Minimizing communication in numerical linear algebra. SIAM J. Matrix Analysis Applications, 32(3):866 -- 901, 2011. 24 [11] Grey Ballard, James Demmel, Olga Holtz, and Oded Schwartz. Communication costs of strassen's matrix multiplication. Communications of the ACM, 57(2), 2014. [12] Richard Bellman. Dynamic programming. Princeton University Press, 1957. [13] Naama Ben-David, Guy E. Blelloch, Jeremy T. Fineman, Phillip B. Gibbons, Yan Gu, Charles McGuffey, and Julian Shun. Parallel algorithms for asymmetric read-write costs. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 2016. [14] Naama Ben-David, Guy E Blelloch, Jeremy T Fineman, Phillip B Gibbons, Yan Gu, Charles McGuf- fey, and Julian Shun. Implicit decomposition for write-efficient connectivity algorithms. In IEEE International Parallel and Distributed Processing Symposium (IPDPS), 2018. [15] G. E. Blelloch and P. B. Gibbons. Effectively sharing a cache among threads. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 2004. [16] Guy E. Blelloch, Jeremy T. Fineman, Phillip B. Gibbons, Yan Gu, and Julian Shun. Sorting with asymmetric read and write costs. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 2015. [17] Guy E. Blelloch, Jeremy T. Fineman, Phillip B. Gibbons, Yan Gu, and Julian Shun. Efficient algorithms with asymmetric read and write costs. In European Symposium on Algorithms (ESA), 2016. [18] Guy E. Blelloch, Jeremy T. Fineman, Phillip B. Gibbons, Yan Gu, and Julian Shun. Sorting with asymmetric read and write costs. In arXiv preprint:1603.03505, 2016. [19] Guy E Blelloch, Phillip B Gibbons, Yan Gu, Charles McGuffey, and Julian Shun. The parallel persistent memory model. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 2018. [20] Guy E Blelloch, Phillip B Gibbons, and Harsha Vardhan Simhadri. Low depth cache-oblivious algorithms. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 2010. [21] Guy E Blelloch, Yan Gu, Julian Shun, and Yihan Sun. Parallel write-efficient algorithms and data struc- tures for computational geometry. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 2018. [22] Guy E. Blelloch, Yan Gu, and Yihan Sun. Efficient construction of probabilistic tree embeddings. In International Colloquium on Automata, Languages, and Programming (ICALP), 2017. [23] Guy E. Blelloch, Yan Gu, Yihan Sun, and Kanat Tangwongsan. Parallel shortest paths using radius stepping. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), 2016. [24] Guy E Blelloch, Anupam Gupta, and Kanat Tangwongsan. Parallel probabilistic tree embeddings, k-median, and buy-at-bulk network design. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 2012. [25] R. D. Blumofe, M. Frigo, C. F. Joerg, C. E. Leiserson, and K. H. Randall. An analysis of dag- consistent distributed shared-memory algorithms. In ACM symposium on Parallelism in algorithms and architectures (SPAA), 1996. [26] Robert D Blumofe and Charles E Leiserson. Scheduling multithreaded computations by work stealing. Journal of the ACM (JACM), 46(5):720 -- 748, 1999. 25 [27] Charles L Bouton. Nim, a game with a complete mathematical theory. The Annals of Mathematics, 3(1/4), 1901. [28] Gerth Stølting Brodal. Cache-oblivious algorithms and data structures. In Scandinavian Workshop on Algorithm Theory (SWAT), volume 3111. Springer, 2004. [29] Erin Carson, James Demmel, Laura Grigori, Nicholas Knight, Penporn Koanantakool, Oded Schwartz, and Harsha Vardhan Simhadri. Write-avoiding algorithms. In IEEE International Parallel and Dis- tributed Processing Symposium (IPDPS), 2016. [30] Rezaul Chowdhury, Pramod Ganapathi, Yuan Tang, and Jesmin Jahan Tithi. Provably efficient schedul- ing of cache-oblivious wavefront algorithms. In Proceedings of the 29th ACM Symposium on Parallelism in Algorithms and Architectures, pages 339 -- 350. ACM, 2017. [31] Rezaul Chowdhury, Pramod Ganapathi, Jesmin Jahan Tithi, Charles Bachmeier, Bradley C Kuszmaul, Charles E Leiserson, Armando Solar-Lezama, and Yuan Tang. Autogen: Automatic discovery of cache-oblivious parallel recursive algorithms for solving dynamic programs. In ACM Symposium on Principles and Practice of Parallel Programming (PPoPP), 2016. [32] Rezaul A. Chowdhury. Cache-efficient algorithms and data structures: Theory and experimental evaluation. PhD Thesis, UT Austin, 2007. [33] Rezaul A. Chowdhury, Hai-Son Le, and Vijaya Ramachandran. Cache-oblivious dynamic programming for bioinformatics. IEEE/ACM Transactions on Computational Biology and Bioinformatics (TCBB), 7(3):495 -- 510, 2010. [34] Rezaul A. Chowdhury and Vijaya Ramachandran. Cache-oblivious dynamic programming. In ACM- SIAM symposium on Discrete algorithm (SODA), 2006. [35] Rezaul A. Chowdhury and Vijaya Ramachandran. Cache-efficient dynamic programming algorithms for multicores. In ACM Symposium on Parallelism in algorithms and architectures (SPAA), pages 207 -- 216. ACM, 2008. [36] Rezaul A. Chowdhury and Vijaya Ramachandran. The cache-oblivious gaussian elimination paradigm: theoretical framework, parallelization and experimental evaluation. Theory of Computing Systems, 47(4), 2010. [37] Richard Cole and Vijaya Ramachandran. Resource oblivious sorting on multicores. In International Colloquium on Automata, Languages, and Programming. Springer, 2010. [38] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms (3rd edition). MIT Press, 2009. [39] Erik D Demaine. Cache-oblivious algorithms and data structures. Lecture Notes from the EEF Summer School on Massive Data Sets, 8(4), 2002. [40] James Demmel, David Eliahu, Armando Fox, Shoaib Kamil, Benjamin Lipshitz, Oded Schwartz, and Omer Spillinger. Communication-optimal parallel recursive rectangular matrix multiplication. In International Parallel & Distributed Processing Symposium (IPDPS), 2013. [41] David Dinh, Harsha Vardhan Simhadri, and Yuan Tang. Extending the nested parallel model to the In ACM Symposium on Parallelism in nested dataflow model with provably efficient schedulers. Algorithms and Architectures (SPAA), 2016. 26 [42] David Eppstein and Zvi Galil. Parallel algorithmic techniques for combinatorial computation. Interna- tional Colloquium on Automata, Languages, and Programming (ICALP), 1989. [43] Mingdong Feng and Charles E Leiserson. Efficient detection of determinacy races in cilk programs. Theory of Computing Systems, 32(3):301 -- 326, 1999. [44] Michael J Fischer and Albert R Meyer. Boolean matrix multiplication and transitive closure. In IEEE Symposium on Switching and Automata Theory, 1971. [45] Robert W. Floyd. Algorithm 97: Shortest path. Commun. ACM, 5(6), June 1962. [46] Matteo Frigo, Charles E. Leiserson, Harald Prokop, and Sridhar Ramachandran. Cache-oblivious algorithms. In IEEE Symposium on Foundations of Computer Science (FOCS), 1999. [47] Matteo Frigo and Volker Strumpen. Cache oblivious stencil computations. In ACM International Conference on Supercomputing, pages 361 -- 366, 2005. [48] ME Furman. Application of a method of fast multiplication of matrices to problem of finding graph transitive closure. Doklady Akademii Nauk SSSR, 194(3), 1970. [49] Zvi Galil and Raffaele Giancarlo. Speeding up dynamic programming with applications to molecular biology. Theoretical Computer Science, 64(1), 1989. [50] Zvi Galil and Kunsoo Park. Dynamic programming with convexity, concavity and sparsity. Theoretical Computer Science, 92(1), 1992. [51] Zvi Galil and Kunsoo Park. Parallel algorithms for dynamic programming recurrences with more than O(1) dependency. Journal of Parallel and Distributed Computing, 21(2), 1994. [52] Yan Gu. Write-Efficient Algorithms. PhD Thesis, Carnegie Mellon University, 2019. [53] Yan Gu, Yihan Sun, and Guy E. Blelloch. Algorithmic building blocks for asymmetric memories. In European Symposium on Algorithms (ESA), 2018. [54] Daniel S. Hirschberg. A linear space algorithm for computing maximal common subsequences. Communications of the ACM, 18(6):341 -- 343, 1975. [55] Daniel S Hirschberg and Lawrence L Larmore. The least weight subsequence problem. SIAM Journal on Computing, 16(4), 1987. [56] Jia-Wei Hong and H. T. Kung. I/O complexity: The red-blue pebble game. In Proc. ACM Symposium on Theory of Computing (STOC), 1981. [57] S-HS Huang, Hongfei Liu, and Venkatraman Viswanathan. Parallel dynamic programming. IEEE transactions on parallel and distributed systems, 5(3), 1994. [58] Shou-Hsuan Stephen Huang, Hongfei Liu, and Venkatraman Viswanathan. A sublinear parallel algorithm for some dynamic programming problems. Theoretical Computer Science, 106(2), 1992. [59] Dror Irony, Sivan Toledo, and Alexandre Tiskin. Communication lower bounds for distributed-memory matrix multiplication. J. Parallel Distrib. Comput., 64(9):1017 -- 1026, 2004. 27 [60] Shachar Itzhaky, Rohit Singh, Armando Solar-Lezama, Kuat Yessenov, Yongquan Lu, Charles Leiserson, and Rezaul Chowdhury. Deriving divide-and-conquer dynamic programming algorithms using solver- aided transformations. In ACM International Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2016. [61] Riko Jacob and Nodari Sitchinava. Lower bounds in the asymmetric external memory model. In ACM Aymposium on Parallelism in Algorithms and Architectures (SPAA), 2017. [62] Stephen Cole Kleene. Representation of events in nerve nets and finite automata. Technical report, RAND PROJECT AIR FORCE SANTA MONICA CA, 1951. [63] Jon Kleinberg and Eva Tardos. Algorithm design. Pearson Education India, 2006. [64] Donald E Knuth and Michael F Plass. Breaking paragraphs into lines. Software: Practice and Experience, 11(11), 1981. [65] Penporn Koanantakool, Ariful Azad, Aydin Buluc¸, Dmitriy Morozov, Sang-Yun Oh, Leonid Oliker, and Katherine Yelick. Communication-avoiding parallel sparse-dense matrix-matrix multiplication. In IEEE International Parallel and Distributed Processing Symposium (IPDPS), 2016. [66] Marvin Kunnemann, Ramamohan Paturi, and Stefan Schneider. On the fine-grained complexity of one-dimensional dynamic programming. arXiv preprint arXiv:1703.00941, 2017. [67] Gad M Landau and Uzi Vishkin. Introducing efficient parallelism into approximate string matching and a new serial algorithm. In ACM symposium on Theory of computing (STOC), pages 220 -- 230, 1986. [68] Lynn H Loomis and Hassler Whitney. An inequality related to the isoperimetric inequality. Bulletin of the American Mathematical Society, 55(10):961 -- 962, 1949. [69] Saeed Maleki, Madanlal Musuvathi, and Todd Mytkowicz. Efficient parallelization using rank conver- gence in dynamic programming algorithms. Communications of the ACM, 59(10):85 -- 92, 2016. [70] Saeed Maleki, Madanlal Musuvathi, and Todd Mytkowicz. Low-rank methods for parallelizing dynamic programming algorithms. ACM Transactions on Parallel Computing (TOPC), 2(4):26, 2016. [71] Ian Munro. Efficient determination of the transitive closure of a directed graph. Information Processing Letters, 1(2), 1971. [72] Wojciech Rytter. On efficient parallel computations for some dynamic programming problems. Theo- retical Computer Science, 59(3), 1988. [73] Edgar Solomonik, Aydin Buluc, and James Demmel. Minimizing communication in all-pairs shortest paths. In IEEE International Parallel & Distributed Processing Symposium (IPDPS), 2013. [74] Yuan Tang and Shiyi Wang. Brief announcement: Star (space-time adaptive and reductive) algorithms for dynamic programming recurrences with more than O(1) dependency. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), 2017. [75] Yuan Tang, Ronghui You, Haibin Kan, Jesmin Jahan Tithi, Pramod Ganapathi, and Rezaul A Chowdhury. Cache-oblivious wavefront: improving parallelism of recursive dynamic programming algorithms without losing cache-efficiency. In ACM Symposium on Principles and Practice of Parallel Programming (PPOPP), 2015. 28 [76] Alexandre Tiskin. All-pairs shortest paths computation in the BSP model. In International Colloquium on Automata, Languages and Programming (ICALP), pages 178 -- 189, 2001. [77] Jesmin Jahan Tithi, Pramod Ganapathi, Aakrati Talati, Sonal Aggarwal, and Rezaul Chowdhury. High- performance energy-efficient recursive dynamic programming with matrix-multiplication-like flexible kernels. In IEEE International Parallel and Distributed Processing Symposium (IPDPS), 2015. [78] Sivan Toledo. Locality of reference in lu decomposition with partial pivoting. SIAM Journal on Matrix Analysis and Applications, 18(4), 1997. [79] Alexander van Renen, Lukas Vogel, Viktor Leis, Thomas Neumann, and Alfons Kemper. Persistent memory i/o primitives. In International Workshop on Data Management on New Hardware, page 12. ACM, 2019. [80] Stephen Warshall. A theorem on boolean matrices. Journal of the ACM (JACM), 9(1), 1962. [81] Michael S Waterman and Temple F Smith. Rna secondary structure: A complete mathematical analysis. Mathematical Biosciences, 42(3-4), 1978. [82] Virginia Vassilevska Williams. On some fine-grained questions in algorithms and complexity. In International Congress of Mathematicians (ICM), 2018. [83] David Womble, David Greenberg, Stephen Wheat, and Rolf Riesen. Beyond core: Making parallel computer i/o practical. In Proceedings of the 1993 DAGS/PC Symposium, 1993. [84] F Frances Yao. Efficient dynamic programming using quadrangle inequalities. In Proceedings of the twelfth annual ACM symposium on Theory of computing, 1980. A Strassen Algorithm Strassen algorithm computes matrix multiplication on a ring. Given two input matrices A and B and the output matrix C = AB, the algorithm partitions A, B and C into quadrants, applies seven recursive matrix multiplications on the sums or the differences of the quadrants, and each quadrant of C can be calculated by summing a subset of the seven intermediate matrices. This can be done in O(nlog2 7) work, O(nlog2 7/M log4 7−1B) cache complexity and O(log2 n) depth. Technically the computation structure of Strassen is not a k-d grid, but we can apply a similar idea in Section 5 to reduce asymmetric cache complexity. We still use r as the balancing factor between reads and writes (set to be ω2/3 in classic matrix multiplication). Given square input matrices, the algorithm also partition the output into r-by-r submatrices, and then run the 8-way divide-and-conquer approach to compute the matrix multiplication. This gives the following recurrences on work (T ), reads, writes and depth based on the output size n: T (cid:48)(n) = 7T (cid:48)(n/2) + O(n2) R(cid:48)(n) = 7R(cid:48)(n/2) + O(n2/B) W (cid:48)(n) = 7W (cid:48)(n/2) + O(ωn2/B) D(cid:48)(n) = D(n/2) + O(log n) 29 Algorithm 3: KLEENE(A) Input: Distance matrix A initialized based on the input graph G = (V, E) Output: Computed Distance matrix A 1 A00 ← KLEENE(A00) 2 A01 ← A01 + A00A01 3 A10 ← A10 + A10A00 4 A11 ← A11 + A10A01 5 A11 ← KLEENE(A11) 6 A01 ← A01 + A01A11 7 A10 ← A10 + A11A10 8 A00 ← A00 + A10A01 9 return A √ with the base cases T (cid:48)(1) = r, R(cid:48)( rM ) = M/B, W (cid:48)( √ M ) = ωM/B, and D(cid:48)(1) = 1. They solve to R(n) = r2R(cid:48)(n/r) = O(nlog2 7r2−log4 7M 1−log4 7/B) W (n) = r2W (cid:48)(n/r) = O(ωnlog2 7r2−log2 7M 1−log4 7/B) D(n) = O(log2 n) The case when r = ωlog7 4 gives the minimized cache complexity of Q(n) = O(nlog2 7ωlog7 16−1M 1−log4 7/B) ≈ O(n2.8ω0.42/BM 0.4) an O(ω0.58) improvement over the non-write-efficient version. In this setting the work is O(nlog2 7ωlog7 64−2), a factor of O(ω0.14) or O(ω1/7) extra work. B All-Pair Shortest-Paths (APSP) We now discuss the cache-oblivious algorithms to solve all-pair shortest paths (APSP) on a graph with improved asymmetric cache complexity and linear span. Regarding the span, Chowdhury and Ramachan- dran [36] showed an algorithm using O(n log2 n) span. There exist work-optimal and sublinear span algorithm for APSP [76], but we are unaware of how to make it I/O-efficient while maintaining the same span. Compared to previous linear span algorithms in [41], our algorithm is race-free and in the classic nested-parallel model. Also, we believe our algorithms are simpler. The improvement is from plugging in the algorithms introduced in Section 5 and 6 to Kleene's Algorithm. An all-pair shortest-paths (APSP) problem takes a (usually directed) graph G = (V, E) (with no negative cycles) as input. Here we discuss the Kleene's algorithm (first mentioned in [62, 71, 44, 48], discussed in full details in [6]). Kleene's algorithm has the same computational DAG as Floyd-Washall algorithm [45, 80], but it is described in a divide-and-conquer approach, which is already I/O-efficient, cache-oblivious and highly parallelized. The pseudocode of Kleene's algorithm is provided in Algorithm 3. The matrix A is partitioned into . The matrix multiplication is defined in a closed semi-ring with 4 submatrices indexed as (+, min). Kleene's algorithm is a divide-and-conquer algorithm to compute APSP. Its high-level idea is to first compute the APSP between the first half of the vertices only using the paths between these vertices. Then (cid:20)A00 A01 (cid:21) A10 A11 30 by applying some matrix multiplication we update the shortest-paths between the second half of the vertices using the computed distances from the first half. We then apply another recursive subtask on the second half vertices. The computed distances are finalized, and we use them to again update the shortest-paths from the first-half vertices. The asymmetric cache complexity Q(n) of this algorithm follows the recursion of: Q(n) = 2Q(n/2) + 6Q3C(n/2) D(n) = 2D(n/2) + 2D3C(n/2) Considering this cost, the recursion is root-dominated, which indicates that computing all-pair shortest paths of a graph has the same upper bound on cache complexity as matrix multiplication. C Gaussian Elimination Gaussian elimination (without pivoting) is used in solving of systems of linear equations and computing LU decomposition of symmetric positive-definite or diagonally dominant real matrices. Given a linear system AX = b, the algorithm proceeds in two phases. The first phase modifies A into an upper triangular matrix (updates B accordingly), which is discussed in this section. The second phase solves the values of the variables using back substitution, which is shown in Section D. The process of Gaussian elimination can be viewed as a three nested-loops and computing the value of Ai,j requires Ai,k, Ak,j and Ak,k for all 1 ≤ k < i. If required, the corresponding value of the LU decomposition matrix can be computed simultaneously. The underlying idea of divide-and-conquer approach is almost identical to Kleene's algorithm, which partitions A into four quadrants . The algorithm: (1) recursively computes A00; (2) updates A10 and A01 using A00; (3) updates A11 using A10 and A01; and (4) recursively computes A11. (cid:20)A00 A01 A10 A11 (cid:21) Note that each inter-quadrant update in step (2) and (3) is a 3d grid, which gives the following recurrence: Q(n) = 2Q(n/2) + 4Q3C(n/2) D(n) = 2D(n/2) + 3D3C(n/2) D Triangular System Solver A Triangular System Solver computes the back substitution step in solving the linear system. Here we assume that it takes as input a lower triangular n × n matrix T (can be computed using the algorithm discussed in Section C) and a square matrix B and outputs a square matrix X such that T X = B. A triangular system can be recursively decomposed as: (cid:20)B00 B01 (cid:21) B10 B11 = = (cid:20)T00 (cid:20) 0 T10 T11 (cid:21)(cid:20)X00 X01 (cid:21) X10 X11 T00X00 T00X01 T10X00 + T11X10 T10X01 + T11X11 (cid:21) such that four equally sized subquadrants X00, X01, X10, and X11 can be solved recursively. In terms of parallelism, the two subtasks of X00 and X01 are independent, and need to be solved prior to the other independent subtasks X10, and X11. The asymmetric cache complexity Q(n) of this algorithm follows the recursion of: Q(n) = 4Q(n/2) + 2Q3C(n/2) D(n) = 2D(n/2) + D3C(n/2) 31 E Discussions of Carson et al. [29] Carson et al. also analyze algorithms that reduce the number of writes [29]. They concluded that many cache- oblivious algorithms like matrix multiplication could not be write-avoiding. Their definition of write-avoiding is different from our write-efficiency, and it requires the algorithm to reduce writes without asymptotically increasing reads. Hence, their negative conclusion does not contradict the result in this paper. We now use matrix multiplication as an example that optimal number of reads leads to worse overall asymmetric cache complexity. Let's say a write is n times more expansive than a read. One algorithm can apply n2 inner products, and the asymmetric cache complexity is O(n3/B): O(n/B) reads and O(1/B) writes per inner product. However, the algorithms using optimal number of reads requires O(n3/B M ) reads and writes, so the overall cache complexity is O(n · n3/B M ). The first algorithm requiring more M ) better on the asymmetric cache complexity. Notice that we always assume reads is a factor of O(n/ M ) since otherwise the whole computation is trivially in the cache and has no cost. As a result, an n = ω( algorithm with a good asymmetric cache complexity does not always need to be write-avoiding. √ √ √ √ The algorithms on asymmetric memory in this paper all require extra reads, but can greatly reduce the overall asymmetric cache complexity compared to the previous cache-oblivious algorithms. The goal of this paper is to find the optimal cache-oblivious algorithms for any given write-read asymmetry ω. 32
1911.02921
1
1911
2019-11-06T13:26:32
Probabilistic Watershed: Sampling all spanning forests for seeded segmentation and semi-supervised learning
[ "cs.DS", "cs.CV" ]
The seeded Watershed algorithm / minimax semi-supervised learning on a graph computes a minimum spanning forest which connects every pixel / unlabeled node to a seed / labeled node. We propose instead to consider all possible spanning forests and calculate, for every node, the probability of sampling a forest connecting a certain seed with that node. We dub this approach "Probabilistic Watershed". Leo Grady (2006) already noted its equivalence to the Random Walker / Harmonic energy minimization. We here give a simpler proof of this equivalence and establish the computational feasibility of the Probabilistic Watershed with Kirchhoff's matrix tree theorem. Furthermore, we show a new connection between the Random Walker probabilities and the triangle inequality of the effective resistance. Finally, we derive a new and intuitive interpretation of the Power Watershed.
cs.DS
cs
Probabilistic Watershed: Sampling all spanning forests for seeded segmentation and semi-supervised learning Enrique Fita Sanmartín, Sebastian Damrich, Fred A. Hamprecht HCI/IWR at Heidelberg University, 69115 Heidelberg, Germany {fita@stud, sebastian.damrich@iwr, fred.hamprecht@iwr}.uni-heidelberg.de Abstract The seeded Watershed algorithm / minimax semi-supervised learning on a graph computes a minimum spanning forest which connects every pixel / unlabeled node to a seed / labeled node. We propose instead to consider all possible spanning forests and calculate, for every node, the probability of sampling a forest connecting a certain seed with that node. We dub this approach "Probabilistic Watershed". Leo Grady (2006) already noted its equivalence to the Random Walker / Harmonic energy minimization. We here give a simpler proof of this equivalence and establish the computational feasibility of the Probabilistic Watershed with Kirchhoff's matrix tree theorem. Furthermore, we show a new connection between the Random Walker probabilities and the triangle inequality of the effective resistance. Finally, we derive a new and intuitive interpretation of the Power Watershed. 1 Introduction Seeded segmentation in computer vision and graph-based semi-supervised machine learning are essentially the same problem. In both, a popular paradigm is the following: given many unlabeled pixels / nodes in a graph as well as a few seeds / labeled nodes, compute a distance from a given query pixel / node to all of the seeds, and assign the query to a class based on the shortest distance. There is obviously a large selection of distances to choose from, and popular choices include: i) the shortest path distance (e.g. [20]), ii) the commute distance (e.g. [53, 52, 5, 28]) or iii) the bottleneck shortest path distance (e.g. [31, 13]). Thanks to its matroid property, the latter can be computed very efficiently -- a greedy algorithm finds the global optimum -- and is thus widely studied and used in different fields under names including widest, minimax, maximum capacity, topographic and watershed path distance. In computer vision, the corresponding algorithm known as "Watershed" is popular in seeded segmentation not only because it is so efficient [14] but also because it works well in a broad range of problems [51, 3], is well understood theoretically [18, 1], and unlike Markov Random Fields induces no shrinkage bias [4]. Even though the Watershed's optimization problem can be solved efficiently, it is combinatorial in nature. One consequence is the "winner-takes-all" characteristic of its solutions: a pixel or node is always unequivocally assigned to a single seed. Given suitable graph edge-weights, this solution is often but not always correct, see Figures 1 and 21. Intrigued by the value of the Watershed to many computer vision pipelines, we have sought to entropy-regularize the combinatorial problem to make it more amenable to end-to-end learning in modern pipelines. Exploiting the equivalence of Watershed segmentations to minimum cost spanning forests, we hence set out from the following question: Is it possible to compute not just the minimum, but all (!) possible spanning forests, and to compute, in closed form, the probability that a pixel of 1which were produced with the code at https://github.com/hci-unihd/Probabilistic_Watershed 33rd Conference on Neural Information Processing Systems (NeurIPS 2019), Vancouver, Canada. 0.00 0.05 s2 0.70 1.20 q 0.43 0.22 0.51 0.92 1.61 0.10 s1 0.16 0.36 0.68 0.77 1.00 1 s2 s2 s2 s2 q q q 0.21 0.52 0.72 mSF q s1 s1 s1 s1 0.00 0.30 0.45 0 Figure 1: The Probabilistic Watershed computes the expected seed assignment of every node for a Gibbs distribution over all exponentially many spanning forests in closed-form. It thus avoids the winner-takes-all behaviour of the Watershed. (Top right) Graph with edge-costs and two seeds. (Bottom left) The minimum spanning forest (mSF) and other, higher cost forests. The Watershed selects the mSF, which assigns the query node q to seed s1. Other forests of low cost might however induce different segmentations. The dashed lines indicate the cut of the segmentations. For instance, the other depicted forests connect q to s2. (Top left) We therefore consider a Gibbs distribution over all spanning forests with respect to their cost (see equation (5), µ = 1). Each green bar corresponds to the cost of one of the 288 possible spanning forests. (Bottom right) Probabilistic Watershed probabilities for assigning a node to s2. Query q is now assigned to s2. Considering a distribution over all spanning forests gives an uncertainty measure and can yield a segmentation different from the mSF's. In contrast to the 288 forests in this toy graph, for the real-life image in Figure 2 one would have to consider at least 1011847 spanning forests separating the 13 seeds (see appendix G), a feat impossible without the matrix tree theorem. interest is assigned to one of the seeds? More specifically, we envisaged a Gibbs distribution over the exponentially many distinct forests that span an undirected graph with edge-costs, where each forest is assigned a probability that decreases with increasing sum of the edge-costs in that forest. If computed naively, this would be an intractable problem for all but the smallest graphs. However, we show here that a closed-form solution can be found by recurring to Kirchhoff's matrix tree theorem, and is given by the solution of the Dirichlet problem associated with commute distances [53, 52, 5, 28]. Leo Grady mentioned this connection in [28, 29] and based his argument on potential theory, using results from [8]. Our informal poll amongst experts from both computer vision and machine learning indicated that this connection has remained mostly unknown. We hence offer a completely self-contained, except for the matrix tree theorem, and hopefully simpler proof. In this entirely conceptual work, we • give a proof, using elementary graph constructions and building on the matrix tree theorem, that shows how to compute analytically the probability that a graph node is assigned to a particular seed in an ensemble of Gibbs distributed spanning forests (Section 3). • establish equivalence to the algorithm known as Random Walker in computer vision [28] and as Laplacian Regularized Least Squares and under other names in transductive machine learning [53, 52, 5]. In particular, we relate, for the first time, the probability of assigning a query node to a seed to the triangle inequality of the effective resistance between seeds and query (Section 4). • give a new interpretation of the so-called Power Watershed [16] (Section 5). 1.1 Related work Watershed as a segmentation algorithm was first introduced in [6]. Since then it has been studied from different points of view [7, 17], notably as a minimum spanning forest that separates the seeds 2 (a) Image with seeds (b) Watershed (c) Probabilistic Watershed (d) Uncertainty Figure 2: The Probabilistic Watershed profits from using all spanning forests instead of only the minimum cost one. (2a) Crop of a CREMI image [19] with marked seeds. (2b) and (2c) show results of Watershed and multiple seed Probabilistic Watershed (end of section 3) applied to edge-weights from [12]. (2d) shows the entropy of the label probabilities of the Probabilistic Watershed (white high, black low). The Watershed errs in an area where the Probabilistic Watershed expresses uncertainty but is correct. [18]. The Random Walker [28, 52, 53, 5] calculates the probability that a random walker starting at a query node reaches a certain seed before the other ones. Both algorithms are related in [16] by a limit consideration termed Power Watershed algorithm. In this work, we establish a different link between the Watershed and the Random Walker. The Watershed's and Random Walker's recent combination with deep learning [51, 49, 12] also connects our Probabilistic Watershed to deep learning. Related to our work by name though not in substance is the "Stochastic Watershed" [2, 38], which samples different instances of seeds and calculates a probability distribution over segmentation boundaries. Instead, in [43] the authors suggest sampling the edge-costs in order to define an uncertainty measure of the labeling. They show that it is NP-hard to calculate the probability that a node is assigned to a seed if the edge-costs are stochastic. We derive a closed-form formula for this probability for non-stochastic costs by sampling spanning forests. Ensemble Watersheds proposed by [13] samples part of the seeds and part of the features which determine the edge-costs. Introducing stochasticity to distance transforms makes a subsequent Watershed segmentation more robust to noise [40]. Minimum spanning trees are also applied in optimum-path forest learning, where confidence measures can be computed [22, 23]. Similar to our forest distribution, [33] considers a Gibbs distribution over shortest paths. This approach is extended to more general bags-of-paths in [25]. Entropic regularization has been used most successfully in optimal transport [21] to smooth the combinatorial optimization problem and hence afford end-to-end learning in conjunction with deep networks [39]. Similarly, we smooth the combinatorial minimum spanning forest problem by considering a Gibbs distribution over all spanning forests. The matrix tree theorem (MTT) plays a crucial role in our theory, permitting us to measure the weight of a set of forests. The MTT is applied in machine learning [34], biology [45] and network analysis [44, 46]. The matrix forest theorem (MFT), a generalization of the MTT, is applied in [15, 42]. By means of the MFT, a distance on the graph is defined in [15]. In a similar manner as we do with the MTT, [42] is able to compute a Gibbs distribution of forests using the MFT. Some of the theoretical results of our work are mentioned in [28, 29], where they refer to [8]. In contrast to [28], we emphasize the relation with the Watershed and develop the theory in a simpler and more direct way. 2 Background 2.1 Notation and terminology Let G = (V, E, w, c) be a graph where V denotes the set of nodes, E the set of edges and w and c are functions that assign a weight w(e) ∈ R≥0 and a cost c(e) ∈ R to each edge e ∈ E. All the graphs G considered will be connected and undirected. When we speak of a multigraph, we allow for 3 (cid:26)−w(cid:0){u, v}(cid:1) k∈V w(cid:0){u, k}(cid:1) (cid:80) if u (cid:54)= v if u = v multiple edges incident to the same two nodes but not for self-loops. We will consider simple graphs unless stated otherwise. The Laplacian of a graph L ∈ RV ×V is defined as , Luv := where we consider w(cid:0){u, v}(cid:1) = 0 if {u, v} /∈ E. L+ will denote its pseudo-inverse. We define the weight of a graph as the product of the weights of all its edges, w(G) =(cid:81) manner, we define the cost of a graph as the sum of the costs of all its edges, c(G) =(cid:80) e∈E w(e). The weight of a set of graphs, w({Gi}n i=0) is the sum of the weights of the graphs. In a similar The set of spanning trees of G will be denoted by T . Given a tree t ∈ T and nodes u, v ∈ V , the set of edges on the unique path between u and v in t will be denoted by Pt(u, v). By F v u we denote the set of 2-trees spanning forests, i.e. spanning forests with two trees, such that u and v are not connected. Furthermore, if we consider a third node q, we define F v q , i.e. all 2-trees spanning forests such that q and u are in one tree and v belongs to the other tree. Note that the sets F v u,q (= F v v ), since q must be connected either to u or v, but not to both. In order to shorten the notation we will refer to 2-trees spanning forests simply as 2-forests. We consider w(e) = exp(−µc(e)), µ ≥ 0, as will be motivated in Section 3.1 by the definition of a Gibbs distribution over the 2-forests in F v u. Thus, a low edge-cost corresponds to a large edge-weight, and a minimum edge-cost spanning forest (mSF) is equivalent to a maximum edge-weight spanning forest (MSF). q,u) and F u v,q (= F u q,v) form a partition of F v u,q := F v u ∩ F v u (= F u e∈E c(e). 2.2 Seeded Watershed as minimum cost spanning forest computation Let G = (V, E, c) be a graph and c(e) be the cost of edge e. The lower the cost, the higher the affinity between the nodes incident to e. Given different seeds, a forest in the graph defines a segmentation over the nodes as long as each component contains a different seed. The cost of a forest, c(f ), is equal to the sum of the costs of its edges. The Watershed algorithm calculates a minimum cost spanning forest, mSF, (or maximum weight, MSF) such that the seeds belong to different components [18]. 2.3 Matrix tree theorem In our approach we want to take all possible 2-forests in F v u into account. The probability of a node label will be measured by the cumulative weight of the 2-forests connecting the node to a seed of that label. To compute the weight of a set of 2-forests we will use the matrix tree theorem (MTT) which can be found e.g. in chapter 4 of [47] (see Appendix A)) and has its roots in [32]. Theorem 2.1 (MTT). For any edge-weighted multigraph G the sum of the weights of the spanning trees of G, w(T ), is equal to (cid:88) t∈T (cid:88) (cid:89) t∈T e∈Et (cid:16) V 11(cid:62)(cid:17) 1 w(e) = 1 V det L + w(T ) := w(t) = = det(L[v]), where 1 is a column vector of 1's. L[v] is the matrix obtained from L after removing the row and column corresponding to an arbitrary but fixed node v. This theorem considers trees instead of 2-forests. The key idea to obtain an expression for w (F v u ) by means of the MTT is that any 2-forest f ∈ F v u can be transformed into a tree by adding an artificial edge ¯e = {u, v} which connects the two components of f (as done in section 9 of [8] or in the original work of Kirchhoff [32]). We obtain the following lemma, which is proven in Appendix A. Lemma 2.2. Let G = (V, E, w) be an undirected edge-weighted connected graph and u, v ∈ V arbitrary vertices. a) Let (cid:96)+ ij denote the entry ij of the pseudo-inverse of the Laplacian of G, L+. Then we get (1) u ) = w(T )(cid:0)(cid:96)+ w(F v uu + (cid:96)+ vv − 2(cid:96)+ uv (cid:1) . 4 b) Let (cid:96) −1,[r] ij denote the entry ij of the inverse of the matrix L[r] (the Laplacian L after removing the row and the column corresponding to node r), then −1,[r] vv − 2(cid:96) −1,[r] uv (cid:17) (cid:16) w(T ) w(T )(cid:96) w(T )(cid:96) −1,[r] (cid:96) uu + (cid:96) −1,[v] uu −1,[u] vv w(F v u ) = if r (cid:54)= u, v if r = v and u (cid:54)= v if r = u and u (cid:54)= v. (2) 2.4 Effective resistance In electrical network theory, the circuits are also interpreted as graphs, where the weights of the edges are defined by the reciprocal of the resistances of the circuit. The effective resistance between two uv := (νu − νv) /I where νu is the potential at node u and I is the nodes u and v can be defined as reff current flowing into the network. Other equivalent expressions for the effective resistance [27] in terms of the matrices L+ and L[r], as defined in Lemma 2.2, are (cid:17) −1,[r] vv − 2(cid:96) −1,[r] uv (cid:16)  −1,[r] (cid:96) uu + (cid:96) −1,[v] (cid:96) uu −1,[u] (cid:96) vv if r (cid:54)= u, v if r = v and u (cid:54)= v if r = u and u (cid:54)= v. (3) reff uv = (cid:96)+ uu + (cid:96)+ vv − 2(cid:96)+ uv = We observe that the expressions in Lemma 2.2 and in equation (3) are proportional. We will develop this relation further in Section 3.2. An important property of the effective resistance is that it defines a metric over the nodes of a graph ([24] Section 2.5.2). 3 Probabilistic Watershed Instead of computing the mSF, as in the Watershed algorithm, we take into account all the 2-forests that separate two seeds s1 and s2 in two trees according to their costs. Since each 2-forest assigns a query node to exactly one of the two seeds, we calculate the probability of sampling a 2-forest that connects the seed with the query node. Moreover, this provides an uncertainty measure of the assigned label. We call this approach to semi-supervised learning "Probabilistic Watershed". 3.1 Probability of connecting two nodes in an ensemble of 2-forests In Section 2.1, we defined the cost of a forest as the cumulative cost of its edges. We assume that the 2-forests f ∈ F s2 s1 follow a probability distribution that minimizes the expected cost of a 2-forest among all distributions of given entropy J. Formally, the 2-forests are sampled from the distribution which minimizes P (f ) = 1 and H(P ) = J, (4) (cid:88) P (f )c(f ), min P f∈F s2 s1 s.t. (cid:88) (cid:81) f∈F s2 s1 e∈Ef f(cid:48)∈F s2 s1 (cid:80) where H(P ) is the entropy of P . The lower the entropy, the more probability mass is given to the 2-forests of lowest cost. The minimizing distribution is the Gibbs distribution (e.g. [50] 3.2): (cid:80) P (f ) = exp (−µc(f )) exp (−µc(f(cid:48))) = f(cid:48)∈F s2 s1 (cid:81) exp(−µc(e)) e∈Ef(cid:48) exp(−µc(e)) (cid:80) = w(f ) f(cid:48)∈F s2 s1 w(f(cid:48)) , (5) where µ implicitly determines the entropy. A higher µ implies a lower entropy (see Section 5 and Figure 6 in the appendix). According to (5), an appropriate choice for the edge-weights is w(e) = exp(−µc(e)). The main definition of the paper is: Definition 3.1 (Probabilities of the Probabilistic Watershed). Given two seeds s1 and s2 and a query node q, we define the Probabilistic Watershed's probability that q and s1 have the same label as the probability of sampling a 2-forest that connects s1 and q, while separating the seeds: (cid:46) (cid:88) w(f(cid:48)) = w(cid:0)F s2 s1,q (cid:1)(cid:14)w(cid:0)F s2 (cid:1) . s1 (6) P (q ∼ s1) := (cid:88) (cid:88) P (f ) = w(f ) f∈F s2 s1,q f∈F s2 s1,q f(cid:48)∈F s2 s1 5 q q q q f ∈ F q s1,s2 f ∈ F s2 s1,q f ∈ F s1 s2,q f ∈ F q s1,s2 f ∈ F s1 s2,q f ∈ F s2 s1,q s1 s2 s1 s2 s1 s2 s1 s2 (b) forest f ∈ F q (a) spanning tree t ∈ T Figure 3: Amongst all spanning forests that isolate seed s1 from s2, we want to identify the fraction of forests connecting s1 and q (Definition 3.1). The dashed lines represent all spanning trees. Either cut in (3b) yields a forest separating q from s2. The blue ones are of interest to us. Diagrams (3b) - (3d) correspond to the three equations in the linear system (7), which can be solved for w(F s2 (d) forest f ∈ F s2 (c) forest f ∈ F q s2 s1 s1 s1,q). The Watershed algorithm computes a minimum cost 2-forest, which is the most likely 2-forest according to (5), and segments the nodes by their connection to seeds in the minimum cost spanning 2-forest. However, it does not indicate which label assignments were ambiguous, for instance due to the existence of other low - but not minimum - cost 2-forests. This makes it a brittle "winner- takes-all" approach. In contrast, the Probabilistic Watershed takes all spanning 2-forests into account according to their cost (see Figure 1). The resulting assignment probability of each node provides an uncertainty measure. Assigning each node to the seed for which it has the highest probability can yield a segmentation different from the Watershed's. 3.2 Computing the probability of a query being connected to a seed In the previous subsection, we defined the probability of a node being assigned to a seed via a Gibbs distribution over all exponentially many 2-forests. Here, we show that it can be computed analytically using only elementary graph constructions and the MTT (Theorem 2.1). In Lemma 2.2 we have stated how to calculate w(F v s2 we can compute w(F s2 F v u,q and F u 2.1. Thus, we obtain the linear system of three equations in three unknowns: u for any mutually distinct nodes u, v, q as mentioned in Section u ) for any u, v ∈ V . Applying this to F s2 v,q form a partition of F v s2,q) by means of a linear system. s1,q) and w(F s1 s1 and F q s1 , F q w(F s2 w(F q w(F s2 s1,q) + w(F q ) + w(F s1 s1,q) + w(F s1 ) = w(F q s2,q) = w(F q s2,q) = w(F s2 s1,s2 s1,s2 s1 s1 s2 ) ) ). (7) In this paragraph, we describe an alternative way of deriving (7) by relating spanning 2-forests to spanning trees before we solve it in (8). This is similar to our use of the MTT for counting spanning 2-forests instead of trees in Lemma A.4 (see Appendix A) Let t be a spanning tree of G. To create a 2-forest f ∈ F s2 s1 from t we need to remove an edge e in the path from s1 to s2, that is e ∈ Pt(s1, s2). This edge e must be either in Pt(q, s1) ∩ Pt(s1, s2) or Pt(q, s2) ∩ Pt(s1, s2) (shown in red and blue respectively in Figure 3d), as the union of Pt(s1, q) and Pt(q, s2) contains Pt(s1, s2) and removing e from t cannot pairwise separate q, s1 and s2. If we remove an edge from Pt(q, s2) ∩ Pt(s1, s2), we get f ∈ F s2 s2,q. Analogously, we obtain a 2-forest in F q s2 if we remove an edge e from Pt(s1, q) or Pt(s2, q) respectively (see Figure 3). When applied to all spanning trees, we obtain the system (7). Solving the linear system (7) we obtain 2 s1,q since we are disconnecting s2 from q, otherwise f ∈ F s1 s1 or F q ) + w(F s2 s1 s2 ) − w(F q (8) In consequence of equation (8) and Definition 3.1 we get the following theorem: Theorem 3.1. The probability that q has the same label as seed s1 is ) − w(F q v ) for any u, v, q ∈ V but that formula is incorrect. For instance, it does not hold for the complete graph with nodes {u, v, q} and with w(e) = 1 for all edges e, since w(F v 2Section IV.B of [28] states w(F v ) + w(F s2 u ) − w(F q u,q) = 1 (cid:54)= 0 = 2 − 2 = w(F v u,q) = w(F v u ) − w(F q v ). s2 s1 s1 s1 s1,q w(cid:0)F s2 (cid:1) =(cid:0)w(F q P (q ∼ s1) =(cid:0)w(F q s1 )(cid:1)(cid:14)2. )(cid:1)(cid:14)(cid:0)2w(F s2 )(cid:1). 6 Theorem 3.1 expresses P (q ∼ s1) in terms of weights of 2-forests, which we can compute with Lemma 2.2, which is based on the MTT. We use this expression to relate P (q ∼ s1) to the effective resistance. As a result of Lemma 2.2 and equation (3), for any nodes u, v ∈ V we have uv = w (F v reff u ) /w(T ). s1q − reff P (q ∼ s1) =(cid:0)reff uv being a metric, w (F v (cid:1) s1q ≤ reff (cid:1)(cid:14)(cid:0)2reff (9) This relation has already been proven in [8] (Proposition 17.1) but in terms of the effective conductance (the inverse of the effective resistance). Due to reff u ) also defines a metric over the nodes of the graph. Combining (9) with Theorem 3.1, we have that the probability of q having seed s1's label is s2q + reff s2s1 (10) s1s2 The probability is proportional to the gap in the triangle inequality reff s2q. It will be shown in Section 4 that the probability defined in Definition 3.1 is equal to the probability given by the Random Walker [28]. Equation (10) gives an interpretation of this probability, which is new to the best of our knowledge. We can see that the greater the gap in the triangle inequality, the greater is the probability. Further, we get P (q ∼ s1) ≥ P (q ∼ s2) ⇐⇒ reff s2q. This relation has already been pointed out in [28] (section IV.B) in terms of the effective conductance between two nodes, but not as explicitly as in (10). We note that any metric distance on the nodes of a graph, e.g. the ones mentioned in the introduction, can define an assignment probability along the lines of equation (10). Our discussion was constrained to the case of two seeds only to ease our explanation. We can reduce the case of multiple seeds per label to the two seed case by merging all nodes seeded with the same label. Similarly, the case of more than two labels can be reduced to the two label scenario by using a one versus all strategy: We choose one label and merge the seeds of other labels into one unique seed. In both cases we might introduce multiple edges between node pairs. While having formulated our arguments for simple graphs, they are also valid for multigraphs (see Appendix A). s1q ≤ reff + reff s1s2 4 Connection between the Probabilistic Watershed and the Random Walker In this section we will show that the Random Walker of [28] is equivalent to our Probabilistic Watershed, both computationally and in terms of the resulting label probabilities. Theorem 4.1. The probability xs1 q that a random walker as defined in [28] starting at node q reaches s1 first before reaching s2 is equal to the Probabilistic Watershed probability defined in Definition 3.1: q = P (q ∼ s1). xs1 This equivalence, which we prove in Appendix B, was pointed out by Leo Grady in [28] section IV.B but with a different approach. Grady relied on results from [8], where potential theory is used. There it is shown that xs1 using equation (9): q = w(F s2 xs1 w(T )(cid:1). From this formula we get Theorem 4.1 by s1,q)/(cid:0)reff w(T )(cid:1) = w(cid:0)F s2 (cid:1) = P (q ∼ s1). (cid:1) /w(cid:0)F s2 s1,q)/(cid:0)reff q = w(F s2 s1s2 s1s2 s1,q s1 We have proven the same statement with elementary arguments and without the main theory of [8]. Through the use of the MTT, we have shown that the forest-sampling point of view is computationally equivalent to the in practice very useful Random Walker (see [53, 28], and recently [49, 11, 12, 36, 9]), making our method just as potent. We thus refrained from adding further experiments and instead include a new interpretation of the Power Watershed within our framework. 5 Power Watershed counts minimum cost spanning forests The objective of this section is to recall the Power Watershed [16] (see Appendix C for a summary) and develop a new understanding of its nature. Power Watershed is a limit over the Random Walker and thus over the equivalent Probabilistic Watershed. The latter's idea of measuring the weight of a set of 2-forests carries over nicely to the Power Watershed, where, as a limit, only the maximum weight / minimum cost spanning forests are considered. This section details the connection. Let G = (V, E, w, c) and s1, s2 ∈ V be as before. In [16] the following objective function is proposed: (w(e))α (xu − xv)β , s.t. xs1 = 1, xs2 = 0. (11) (cid:88) arg min x e={u,v}∈E 7 (a) P (node ∼ s1) and P (edge ∈ some mSF) (b) P (node ∼ s1) and P (edge ∼ s1edge ∈ some msF) (c) P (node ∼ s1) and P (edge ∼ s1, edge ∈ some mSF) (d) P (node ∼ s2) and P (edge ∼ s2, edge ∈ some mSF) Figure 4: Power Watershed result on a grid graph with seeds s1, s2 and with random edge-costs outside a plateau of edges with the same cost (wide edges). By the results in Theorem 5.1, the Power Watershed counts mSFs. This is illustrated both with the node- and edge-colors. (4a-4d) The nodes are colored by their probability of belonging to seed s1 (s2), i.e. by the share of mSFs that connect a given node to s1 (s2). (4a) The edge-color indicates the share of mSFs in which the edge is present. (4b) The edge-color indicates the share of mSFs in which the edge is connected to seed s1 among the mSFs that contain the edge. (4c - 4d) The edge-color indicates the share of mSFs in which the edge is connected to s1 or s2, respectively, among all mSFs. See Appendix F for a more detailed explanation. the edges to α we obtain(cid:0)w(e)(cid:1)α For α = 1 and β = 2 it gives the Random Walker's objective function. The Power Watershed considers the limit case when α → ∞ and β remains finite. In section 3.1 we defined the weight of an edge e as w(e) = exp(−µc(e)), where c(e) was the edge- cost and µ implicitly determined the entropy of the 2-forest distribution. By raising the weight of = exp(−µαc(e)) = exp(−µαc(e)), where µα := µα. Therefore, we can absorb α into µ. When α → ∞ (and therefore µα → ∞) the distribution will have a lowest entropy. As a consequence only the mSFs / MSFs are considered in the Power Watershed: Theorem 5.1. Given two seeds s1 and s2, let us denote the potential of node q being assigned to seed s1 by the Power Watershed with β = 2 as xPW . Let further wmax be maxf∈F s2 w(f ). Then s1 (cid:12)(cid:12){f ∈ F s2 s1,q : w(f ) = wmax}(cid:12)(cid:12) q : w(f ) = wmax} . xPW q = {f ∈ F s2 s1 Theorem 5.1,which we prove in Appendix D, interprets the Power Watershed potentials as a ratio of 2-forests similar to the Probabilistic Watershed. But instead of all 2-forests the Power Watershed only considers minimum cost 2-forests (equivalently maximum weight 2-forests) as they are the only ones that matter after taking the limit µ → ∞ (or α → ∞). In other words, the Power Watershed counts 8 s1s20.00.20.40.60.81.00.00.20.40.60.81.0s1s20.00.20.40.60.81.0s1s20.00.20.40.60.81.0s1s20.00.20.40.60.81.0 q 1 3 s1 7 6 4 8 5 s2 2 4 0 8 4 s2 s2 s2 0.00 1.00 1.00 1 q s2 s1 s1 s1 0.00 0.33 0.67 0 s1 0.00 0.33 1.00 (b) mSF1 (c) mSF2 (e) P∞(node ∼ s2) (d) mSF3 (a) Graph (f) RW reachability Figure 5: Forest-interpretation of Power Watershed. (5a) Graph with edge-costs and its mSFs in ((5b)-(5d)). (5e) Power Watershed probabilities for assigning a node to s2. The Power Watershed computes the ratio between the mSFs connecting a node to s2 and all possible mSFs. The dashed lines indicate the segmentation's cut. (5f) indicates the allowed Random Walker transitions when µ → ∞ with headed arrows. The Random Walker interpretation of the Power Watershed breaks down in the limit case since a Random Walker starting at node q does not reach any seed, but oscillates along the bold arrow. by how many seed separating mSFs a node is connected to a seed (see Figure 5). Note, that there can be more than one mSF when the edge-costs are not unique. In Figure 4 we show the probability of an edge being part of a mSF (see Appendix F for a more exhaustive explanation). In addition, it is worth recalling that the cut given by the Power Watershed segmentation is a mSF-cut (Property 2 of [16]). The Random Walker interpretation can break down in the limit case of the Power Watershed. After taking the power of the edge-weights to infinity, at any node a Random Walker would move along an incident edge with maximum weight / minimum cost. So, in the limit case a Random Walker could get stuck at the edges, e = {u, v}, which minimize the cost among all the edges incident to u or v. In this case the Random Walker will not necessarily reach any seed (see Figure 5f). In contrast, the forest-counting interpretation carries over nicely to the limit case. The Probabilistic Watershed with a Gibbs distribution over 2-forests of minimal (maximal) entropy, µ = ∞ (µ = 0), corresponds to the Power Watershed (only considers the graph's topology). The effect of µ is illustrated on a a toy graph in Figure 6 of the appendix. One could perform grid search to identify interesting intermediate values of µ. Alternatively, µ can be learned, alongside the edge-costs, by back-propagation [12] or by a first-order approximation thereof [49]. 6 Discussion In this work, we provided new understanding of well-known seeded segmentation algorithms. We have presented a tractable way of computing the expected label assignment of each node by a Gibbs distribution over all the seed separating spanning forests of a graph (Definition 3.1). Using the MTT we showed that this is computationally and by result equivalent to the Random Walker [28]. Our approach has been developed without using potential theory (in contrast to [8]). These facts have provided us with a novel understanding of the Random Walker (Probabilistic Watershed) probabilities: They are proportional to the gap produced by the triangle inequality of the effective resistance between the seeds and the query node. Finally, we have proposed a new interpretation of the Power Watershed potentials for β = 2 and α → ∞: They are given as the probabilities of the Probabilistic Watershed when the latter is restricted to mSFs instead of all spanning forests. A mSF can also be seen as a union of minimax paths between the vertices [37]. Recently, [13] showed that the Power Watershed assigns a query node q to the seed to which the minimax path from q has the lowest maximum edge cost. In future work, we hope to extend this path-related point of view to an intuitive understanding of the Power Watershed. We are currently working on an extension of the Probabilistic Watershed framework to directed graphs, by means of the generalization of the MTT to directed graphs [47]. Here, one samples directed spanning forests with the seeds as sinks to segment the unlabelled nodes. This might lead to a new practical algorithm for semi-supervised learning on directed graphs such as social / citation or Web networks and could be related to directed random walks. 9 Acknowledgements The authors would like to thank Prof. Marco Saerens for his profound and constructive comments as well as the anonymous reviewers for their helpful remarks. We would like to express our gratitude to Lorenzo Cerrone, who also shared the edge weights of [11], and Laurent Najman for the useful discussions about the Random Walker and Power Watershed algorithms, respectively. We also acknowledge partial financial support of the DFG under grant No. DFG HA-4364 8-1. References [1] C. Allène, J. Y. Audibert, M. Couprie, J. Cousty, and R. Keriven. Some links between min-cuts, optimal spanning forests and watersheds. In Proceedings of the 8th International Symposium on Mathematical Morphology, pages 253 -- 264, 2007. [2] J. Angulo and D. Jeulin. Stochastic watershed segmentation. In Proceedings of the 8th International Symposium on Mathematical Morphology, pages 265 -- 276, 2007. [3] M. Bai and R. Urtasun. Deep watershed transform for instance segmentation. CVPR, pages 2858 -- 2866, 2017. [4] T. Beier, C. Pape, N. Rahaman, T. Prange, S. Berg, D. D. Bock, A. Cardona, G. W. Knott, S. M. Plaza, L. K. Scheffer, U. Koethe, A. Kreshuk, and F. A. Hamprecht. Multicut brings automated neurite segmentation closer to human performance. Nature Methods, 14(2):101 -- 102, January 2017. [5] M. Belkin, P. Niyogi, and V. Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. JMLR, 7:2399 -- 2434, 2006. [6] S. Beucher and C. Lantuéjoul. Use of watersheds in contour detection. In International Workshop on Image Processing: Real-time Edge and Motion Detection/Estimation, volume 132, 1979. [7] S. Beucher and F. Meyer. The morphological approach to segmentation: the watershed transfor- mation. Mathematical Morphology in Image Processing, 34:433 -- 481, 1993. [8] N. Biggs. Algebraic potential theory on graphs. Bulletin of the London Mathematical Society, 29:641 -- 682, 1997. [9] N. Bockelmann, D. Krüger, D. F. Wieland, B. Zeller-Plumhoff, N. Peruzzi, S. Galli, R. Willumeit-Römer, F. Wilde, F. Beckmann, J. Hammel, et al. Sparse annotations with random walks for u-net segmentation of biodegradable bone implants in synchrotron microto- mograms. In International Conference on Medical Imaging with Deep Learning -- Extended Abstract Track, 2019. [10] A. E. Brouwer and W. H. Haemers. Spectra of Graphs. Springer, New York, NY, 2012. [11] V. Bui, L.-Y. Hsu, L.-C. Chang, and M. Y. Chen. An automatic random walk based method for 3D segmentation of the heart in cardiac computed tomography images. In ISBI, pages 1352 -- 1355, 2018. [12] L. Cerrone, A. Zeilmann, and F. A. Hamprecht. End-to-end learned random walker for seeded image segmentation. In CVPR, 2019. [13] A. Challa, S. Danda, B. S. D. Sagar, and L. Najman. Watersheds for semi-supervised classifica- tion. IEEE Signal Processing Letters, 26:720 -- 724, May 2019. [14] B. Chazelle. A minimum spanning tree algorithm with inverse-ackermann type complexity. J. ACM, 47:1028 -- 1047, November 2000. [15] P. Y. Chebotarev and E. Shamis. The matrix-forest theorem and measuring relations in small social groups1. Automation and Remote Control, 58:1505 -- 1514, 1997. [16] C. Couprie, L. Grady, L. Najman, and H. Talbot. Power watershed: A unifying graph-based optimization framework. IEEE Transactions on Pattern Analysis and Machine Intelligence, 33:1384 -- 1399, 2011. [17] M. Couprie, L. Najman, and G. Bertrand. Quasi-linear algorithms for the topological watershed. Journal of Mathematical Imaging and Vision, 22:231 -- 249, 2005. 10 [18] J. Cousty, G. Bertrand, L. Najman, and M. Couprie. Watershed cuts: Minimum spanning forests and the drop of water principle. IEEE Transactions on Pattern Analysis and Machine Intelligence, 31:1362 -- 74, 2009. [19] CREMI. Miccai challenge on circuit reconstruction from electron microscopy images, 2017. https://cremi.org. [20] A. Criminisi, T. Sharp, and A. Blake. Geos: Geodesic image segmentation. In ECCV, pages 99 -- 112. Springer, 2008. [21] M. Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In NIPS, pages 2292 -- 2300, 2013. [22] S. E. N. Fernandes and J. P. Papa. Improving optimum-path forest learning using bag-of- classifiers and confidence measures. Pattern Analysis and Applications, 22:703 -- 716, 2019. [23] S. E. N. Fernandes, D. R. Pereira, C. C. O. Ramos, A. N. Souza, D. S. Gastaldello, and J. P. Papa. A probabilistic optimum-path forest classifier for non-technical losses detection. IEEE Transactions on Smart Grid, 10:3226 -- 3235, 2019. [24] F. Fouss, M. Saerens, and M. Shimbo. Algorithms and Models for Network Data and Link Analysis. Cambridge University Press, New York, NY, USA, 1st edition, 2016. [25] K. Françoisse, I. Kivimäki, A. Mantrach, F. Rossi, and M. Saerens. A bag-of-paths framework for network data analysis. Neural Networks, 90:90 -- 111, 2017. [26] S. O. Gharan. Recent developments in approximation algorithms: Lecture 1 and 2: Ran- dom spanning trees. https://homes.cs.washington.edu/~shayan/courses/cse599/ index.html, 2015. [27] A. Ghosh, S. Boyd, and A. Saberi. Minimizing effective resistance of a graph. SIAM Rev., 50:37 -- 66, 2008. [28] L. Grady. Random walks for image segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2006. [29] L. J. Grady and J. R. Polimeni. Discrete Calculus. Springer, London, 2010. [30] D. A. Harville. Matrix Algebra From a Statistician's Perspective. Springer-Verlag New York, 1997. [31] K.-H. Kim and S. Choi. Label propagation through minimax paths for scalable semi-supervised learning. Pattern Recognition Letters, 45:17 -- 25, 2014. [32] G. Kirchhoff. Über die Auflösung der Gleichungen, auf welche man bei der Untersuchung der linearen Vertheilung galvanischer Ströme geführt wird. Annalen der Physik, 148:497 -- 508, 1847. [33] I. Kivimäki, M. Shimbo, and M. Saerens. Developments in the theory of randomized shortest paths with a comparison of graph node distances. Physica A: Statistical Mechanics and its Applications, 393:600 -- 616, 2014. [34] T. K. Koo, A. Globerson, X. Carreras, and M. Collins. Structured prediction models via the matrix-tree theorem. In EMNLP-CoNLL, 2007. [35] J. B. Kruskal. On the Shortest Spanning Subtree of a Graph and the Traveling Salesman Problem. In Proceedings of the American Mathematical Society, 7, 1956. [36] Z. Liu, Y. Song, C. Maere, Q. Liu, Y. Zhu, H. Lu, and D. Yuan. A method for PET-CT lung cancer segmentation based on improved random walk. 24th International Conference on Pattern Recognition (ICPR), pages 1187 -- 1192, 2018. [37] B. M. Maggs and S. A. Plotkin. Minimum-cost spanning tree as a path-finding problem. Information Processing Letters, 26:291 -- 293, 1988. [38] F. Malmberg and C. L. L. Hendriks. An efficient algorithm for exact evaluation of stochas- tic watersheds. Pattern Recognition Letters, 47:80 -- 84, 2014. Advances in Mathematical Morphology. [39] A. Mensch and M. Blondel. Differentiable dynamic programming for structured prediction and attention. In ICML, 2018. [40] J. Öfverstedt, J. Lindblad, and N. Sladoje. Stochastic distance transform. In International Conference on Discrete Geometry for Computer Imagery, pages 75 -- 86. Springer, 2019. 11 [41] C. Rao and S. Mitra. Generalized Inverse of Matrices and Its Applications. John Wiley and Sons, 1971. [42] M. Senelle, S. García-Díez, A. Mantrach, M. Shimbo, M. Saerens, and F. Fouss. The sum- over-forests density index: Identifying dense regions in a graph. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36:1268 -- 1274, 2014. [43] C. Straehle, U. Koethe, G. Knott, K. Briggman, W. Denk, and F. A. Hamprecht. Seeded watershed cut uncertainty estimators for guided interactive segmentation. In CVPR, pages 765 -- 772, 2012. [44] A. Teixeira, P. Monteiro, J. Carriço, M. Ramirez, and A. Francisco. Spanning edge betweenness. In Workshop on Mining and Learning with Graphs, volume 24, pages 27 -- 31, January 2013. [45] A. Teixeira, P. Monteiro, J. Carriço, M. Ramirez, and A. P. Francisco. Not seeing the forest for the trees: Size of the minimum spanning trees (msts) forest and branch significance in mst-based phylogenetic analysis. PLOS ONE, 10, 2015. [46] F.-S. Tsen, T.-Y. Sung, M.-Y. Lin, L.-H. Hsu, and W. Myrvold. Finding the most vital edge with respect to the number of spanning trees. IEEE Transactions on Reliability, 43:600 -- 602, 1994. [47] W. T. Tutte. Graph theory. Encyclopedia of mathematics and its applications. Addison-Wesley, 1984. [48] W.-J. Tzeng and F. Wu. Spanning trees on hypercubic lattices and nonorientable surfaces. Applied Mathematics Letters, 13(7):19 -- 25, 2000. [49] P. Vernaza and M. Chandraker. Learning random-walk label propagation for weakly-supervised semantic segmentation. In CVPR, pages 7158 -- 7166, 2017. [50] G. Winkler. Image analysis, random fields and Markov chain Monte Carlo methods: a mathematical introduction, volume 27. Springer Science & Business Media, 2012. [51] S. Wolf, L. Schott, U. Köthe, and F. A. Hamprecht. Learned watershed: End-to-end learning of seeded segmentation. ICCV, pages 2030 -- 2038, 2017. [52] D. Zhou, O. Bousquet, T. N. Lal, J. Weston, and B. Schölkopf. Learning with local and global consistency. In NIPS, pages 321 -- 328, 2004. [53] X. Zhu, Z. Ghahramani, and J. Lafferty. Semi-supervised learning using gaussian fields and harmonic functions. In ICML, pages 912 -- 919, 2003. A Calculus of w (F v u) In this appendix we will focus on the calculation of w(F v u ) for any nodes u, v ∈ V . We will prove Lemma 2.2 (here denoted Lemma A.5). In order to demonstrate it we will use the matrix tree theorem (MTT) and some previous results. To deduce some results we will use multigraphs. The Laplacian of a multigraph is slightly different from the Laplacian of a simple graph. We introduce the following definition. Definition A.1 (Laplacian of a multigraph). Let G be a multigraph. The Laplacian LG has the following formula where E(u,v) ⊂ EG is the subset of edges incident to u and v. If there are no edges incident to u and v the sum is considered equal to 0. Since the MTT is crucial in our theory we recall it. Theorem A.1 (Matrix tree theorem (MTT)). For any weighted multigraph G the sum of the weights of the spanning trees of G, w(T ) :=(cid:80) t∈T (cid:81) w(e), is equal to e∈Et V λ2 ··· λV = 1 V det(L + 1 1 V 11(cid:62)), w(T ) = det(L[v]) = where L[v] is the matrix obtained from the Laplacian, L, after removing the row and column corresponding to an arbitrary but fixed node v, {λi}i≥1 are the eigenvalues of L with λ1 = 0 and 1 the corresponding eigenvector, the column vector of 1's. 12 (cid:0)LG (cid:1) uv := (cid:40)(cid:80) (cid:80) (cid:80) ¯e∈E(u,v) −wG k∈V k(cid:54)=u (cid:0)¯e(cid:1) ¯e∈E(u,k) wG (cid:0)¯e(cid:1) if u (cid:54)= v if u = v , Proof. We will only prove the third equality. The first equality can be found in [47]. The second equality can be found in chapter 1 of [10] for non-weighted graphs, but the reasoning of the proof is equivalent for weighted graphs. The proof of the third equality is Theorem 1.6 in [26], but since it has some typos we preferred to prove it by means of the second equality. In order to demonstrate the third equality we will show that λ2 ··· λV = det(L + 1 V 11(cid:62)). (12) Let λi for i = 1, . . . ,V be the eigenvalues of L + 1V 11(cid:62). Since the determinant of a matrix is the product of its eigenvalues we obtain det(L + 1 V 11(cid:62)) = λ1 ··· λV . We will show that one of the λi's, say λ1, is one and that {λ2, . . . , λV } = {λ2, . . . , λV } which establishes equation (12). The first eigenvalue of the Laplacian L is λ1 = 0 whose eigenvector is 1, since the elements of every row of L sum to 1. We prove now that 1 is an eigenvector of L + 1V 11(cid:62) with eigenvalue equal to 1. (L + 1 V 11(cid:62))1 = L1(cid:124)(cid:123)(cid:122)(cid:125) =0 1 V 1 1(cid:62)1(cid:124)(cid:123)(cid:122)(cid:125) =V + = 1 Therefore, we get λ1 = 1. Since L + 1V 11(cid:62) is symmetric, we can find an orthogonal basis of eigenvectors of L + 1V 11(cid:62) containing 1. Let xi be an element of that basis associated with λi for i ≥ 2. By the orthogonality of 1 and xi, we get (L + 1 V 11(cid:62))xi = Lxi + 1 (cid:124)(cid:123)(cid:122)(cid:125) V 1 1(cid:62)xi =0 = λixi Therefore λi for i ≥ 2 is also an eigenvalue of L + 1V 11(cid:62) and the theorem is proven. Lemma A.2 (Determinant Lemma). Given an invertible matrix A ∈ Rm×m and u, v ∈ Rm then: det(A + uv(cid:62)) = det(A)(1 + v(cid:62)A−1u) Proof. See [30]. Lemma A.3. Let L+ be the pseudo-inverse of the Laplacian, then (cid:18) (cid:19)−1 − 11(cid:62) V , 11(cid:62) V L+ = L + where 1 is the column vector of 1s. (cid:16) (cid:17)−1 Proof. On page 48 of [24] the same argument as in the proof of Theorem A.1 is applied. L + 11(cid:62) and L+ have the same eigenvectors and eigenvalues except for λ1 = 1 whose V corresponding eigenvalue of L+ is λ1 = 0. By subtracting 11(cid:62) the eigenvalue λ1 is modified and becomes 0. Hence both matrices are equal since they have the same spectral decomposition . See chapter 10 in [41] for more details. Before proving the next result we need to introduce some notation. Let ¯e = {u, v} ⊂ V be an edge not necessarily included in E. Let G¯e be the graph formed from G after adding the edge ¯e, L + 11(cid:62) V (cid:17)−1 V from (cid:16) 13 i.e. G¯e = (V, E (cid:116) {¯e}), where (cid:116) denotes the disjoint union3. The use of the disjoint union permits distinguishing between the added edge and the ones originally present in the graph. Therefore G¯e may be a multigraph. The following lemma explains why we need to consider G¯e as a multigraph. Lemma A.4. Let G = (VG, EG, wG) be a weighted graph and consider G¯e = (VG, EG (cid:116) {¯e}, w) for some ¯e = {u, v} ⊂ V , where w(e) = wG(e) for all e ∈ EG and w(¯e) an arbitrary positive number. We will omit the subscript of wG without risk of confusion. Then w(TG¯e) − w(TG) w (F v u ) = w(¯e) , where TG¯e and TG denote the set of spanning trees of G¯e and G respectively. Proof. The key idea of the proof is the fact that TG¯e can be partitioned in the set of trees that do not contain the edge ¯e (which is equal to TG since G did not contain ¯e) and the ones that do contain the edge ¯e. Let us denote the second set T ¯e := {t ∈ TG¯e : ¯e ∈ Et}. Recall that ¯e is considered as a special edge even if there was already an edge e = {u, v} contained in the graph G. If e and ¯e where considered as the same edge, then the set of trees not containing ¯e would not be equal to TG, since e belongs to some trees in TG. Therefore we need to consider G¯e as a multigraph. u since any tree t ∈ T ¯e forms a 2-forest f ∈ F v Note that there is a bijection between T ¯e and F v u after u forms a tree in t ∈ T ¯e after adding ¯e (see p.652 in removing ¯e from t, and vice versa, any f ∈ F v [8]). Moreover, w(¯e) · w(f ) = w(t) since the only edge present in t but not in f is ¯e. Therefore, we (cid:88) obtain (cid:88) (cid:88) w(t) = w(t) + w(t) = w(¯e) w(TG¯e) = w(t) w(¯e) + w(TG) t∈TG¯e = w(¯e) t∈T ¯e t∈TG w(f ) + w(TG) = w(¯e)w(F v (cid:88) f∈F v u (cid:88) t∈T ¯e u ) + w(TG). u ) we get the desired result. Isolating w(F v Lemma A.5 (Lemma 2.2). Let G = (V, E, w) be an undirected edge-weighted connected graph and u, v ∈ V arbitrary vertices. (a) Let (cid:96)+ ij denote the entry ij of the pseudo-inverse of the Laplacian of G, L+ G, then u ) = w(T )(cid:0)(cid:96)+ w(F v uu + (cid:96)+ (cid:1) . (b) If (cid:96) −1,[r] ij denotes the entry ij of the inverse of the matrix L[r] (the Laplacian L after removing the row and the column corresponding to node r), then uv vv − 2(cid:96)+ (cid:17) −1,[r] vv − 2(cid:96) −1,[r] uv (cid:16) w(T ) w(T )(cid:96) w(T )(cid:96) −1,[r] uu + (cid:96) (cid:96) −1,[v] uu −1,[u] vv w(F v u ) = (13) (14) if r (cid:54)= u, v if r = v and u (cid:54)= v if r = u and u (cid:54)= v. (15) Proof. We apply the matrix tree theorem (Theorem A.1) in combination with Lemma A.2, Lemma A.3 and Lemma A.4. We will use the following notation LG = LG + 11(cid:62) V . In order to use Lemma A.4 we will use the edge ¯e = {u, v} with w(¯e) = 1. Moreover, let us denote b¯e = 1u − 1v where 1v indicates the column v of the identity matrix. Since the difference between G and G¯e is just the edge ¯e with w(¯e) = 1, we can write the following relation between the Laplacians of G and G¯e 3Given a family of sets {Ai : i ∈ I} the disjoint union is defined as(cid:70) LG¯e = LG + b¯eb(cid:62) ¯e . i∈I Ai =(cid:83) i∈I {(x, i) : x ∈ Ai}. 14 Therefore, we may write w(F v w(TG¯e ) − w(TG) (cid:16) (cid:18) 1 V det( LG) 1 V det( LG) w(TG)(cid:0)(cid:96)+ uu + (cid:96)+ (cid:18) =(cid:124)(cid:123)(cid:122)(cid:125)MTT Theorem A.1 1 + b(cid:62) ¯e L−1 G b¯e ¯e b(cid:62) L+ + vv − 2(cid:96)+ uv (cid:1) Lemma A.4 u ) =(cid:124)(cid:123)(cid:122)(cid:125) =(cid:124)(cid:123)(cid:122)(cid:125) =(cid:124)(cid:123)(cid:122)(cid:125) =(cid:124)(cid:123)(cid:122)(cid:125)MTT Lemma A.3 Lemma A.2 Theorem A.1 e 1 V det (cid:17) − 1 (cid:16) LG + beb(cid:62) (cid:124) (cid:123)(cid:122) (cid:125) (cid:17) − 1 (cid:19) (cid:19) V det( LG) = V det( LG)(cid:0)(cid:96)+ LG¯e b¯e = 1 11(cid:62) V V det( LG) (cid:16) 1 V det( LG) b(cid:62) ¯e L−1 G b¯e uu + (cid:96)+ vv − 2(cid:96)+ uv (cid:17) (cid:1) The second statement can be deduced from equation (3) in the main paper. Still we show how it can be computed by following a similar argument as in the previous case. Let r (cid:54)= u, v. L[r] G + b[r] e b[r] e − det(L[r] G ) (cid:16) (cid:123)(cid:122) (cid:19) (cid:17)(cid:62) (cid:125) L[r] G¯e − det(L[r] G ) (cid:17) . (cid:16) uu + (cid:96)−1,[r] (cid:96)−1,[r] (cid:17)(cid:62) (cid:16) (cid:125) (cid:19) 1[u] v (cid:123)(cid:122) − det(L[u] G ) G + 1[u] L[u] v (cid:19) L[u] Ge − det(L[u] 1 + 1[u] v L[u] G 1[u] v G ) = det(L[u] G )(cid:96)−1,[u] vv = det(L[r] G ) (cid:96)−1,[r] uu + (cid:96)−1,[r] = w(TG) vv − 2(cid:96)−1,[r] uv (cid:19) b[r] ¯e Theorem A.1 (cid:18) (cid:17)−1 det b[r] ¯e L[r] G =(cid:124)(cid:123)(cid:122)(cid:125)MTT (cid:17)(cid:62)(cid:16) (cid:124) (cid:17) vv − 2(cid:96)−1,[r] (cid:18) (cid:124) (cid:17)−1 =(cid:124)(cid:123)(cid:122)(cid:125)MTT (cid:17)(cid:62)(cid:16) Theorem A.1 det uv w(F v Lemma A.4 u ) =(cid:124)(cid:123)(cid:122)(cid:125) =(cid:124)(cid:123)(cid:122)(cid:125) Lemma A.2 w(TG¯e ) − w(TG) (cid:16) (cid:18) det(L[r] G ) 1 + (cid:16) For r = u the proof is the following: w(F v Lemma A.4 u ) =(cid:124)(cid:123)(cid:122)(cid:125) =(cid:124)(cid:123)(cid:122)(cid:125) w(TG¯e ) − w(TG) (cid:16) (cid:18) Lemma A.2 det(L[u] G ) = w(TG)(cid:96)−1,[u] vv . The case r = v is analogous. B Proof of Theorem 4.1 Theorem B.1 (Theorem 4.1). The probability xs1 q that a random walker as defined in [28] starting at node q reaches s1 first before reaching s2 is equal to the Probabilistic Watershed probability defined in Definition 3.1 of the main paper: q = P (q ∼ s1). xs1 Proof. If we write the probability in terms of the inverse of L[s2] (Lemma 2.2, equation 2 of the main paper) we find: s1 s2 = (cid:96)−1,[s2] + (cid:96)−1,[s2] ) − w(F q −(cid:16) ) + w(F s2 (cid:96)−1,[s2] P (q ∼ s1) =(cid:0)w(F q )(cid:1)(cid:14)(cid:0)2w(F s2 )(cid:1) (cid:17)(cid:17)(cid:14)(cid:16) (cid:16) column s1 of(cid:0)L[s2](cid:1)−1. Solving the following linear system: (cid:14)(cid:96)−1,[s2] L[s2](cid:17)−1 (cid:14)(cid:96)−1,[s2] − 2(cid:96)−1,[s2] + (cid:96)−1,[s2] ⇐⇒ y = L[s2]y = 1s1 (cid:16) 1s1 s1s1 s1s1 qs1 s1 s1 s1s1 s1s1 qq . (16) Therefore, to calculate the probabilities for P (q ∼ s1) for every q we only need to compute the s1s1 s1s1 qs1 qq 2(cid:96)−1,[s2] = (cid:96)−1,[s2] (cid:16) L[s2](cid:17)−1 ·,s1 (cid:14)(cid:96)−1,[s2] s1s1 = (cid:14)(cid:96)−1,[s2] , (17) (cid:17) 15 where 1u denotes the column u of the identity matrix, we have that y is the vector formed by the elements in the right hand side of (16). Let us assume without loss of generality that the row corresponding to the seed s1 is the first one, then we can express equation (17) block-wise : (cid:18) Ls1s1 B(cid:62) Bs1 s1 LU (cid:19) (cid:19)(cid:18) ys1 yU (cid:18) Ls1s1ys1 + B(cid:62) yU Bs1ys1 + LU yU s1 (cid:19) = 1/(cid:96) −1,[s2] s1s1 0 (cid:18) = , (18) (cid:19) where Ls1s1 is the entry s1s1 of the Laplacian L[s2], Bs1 is the row s1 of this Laplacian without considering the element in the diagonal and LU are the rows and columns of the unseeded vertices. Since ys1 = P (s1 ∼ s1) = 1, we obtain the following linear system of equations LU yU = −Bs1 , which is the same linear system that the Random Walker solves ([28] section III.B, equation (10)). Therefore P (q ∼ s1) = yq = xs1 q for all q. C Power Watershed In this section we recall some definitions of [16]. Let G = (V, E, w) be an undirected edge-weighted graph and s1, s2 ∈ V two seeds as it has been considered in the main paper. In [16] the following objective function is proposed: (w(e))α (xv − xu)β , s.t. xs1 = 1, xs2 = 0. (19) (cid:88) x∗ = arg min x e=(v,u)∈E This objective generalizes a set of segmentation algorithms depending on the choice of parameters α and β. For instance, α = 1 and β = 2 give the Random Walker's objective function. The Power Watershed algorithm solves (19) when α → ∞. The algorithm is similar to Kruskal's algorithm [35]: a maximum weight spanning forest rooted in the seeds is computed iteratively, but at each plateau (maximal connected subgraphs with constant edge-weight) the following optimization problem is solved (cid:88) xu − xvβ. min x (u,v)∈E (20) In case that β = 2 this is equivalent to apply the Random Walker on the plateau. D Proof of Theorem 5.1 Theorem D.1 (Theorem 5.1). Given two seeds s1 and s2, let us denote the potential of node q being assigned to seed s1 by the Power Watershed with β = 2 as xPW w(f ). Then . Let further wmax be maxf∈F s2 s1 q (cid:12)(cid:12){f ∈ F s2 {f ∈ F s2 s1,q : w(f ) = wmax}(cid:12)(cid:12) : w(f ) = wmax} =: P∞(q ∼ s1). s1 xPW q = Proof. It has already been proven in Theorem 3 of [16] that the potential computed by the algorithm of the Power Watershed is equal to the limit of the Random Walker probabilities when the weights are raised to α → ∞. Since the Probabilistic Watershed probabilities are the same as the Random Walker probabilities (see Section 4), we just need to show that the limit of the Probabilistic Watershed with the weights raised to α → ∞ is counting MSFs. Pα(q ∼ s1) := f∈F s2 s1,q (cid:88) (cid:88) (cid:89) (cid:89) e∈f f∈F s2 s1 e∈f (cid:88) (cid:88) f∈F s2 s1 ,q = f∈F s2 s1 w(e)α w(f )α w(e)α w(f )α (cid:88) (cid:88) (cid:19)α (cid:18) w(f ) (cid:19)α (cid:18) w(f ) wmax f∈F s2 s1,q = f∈F s2 s1 wmax α→∞−−−−→ ((cid:63)) P∞(q ∼ s1). In ((cid:63)) we used the fact that w(f ) wmax fraction (w(f )/wmax)α does not tend to 0, but to 1. Thus, we are counting MSFs. (21) < 1 ⇐⇒ w(f ) (cid:54)= wmax. When α → ∞, only for the MSFs the 16 s2 10−2 0 s2 s2 0 10−3 s3 s3 s3 s1 8 · 10−4 q 10−1 s1 0 s4 (a) Graph with four seeds s2 s1 q s4 s1 q s4 (c) µ = 10 s3 q s4 (b) µ = 0 s2 s3 s1 q s4 (d) µ = 100 (e) µ → ∞, Watershed Figure 6: Effect of the inverse temperature µ on Probabilistic Watershed solutions. (6a) shows a graph with 4 seeds and edge costs, c(e). All paths from the query node q to a seed si have the same cost (only indicated once per seed). (6b) - (6d) show the Probabilistic Watershed's segmentation for edge weights exp(−µ c(e)). As µ grows, q's assignment changes from a weight-independent (maximum entropy) one over two Random Walker assignments to the Watershed assignment (lowest entropy). E Effect of the entropy on the Probabilistic Watershed Figure 6 illustrates how the forest distribution's entropy interpolates between (Power) Watershed and Probabilistic Watershed / Random Walker with decreasing sensitivity to edge-costs. F Edge and node probabilities in the Power Watershed In this chapter, we elaborate the minimum spanning forest (mSF) counting interpretation of the Power Watershed. Figure 7 shows a graph G with a single plateau P , a maximal connected subgraph of constant edge-cost c. To simplify our exposition, we made sure that there is exactly one path with maximum cost below c from each seed to P . The nodes at the end of these paths are called p1 and p2, respectively. We illustrate the mSF-counting nature of the Power Watershed both on nodes and on edges. In Figure 7a, we show the probability of an edge being present in a mSF. Outside the plateau, the edges are either part of every or of no mSF. All mSFs agree on these edges. They can be found by a variant of Kruskal's greedy algorithm which iteratively adds edges of minimal cost, while avoiding cycles and connections between the two seeds. Therefore, the edges outside the plateau are only black or white in Figure 7a. On the plateau all spanning forests have the same, minimal cost. Here, Power Watershed performs the Random Walker, or - in our forest-framework - counts spanning forests. Therefore, the edges on P typically have a probability of being present in a mSF strictly between 0 and 1. Note that the final segmentation can be read-off from the edge probabilities in Figure 7a outside the plateau (as in each mSF in our example every node outside the plateau can be reached from a seed without entering the plateau) but not on the plateau without the node potentials. In Figures 7b-7d, we show how likely an edge is connected to either of the seeds in a mSF. Again, all the edges outside the plateau are either always connected to the same seed in all mSFs or never part of any mSF. In the latter case, the conditional probability in 7b is not defined; we colored them white, which corresponds to the uninformed probability of 0.5 for ease of presentation. The closer an edge of P is to the node p1, where the subtree of s1 connects to the plateau, the higher its probability to be connected to s1 among the mSFs that contain this edge (Figure 7b) and also among all mSFs (Figure 17 (a) P (node ∼ s1) and P (edge ∈ some mSF) (b) P (node ∼ s1) and P (edge ∼ s1edge ∈ some msF) (c) P (node ∼ s1) and P (edge ∼ s1, edge ∈ some mSF) (d) P (node ∼ s2) and P (edge ∼ s2, edge ∈ some mSF) Figure 7: Power Watershed result on a grid graph with seeds s1, s2 and with random edge-costs outside a plateau of edges with the same cost (wide edges). By the results in Theorem 5.1, the Power Watershed counts mSFs. This is illustrated with both the node- and edge-colors. (7a-7d) The nodes are colored by their probability of belonging to seed s1 (s2), i.e. by the share of mSFs that connect a given node to s1 (s2). (7a) The edge-color indicates the share of mSFs in which the edge is present. (7b) The edge-color indicates the share of mSFs in which the edge is connected to seed s1 among the mSFs that contain the edge. (7c - 7d) The edge-color indicates the share of mSFs in which the edge is connected to s1 or s2, respectively, among all mSFs. 7c). The same holds for s2 in Figures 7b and 7d. Note that in both Figure 7c and Figure 7d the color intensity of every edge e = {u, v} is at most as high as that of u or v. This is because whenever e is connected to some seed in a mSF f, both u and v are connected to that seed in f, too. We computed the probability of an edge being present in a spanning forest on the plateau by the generalization of the MTT in Lemma 1.9 of [26], see also Theorem 2 of [44] for a version on unweighted graphs. Then for each edge e = {u, v} on P , we merged u and v into a new node qe, thus obtaining a minor Pe of P . On Pe in turn, we computed the Probabilistic Watershed probabilities PPe (p1 ∼ qe), hence finding the share of 2-forests in Pe isolating p1 and p2 that connect qe to p1. This is nothing but the share of 2-forests in P separating p1 and p2 that contain e and connect it to p1 among the 2-forests separating p1 and p2 that contain e. Multiplying this with the probability that an edge is part of any mSF gives the share of mSFs in G, which contain e and connected it to s1, among all mSFs separating s1 and s2. G Rough lower bound for the number of forests in a grid graph In this chapter we derive a rough lower bound on the number of spanning forests that separate k given seeds in a two-dimensional grid graph. We refer to these forests as "k-forests". If there is some 18 s1s2p1p20.00.20.40.60.81.00.00.20.40.60.81.0s1s2p1p20.00.20.40.60.81.0s1s2p1p20.00.20.40.60.81.0s1s2p1p20.00.20.40.60.81.0 n × m subgrid without any seeds then the number of k-forests is at least as large as the number of spanning trees in the subgrid. This is because there are k-forests in which all nodes in the subgrid belong the tree of some of the seeds. We can compute the number of spanning trees NT in a grid graph with n rows and m columns by the closed-form formula (see [48] Theorem 1): NT (n, m) = 2nm−1 nm (cid:18) · (cid:89) i=0,...,n−1, j=0,...,m−1, (i,j)(cid:54)=(0,0) (cid:18) iπ (cid:19) n (cid:18) jπ (cid:19)(cid:19) m 2 − cos − cos (22) The image in Figure 2 of the main paper has a seed-free part of size 87 × 272, see Figure 8 below. This yields the following lower bound for the number of 13-forests separating the 13 seeds: NT (87, 272) ≈ 1011847 (23) Figure 8: The shaded region was used to obtain a rough lower bound on the number of forests separating the seeds. There are about 1011847 spanning trees in the grid graph that corresponds to the shaded region and hence at least as many forests in the whole graph which separate the seeds. 19
1504.06647
2
1504
2015-09-10T14:59:37
Approximating LZ77 via Small-Space Multiple-Pattern Matching
[ "cs.DS" ]
We generalize Karp-Rabin string matching to handle multiple patterns in $\mathcal{O}(n \log n + m)$ time and $\mathcal{O}(s)$ space, where $n$ is the length of the text and $m$ is the total length of the $s$ patterns, returning correct answers with high probability. As a prime application of our algorithm, we show how to approximate the LZ77 parse of a string of length $n$. If the optimal parse consists of $z$ phrases, using only $\mathcal{O}(z)$ working space we can return a parse consisting of at most $(1+\varepsilon)z$ phrases in $\mathcal{O}(\varepsilon^{-1}n\log n)$ time, for any $\varepsilon\in (0,1]$. As previous quasilinear-time algorithms for LZ77 use $\Omega(n/\textrm{polylog }n)$ space, but $z$ can be exponentially small in $n$, these improvements in space are substantial.
cs.DS
cs
Approximating LZ77 via Small-Space Multiple-Pattern Matching Johannes Fischer∗1, Travis Gagie2, Pawe(cid:32)l Gawrychowski†3, and Tomasz Kociumaka‡3 2Helsinki Institute for Information Technology (HIIT), Department of Computer Science, 1TU Dortmund, Germany [email protected] 3Institute of Informatics, University of Warsaw, Poland University of Helsinki, Finland [email protected] {gawry,kociumaka}@mimuw.edu.pl November 5, 2018 Abstract We generalize Karp-Rabin string matching to handle multiple patterns in O(n log n + m) time and O(s) space, where n is the length of the text and m is the total length of the s patterns, returning correct answers with high probability. As a prime application of our algorithm, we show how to approximate the LZ77 parse of a string of length n. If the optimal parse consists of z phrases, using only O(z) working space we can return a parse consisting of at most (1+ε)z phrases in O(ε−1n log n) time, for any ε ∈ (0, 1]. As previous quasilinear-time algorithms for LZ77 use Ω(n/poly log n) space, but z can be exponentially small in n, these improvements in space are substantial. 1 Introduction Multiple-pattern matching, the task of locating the occurrences of s patterns of total length m in a single text of length n, is a fundamental problem in the field of string algorithms. The algorithm by Aho and Corasick [2] solves this problem using O(n+m) time and O(m) working space in addition to the space needed for the text and patterns. To list all occ occurrences rather than, e.g., the leftmost ones, extra O(occ) time is necessary. When the space is limited, we can use a compressed Aho-Corasick automaton [11]. In extreme cases, one could apply a linear-time constant-space single-pattern matching algorithm sequentially for each pattern in turn, at the cost of increasing the running time to O(n · s + m). Well-known examples of such algorithms include those by Galil and Seiferas [8], Crochemore and Perrin [5], and Karp and Rabin [13] (see [3] for a recent survey). It is easy to generalize Karp-Rabin matching to handle multiple patterns in O(n + m) expected time and O(s) working space provided that all patterns are of the same length [10]. To do this, we store the fingerprints of the patterns in a hash table, and then slide a window over the text maintaining the fingerprint of the fragment currently in the window. The hash table lets us check if the fragment is an occurrence of a pattern. If so, we report it and update the hash table so that every pattern is returned at most once. This is a very ∗Supported by Academy of Finland grant 268324. †Work done while the author held a post-doctoral position at Warsaw Center of Mathematics and Computer Science. ‡Supported by Polish budget funds for science in 2013-2017 as a research project under the 'Diamond Grant' program. 1 simple and actually applied idea [1], but it is not clear how to extend it for patterns with many distinct lengths. In this paper we develop a dictionary matching algorithm which works for any set of patterns in O(n log n + m) time and O(s) working space, assuming that read-only random access to the text and the patterns is available. If required, we can compute for every pattern its longest prefix occurring in the text, also in O(n log n + m) time and O(s) working space. In a very recent independent work Clifford et al. [4] gave a dictionary matching algorithm in the streaming model. In this setting the patterns and later the text are scanned once only (as opposed to read-only random access) and an occurrence needs to be reported immediately after its last character is read. Their algorithm uses O(s log (cid:96)) space and takes O(log log(s + (cid:96))) time per character where (cid:96) is the length of the longest s ≤ (cid:96) ≤ m). Even though some of the ideas used in both results are similar, one should note that pattern ( m the streaming and read-only models are quite different. In particular, computing the longest prefix occurring in the text for every pattern requires Ω(m log min(n,Σ)) bits of space in the streaming model, as opposed to the O(s) working space achieved by our solution in the read-only setting. As a prime application of our dictionary matching algorithm, we show how to approximate the Lempel- Ziv 77 (LZ77) parse [18] of a text of length n using working space proportional to the number of phrases (again, we assume read-only random access to the text). Computing the LZ77 parse in small space is an issue of high importance, with space being a frequent bottleneck of today's systems. Moreover, LZ77 is useful not only for data compression, but also as a way to speed up algorithms [15]. We present a general approximation algorithm working in O(z) space for inputs admitting LZ77 parsing with z phrases. For any ε ∈ (0, 1], the algorithm can be used to produce a parse consisting of (1 + ε)z phrases in O(ε−1n log n) time. To the best of our knowledge, approximating LZ77 factorization in small space has not been considered before, and our algorithm is significantly more efficient than methods producing the exact answer. A recent sublinear-space algorithm, due to Karkkainen et al. [12], runs in O(nd) time and uses O(n/d) space, for any parameter d. An earlier online solution by Gasieniec et al. [9] uses O(z) space and takes O(z2 log2 z) time for each character appended. Other previous methods use significantly more space when the parse is small relative to n; see [7] for a recent discussion. Structure of the paper. Sect. 2 introduces terminology and recalls several known concepts. This is followed by the description of our dictionary matching algorithm. In Sect. 3 we show how to process patterns of length at most s and in Sect. 4 we handle longer patterns, with different procedures for repetitive and non-repetitive ones. In Sect. 5 we extend the algorithm to compute, for every pattern, the longest prefix occurring in the text. Finally, in Sect. 7, we apply the dictionary matching algorithm to construct an approximation of the LZ77 parsing, and in Sect. 6 we explain how to modify the algorithms to make them Las Vegas. Model of computation. Our algorithms are designed for the word-RAM with Ω(log n)-bit words and assume integer alphabet of polynomial size. The usage of Karp-Rabin fingerprints makes them Monte Carlo randomized: the correct answer is returned with high probability, i.e., the error probability is inverse polynomial with respect to input size, where the degree of the polynomial can be set arbitrarily large. With some additional effort, our algorithms can be turned into Las Vegas randomized, where the answer is always correct and the time bounds hold with high probability. Throughout the whole paper, we assume read- only random access to the text and the patterns, and we do not include their sizes while measuring space consumption. 2 Preliminaries We consider finite words over an integer alphabet Σ = {0, . . . , σ − 1}, where σ = poly(n + m). For a word w = w[1] . . . w[n] ∈ Σn, we define the length of w as w = n. For 1 ≤ i ≤ j ≤ n, a word u = w[i] . . . w[j] is called a subword of w. By w[i..j] we denote the occurrence of u at position i, called a fragment of w. A fragment with i = 1 is called a prefix and a fragment with j = n is called a suffix. 2 A positive integer p is called a period of w whenever w[i] = w[i + p] for all i = 1, 2, . . . ,w − p. In this case, the prefix w[1..p] is often also called a period of w. The length of the shortest period of a word w is denoted as per(w). A word w is called periodic if per(w) ≤ w 3 . The well-known periodicity lemma [6] says that if p and q are both periods of w, and p + q ≤ w, then gcd(p, q) is also a period of w. We say that word w is primitive if per(w) is not a proper divisor of w. Note that the shortest period w[1.. per(w)] is always primitive. 2 and highly periodic if per(w) ≤ w 2.1 Fingerprints Our randomized construction is based on Karp-Rabin fingerprints; see [13]. Fix a word w[1..n] over an alphabet Σ = {0, . . . , σ−1}, a constant c ≥ 1, a prime number p > max(σ, nc+4), and choose x ∈ Zp uniformly at random. We define the fingerprint of a subword w[i..j] as Φ(w[i..j]) = w[i]+w[i+1]x+. . .+w[j]xj−i mod p. With probability at least 1 − 1 nc , no two distinct subwords of the same length have equal fingerprints. The situation when this happens for some two subwords is called a false-positive. From now on when stating the results we assume that there are no false-positives to avoid repeating that the answers are correct with high probability. For dictionary matching, we assume that no two distinct subwords of w = T P1 . . . Ps have equal fingerprints. Fingerprints let us easily locate many patterns of the same length. A straightforward solution described in the introduction builds a hash table mapping fingerprints to patterns. However, then we can only guarantee that the hash table is constructed correctly with probability 1 − O( 1 sc ) (for an arbitrary constant c), and we would like to bound the error probability by O( (n+m)c ). Hence we replace hash table with a deterministic dictionary as explained below. Although it increases the time by O(s log s), the extra term becomes absorbed in the final complexities. 1 Theorem 1. Given a text T of length n and patterns P1, . . . , Ps, each of length exactly (cid:96), we can compute the the leftmost occurrence of every pattern Pi in T using O(n + s(cid:96) + s log s) total time and O(s) space. Proof. We calculate the fingerprint Φ(Pj) of every pattern. Then we build in O(s log s) time [16] a deter- ministic dictionary D with an entry mapping Φ(Pj) to j. For multiple identical patterns we create just one entry, and at the end we copy the answers to all instances of the pattern. Then we scan the text T with a sliding window of length (cid:96) while maintaining the fingerprint Φ(T [i..i + (cid:96) − 1]) of the current window. Using D, we can find in O(1) time an index j such that Φ(T [i..i + (cid:96) − 1]) = Φ(Pj), if any, and update the answer for Pj if needed (i.e., if there was no occurrence of Pj before). If we precompute x−1, the fingerprints Φ(T [i..i + (cid:96) − 1]) can be updated in O(1) time while increasing i. 2.2 Tries A trie of a collection of strings P1, . . . , Ps is a rooted tree whose nodes correspond to prefixes of the strings. The root represents the empty word and the edges are labeled with single characters. The node corresponding to a particular prefix is called its locus. In a compacted trie unary nodes that do not represent any Pi are dissolved and the labels of their incidents edges are concatenated. The dissolved nodes are called implicit as opposed to the explicit nodes, which remain stored. The locus of a string in a compacted trie might therefore be explicit or implicit. All edges outgoing from the same node are stored on a list sorted according to the first character, which is unique among these edges. The labels of edges of a compacted trie are stored as pointers to the respective fragments of strings Pi. Consequently, a compacted trie can be stored in space proportional to the number of explicit nodes, which is O(s). Consider two compacted tries T1 and T2. We say that (possibly implicit) nodes v1 ∈ T1 and v2 ∈ T2 are twins if they are loci of the same string. Note that every v1 ∈ T1 has at most one twin v2 ∈ T2. Lemma 2. Given two compacted tries T1 and T2 constructed for s1 and s2 strings, respectively, in O(s1 +s2) total time and space we can find for each explicit node v1 ∈ T1 a node v2 ∈ T2 such that if v1 has a twin in T2, then v2 is its twin. (If v1 has no twin in T2, the algorithm returns an arbitrary node v2 ∈ T2). 3 Proof. We recursively traverse both tries while maintaining a pair of nodes v1 ∈ T1 and v2 ∈ T2, starting with the root of T1 and T2 satisfying the following invariant: either v1 and v2 are twins, or v1 has no twin in T2. If v1 is explicit, we store v2 as the candidate for its twin. Next, we list the (possibly implicit) children of v1 and v2 and match them according to the edge labels with a linear scan. We recurse on all pairs of matched children. If both v1 and v2 are implicit, we simply advance to their immediate children. The last step is repeated until we reach an explicit node in at least one of the tries, so we keep it implicit in the implementation to make sure that the total number of operations is O(s1 + s2). If a node v ∈ T1 is not visited during the traversal, for sure it has no twin in T2. Otherwise, we compute a single candidate for its twin. 3 Short Patterns To handle the patterns of length not exceeding a given threshold (cid:96), we first build a compacted trie for those patterns. Construction is easy if the patterns are sorted lexicographically: we insert them one by one into the compacted trie first naively traversing the trie from the root, then potentially partitioning one edge into two parts, and finally adding a leaf if necessary. Thus, the following result suffices to efficiently build the tries. Lemma 3. One can lexicographically sort strings P1, . . . , Ps of total length m in O(m + σε) time using O(s) space, for any constant ε > 0. √ m + σε/2 longest strings and all the remaining strings, and then merge both Proof. We separately sort the sorted lists. Note these longest strings can be found in O(s) time using a linear time selection algorithm. Long strings are sorted using insertion sort. If the longest common prefixes between adjacent (in the sorted order) strings are computed and stored, inserting Pj can be done in O(j + Pj) time. In more detail, let S1, S2, . . . , Sj−1 be the sorted list of already processed strings. We start with k := 1 and keep increasing k by one as long as Sk is lexicographically smaller than Pj while maintaining the longest common prefix between Sk and Pj, denoted (cid:96). After increasing k by one, we update (cid:96) using the longest common prefix between Sk−1 and Sk, denoted (cid:96)(cid:48), as follows. If (cid:96)(cid:48) > (cid:96), we keep (cid:96) unchanged. If (cid:96)(cid:48) = (cid:96), we try to iteratively increase (cid:96) by one as long as possible. In both cases, the new value of (cid:96) allows us to lexicographically compare Sk and Pj in constant time. Finally, (cid:96)(cid:48) < (cid:96) guarantees that Pj < Sk and we may terminate the procedure. m + σε/2)2) = O(m + σε) time. Sorting the m each, and if there are any, then s ≥ σε/2. We sort these strings by iteratively applying radix sort, treating each symbol from Σ as a sequence of 2 ε symbols from {0, 1, . . . , σε/2 − 1}. Then a single radix sort takes time and space proportional to the number of strings involved plus the alphabet size, which is O(s + σε/2) = O(s). Furthermore, because the numbers of strings involved in the subsequent radix sorts sum up to m, the total time complexity is O(m+σε/2√ m) = O(m+σε). Finally, the merging takes time linear in the sum of the lengths of all the involved strings, so the total m + σε/2 longest strings using this approach takes O(m + ( √ √ The remaining strings are of length at most √ complexity is as claimed. Next, we partition T into O( n (cid:96) ) overlapping blocks T1 = T [1..2(cid:96)], T2 = T [(cid:96) + 1..3(cid:96)], T3 = T [2(cid:96) + 1..4(cid:96)], . . .. Notice that each subword of length at most (cid:96) is completely contained in some block. Thus, we can consider every block separately. The suffix tree of each block Ti takes O((cid:96) log (cid:96)) time [17] and O((cid:96)) space to construct and store (the suffix tree is discarded after processing the block). We apply Lemma 2 to the suffix tree and the compacted trie of patterns; this takes O((cid:96) + s) time. For each pattern Pj we obtain a node such that the corresponding subword is equal to Pj provided that Pj occurs in Ti. We compute the leftmost occurrence Ti[b..e] of the subword, which takes constant time if we store additional data at every explicit node of the suffix tree, and then we check whether Ti[b..e] = Pj using fingerprints. For this, we precompute the fingerprints of all patterns, and for each block Ti we precompute the fingerprints of its prefixes in O((cid:96)) time and space, which allows to determine the fingerprint of any of its subwords in constant time. 4 In total, we spend O(m + σε) for preprocessing and O((cid:96) log (cid:96) + s) for each block. Since σ = (n + m)O(1), for small enough ε this yields the following result. Theorem 4. Given a text T of length n and patterns P1, . . . , Ps of total length m, using O(n log (cid:96) + s n (cid:96) + m) total time and O(s + (cid:96)) space we can compute the leftmost occurrences in T of every pattern Pj of length at most (cid:96). 4 Long Patterns 2 To handle patterns longer than a certain threshold, we first distribute them into groups according to the value of (cid:98)log4/3 Pj(cid:99). Patterns longer than the text can be ignored, so there are O(log n) groups. Each group is handled separately, and from now on we consider only patterns Pj satisfying (cid:98)log4/3 Pj(cid:99) = i. We classify the patterns into classes depending on the periodicity of their prefixes and suffixes. We set (cid:96) = (cid:100)(4/3)i(cid:101) and define αj and βj as, respectively, the prefix and the suffix of length (cid:96) of Pj. Since 3 (αj + βj) = 4 3 (cid:96) ≥ Pj, the following fact yields a classification of the patterns into three classes: either Pj is highly periodic, or αj is not highly periodic, or βj is not highly periodic. The intuition behind this classification is that if the prefix or the suffix is not repetitive, then we will not see it many times in a short subword of the text. On the other hand, if both the prefix and suffix are repetitive, then there is some structure that we can take advantage of. Fact 5. Suppose x and y are a prefix and a suffix of a word w, respectively. If x + y ≥ w + p and p is a period of both x and y, then p is a period of w. Proof. We need to prove that w[i] = w[i + p] for all i = 1, 2, . . . ,w − p. If i + p ≤ x this follows from p being a period of x, and if i ≥ w − y + 1 from p being a period of y. Because x + y ≥ w + p, these two cases cover all possible values of i. To assign every pattern to the appropriate class, we compute the periods of Pj, αj and βj using small space. Roughly the same result has been proved in [14], but for completeness we provide the full proof here. Lemma 6. Given a read-only string w one can decide in O(w) time and constant space if w is periodic and if so, compute per(w). Proof. Let v be the prefix of w of length (cid:100) 1 2w(cid:101) and p be the starting position of the second occurrence of v in w, if any. We claim that if per(w) ≤ 1 2w, then per(w) = p − 1. Observe first that in this case v occurs at a position per(w) + 1. Hence, per(w) ≥ p − 1. Moreover p − 1 is a period of w[1..v + p − 1] along with per(w). By the periodicity lemma, per(w) ≤ 1 2w ≤ v implies that gcd(p − 1, per(w)) is also a period of that prefix. Thus per(w) > p − 1 would contradict the primitivity of w[1.. per(w)]. The algorithm computes the position p using a linear time constant-space pattern matching algorithm. If it exists, it uses letter-by-letter comparison to determine whether w[1..p− 1] is a period of w. If so, by the discussion above per(w) = p − 1 and the algorithm returns this value. Otherwise, 2 per(w) > w, i.e., w is not periodic. The algorithm runs in linear time and uses constant space. 4.1 Patterns without Long Highly Periodic Prefix Below we show how to deal with patterns with non-highly periodic prefixes αj. Patterns with non-highly periodic suffixes βj can be processed using the same method after reversing the text and the patterns. Lemma 7. Let (cid:96) be an arbitrary integer. Suppose we are given a text T of length n and patterns P1, . . . , Ps such that for 1 ≤ j ≤ s we have (cid:96) ≤ Pj < 4 3 (cid:96) and αj = Pj[1..(cid:96)] is not highly periodic. We can compute the leftmost and the rightmost occurrence of each pattern Pj in T using O(n + s(1 + n (cid:96) ) log s + s(cid:96)) time and O(s) space. 5 The algorithm scans the text T with a sliding window of length (cid:96). Whenever it encounters a subword equal to the prefix αj of some Pj, it creates a request to verify whether the corresponding suffix βj of length (cid:96) occurs at the appropriate position. The request is processed when the sliding window reaches that position. This way the algorithm detects the occurrences of all the patterns. In particular, we may store the leftmost and rightmost occurrence of each pattern. We use the fingerprints to compare the subwords of T with αj and βj. To this end, we precompute Φ(αj) and Φ(βj) for each j. We also build a deterministic dictionary D [16] with an entry mapping Φ(αj) to j for every pattern (if there are multiple patterns with the same value of Φ(αj), the dictionary maps a fingerprint to a list of indices). These steps take O(s(cid:96)) and O(s log s), respectively. Pending requests are maintained in a priority queue Q, implemented using a binary heap1 as pairs containing the pattern index (as a value) and the position where the occurrence of βj is anticipated (as a key). Algorithm 1: Processing patterns with non-highly periodic αj. 1 for i = 1 to n − (cid:96) + 1 do h := Φ(w[i..i + (cid:96) − 1]) foreach j : Φ(αj) = h do foreach request (i, j) ∈ Q at position i do add a request (i + Pj − (cid:96), j) to Q 4 2 3 5 6 7 8 report an occurrence of Pj at i + (cid:96) − Pj if h = Φ(βj) then remove (i, j) from Q Algorithm 1 provides a detailed description of the processing phase. Let us analyze its time and space complexities. Due to the properties of Karp-Rabin fingerprints, line 2 can be implemented in O(1) time. Also, the loops in lines 3 and 5 takes extra O(1) time even if the respective collections are empty. Apart from these, every operation can be assigned to a request, each of them taking O(1) (lines 3 and 5-6) or O(log Q) (lines 4 and 8) time. To bound Q, we need to look at the maximum number of pending requests. Fact 8. For any pattern Pj just O(1 + n pending. (cid:96) ) requests are created and at any time at most one of them is Proof. Note that there is a one-to-one correspondence between requests concerning Pj and the occurrences of αj in T . The distance between two such occurrences must be at least 1 3 (cid:96), because otherwise the period of αj would be at most 1 (cid:96) ) upper bound on the total number of requests. Additionally, any request is pending for at most Pj − (cid:96) < 1 3 (cid:96) iterations of the main for loop. Thus, the request corresponding to an occurrence of αj is already processed before the next occurrence appears. 3 (cid:96), thus making αj highly periodic. This yields the O(1 + n Hence, the scanning phase uses O(s) space and takes O(n + s(1 + n (cid:96) ) log s) time. Taking preprocessing into account, we obtain bounds claimed in Lemma 7. 4.2 Highly Periodic Patterns Lemma 9. Let (cid:96) be an arbitrary integer. Given a text T of length n and a collection of highly periodic patterns P1, . . . , Ps such that for 1 ≤ j ≤ s we have (cid:96) ≤ Pj < 4 3 (cid:96), we can compute the leftmost occurrence of each pattern Pj in T using O(n + s(1 + n (cid:96) ) log s + s(cid:96)) total time and O(s) space. The solution is basically the same as in the proof of Lemma 7, except that the algorithm ignores certain shiftable occurrences. An occurrence of x at position i of T is called shiftable if there is another occurrence 1Hash tables could be used instead of the heap and the deterministic dictionary. Although this would improve the time complexity in Lemma 7, the running time of the algorithm in Thm. 12 would not change and failures with probability inverse polynomial with respect to s would be introduced; see also a discussion before Thm. 1. 6 3Pj ≤ 8 of x at position i − per(x). The remaining occurrences are called non-shiftable. Notice that the leftmost occurrence is always non-shiftable, so indeed we can safely ignore some of the shiftable occurrences of the patterns. Because 2 per(Pj) ≤ 2 9 (cid:96) < (cid:96), the following fact implies that if an occurrence of Pj is non-shiftable, then the occurrence of αj at the same position is also non-shiftable. Fact 10. Let y be a prefix of x such that y ≥ 2 per(x). Suppose x has a non-shiftable occurrence at position i in w. Then, the occurrence of y at position i is also non-shiftable. Proof. Note that per(y) + per(x) ≤ y so the periodicity lemma implies that per(y) = per(x). Let x = ρkρ(cid:48) where ρ is the shortest period of x. Suppose that the occurrence of y at position i is shiftable, meaning that y occurs at position i− per(x). Since y ≥ per(x), y occurring at position i− per(x) implies that ρ occurs at the same position. Thus w[i− per(x)..i +x− 1] = ρk+1ρ(cid:48). But then x clearly occurs at position i− per(x), which contradicts the assumption that its occurrence at position i is non-shiftable. Consequently, we may generate requests only for the non-shiftable occurrences of αj. In other words, if an occurrence of αj is shiftable, we do not create the requests and proceed immediately to line 5. To detect and ignore such shiftable occurrences, we maintain the position of the last occurrence of every αj. However, if there are multiple patterns sharing the same prefix αj1 = . . . = αjk , we need to be careful so that the time to detect a shiftable occurrence is O(1) rather than O(k). To this end, we build another deterministic dictionary, which stores for each Φ(αj) a pointer to the variable where we maintain the position of the previously encountered occurrence of αj. The variable is shared by all patterns with the same prefix αj. 2 (cid:96). Then i − i(cid:48) ≤ 1 It remains to analyze the complexity of the modified algorithm. First, we need to bound the number of non-shiftable occurrences of a single αj. Assume that there is a non-shiftable occurrence αj at positions 2 (cid:96) is a period of T [i(cid:48)..i + (cid:96) − 1]. By the periodicity lemma, i(cid:48) < i such that i(cid:48) ≥ i − 1 per(αj) divides i− i(cid:48), and therefore αj occurs at position i(cid:48) − per(αj), which contradicts the assumption that the occurrence at position i(cid:48) is non-shiftable. Consequently, the non-shiftable occurrences of every αj are at least 1 2 (cid:96) characters apart, and the total number of requests and the maximum number of pending requests can be bounded by O(s(1 + n (cid:96) )) and O(s), respectively, as in the proof of Lemma 7. Taking into the account the time and space to maintain the additional components, which are O(n + s log s) and O(s), respectively, the final bounds remain the same. 4.3 Summary Theorem 11. Given a text T of length n and patterns P1, . . . , Ps of total length m, using O(n log n + m + (cid:96) log s) total time and O(s) space we can compute the leftmost occurrences in T of every pattern Pj of s n length at least (cid:96). Proof. The algorithm distributes the patterns into O(log n) groups according to their lengths, and then into three classes according to their repetitiveness, which takes O(m) time and O(s) space in total. Then, it applies either Lemma 7 or Lemma 9 on every class. It remains to show that the running times of all those calls sum up to the claimed bound. Each of them can be seen as O(n) plus O(Pj + (1 + nPj ) log s) per every pattern Pj. Because (cid:96) ≤ Pj ≤ n and there are O(log n) groups, this sums up to O(n log n+m+s n (cid:96) log s). Using Thm. 4 for all patterns of length at most min(n, s), and (if s ≤ n) Thm. 11 for patterns of length at least s, we obtain our main theorem. Theorem 12. Given a text T of length n and patterns P1, . . . , Ps of total length m, we can compute the leftmost occurrence in T of every pattern Pj using O(n log n + m) total time and O(s) space. 5 Computing Longest Occurring Prefixes In this section we extend Thm. 12 to compute, for every pattern Pj, its longest prefix occurring in the text. A straightforward extension uses binary search to compute the length (cid:96)j of the longest prefix of Pj occurring 7 in T . All binary searches are performed in parallel, that is, we proceed in O(log n) phases. In every phase we check, for every j, if Pj[1..1 + (cid:96)j] occurs in T using Thm. 12 and then update the corresponding (cid:96)j accordingly. This results in O(n log2 n + m) total time complexity. To avoid the logarithmic multiplicative overhead in the running time, we use a more complex approach requiring a careful modification of all the components developed in Sections 3 and 4. Short patterns. We proceed as in Sect. 3 while maintaining a tentative longest prefix occurring in T for every pattern Pj, denoted Pj[1..(cid:96)j]. Recall that after processing a block Ti we obtain, for each pattern Pj, a node such that the corresponding substring is equal to Pj provided that Pj occurs in Ti. Now we need a stronger property, which is that for any length k, (cid:96)j ≤ k ≤ Pj, the ancestor at string depth k of that node (if any) corresponds to Pj[1..k] provided that Pj[1..k] occurs in Ti. This can be guaranteed by modifying the procedure described in Lemma 2: if a child of v1 has no corresponding child of v2, we report v2 as the twin of all nodes in the subtree rooted at that child of v1. (Notice that now the string depth of v1 ∈ T1 might be larger than the string depth of its twin v2 ∈ T2, but we generate exactly one twin for every v1 ∈ T1.) Using the stronger property we can update every (cid:96)j by first checking if Pj[1..(cid:96)j] occurs in Ti, and if so incrementing (cid:96)j as long as possible. In more detail, let Ti[b..e] denote the substring corresponding to the twin of Pj. If Ti[b..e] < (cid:96)j, there is nothing to do. Otherwise, we check whether Ti[b..(b + (cid:96)j − 1)] = Pj[1..(cid:96)j] using fingerprints, and if so start to naively compare Ti[b + (cid:96)j..e] and Pj[(cid:96)j + 1..Pj]. Because in the end (cid:80) j (cid:96)j ≤ m, updating every (cid:96)j takes O(s n (cid:96) + m) additional total time. Theorem 13. Given a text T of length n and patterns P1, . . . , Ps of total length m, using O(n log (cid:96)+s n (cid:96) +m) total time and O(s + (cid:96)) space we can compute the longest prefix occurring in T for every pattern Pj of length at most (cid:96). Long patterns. As in Sect. 4, we again distribute all patterns of length at least (cid:96) into groups. However, now for patterns in the i-th group (satisfying (cid:98)log4/3 Pj(cid:99) = i), we set gi = (cid:100)(4/3)i(cid:101) and additionally require that Pj[1..gi] occurs in T . To verify that this condition is true, we process the groups in the decreasing order of the index i and apply Thm. 1 to prefixes Pj[1..gi]. If for some pattern Pj the prefix fails to occur in T , we replace Pj setting Pj := Pj[1..gi − 1]. Observe that this operation moves Pj to a group with a smaller index (or makes Pj a short pattern). Additionally, note that in subsequent steps the length of Pj decreases geometrically, so the total length of patterns for which we apply Thm. 1 is O(m) and thus the total running time of this preprocessing phase is O(n log n + m) as long as (cid:96) ≥ log s. Hence, from now on we consider only patterns Pj belonging to the i-th group, i.e., such that gi ≤ Pj < 4 3 gi and Pj[1..gi] occurs in T . As before, we classify patterns depending on their periodicity. However, now the situation is more complex, because we cannot reverse the text and the patterns. As a warm-up, we first describe how to process patterns Pj with a non-highly periodic prefix αj = Pj[1..(cid:96)]. While not used in the final solution, this step allows us to gradually introduce all the required modifications. Then we show to process all highly periodic patterns, and finally move to the general case, where patters are not highly periodic. Patterns with a non-highly periodic prefix. We maintain a tentative longest prefix occurring in T for every pattern Pj, denoted Pj[1..(cid:96)j] and initialized with (cid:96)j = (cid:96), and proceed as in Algorithm 1 with the following modifications. In line 4, the new request is (i + (cid:96)j − (cid:96) + 1, j). In line 6, we compare h with Φ(Pj[((cid:96)j +2−(cid:96))..((cid:96)j +1)]). If these two fingerprints are equal, we have found an occurrence of Pj[1..(cid:96)j +1]. In such case we try to further extend the occurrence by naively comparing Pj[(cid:96)j +1..Pj] with the corresponding fragment of T and incrementing (cid:96)j as long as the corresponding characters match. For every Pj we also need to maintain Φ(Pj[((cid:96)j + 2− (cid:96))..((cid:96)j + 1)]), which can be first initialized in O((cid:96)) time and then updated in O(1) time whenever (cid:96)j is incremented. Because at any time at most one request is pending for every pattern Pj (and thus, while updating (cid:96)j no such request is pending), this modified algorithm correctly determines the longest occurring prefix for every pattern with non-highly periodic αj. Lemma 14. Let (cid:96) be an arbitrary integer. Suppose we are given a text T of length n and patterns P1, . . . , Ps such that, for 1 ≤ j ≤ s, we have (cid:96) ≤ Pj < 4 3 (cid:96) and αj = Pj[1..(cid:96)] is not highly periodic. We can compute 8 the longest prefix occurring in T for every pattern Pj using O(n + s(1 + n space. (cid:96) ) log s + s(cid:96)) total time using O(s) Highly periodic patterns. As in Sect. 4.2, we observe that all shiftable occurrences of the longest prefix of Pj occurring in T can be ignored, and therefore it is enough to consider only non-shiftable occurrences of αj (by the same argument, because that longest prefix is of length at least αj). Therefore, we can again use Algorithm 1 with the same modifications. As for non-highly periodic αj, we maintain a tentative longest prefix Pj[1..(cid:96)j] for every pattern Pj. Whenever a non-shiftable occurrence of αj is detected, we create a new request to check if (cid:96)j can be incremented. If so, we start to naively compare Pj[1..(cid:96)j + 1] with the corresponding fragment of T . The total time and space complexity remain unchanged. Lemma 15. Let (cid:96) be an arbitrary integer. Given a text T of length n and a collection of highly periodic patterns P1, . . . , Ps such that, for 1 ≤ j ≤ s, we have (cid:96) ≤ Pj < 4 3 (cid:96), we can compute the longest prefix occurring in T for every pattern Pj using O(n + s(1 + n (cid:96) ) log s + s(cid:96)) total time and O(s) space. General case. Now we describe how to process all non-highly periodic patterns Pj. This will be an extension of the simple modification described for the case of non-highly periodic prefix αj. We start with the following simple combinatorial fact. Fact 16. Let (cid:96) ≥ 3 be an integer and w be a non-highly periodic word of length at least (cid:96). Then there exists i such that w[i..i+(cid:96)−1] is not highly periodic and either i = 1 or w[1..i+(cid:96)−2] is highly periodic. Furthermore, such i can be found in O(w) time and constant space assuming read-only random access to w. Proof. If per(w[1..(cid:96)]) > 1 Since w is not highly periodic, we have j < w. Thus per(w[1..j]) ≤ 1 that i = j + 2− (cid:96) can be returned. We must argue that per(w[j + 2− (cid:96)..j + 1]) > 1 of both w[1..j] and w[j + 2 − (cid:96)..j + 1] are at most 1 (cid:96) − 1 ≥ 2 has period at most 1 period of w[1..(cid:96)] extends in the whole w naively in O(w) time and constant space. 3 (cid:96), we are done. Otherwise, choose largest j such that per(w[1..j]) = per(w[1..(cid:96)]). 3 (cid:96). We claim 3 (cid:96). Otherwise, the periods 3 (cid:96). But these two substrings share a fragment of length 3 (cid:96), so by the periodicity lemma their periods are in fact the same, and then the whole w[1..j + 1] Regarding the implementation, we compute per(w[1..(cid:96)]) using Lemma 6. Then we check how far the 3 (cid:96) but per(w[1..j + 1]) > 1 3 (cid:96), which is a contradiction. For every non-highly periodic pattern Pj we use Fact 16 to find its non-highly periodic substring of length (cid:96), denoted Pj[kj...kj + (cid:96)− 1], such that kj = 1 or Pj[1..kj + (cid:96)− 2] is highly periodic. We begin with checking if Pj[1..kj + (cid:96) − 1] occurs in T using Lemma 7 (if kj = 1, it surely does because of how we partition the patterns into groups). If not, we replace Pj setting Pj := Pj[1..kj + (cid:96) − 2], which is highly periodic and can be processed as already described. From now on we consider only patterns Pj such that Pj[kj..kj + (cid:96) − 1] is not highly periodic and Pj[1..kj + (cid:96) − 1] occurs in T . We further modify Algorithm 1 to obtain Algorithm 2 as follows. We scan the text T with a sliding window of length (cid:96) while maintaining a tentative longest occurring prefix Pj[1..(cid:96)j] for every pattern Pj, initialized by setting (cid:96)j = kj + (cid:96) − 1. Whenever we encounter a substring equal to Pj[kj..kj + (cid:96) − 1], i.e., Pj[kj..kj + (cid:96)− 1] = T [i..i + (cid:96)− 1], we want to check if Pj[1..kj + (cid:96)− 1] = T [i− kj + 1..i + (cid:96)− 1] by comparing fingerprints of αj = Pj[1..(cid:96)] and the corresponding fragment of T . This is not trivial as that fragment is already to the left of the current window. Hence we conceptually move two sliding windows of length (cid:96), corresponding to w[i + 1 3 (cid:96), whenever the first window generates a request (called request of type I), the second one is still far enough to the left for the request to be processed in the future. Furthermore, because Pj[kj..kj + (cid:96) − 1] is non-highly periodic and the distance between the sliding windows is 1 3 (cid:96), each pattern Pj contributes at most one pending request of type I at any moment and O(1 + n (cid:96) ) such requests in total. Then, whenever a request of type I is successfully processed, we know that Pj[1..kj + (cid:96) − 1] matches with the corresponding fragment of T . We want to check if the occurrence of Pj[1..kj + (cid:96)− 1] can be extended to an occurrence of Pj[1..(cid:96)j + 1]. To this end, we create another request (called request of type II) to check if Pj[(cid:96)j +2−(cid:96)..(cid:96)j +1] matches the corresponding fragment of T . This request can be processed using the second window and, again because per(Pj[1..kj + (cid:96)− 1]) > 1 3 (cid:96), 3 (cid:96) − 1] and w[i..i + (cid:96) − 1], respectively. Because kj ≤ Pj − (cid:96) ≤ 1 3 (cid:96)..i + 4 9 Algorithm 2: Processing patterns with non-highly periodic Pj[kj..kj + (cid:96)−1]. 1 for j = 1 to s do (cid:96)j := kj + (cid:96) − 1 2 3 for i = 1 − 1 3 (cid:96)..i + 4 3 (cid:96) − 1]) add a request (i + 1 3 (cid:96) to n − (cid:96) + 1 do h1 := Φ(w[i + 1 h2 := Φ(w[i + (cid:96)..i + (cid:96) − 1]) foreach j : Φ(Pj[kj..kj + (cid:96) − 1]) = h1 do 3 (cid:96) − kj + 1, j) to Q1 foreach request (i, j) ∈ Q1 at position i do add a request (i − (cid:96) + (cid:96)j + 1, j) to Q2 if h2 = Φ(P [1..(cid:96)]) then remove (i, j) from Q1 if h2 = Φ(Pj[(cid:96)j + 2 − (cid:96)..(cid:96)j + 1]) then foreach request (i − (cid:96), j) ∈ Q2 at position i do oj := i + (cid:96) − (cid:96)j − 1 increment (cid:96)j as long as Pj[(cid:96)j + 1] = T [oj + (cid:96)j] remove (i, j) from Q2 4 5 6 7 8 9 10 11 12 13 14 15 16 each pattern contribues at most one pending request of type II at any moment and O((1 + n (cid:96) )) such request in total. Finally, whenever a request of type II is successfully processed, we know that the corresponding (cid:96)j can be incremented. Therefore, we start to naively compare the characters of Pj[(cid:96)j + 1..Pj]] and the corresponding fragment of T . Since at that time no other request of type II is pending for Pj, such modified algorithm correctly computes all values (cid:96)j (and the corresponding positions oj). Lemma 17. Let (cid:96) be an arbitrary integer. Suppose we are given a text T of length n and patterns P1, . . . , Ps such that, for 1 ≤ j ≤ s, we have (cid:96) ≤ Pj < 4 3 (cid:96) and Pj is non-highly periodic. We can compute the longest prefix occurring in T for every pattern Pj in O(n + s(1 + n (cid:96) ) log s + s(cid:96)) total time using O(s) space. By combining all the ingredients, we get the following theorem. Theorem 18. Given a text T of length n and patterns P1, . . . , Ps of total length m, we can compute the longest prefix occurring in T for every pattern Pj using O(n log n + m) total time and O(s) space. Proof. We proceed as in Thm. 11 and 12, except that now we use Thm. 13, Lemma 15 and Lemma 17 instead of Thm. 4, Lemma 9 and Lemma 7, respectively. Additionally, we need O(n log n + m) time to distribute the long patterns into groups, which is absorbed in the final complexity. Finally, let us note that it is straightforward to modify the algorithm so that we can specify for every pattern Pj an upper bound rj on the starting positions of the occurrences. Theorem 19. Given a text T of length n, patterns P1, . . . , Ps of total length m, and integers r1, . . . , rs, we can compute for each pattern the maximum length (cid:96)j and a position oj ≤ rj such that Pj[1..(cid:96)j] = T [oj..(oj + (cid:96)j − 1)], using O(n log n + m) total time and O(s) space. 6 Las Vegas Algorithms As shown below, it is not difficult to modify our dictionary matching algorithm so that it always verifies the correctness of the answers. Assuming that we are interested in finding just the leftmost occurrence of every pattern, we obtain an O(n log n + m)-time Las Vegas algorithm (with inverse-polynomial failure probability). In most cases, it suffices to naively verify in O(Pj) time whether the leftmost occurrence of Pj detected by the algorithm is valid. If it is not, we are guaranteed that the fingerprints Φ admit a false-positive. Since this event happens with inverse-polynomial probability, a failure can be reported. 10 Recall that per(αj) ≤ 1 3 (cid:96)], T2 = [ 1 3 (cid:96) + 1.. 4 3 (cid:96). If the previous occurrence of αj was at position i ≥ i − 1 This simple solution remains valid for short patterns and non-highly periodic long patterns. For highly periodic patterns, the situation is more complicated. The algorithm from Lemma 9 assumes that we are correctly detecting all occurrences of every αj so that we can filter out the shiftable ones. Verifying these occurrences naively might take too much time, because it is not enough check just one occurrence of every αj. 2 (cid:96), we will check if per(αj) is a period of T [i(cid:48)..i + (cid:96) − 1]. If so, either both occurrences (at position i(cid:48) and at position i) are false-positives, or none of them is, and the occurrence at position i(cid:48) can be ignored. Otherwise, at least one occurrence is surely false-positive, and we declare a failure. To check if per(αj) is a period of T [i(cid:48)..i + (cid:96) − 1], 3 (cid:96) + 1..(t + 1) 1 we partition T into overlapping blocks T1 = [1.. 2 3 (cid:96)] be the rightmost such block fully inside T [1..i + (cid:96)− 1]. We calculate the period of Tt using Lemma 6 in O((cid:96)) time and O(1) space, and then calculate how far the period extends to the left and to the right, terminating if it extends very far. Formally, we calculate the largest e < (t + 2) 1 2 (cid:96) such that per(Tt) is a period of T [b..e]. This takes O((cid:96)) time for every t summing up to O(n) total time. Then, to check if per(αj) is a period of T [i(cid:48)..i + (cid:96) − 1] we check if it divides the period of per(Tt) and furthermore r ≥ i + (cid:96)− 1 and (cid:96) ≤ i(cid:48). Finally, we naively verify the the reported leftmost occurrences of Pj. Consequently, Las Vegas randomization suffices in Thoerem 12. 3 (cid:96)], . . .. Let Tt = T [(t− 1) 1 3 (cid:96) and the smallest b > (t− 2) 1 3 (cid:96)− 1 For Thm. 18, we run the Las Vegas version of Thm. 12 with Pj[1..(cid:96)j] and Pj[1..(cid:96)j + 1] as patterns to make sure that the former occur in T but the latter do not. For Thm. 19 we also use Thm. 12, but this time we need to see where the reported leftmost occurrences start compared to bounds rj. 7 Approximating LZ77 in Small Space A non-empty fragment T [i..j] is called a previous fragment if the corresponding subword occurs in T at a position i(cid:48) < i. A phrase is either a previous fragment or a single letter not occurring before in T . The LZ77-factorization of a text T [1..n] is a greedy factorization of T into z phrases, T = f1f2 . . . fz, such that each fi is as long as possible. To formalize the concept of LZ77-approximation, we first make the following definition. Definition 20. Let w = g1g2 . . . ga be a factorization of w into a phrases. We call it c-optimal if the fragment corresponding to the concatenation of any c consecutive phrases gi . . . gi+c−1 is not a previous fragment. A c-optimal factorization approximates the LZ77-factorization in the number of factors, as the following observation states. However, the stronger property of c-optimality is itself useful in certain situations. Observation 21. If w = g1g2 . . . ga is a c-optimal factorization of w into a phrases, and the LZ77- factorization of w consists of z phrases, then a ≤ c · z. We first describe how to use the dictionary matching algorithm described in Thm. 12 to produce a 2- optimal factorization of w[1..n] in O(n log n) time and O(z) working space. Then, the resulting parse can be further refined to produce a (1 + ε)-optimal factorization in O(ε−1n log n) additional time and the same space using the extension of the dictionary matching algorithm from Thm 18. 7.1 2-Approximation Algorithm 7.1.1 Outline. Our algorithm is divided into three phases, each of which refines the factorization from the previous phase: Phase 1. Create a factorization of T [1..n] stored implicitly as z chains consisting of O(log n) phrases each. Phase 2. Try to merge phrases within the chains to produce an O(1)-optimal factorization. Phase 3. Try to merge adjacent factors as long as possible to produce the final 2-optimal factorization. 11 Figure 1: An illustration of Phase 1 of the algorithm, with the "cherries" depicted in thicker lines. The horizontal lines represent the LZ77-factorization and the vertical lines depict factors induced by the tree. Longer separators are drawn between chains, whose lengths are written in binary with the least significant bits on top. Every phase takes O(n log n) time and uses O(z) working space. In the end, we get a 2-approximation of the LZ77-factorization. Phases 1 and 2 use the very simple multiple pattern matching algorithm for patterns of equal lengths developed in Thm. 1, while Phase 3 requires the general multiple pattern matching algorithm obtained in Thm. 12. 7.1.2 Phase 1. To construct the factorization, we imagine creating a binary tree on top the text T of length n = 2k -- see also Fig. 1 (we implicitly pad w with sufficiently many $'s to make its length a power of 2). The algorithm works in log n rounds, and the i-th round works on level i of the tree, starting at i = 1 (the children of the root). On level i, the tree divides T into 2i blocks of size n/2i; the aim is to identify previous fragments among these blocks and declare them as phrases. (In the beginning, no phrases exist, so all blocks are unfactored.) To find out if a block is a previous fragment, we use Thm. 1 and test whether the leftmost occurrence of the corresponding subword is the block itself. The exploration of the tree is naturally terminated at the nodes corresponding to the previous fragments (or single letters not occurring before), forming the leaves of a (conceptual) binary tree. A pair of leaves sharing the same parent is called a cherry. The block corresponding to the common parent is induced by the cherry. To analyze the algorithm, we make the following observation: Fact 22. A block induced by a cherry is never a previous fragment. Therefore, the number of cherries is at most z. Proof. The former part follows from construction. To prove the latter, observe that the blocks induced by different cherries are disjoint and hence each cherry can be assigned a unique LZ77-factor ending within the block. Consequently, while processing level i of the tree, we can afford storing all cherries generated so far on a sorted linked list L. The remaining already generated phrases are not explicitly stored. In addition, we also store a sorted linked list Li of all still unfactored nodes on the current level i (those for which the corresponding blocks are tested as previous fragments). Their number is bounded by z (because there is a cherry below every node on the list), so the total space is O(z). Maintaining both lists sorted is easily accomplished by scanning them in parallel with each scan of T , and inserting new cherries/unfactored nodes at their correct places. Furthermore, in the i-th round we apply Thm. 1 to at most 2i patterns of length n/2i, so the total time is(cid:80)log n i=1 O(n + 2i log(2i)) = O(n log n). Next, we analyze the structure of the resulting factorization. Let hx−1hx and hyhy+1 be the two con- secutive cherries. The phrases hx+1 . . . hy−1 correspond to the right siblings of the ancestors of hx and to the left siblings of the ancestors of hy (no further than to the lowest common ancestor of hx and hy). This naturally partitions hxhx+1 . . . hy−1hy into two parts, called an increasing chain and a decreasing chain to depict the behaviour of phrase lengths within each part. Observe that these lengths are powers of two, so the 12 abbbabaabaabaabbbabaabbbbaabbab$1010101010000110001001000100111010001000 structure of a chain of either type is determined by the total length of its phrases, which can be interpreted as a bitvector with bit i(cid:48) set to 1 if there is a phrase of length 2i(cid:48) in the chain. Those bitvectors can be created while traversing the tree level by level, passing the partially created bitvectors down to the next level Li+1 until finally storing them at the cherries in L. At the end we obtain a sequence of chains of alternating types, see Fig. 1. Since the structure of each chain follows from its length, we store the sequence of chains rather the actual factorization, which might consist of Θ(z log n) = ω(z) phrases. By Fact 22, our representation uses O(z) words of space and the last phrase of a decreasing chain concatenated with the first phrase of the consecutive increasing chain never form a previous fragment (these phrases form the block induced by the cherry). 7.1.3 Phase 2. In this phase we merge phrases within the chains. We describe how to process increasing chains; the decreasing are handled, mutatis mutandis, analogously. We partition the phrases h(cid:96) . . . hr within a chain into groups. For each chain we maintain an active group, initially consisting of h(cid:96), and scan the remaining phrases in the left-to-right order. We either append a phrase hi to the active group gj, or we output gj and make gj+1 = hi the new active group. The former action is performed if and only if the fragment of length 2hi starting at the same position as gj is a previous fragment. Having processed the whole chain, we also output the last active group. Fact 23. Within every chain every group gj forms a valid phrase, but no concatenation of three adjacent groups gjgj+1gj+2 form a previous fragment. Proof. Since the lengths of phrases form an increasing sequence of powers of two, at the moment we need to decide if we append hi to gj we have gj ≤ h(cid:96) . . . hi−1 < hi, so 2hi > gjhi, and thus we are guaranteed if we append gj, then gjhi is a previous factor. Finally, let us prove the aforementioned optimality condition, i.e., that gjgj+1gj+2 is not a previous fragment for any three consecutive groups. Suppose that we output gj while processing hi, that is, gj+1 = hi . . . hi(cid:48). We did not append hi to gj, so the fragment of length 2hi starting at the same position as gj is not a previous fragment. However, gjgj+1gj+2 > gj+1gj+2 ≥ hihi+1 > 2hi, so this immediately implies that gjgj+1gj+2 is not a previous fragment. The procedure described above is executed in parallel for all chains, each of which maintains just the length of its active group. In the i-th round only chains containing a phrase of length 2i participate (we use bit operations to verify which chains have length containing 2i in the binary expansion). These chains provide fragments of length 2i+1 and Thm. 1 is applied to decide which of them are previous fragments. The chains modify their active groups based on the answers; some of them may output their old active groups. These groups form phrases of the output factorization, so the space required to store them is amortized by the size of this factorization. As far as the running time is concerned, we observe that no more than min(z, n 2i ) 2i ) = O(n log n). chains participate in the i-th round . Thus, the total running time is(cid:80)log n To bound the overall approximation guarantee, suppose there are five consecutive output phrases forming a previous fragment. By Fact 22, these fragments cannot contain a block induced by any cherry. Thus, the phrases are contained within two chains. However, by Fact 23 no three consecutive phrases obtained from a single chain form a previous fragment. Hence the resulting factorization is 5-optimal. i=1 O(n + n 2i log n 7.1.4 Phase 3. The following lemma achieves the final 2-approximation: Lemma 24. Given a c-optimal factorization, one can compute a 2-optimal factorization using O(c· n log n) time and O(c · z) space. Proof. The procedure consists of c iterations. In every iteration we first detect previous fragments corre- sponding to concatenations of two adjacent phrases. The total length of the patterns is up to 2n, so this takes 13 O(n log n + m) = O(n log n) time and O(c· z) space using Thm. 12. Next, we scan through the factorization and merge every phrase gi with the preceding phrase gi−1 if gi−1gi is a previous fragment and gi−1 has not been just merged with its predecessor. We shall prove that the resulting factorization is 2-optimal. Consider a pair of adjacent phrases gi−1gi in the final factorization and let j be the starting position of gi. Suppose gi−1gi is a previous fragment. Our algorithm performs merges only, so the phrase ending at position j − 1 concatenated with the phrase starting at position j formed a previous fragment at every iteration. The only reason that these factors were not merged could be another merge of the former factor. Consequently, the factor ending at position j − 1 took part in a merge at every iteration, i.e., gi−1 is a concatenation of at least c phrases of the input factorization. However, all the phrases created by the algorithm form previous fragments, which contradicts the c-optimality of the input factorization. 2 a blocks corresponding to 2 7.2 Approximation Scheme The starting point is a 2-optimal factorization into a phrases, which can be found in O(n log n) time using the previous method. The text is partitioned into ε ε consecutive phrases. Every block is then greedily factorized into phrases. The factorization is implemented using Thm. 19 to compute the longest previous fragments in parallel for all blocks as follows. Denote the starting positions of the blocks by b1 < b2 < . . . and let ij be the current position in the i-th block, initially set to bi. For every i, we find the longest previous fragment starting at ij and fully contained inside T [ij..bj+1 − 1] by computing the longest prefix of T [ij..bj+1 − 1] occurring in T and starting in T [1..ij − 1], denoted T [ij..ij + (cid:96)j − 1]. Then we output every T [ij..ij + (cid:96)j − 1] as a new phrase and increase ij by (cid:96)j. Because every block, by definition, can be factorized into 2 ε n log n) time in total. To bound the approximation guarantee, observe that every phrase inside the block, except possibly for the last one, contains an endpoint of a phrase in the LZ77-factorization. Consequently, the total number of phrases is at most z + ε ε phrases and the greedy factorization is optimal, this requires O( 1 2 a ≤ (1 + ε)z. Theorem 25. Given a text T of length n whose LZ77-factorization consists of z phrases, we can factorize T into at most 2z phrases using O(n log n) time and O(z) space. Moreover, for any ε ∈ (0, 1] in O(ε−1n log n) time and O(z) space we can compute a factorization into no more than (1 + ε)z phrases. Acknowledgments. The authors would like to thank the participants of the Stringmasters 2015 workshop in Warsaw, where this work was initiated. We are particularly grateful to Marius Dumitran, Artur Jez, and Patrick K. Nicholson. References [1] Rabin -- Karp algorithm -- Wikipedia, The Free Encyclopedia. [2] A. V. Aho and M. J. Corasick. Efficient string matching: An aid to bibliographic search. Commun. ACM, 18(6):333 -- 340, 1975. [3] D. Breslauer, R. Grossi, and F. Mignosi. Simple real-time constant-space string matching. Theor. Comput. Sci., 483:2 -- 9, 2013. [4] R. Clifford, A. Fontaine, E. Porat, B. Sach, and T. Starikovskaya. Dictionary matching in a stream. In N. Bansal and I. Finocchi, editors, ESA 2015, volume 8737 of LNCS, pages 361 -- 372. Springer, Heidelberg, 2015. [5] M. Crochemore and D. Perrin. Two-way string matching. J. ACM, 38(3):651 -- 675, 1991. [6] N. J. Fine and H. S. Wilf. Uniqueness theorems for periodic functions. P. Am. Math. Soc., 16(1):109 -- 114, 1965. 14 [7] J. Fischer, T. I, and D. Koppl. Lempel Ziv computation in small space (LZ-CISS). In F. Cicalese, E. Porat, and U. Vaccaro, editors, Combinatorial Pattern Matching - 26th Annual Symposium, CPM 2015, Ischia Island, Italy, June 29 - July 1, 2015, Proceedings, volume 9133 of Lecture Notes in Computer Science, pages 172 -- 184. Springer, 2015. [8] Z. Galil and J. I. Seiferas. Time-space-optimal string matching. J. Comput. Syst. Sci., 26(3):280 -- 294, 1983. [9] L. Gasieniec, M. Karpinski, W. Plandowski, and W. Rytter. Efficient algorithms for Lempel-Ziv encoding (extended abstract). In R. G. Karlsson and A. Lingas, editors, SWAT 1996, volume 1097 of LNCS, pages 392 -- 403. Springer, Heidelberg, 1996. [10] B. Gum and R. J. Lipton. Cheaper by the dozen: Batched algorithms. In V. Kumar and R. L. Grossman, editors, SDM 2001, pages 1 -- 11. SIAM, Philadelphia, 2001. [11] W. Hon, T. Ku, R. Shah, S. V. Thankachan, and J. S. Vitter. Faster compressed dictionary matching. Theor. Comput. Sci., 475:113 -- 119, 2013. [12] J. Karkkainen, D. Kempa, and S. J. Puglisi. Lightweight Lempel-Ziv parsing. In V. Bonifaci, C. Deme- trescu, and A. Marchetti-Spaccamela, editors, SEA 2013, volume 7933 of LNCS, pages 139 -- 150. Springer, Heidelberg, 2013. [13] R. M. Karp and M. O. Rabin. Efficient randomized pattern-matching algorithms. IBM J. Res. Dev., 31(2):249 -- 260, 1987. [14] T. Kociumaka, T. Starikovskaya, and H. W. Vildhøj. Sublinear space algorithms for the longest common substring problem. In A. S. Schulz and D. Wagner, editors, ESA 2014, volume 8737 of LNCS, pages 605 -- 617. Springer, Heidelberg, 2014. [15] M. Lohrey. Algorithmics on SLP-compressed strings: A survey. Groups Complexity Cryptology, 4(2):241 -- 299, 2012. [16] M. Ruzi´c. Constructing efficient dictionaries in close to sorting time. In L. Aceto, I. Damgard, L. A. Goldberg, M. M. Halld´orsson, A. Ing´olfsd´ottir, and I. Walukiewicz, editors, ICALP 2008, volume 5125, pages 84 -- 95. Springer, Heidelberg, 2008. [17] E. Ukkonen. On-line construction of suffix trees. Algorithmica, 14(3):249 -- 260, 1995. [18] J. Ziv and A. Lempel. A universal algorithm for sequential data compression. IEEE Trans. Inform. Theory, 23(3):337 -- 343, 1977. 15
1208.1688
3
1208
2012-08-17T07:57:06
Don't Be Strict in Local Search!
[ "cs.DS" ]
Local Search is one of the fundamental approaches to combinatorial optimization and it is used throughout AI. Several local search algorithms are based on searching the k-exchange neighborhood. This is the set of solutions that can be obtained from the current solution by exchanging at most k elements. As a rule of thumb, the larger k is, the better are the chances of finding an improved solution. However, for inputs of size n, a na\"ive brute-force search of the k-exchange neighborhood requires n to the power of O(k) time, which is not practical even for very small values of k. Fellows et al. (IJCAI 2009) studied whether this brute-force search is avoidable and gave positive and negative answers for several combinatorial problems. They used the notion of local search in a strict sense. That is, an improved solution needs to be found in the k-exchange neighborhood even if a global optimum can be found efficiently. In this paper we consider a natural relaxation of local search, called permissive local search (Marx and Schlotter, IWPEC 2009) and investigate whether it enhances the domain of tractable inputs. We exemplify this approach on a fundamental combinatorial problem, Vertex Cover. More precisely, we show that for a class of inputs, finding an optimum is hard, strict local search is hard, but permissive local search is tractable. We carry out this investigation in the framework of parameterized complexity.
cs.DS
cs
Don't Be Strict in Local Search! Serge Gaspers The University of New South Wales and Vienna University of Technology [email protected] Eun Jung Kim Sebastian Ordyniak LAMSADE-CNRS, Universit´e Paris-Dauphine Vienna University of Technology [email protected] [email protected] Saket Saurabh Stefan Szeider The Institute of Mathematical Sciences Vienna University of Technology [email protected] [email protected] Abstract Local Search is one of the fundamental approaches to combinatorial optimization and it is used throughout AI. Several local search algorithms are based on searching the k-exchange neighborhood. This is the set of solutions that can be obtained from the current solution by exchanging at most k elements. As a rule of thumb, the larger k is, the better are the chances of finding an improved solution. However, for inputs of size n, a naıve brute-force search of the k-exchange neighborhood requires nO(k) time, which is not practical even for very small values of k. Fellows et al. (IJCAI 2009) studied whether this brute-force search is avoidable and gave positive and nega- tive answers for several combinatorial problems. They used the notion of local search in a strict sense. That is, an improved solution needs to be found in the k-exchange neighborhood even if a global optimum can be found efficiently. In this paper we consider a natural relaxation of local search, called permissive local search (Marx and Schlotter, IWPEC 2009) and investigate whether it enhances the domain of tractable inputs. We exemplify this approach on a fundamental combinatorial problem, VERTEX COVER. More precisely, we show that for a class of inputs, finding an optimum is hard, strict local search is hard, but permissive local search is tractable. We carry out this investigation in the framework of parameterized complexity. 1 Introduction Local search is one of the most common approaches applied in practice to solve hard optimization problems. It is used as a subroutine in several kinds of heuristics, such as evolutionary algorithms and hybrid heuristics that combine local search and genetic algorithms. The history of employing local search in combinatorial optimiza- tion and operations research dates back to the 1950s with the first edge-exchange algorithms for the traveling salesperson (Bock, 1958; Croes, 1958). In general, such algorithms start from a feasible solution and iteratively try to improve the current solution. Local search algorithms, also known as neighborhood search algorithms, form a large class of improvement algorithms. To perform local search, a problem specific neighborhood distance function is defined on the solution space and a better solution is searched in the neighborhood of the current solution. In particular, many local search algorithms are based on searching the k-exchange neighborhood. This is the set of solutions that can be obtained from the current solution by exchanging at most k elements. Most of the literature on local search is primarily devoted to experimental studies of different heuristics. The theoretical study of local search has developed mainly in four directions. 1 The first direction is the study of performance guarantees of local search, i.e., the quality of the solution (Al- imonti, 1995, 1997; Gupta and Tardos, 2000; Khanna et al., 1998; Papadimitriou and Steiglitz, 1977). The second direction of the theoretical work is on the asymptotic convergence of local search in probabilistic settings, such as simulated annealing (Aarts, Korst, and van Laarhoven, 1997). The third direction concerns the time required to reach a local optimum. The fourth direction is concerned with so-called kernelization techniques (Guo and Niedermeier, 2007) for local search, and aims at providing the basis for putting our theoretical results to work in practice. In a recent paper by Fellows et al. (2009) another twist in the study of local search has been taken with the goal of answering the following natural question. Is there a faster way of searching the k-exchange neighborhood than brute-force? This question is important because the typical running time of a brute-force algorithm is nO(k), where n is the input length. Such a running time becomes a real obstacle in using k-exchange neighborhoods in practice even for very small values of k. For many years most algorithms searching an improved solution in the k-exchange neighborhood had an nO(k) running time, creating the impression that this cannot be done significantly faster than brute-force search. But is there mathematical evidence for this common belief? Or is it possible for some problems to search k-exchange neighborhoods in time O(f (k)nc), where c is a small constant, which can make local search much more powerful? An appropriate tool to answer all these questions is parameterized complexity. In the parameterized complex- ity framework, for decision problems with input size n, and a parameter k, the goal is to design an algorithm with running time f (k)nO(1) , where f is a function of k alone. Problems having such an algorithm are said to be fixed parameter tractable (FPT). There is also a theory of hardness that allows us to identify parameterized problems that are not amenable to such algorithms. The hardness hierarchy is represented by W [i] for i ≥ 1. The theory of parameterized complexity was developed by Downey and Fellows (1999). For recent developments, see the book by Flum and Grohe (2006). In this paper we consider two variants of the local search problem for the well-known VERTEX COVER problem, that is, the strict and the permissive variant of local search (Marx and Schlotter 2011; Krokhin and Marx). In the strict variant the task is to either determine that there is no better solution in the k-exchange neighborhood, or to find a better solution in the k-exchange neighborhood. In the permissive variant, however, the task is to either determine that there is no better solution in the k-exchange neighborhood, or to find a better solution, which may or may not belong to the k-exchange neighborhood. Thus, permissive local search does not require the improved solution to belong to the local neighborhood, but still requires that at least the local neighborhood has been searched before abandoning the search. It can therefore be seen as a natural relaxation of strict local search with the potential to make local search applicable to a wider range of problems or instances. Indeed, we will present a class of instances for VERTEX COVER where strict local search is W[1]-hard, but permissive loal search is FPT. In heuristic local search, there is an abundance of techniques, such as random restarts and large neighborhood search, to escape local minima and boost the performance of algorithms (Hoos and Stutzle, 2004). Permissive lo- cal search is a specific way to escape the strictness of local search, but allows a rigorous analysis and performance guarantees. Relevant results. Recently, the parameterized complexity of local search has gained more and more attention. Starting with the first breakthrough in this area by Marx (2008) who investigated the parameterized complexity of TSP, several positive and negative results have been obtained in many areas of AI. For instance, the local search problem has already been investigated for a variant of the feedback edge set problem (Khuller, Bhatia, and Pless, 2003), for the problem of finding a minimum weight assignment for a Boolean constraint satisfaction instance (Krokhin and Marx), for the stable marriage problem with ties (Marx and Schlotter, 2011), for combi- natorial problems on graphs (Fellows et al., 2009), for feedback arc set problem on tournaments (Fomin et al., 2010), for the satisfiability problem (Szeider, 2011), and for Bayesian network structure learning (Ordyniak and Szeider, 2010). Our results. We investigate local search for the fundamental VERTEX COVER problem. This well-known combinatorial optimization problem has many applications (Abu-Khzam et al., 2004; Gomes et al., 2006) and is closely related to two other classic problems, INDEPENDENT SET and CLIQUE. All our results for VERTEX 2 COVER also hold for the INDEPENDENT SET problem, and for the CLIQUE problem on the complement graph classes. • We give the first compelling evidence that it is possible to enhance the tractability of local search problems if permissive local search is considered instead of strict local search. Indeed, the permissive variant allows us to solve the local search problem for VERTEX COVER for a significantly larger class of sparse graphs than strict local search. • We show that the strict local search VERTEX COVER problem remains W [1]-hard for special sparse in- stances, improving a result from Fellows et al. (2009). On the way to this result we introduce a size- restricted version of a Hall set problem which be believe to be interesting in its own right. • We answer a question of Krokhin and Marx in the affirmative, who asked whether there was a problem where finding the optimum is hard, strict local search is hard, but permissive local search is FPT. 2 Preliminaries The distance between two sets S1 and S2 is dist(S1, S2) = S1 ∪ S2 − S1 ∩ S2. We say that S1 is in the k- exchange neighborhood of S2 if dist(S1, S2) ≤ k. If we consider a universe V with S1, S2 ⊆ V , the characteristic functions of S1 and S2 with respect to V are at Hamming distance at most k if dist(S1, S2) ≤ k. All graphs considered in this paper are finite, undirected, and simple. Let G = (V, E) be a graph, S ⊆ V be a vertex set, and u, v ∈ V be vertices. The distance dist(u, v) between u and v is the minimum number of edges on a path from u to v in G. The (open) neighborhood of v is N (v) = { u ∈ V uv ∈ E }, i.e., the vertices at distance one from v, and its closed neighborhood is N [v] = N (v)∪{v}. We also define N (S) = Su∈S N (u)\ S and N [S] = N (S) ∪ S. More generally, N d(S) and N d[S] denote the set of vertices at distance d and at distance at most d from a vertex in S, respectively. We write N d(v) and N d[v] for N d({v}) and N d[{v}], respectively. The degree of v is d(v) = N (v). These notations may be subscripted by G, especially if the graph is not clear from the context. The graph G \ S is obtained from G by removing all vertices in S and all edges incident to vertices in S. The subgraph of G induced by S is G \ (V \ S) and it is denoted G[S]. The set S is a vertex cover of G if G \ S has no edge. The set S is an independent set of G if G[S] has no edge. The graph G is bipartite if its vertex set can be partitioned into two independent sets A and B. In this case, we also denote the graph by a triple G = (A, B, E). The instances considered in this paper are d-degenerate graphs. The degeneracy of G is the minimum d such that every subgraph of G has a vertex of degree at most d. Degeneracy is a fundamental sparsity measure of graphs. A graph G′ is obtained from G by subdividing an edge xy ∈ E if G′ is obtained by removing the edge xy, and adding a new vertex zxy and edges xzxy and zxyy. A graph G′ is obtained from G by subdividing an edge xy ∈ E twice if G′ is obtained by removing the edge xy, and adding new vertices zxy and z′ xyy. The graph G is 2-subdivided if G can be obtained from a graph G′ by subdividing each edge of G′ twice. xy and edges xzxy, zxyz′ xy and z′ 3 Hardness proofs In this section we show that strict local search for VERTEX COVER is W[1]-hard on 2-subdivided graphs. LS-VERTEX COVER Input: Parameter: The integer k. Question: A graph G = (V, E), a vertex cover S ⊆ V of G, and an integer k. Is there a vertex cover S′ ⊆ V in the k-exchange neighborhood of S with S′ < S? Our proof will strengthen the following result of Fellows et al. (2009). Theorem 1 (Fellows et al., 2009). LS-VERTEX COVER is W[1]-hard and remains W[1]-hard when restricted to 3-degenerate graphs. 3 G G′ a b a vab b Figure 1: Reduction from Lemma 2 illustrated for one edge of G. . . . U As 2-subdivided graphs are 2-degenerate, our result implies that LS-VERTEX COVER is W[1]-hard when restricted to 2-degenerate graphs as well. We first show that the following intermediate problem is W[1]-hard for 2-subdivided graphs. HALL SET A bipartite graph G = (A, B, E) and an integer k. Input: Parameter: The integer k Question: Is there a set S ⊆ A of size at most k such that N (S) < S? As HALL SET is a very natural problem related to matching theory, and to give an intuition for the W[1]- hardness proof for HALL SET restricted to 2-subdivided graphs, we first show that HALL SET is W[1]-hard on general graphs. Lemma 2. HALL SET is W[1]-hard. Proof. We prove the lemma by a parameterized reduction from CLIQUE, which is W[1]-hard (Downey and Fellows, 1999). CLIQUE Input: Parameter: The integer k. Question: A graph G and an integer k. Does G have a clique of size k? Let (G, k) be an instance for CLIQUE. We construct an instance (G′, k′) for HALL SET as follows. Set k′ − 1. Thus, S is a Hall set of size k′. with t := k′ − k − 1, and add an edge veu for each e ∈ E and u ∈ U . Set A := { ve e ∈ E } and B := V ∪ U . Suppose G has a clique C of size k. Consider the set S := { ve ∈ A e ⊆ C }, i.e., the set of vertices 2(cid:1). Subdivide each edge e of G by a new vertex ve, then add a set of t new vertices U = {u1, . . . , ut}, 2(cid:1) = k′. Moreover, N (S) = C ∪ U = k + t = k′ := (cid:0)k introduced in G′ to subdivide the edges of C. Then, S = (cid:0)k each vertex from S has two neighbors in V , we have S ≤ (cid:0)V ∩N (S) that S −(cid:0)k 2(cid:1) + k + 1 > V ∩ N (S), which can only be achieved if S = (cid:0)k (cid:1). From S > t + V ∩ N (S) it follows 2(cid:1) and V ∩ N (S) = k. But then, On the other hand, suppose S ⊆ A is a Hall Set of size at most k′. As S 6= ∅, we have that U ⊆ N (S). Since V ∩ N (S) is a clique of size k in G. 2 We now generalize the above proof and reduce CLIQUE to HALL SET restricted to 2-subdivided graphs. Lemma 3. HALL SET is W[1]-hard even if restricted to 2-subdivided graphs. Proof. Let (G, k) be an instance for CLIQUE. We construct an instance (G′, k′) for HALL SET as follows. Set t = (cid:0)k 2(cid:1) − k − 1 and k′ = (3 + t) · (cid:0)k new vertices U = {u1, . . . , ut}, and add an edge veu for each e ∈ E and u ∈ U . This graph is bipartite with bipartition (A, B) where A := { ve e ∈ E } and B := V ∪ U . Now, make a 2-subdivision of each edge. Choose A′ ⊇ A and B′ ⊇ B so that (A′, B′) is a bipartition of the vertex set of the resulting graph G′ = (V ′, E′). 2(cid:1). Subdivide each edge e of G by a new vertex ve. Then add a set of t 4 G G′ a b a vab b Figure 2: Reduction from Lemma 3 illustrated for one edge of G. . . . U Suppose G has a clique C of size k. Consider the set S := { ve ∈ A e ⊆ C }, i.e., the set of vertices introduced to subdivide the edges of C. Set S′ := S ∪ N 2 Moreover, N (S′) = C ∪ NG′(S) ∪ U = k + (2 + t)(cid:0)k G′(S). Then, S′ ⊆ A′ and S′ = (3 + t)(cid:0)k 2(cid:1) + t = k′ − 1. Thus, S′ is a Hall set of size k′. 2(cid:1) = k′. On the other hand, suppose S ⊆ A is a Hall Set of G′ of size at most k′. Set S′ := S and exhaustively apply the following rule. Minimize If there is a vertex v ∈ A such that ∅ 6= S′ ∩ ({v} ∪ N 2(v)) 6= {v} ∪ N 2(v), then remove {v} ∪ N 2(v) from S′. To see that the resulting S′ is a Hall Set in G′, consider a set S2 that is obtained from a Hall Set S1 by one application of the Minimize rule. Suppose v ∈ A such that ∅ 6= S1 ∩ ({v} ∪ N 2(v)) 6= {v} ∪ N 2(v) but S2 ∩ ({v} ∪ N 2(v)) = ∅. If v /∈ S1, then removing a vertex u ∈ N 2(v) from S1 decreases S1 by one and N (S1) by at least one; namely the vertex in N (u) ∩ N (v) disappears from N (S1) when removing v from S1. After removing all vertices in N 2(v) from S1, we obtain a set S2 such that N (S1) − N (S2) ≥ S1 − S2. As N (S1) ≤ S1 − 1, we obtain that N (S2) ≤ S2 − 1 and therefore, S2 is a Hall Set of size at most k′. On the other hand, if v ∈ S1, then there is a vertex u ∈ N 2(v) \ S1. Then, removing v from S1 decreases S1 by one and N (S1) by at least one; namely, the vertex in N (u) ∩ N (v) disappears from N (S1) when removing v from S1. Thus, S1 \ {v} is a Hall Set of size at most k′ and we can appeal to the previous case with S1 := S1 \ {v}. We have now obtained a Hall set S′ of size at most k′ such that for every v ∈ A, either S′ ∩({v}∪N 2(v)) = ∅ or {v} ∪ N 2(v) ⊆ S′ As S′ 6= ∅, we have that U ⊆ N (S′). Expressing the size of S′ in terms of vertices from A we obtain that S′ = (3 + t)S′ ∩ A. Similarly, we express N (S′), which contains all vertices from N (S′ ∩ A), all vertices in U and some vertices from V ∩ N 3(S′). Now, N (S′) = (2 + t)S′ ∩ A + t + V ∩ N 3(S′). S′ > N (S′) (3 + t)S′ ∩ A > (2 + t)S′ ∩ A + t + V ∩ N 3(S′) S′ ∩ A −(cid:18)k 2(cid:19) > V ∩ N 3(S′) − k − 1. Since there are two vertices in V ∩ N 3(v) for each vertex v ∈ S′ ∩ A, we have S′ ∩ A ≤ (cid:0)V ∩N 3(S ′) (cid:1). 2(cid:1) and 2(cid:1). Therefore, the previous inequality can only be satisfied if S′ ∩ A = (cid:0)k 2 Moreover, S′ ∩ A ≤ k′ V ∩ N 3(S′) = k. Then, V ∩ N 3(S′) is a clique of size k in G. 3+t = (cid:0)k Finally, we rely on the previous lemma to establish W[1]-hardness of LS-VERTEX COVER for 2-subdivided graphs. The reduction will make clear that the HALL SET problem captures the essence of the LS-VERTEX COVER problem. 5 Theorem 4. LS-VERTEX COVER is W[1]-hard when restricted to 2-subdivided graphs. Proof. The proof uses a reduction from HALL SET restricted to 2-subdivided graphs. Let (G, k) be an instance for HALL SET where G = (A, B, E) is a 2-subdivided graph. The set A is a vertex cover for G. Consider (G, A, k′), with k′ := 2k − 1 as an instance for LS-VERTEX COVER. Let S ⊆ A be a Hall Set of size at most k for G, i.e., N (S) < S. Then, (A \ S) ∪ N (S) is a vertex cover for G of size at most A − 1. Moreover, this vertex cover is in the k′-exchange neighborhood of A. := C. On the other hand, let C be a vertex cover in the k′-exchange neighborhood of A such that C < A. Set C′ If A \ C > k, then add A \ C − k vertices from A \ C to C′. The resulting set C′ is also in the k′-exchange neighborhood of A and C′ < A. Set S := A \ C′. Then, S ≤ k. As C′ is a vertex cover, N (S) ⊆ C′. But since C′ is smaller than A, we have that C′ ∩ B ≤ S − 1 Therefore, N (S) ≤ C′ ∩ B ≤ S − 1, which shows that S is a Hall Set of size at most k for G. 4 FPT Algorithm In this section we will show that the permissive version of LS-VERTEX COVER is fixed-parameter tractable for a generalization of 2-subdivided graphs. PLS-VERTEX COVER A graph G, a vertex cover S, and a positive integer k. Input: Parameter: The integer k. Task: Determine that G has no vertex cover S′ with dist(S, S′) ≤ k and S′ < S or find a vertex cover S′′ with S′′ < S. The initial algorithm will be randomized, and we will exploit the following pseudo-random object and theo- rem to derandomize it. Definition 1 (Naor, Schulman, and Srinivasan, 1995). An (n, t)-universal set F is a set of functions from {1, . . . , n} to {0, 1}, such that for every subset S ⊆ {1, . . . , n} with S = t, the set FS = { f S f ∈ F } is equal to the set 2S of all the functions from S to {0, 1}. Theorem 5 (Naor, Schulman, and Srinivasan, 1995). There is a deterministic algorithm with running time O(2ttO(log t)n log n) that constructs an (n, t)-universal set F such that F = 2ttO(log t) log n. Our FPT algorithm will take as input a β-separable graph. Definition 2. For a fixed non-negative integer β, a graph G = (V, E) is β-separable if there exists a bipartition of V into V1 and V2 such that • for each v ∈ V1, N (v) ∩ V1 ≤ β, and • for each w ∈ V2, N (w) ≤ β. A bipartition of V satisfying these properties is a partition certifying β-separability. By G(β) we denote the set of all β-separable graphs. Remark 1. Observe that a graph of degree at most d is d-separable. Similarly every 2-subdivided graph is 2-separable. The following lemma characterizes solutions for PLS-VERTEX COVER that belong to the k-exchange neigh- borhood of S. Lemma 6. Let G = (V, E) be a graph, S be a vertex cover of G and k be a positive integer. Then there exists a vertex cover S′ such that S′ < S and dist(S, S′) ≤ k if and only if there exists a set S∗ ⊆ S such that 1. S∗ is an independent set, 2. N (S∗) \ S < S∗, and 3. N (S∗) \ S + S∗ ≤ k. 6 Proof. We first show the forward direction of the proof. Let S∗ = S \ S′. Since I = V \ S′ is an independent set and S∗ ⊆ I we have that S∗ is an independent set. Furthermore, since S∗ is in I we have that N (S∗) ⊆ S′ and in particular N (S∗) \ S is the set of vertices that are present in S′ but not in S. Since S′ < S we have that N (S∗) \ S < S∗ and by the fact that dist(S, S′) ≤ k we have that N (S∗) \ S + S∗ ≤ k. For the reverse direction it is easy to see that (S \ S∗) ∪ (N (S∗) \ S) is the desired S′. This completes the proof. To obtain the FPT algorithm for PLS-VERTEX COVER on G(β) we will use Lemma 6. More precisely, our strategy is to obtain an FPT algorithm for finding a subset Q ⊆ S such that Q is an independent set and S∗ ⊆ Q. Here, S∗ is as described in Lemma 6. Thus, our main technical lemma is the following. Lemma 7. Let β be a fixed non-negative integer. Let G be a β-separable graph, S be a vertex cover of G and k be a positive integer. There is a O(2qqO(log q)n log n) time algorithm finding a family Q of subsets of S such that (a) Q ≤ 2qqO(log q) log n, (b) each Q ∈ Q is an independent set, and (c) if there exists a S∗ as described in Lemma 6, then there exists a Q ∈ Q such that S∗ ⊆ Q. Here, q = k + βk. We postpone the proof of Lemma 7 and first give the main result that uses Lemma 7 crucially. Theorem 8. Let β be a fixed non-negative integer. PLS-VERTEX COVER is FPT on G(β) with an algorithm running in time 2qqO(log q)nO(1), where q = k + βk. Proof. Let G be the input graph from G(β), S be a vertex cover of G, and k be a positive integer. Fix q = k + βk and I = V \S. We first apply Lemma 7 and obtain a family Q of subsets of S such that (a) Q ≤ 2qqO(log q) log n and (b) each Q ∈ Q is an independent set. The family Q has the additional property that if there exists a set S∗ as described in Lemma 6, then there exists a Q ∈ Q such that S∗ ⊆ Q. For every Q ∈ Q, the algorithm proceeds as follows. Consider the bipartite graph G[Q ∪ I]. Now in polynomial time check whether there exists a subset W ⊆ Q such that N (W ) < W in G[Q ∪ I]. This is done by checking Halls' condition that says that there exists a matching saturating Q if and only if for all A ⊆ Q, N (A) ≥ A. A polynomial time algorithm that finds a maximum matching in a bipartite graph can be used to find a violating set A if there exists one. See Kozen (1991) for more details. Returning to our algorithm, if we find such set W then we return S′ = (S \ W ) ∪ N (W ). Clearly, S′ is a vertex cover and S′ < S. Now we argue that if for every Q ∈ Q we do not obtain the desired W , then there is no vertex cover S′ such that S′ < S and dist(S, S′) ≤ k. However, this is guaranteed by the fact that if there would exist such a set S′, then by Lemma 6 there exist a desired S∗. Thus, when we consider the set Q ∈ Q such that S∗ ⊆ Q then we would have found a W ⊆ Q such that N (W ) < W in G[Q ∪ I]. This proves the correctness of the algorithm. The running time of the algorithm is governed by the size of the family Q. This completes the proof. To complete the proof of Theorem 8, the only remaining component is a proof of Lemma 7 which we give below. Proof of Lemma 7. Let G be a β-separable graph, S be a vertex cover of G, and k be a positive integer. By the proof of Lemma 6 we know that if there exists a vertex cover S′ such that S′ < S and dist(S, S′) ≤ k then there exists a set S∗ ⊆ S such that 1. S∗ is an independent set, 2. N (S∗) \ S < S∗, and 3. N (S∗) \ S + S∗ ≤ k. We first give a randomized procedure that produces a family Q satisfying the properties of the lemma with high probability. In a second stage, we will derandomize it using universal sets. For our argument we fix one such S∗ and let V1 and V2 be a partition certifying β-separability of G. Let S1 = S∗ ∩ V1 and S2 = S∗ ∩ V2. Since G is a β-separable graph, we have that N [S1] ∩ (V1 ∩ S) + N [S2] ∩ S ≤ βS1 + S1 + βS2 + S2 ≤ k + βk. We also know that S∗ ≤ k. Let q = k + βk and A = (N [S1] ∩ (V1 ∩ S)) ∪ (N [S2] ∩ S). Now, uniformly at random color the vertices of S with {0, 1}, that is, color each vertex of S with 0 with probability 1 2 and with 1 otherwise. Call this coloring f . The probability that for all x ∈ S∗, f (x) = 0 and for all y ∈ (A \ S∗), f (y) = 1, is 1 2A ≥ 1 2q . Given the random coloring f we obtain a set Q(f ) ⊆ S with the following properties 7 • Q(f ) is an independent set; and • with probability at least 2−q, S∗ ⊆ Q(f ). We obtain the set Q(f ) as follows. Let C0 = { v v ∈ S, f (v) = 0 }, that is, C0 contains all the vertices of S that have been assigned 0 by f . Let C1 0 . 0 := C0 \C1 Let E′ 0) be the set of end-points of the edges in E′ 0 ⊆ C0 ∩V2 be the set of vertices that have degree at least 1 in G[C0]. Let C′ 0. Define Q(f ) := C′ 0 be the set of edged in the induced graph G[C′ 0] and V (E′ 0 \ V (E′ 0). By the procedure it is clear that Q(f ) is an independent set. However, note that it is possible that Q(f ) = ∅. Now we show that with probability at least e−q, S∗ ⊆ Q(f ). Let Ci = { v v ∈ S, f (v) = i }, i ∈ {0, 1}. By the probability computation above we know that with probability at least e−q, S∗ ⊆ C0 and A \ S∗ ⊆ C1. Now we will show that the procedure that prunes C0 and obtains Q(f ) does not remove any vertices of S∗. All the vertices in the set N (S2) ∩ S are contained in C1 and thus there are no edges incident to any vertex in S2 in G[C0]. Therefore the only other possibility is that we could remove vertices of S1 ∩ C0. However, to do so there must be an edge between a vertex in S1 and a vertex in V1 ∩ S, but we know that all such neighbors of vertices of S1 are in C1. This shows that with probability at least 2−q, S∗ ⊆ Q(f ). We can boost the success probability of the above random procedure to a constant, by independently repeating the procedure 2q times. Let the random functions obtained while repeating the above procedure be fj, j ∈ {1, . . . , 2q} and let Q(fj) denote the corresponding set obtained after applying the above pruning procedure. The probability that one of the Q(fj) contains S∗ is at least 1 −(cid:18)1 − 1 2q(cid:19)2q ≥ 1 − 1 e ≥ 1 2 . Thus we obtain a collection Q of subsets of S with the following properties. • Q ≤ 2q, where Q = { Q(fj) j ∈ {1, . . . , 2q} }, • every set Q ∈ Q is an independent set, and 2 , there exists a set Q ∈ Q such that S∗ ⊆ Q. • with probability at least 1 Finally, to derandomize the above procedure we will use Theorem 5. We first compute a (S, q)-universal set F with the algorithm described in Theorem 5 in time O(2qqO(log q)S log S) of size 2qqO(log q) log S. Now every function f ∈ F can be thought of as a function from S to {0, 1}. Given this f we obtain Q(f ) as described above. Let Q = { Q(f ) f ∈ F }. Clearly, Q ≤ 2qqO(log q) log n. Now if there exists a set S∗ of the desired type then the Q(f ) corresponding to the function f ∈ F, that assigns 0 to every vertex in S∗ and 1 to every vertex in A \ S∗, has the property that S∗ ⊆ Q(f ) and Q(f ) is an independent set. This completes the proof. It is easily seen that finding minimum vertex cover of a 2-subdivided graph is NP-hard. Indeed, it follows from the NP-hardness of the VERTEX COVER problem on general graphs since: if G′ is a 2-subdivision of a graph G with m edges, then G has a vertex cover of size at most k if and only if G′ has a vertex cover of size at most k + m. Thus, Theorems 4 and 8 together resolve a question raised by (Krokhin and Marx), who asked for a problem where finding the optimum is hard, strict local search is hard, but permissive local search is FPT. 5 Conclusion In this paper we have shown that from the parameterized complexity point of view, permissive Local Search is indeed more powerful than the strict Local Search and thus may be more desirable. We have demonstrated this on one example, namely VERTEX COVER, but it would be interesting to find a broader set of problems where the complexity status of the strict and permissive versions of local search differ. We believe that the results in this paper have opened up a complete new direction of research in the domain of parameterized local search, which is still in nascent stage. It would be interesting to undertake a similar study for FEEDBACK VERTEX SET, even on planar graphs. 8 Acknowledgments All authors acknowledge support from the OeAD (Austrian Indian collaboration grant, IN13/2011). Serge Gaspers, Sebastian Ordyniak, and Stefan Szeider acknowledge support from the European Research Council (COMPLEX REASON, 239962). Serge Gaspers acknowledges support from the Australian Research Council (DE120101761). Eun Jung Kim acknowledges support from the ANR project AGAPE (ANR-09-BLAN-0159). References Aarts, E. H. L.; Korst, J.; and van Laarhoven, P. J. M. 1997. Simulated annealing. Local Search in Combintaorial Optimization, Wiley 91 -- 120. Abu-Khzam, F. N.; Collins, R. L.; Fellows, M. R.; Langston, M. A.; Suters, W. H.; and Symons, C. T. 2004. Kernelization algorithms for the vertex cover problem: Theory and experiments. In Proceedings of the 6th Workshop on Algorithm Engineering and Experiments (ALENEX 2004), 62 -- 69. SIAM. Alimonti, P. 1995. Non-oblivious local search for graph and hypergraph coloring problems. In WG, volume 1017 of Lecture Notes in Computer Science, 167 -- 180. Springer Verlag. Alimonti, P. 1997. Non-oblivious local search for MAX 2-CCSP with application to max dicut. In WG, volume 1335 of Lecture Notes in Computer Science, 2 -- 14. Springer Verlag. Bock, F. 1958. An algorithm for solving 'traveling-salesman' and related network optimization problems. Re- search report, Armour Research Foundation. Croes, G. 1958. A method for solving traveling-salesman problems. Operations Research 6:791 -- 812. Downey, R. G., and Fellows, M. R. 1999. Parameterized Complexity. Monographs in Computer Science. New York: Springer Verlag. Fellows, M. R.; Rosamond, F. A.; Fomin, F. V.; Lokshtanov, D.; Saurabh, S.; and Villanger, Y. 2009. Local search: Is brute-force avoidable? In Boutilier, C., ed., IJCAI 2009, Proceedings of the 21st International Joint Conference on Artificial Intelligence, Pasadena, California, USA, July 11-17, 2009, 486 -- 491. Flum, J., and Grohe, M. 2006. Parameterized Complexity Theory, volume XIV of Texts in Theoretical Computer Science. An EATCS Series. Berlin: Springer Verlag. Fomin, F. V.; Lokshtanov, D.; Raman, V.; and Saurabh, S. 2010. Fast local search algorithm for weighted feedback arc set in tournaments. In Fox, M., and Poole, D., eds., Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2010, Atlanta, Georgia, USA, July 11-15, 2010. AAAI Press. Gomes, F. C.; de Meneses, C. N.; Pardalos, P. M.; and Viana, G. V. R. 2006. Experimental analysis of approxi- mation algorithms for the vertex cover and set covering problems. Computers & OR 33(12):3520 -- 3534. Guo, J., and Niedermeier, R. 2007. Invitation to data reduction and problem kernelization. ACM SIGACT News 38(2):31 -- 45. Gupta, A., and Tardos, ´E. 2000. A constant factor approximation algorithm for a class of classification problems. In STOC, 652 -- 658. Hoos, H. H., and Stutzle, T. 2004. Stochastic Local Search: Foundations and Applications. Elsevier/Morgan Kaufmann. Khanna, S.; Motwani, R.; Sudan, M.; and Vazirani, U. V. 1998. On syntactic versus computational views of approximability. SIAM J. Comput. 28(1):164 -- 191. Khuller, S.; Bhatia, R.; and Pless, R. 2003. On local search and placement of meters in networks. SIAM J. Comput. 32(2):470 -- 487. 9 Kozen, D. C. 1991. The Design and Analysis of Algorithms (Monographs in Computer Science). Springer-Verlag. Krokhin, A., and Marx, D. On the hardness of losing weight. ACM Transactions on Algorithms 8(2):19,2012. Marx, D., and Schlotter, I. 2011. Stable assignment with couples: Parameterized complexity and local search. Discrete Optimization 8(1):25 -- 40. Marx, D. 2008. Searching the k-change neighborhood for TSP is W[1]-hard. Oper. Res. Lett. 36(1):31 -- 36. Naor, M.; Schulman, L. J.; and Srinivasan, A. 1995. Splitters and near-optimal derandomization. In Proceedings of the 36th Annual Symposium on Foundations of Computer Science (FOCS 1995). IEEE Computer Society. 182 -- 191. Ordyniak, S., and Szeider, S. 2010. Algorithms and complexity results for exact bayesian structure learning. In Grunwald, P., and Spirtes, P., eds., Proceedings of UAI 2010, The 26th Conference on Uncertainty in Artificial Intelligence, Catalina Island, California, USA, July 8-11, 2010. AUAI Press, Corvallis, Oregon. Papadimitriou, C. H., and Steiglitz, K. 1977. On the complexity of local search for the traveling salesman problem. SIAM J. Comput. 6(1):76 -- 83. Szeider, S. 2011. The parameterized complexity of k-flip local search for sat and max sat. Discrete Optimization 8(1):139 -- 145. 10
1606.05975
2
1606
2017-02-15T13:07:23
Cutwidth: obstructions and algorithmic aspects
[ "cs.DS", "math.CO" ]
Cutwidth is one of the classic layout parameters for graphs. It measures how well one can order the vertices of a graph in a linear manner, so that the maximum number of edges between any prefix and its complement suffix is minimized. As graphs of cutwidth at most $k$ are closed under taking immersions, the results of Robertson and Seymour imply that there is a finite list of minimal immersion obstructions for admitting a cut layout of width at most $k$. We prove that every minimal immersion obstruction for cutwidth at most $k$ has size at most $2^{O(k^3\log k)}$. As an interesting algorithmic byproduct, we design a new fixed-parameter algorithm for computing the cutwidth of a graph that runs in time $2^{O(k^2\log k)}\cdot n$, where $k$ is the optimum width and $n$ is the number of vertices. While being slower by a $\log k$-factor in the exponent than the fastest known algorithm, given by Thilikos, Bodlaender, and Serna in [Cutwidth I: A linear time fixed parameter algorithm, J. Algorithms, 56(1):1--24, 2005] and [Cutwidth II: Algorithms for partial $w$-trees of bounded degree, J. Algorithms, 56(1):25--49, 2005], our algorithm has the advantage of being simpler and self-contained; arguably, it explains better the combinatorics of optimum-width layouts.
cs.DS
cs
Cutwidth: obstructions and algorithmic aspectsa,b Archontia C. Giannopoulouc Micha l Pilipczukd Jean-Florent Raymondd ,e Dimitrios M. Thilikose ,f Marcin Wrochnad Abstract Cutwidth is one of the classic layout parameters for graphs. It measures how well one can order the vertices of a graph in a linear manner, so that the maximum number of edges between any prefix and its complement suffix is minimized. As graphs of cutwidth at most k are closed under taking immersions, the results of Robertson and Seymour imply that there is a finite list of minimal immersion obstructions for admitting a cut layout of width at most k. We prove that every minimal immersion obstruction for cutwidth at most k has size at most 2O(k3 log k). As an interesting algorithmic byproduct, we design a new fixed-parameter algorithm for computing the cutwidth of a graph that runs in time 2O(k2 log k) · n, where k is the optimum width and n is the number of vertices. While being slower by a log k-factor in the exponent than the fastest known algorithm, given by Thilikos, Bodlaender, and Serna in [Cutwidth I: A linear time fixed parameter algorithm, J. Algorithms, 56(1):1–24, 2005] and [Cutwidth II: Algorithms for partial w-trees of bounded degree, J. Algorithms, 56(1):25–49, 2005], our algorithm has the advantage of being simpler and self-contained; arguably, it explains better the combinatorics of optimum-width layouts. Keywords: cutwidth, obstructions, immersions, fixed-parameter tractability. aThis work was partially done while Archontia C. Giannopoulou was holding a post-doc position at Warsaw Center of Mathematics and Computer Science. The research of Archontia C. Giannopoulou has been supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (ERC consolidator grant DISTRUCT, agreement No 648527). The research of Micha l Pilipczuk and Marcin Wrochna is supported by the Polish National Science Center grant SONATA UMO-2013/11/D/ST6/03073. The research of Jean-Florent Raymond is supported by the Polish National Science Center grant PRELUDIUM UMO-2013/11/N/ST6/02706. Micha l Pilipczuk is supported by the Foundation for Polish Science (FNP) via the START stipend programme. bEmails: [email protected], [email protected], jean-florent. [email protected], [email protected], and [email protected]. cTechnische Universitat Berlin, Berlin, Germany. dInstitute of Informatics, University of Warsaw, Poland. eAlGCo project team, CNRS, LIRMM, Montpellier, France. fDepartment of Mathematics, National and Kapodistrian University of Athens, Athens, Greece. 1 1 Introduction The cutwidth of a graph is defined as the minimum possible width of a linear ordering of its vertices, where the width of an ordering σ is the maximum, among all the prefixes of σ, of the number of edges that have exactly one vertex in a prefix. Due to its natural definition, cutwidth has various applications in a range of practical fields of computer science: whenever data is expected to be roughly linearly ordered and dependencies or connections are local, one can expect the cutwidth of the corresponding graph to be small. These applications include circuit design, graph drawing, bioinformatics, and text information retrieval; we refer to the survey of layout parameters of D´ıaz, Petit, and Serna [6] for a broader discussion. As finding a layout of optimum width is NP-hard [9], the algorithmic and combinatorial aspects of cutwidth were intensively studied. There is a broad range of polynomial-time algo- rithms for special graph classes [13, 14, 26], approximation algorithms [18], and fixed-parameter algorithms [22, 23]. In particular, Thilikos, Bodlaender, and Serna [22, 23] proposed a fixed- parameter algorithm for computing the cutwidth of a graph that runs1 in time 2O(k2) · n, where k is the optimum width and n is the number of vertices. Their approach is to first compute the pathwidth of the input graph, which is never larger than the cutwidth. Then, the optimum layout can be constructed by an elaborate dynamic programming procedure on the obtained path decomposition. To upper bound the number of relevant states, the authors had to understand how an optimum layout can look in a given path decomposition. For this, they borrow the technique of typical sequences of Bodlaender and Kloks [3], which was introduced for a similar reason, but for pathwidth and treewidth instead of cutwidth. Since the class of graphs of cutwidth at most k is closed under immersions, and the immersion order is a well-quasi ordering of graphs2 [19], it follows that for each k there exists a finite obstruction set Lk of graphs such that a graph has cutwidth at most k if and only if it does not admit any graph from Lk as an immersion. However, this existential result does not give any hint on how to generate, or at least estimate the sizes of the obstructions. The sizes of obstructions are important for efficient treatment of graphs of small cutwidth; this applies also in practice, as indicated by Booth et al. [4] in the context of VLSI design. The estimation of sizes of minimal obstructions for graph parameters like pathwidth, treewidth, or cutwidth, has been studied before. For minor-closed parameters pathwidth and treewidth, Lagergren [17] showed that any minimal minor obstruction to admitting a path decomposition of width k has size at most single-exponential in O(k4), whereas for tree decompositions he showed an upper bound double-exponential in O(k5) . Less is known about immersion-closed parame- ters, like cutwidth. Govindan and Ramachandramurthi [12] showed that the number of minimal immersion obstructions for the class of graphs of cutwidth at most k is at least 3k−7 +1, and their construction actually exemplify minimal obstructions for cutwidth at most k with (3k−5 − 1)/2 vertices. To the best of our knowledge, nothing was known about upper bounds for the cutwidth case. 1Thilikos, Bodlaender, and Serna [22,23] do not specify the parametric dependence of the running time of their algorithm. A careful analysis of their algorithm yields the above claimed running time bound. 2All graphs considered in this paper may have parallel edges, but no loops. 2 1.1 Results on obstructions. Our main result concerns the sizes of obstructions for cutwidth. Theorem 1. Suppose a graph G has cutwidth larger than k, but every graph with fewer vertices or edges (strongly) immersed in G has cutwidth at most k. Then G has at most 2O(k3 log k) vertices and edges. The above result immediately gives the same upper bound on the sizes of graphs from the minimal obstruction sets Lk as they satisfy the prerequisites of Theorem 1. This somewhat matches the (3k−5 − 1)/2 lower bound of Govindan and Ramachandramurthi [12]. Our approach for Theorem 1 follows the technique used by Lagergren [17] to prove that minimal minor obstructions for pathwidth at most k have sizes single-exponential in O(k4). Intuitively, the idea of Lagergren is to take an optimum decomposition for a minimal obstruction, which must have width k + 1, and to assign to each prefix of the decomposition one of finitely many "types", so that two prefixes with the same type "behave" in the same manner. If there were two prefixes, one being shorter than the other, with the same type, then one could replace one with the other, thus obtaining a smaller obstruction. Hence, the upper bound on the number of types, being double-exponential in O(k4), gives some upper bound on the size of a minimal obstruction. This upper bound can be further improved to single-exponential by observing that types are ordered by a natural domination relation, and the shorter a prefix is, the weaker is its type. An important detail is that one needs to make sure that the replacement can be modeled by minor operations. For this, Lagergren uses the notion of linked path decompositions (a weaker variant of lean path decompositions; cf. [1, 24]). To prove Theorem 1, we perform a similar analysis of prefixes of an optimum ordering of a minimal obstruction. We show that prefixes can be categorized into a bounded number of types, each comprising prefixes that have the same "behavior". Provided two prefixes with equally strong type appear one after the other, we can "unpump" the part of the graph in their difference. To make sure that unpumping is modeled by taking an immersion, we define linked orderings for cutwidth and reprove the analogue of the result of Thomas [24] (see [1] for simplified proofs): there is always an optimum-width ordering that is linked. We remark this already follows from more general results on submodular functions: the same is true for parameters like linear rank- width, as observed by Kant´e and Kwon [15], which in turns follows from the proof of an analogous theorem of Geelen et al. [10] that applies to branch-decompositions, and thus, e.g., to parameters known as branch-width and carving-width. The proof of the upper bound on the number of types essentially boils down to the following setting. We are given a graph G and a subset X of vertices, such that at most ℓ edges have exactly one endpoint in X. The question is how X can look like in an optimum-width ordering of G. We prove that there is always an ordering where X is split into at most O(kℓ) blocks, where k is the optimum width. This allows us to store the relevant information on the whole X in one of a constant number of types (called bucket interfaces). The swapping argument used 3 in this proof holds the essence of the typical sequences technique of Bodlaender and Kloks [3], while being, in our opinion, more natural and easier to understand. As an interesting byproduct, we can also use our understanding to treat the problem of removing edges to get a graph of small cutwidth. More precisely, for parameters w, k, we consider the class of all graphs G, such that w edges can be removed from G to obtain a graph of cutwidth at most k. We prove that for every constant k, the minimal (strong) immersion obstructions for this class have sizes bounded linearly in w. Moreover we give an exponential lower bound to the number of these obstructions. These results are presented in Section 6. 1.2 Algorithmic results. Consider the following "compression" problem: given a graph G and its ordering σ of width ℓ, we would like to construct, if possible, a new ordering of the vertices of G of width at most k, where k < ℓ. Then the types defined above essentially match states that would be associated with prefixes of σ in a dynamic programming algorithm solving this problem. Alternatively, one can think of building an automaton that traverses the ordering σ of width ℓ while constructing an ordering of G of width at most k. Hence, our upper bound on the number of types can be directly used to limit the state space in such a dynamic programming procedure/automaton, yielding an FPT algorithm for the above problem. With this result in hand, it is not hard to design of an exact FPT algorithm for cutwidth. One could introduce vertices one by one to the graph, while maintaining an ordering of optimum width. Each time a new vertex is introduced, we put it anywhere into the ordering, and it can be argued that the new ordering has width at most three times larger than the optimum. Then, the dynamic programming algorithm sketched above can be used to "compress" this approximate ordering to an optimum one in linear FPT time. The above approach yields a quadratic algorithm. To match the optimum, linear running time, we use a similar trick as Bodlaender in his linear-time algorithm for computing the treewidth of the graph [2]. Namely, we show that instead of processing vertices one by one, we can proceed recursively by removing a significant fraction of all the edges at each step, so that their reintroduction increases the width at most twice. We then run the compression algorithm on the obtained 2-approximate ordering to get an optimum one. The main point is that, since we remove a large portion of the graph at each step, the recursive equation on the running time solves to a linear function, instead of quadratic. This gives the following. Theorem 2. There exists an algorithm that, given an n-vertex graph G and an integer k, runs in time 2O(k2 log k) · n and either correctly concludes that the cutwidth of G is larger than k, or outputs an ordering of G of width at most k. The algorithm of Theorem 2 has running time slightly larger than that of Thilikos, Bodlaender, and Serna [22, 23]. The difference is the log k factor in the exponent, the reason for which is that we use a simpler bucketing approach to bound the number of states, instead of the more entangled, but finer, machinery of typical sequences. We believe the main strength of our approach lies in its explanatory character. Instead of relying on algorithms for computing tree 4 or path decompositions, which are already difficult by themselves, and then designing a dynamic programming algorithm on a path decomposition, we directly approach cutwidth "via cutwidth", and not "via pathwidth". That is, the dynamic programming procedure for computing the optimum cutwidth ordering on an approximate cutwidth ordering is technically far simpler and conceptually more insightful than performing the same on a general path decomposition. We also show that the "reduction-by-a-large-fraction" trick of Bodlaender [2] can be performed also in the cutwidth setting, yielding a self-contained, natural, and understandable algorithm. 2 Preliminaries We denote the set of non-negative integers by N and the set of positive integers by N+. For r, s ∈ N with r ≤ s, we denote [r] = {1, . . . , r} and [r, s] = {r, . . . , s}. Notice that [0] = ∅. Graphs. All graphs considered in this paper are undirected, without loops, and may have mul- tiple edges. The vertex and edge sets of a graph G are denoted by V (G) and E(G), respectively. For disjoint X, Y ⊆ V (G), by EG(X, Y ) we denote the set of edges of G with one endpoint in X and one in Y . If S ⊆ V (G), then we denote δG(S) = EG(S, V (G) \ S). We drop the subscript if it is clear from the context. Every partition (A, B) of V (G) is called a cut of G; the size of the cut (A, B) is δ(A). Cutwidth. Let G be a graph and σ be an ordering of V (G). For u, v ∈ V (G), we write u <σ v if u appears before v in σ. Given two disjoint sequences σ1 = hx1, . . . , xr1i and σ2 = hy1, . . . , yr2i of vertices in V (G), we define their concatenation as σ1 ◦ σ2 = hx1, . . . , xr1 , y1, . . . , yr2i. For X ⊆ V (G), let σX be the ordering of X induced by σ, i.e., the ordering obtained from σ if we remove the vertices that do not belong in X. For a vertex v we denote by V σ the set v {u ∈ V (G) u ≤σ v}. A σ-cut is any cut of the form (V σ v , V (G) \ V σ v ) for v ∈ V (G). The cutwidth of an ordering σ of G is defined as cwσ(G) = maxv∈V (G) δ(V σ v ). The cutwidth of G, cw(G), is the minimum of cwσ(G) over all possible orderings of V (G). Obstructions. Let ≤ be a partial order on graphs. We say that G′ (cid:8) G if G′ ≤ G and G′ is not isomorphic to G. A graph class G is closed under ≤ if whenever G′ ≤ G and G ∈ G, we also have that G′ ∈ G. Given a partial order ≤ and a graph class G closed under ≤, we define the (minimal) obstruction set of G w.r.t. ≤, denoted by obs≤(G), as the set containing all graphs where the following two conditions hold: O1: G 6∈ G, i.e., G is not a member of G, and O2: for each G′ with G′ (cid:8) G, we have that G′ ∈ G. We say that a set of graphs H is a ≤-antichain if it does not contain any pair of comparable elements wrt. ≤. By definition, for any class G closed under ≤, the set obs≤(G) is an antichain. 5 Immersions. Let H and G be graphs. We say that G contains H as an immersion if there is a pair of functions (φ, ψ), called an H-immersion model of G, such that φ is an injection from V (H) to V (G) and ψ maps every edge uv of H to a path of G between φ(u) and φ(v) so that different edges are mapped to edge-disjoint paths. Every vertex in the image of φ is called a branch vertex. If we additionally demand that no internal vertex of a path in ψ(E(H)) is a branch vertex, then we say that (φ, ψ) is a strong H-immersion model and H is a strong immersion of G. We denote by H ≤i G (H ≤si G) the fact that H is an immersion (strong immersion) of G; these are partial orders. Clearly, for any two graphs H and G, if H ≤si G then H ≤i G. This implies the following observation: Observation 3. If G is a graph class closed under ≤i, then obs≤i (G) ⊆ obs≤si (G). Robertson and Seymour proved in [19] that every ≤i-antichain is finite and conjectured the same for ≤si. It is well-known that for every k ∈ N, the class Ck of graphs of cutwidth at most k is closed under immersions. It follows from the results of [19] that obs≤i (Ck) is finite; the goal of this paper is to provide good estimates on the sizes of graphs in obs≤si (Ck). As the cutwidth of a graphs is the maximum cutwidth of its connected components, it follows that graphs in obs≤si(Ck) are connected. Moreover, every graph in obs≤si(Ck) has cutwidth exactly k + 1, because the removal of any of its edges decreases its cutwidth to at most k. 3 Bucket interfaces Let G be a graph and σ be an ordering of V (G). For a set X ⊆ V (G), the X-blocks in σ are the maximal subsequences of consecutive vertices of σ that belong to X. Suppose (A, B) is a cut of G. Then we can write σ = b1 ◦ . . . ◦ bp, where b1, . . . , bp are the A- and B-blocks in σ; these will be called jointly (A, B)-blocks. The next lemma is the cornerstone of our approach: we prove that given a graph G and a cut (A, B) of G, there exists an optimum cutwidth ordering of G where number of blocks depends only on the cutwidth and the size of (A, B). Lemma 4. Let ℓ ∈ N+ and G be a graph. If (A, B) is a cut of G of size ℓ, then there is an optimum cutwidth ordering σ of V (G) with at most (2ℓ + 1) · (2cw(G) + 3) + 2ℓ (A, B)-blocks. Proof. Let σ be an optimum cutwidth ordering such that, subject to the width being minimum, the number of (A, B)-blocks it defines is also minimized. Let σ = b1◦b2◦· · ·◦br, where b1, b2, . . . , br are the (A, B)-blocks of σ. If σ defines less than three blocks, then the claim already follows, so let us assume r ≥ 3. Consider any ordering σ′ obtained by swapping two blocks, i.e., σ′ = b1 ◦ · · · ◦ bj−1 ◦ bj+1 ◦ bj ◦ bj+2 . . . br, for some j ∈ [r − 1]. Observe that since the blocks b1, . . . , br alternate as A-blocks and B-blocks, the ordering σ′ has a strictly smaller number of blocks; indeed, either j − 1 ≥ 1, in which case bj−1 ◦ bj+1 defines a single block of σ′, or j = 1 and hence j + 2 ≤ r, in which case bj ◦ bj+2 does. Therefore, by choice of σ, for each j ∈ [r − 1], swapping bj and bj+1 in σ must yield an ordering with strictly larger cutwidth. 6 µ(j − 1) µ(j) µ(j + 1) · · · · · · block j − 1 block j block j + 1 block j + 2 Figure 1: A cut (A, B) is highlighted (blue, red), with the corresponding blocks underlined and cuts between them marked with dashed lines. Edges counted as pj and sj are thickened. We call a block free if it does not contain any endpoint of the cut edges EG(A, B). We now prove that any sequence of consecutive free blocks in σ has at most 2cw(G) + 3 blocks. Since the cut (A, B) has size ℓ, there are at most 2ℓ blocks that are not free. This implies the claimed bound on the total number of all blocks in σ. Suppose, to the contrary, that there exists a sequence of q > 2cw(G) + 3 consecutive free blocks in σ. Let these blocks be br, br+1, . . . , bs, where s − r + 1 = q. For j ∈ [r, s − 1], we define µ(j) to be the size of the cut between all vertices inside or preceding the vertices of block bj and all vertices inside or following the vertices of block bj+1 in σ; see Figure 1. Claim 5. For all j ∈ [r + 1, . . . , s − 2], we have that µ(j − 1) > µ(j) or µ(j) < µ(j + 1). Proof. Suppose that for some j ∈ [r + 1, s − 2], µ(j) ≥ max(µ(j − 1), µ(j + 1)). We will then show that the ordering σ′ obtained by swapping the blocks bj and bj+1 still has optimum cutwidth, a contradiction to the choice of σ. Notice that for every vertex v preceding all vertices of bj or succeeding all vertices of bj+1, δ(V σ′ v ). Thus, it remains to show that for any vertex v belonging to the block bj or to the block bj+1, also δ(V σ′ v ) = δ(V σ v ) ≤ δ(V σ v ). Let pj be the number of edges of G with one endpoint in the block bj and the other endpoint preceding (in σ) all vertices of bj. Let also sj be the number of edges of G with one endpoint in bj and the other endpoint succeeding (in σ) all vertices of bj (and hence succeeding all vertices of block bj+1, since both bj and bj+1 are free). Notice that µ(j) = µ(j − 1) − pj + sj and recall that µ(j) ≥ µ(j − 1). This yields that sj ≥ pj. Similarly, let pj+1 be the number of edges of G with one endpoint in bj+1 and the other endpoint preceding all vertices of the block bj+1 (and, in particular, all vertices of block bj). Let also sj+1 be the number of edges of G with one endpoint in bj+1 and the other endpoint succeeding all vertices of block bj+1. Again, we have µ(j + 1) = µ(j) − pj+1 + sj+1 and µ(j) ≥ µ(j + 1). This yields that pj+1 ≥ sj+1. Let v be a vertex of the block bj. Recall that the blocks bj and bj+1 are free and thus, v ). v ). Thus, there are no edges between them. Observe then that δ(V σ′ Symmetrically, for any vertex v in bj+1, observe that δ(V σ′ cwσ′ (G) ≤ cwσ(G) = cw(G), a contradiction. v ) = δ(V σ v ) = δ(V σ v ) + sj+1 − pj+1 ≤ δ(V σ v ) + pj − sj ≤ δ(V σ y Claim 5 shows that for all j ∈ [r + 1, s − 2], we have µ(j − 1) > µ(j) or µ(j) < µ(j + 1). It follows that any non-decreasing pair µ(j − 1) ≤ µ(j) must be followed by an increasing pair 7 µ(j) < µ(j + 1). Hence, if jmin is the minimum index such that µ(jmin) ≤ µ(jmin + 1), then the sequence µ(j) has to be strictly decreasing up to jmin and strictly increasing from jmin + 1 onward. Since µ(j) ≤ cw(G) for all j, the length q of the sequence of consecutive free blocks cannot be longer than 2cw(G) + 3 in total, concluding the proof. We use the above lemma to bound the number of "types" of prefixes in graph orderings. To describe such a prefix, i.e., one side of a cut in a graph, we use the following definition. Definition 6. A k-boundaried graph is a pair G = (G, ¯x) where G is a graph and ¯x = (x1, . . . , xk) is a k-tuple of the graph's boundary vertices (ordered, not necessarily distinct). The extension of G is the graph G∗ obtained from G by adding k new vertices x′ k and edges x1x′ k. The join A ⊕ B of two k-boundaried graphs A = (A, ¯x), B = (B, ¯y) is the graph obtained from the disjoint union of A and B by adding an edge xiyi for i ∈ [k]. 1, . . . , xkx′ 1, . . . , x′ From Lemma 4 we derive that for any given cut (A, B) of size ℓ of a graph G with cw(G) ≤ k, there is an optimum cutwidth ordering in which the vertices of A occur in O(kℓ) blocks. Our next goal is to show that the only information about A that can affect the cutwidth of G is: the placing of the endpoints of each cutedge (xi and x′ i) into blocks, and the cutwidth of each block (as an induced subgraph of A or A∗). Recall that for an ordering σ of V (G), σ-cuts are cuts of the form (V σ v ), for v ∈ V (G). v , V (G) \ V σ Definition 7. Let G be a graph and σ be an ordering of its vertices. An ℓ-bucketing of σ is a function T : V (G) → [ℓ] such that T (u) ≤ T (v) for any u appearing before v in σ. For every i ∈ [ℓ], the set T −1(i) will be called a bucket; a bucket is naturally ordered by σ. For every bucket T −1(i), i ∈ [ℓ], let cuts(G, σ, T, i) be the family of σ-cuts containing on one side all vertices of buckets appearing before i and a prefix (in σ) of the i-th bucket. For an ordering σ of the vertices of a graph G, define the width of the bucket i, i ∈ [ℓ], as the maximum width of any cut in the family cuts(G, σ, T, i). Formally, cuts(G, σ, T, i) = (cid:8)(cid:0)T −1([1, i − 1]) ∪ L, R ∪ T −1([i + 1, ℓ])(cid:1) : (L, R) is a σ-cut of T −1(i)(cid:9) , width(G, σ, T, i) = max { EG(L, R) : (L, R) ∈ cuts(G, σ, T, i) } . Notice that every σ-cut of G is in cuts(G, σ, T, i) for at least one bucket i ∈ [ℓ]; since cwσ(G) is the maximum of EG(L, R) over σ-cuts (L, R), we have cwσ(G) = max i∈[ℓ] width(G, σ, T, i). (1) 1, . . . , xkx′ k in A∗ to be the same as y′ For two k-boundaried graphs A = (A, ¯x), B = (B, ¯y), we slightly abuse notation and understand the edges x1x′ kyk in B∗ and as x1y1, . . . , xkyk in A ⊕ B. That is, for an ordering σ of A ⊕ B with ℓ-bucketing T , we define T A∗(v) to be T (v) for v ∈ V (A) and T (yi) for v = x′ i just as σ orders yi, with the order between x′ j chosen arbitrarily when yi = yj. The following lemma shows that if an ℓ-bucketing respects the sides of a cut, then the width of any bucket can be computed as the sum of contributions of the sides. i. We define σA∗ as an ordering that orders x′ 1y1, . . . , y′ i and x′ 8 Lemma 8. Let k, ℓ be positive integers and A = (A, ¯x), B = (B, ¯y) be two k-boundaried graphs. Let also σ be a vertex ordering of A ⊕ B with ℓ-bucketing T . If T −1(i) does not contain any vertex of A, for some i ∈ [ℓ], that is, T −1(i)∩V (A) = ∅, then it holds that width(A⊕ B, σ, T, i) = width(A, σA, T A, i) + width(B∗, σB∗ , T B∗, i). Proof. Consider any cut (L, R) in cuts(G, σ, T, i). Observe that for every edge e of EA⊕B(L, R) one of the following holds: 1. e ∈ EA(L ∩ V (A), R ∩ V (A)) or 2. e ∈ EB(L ∩ V (B), R ∩ V (B)) or 3. e ∈ EG(L ∩ V (A), R ∩ V (B)), or 4. e ∈ EG(R ∩ V (A), L ∩ V (B)). Since we do not distinguish between the vertices xi and the vertices y′ i, we equivalently obtain that for every edge e ∈ EA⊕B(L, R), e is either an edge in EA(L ∩ V (A), R ∩ V (A)) or an edge in EB∗ (L ∩ V (B∗), R ∩ V (B∗)). Observe that (L ∩ V (A), R ∩ V (A)) is a cut in cuts(A, σA, T A, i) and (L ∩ V (B∗), R ∩ V (B∗)) is a cut in cuts(B∗, σB∗ , T B∗, i). Therefore, the total number of edges crossing these cuts is at most width(A, σA, T A, i) + width(B∗, σB∗ , T B∗, i). This proves that width(A ⊕ B, σ, T, i) ≤ width(A, σA, T A, i) + width(B∗, σB∗ , T B∗, i). For the converse inequality, observe that since the bucket T −1(i) does not contain any vertices of A, we have T −1 A (i) = ∅. Hence there is exactly one cut in cuts(A, σA, T A, i), namely (LA, RA), where LA = T −1({1, . . . , i − 1}) ∩ V (A) and RA = T −1({i + 1, . . . , ℓ}) ∩ V (A). Let (LB, RB) be a cut in cuts(B∗, σB∗ , T B∗, i) maximizing EB∗ (LB, RB). Then, since we assumed that T −1(i) does not contain any vertices of A (and thus, may only contain vertices of B), it follows that (LA ∪ LB, RA ∪ RB) is a cut in cuts(G, σ, T, i). As above, every edge of A ⊕ B crossing this cut is either in EA(LA, RA) or in EB∗ (LB, RB), where we again do not distinguish between the vertices xi and y′ i. Hence width(A ⊕ B, σ, T, i) ≥ EA⊕B(L, R) = EA(LA, RA) + EB∗ (LB, RB) = width(A, σA, T A, i) + width(B∗, σB∗ , T B∗, i). Replacing the roles of A and B above, we obtain that if T −1(i) does not contain any vertex of B, then width(A ⊕ B, σ, T, i) = width(A∗, σA∗ , T A∗, i) + width(B, σB, T B, i). Intuitively, this implies that the cutwidth of A ⊕ B depends on A only in the widths of each block relative to A and A∗ (in any bucketing where buckets are either A-blocks or B-blocks). 9 Therefore, replacing A with another boundaried graph whose extension has an ordering and bucketing with the same widths preserves cutwidth (as long as endpoints of the cut edges are placed in the same buckets too). This is formalized in the next definition. Definition 9. For k, ℓ ∈ N, a (k,ℓ)-bucket interface consists of functions: • b, b′ : [k] → [ℓ] identifying the buckets which contain xi and x′ i, respectively and • µ, µ∗ : [ℓ] → [0, k] corresponding to the widths of buckets. A k-boundaried graph G conforms with a (k, ℓ)-bucket interface if there exists an ordering σ of the vertices of G∗ and an ℓ-bucketing T of G∗ such that: • T (v) is odd for v ∈ V (G) and even for v ∈ {x′ 1, . . . , x′ k}, • T (xi) = b(i) and T (x′ i) = b′(i), for each i ∈ [k], • width(G, σG, T G, j) ≤ µ(j), for each j ∈ [ℓ], • width(G∗, σ, T, j) ≤ µ∗(j), for each j ∈ [ℓ]. Observation 10. For all k, ℓ ∈ N+ there are ≤ 22(k log ℓ+ℓ log(k+1)) (k, ℓ)-bucket interfaces. We call two k-boundaried graphs G1, G2 (k,ℓ)-similar if the sets of (k, ℓ)-bucket interfaces they conform with are equal. The following lemma subsumes the above ideas. The proof follows easily from Lemma 8 and the fact that cwσ(G) = maxi∈[ℓ] width(G, σ, T, i) (Eq. (1)). Theorem 11. Let k, r be two positive integers. Let also A1 and A2 be two k-boundaried graphs that are (k, ℓ)-similar, where ℓ = (2k + 1) · (2r + 4). Then for any k-boundaried graph B where cw(A1 ⊕ B) ≤ r, it holds that cw(A2 ⊕ B) = cw(A1 ⊕ B). Proof. Let Ai = (Ai, ¯xi), B = (B, ¯y) and suppose that cw(A1 ⊕ B) ≤ r. By Lemma 4, there is an optimum cutwidth ordering σ1 of the vertices of A1 ⊕ B that has at most ℓ − 1 (V (A1), V (B))- blocks. In particular cwσ1 (A1 ⊕ B) = cw(A1 ⊕ B) ≤ r. By adding an empty block at the front, if necessary, we may assume that the number of blocks is at most ℓ, while odd-indexed blocks are V (A1)-blocks and even-indexed blocks are V (B)-blocks. Then, there is an ℓ-bucketing T1 of σ1 such that T1(v) is odd for v ∈ A1 and even for v ∈ B. Therefore σ1A∗ 1 certify that the following (k, ℓ)-bucket interface conforms with A1: 1 and T1A∗ • b(i) = T1(x1 i ) and b′(i) = T1A∗ 1 (x1 i ′) = T1(yi) for i ∈ [k], • µ(i) = width(A1, σ1A1, T1A1 , i) and µ∗(i) = width(A∗ 1, σ1A∗ 1 , T1A∗ 1 , i) for i ∈ [ℓ]. By (k, ℓ)-similarity there is an ordering σ2 of A∗ 2 and its ℓ-bucketing T2 such that: • each bucket T −1 2 (i) is contained in A2 for odd i ∈ [ℓ] and in {x2 1 ′, . . . , x2 k ′} for even i ∈ [ℓ] • b(i) = T2(x2 i ) and b′(i) = T2(x2 i ′) for i ∈ [k], • µ(i) ≥ width(A2, σ2A2, T2A2 , i) and µ∗(i) ≥ width(A∗ 2, σ2A∗ 2 , T2A∗ 2 , i) for i ∈ [ℓ]. 10 Given this, we define an assignment of vertices into buckets Π : V (A2 ⊕ B) → [ℓ] as follows. • Π(v) = T1(v) for v ∈ V (B) and • Π(v) = T2(v) for v ∈ V (A2). Clearly, ΠB = T1B and ΠA2 = T2A2 . We claim that ΠA∗ 2 = T2A∗ 2 and ΠB∗ = T1B∗ also hold. Indeed, ΠA∗ 2 (x2′ i ) = Π(yi) = T1(yi) = b′(i) = T2(x2′ i ) and, similarly, ΠB∗ (y′ i) = Π(x2 i ) = T2(x2 i ) = b(i) = T1(x1 i ) = T1B∗ (y′ i) Thus, we obtain that ΠA∗ 2 = T2A2 ΠB∗ = T1B∗ . (we consider x2′ i as yi) (by definition) ((k, ℓ)-bucket interface) ((k, ℓ)-similarity) (we consider y′ i as x2 i ) (by definition) ((k, ℓ)-bucket interface) ((k, ℓ)-similarity) (by definition). (2) (3) (4) (5) Note also that vertices of A2 are mapped to odd buckets and vertices of B are mapped to even buckets. We use Π to define an ordering π of the vertices of A2 ⊕ B as follows. Formally, we let u <π u if and only if one of the following conditions hold: 1. Π(u) < Π(v), 2. u <σ2 v and Π(u) = Π(v) is odd, or 3. u <σ1 v and Π(u) = Π(v) is even. Note that this is a linear ordering as it first sorts the vertices according to the bucket they belong to and then according to the ordering induced in this bucket by the orderings σ1 and σ2. 2 = T2A2 . Note also that by definition Π is an ℓ-bucketing of π. Recall that, from Eq. (4), ΠA∗ 11 This, together with the observation that the vertices of A2 are mapped to odd buckets of Π, implies that πA∗ 2 = σ2A∗ πA2 = σ2A2 . 2 and that (6) (7) Moreover, recall that ΠB∗ = T1B∗ . This, together with the fact that the vertices of B are mapped to even buckets of Π, implies that πB∗ = σ1B∗ and that πB = σ1B. (8) (9) We now bound the width of each bucket. Let i ∈ [ℓ]. Notice that if i is even the by construction Π−1(i) contains only vertices from B. Therefore, width(A2 ⊕ B, π, Π, i) = width(A2, πA2 , ΠA2 , i) + width(B∗, πB∗ , ΠB∗ , i) = width(A2, σ2A2, T2A2, i) + width(B∗, σ1B∗ , T1B∗ , i) ≤ µ(i) + width(B∗, σ1B∗ , T1B∗ , i) = width(A1, σ1A1, T1A1, i) + width(B∗, σ1B∗ , T1B∗ , i) = width(A1 ⊕ B, σ1, T1, i), (10) where the first equality follows from Lemma 8, the second equality holds by Eq. (3), (7), (8), and (5), the third inequality follows from the (k, ℓ)-bucket interface, and the fifth equality follows from Lemma 8. We similarly argue, using µ∗ instead of µ, that for odd i ∈ [ℓ], width(A2 ⊕ B, π, Π, i) = width(A1 ⊕ B, σ1, T1, i). In particular, width(A2 ⊕ B, π, Π, i) = width(A∗ = width(A∗ ≤ µ∗(i) + width(B, σ1B, T1B, i) = width(A∗ 2 , ΠA∗ 2 , T2A∗ 2, πA∗ 2, σ2A∗ 1, σ1A∗ 1 , T1A∗ 1 , i) + width(B, σ1B, T1B, i) 2 , i) + width(B, πB, ΠB, i) 2 , i) + width(B, σ1B, T1B, i) = width(A1 ⊕ B, σ1, T1, i). (11) Similarly, to Eq. 10, we get that the first equality follows from Lemma 8, the second equality holds by Eq. (4), (6), (2), and (9), the third inequality follows from the (k, ℓ)-bucket interface, and the fifth equality follows from Lemma 8. Therefore, from Eq. (10) and (11) we obtain that cwπ(A2 ⊕ B) = max i∈[ℓ] width(A2 ⊕ B, π, Π, i) ≤ max i∈[ℓ] width(A1 ⊕ B, σ1, T1, i) = cwσ1 (A1 ⊕ B). Moreover, since cw(A2 ⊕ B) ≤ cwπ(A2 ⊕ B) and σ1 is an optimum cutwidth ordering for A' ⊕ B, it follows that cw(A2 ⊕ B) ≤ cw(A1 ⊕ B) ≤ r. So in particular cw(A2 ⊕ B) ≤ r. By applying the same reasoning, but with A1 and A2 reversed, we obtain also the converse inequality cw(A2 ⊕ B) ≤ cw(A1 ⊕ B). This proves that indeed cw(A2 ⊕ B) = cw(A1 ⊕ B). 12 4 Obstruction sizes and linked orderings In this section we establish the main result on sizes of obstructions for cutwidth. We first introduce linked orderings and prove that there is always an optimum ordering that is linked. Definition 12 (linked ordering). An ordering σ of V (G) is linked if for any two vertices u ≤σ u′, there exist min{δ(V σ v ) u ≤σ v ≤σ u′} edge-disjoint paths between V σ u and V (G) \ V σ u′ in G. Lemma 13 ([10, 15]). For each graph G, there is a linked ordering σ of V (G) with cwσ(G) = cw(G). v ) is minimized. We prove that σ defined in this manner is in fact linked. Proof. Without loss of generality, we may assume that the graph is connected. Let σ be an optimum cutwidth ordering of V = V (G). Subject to the optimality of σ, we choose σ so that Pv∈V δ(V σ i ∈ N such that δ(V σ V σ u ⊆ A and V \ V σ A1 = V σ and B1 = B \ B2 (see Figure 2). Notice that A2 = A \ V σ that B1 = B \ (V \ V σ concatenating σA1, σA2 , σB1 , and σB2 . Assume the contrary. Then by Menger's theorem, there exist vertices u <σ u′ in V and v ) > i for every u ≤σ v ≤σ u′, but a minimum cut (A, B) of G with u′ ⊆ B has size δ(A) ≤ i. We partition A into sets A1 and A2, where u and A2 = A \ A1, and we partition B into sets B1 and B2, where B2 = V \ V σ u′ u = {v u <σ v ≤σ u′} ∩ A and u′ ) = {v u <σ v ≤σ u′} ∩ B. Let σ′ be the ordering of V obtained by We prove that δ(V σ′ v = V σ v ) ≤ δ(V σ v and thus, δ(V σ′ it holds that V σ′ the submodularity of cuts it follows that δ(V σ (V σ of (A, B) it follows that δ(A) ≤ δ(V σ we obtain that δ(V σ′ v ∪ A, V \ (V σ v ) ≤ δ(V σ v ). v ) = δ(V σ v ), for every v ∈ V . Observe first that for every vertex v ∈ A1∪B2 v ∩ A. By v ). Notice that u′ . From the minimality v ). As V σ′ v ∩ A, v ). Let now v ∈ A2. Then V σ′ v ∩ A) ≤ δ(A) + δ(V σ u and B2 = V \ V σ v ∩ A) ≤ δ(V σ v ∪ A). Therefore, δ(V σ v ∪ A) + δ(V σ v = V σ v = V σ v ∪ A)) is also a cut separating A1 = V σ Symmetrically, let now v ∈ B1. Then V σ′ v ∪ A) + δ(V σ v ∩ A) ≤ δ(A) + δ(V σ δ(V σ A1 and B2. From the minimality of (A, B) it follows that δ(A) ≤ δ(V σ δ(V σ v ∪ A, we obtain that δ(V σ′ v ). Notice that (V σ v ). As V σ′ v ) ≤ δ(V σ v = V σ v ). v ∪ A. By the submodularity of cuts we have v ∩ A)) is a cut separating v ∩ A). Therefore, v ∩ A, V \ (V σ v = V σ v ∪ A) ≤ δ(V σ Thus, δ(V σ′ v ) ≤ δ(V σ v ) ≤ cw(G) for every v ∈ V , and hence cwσ′ (G) = cw(G). Finally, u u A1 A1 A2 ∪ B1 u′ u′ A2 B1 B2 B2 Figure 2: An ordering of vertices with the minimum cut (A, B) between A1 and B2 of size i highlighted in blue and red. Below, the modified ordering, with cutwidth bounded using submodularity. 13 note that δ(V σ′ contradicting the choice of σ. Therefore, σ is a linked ordering of V with cwσ(G) = cw(G). v ) for the last vertex v in A. Thus Pv δ(V σ′ v ) = δ(A) ≤ i < δ(V σ v ) < Pv δ(V σ v ), The rest of Section 4 is devoted to the proof of Theorem 1. Before we proceed with this proof, we need a series of auxiliary lemmas. For every s, r ∈ N+, we set As,r = [s, s + r − 1]. We prove the following. Lemma 14. Let N be a positive integer. For every s, r ∈ N+ and every word w over As,r of length N r there is a symbol k ∈ As,r and a subword u of w such that (a) u contains only numbers not smaller than k, and (b) u contains the number k at least N times. Proof. We prove the lemma by induction on r. Notice that for r = 1, As,r = {s} and thus the only word w of length N is sN . Thus, the lemma holds with k = s and u = w. We proceed to the inductive step for r > 1. Let now s ∈ N and let w be a word over As,r of length N r. If s occurs at least N times, then again, the lemma holds with k = s and u = w. Thus, we may assume that s occurs at most N − 1 times. Then, since w has length at least N r, there exists a subword w′ of w of length at least N r−1 over As,r \ {s} = As+1,r−1. From the inductive hypothesis, there exists k ∈ As+1,r−1 ⊆ As,r and a subword u of w′ such that k occurs at least N times in u and u contains only numbers at least k. Since w′ is a subword of w, u is also a subword of w. This completes the inductive step and the proof of the lemma. We use Lemma 14 only for s = 1, giving the following corollary. Corollary 15. Let r, N be positive integers and let w be a word of length N r over the alphabet [r]. Then there is a number k ∈ [r] and a subword u of w such that (a) u contains only numbers not smaller than k, and (b) u contains the number k at least N times. We also need one additional statement about boundaried graphs and bucket interfaces. Lemma 16. Let k, ℓ ∈ N. Suppose A = (A, ¯x) and B = (B, ¯y) are two k-boundaried graphs, and suppose further that there is an immersion model (φ, ψ) of A in B such that φ(xi) = yi, for all i = 1, 2, . . . , k. Then for every (k, ℓ)-bucket interface (b, b′, µ, µ∗), if B conforms to (b, b′, µ, µ∗) then also A conforms to (b, b′, µ, µ∗). Proof. First, we extend the immersion model (φ, ψ) to an immersion model (φ∗, ψ∗) of A∗ in B∗ by putting φ∗(x′ i for all i ∈ [k]. Suppose that ordering σ of V (B∗) and its ℓ-bucketing T certify that B conforms to (b, b′, µ, µ∗). We define ordering σ′ of V (A∗) and its ℓ-bucketing T ′ as follows: i and ψ∗(xix′ i) = yiy′ i) = y′ • For u, v ∈ V (A∗), we put u <σ′ v if and only if φ∗(u) <σ′ φ∗(v). • For u ∈ V (A∗), we put T ′(u) = T (φ∗(u)). It is easy to see that T ′ is an ℓ-bucketing of σ′. We now verify that σ′ and T ′ certify that A conforms to (b, b′, µ, µ∗). The first two conditions of conforming follow directly from the definition of σ′ and T ′, so we are left with the third and the fourth condition. 14 For the third condition, take any j ∈ [ℓ]. It suffices to show that for any cut (L′, R′) ∈ cuts(A, σ′A, T ′A, j), we have that EA(L′, R′) ≤ µ(j). By the construction of (σ′, T ′) it follows that there is a cut (L, R) ∈ cuts(B, σB, T B, j) such that φ(L′) ⊆ L and φ(R′) ⊆ R. Since (σ, T ) certified that B conforms to (b, b′, µ, µ∗), we have that EB(L, R) ≤ µ(j). Take any uv ∈ EA(L′, R′), and observe that ψ(uv) is a path in B leading from φ(u) ∈ L to φ(v) ∈ R. Consequently, one of the edges of this path must belong to EB(L, R). Since paths ψ(uv) are pairwise edge-disjoint for different edges uv ∈ EA(L′, R′), we infer that EA(L′, R′) ≤ EB(L, R) ≤ µ(j). This establishes the third condition. The fourth condition follows by the same argument applied to graphs A∗ and B∗, instead of A and B. The following theorem is the technical counterpart of Theorem 1. Its proof is based on Theorem 11, Lemma 13, Observation 10 and the idea of "unpumping" repeating types, presented in the introduction. The linkedness is used to make sure that within the unpumped segment of the ordering, one can find the maximum possible number of edge-disjoint paths between the parts of the graph on the left side and on the right side of the segment. This ensures that the graph obtained from unpumping can be immersed in the original one. Theorem 17. Let k be a positive integer. N = 22((k+1) log ℓ+ℓ log(k+2)) + 2 and ℓ = (2k + 3) · (2k + 6). If G ∈ obs≤si (Ck), then V (G) ≤ N k+1, where Proof. Take any G ∈ obs≤si (Ck) and assume, towards a contradiction, that V (G) > N k+1. Let σ = hv1, v2, . . . , vV (G)i be a linked optimum cutwidth ordering of G, which exists by Lemma 13. We define ci = δ(V σ vi ), that is, ci is the size of the cut between the vertices of G up to vi and the rest of the graph. Notice that since G ∈ obs≤si(Ck), we have that cw(G) = k + 1 and G is connected. This implies that ci ∈ [k + 1], for every i ∈ [V (G) − 1]. Observe that c1c2 . . . cV (G)−1 is a word of length at least N k+1 over the alphabet [k + 1]. From Corollary 15, it follows that there exist 1 ≤ s ≤ t < V (G) and q ∈ [k + 1] such that for every s ≤ i ≤ t we have ci ≥ q, and there also exist N distinct indices s ≤ i1 < i2 < · · · < iN ≤ t such that cij = q, for every j ∈ [N ]. Without loss of generality we may assume that i1 = s and iN = t. For each j ∈ [N ], we can define a q-boundaried graph Gj = (Gj, (z1 . Notice that for each j ∈ [N ] the cut EG(V σ vij following way. First, by linkedness, we find edge-disjoint paths P1, . . . , Pq between V σ vi1 V \ V σ viN of each path Pi. Denote this edge by ei belongs to V σ vij ], adding fresh boundary vertices (z1 taking G[V σ vij for each i ∈ [q]. , V (G) \ V σ vij j, for i ∈ [q]. For i ∈ [q], let xi j be the endpoint that does not belong to V σ vij j ), and adding one fresh edge xi j , z2 j , . . . , zq j )) in the and ) contains exactly one edge j be the endpoint of ei j that . We construct Gj by jzi j j , z2 j , . . . , zq , and let yi Now consider any pair of indices 1 ≤ j1 < j2 ≤ N . Observe that there exists an immersion j2 for each i ∈ [q]. Indeed, we can put φ(u) = u for j2 for each i ∈ [q]. Then ψ can be defined by taking ψ(e) = e for model (φ, ψ) of Gj1 in Gj2 such that φ(zi each u ∈ V (Gj1 ) and φ(zi j1 ) = zi j1 ) = zi 15 each e ∈ E(Gj1 ) and mapping each edge xi by the edge xi that if by ζ(j) we denote the set of (q, ℓ)-bucket interfaces to which Gj conforms, then j1 to an appropriate infix of the path Pi, extended j2 . Consequently, Gj1 and Gj2 satisfy the prerequisites of Lemma 16. We infer j1 zi j2 zi ζ(1) ⊇ ζ(2) ⊇ . . . ⊇ ζ(N − 1) ⊇ ζ(N ). Observation 10 implies that N is larger by more than 1 than the total number of (q, ℓ)-bucket interfaces. It follows that there exists an index j, 1 ≤ j < N , such that In other words, the q-boundaried graphs Gj and Gj+1 are (q, ℓ)-similar. ζ(j) = ζ(j + 1). Define a q-boundaried graph G′ = (G′, (y1 ij+1 ]. It , V (G)\ ) subdivided once. Since subdividing edges does not change the cutwidth of the graph, we can be now seen that Gj+1 ⊕G′ is exactly the graph G with every edge of the cut EG(V σ vij V σ vij have that j+1)) by taking G′ = G[V (G) \ V σ j+1, . . . , yq cw(Gj+1 ⊕ G′) = cw(G) > k. (12) On the other hand, q-boundaried graphs Gj and Gj+1 are (q, ℓ)-similar. Since ℓ ≥ (2q+3)·(2q+6), by Theorem 11 we conclude that cw(Gj ⊕ G′) = cw(Gj+1 ⊕ G′). (13) Examine the graph Gj ⊕ G′. In the join operation, we added an edge zi which means each vertex zi j and one connecting it to yi xi every vertex zi Subdividing edges does not change the cutwidth of a graph, so we obtain that: j+1 for each i ∈ [q], j has exactly two incident edges in Gj ⊕ G′: one connecting it to j+1. Let H be the graph obtained from Gj ⊕ G′ by dissolving j+1. j, i.e., removing it and replacing edges xi j+1 with a fresh edge xi j and zi j yi jyi jzi jyi cw(H) = cw(Gj ⊕ G′) (14) Finally, it is easy to see that G admits H as a strong immersion: a strong immersion model of H in G can be constructed by mapping the vertices and edges of Gj and G′ identically, and then mapping each of the remaining edges xi j+1 to a corresponding infix of the path Pi. Also, since ij < ij+1, the graph H has strictly less vertices than G. However, from Eq. (12), (13), and (14) we conclude that cw(H) = cw(G) > k. This contradicts the assumption that G ∈ obs≤si(Ck). jyi Proof of Theorem 1. Theorem 17 provides an upper bound on the number of vertices of a graph in obs≤si(Ck). Observe that since such a graph has cutwidth k + 1, each of its vertices has degree at most 2(k + 1). It follows that any graph from obs≤si(Ck) has 2O(k3 log k) vertices and edges. Finally, by Observation 3 we have obs≤i (Cq) ⊆ obs≤si(Cq), so the same bound holds also for immersions instead of strong immersions. This concludes the proof of Theorem 1. 16 5 An algorithm for computing cutwidth In this section we present an exact FPT algorithm for computing the cutwidth of the graph. First, we need to give a dynamic programming algorithm that given an approximate ordering σ of width r, finds, if possible, an ordering of width at most k, where k ≤ r is given. Our algorithm takes advantage of the given ordering σ and essentially computes, for each subgraph of G induced by a prefix of σ, the (r, ℓ)-bucket interfaces it conforms to. More precisely, in Lemma 18 we show that if G has an optimum ordering of width k, then there is an optimum ordering were each of these induced subgraphs occupies at most ℓ = O(rk) buckets, allowing to restrict our search to (r, ℓ)-bucket profiles (a variant of bucket interfaces to be defined later, refined so as to consider border vertices more precisely). The proof slightly strengthens that of Lemma 4. Lemma 18. Let G be a graph with an ordering σ of width r. Then there exists also an ordering τ of optimum width, i.e., with cwτ (G) = cw(G), that has the following property: for every prefix X of σ, the number of X-blocks in τ is at most 2r · cw(G) + cw(G) + 4r + 2. Proof. Lemma 4 asserts that for each cut (A, B) of G of size at most r, there exists an optimum- width ordering of V (G) where the number of (A, B)-blocks is at most (2r + 1) · (2cw(G) + 3) + 2r = 4r · cw(G) + 2cw(G) + 8r + 3. As A-blocks and B-blocks appear alternately, at most half rounded up of the (A, B)-blocks can be A-blocks. Hence, the number of A-blocks in such an optimum-width ordering is at most 2r · cw(G) + cw(G) + 4r + 2; we denote this quantity by λ. The proof of Lemma 4 in fact shows that for any ordering σ of V (G) and any cut (A, B) of G of size at most r, either σ already has at most 2λ − 1 (A, B)-blocks, or an ordering σ′ can be obtained from σ by swapping its (A, B)-blocks so that σ′ has strictly less (A, B)-blocks. Therefore, by reordering (A, B)-blocks of σ, we eventually get a new ordering which has at most 2λ − 1 (A, B)-blocks, and hence at most λ A-blocks. For i = 1, 2, . . . , V (G) − 1, let (Ai, Bi) be the cut of G, where Ai is the prefix of σ of length i, while Bi is the suffix of σ of length V (G) − i. Let τ0 be any optimum-width ordering of G. We now inductively construct orderings τ1, τ2, . . . , τV (G)−1, as follows: once τi is constructed, we apply the above reordering procedure to τi and cut (Ai+1, Bi+1). This yields a new ordering τi+1 of optimum width such that the number of Ai+1-blocks in τi+1 is at most λ. Furthermore, τi+1 is obtained from τi by reordering Ai+1- and Bi+1-blocks in τi. Hence, whenever X is a subset of Ai+1, then any X-block in τi remains consecutive in τi+1, as it is contained in one Ai+1-block in τi that is moved as a whole in the construction of τi+1. Consequently, if for all j ≤ i we had that the number of Aj -blocks in τi is at most λ, then this property is also satisfied in τi+1. It is now clear that a straightforward induction yields the following invariant: for each j ≤ i, then number of Aj-blocks in τi is at most λ. Therefore τ = τV (G)−1 gives an ordering with the claimed properties. 17 Bucket profiles. We now define a refinement of the widths of the buckets of a bucket inter- face as well as a refinement of the notion of bucket interfaces. They are used in the dynamic programming algorithm of Lemma 22. Definition 19. Let (G, ¯x) be a k-boundaried graph and let S = {x1, . . . , xk, x′ k} ⊆ V (G∗). Let now σ be an ordering of V (G∗) and T be an ℓ-bucketing of σ. For every bucket T −1(i), i ∈ [ℓ], let T −1(i) ∩ S = {v1, v2, . . . , vp} for some v1 <σ v2 <σ · · · <σ vp; we then define 1, . . . , x′ T −1 j (i) =   {v ∈ T −1(i) : v <σ v1} {v ∈ T −1(i) : vj <σ v <σ vj+1} {v ∈ T −1(i) : vp <σ v} for j = 0, for j ∈ [p − 1], for j = p. Let also cuts(G, σ, T, i, j) be the family of σ-cuts containing on one side all vertices appearing before vj−1 (or, if j = 0, all vertices of buckets appearing before bucket i) and a prefix (in σ) of T −1 (i) j of the bucket i, i ∈ [ℓ], j ∈ [0, p], as the maximum width of any cut in the family cuts(G, σ, T, i, j). Formally, (i). For an ordering σ of the vertices of a graph G, define the width of j-th segment T −1 j cuts(G, σ, T, i, j) = (cid:8)(cid:0)T −1({1, . . . , i − 1}) ∪ L, T −1({i + 1, . . . , ℓ}) ∪ R(cid:1) : (L, R) is a σ-cut of T −1(i) with vj ∈ L and vj+1 ∈ R(cid:9) , width(G, σ, T, i, j) = max { EG(L, R) : (L, R) ∈ cuts(G, σ, T, i, j) } . We also need to refine the notion of a (k, ℓ)-bucket interface. Definition 20. For k, ℓ ∈ N, a (k,ℓ)-bucket profile consists of functions: • b, b′ : [k] → [ℓ] identifying the buckets which contain xi and x′ i, respectively, • p, p′ : [k] → [k] highlighting the ordering between the vertices xi and x′ i inside a bucket, respectively, • ν : [ℓ] × [0, k] → [0, k] corresponding to the widths of segments of buckets defined by the vertices xi, respectively. A k-boundaried graph G conforms with a (k, ℓ)-bucket profile, if there exists an ordering σ of the vertices of G∗ and an ℓ-bucketing T such that: • T (v) is odd for v ∈ V (G) and even for v ∈ {x′ 1, . . . , x′ k}, • T (xi) = b(i) and T (x′ i) = b′(i), for each i ∈ [k], • p(i) < p(j), if b(i) = b(j) and xi <σ xj , and p′(i) < p′(j) if b′(i) = b′(j) and x′ i <σ x′ j, • width(G, σG, T G, j, s) = ν(j, s), for each j ∈ [ℓ] and s ∈ [0, k]. From the fact that the boundary vertices of a k-boundaried graph G split the buckets defined by T into at most 2k segments in total it follows that: 18 Observation 21. For any pair (k, ℓ) of positive integers, there is a set of at most 22k(log ℓ+log k)+(ℓ+2k) log(k+1) (k, ℓ)-bucket profiles that a k-boundaried graph G can possibly conform with, and this set can be constructed in time polynomial in its size. The (k, ℓ)-bucket profiles that Observation 21 refers to will be called valid. By making use of these two notions we ensure that we will be able to update the widths of each bucket every time a new vertex is processed by the dynamic programming algorithm. We are now ready to prove Lemma 22. Lemma 22. Let r ∈ N+. Given a graph G and an ordering σ of its vertices with cwσ(G) ≤ r, an ordering τ of the vertices of G with cwτ (G) = cw(G) can be computed in time 2O(r2 log r) · V (G). Proof. The algorithm attempts to compute an ordering of width k for consecutive k = 0, 1, 2, . . .. The first value of k for which the algorithms succeeds is equal to the value of the cutwidth, and then the constructed ordering may be returned. Since there is an ordering of width r, we will always eventually succeed for some k ≤ r, which implies that we will make at most r + 1 iterations. Hence, from now on we may assume that we know the target width k ≤ r for which we try to construct an ordering. Given a graph G and an ordering σ of its vertices with cwσ(G) ≤ r we denote by Gw the graph induced by the vertices of the prefix of σ of length w. Then we naturally define the boundaried graph Gw, where we introduce a boundary vertex xi for each edge ei of the cut EG(V (Gw), V (G) \ V (Gw). Note that this cut has at most r edges. By Lemma 18, we know that there is an optimum-width ordering τ such that every prefix V (Gw) of σ has at most ℓ blocks in τ . Our dynamic programming algorithm will simply induc- tively reconstruct all (k, ℓ)-bucket profiles that may correspond to V (Gw)-blocks in τ , for each consecutive w in the ordering σ, eventually reconstructing τ , if cwτ (G) ≤ k. We now construct an auxiliary directed graph D that will model states and transitions of our dynamic programming algorithm. Let ℓ = 4rk + 2k + 8r + 4. First, for every w ∈ [0, V (G)] and every valid (k, ℓ)-bucket profile P , we add a vertex (w, P ) to D. Thus, by Observation 21, the digraph D has at most 22k(log ℓ+log k)+(ℓ+2k) log(k+1) · (V (G) + 1) = 2O(r2 log r) · V (G) vertices. We add an edge ((w, P ), (w + 1, P ′)), whenever the (k, ℓ)-bucket profile P can be expanded to the (k, ℓ)-bucket profile P ′ in the sense that we explain now. We describe which bucket profiles P ′ expand P by guessing where the new vertex would land in the bucket profile P , assuming that Gw conforms to P . After the guess is made, the updated profile P becomes the expanded profile P ′. Different guesses lead to different profiles P ′ which extend P ; this corresponds to different ways in which the construction of the optimum ordering can continue. As describing the details of this expansion relation is a routine task, we prefer to keep the description rather informal, and leave working out all the formal details to the reader. 19 Let vw+1 be the (w + 1)-st vertex in the ordering σ, that is, vw+1 ∈ V (Gw+1) \ V (Gw). We construct (by guessing) a (k, ℓ)-bucket profile P ′ from the (k, ℓ)-bucket profile P in the following way. First, we guess an even bucket of P to place each one of the vertices in V (G∗ w): the new vertices of the extension that correspond to new edges of the cut EG(V (Gw+1), V (G) \ V (Gw+1)) that are incident to vw+1. Notice that each bucket contains, at any moment, at most r vertices. Therefore, we have at most r + 1 possible choices about where each vertex will land in each bucket (including the placing in the order, as indicated by the function p′(·). Notice also that there are at most r +1 vertices in V (G∗ w). Therefore we have at most (ℓ(r +1))r+1 options for this guess. w+1) \ V (G∗ w+1)\V (G∗ Next, we choose the place vw+1 is going to be put in. If vw+1 is an endpoint of an edge from the cut EG(V (Gw), V (G) \ V (Gw)), then this place is already indicated by functions b′(·) and p′(·) in the bucket profile P ; if there are multiple edges in the cut EG(V (Gw), V (G) \ V (Gw)) that have vw+1 as an endpoint, then all of them must be placed next to each other in the same even bucket (otherwise P has no extension). Otherwise, if vw+1 is not an endpoint of an edge from EG(V (Gw), V (G) \ V (Gw)), we guess the placing of vw+1 by guessing an even bucket (one of at most ℓ + 1 options) together with a segment between two consecutive extension vertices in this bucket (one of at most r + 1 options). The placing of vw+1 may lead to one of three different scenarios; we again guess which one applies. First, vw+1 can establish a new odd bucket and split the even bucket into which it was put into two new even buckets, one on the left and one on the right of the new odd bucket containing vw+1; the other extension vertices placed in this bucket are split accordingly. Second, vw+1 can be present at the leftmost or rightmost end of the even bucket it is placed in, so it gets merged into the neighboring odd bucket. Finally, if the even bucket in which vw+1 is placed did not contain any other extension vertices of G∗ w, then vw+1 can be declared to be the last vertex placed in this bucket, in which case we merge it together with both neighboring odd buckets. In these scenarios, whenever the extended profile turns out to have more than ℓ buckets, we discard this option. Having guessed how the placing of vw+1 will affect the configuration of buckets, we proceed with updating the sizes of cuts, as indicated by the function ν(·). For this, we first examine all the edges of the cut EG(V (Gw), V (G) \ V (Gw)) that have vw+1 as an endpoint. These edges did not contribute to the values of ν(·) in the bucket profile P , but should contribute in P ′. Note that given the placement of vw+1, for each such edge we exactly see over which segments this edge "flies over", and therefore we can update the values of ν(·) for these segments by incrementing them by one. Finally, when vw+1 got merged to a neighboring odd bucket (or to two of them), we may also need to take into account one more cut in the value of ν(·) for the last/first segment of this bucket: the one between vw+1 and the vertices placed in this bucket. It is easy to see that from the value of ν(·) for the segment in which vw+1 is placed, and the exact placement of the endpoints of all the boundary edges, we can deduce the exact size of this cut. Hence, the relevant value of ν(·) can be efficiently updated by taking the maximum of the old value and the deduced size of the cut. We update ν in a similar fashion when vw+1 merges with both neighboring odd buckets. If at any point any of the values of ν(·) exceeds k, we discard this guess. 20 This concludes the definition of the extension. For every (k, ℓ)-bucket profile P and every (k, ℓ)-bucket profile P ′ that extends it, we add to D an arc from (w, P ) to (w + 1, P ′). It is easy to see from the description above that, given P and P ′, it can be verified in time polynomial in r whether such an arc should be added. Finally, in the graph D we determine using, say, depth-first search, whether there is a directed path from node (0, P∅) to node (V (G), Pfull), where P∅ is an empty bucket profile and Pfull is a bucket profile containing just one odd bucket. It is clear from the construction that if we find such a path, then by applying operations recorded along such a path we obtain an ordering of the vertices of G of width at most k. On the other hand, provided k = cw(G), by Lemma 18 we know that there is always an optimum-width ordering τ such that every prefix of σ has at most ℓ blocks in τ . Then the (k, ℓ)-bucket profiles naturally defined by the prefixes of σ in τ define a path from (0, P∅) to (V (G), Pfull) in D. The graph D has 2O(r2 log r) · V (G) vertices and arcs, and the depth-first search runs in time linear in its size. It is also trivial to reconstruct the optimum-width ordering of the vertices of G from the obtained path in linear time. This yields the promised running time bounds. Having the algorithm of Lemma 22, a standard application of the iterative compression technique immediately yields a 2O(k2 log k) ·n2 time algorithm for computing cutwidth, as sketched in Section 1. Simply add the vertices of G one by one, and apply the algorithm of Lemma 22 at each step. However, we can make the dependence on n linear by adapting the approach of Bodlaender [2]; more precisely, we make bigger steps. Such a big step consists of finding a graph H that can be immersed in the input graph G, which is smaller by a constant fraction, but whose cutwidth is not much smaller. This is formalised in Lemma 25. For its proof we we need the following definition and a known result about obstacles to small cutwidth. Definition 23. A perfect binary tree is a rooted binary tree in which all interior nodes have two children and all leaves have the same distance from its root. The height of a perfect binary tree is the distance between its root and one of its leaves. Lemma 24 ([12, 16, 21]). If T is a perfect binary tree of height 2k, then cw(T ) ≥ k. Lemma 25. There is an algorithm that given a positive integer k and a graph G, works in time O(k2 · V (G)) and either concludes that cw(G) > k, or finds a graph H immersed in G such that E(H) ≤ E(G) · (1 − 1/(2k + 1)4(k+1)+3) and cw(G) ≤ 2cw(H). Furthermore, in the latter case, given an ordering σ of the vertices of H, an ordering τ of the vertices of G with cwτ (G) ≤ 2cwσ(H) can be computed in O(V (G)) time. Proof. Without loss of generality we assume that G is connected, because we can apply the algorithm on the connected components of G separately and then take the disjoint union of the results. Observe first that we may assume that every vertex in G is incident to at most 2k edges, as otherwise, we could immediately conclude that cw(G) > k. This also implies that every vertex in G has at most 2k neighbors; by N (v) we denote the set of neighbors of a vertex v, and N (X) = (Sv∈X N (v)) \ X for a vertex subset X. Let G′ be the graph obtained from 21 G by exhaustively dissolving any vertices of degree 2 whose neighbors are different. That is, having such a vertex v, we delete it from the graph and replace the two edges incident to it with a fresh edge between its neighbors, and we proceed doing this as long as there are such vertices in the graph. Clearly, the eventually obtained graph G′ can be immersed in G, we have E(G′) ≤ E(G), the degree of every vertex in G′ is the same to its degree in G, and cw(G′) ≤ cw(G). However, observe that any ordering of the vertices of G′ can be turned into an ordering of the vertices of G with the same width by placing each dissolved vertex in any place between its two original neighbors. Thus, cw(G′) = cw(G). Moreover, G′ can be constructed in linear time by inspecting, in any order, all the vertices It is also easy to see that, given an ordering of that have degree 2 in the original graph G. vertices of G′, one can reconstruct in linear time an ordering of G of at most the same width. Altogether, it is now enough to either conclude that cw(G′) > k or find a graph H immersed in G′ such that E(H) ≤ E(G′) · (1 − 1/(2k + 1)4(k+1)+2) and cw(G′) ≤ 2cw(H ′). Therefore, from now on we may assume that if the graph G′ contains a vertex that is incident to two edges then this vertex is incident to an edge of multiplicity 2. Let V1 be the set of vertices of degree 1 in G′. We consider two cases depending on the size of V1. V1 ≥ E(G′)/(2k + 1)4(k+1)+2. Notice first that V1 ⊆ N (N (V1)), and recall that Case 1. every vertex in G′ is incident to at most 2k edges and therefore has at most 2k neighbors. It follows then that V1 ≤ 2k · N (V1) and hence N (V1) ≥ E(G′)/(2k + 1)4(k+1)+3. Let H be the graph obtained from G′ by removing, for each vertex in N (V1), one of its neighbors in V1. Then E(H) ≤ E(G′) · (1 − 1/(2k + 1)4(k+1)+3) and H is immersed in G′ (as it is an induced subgraph). Hence, H is also immersed in G. Furthermore, let σ be any ordering of the vertices of H. Then, we can obtain an ordering of the vertices of G′ by placing each deleted vertex next to its original neighbors. Notice that this placement increases the width of σ by at most 1 in total, and thus by a multiplicative factor of at most 2. As we already showed how to obtain an ordering of V (G) from a given ordering of V (G′), the lemma follows for the case where V1 ≥ E(G′)/(2k + 1)4(k+1)+2. Case 2. V1 < E(G′)/(2k + 1)4(k+1)+2. For every v ∈ V (G′) and every positive integer s, we define Bs(v) to be the ball of radius s around v, that is, the set of vertices at distance at most s from v in G′. Recall that every vertex of G′ has at most 2k neighbors and observe then that Bs(v) ≤ (2k + 1)s. We construct a set of vertices v1, v2, . . . , vℓ ∈ V (G′) whose pairwise distance is greater than 4(k + 1) in the following greedy way. Having chosen v1, . . . , vi, if B4(k+1)(v1) ∪ · · · ∪ B4(k+1)(vi) 6= V (G′) then let vi+1 be any vertex outside of B4(k+1)(v1) ∪ · · · ∪ B4(k+1)(vi). If such a vertex does not exist, we stop by putting ℓ = i and consider the set v1, v2, . . . , vℓ. Observe here that we can calculate B4(k+1)(vi) by breadth-first search in O((2k + 1)4(k+1)+1) time, by stopping the search at depth 4(k + 1). However, note we do not need to revisit a previously visited vertex, unless we reach it with fewer steps. That is, starting with i = 0, we mark which vertices we have already visited (the set B4(k+1)(v1) ∪ · · · ∪ B4(k+1)(vi)) and remember minimum 22 distances from {v1, . . . , vi} to each previously visited vertex. Considering vertices in any order, we let vi+1 be the first not yet visited. We then mark the new ball of radius 4(k + 1) around it, but only exploring a previously visited vertex when the minimum distance to it strictly decreases by adding vi+1. This way, we explore each vertex at most 4(k + 1) times, as this is an upper bound on the minimum distance of any vertex when first visited. Hence the sequence v1, . . . , vℓ can be computed in O(k2V (G)) time. We now estimate the length ℓ of the sequence. Recall that for every i ∈ [ℓ], B4(k+1)(vi) ≤ (2k +1)4(k+1) and that V (G) = Si∈[ℓ] B4(k+1)(vi). From the above and the fact that E(G′) ≤ 2k · V (G′) (as every vertex of G′ is incident to at most 2k edges of G′), it follows that ℓ ≥ V (G′)/(2k + 1)4(k+1) ≥ E(G′)/(2k + 1)4(k+1)+1. By construction, the distance between vi and vj is greater than 4(k + 1), for distinct i, j ∈ [ℓ]. Therefore, the balls B2(k+1)(v1), . . . , B2(k+1)(vℓ) are vertex-disjoint. Moreover, since we have that V1 < E(G′)/(2k + 1)4(k+1)+2, at most E(G′)/(2k + 1)4(k+1)+2 of those balls contain a vertex of degree 1. Therefore, the remaining ℓ − E(G′)/(2k + 1)4(k+1)+2 balls are disjoint with V1. Let I ⊆ [ℓ] be the set of indices for which the balls B2(k+1)(vi), i ∈ I, are disjoint from V1. Observe that I ≥ ℓ − E(G′)/(2k + 1)4(k+1)+2 ≥ E(G′)/(2k + 1)4(k+1)+2. Claim 26. In time O(E(G′)) we can either conclude that cw(G′) > k, or for each i ∈ I find a cycle in G′ passing only through the vertices of the ball B2(k+1)(vi). Proof. Suppose for some i ∈ I, B2(k+1)(vi) does not contain a cycle. We will prove that every vertex in G′[B2(k+1)(vi)] has degree at least 3 in G′, and that every edge appears with multiplic- ity 1. Notice first that every edge of the graph G′[B2(k+1)(vi)] has multiplicity 1, as otherwise an edge with multiplicity at least 2 would form a cycle, a contradiction. Notice also that B2(k+1)(vi) does not have any vertex that has degree 2 in G. Indeed, recall that by the construction of the graph G′ any vertex of degree 2 is incident only to one edge of multiplicity 2, which is again a contradiction. Moreover, by the choice of i ∈ [I], we obtain that B2(k+1)(vi) ∩ V1 = ∅ and there- fore, G′[B2(k+1)(vi)] does not have any vertex that has degree 1 in G. We conclude that every vertex in G′[B2(k+1)(vi)] has degree at least 3 in G, and every edge appears with multiplicity 1. Recall that the subgraph of G′ induced by B2(k+1)(vi) contains the full breadth-first search tree of vertices at distance at most 2(k + 1) from vi. If G′[B2(k+1)(vi)] did not contain any cycle, then it would be equal to this breadth-first search tree, and in this tree all vertices except possibly the last layer would have degrees at least 3. Hence, G′ would contain as a subgraph a perfect binary tree of height 2(k + 1). From Lemma 24, this tree has cutwidth at least k + 1. The algorithm can thus check (by breadth-first search) for a cycle in the subgraph induced by B2(k+1)(vi). If it does not find any such cycle it immediately concludes that cw(G) = cw(G′) > k. If for every i ∈ I, the breadth-first search in G′[B2(k+1)(vi)] finds a cycle, then the algorithm obtained, in total time O(E(G′)), a set of at least I ≥ E(G′)/(2(k + 1))4(k+1)+2 vertex-disjoint (and hence edge-disjoint) cycles. y 23 Let us assume that the algorithm has now found a set C of at least E(G′)/(2k + 1)4(k+1)+2 edge-disjoint cycles and let H be the subgraph obtained from G′ by removing one, arbitrarily chosen, edge eC from each cycle C ∈ C. Then H can be immersed in G′ and E(H) ≤ E(G′) · (1−1/(2k+1)4(k+1)+2). To complete the proof of the lemma we will prove that if σ is any ordering of the vertices of H then σ is also an ordering of the vertices of G′ such that cwσ(G′) ≤ 2cwσ(H). Notice that by reintroducing an edge eC of G′ to H we increase the width of the σ-cuts separating its endpoints by exactly 1. Observe also that since eC belongs to the cycle C, the rest of the cycle forms a path PC in H that connects the endpoints of eC . Therefore, each of the σ-cuts separating the endpoints of eC has to contain at least one edge of PC . Since for different edges eC , for C ∈ C, the corresponding paths PC are pairwise edge-disjoint and they are present in H, it follows that the size of each σ-cut in G′ is at most twice the size of this σ-cut in H. Therefore cwσ(G′) ≤ 2cwσ(H). Thus, H can be returned, concluding the algorithm. We are now ready to put all the pieces together. Proof of Theorem 2. Given an n-vertex graph G and an integer k, one can in time 2O(k2 log k) · n either conclude that cw(G) > k, or output an ordering of G of width at most k. The proof follows the same recursive Reduction&Compression scheme as the algorithm of Bodlaender [2]. By applying Lemma 25, we obtain a significantly smaller immersion H, and we recurse on H. This recursive call either concludes that cw(H) > k, which implies cw(G) > k, or it produces an ordering of H of optimum width cw(H) ≤ k. This ordering can be lifted, using Lemma 25 again, to an ordering of G of width ≤ 2k. Given this ordering, we apply the dynamic programming procedure of Lemma 22 to construct an optimum ordering of G in time 2O(k2 log k) · V (G). Since at each recursion step the number of edges of the graph drops by a multiplicative factor of at least 1/(2k + 1)4(k+1)+3, we see that the graph Gi at level i of the recursion will have at most (1 − 1/(2k + 1)4(k+1)+3)i · E(G) edges. Hence, the total work used by the algorithm is bounded by the sum of a geometric series: ∞ X i=0 2O(k2 log k) · E(Gi) ≤ 2O(k2 log k) · E(G) · ∞ X i=0 (1 − 1/(2k + 1)4k+7)i = 2O(k2 log k) · E(G) · (2k + 1)4k+7 = 2O(k2 log k) · E(G). (15) 24 6 Obstructions to edge-removal distance to cutwidth Throughout this section, by Ok(w) we mean a quantity bounded by ck · w + dk, for some constant ck, dk depending on k only. Given a graph G and a k ∈ N, we define the parameter dcwk(G) as the minimum number of edges that can be deleted from G so that the resulting graph has cutwidth at most k (so dcwk(G) fits in the wider category of "graph modification parameters"). In other words: dcwk(G) = min{F : F ⊆ E(G) and cw(G \ F ) ≤ k} Let Cw,k = {G dcwk(G) ≤ w}. Notice that Ck = C0,k. In this section, we provide bounds to the sizes of the obstruction sets of the class of graphs G with dcwk(G) ≤ w, for each k, w ∈ N. Our results are the following. Theorem 27. For every w, k ∈ N, every graph in obs≤si (Cw,k) has Ok(w) vertices. Theorem 28. For every k, w ∈ N where k ≥ 7, the set obs≤i (Cw,k) contains at least (cid:0)3k−7+w+1 (cid:1) w+1 non-isomorphic graphs. From Observation 3, both bounds of Theorems 27 and 28 holds for both immersions and strong immersions as well. Given a collection H of graphs, we define the parameter aicH(G) as the minimum number of edges whose removal from G creates an H-immersion free graph, that is, a graph that does not admit any graph from H as an immersion. In both subsections that follow, we need the following observation. Observation 29. For every graph G and every w ∈ N, it holds that dcww(G) = aicobs(Cw)(G). We remark that, within the same set of authors, we have recently studied kernelization algorithms for edge removal problems to immersion-closed classes. The following result has been obtained in [11]: whenever a finite collection of graphs H contains at least one planar subcubic graph, and all graphs from H are connected, then the problem of computing aicH(G), parameterized by the target value, admits a linear kernel. These prerequisites are satisfied for H = obs(Cw), and hence the problem of computing dcww(G), parameterized by the target value k, admits a linear kernel. The connections between kernelization procedures and upper bounds on minimal obstruction sizes have already been noticed in the literature; see e.g. [7]. Intuitively, whenever the kerneliza- tion rules apply only minor or immersion operations, the kernelization algorithm can be turned into a proof of an upper bound on the sizes of minimal obstacles for the corresponding order. Unfortunately, this is not the case for the results of [11]: the main problem is the lack of linked decompositions for parameter tree-cut width, which plays the central role. Here, the situation is different, as we know that there are always linked orderings of optimum width. We therefore showcase how to use the linkedness to obtain a linear upper bound on the sizes of obstructions for Cw,k. The arguments are somewhat similar as in [11]: we use the idea of protrusions, adapted to the setting of edge cuts, and we try to replace protrusions with smaller ones having the 25 same behavior. The main point is that linkedness ensures us that the replacement results in an immersion of the original graph. 6.1 Upper bound on obstruction size A partial q-boundaried graph is a pair G = (G, ¯x) where G is a graph and ¯x = (x1, . . . , xq) is a q-tuple that consists either of vertices of G or from empty slots (that are indices that do not correspond to vertices of G). If xi is an empty slot, we denote it by xi = ⋄. The extension of such G is defined just as for q-boundaried graphs, but we put x′ i = ⋄′ iff xi = ⋄. Intuitively a partial q-boundaried graph extends the notion of a boundaried graph by allowing the vertices of the boundary to carry indices from a set whose cardinality might be bigger than the boundary. Let H be a graph and let (X1, X2) be its cut where q = δ(X1). Let EH (X1, X2) = {e1, . . . , eq} where ei = {x1 i ∈ Xj for (i, j) ∈ [q] × [2]. For j ∈ [2], we say that the pair (X1, X2) generates the q-boundaried graph Aj = (Aj, xj) if Ai = G[Xi] and xi = (xj i }, i ∈ [q], and such that xj i , x2 1, . . . , xj q). We denote by Bq,h the collection containing every q-boundaried graph that can be generated from some cut (X1, X2) of some graph H where V (H) + E(H) ≤ h and q = δ(X1). Moreover, we denote by Mq,h the set of all partial q-boundaried graphs F′ = (F ′, ¯x′) such that, for some F = (F, ¯x) of Bq,h, F ′ is a subgraph of F and a vertex xi in ¯x′ is an empty slot iff xi ∈ V (F ) \ V (F ′). In other words, Mq,h contains all partial q-boundaried graphs that can be generated by a graph whose number of edges and vertices does not exceed h. We insist that if H = (H, x) ∈ Mq,h, then the vertices of H are taken from some fixed repository of h vertices and that an element xi of x is either an empty slot (i.e., xi = ⋄) or the i-th vertex of some predetermined ordering (x1, . . . , xq) of q vertices from this repository. This permits us to assume that Mq,h is bounded by some function that depends only on q and h. Let G = (G, x) be a q-boundaried graph and H = (H, y) be a partial q-boundaried graph. Let also G∗ and H ∗ be the extensions of G and H, respectively. We also assume that, for all i ∈ [q], either yi = xi or yi = ⋄. For an edge subset R ⊆ E(G∗), we say that H is an R-avoiding strong immersion in G if there is an H ∗-immersion model (φ, ψ) of G∗ \ R where, for every i ∈ [q] such that yi 6= ⋄, it holds that φ(yi) = xi and φ(y′ i 6= ⋄. We now define the R-avoiding (q, h)-folio of G as the set of all partial q-boundaried graphs in Mq,h that are R-avoiding strong immersions in G and we denote it by folioq,h,R(G). We finally define i) = x′ Fq,h(G) = {folioq,h,R(G) R ⊆ E(G∗) and R ≤ q}. Given two q-boundaried graphs G1 and G2 we write G1 ∼q,h G2 in order to denote that Fq,h(G2) = Fq,h(G2). As Fq,h maps each q-boundaried graph to a collection of subsets of Mq,h we have the following. Lemma 30. There is some function f1 : N2 → N such that for every two non-negative integers q and h, the number of equivalence classes of ∼q,h is at most f1(q, h). The next lemma is a consequence of the definition of the function Fq,h. 26 Lemma 31. Let H be some set of connected graphs, each of at most h vertices, and let Gi = (Gi, xi), i ∈ {1, 2} be two q-boundaried graphs such that G1 ∼q,h G2 and such both G1, G2 are H-immersion free. Then, for every q-boundaried graph F = (F, y), it holds that aicH(F ⊕ G1) = aicH(F ⊕ G2). The proof is omitted as it is very similar to the one in [5] where a similar encoding was defined in order to treat the topological minor relation. To see the main idea, recall that Fq,h(Gi) registers all different "partial occurrences" of graphs of ≤ h vertices (and therefore also of graphs of H) in G′ i from Gi after removing at most q edges. This encoding is indeed sufficient to capture the behavior of all possible edge sets whose removal from F ⊕ Gi creates an H-free graph. Indeed, as both G1 and G2 are H-immersion free, any such set should have at most q edges inside Gi as, if not, the q-boundary edges between F and Gi would also make the same job. A similar discussion is also present in [11]. i, for all possible ways to obtain G′ Given a graph G and X ⊆ V (G), we write cwσ(G, X) = δG(X) + cwσX (G[X]). We require the following extension of the definition of linked orderings. Definition 32 (extended linked ordering). Let G be a n-vertex graph and X ⊆ V (G). An ordering σ = hv1, . . . , vni of G is X-linked if X = {vn−X+1, . . . , vn} and for every i, j ∈ [n − X, n] where i < j there exist min{δ({v1, . . . , vh}) i ≤ h ≤ j} edge-disjoint paths between {v1, . . . , vi} and {vj, . . . , vn} in G. The proof of the following result is very similar to the one of Lemma 13. We just move X to the end of the ordering, in the order given by σ, and apply exhaustively the same refinement step based on submodularity, but only to the subordering induced by X. Lemma 33. For every graph G and every subset X of V (G), if there exists an ordering σ of G such that cwσ(G, X) ≤ r, then there exists an X-linked ordering σ′ of G such that cwσ′ (G, X) ≤ r. Let w1, w2 ∈ N, G be a graph, and X ⊆ V (G). We say that X is an (w1, w2)-cutwidth-edge- protrusion of G if δ(X) ≤ w1 and cw(G[Xi]) ≤ w2. The next lemma uses an idea similar to the one of Lemma 17. Here ∼q,h plays the role of (q, ℓ)-similarity. Lemma 34. There is a computable function f2 : N2 → N such that the following holds: Let k be a non-negative integer and let H be a finite set of connected graphs, each having at most h vertices and edges. Let also G be a graph and let X be a (2k, k)-cutwidth-edge-protrusion of G. If X > f2(k, h), then G contains as a proper strong immersion a graph G′ where aicH(G) = aicH(G′). Proof. We set f2(k, h) = (f1(3k, h) + 1)3k+1 − 1. We have that X > f2(k, h) or, equivalently, X ≥ (f1(3k, h) + 1)3k+1. We set ℓ = X. Let σ∗ = hx1, . . . , xℓi be an ordering of the vertices in X such that cwσ∗ (G[X]) ≤ k. Let σ = hv1, . . . , vn−ℓ, vn−ℓ+1, . . . , vni be any ordering of V (G) such that σ∗ is a suffix of σ, i.e. It follows that hx1, . . . , xℓi = hvn−ℓ+1, . . . , vni. 27 cwσ(G, X) ≤ cwσ∗ (G[X]) + δG(X) ≤ k + 2k = 3k. From Lemma 33, there is an X-linked ordering σ′ of V (G), where cwσ′ (G, X) ≤ 3k. We set ki = δG[X]({x1, . . . , xi−(n−ℓ)) + δG(X) and observe that ki ≤ k + 2k = 3k, i ∈ [n−ℓ, n−1]. We set up the alphabet A = {0, 1, . . . , 3k} and we see w = kn−ℓ, kn−ℓ+1, . . . , kn−1 as a word on A. Let also N = f1(3k, h). Notice that w = X = ℓ ≥ (f1(3k, h)+1)3k+1 = (N +1)A. From Corollary 15, if w ≥ (N + 1)A, there are a, b ∈ [n − ℓ, n − 1], a < b and some p ∈ A such that ka, kb ≥ p and p appears in {ka, . . . , kb} at least N + 1 times. Let these appearance be at indices a ≤ i1 < i2 < . . . < iN +1 ≤ b. By X-linkedness, there are p edge-disjoint paths P i, for i ∈ [p], from {v1, . . . , vi1 } to {viN +1, . . . , vV (G)}. Observe that for each j ∈ [N + 1], each path P i must cross exactly one edge of the cut δG({v1, . . . , vij }); let this edge be zi j /∈ {v1, . . . , vij }. For each j ∈ [N + 1] we define p-boundaried graphs Fj = (Fj , (z1 j )), where Fj = G[{v1, . . . , vij }], and Gj = (Gj , (w1 j , . . . , zp j )) where Gj = G[{vij +1, . . . , vV (G)}]. j , . . . , wp jwi j , where zi j ∈ {v1, . . . , vij } and wi As, from Lemma 30, the equivalence relation ∼3k,h has at most N equivalent classes, there are j1, j2 such that a ≤ j1 < j2 ≤ b such that Gj1 ∼3k,h Gj2 . Let G′ = Fij1 ; it is easy to observe that G′ is a proper immersion of G, because the edges added when joining can be modeled using appropriate infixes of the paths Pi. From Lemma 31, however, we have aicH(Fi ⊕ Gi) = aicH(Fi ⊕ Gj), and therefore aicH(G) = aicH(G′). ⊕ Gij2 Lemma 35. Let k, w, ℓ ∈ N and let G be a graph. If dcwk(G) ≤ w and V (G) ≥ ℓ·(2w+1)+2w, then G has a (2k, k)-cutwidth-edge-protrusion X where X ≥ ℓ. Proof. We denote n = V (G). Let F be a set of edges of G such that if G′ = G \ F , then cw(G′) ≤ k. Let σ = hv1, . . . , vni be an ordering of V (G′) such that cwσ(G′) ≤ k. Let I denote the indices in σ of the endpoints of the edges in F and notice that I ≤ 2w. We consider the maximal intervals of [n] that do not intersect I. The set [n] \ I has n − I ≥ n − 2w elements, that are distributed among at most I + 1 ≤ 2w + 1 such intervals. By the pigeonhole principle, one interval {i, . . . , j} has at least n−2w 2w+1 ≥ ℓ elements. Consider now the set X = {vi, . . . , vj}, X ≥ ℓ. Notice that if σ′ = hvi, . . . , vji, then cwσ′ (G[X]) ≤ k. Moreover there are at most δG′({v1, . . . , vi−1}) + δG′ ({vj+1, . . . , vn}) ≤ 2k edges with one vertex in X and the other not in X. Therefore, δG(X) ≤ 2k and X is a (2k, k)- cutwidth-edge-protrusion of G. Proof of Theorem 27. We set H = obs≤im(Ck). By Theorem 17, there is a function f3 : N → N such that graphs from H have at most h = f3(k) vertices. Let G ∈ obs≤im (Cw,k). This means that dcwk(G) = w + 1, while, for every proper strong immersion G′ of G, it holds that dcwk(G′) ≤ w. This, together with Observation 29 and Lemma 34, implies that G cannot have a (2k, k)-cutwidth- edge-protrusion X of more than ℓ = f2(k, h), vertices. As dcwk(G) = w + 1, Lemma 35 implies that V (G) < ℓ · (2w + 3) + 2(w + 1) = Ok(w) vertices. Notice that Theorem 27 can be seen as an application of Lemma 13 on the existence of linked orderings of optimum cutwidth (along with Lemma 33, that is an easy extension of it). We stress that this bound is constructive as, by going through the proof, one can make an estimation of the 28 functions of k hidden in the Ok notation. In future work we plan to further develop the above technique of proving such linear bounds for other edge modification problems. Some analogous work for vertex modification problems have been done in [7] where the parameter k is the number of vertices that one should remove in order to transform a graph to one of treewidth at most k. The corresponding bound in [7] is wOk (1), is non-constructive, and follows a distinct (more elaborated) approach. 6.2 Lower bound on number of obstructions We now focus on the proof of Theorem 28. We need the following result. Theorem 36 ([12]). For every k ≥ 7, the number of non-isomorphic connected minimal obstruc- tions in obs≤i (Ck) is at least 3k−7 + 1. Recall that, given a graph class H, we defined aicH(G) as the minimum number of edges of G whose removal yields an H-immersion-free graph. We set Cw,H = {G aicH(G) ≤ w}. In particular C0,H is the class of all H-immersion free graphs. If G and H are graphs, we denote by G ⊎ H the disjoint union of G and H. The following observations follow directly from the definition of aicH. Observation 37. If G and H are graphs, then H ≤i G implies that aicH(H) ≤ aicH(G). Observation 38. If G and H are graphs, then aicH(G ⊎ H) = aicH(G) + aicH(H). Observation 39. If G ∈ obs≤i (Cw,H), then aicH(G) = w + 1. i=1 Gi ∈ obs≤i (Cw,H). Lemma 40. Let H be some ≤i-antichain. For every non-negative integer w, if G1, . . . , Gw+1 are (not necessarily distinct) members of H, then Uw+1 Proof. Let G = Uw+1 i=1 Gi. To prove that G ∈ obs≤i (Cw,H) we have to show that it satisfies O1 and O2. Notice that since H is an ≤i-antichain, aicH(H) = 1 for every H ∈ H. By Observations 38 and 39, aicH(G) = Pw+1 i=1 aicH(Gi) = w +1 and O1 holds. Therefore, G 6∈ Cw,H. Let now G′ is a proper immersion of G. This mean that G′ = Uw+1 i ≤i Gi and at least one of G′ 1, . . . , G′ w+1 is different than Gi. W.l.o.g. we assume that this graph is Gw+1. As H is a ≤i-antichain, G′ w+1 is not isomorphic to a graph of H. Therefore aicH(G′ w+1) = 0. Then, by Observations 37 and 38, aicH(G′) = Pk i=1 aicH(Gi) + 0 = w w+1) ≤ Pw i=1 G′ i where G′ and O2 holds. i=1 aicH(G′ i) + aicH(G′ Theorem 41. If k is a non-negative integer and H is a ≤i-antichain that contains at least q connected graphs, then obs≤i (Cw,H) ≥ (cid:0)q+w w+1(cid:1). Proof. Let H′ be some subset of H containing q connected graphs. Using Lemma 40, we observe that every multiset of cardinality w + 1 whose elements belong to H′ corresponds to a different (i.e. non-isomorphic) obstruction of Cw,H. Therefore, obs≤i (Cw,H) is at least the number of multisets of cardinality w + 1 the elements of which are taken from a set of cardinality q, which is known to be (cid:0)q+w w+1(cid:1). 29 Proof of Theorem 28. From Observation 29, Cw,k = Cw,Hk, where Hk = obs≤i (Ck). This means that obs≤i (Cw,k) = obs≤i (Cw,Hk). The result follows from Theorems 36 and 41. 7 Conclusions In this paper we have proved that the immersion obstructions for admitting a layout of cutwidth at most k have sizes single-exponential in O(k3 log k). The core of the proof can be interpreted as bounding the number of different behavior types for a part of the graph that has only a small number of edges connecting it to the rest. This, in turn, gives an upper bound on the number of states for a dynamic programming algorithm that computes the optimum cutwidth ordering on an approximate one. This last result, complemented with an adaptation of the reduction scheme of Bodlaender [2] to the setting of cutwidth, yields a direct and self-contained FPT algorithm for computing the cutwidth of a graph. In fact, we believe that our algorithm can be thought of "Bodlaender's algorithm for treewidth in a nutshell". It consists of the same two components, namely a recursive reduction scheme and dynamic programming on an approximate decomposition, but the less challenging setting of cutwidth makes both components simpler, thus making the key ideas easier to understand. For an alternative attempt of simplification of the algorithm of Bodlaender and Kloks [3], applied for the case of pathwidth, see [8]. In our proof of the upper bound on the number of types/states, we used a somewhat new bucketing approach. This approach holds the essence of the typical sequences of Bodlaender and Kloks [3], but we find it more natural and conceptually simpler. The drawback is that we lose a log k factor in the exponent. It is conceivable that we could refine our results by removing this factor provided we applied typical sequences directly, but this is a price that we are willing to pay for the sake of simplicity and being self-contained. An important ingredient of our approach is the observation that there is always an optimum cutwidth ordering that is linked: the cutsizes along the ordering precisely govern the edge con- nectivity between prefixes and suffixes. Recently, there is a growing interest in parameters that are tree-like analogues of cutwidth: tree-cut width [25] and carving-width [20]. In future work, we aim to explore and use linkedness for tree-cut decompositions and carving decompositions in a similar manner as presented here. 7.1 Acknowledgements. The second author thanks Miko laj Boja´nczyk for the common work on understanding and rein- terpreting the Bodlaender-Kloks dynamic programming algorithm [3], which influenced the buck- eting approach presented in this paper. We also thank O-joung Kwon for pointing us to [10, 15], as well as an anonymous referee for noting that the running time in Lemma 25 can be reduced to polynomial by amortization. 30 References [1] Patrick Bellenbaum and Reinhard Diestel. Two short proofs concerning tree-decompositions. Combinatorics, Probability & Computing, 11(6):541–547, 2002. [2] Hans L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput., 25(6):1305–1317, 1996. [3] Hans L. Bodlaender and Ton Kloks. Efficient and constructive algorithms for the pathwidth and treewidth of graphs. J. Algorithms, 21(2):358–402, 1996. [4] Heather Booth, Rajeev Govindan, Michael A. Langston, and Siddharthan Ramachandra- murthi. Cutwidth approximation in linear time. In Proceedings of the Second Great Lakes Symposium on VLSI, pages 70–73. IEEE, 1992. [5] Dimitris Chatzidimitriou, Jean-Florent Raymond, Ignasi Sau, and Dimitrios M. Thilikos. An O(log OP T ) -approximation for covering/packing minor models of θr. In Proceedings of WAOA 2015, pages 122–132, 2015. Full version available at arXiv:1510.03945. [6] Josep D´ıaz, Jordi Petit, and Maria J. Serna. A survey of graph layout problems. ACM Comput. Surv., 34(3):313–356, 2002. [7] Fedor V. Fomin, Daniel Lokshtanov, Neeldhara Misra, and Saket Saurabh. Planar F - In Proceedings of deletion: Approximation, kernelization and optimal FPT algorithms. FOCS 2012, pages 470–479. IEEE Computer Society, 2012. [8] Martin Furer. Faster computation of path-width. In Veli Makinen, J. Simon Puglisi, and Leena Salmela, editors, Combinatorial Algorithms: 27th International Workshop, IWOCA 2016, Helsinki, Finland, August 17-19, 2016, Proceedings, pages 385–396, Cham, 2016. Springer International Publishing. [9] Michael R. Garey and David S. Johnson. Computers and intractability, volume 174. Freeman New York, 1979. [10] James F. Geelen, A. M. H. Gerards, and Geoff Whittle. Branch-width and well-quasi- ordering in matroids and graphs. J. Comb. Theory, Ser. B, 84(2):270–290, 2002. A correction is available at http://www.math.uwaterloo.ca/~jfgeelen/Publications/bn-corr.pdf. [11] A. C. Giannopoulou, M. Pilipczuk, D. M. Thilikos, J.-F. Raymond, and M. Wrochna. Lin- ear kernels for edge deletion problems to immersion-closed graph classes. ArXiv e-prints arXiv:1609.07780, September 2016. [12] Rajeev Govindan and Siddharthan Ramachandramurthi. A weak immersion relation on graphs and its applications. Discrete Mathematics, 230(1):189 – 206, 2001. [13] Pinar Heggernes, Daniel Lokshtanov, Rodica Mihai, and Charis Papadopoulos. Cutwidth of split graphs and threshold graphs. SIAM J. Discrete Math., 25(3):1418–1437, 2011. 31 [14] Pinar Heggernes, Pim van 't Hof, Daniel Lokshtanov, and Jesper Nederlof. Computing the cutwidth of bipartite permutation graphs in linear time. SIAM J. Discrete Math., 26(3):1008–1021, 2012. [15] Mamadou Moustapha Kant´e and O-joung Kwon. An upper bound on the size of obstructions for bounded linear rank-width. CoRR, arXiv:1412.6201, 2014. [16] Ephraim Korach and Nir Solel. Tree-width, path-width, and cutwidth. Discrete Applied Mathematics, 43(1):97 – 101, 1993. [17] Jens Lagergren. Upper bounds on the size of obstructions and intertwines. J. Comb. Theory, Ser. B, 73(1):7–40, 1998. [18] Frank Thomson Leighton and Satish Rao. Multicommodity max-flow min-cut theorems and their use in designing approximation algorithms. J. ACM, 46(6):787–832, 1999. [19] Neil Robertson and Paul D. Seymour. Graph minors XXIII. Nash-Williams' immersion conjecture. J. Comb. Theory, Ser. B, 100(2):181–205, 2010. [20] Paul D. Seymour and Robin Thomas. Call routing and the ratcatcher. Combinatorica, 14(2):217–241, 1994. [21] Atsushi Takahashi, Shuichi Ueno, and Yoji Kajitani. Minimal acyclic forbidden minors for the family of graphs with bounded path-width. Discrete Math., 127(1-3):293–304, 1994. Graph theory and applications (Hakone, 1990). [22] Dimitrios M. Thilikos, Maria J. Serna, and Hans L. Bodlaender. Cutwidth I: A linear time fixed parameter algorithm. J. Algorithms, 56(1):1–24, 2005. [23] Dimitrios M. Thilikos, Maria J. Serna, and Hans L. Bodlaender. Cutwidth II: Algorithms for partial w-trees of bounded degree. J. Algorithms, 56(1):25–49, 2005. [24] Robin Thomas. A Menger-like property of tree-width: The finite case. J. Comb. Theory, Ser. B, 48(1):67–76, 1990. [25] Paul Wollan. The structure of graphs not admitting a fixed immersion. J. Comb. Theory, Ser. B, 110:47–66, 2015. [26] Mihalis Yannakakis. A polynomial algorithm for the min-cut linear arrangement of trees. J. ACM, 32(4):950–988, 1985. 32
1707.08684
2
1707
2017-08-01T13:01:14
A Naive Algorithm for Feedback Vertex Set
[ "cs.DS" ]
Given a graph on $n$ vertices and an integer $k$, the feedback vertex set problem asks for the deletion of at most $k$ vertices to make the graph acyclic. We show that a greedy branching algorithm, which always branches on an undecided vertex with the largest degree, runs in single-exponential time, i.e., $O(c^k\cdot n^2)$ for some constant $c$.
cs.DS
cs
A Naive Algorithm for Feedback Vertex Set Yixin Cao∗ Abstract 7 1 0 2 g u A 1 ] S D . s c [ 2 v 4 8 6 8 0 . 7 0 7 1 : v i X r a Given a graph on n vertices and an integer k, the feedback vertex set problem asks for the deletion of at most k vertices to make the graph acyclic. We show that a greedy branching algorithm, which always branches on an undecided vertex with the largest degree, runs in single-exponential time, i.e., O(ck · n2) for some constant c. 1 Introduction All graphs in this paper are undirected and simple. A graph G is given by its vertex set V(G) and edge set E(G), whose cardinalities will be denoted by n and m respectively. A set V− of vertices is a feedback vertex set of graph G if G − V− is acyclic, i.e., being a forest. Given a graph G and an integer k, the feedback vertex set problem asks whether G has a feedback vertex set of at most k vertices. The feedback vertex set problem was formulated from artificial intelligence, where a feedback vertex set is also called a loop cutset. For each instance of the constraint satisfaction problem one can define a constraint graph, and it is well known that the problem can be solved in polynomial time when the constraint graph is a forest [11]. Therefore, one way to solve the constraint satisfaction problem is to find first a minimum feedback vertex set of the constraint graph, enumerate all possible assignments on them, and then solve the remaining instance. Given an instance I of the constraint satisfaction problem on p variables, and a feedback vertex set V− of the constraint graph, this approach can be implemented in O(pV− · IO(1)) time [7]. A similar application was found in Bayesian inference, also in the area of artificial intelligence [18]; more updated material can be found in the Ph.D. thesis of Bidyuk [3]. The feedback vertex set problem is NP-hard [16]. The aforementioned approach for solving the constraint satisfaction problem only makes sense when V− is fairly small. This motivates the study of parameterized algorithms for the feedback vertex set problem, i.e., algorithms that find a feedback vertex set of size at most k in time f(k) · nO(1). Since earlier 1990s, a chain of parameterized algorithms have been reported in literature; for a complete list we refer to [5]. Instead of providing a new and improved algorithm, this paper considers a naive branching algorithm that should have been discovered decades ago. A trivial branching algorithm will work as follows. It picks a vertex and branches on either including it in the solution V− (i.e., deleting it from G), or marking it "undeletable," until the remaining graph is already a forest. This algorithm however takes O(2n) time. A (rather informal) observation is that a vertex of a larger degree has a larger chance to be in a minimum feedback vertex set, thereby inspiring the following two-phase greedy algorithm for solving the feedback vertex set problem. If there are undecided vertices of degree larger than two after some preprocessing, then it always branches on an undecided vertex with the largest degree. Believe it or not, this greedy algorithm, implemented in its most naive way, already beats most previous algorithms for this problem. Theorem 1.1. The greedy algorithm can be implemented in O(8k · n2) time. The use of the observations on degrees in solving the feedback vertex set problem is quite natural. Indeed, the research on parameterized algorithms and that on approximation algorithms for the feedback vertex set problem have undergone a similar process. Early work used the cycle packing-covering duality, and hence ended with O((log k)O(k) · nO(1))-time parameterized algorithms [19] and O(log n)-ratio approximation algorithms [8], respectively, while the first 2-approximation algorithm uses a similar greedy approach on high-degree vertices [1]. Indeed, all the four slightly different 2-approximation algorithms for this problem are based on similar degree ∗Department of Computing, Hong Kong Polytechnic University, Hong Kong, China. [email protected] 1 observations [6, 12]. So is the quadratic kernel of Thomass´e [20]. There is also an O(4k · n)-time randomized algorithm [2] based on this idea. Our greedy branching algorithm can be viewed as the de-randomization of this randomized algorithm. For a reader familiar with parameterized algorithms of the feedback vertex set problem, Theorem 1.1 may sound somewhat surprising. Deterministic single-exponential algorithms for the feedback vertex set problem had been sedulously sought, before finally discovered in 2005. With so many different techniques, some very complicated, having been tried toward this end,1 it is rather interesting that the goal can be achieved in such a naive way. The significance of single-exponential algorithms for the feedback vertex set problem lies also in the theoretical interest, for which let us put it into context. Together with the vertex cover problem (finding a set V− of at most k vertices of a graph G such that G − V− is edgeless), the feedback vertex set problem is arguably the most studied parameterized problem. However, a simple O(2k · (m + n))-time algorithm for vertex cover was already known in 1980s [17]. For this difference there is a quick and easy explanation from the aspect of graph modification problems [16, 4]. Vertex deletion problems ask for the deletion of a minimum set of vertices from a graph to make it satisfy specific properties. The vertex cover problem and the feedback vertex set problem are precisely vertex deletion problems to, respectively, the edgeless graphs and acyclic graphs, i.e., forests. The obstruction (forbidden induced subgraph) for the edgeless graphs is an single edge, the simplest one that is nontrivial. On the other hand, the obstructions for forests are all cycles, which may be considered the simplest of all those infinite obstructions, for most of which single-exponential algorithms are quite nontrivial, if possible at all. The problems vertex cover and feedback vertex set are also known as planar-F-deletion problems, which, given a graph G, a set F of graphs of which at least one is planar, ask for a minimum set of vertices whose deletion make the graph H-minor-free for every H ∈ F [9]. They correspond to the cases with F = {K2} and F = {K3} respectively. Recently, Fomin et al. [10] and Kim et al. [14] showed that all planar-F-deletion problems can be solved in single-exponential time. With a huge constant hidden by the big-Oh, their results, however, are of only theoretical interest. Yet another way to connect the vertex cover problem and the feedback vertex set problem is that a graph has treewidth zero if and only if it is edgeless, and treewidth at most one if and only if it is a forest. The treewidth-two vertex deletion problem is planar-{K4}-deletion [15]. 2 The algorithm There is no secret in our algorithm, which is presented in Figure 1, except the recursive form and an extra input F, the set of "undeletable" vertices. We say that (G, k, F), where F ⊆ V(G) and the solution is only picked from V(G) \ F, is an extended instance; note that to make such an extended instance nontrivial, F needs to induce a forest. (Indeed, the solution in the original loop cutset problem has to be selected from "allowed" vertices, which is exactly the case F comprising all vertices that are not allowed.) The algorithm can be viewed as two parts, the first (steps 1–4) applying some simple operations when the situation is simple and clear, while the second (steps 5–7) trying both possibilities on whether a vertex v is in a solution. The operations in the first part are called reductions in the parlance of parameterized algorithms. The three we use here are standard and well-known,2 and their correctness is straightforward; see, e.g., [5]. Lemma 2.1. Calling algorithm naive-fvs with (G, k,∅) solves the instance (G, k) of the feedback vertex set problem. Proof. The two termination conditions in step 0 are clearly correct. For each recursive call in steps 1 and 2, we show that the original instance is a yes-instance if and only if the new instance is a yes-instance. Note that no 1To date, the number of parameterized algorithms for feedback vertex set published in literature exceeds any other single problem, including the more famous vertex cover problem. 2For the reader familiar with related algorithms, our reduction steps may seem slightly different from those in literature. First of all, unlike most algorithms for the problem, our algorithm does not involve multiple edges. We believe it is simple to keep the graph simple. As a result, we are not able to eliminate all vertices of degree two: The common way to dispose of a vertex v of degree-2 is to delete v and add an edge between its two neighbors, so called smoothening. Smoothening a vertex whose two neighbors were already adjacent would introduce parallel edges. Noting that there always exists an optimal solution avoiding v, one may move v into F [5], but we prefer the current form because it is simpler and easier to analyze. It is also easier to be extended in Section 3. 2 Algorithm naive-fvs(G, k, F) INPUT: a graph G, an integer k, and a set F ⊆ V(G) inducing a forest. OUTPUT: a feedback vertex set V− ⊆ V(G) \ F of size (cid:54) k or "NO." 0. 1. 2. if k < 0 then return "NO"; if V(G) = ∅ then return ∅; if a vertex v has degree less than two then if a vertex v ∈ V(G) \ F has two neighbors in the same component of G[F] then return naive-fvs(G − {v}, k, F \ {v}); X ← naive-fvs(G − {v}, k − 1, F); return X ∪ {v}; if d(v) = 2 then 3. pick a vertex v from V(G) \ F with the maximum degree; 4. 4.1. 4.2. X ← ∅; while there is a cycle C in G then take any vertex x in C \ F; add x to X and delete it from G; if X (cid:54) k then return X; else return "NO"; 4.3. 5. X ← naive-fvs(G − {v}, k − 1, F); \\case 1: v ∈ V−. if X is not "NO" then return X ∪ {v}; return naive-fvs(G, k, F ∪ {v}). \\case 2: v (cid:54)∈ V−. 6. Figure 1: A simple algorithm for feedback vertex set branching in a greedy manner. vertex is moved to F in these two steps. In step 1, the vertex v is not in any cycle, and hence it can be avoided by any solution. In step 2, there is a cycle consisting of the vertex v and vertices in F (any path connecting these two vertices in G[F]), and hence any solution has to contain v. To argue the correctness of step 4, we show that the solution found in step 4 is optimal. Let c be the number of components in G and (cid:96) the size of optimal solutions. Note that every vertex in a solution has degree two, and hence after deleting (cid:96) vertices the graph has n − (cid:96) vertices and at least m − 2(cid:96) edges. Moreover, deleting vertices from an optimal solution will not decrease the number of components of the graph, we have (n−(cid:96))−(m−2(cid:96)) (cid:62) c. Hence, (cid:96) (cid:62) m − n + c, and showing X = m − n + c would finish the task. Deleting a vertex of degree 2 from a cycle never increases the number of components. Also note that a graph on c components contains a cycle if and only if it has more than n − c edges. Therefore, the while loop in step 4 would be run exactly m − n + c iterations: After deleting m − n + c vertices, each of degree two when deleted, the remaining graph has 2n − m − c vertices and 2n − m − 2c edges, which has to be a forest of c trees. The last two steps are trivial: If there is a solution containing v, then it is found in step 5; otherwise, step 6 always gives the correct answer. We now analyze the running time of the algorithm, which is simple but nontrivial. The execution of the algorithm can be described as a search tree in which each node corresponds to two extended instances of the problem, the entry instance and the exit instance. The entry instance of the root node is (G, k,∅). The exit instance of a node is the one after steps 1–3 have been exhaustively applied on the entry instance. If step 5 is further called, then two children nodes are generated, with entry instances (G − {v}, k − 1, F) and (G, k, F ∪ {v}) respectively. (Note that the second child may not be explored by the algorithm, but this is not of our concern.) A leaf node of the search tree returns either a solution or "NO." It is clear that each node can be processed in polynomial time, and thus the focus of our analysis is to bound the number of nodes in the search tree. Since the tree is binary, it suffices to bound its depth. We say that a path from the root of the search tree to a leaf node is an execution path. Let us fix an arbitrary execution path in the search tree of which the leaf node returns a solution V−, and let F(cid:48) denote all the vertices moved into F by step 6 in this execution path. The length of this execution path is at most V− + F(cid:48): Each non-leaf node puts at least one vertex to V− or F. We are allowed to put at most k vertices into V−, i.e., V− (cid:54) k, and hence our task in the rest of this section is to bound F(cid:48). 3 Let us start from some elementary facts on trees. Any tree T satisfies d(v) = 2E(T ) = 2V(T ) − 2 and (d(v) − 2) = −2. (cid:88) v∈V(T ) (cid:88) v∈V(T ) Let L denote the set of leaves of T, and V3 the set of vertices of degree at least three. If V(T ) (cid:62) 2, then L (cid:62) 2 and (d(v) − 2) + (d(v) − 2) = (−1) + (d(v) − 2) = (d(v) − 2) − L. (cid:88) v∈V(T )\L (cid:88) v∈L (cid:88) v∈V3 (cid:88) v∈V3 (cid:88) v∈L −2 = Hence (d(v) − 2) = L − 2. (1) (cid:88) v∈V3 The implication of (1) for our problem is that the more large-degree vertices (V3) in the final forest G − V−, the more leaves (L) it has. Every vertex u ∈ F(cid:48) will be in the forest. Since its original degree is at least three, either its degree is decreased to two or less, or there must be some leaves produced to "balance the equation (1)." On the other hand, however, every vertex has degree at least two when u is moved to F. Therefore, if it is the second case, the leaves have to be "produced" in later steps. The requirement of degree decrements is decided by the degree of u, and can be satisfied by vertices deleted later, whose degrees cannot be larger than that of u. This informal observation would enable us to derive the desired lower bound on F(cid:48). The following invariants will be used in our formal analysis. Invariant 1 : During the algorithm, the degree of no vertex can increase. Invariant 2 : When a recursive call is made in step 5 or 6, there is no vertex of degree 0 or 1 in the graph. This algorithm never directly deletes any edge, and thus the degree of a vertex decreases only when some of its neighbors are deleted from the graph,-we are talking about the degree in the whole graph G, so moving a vertex to F does not change the degree of any vertex. In particular, only steps 1, 2, 4, and 5 can decrease the degree of vertices. By Invariant 2, after a vertex is moved to F, step 1 cannot be called before step 2, 4, or 5. In other words, the degree of a vertex in F decreases only after some vertex put into V−. We can attribute them to vertices V− as follows. For a vertex v ∈ V− ∪ F(cid:48), we use d∗(v) to denote the degree of v at the moment it is deleted from the graph and put into V− (step 2, 4, or 5) or moved into F (step 6). Note that dG(v) (cid:62) d∗(v) by Invariant 1, and d∗(v) (cid:62) 3 when v ∈ F(cid:48). Let x1, x2, . . ., xV− be the vertices in V−, in the order of them being put into V−, and let (Gi, ki, Fi) be the exit instance in the node of the search tree corresponding to xi. Definition 1. We say that the decrements of the degree of a vertex u ∈ F(cid:48) from d∗(u) to 2 are effective, and an effective decrement is incurred by xi ∈ V− if it happens between deleting xi and xi+1, or after deleting xV− if i = V−. Let δ(u, xi) denote the number of effective decrements of u incurred by xi. Note that δ(u, xi) may be larger than 1. It is worth stressing that we do not count the degree decrements of u before it is moved into F. Therefore, δ(u, xi) can be positive only when u is in F when xi is deleted, i.e., u ∈ Fi and hence dGi (u) (cid:62) 2: (cid:14) δ(u, xi) = dGi (u) − max{dGi+1 (u), 2} when u ∈ Fi, 0 otherwise. Proposition 2.2. For any u ∈ F(cid:48) and xi ∈ V−, if δ(u, xi) > 0 then d∗(u) (cid:62) d∗(xi). (cid:80) First, we bound the total number of effective decrements incurred by xi for each xi ∈ V−. Lemma 2.3. For each xi ∈ V−, it holds Proof. Recall that all effective decrements incurred by xi happen after deleting xi from Gi. If dGi (v) > 2 for every vertex v ∈ NGi(xi), then the deletion of xi will not make the degree of any vertex smaller than two. Therefore, step 1 will not be called before putting the next vertex into V−. The degree of each vertex in NGi (xi) decreases by one, and the total number of effective decrements incurred by xi is thus at most d∗(xi). u∈F(cid:48) δ(u, xi) (cid:54) d∗(xi). 4 In the rest dGi (v) = 2 for some v ∈ NGi(xi), and it becomes 1 with the deletion of xi. This decrement is not effective, but it will trigger step 1, which may subsequently lead to effective decrements. Let d denote the number of degree-2 neighbors of xi in Gi. After the deletion of xi, all of them have degree one, and there is no other vertex having degree one in Gi − {xi} (Invariant 2). We consider the application of step 1, and let x be the vertex deleted. If the only neighbor of x has degree two when this step is executed, then its degree becomes 1 after the deletion of x, and hence the number of degree-1 vertices is not changed. Otherwise, there is one less vertex of degree 1 but there may be one effective decrement (only when the only neighbor of x is in F and has degree at least three). Therefore, when step 1 is no longer applicable, the total number of effective decrements is at most d∗(xi) − d + d = d∗(xi). We are now ready to bound the number of calls of step 6 made in this execution path, i.e., the size of F(cid:48), by the size of V−. This is exactly the place the greedy order of branching plays the magic. Lemma 2.4. In an execution path that leads to a solution, F(cid:48) (cid:54) 3V−. Proof. Since this execution path leads to a solution, all vertices must be deleted from the graph at the end of the path. In the algorithm, a vertex in F can only be deleted from the graph in step 1, when the degree of the vertex has to be one or zero. On the other hand, d∗(u) (cid:62) 3. Thus, all the d∗(u) − 2 effective decrements must have happened on this vertex, i.e., δ(u, v) = d∗(u) − 2. Putting everything together, we have (cid:80) v∈V− (cid:88) V− = v∈V− δ(u, v) d∗(v) d∗(v) d∗(v) 1 (cid:88) (cid:88) (cid:88) u∈F(cid:48) δ(u, v) d∗(v) δ(u, v) d∗(u) (cid:88) v∈V− u∈F(cid:48) v∈V− u∈F(cid:48) 1 v∈V− v∈V− (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) u∈F(cid:48) u∈F(cid:48) u∈F(cid:48) F(cid:48) 3 , 1 = (cid:62) = (cid:62) = = (cid:62) = (Lemma 2.3) (Proposition 2.2) δ(u, v) d∗(u) v∈V− d∗(u) − 2 d∗(u) 1 3 (d∗(u) (cid:62) 3) and the proof is complete. Theorem 2.5. Algorithm naive-fvs can be implemented in O(16k · n2) time to decide whether a graph G has a feedback vertex set of size at most k. Proof. If the input graph G has a feedback vertex set of size at most k, then there must be an execution path that returns a solution, and by Lemma 2.4, the length of this path is at most 4k. Otherwise, all execution paths return "NO," disregard of their lengths. Therefore, we can terminate every execution path after it has put 3k vertices into F by returning "NO" directly. The new search tree would then have depth at most 4k. Clearly, the processing in each node can be done in O(n2) time. This gives the running time O(24k+1 · n2) = O(16k · n2). 3 An improved running time It is long (but not well) known that if the maximum degree of a graph is at most three, then a minimum feedback vertex set can be found in polynomial time [13, 21]. This can be extended to the setting that the degree bound holds only for the undecided vertices i.e., vertices in V(G) \ F. 5 Lemma 3.1 ([5]). Given a graph G and a set F of vertices such that every vertex in V(G) \ F has degree at most three, there is a polynomial-time algorithm for finding a minimum set V− ⊆ V(G) \ F such that G − V− is a forest. Therefore, we can change step 4 of algorithm naive-fvs to the following: if d(v) (cid:54) 3 then 4. 4.1. 4.2. call Lemma 3.1 to find a minimum solution X; if X (cid:54) k then return X; else return "NO"; Therefore, d∗(u) (cid:62) 4 for each vertex u ∈ F(cid:48). As a result, in the last inequality in the proof of Lemma 2.4, we can use (d∗(u) − 2)/d∗(u) (cid:62) 2/4 = 1/2, which implies F(cid:48) (cid:54) 2V−. The algorithm would then run in O(8k · nO(1)) time. We conclude this paper by pointing out that the analysis is not tight. The inequalities in the proof of Lemma 2.4 can be tight only when d∗(v) = 4 for all vertices v ∈ V− ∪ F, and more importantly, all the degree decrements incurred by putting a vertex to V− are effective. If such a graph exists,-we may assume without loss of generality that it does not contains any vertex of degree two or less,-then all its vertices have degree four, and all neighbors of a vertex x ∈ V− are in F. But in such a graph there should be a different solution, and note that our algorithm only explore the subtree rooted at the child node made by step 6 only if all the leaves in the other subtree (rooted at the node made by step 5) return "NO." Acknowledgment. The author would like to thank O-joung Kwon and Saket Saurabh for pointing out a mistake in the introduction of the previous version. References [1] Vineet Bafna, Piotr Berman, and Toshihiro Fujito. A 2-approximation algorithm for the undirected feedback vertex set problem. SIAM Journal on Discrete Mathematics, 12(3):289–297, 1999. doi:10.1137/ S0895480196305124. [2] Ann Becker, Reuven Bar-Yehuda, and Dan Geiger. Randomized algorithms for the loop cutset problem. Journal of Artificial Intelligence Research, 12:219–234, 2000. doi:10.1613/jair.638. [3] Bozhena Petrovna Bidyuk. Exploiting Graph Cutsets for Sampling-Based Approximations in Bayesian Networks. PhD thesis, University of California, Irvine, 2006. [4] Leizhen Cai. Fixed-parameter tractability of graph modification problems for hereditary properties. Infor- mation Processing Letters, 58(4):171–176, 1996. doi:10.1016/0020-0190(96)00050-6. [5] Yixin Cao, Jianer Chen, and Yang Liu. On feedback vertex set: New measure and new structures. Algorithmica, 73(1):63–86, 2015. A preliminary version appeared in SWAT 2010. doi:10.1007/ s00453-014-9904-6. [6] Fabi´an A. Chudak, Michel X. Goemans, Dorit S. Hochbaum, and David P. Williamson. A primal-dual interpretation of two 2-approximation algorithms for the feedback vertex set problem in undirected graphs. Operations Research Letters, 22(4-5):111–118, 1998. doi:10.1016/S0167-6377(98)00021-2. [7] Rina Dechter and Judea Pearl. Network-based heuristics for constraint-satisfaction problems. Artificial Intelligence, 34(1):1–38, 1987. doi:10.1016/0004-3702(87)90002-6. [8] Paul Erdos and Lajos P´osa. On the maximal number of disjoint circuits of a graph. Publicationes Mathematicae Debrecen, 9:3–12, 1962. [9] Michael R. Fellows and Michael A. Langston. Nonconstructive tools for proving polynomial-time decidability. Journal of the ACM, 35(3):727–739, 1988. doi:10.1145/44483.44491. 6 [10] Fedor V. Fomin, Daniel Lokshtanov, Neeldhara Misra, and Saket Saurabh. Planar F-deletion: Approximation and optimal FPT algorithms. In Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science, pages 470–479. IEEE Computer Society, 2012. doi:10.1109/FOCS.2012.62. [11] Eugene C. Freuder. A sufficient condition for backtrack-free search. Journal of the ACM, 29(1):24–32, 1982. doi:10.1145/322290.322292. [12] Toshihiro Fujito. A note on approximation of the vertex cover and feedback vertex set problems - unified approach. Information Processing Letters, 59(2):59–63, 1996. doi:10.1016/0020-0190(96)00094-4. [13] Merrick L. Furst, Jonathan L. Gross, and Lyle A. McGeoch. Finding a maximum-genus graph imbedding. Journal of the ACM, 35(3):523–534, 1988. doi:10.1145/44483.44485. [14] Eun Jung Kim, Alexander Langer, Christophe Paul, Felix Reidl, Peter Rossmanith, Ignasi Sau, and Somnath Sikdar. Linear kernels and single-exponential algorithms via protrusion decompositions. ACM Transactions on Algorithms, 12(2):21:1–21:41, 2015. doi:10.1145/2797140. [15] Eun Jung Kim, Christophe Paul, and Geevarghese Philip. A single-exponential FPT algorithm for the K4-MINOR COVER problem. Journal of Computer and System Sciences, 81(1):186–207, 2015. A preliminary version appeared in SWAT 2012. doi:10.1016/j.jcss.2014.05.001. [16] John M. Lewis and Mihalis Yannakakis. The node-deletion problem for hereditary properties is NP-complete. Journal of Computer and System Sciences, 20(2):219–230, 1980. Preliminary versions independently presented in STOC 1978. doi:10.1016/0022-0000(80)90060-4. [17] Kurt Mehlhorn. Data Structures and Algorithms 2: Graph Algorithms and NP-Completeness. EATCS Mono- graphs on Theoretical Computer Science. Springer Verlag, 1984. [18] Judea Pearl. Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference. Morgan Kaufmann Series in Representation and Reasoning. Morgan Kaufmann, 1988. [19] Venkatesh Raman, Saket Saurabh, and C. R. Subramanian. Faster fixed parameter tractable algorithms for undirected feedback vertex set. In Prosenjit Bose and Pat Morin, editors, ISAAC, volume 2518 of LNCS, pages 241–248. Springer, 2002. doi:10.1007/3-540-36136-7_22. [20] St´ephan Thomass´e. A 4k2 kernel for feedback vertex set. ACM Transactions on Algorithms, 6(2):32.1–32.8, 2010. A preliminary version appeared in SODA 2009. doi:10.1145/1721837.1721848. [21] Shuichi Ueno, Yoji Kajitani, and Shin'ya 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. doi:10.1016/0012-365X(88)90226-9. 7
1512.00519
1
1512
2015-11-30T17:29:43
Proposed Approximate Dynamic Programming for Pathfinding under Visible Uncertainty
[ "cs.DS" ]
Continuing our preleminary work \cite{knowles14}, we define the safest-with-sight pathfinding problems and explore its solution using techniques borrowed from measure-theoretic probability theory. We find a simple recursive definition for the probability that an ideal pathfinder will select an edge in a given scenario of an uncertain network where edges have probabilities of failure and vertices provide "vision" of edges via lines-of-sight. We propose an approximate solution based on our theoretical findings that would borrow techniques from approximate dynamic programming.
cs.DS
cs
Proposed Approximate Dynamic Programming for Pathfinding under Visible Uncertainty Bryan A. Knowles and Mustafa Atici August 10, 2018 Abstract Continuing our preleminary work [2], we define the safest-with-sight pathfinding problems and explore its solution using techniques borrowed from measure-theoretic probability theory. We find a simple recursive definition for the probability that an ideal pathfinder will select an edge in a given scenario of an uncertain network where edges have probabilities of failure and vertices provide "vision" of edges via lines-of-sight. We propose an approximate solution based on our theoretical findings that would borrow techniques from approximate dynamic programming. 1 Introduction We introduce a probabilistic-decision variant of the classic pathfinding problem defined on a directed acylic graph [8] where each edge has some probability of "failure" and each vertex has "vision" of a set of edges. That is, once the pathfinder has reached a vertex, it can "know" whether the edges within the sight of that vertex are up or down; the status of these edges are said to not change during the duration of a single "trial." How, then, should the pathfinder behave if it wishes to take the "safest" (most likely to succeed) path taking this "sight" into account? Although this safest-with-sight problem, as we will refer to it throughout, is simple to state, and we have restricted it to directed acyclic graphs, which generally reduce the complexity of problems, we believe that the introduction of vision into the mix makes this problem computationally hard. Naturally, this being a graph-theory-grounded problem, we wish to determine a greedy algorithm [8] to answer the query, "given a current scenario, will an ideal pathfinder's one next move be x?" However, this being a problem steeped in uncertainties, we must also accomplish this task probabilistically, defining a decision function by borrowing techniques from measure-theoretic probability theory [5]. So, to calculate the solution in the general case, where we find that a greedy solution cannot work, we find a dynamic algorithm and propose, to reduce the computational complexities in that unmodified algorithm, to use an approximate dynamic scheme instead [6]. In section 2 we briefly discuss a portion of the literature on the subject, in section 3 we discuss our laying the groundwork for a theoretical solution to this problem, and in section 4 we conclude by stating our goals in implementing an approximate solution for the general case that is exact and polynomial in certain cases of the problem. 2 Previous Work We have been unable to find any publication on the same problem as ours or on a problem that is immediately reducible to safest-with-sight. The key difference between our definition and others is that of vision -- the ability of the pathfinder to select options that will make future options more informed. It is by this distinction that we mean "visible uncertainty." However, the literature does contain works related to components of ours. In a preliminary article [2], we explore several works on undirected, random, and directed-acyclic graphs each with edge-risk probabilities, and others on paths through and relationships between layers of probabilistic networks. 1 Having quickly reached problems with approaching safest-with-sight from a purely graph-theoretical per- spective after releasing our preliminary work in preprint, we looked further into uncertainty and probability theory itself. In a now classic work, Bart Kosko introduces fuzzy logic, now a staple in the machine learning literature, which does away with the binary of true and false in favor of a model based on partial membership within sets [3]. David Pollard writes on measure-theoretic probability theory, which reevaluates how we construct probabilities as not densities, but as measure functions or expected values of inclusion within a set of outcomes [5]. And in a collection of works by Springer, the foundations of applying fuzzy logic and uncertainty is set forth [7]. None of these publications has been more influential on our research more than Pollard's, as it forced us to work axiomatically from set theoretical definitions, making clear the exact influence that vision has on "the math." It is in the following statement, and no more, that vision has its priciple effects: I will never (probability equals zero) decide to take an edge that is both down and in my accumulated line-of-sight. 3 Theoretical Foundations Problem. An instance of the safest-with-sight problem is defined by the tuple (G, β, tsd). First, G = (V, E, W ), where V is a set of vertices, E is a set of edges and ij ∈ E implies an edge exists between i and j such that i < j, and W is a set of lines-of-sight and ijk ∈ W implies vertex i has line-of-sight to edge jk such that i ≤ j. Second, β is a set of parameters where βαij is the probability of event αij , in which edge ij is down or obstructed. Finally, we are given the task tsd, representing the starting vertex s and destination vertex d. Given a possible first step si that the pathfinder could take, assuming the pathfinder behaves ideally for the following properties, decide whether the pathfinder will take that first step: 1. if the pathfinder crosses an edge that is down, it can no longer move and fails the trial immediately 2. the pathfinder can only follow directed, simple paths that start at the starting point and end either at the destination or the first visited point at which the pathfinder knows that all remaining paths end in "dead-ends" 3. the pathfinder will never attempt to cross edges that it knows are down or lead only to dead-ends 4. the pathfinder always selects the path that maximizes its probability of successfully reaching the destination with respects to its current knowledge 5. the pathfinder always knows the layout of the graph, including lines-of-sight 6. the pathfinder only knows the up/down status of edges that are in a line-of-sight of any vertex it has ever visited during the current trial 7. extraneous edges have been removed, so any unobstructed path the pathfinder takes will lead it to the destination 8. the pathfinder stops at each vertex to consider new information from new lines-of-sight, and it may use this information to reroute its current course such that the probability of success remains optimized with respects to the pathfinder's current knowledge 9. depending on the application, a definition of "tie-broken" is given that imposes a total ordering on the edges without respect to probabilities of success; if no definition for tiebreaking can be given, we suggest using the outward indices of edges for tiebreaking so that the pathfinder will select the optimal edge with the highest outward index Theorem 1. The safest-with-sight problem cannot be solved with a greedy algorithm. Proof. The probability of success of a "first edge" is determined, in part, by the probability of future edges and their probabilities of being taken; however, the probabilities of a future edge is likewise determined by the probabilities of first edges, since they determine what set of lines-of-sight may be available once that future edge has been reached. In other words, the behavior of the pathfinder at the first step and future steps are caught in a chicken-and-egg problem. This prevents safest-with-sight from meeting the greedy-choice property, since solutions to problems depend on solutions to subproblems [1]. Therefore, safest-with-sight cannot be greedy. q.e.d. Definition. We define a function Φ that digitizes statements as 1s or 0s. 2 Φ(x) =(1 x is true if xi are independant then ∀iΦ(xi) =Yi 0 Otherwise Φ(xi) (1) (2) Definition. We define P as an underlying a probability measure for solving this problem, choosing notation such that P maps queries encoded as a summed series of terms to the space B of basis B. In- depth measure-theoretic details do not matter in our application, as we will replace all occurrences of P in our problem with either event methods, which correspond with computable functions, or with conditional statements of constant values. First, our outcome space is defined as follows, letting each ω representing a vector or sum of terms where t is a term representing the task of the trial, each a is a term whether some edge was up or down, each d is a term describing whether some edge was taken or not taken by the pathfinder, and each g is a term describing the graph's edges, vertices, and lines-of-sight. Next, P , F, and B are defined as follows. Ω =nω ω = t +X a +X d +X go P : F → B Ω ∈ F if ω ∈ Ω then {ω} ∈ F if A ∈ F then Ω\A ∈ F if A1, A2, · · · ∈ F then \k Ak ∈ F β ∪ {0} ⊆ B if b ∈ B then 1 − b ∈ B And we state the following about P as it is used to encode queries about the pathfinder's behavior: if b1, b2, · · · ∈ B then Yk bk ∈ B P (0) = 1 P (a1 + a2 + . . . ) = P (a1 and a2 and . . . ) P (¯a) = 1 − P (a) P (a + ¯a) = 0 if ai are independant then ∃iP (ai) = 1 −Yi [1 − P (ai)] ∃i [P (ai + ξ1 bi + ξ2)] = PihP (ai +Pi−1 j=1 j=1 ¯aj + bi +Pi−1 Pihbi +Pi−1 ¯bj + ξ2)i j=1 ¯bj + ξ1 + ξ2)i P (a) = βa, ∀a∈ parametric terms P (w + . . . ) = 0, ∀w∈ contradictions 3 (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16) (17) (18) (19) (20) if i < s or j > d then P (tsd + aij + . . . ) = P (tsd + . . . ) ev(a) =Xa′ P (a′ a)P (ev a′) iff a is M.R. on ev then ev(a) = P (ev a) (21) (22) (23) By the term M.R. above, we mean "maximally restrictive." That is, the event method ev, given a, has no change in value for any b disjoint from a in ev(a + b). Therefore, a contains as much information as possible for determining ev's value. Definition. We define the set of terms used to encode events as: tsd, the task term; αij , terms for the event that edge ij is down; sijk, terms for the event that vertex i has vision of edge jk; and δij, terms for the event that the pathfinder chose to travel along edge ij, but not necessarily traveled along it safely. Definition. We complete the definition of P by defining what we mean above by parametricterms and contradictions: • the parametric terms are those for which we are given a β-parameter, such as αij in βαij • if a and b are parametric terms, then P (a b) = P (a) unless b = ¯a, in which case P (a b) = 0 • the contradictions are the minimum set of expression which, for all queries containing one or more of those expressions, the probability must be zero This set of contradictions corresponds to exactly the following, derived directly from the properties of the problem and definition of P : • classic -- appealing to (15), P (a + ¯a) = 0 • restriction -- appealing to property 1, P (δij + δjk + αij ) = 0 • simplicity -- appealing to property 2, P (δij + δik) = 0 and P (tsd + δjkPij • refusal -- appealing to property 3, P (δij + δkm + αkm + sikm) = 0 • dead-ends -- appealing properties P (δij 2 and 3, to ¯δij) = 0 if j 6= s tsd + . . . ) = 0 if j 6= d and ∀jk [P (δjk tsd + . . . ) = 0] • suboptimal -- appealing to property 4, P (δsi tsd+. . . ) = optimal(δsi+tsd+. . . )×tiebroken(δsi+tsd+. . . ) Definition. We define a set of event methods selectsi for all edges si that, on maximally restrictive input, equals 1 only where the pathfinder would select edge si given the current task tsd, knowledge ξ, and lines-of-sight S; otherwise, it equals 0. It is important to note that this event method is simply the functional equivalent of δsi, only given an easier to express name. This definition requires the definitions of event methods optimalsi, tiebrokensi, and successsi, as well as S ′, which corresponds to the lines-of-sight of a subproblem where the vision provided by S has been "copied" to all other vertices and truncated such that no vertex "sees behind itself." selectsi(tsd + S + ξ) = optimalsi(tsd + S + ξ) × tiebrokensi(tsd + S + ξ) where optimalsi(tsd + S + ξ) = ∀sj Φ [successsi(tsd + S + ξ) ≥ successsj(tsd + S + ξ)] and successsd(tsd + S + ξ) = P (¯αsd δsd + tsd + S + ξ) and successsi(tsd + S + ξ) = P (¯αsi δsi + tsd + S + ξ) ×Xξ′ (cid:20)P (ξ′ ξ) × max ik successik(tid + S ′ + ξ′)(cid:21) Lemma 1. If successsi is correctly the probability that the pathfinder will reach the destination (given only what it could know at s and assuming it has decided to traverse si) then selectsi correctly determines whether the pathfinder will choose to traverse si. Proof. Appealing to properties 3 and 9, the pathfinder will select an edge iff it is optimal and tiebroken. Obviously too, an edge is optimal iff there exists no other available edge that, according to the pathfinder's current knowledge, has a higher probability of success. 4 We've defined optimalsi as a digitization of this notion, so when the input is maximally restrictive, this event method maps to {0, 1}. If we assume the input of selectsi is maximally restrictive on both selectsi and optimalsi, then, since the same input is passed to both, selectsi will also map to {0, 1}, being itself the product of two such mappings. We may assume that the initial input, given by the problem, is maximally restrictive in this way, since it corresponds to precisely the knowledge held by the pathfinder while at s, the start of the trial. Because no other input is given to selectsi, these assumptions about maximally restrictive input hold for selectsi and optimalsi always. That is, there is no need to worry about weighted sums, as defined in (21) and (22). Therefore, if successsi is correct, then optimalsi will yield the proper value and, in turn, selectsi as well. q.e.d. Lemma 2. Assuming the pathfinder has decided to traverse edge si, its probability of success (according only to the pathfinder's knowledge) is the probability it successfully crosses si and it succeeds from some subproblem where its starting point is instead i and lines-of-sight everywhere have been modifed to include the lines-of-sight provided by s in the original problem. Proof. When the pathfinder is traversing an edge, it can fail immediately. In the event that it does not, it, appealing to property 8, stops to consider new information. If s provided no lines-of-sight that were not provided by i, then its probability of success after crossing si is no different than its overall probability if it were to begin from i in the first place. If s did provide lines-of-sight useful after i that were not provided by i originally, because, appealing to property 6, the state of the network does not change during a single trial and the pathfinder does not forget information, we can model its "remembering" by copying the vision provided by s to all vertices ahead of it, adding no information to the subproblem that would not have already been known anyway. Therefore, by appealing to the properties of the problem, we can derive this lemma directly. q.e.d. Theorem 2. successsi is correct as required by lemma 1. Proof. First, consider what maximally restritive input to successsi might look like: the maximum information that the pathfinder could have that could change the probability of its success, according only to the knowledge that it could have obtained via lines-of-sight, is where ξ contains αij or ¯αij terms for all edges ij referenced in S. This is precisely the sort of input assumed in lemma 1 to be passed to successsi by optimalsi. Next, appealing to lemma 2 and (21), we write successsi as the following: successsi(tsd + S + ξ) =Xξ′ Xξ′ Xik [P (ξ′ ξ) × P (¯αsi δsi + tsd + S + ξ′)] × (24) [P (ξ′ ξ) × selectik(tid + S ′ + ξ′) × successik(tid + S ′ + ξ′)] (25) Consider how the probability that an edge is up is only affected by whether the edge is already known to be up/down (referenced in S and α or ¯α is in ξ). Hence, the only properties of the problem that have an effect on P (¯αsi . . . ) are (15) and the refusal contradiction; these require only terms that would already be in a maximally restrictive input to successsi. Therefore, for that the first weighted sum we can appeal to (23), at least only when the input to successsi is given to be maximally restrictive. successsi is only ever given maximally restrictive input in our definitions, since optimalsi passes it input that is optimally restrictive and when successsi invokes successik, it does so only under a weighted sum iterating over all maximally restrictive inputs to the subproblem that contain ξ. Therefore, we can appeal to (23) for all cases covered by our definitions and rewrite the first weighted sum as just P (¯αsi . . . ). For the second weighted sum, note that ξ is not guaranteed to be maximally restrictive for the subproblem, since S ′ might reference an edge km such that neither αkm nor ¯αkm are in ξ; therefore, the iteration over ξ′ must be performed and cannot be simplified away as in the first weighted sum. However, consider how the inner sum operates: because selectsi maps to {0, 1}, and to 1 only where optimal and tiebroken, we can write this inner sum simpler as the maximum subproblem, where the notion of maximizing is with respects to both optimalik and tiebrokenik. Taking all of these simplifications into account, we produce exactly the recursive definition of successsi from above. With this in place, the base case definition is trivial to show: once the pathfinder has decided to 5 traverse some final edge leading directly from s into d, its probability of success is simply that of whether or not it successfully that edge -- there is no "succeeds later" to worry about. Therefore, the recursive definition is just P (¯αsi . . . ), what remains after simplifying the first weighted sum and removing the (in the base case) unnecessary second weighted sum. Finally, since the first invocation of successsi is given the proper inputs, it is correct under lemma 2, it passes the correct inputs to future invocations, and the base case is also correct under lemma 2, successsi must be correct in determing the probability of success as required by lemma 1. q.e.d. 4 Conclusions and Future Work The solution we have defined to the safest-with-sight problem, a decision problem based on successsi, is not computationally efficient. When each path through to a certain node would produce a different set of known edges, via accumulated lines-of-sight, then an exact algorithm would need to calculate each of those paths, a PCOUNT-time solution. In cases where the set of known edges at a node is always the same, then solutions to recursive cases of successsi could be cached using dynamic programming techniques and the runtime reduced to O(E), since each edge would only need to be visited once by the algorithm, as in the following two examples: • no lines-of-sight exist, so vision is always empty • lines-of-sight are only of immediate neighbors, so vision cannot accumulate With the cache-based improvement in mind, we propose an approximate solution to the general case of safest-with-sight, where solutions to recursive cases of score are cached and, when a similar-enough case has already been cached for the same edge, that cached solution would be used in hopes that the scores will not differ greatly. This approach will have to be done with care to find a balance between space required to cache results and time required to produce accurate solutions [6]. 5 Special Thanks Special thanks to IPython/Jupyter [4] for providing a free and open source platform used extensively when developing this work. References [1] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Ronald Rivest. Introduction To Algo- rithms. Mcgraw-Hill College, 1990. [2] B. Knowles and M. Atici. Fault-Tolerant, but Paradoxical Path-Finding in Physical and Conceptual Systems. ArXiv e-prints, June 2014. [3] Bart Kosko. Fuzzy Thinking. Hyperion, 1993. [4] Fernando P´erez and Brian E. Granger. IPython: a system for interactive scientific computing. Computing in Science and Engineering, 9(3):21 -- 29, May 2007. [5] David Pollard. A User's Guide to Measure Theoretic Probability (Cambridge Series in Statistical and Probabilistic Mathematics). Cambridge University Press, 2001. [6] Warren B. Powell. Approximate Dynamic Programming: Solving the Curses of Dimensionality, 2nd Edition (Wiley Series in Probability and Statistics). Wiley, 2011. [7] Springer. Foundations of Reasoning under Uncertainty (Studies in Fuzziness and Soft Computing). Springer, 2010. [8] Robin J. Wilson. Applications of Graph Theory. Academic Press, 1980. 6
1510.02694
2
1510
2015-10-16T14:54:30
An Improved Combinatorial Polynomial Algorithm for the Linear Arrow-Debreu Market
[ "cs.DS", "cs.GT" ]
We present an improved combinatorial algorithm for the computation of equilibrium prices in the linear Arrow-Debreu model. For a market with $n$ agents and integral utilities bounded by $U$, the algorithm runs in $O(n^7 \log^3 (nU))$ time. This improves upon the previously best algorithm of Ye by a factor of $\tOmega(n)$. The algorithm refines the algorithm described by Duan and Mehlhorn and improves it by a factor of $\tOmega(n^3)$. The improvement comes from a better understanding of the iterative price adjustment process, the improved balanced flow computation for nondegenerate instances, and a novel perturbation technique for achieving nondegeneracy.
cs.DS
cs
An Improved Combinatorial Polynomial Algorithm for the Linear Arrow-Debreu Market Ran Duan∗ Jugal Garg† Kurt Mehlhorn‡ 5 1 0 2 t c O 6 1 ] S D . s c [ 2 v 4 9 6 2 0 . 0 1 5 1 : v i X r a Abstract We present an improved combinatorial algorithm for the computation of equilibrium prices in the linear Arrow- Debreu model. For a market with n agents and in- tegral utilities bounded by U , the algorithm runs in O(n7 log3(nU )) time. This improves upon the previ- ously best algorithm of Ye by a factor of (cid:101)Ω(n). The Mehlhorn and improves it by a factor of(cid:101)Ω(n3). The im- algorithm refines the algorithm described by Duan and provement comes from a better understanding of the it- erative price adjustment process, the improved balanced flow computation for nondegenerate instances, and a novel perturbation technique for achieving nondegener- acy. 1 Introduction Walras [16] introduced an economic market model in 1874. In this model, every agent has an initial endow- ment of some goods and a utility function over sets of goods. Goods are assumed to be divisible. The market clears at a set of prices if each agent can spend its en- tire budget (= the total value of its goods at the set of prices) on a bundle of goods with maximum utility, and all goods are completely sold. Market clearing prices are also called equilibrium prices. In the linear version of the model, all utility functions are linear. We present an improved combinatorial algorithm for the computation of equilibrium prices. For a mar- ket with n agents and integral utilities bounded by U , the algorithm runs in O(n7 log3(nU )) time. This is al- most by a factor of n better than all known algorithms. Jain [12] and Ye [17] gave algorithms based on the el- lipsoid and the interior point method, respectively, and Duan and Mehlhorn [6] described a combinatorial algo- rithm. The new algorithm refines the latter algorithm and improves upon its running time by a factor of al- most n3. Formally, the linear model is defined as follows. We University, Beijing, China ∗Institute for Interdisciplinary Information Sciences, Tsinghua †Max-Planck-Institut fur Informatik, Saarbrucken, Germany ‡Max-Planck-Institut fur Informatik, Saarbrucken, Germany may assume w.l.o.g. that the number of goods is equal to the number of agents and that the i-th agent owns the i- th good. There is one unit of each good. Let uij ≥ 0 be the utility for agent i if all of good j is allocated to him. We assume that the utilities are integers bounded by U . We make the standard assumption that each agent likes some good, i.e., for all i, maxj uij > 0, and that each good is liked by some agent, i.e., for all j, maxi uij > 0. We also make the nonstandard assumption that for every proper subset P of agents, there exist i ∈ P and j /∈ P such that uij > 0. References [12, 4, 6] show how to remove it. Agents are rational and spend money only on goods that give them maximum utility per unit of money, i.e., if p = (p1, . . . , pn) is a price vector then buyer i is only willing to buy goods j with uij/pj = max(cid:96) ui(cid:96)/p(cid:96). An equilibrium is a vector p of positive prices and allocations xij ≥ 0 such that • all goods are completely sold: (cid:80) i xij = 1 for all j. pi =(cid:80) • all money is spent: • only goods that give maximum utility per unit of j xijpj for all i. money are bought: for all i and j: xij > 0 ⇒ uij pj = αi, where αi = max(cid:96) ui(cid:96) p(cid:96) . In an equilibrium, fij = xijpj is the amount of money that flows from agent i to agent j. In this paper, it is useful to represent each agent i twice, once in its role as a buyer and once in its role as (the owner of) a good. We denote the set of buyers by B = {b1, b2, ..., bn} and the set of goods by C = {c1, c2, ..., cn}. So, if the price of good ci is pi, buyer bi will have pi amount of money. The existence of an equilibrium is nonobvious. The first rigorous existence proof is due to Wald [15]. It required fairly strong assumptions. The existence proof for the general model was given by Arrow and Debreu [1] in 1954. They proved that the market equilibrium always exists if the utility functions are concave. The proof is nonconstructive. Gale [9, 10] gave necessary and sufficient conditions for the existence of an equilibrium in the linear model. The development of algorithms started in the 60s. We restrict the discussion to exact algorithms and refer the reader to [6] for a broader discussion of algorithms and related work. Eaves [7] presented the first exact algorithm for the linear exchange model. He reduced the model to a linear complementary problem which is then solved by Lemke’s algorithm. The algorithm is not polynomial time. Garg, Mehta, Sohoni, and Vazi- rani [11] give a combinatorial interpretation of the algo- rithm. Polynomial time exact algorithms were obtained based on the characterization of equilibria as the solu- tion set of a convex program. The recent paper by Deva- nur, Garg, and V´egh [4] surveys these characterizations. Jain [12] showed how to solve one of these characteriza- tions with a nontrivial extension of the ellipsoid method. His algorithm is the first polynomial time algorithm for the linear Arrow-Debreu market. Ye [17] showed that polynomial time can also be achieved with the interior point method. We quote from his paper: “We present an interior-point algorithm . . . for solving the Arrow- Debreu pure exchange market equilibrium problem with linear utility. . . . The number of arithmetic operations of the algorithm is . . . bounded by O(n4 log 1/), which is substantially lower than the one obtained by the ellip- soid method. If the input data are rational, then an ex- act solution can be obtained by solving the identified sys- tem of linear equations and inequalities, when  < 2−L, where L is the bit length of the input data. Thus, the arithmetic operation bound becomes O(n4L), . . . .” We assume that utilities are integers bounded by U . Then L = n2 log U , and the number of arithmetic operations becomes O(n6 log U ). Ye does not state the precision needed for the computation. However, since the com- putation must guarantee that the error  becomes less than 2−L, it is fair to assume that arithmetic on num- bers with L bits is necessary. Thus the time complexity on a RAM becomes O(n6(log U ) · M (n2 log U )), where M (L) is the cost of multiplying L-bit numbers. On a RAM with logarithmic word-length, M (L) = O(L) [8] and hence the time bound for Ye’s algorithm1 becomes O(n8(log U )2). The utility graph is a bipartite graph with vertex set B ∪ C, where bi and cj are connected by an edge if and only if uij > 0. Any cycle D in the utility graph has even length and hence the edges of the cycle can be 2-colored such that adjacent edges have distinct colors. We use D0 and D1 to denote the two color classes and call (D0, D1) the 2-partition of D. We call an instance 1Yinyu Ye confirmed in personal communication that this interpretation of his result is correct. degenerate if there is a cycle D with 2-partition (D0, D1) such that (cid:89) (cid:89) (1.1) ue = ue. e∈D0 e∈D1 For a price vector p, the equality graph Gp = (B∪C, Ep) is a directed bipartite graph, where the edge set Ep consists of all edges (bi, cj) such that uij/pj = αi. For nondegenerate instances, the equality graph with respect to any price vector is a forest, see Lemma 2.2. Duan and Mehlhorn [6] gave a combinatorial algo- rithm. They obtain equilibrium prices by a procedure that iteratively adjusts prices and allocations in a care- fully chosen, but intuitive manner. The algorithm runs in O(n5 log(nU )) phases and maintains a balanced flow in a flow network defined by the current price vector. A balanced flow is a maximum flow that minimizes the 2-norm of the surplus vector of the agents. The bal- anced flow needs to be recomputed in each phase and this takes O(n) max-flow computations on a graph with n nodes and up to n2 edges. We refine their algorithm (see Figure 1 for a complete listing) and reduce the run- ning time by almost three orders of magnitude. The improvement comes from three sources. • A refined, but equally simple, method for adjusting prices and a refined analysis. This reduces the number of phases by a factor of n. • An improved computation of balanced flows in nondegenerate networks. We show that only one general max-flow computation in a graph with O(n) edges is needed; the other O(n) maxflow computations are in networks with forest structure. This reduces the number of arithmetic operations per phase by a factor of n2 and improves upon the running time by a factor of n2/ log(nU ). The improvement also applies to the algorithm in [6]. • A novel perturbation scheme that removes degen- eracies without increasing the cost of our algorithm. Orlin [13] previously described a perturbation scheme. We will argue in the appendix that his description is incomplete. The Cole-Gkatzelis algorithm [2] for Nash social welfare makes use of Orlin’s perturbation scheme. Our perturbation scheme is applicable in both algorithms. This paper is organized as follows. We introduce some notation and concepts in Section 2 and describe the algorithm in Section 3. Sections 4 and 5 prove the bound on the number of phases. Section 6 contains the improved algorithm for computing balanced flows for nondegenerate instances and Section 7 introduces the novel perturbation scheme. 2 Preliminaries For a vector v = (v1, . . . , vn), let v = v1 + . . . + vn and (cid:107)v(cid:107) = (v2 n)1/2 be the (cid:96)1 and (cid:96)2-norm of v, respectively. 1 + . . . + v2 Let p = (p1, p2, ..., pn) denote the vector of prices of goods 1 to n, so they are also the budgets of agents 1 to n, if goods are completely sold. Each agent only buys its favorite goods, that is, the goods with the maximum ratio of utility and price. Define the bang per buck of buyer bi to be αi = maxj{uij/pj}. For a price vector p, the equality network Np is a flow network with vertex set {s, t} ∪ B ∪ C, where s is a source node, t is a sink node, B is the set of buyers, and C is the set of goods, and the following edge set: (1) An edge (s, bi) with capacity pi for each bi ∈ B. (2) An edge (ci, t) with capacity pi for each ci ∈ C. (3) An edge (bi, cj) with infinite capacity whenever uij/pj = αi. We use Ep to denote these edges. Our task is to find a positive price vector p such that there is a flow in which all edges from s and to t are saturated, i.e., (s, B ∪ C ∪ t) and (s ∪ B ∪ C, t) are both minimum cuts. When this is satisfied, all goods are sold and all of the money earned by each agent is spent on goods of maximum utility per unit of money. For a set S of buyers define its neighborhood Γ(S) = {c ∈ C (b, c) ∈ Ep for some b ∈ S}. Clearly, there is no edge in Ep from S to C \ Γ(S). buyer i as r(bi) = pi−(cid:80) good j as r(cj) = pj −(cid:80) the total surplus to be r = (cid:80) (cid:80) equal to(cid:80) With respect to a flow f , define the surplus r(bi) of a j fij, where fij is the amount of flow on the edge (bi, cj), and define the surplus r(cj) of a i fij, Define the surplus vector of buyers to be r = (r(b1), r(b2), ..., r(bn)). Also, define i r(bi), which is also j r(cj) since the total capacity from s and to t are both i pi. For convenience, we denote the surplus vector of flow f(cid:48) by r(cid:48). In the network corresponding to market clearing prices, the total surplus of a maximum flow is zero. For a set X of buyers, let rmin(X) = min{r(b) b ∈ X} and rmax(X) = max{r(b) b ∈ X} be the minimal and maximal surplus of any buyer in X. For the empty set of buyers, rmax(∅) = 0. The outflow of buyer bi is outflow (bi) =(cid:80) j fij. A maximum flow is balanced if it minimizes the 2- norm of the surplus vector of the buyers. The concept of a balanced flow was introduced by Devanur et al. [5]. Lemma 2.1. ([5, 6]) Balanced flows exist. They can be computed with n maximum flow computations. If f is a balanced flow, buyers bi and bj have equality edges connecting them to the same good c and there is positive flow from bi to c, then the surplus of bj is no larger than the surplus of bi. Let f0 be a maximum flow and let C0 be the goods that are completely sold with respect to f0. Then there is a balanced flow in which all goods in C0 are completely sold. We next show that for nondegenerate instances the equality graph with respect to any price vector is a forest. Lemma 2.2. Consider any cycle D in the utility graph. If D ⊆ Ep for some price vector p, the set of utilities is degenerate. Proof. Consider any buyer b in the cycle and let e0 = (c0, b) ∈ D0 and e1 = (b, c1) ∈ D1 be the edges in D incident to b. Then ue0/p(c0) = ue1/p(c1), and therefore p(c1) = (ue1 /ue0 )p(c0), and e∈D1 e∈D0 ue = 1. hence(cid:81) ue/(cid:81) Fisher Markets: In Fisher markets, the buyers come with a budget to the market. They do not have to earn their budget by selling their goods. Fisher markets are a special case of Arrow-Debreu markets. Let ai be the budget of the i-th buyer. Consider the Arrow-Debreu market, where the i-th buyer owns ai units of each good. Then in an equilibrium his budget will be ai j pj and hence a solution to the Fisher market can be obtained from the solution to the Arrow- Debreu market by dividing all prices and money flows (cid:80) by P =(cid:80) j pj. 3 The Algorithm The algorithm is shown in Figure 1 and refines the one of Duan and Mehlhorn [6]. It starts with all prices pi equal to one and a balanced flow f in Np. It works in phases (called iterations in [6]). In each phase, we first determine a set S of buyers with surplus and the set Γ(S) of goods connected to them by equality edges. We increase the prices of the goods in Γ(S) and the money flow into these goods by a common factor x > 1. Let p(cid:48) be the new price vector and let f(cid:48) be the resulting flow. We turn f(cid:48) into a balanced flow f(cid:48)(cid:48) and make sure that all goods that are completely sold with respect to f are also completely sold with respect to f(cid:48)(cid:48). We set f to f(cid:48)(cid:48), p to p(cid:48), and repeat. Once the total surplus is less than , where  = 1/(8n4nU 3n), we exit from the loop and compute the equilibrium prices from the current price vector p and the current flow f . The last step is exactly as in [6] and will not be discussed further. We next detail the phases. We first explain the choice of S. It is more refined than in [6] and crucial for the improved bound on the number of phases. For a resource bound r0, let S(r0) = {b ∈ B r(b) ≥ r0} be the set of buyers with surplus at least r0. In our algorithm we choose a particular resource bound r0. Part A: Set  = 1/(8n4nU 3n); Set pi = 1 for all i and set f to a balanced flow in Np; While r(B) ≥ ; Sort the buyers by their surpluses in decreasing order: b1, b2, ..., bn; Find the smallest (cid:96) ≥ 1 for which S = S(r(b(cid:96))) satisfies outflow (bi) = 0 and ci (cid:54)∈ Γ(S) for every bi with r(b(cid:96)) > r(bi) ≥ r(b(cid:96))/(1 + 1/n) and let (cid:96) = n when there is no such (cid:96); Let S = S(r(b(cid:96))); Determine xmax, xeq , x23, x24 and x2 and set x = min(xmax, xeq , x23, x24, x2); Update prices and flow according to (3.2) and (3.3); let f(cid:48) be the new flow and p(cid:48) be the new price vector; Compute a balanced flow f(cid:48)(cid:48) in Np(cid:48) with the property that goods that are completely sold with respect to f are also completely sold with respect to f(cid:48)(cid:48); Set f to f(cid:48)(cid:48) and p to p(cid:48); EndWhile Part B: Compute equilibrium prices from f and p as in [6]; Figure 1: The complete algorithm We order the buyers in decreasing order of surpluses: r(b1) ≥ r(b2) ≥ . . . ≥ r(bn−1) ≥ r(bn). Let (cid:96) ≥ 1 be minimal2 such that outflow (bj) = 0 and cj (cid:54)∈ Γ(S) for every bj with r(b(cid:96)) > r(bj) ≥ r(b(cid:96))/(1 + 1/n), where If no such (cid:96) exists, set (cid:96) = n and S = S(r(b(cid:96))). S = S(r(bn)). Let r0 = r(b(cid:96)). Lemma 3.1. r(b(cid:96)) > 0. Proof. If the loop is entered, r(B) > 0. Let k be maximal with r(bk) > 0. Then either k = n or r(bk+1) = 0 < r(bk)/(1 + 1/n). Thus (cid:96) ≤ k. The index (cid:96) is readily determined. Lemma 3.2. The index (cid:96) can be found in O(n2) time. Proof. We use the straightforward algorithm of scan- ning through the buyers in order of decreasing surplus. Set (cid:96) to 1, Γ to Γ(b1), and enter a loop. Increment (cid:96) as long as (cid:96) < n and r(b(cid:96)+1) = r(b(cid:96)). Whenever (cid:96) is increased, add Γ(b(cid:96)) to Γ. Maintain Γ as a bit-vector. If (cid:96) reaches n return it as the desired value. Otherwise, do the following for j = (cid:96) + 1, (cid:96) + 2, . . . : if j reaches n + 1 or r(bj) < r(b(cid:96))/(1 + 1/n), return (cid:96). If outflow (bj) (cid:54)= 0 or cj ∈ Γ, add Γ({b(cid:96)+1, . . . , bj}) to Γ, set (cid:96) = j, and break from the inner loop. 2[6] uses a simpler definition: let (cid:96) be minimal such that r(b(cid:96)+1) < r(b(cid:96))/(1 + 1/n). For this definition, Lemma 5.2 does not hold. The algorithm runs in time proportional to the number of edges of the utility graph and hence in time O(n2). Lemma 3.3. There are no edges in Ep from S to C \ Γ(S), and the edges from ¯S to Γ(S) are not carrying flow. Proof. The first claim is immediate from the definition of Γ(S). For the second claim, assume otherwise and let bj (cid:54)∈ S and ck ∈ Γ(S) be such that there is positive flow on the edge (bj, ck). Since ck ∈ Γ(S), there must a buyer bi ∈ S with (bi, ck) ∈ Ep. Since the flow is balanced, r(bj) ≥ r(bi) by Lemma 2.1, and hence bj ∈ S. We raise the prices of the goods in Γ(S) and the flow on the edges incident to them by a common factor x > 1. We also increase the flow from s to buyers in S such that flow conservation holds. This give us a new price vector p(cid:48) and a new flow f(cid:48). Except for the modified definition of S, this is exactly as in [6]. Observe that the surpluses of the goods in Γ(S) stay zero. Formally, if cj ∈ Γ(S); if cj /∈ Γ(S). if cj ∈ Γ(S); if cj /∈ Γ(S). x · pj pj x · fij fij (cid:40) (cid:40) p(cid:48) j = f(cid:48) ij = (3.2) (3.3) The changes on the edges incident to s and t are implied by flow conservation. Since there are no edges from S to C \ Γ(S), and the edges from ¯S to Γ(S) are not carrying flow, an equivalent definition of the updated flow is f(cid:48) ij = xfij if bi ∈ S and f(cid:48) ij = fij if bi ∈ ¯S. A type 4 buyer has type 4a, if its surplus is at least rmin(S)/(1 + 1/n). Otherwise, See Figure 2 for an illustration. its type is 4b. Lemma 3.5. r(bi) < rmin(S)/(1 + 1/n) for every type 3 and type 4b buyer bi. For a type 4a buyer bi and an edge (bi, cj) ∈ Ep, cj ∈ Γ(S). Proof. Consider any buyer bi with r(bi) ≥ rmin(S)/(1 + 1/n) and bi (cid:54)∈ S. Then ci (cid:54)∈ Γ(S) and hence bi does not have type 3. So, it must have type 4, and more precisely, type 4, it has type 4a. Let (bi, cj) ∈ Ep. Since outflow (bi) = 0, bi has surplus and hence cj is completely sold. The buyers with flow to cj have surplus at least the surplus of bi and hence have surplus at least rmin(S). Thus they belong to S and hence cj ∈ Γ(S). Lemma 3.6. If there is no type 3 buyer then there is at least one type 1 buyer. Proof. Since S is nonempty and every buyer has at least one incident equality edge, Γ(S) is nonempty. The goods in Γ(S) are completely sold and owned by the type 1 and type 3 buyers. If there are no type 3 buyers, there has to be at least one type 1 buyer. Figure 2: The left vertical segment shows the buyers grouped into the buyers with surplus at least rmin(S), with surplus in (rmin(S), rmin(S)/(1 + 1/n)], and with surplus below rmin(S)/(1 + 1/n). S constitutes the type 1 and 2 buyers. The red part on the right vertical segment indicates Γ(S). The goods in Γ(S) are completely sold to the buyers in S. The type 4a buyers have no outflow and all equality edges incident to them end in Γ(S). The type 3 and 4 buyers have no flow to Γ(S). The change of prices and flows affects the surpluses of the buyers, some go up and some go down. We distinguish between four types of buyers, depending on whether a buyer b belongs to S or not and whether the good owned by b belongs to Γ(S) or not. The effect of the change on the surpluses of the buyers is given by the following theorem. Lemma 3.4. ([6]) Given a maximum flow f in Np, a set S of buyers such that all goods in Γ(S) are completely sold and there is no flow from ¯S to Γ(S), and a sufficiently small parameter x > 1, the flow f(cid:48) defined in (3.3) is a feasible flow in the equality network with respect to the prices in (3.2). The surplus of each good remains unchanged, and the surpluses of the buyers become: x · r(bi) (1 − x)pi + x · r(bi) (x − 1)pi + r(bi) r(bi) if bi ∈ S, ci ∈ Γ(S) (type 1 buyer); if bi ∈ S, ci /∈ Γ(S) (type 2 buyer); if bi /∈ S, ci ∈ Γ(S) (type 3 buyer); if bi /∈ S, ci /∈ Γ(S) (type 4 buyer).  r(cid:48)(bi) = For the definition of the factor x, we perform the following thought experiment. We increase the prices of the goods in Γ(S) and the flow on the edges incident to them continuously by a common factor x until one of four events happens: (1) a new edge enters the equality graph or (2) the surplus of a type 2 buyer and a type 3 or 4b buyer become equal or (3) the surplus of a type 2 buyer becomes zero or (4) x reaches a maximum admissible value3 xmax, where xmax = 1 + 1 Cn3 if there are type 3 buyers 1 + 1 if there are no type 3’s and k type 1 buyers, Ckn3  and C = 48e2. The increase of the prices of the goods in Γ(S) makes the goods in C \ Γ(S) more attractive to the buyers in S and hence an equality edge connecting a buyer in S with a good in C \ Γ(S) may arise. This will happen at x = xeq (S), where · pk uik xeq (S) = min{ uij pj bi ∈ S, (bi, cj) ∈ Ep, ck /∈ Γ(S)}. Proof. See [6]. In contrast to [6], we need to split the set of type 4 buyers further into type 4a buyers and type 4b buyers. 3In [6], xmax is defined as 1 + 1/(Cn3). The refined definition of S allows us to choose a larger value if there are no type 3 buyers. This choice will be crucial for Lemma 5.2. rmin(S)rmin(S)/(1 + 1/n)type 4atype 4type 1type 2type 3no outflowb 2 buyer becomes zero. x23(S) = min{ pi + pj − r(bj) pi + pj − r(bi) bi is type 2 and bj is type 3 buyer}, x24(S) = min{ pi − r(bj) pi − r(bi) bi is type 2 and bj is type 4b buyer}, pi − r(bi) bi is type 2 buyer}. x2(S) = min{ pi Figure 3: The surpluses of various types of buyers as a function of x. x23 and x24 are the smallest values of x at which the surpluses of a type 2 and a type 3 or type 4b surplus becomes equal. x2 is the smallest value of x at which a surplus of a type 2 buyer becomes zero. It may happen that the surplus of a type 3 buyer becomes larger than the surplus of a type 1 buyer for an x < min(x23, x24, x2). This possibility is overlooked in [6] and invalidates some of their arguments. They can be fixed along the lines of this paper. When we increase the prices of the goods in Γ(S) by a common factor x ≤ xeq (S), the equality edges in (S× Γ(S))∪ ( ¯S× (C \ Γ(S))) will remain in the network. In particular, by Lemma 3.3, all flow-carrying edges stay in the network. The surplus of type 1 and 3 buyers increases, the surplus of type 2 buyers decreases, and the surplus of type 4 buyers does not change, see Figure 3. Since the total surplus does not change (recall that the surpluses of the goods are not affected by the price update), the decrease in surplus of the type 2 buyers is equal to the increase in surplus of the type 1 and 3 buyers. In particular, there are type 2 buyers. We define quantities x23(S) and x24(S) at which the surplus of a type 2 and type 3 buyer, respectively type 4b4 buyer, becomes equal, and a quantity x2 at which the surplus of a type 4In [6], type 4 is used. Lemma 3.7. With S as defined in the algorithm and x = min(xmax, xeq (S), x23(S), x24(S), x2(S)), f(cid:48) is a feasible flow in Np(cid:48). Proof. Obvious. This ends the description of the algorithm. An important property of the algorithm is that goods with nonzero surplus have price one. Lemma 3.8. Once the surplus of a good becomes zero, it stays zero. As long as a good has nonzero surplus, its price stays at one. Proof. Initially all goods have price one. The price adjustment does not change the surplus of any good and only increases the prices of goods that are completely In the balanced flow f(cid:48)(cid:48), all goods that are sold. completely sold with respect to f are also completely sold with respect to f(cid:48)(cid:48). 4 The Analysis In this section, we derive a bound on the number of phases. We distinguish between xmax-phases and balancing phases. A phase is an xmax-phase if x = xmax and is balancing otherwise. As in [6], we use two potential functions for the analysis, namely the product i pi of all prices and the 2-norm (cid:107)r(B)(cid:107) of the P = (cid:81) surplus vector of the buyers. In Section 4.1, we show that the number of xmax- phases is O(n4 log(nU )), and in Section 5.3, we show the same bound for the number of balancing phases. This is by a factor of n better than in [6]. The improvement for the number of phases comes from the more careful definition of the set S, the distinction between phases with and without type 3 buyers, the refined definition of xmax in phases without type 3 buyers and a refined analysis of the number of such phases (Lemma 4.3), a new analysis of the number of xmax-phases with type 3 buyers (Lemma 4.4), a refined analysis of the norm increase in xmax-phases, and an improved analysis of the norm decrease in balancing phases. rmin(S)rmin(S)/(1 + 1/n)type 4atype 4btype 1type 2type 3xx = 1 4.1 The Number of xmax-Phases. We first recall a result from [6] that prices stay bounded by (nU )n. This immediately yields a bound of (nU )n2 on the product of the x-factors used in all phases and also on the number of xmax-phases with no type 3 buyers. A different argument yields a bound on the number of xmax-phases with type 3 buyers. The latter is even strongly polynomial. prices Lemma 4.1. ([6]) All max(n, U )n−1 ≤ (nU )n. Proof. The upper bound is stated as (nU )n−1 in [6]. The proof actually shows the bound max(n, U )n−1. bounded stay by Lemma 4.2. For a phase h, let xh > 1 be the factor by which the prices in Γ(S) are increased. Then h (cid:89)  xh ≤ (nU )n2 . (cid:89)  xh pj is increased in phase h (nU )n ≤ (nU )n2 . Proof. (cid:89) h xh ≤(cid:89) ≤(cid:89) j j The next two Lemmas have no equivalent in [6]. Lemma 4.3. The number of xmax-phases with no type 3 buyers is O(n4 log(nU )). Proof. Let T be the number of such phases. Consider any such phase and assume that there are k type 1 buyers. Then the prices of exactly k goods are increased i pi grows by a factor xmax = 1+1/(Ckn2). Thus P =(cid:81) by a factor of 1 (1 + Ckn2 )k = exp(k ln(1 + 1 Ckn2 )) 2Ckn2 ) = exp( 1 1 2Cn2 ). ≥ exp(k Since ln P is bounded by n2 log(nU ), we have T · 1/(2Cn2) ≤ n2 log(nU ) and hence T ≤ 2Cn4 log(nU ). Lemma 4.4. The number of xmax-phases with type 3 buyers is O(n4 ln n). Proof. For i ≤ 3, let Bi be the set of type i buyers. We first show that the total budget of the type 3 buyers is at most the total budget of the type 2 buyers, more precisely,(cid:88) i∈B3 pi ≤ (cid:88) i∈B2 (cid:88) i∈B3 (cid:88) i∈B1∪B2 pi = pi + r(bi). The goods owned by the type 1 and type 3 buyers are completely bought by the buyers of type 1 and type 2. Hence i∈B1∪B3 i∈B1∪B3 (cid:88) (cid:88) (cid:88) (cid:88) i∈B1∪B2 pi = = inflow (ci) outflow (bi) (pi − r(bi)). = i∈B1 i∈B1∪B2 Subtracting (cid:80) We next show that (cid:80) pi from both sides establishes the equality in the claim. The inequality follows since surpluses are nonnegative. pi ≤ 2Cn4, whenever x ≥ 1 + 1/(Cn3). The outflow of any type 2 buyer bi is pi − r(bi) at the beginning of the phase. It increases by (pi − r(bi))/(Cn3) during the price update. The increase cannot be more than the surplus and hence (pi − r(bi))/(Cn3) ≤ r(bi) or pi ≤ (1 + Cn3)r(bi). Summing over all type 2 buyers and observing that the total surplus is at most n initially and never increases i∈B2 yields(cid:88) i∈B2 (cid:88) i∈B2 pi ≤ (1 + Cn3) r(bi) ≤ n + Cn4 ≤ 2Cn4. We finally show that the number of xmax-phases with type 3 buyers is at most n + (Cn4 + n) ln(2Cn4). Assume otherwise. Then there must be a buyer bi such that there are at least 1 + (Cn3 + 1) ln(2Cn4) phases in which bi is a type 3 buyer and x = 1 + 1/(Cn3). In each such phase the price of bi increases by a factor of 1 + 1/(Cn3) and hence the price of pi before the last such phase is at least (1 + 1/(Cn3))(Cn3+1) ln(2Cn4) > eln(2Cn4) = 2Cn4. We conclude that the total budget of the buyers in B3 and hence, by the first claim, the total budget of the buyers in B2 exceeds 2Cn4. This contradicts the second claim. 5 The Evolution of the Surplus Vector The 2-norm of the surplus vector of the buyers is our second potential function. In the price and flow adjustment, the surpluses of type 2 and type 3 buyers move towards each other. Lemma 5.1 is our main tool for estimating the resulting reduction of the 2-norm of the surplus vector. Lemmas 5.3 and 5.4 show that the 2- norm of the surplus vector increases by at most a factor 1 + O(1/n3) in xmax-phases. Lemma 5.5 shows that a balancing phase reduces the 2-norm by a factor of 1 − Ω(1/n3). Putting everything together, we obtain the O(n4 log(nU )) bound on the number of balancing phases. 5.1 A Technical Lemma. We start with a technical lemma. Lemma 5.1. Let r = (r1, . . . , rn) and (r(cid:48) 1, . . . , r(cid:48) nonnegative vectors. Let k ∈ [1, n] be such that r(cid:48) for i ≤ k < j. Suppose that δi = ri − r(cid:48) for i ≤ k and δj = r(cid:48) D = mini≤k ri − maxj>k rj, and let ∆ = (cid:80) ∆ ≥(cid:80) n) be i ≥ r(cid:48) i ≥ 0 j j − rj ≥ 0 for j > k. Let i≤k δi. If j>k δj, (cid:107)r(cid:48)(cid:107)2 ≤ (cid:107)r(cid:107)2 − D∆. Proof. Let m = maxj>k rj and m(cid:48) = maxj>k r(cid:48) ri ≥ m + D and r(cid:48) i ≥ m(cid:48) for all i ≤ k. Therefore, j. Then (cid:107)r(cid:107)2 − (cid:107)r(cid:48)(cid:107)2 i≤k (cid:88) (cid:88) (cid:88) (cid:88) i≤k i≤k i≤k j>k (cid:1) (cid:88) (cid:0)r2 i − (ri − δi)2(cid:1) + (cid:0)r2 j − (rj + δj)2(cid:1) (cid:88) (cid:1) + (cid:0)2riδi − δ2 (cid:0)−2rjδj − δ2 δi (ri + ri − δi) −(cid:88) i) −(cid:88) (cid:88) δj(rj + r(cid:48) j) δj (rj + rj + δj) δi(ri + r(cid:48) (cid:88) j>k j>k j>k i j = = = = ≥ (m + D + m(cid:48)) δi − (m + m(cid:48)) i≤k δj j>k ≥ D∆. Figure 4: The good owned by a buyer is shown at the same height as the buyer. The edges shown are equality edges. The two topmost buyers have type 1. Their budgets are 10 and their surplus is five. Both of them spend 5 units on the good owned by the topmost buyer. The third buyer from the top has a budget of 15 and a surplus of 5. It spends 10 units on the good owned by the second buyer. Then we have a chain of arbitrary length of buyers with budget and surplus equal to 5/(1 + 1/n)i, i ≥ 1. According to our definition of S, S consists of the three topmost buyers. According to the definition used in [6], the entire chain of nodes would also belong to S. xmax-Phases. In xmax-phases, the 2-norm of the 5.2 surplus vector of the buyers grows. We again distinguish xmax-phases with and without type 3 buyers and show that for both kind of phases the 2-norm grows by at most a factor of (1 + O(1/n3)). The argument for xmax- phases with type 3 buyers was essentially already given in [6]. The argument for xmax-phases without type 3 buyers is new. For both arguments we need a bound on the maximum ratio of surpluses of buyers in S. In [6] is was shown that rmax(B) ≤ e·rmin(S) for their definition of S. For our definition of S, we have in addition that rmax(B) ≤ (1 + 4k/n)rmin(S) in the case that there are k type 1 buyers and no type 3 buyers. The latter inequality does not hold for the definition of S as used in [6] as Figure 4 shows; it is crucial for the improved bound on the number of phases. Lemma 5.2. The maximum surplus of a buyer is the maximum surplus of a buyer in S, i.e., rmax(B) = rmax(S). Let k = Γ(S). Then rmax(S) ≤ min(e, (1 + 4k/n))rmin(S). The squared norm of the surplus vector of the buyers is bounded by ne2rmin(S)2. If there are no type 3 buyers, k is equal to the number of type 1 buyers. The maximum surplus of any buyer or good is at most n. Proof. By definition, S contains the buyer of largest surplus. Let S(cid:48) = {bi ∈ S outflow (bi) > 0 or ci ∈ Γ(S)} be the subset of buyers in S whose surplus changes by the price and flow adjustment. Let r1 > r2 > . . . > rh be the different surplus values of the buyers in S(cid:48). Any two buyers in S(cid:48) that have positive flow to the same good have the same surplus value. Thus there are at most k distinct surplus values of buyers in S(cid:48) with positive outflow. Every buyer bi in S(cid:48) either has positive outflow or ci ∈ Γ(S). There are at most k buyers of the latter kind. Thus h ≤ 2k. Also, h ≤ n. Recall that b1 is a buyer of highest surplus. We claim b1 ∈ S(cid:48) and hence r1 = rmax(S). Indeed, if b1 (cid:54)∈ S(cid:48) then outflow (b1) = 0. Let (b1, c) be an equality edge incident to c. Then c is completely sold and the flow into c comes from buyers with surplus at least the surplus of b1. These buyers have outflow and hence belong to S(cid:48). Thus r1 = rmax(S). Let b be a buyer in S(cid:48) whose surplus is larger than rmin(S). Since S(r(b)) did not qualify for S, there must be a buyer b(cid:48) such that that r(b)/(1+1/n) ≤ r(b(cid:48)) < r(b) and either outflow (b(cid:48)) > 0 or c(cid:48) ∈ Γ(S(r(b)). In either case, we conclude rmin(S) ≤ r(b(cid:48)) and hence b(cid:48) ∈ S(cid:48). The argument also shows that rmin(S) = rh. Thus price1010155/(1 + 1/n)5/(1 + 1/n)2surplus5555/(1 + 1/n)5/(1 + 1/n)2 rj+1 ≥ rj/(1 + 1/n) for j < h and hence rmax(S) rmin(S) ≤ (1 + 1/n)min(2k,n) ≤ emin(2k,n))/n ≤ min(e, 1 + 4k/n), where the last inequality follows from ex ≤ 1 + 2x for 0 ≤ x ≤ 1. By the two preceding arguments, rmax(B) ≤ e · rmin(S). Thus the squared 2-norm of the surplus vector is at most ne2rmin(S)2. If there are no type 3 buyers, Γ(S) is equal to the number of type 1 buyers. The initial surplus of the buyers is n and the total surplus never increases. Thus, no buyer can ever have a surplus of more than n. We turn to xmax-phases with type 3 buyers. Lemma 5.3. In a xmax-phase with type 3 buyers, the 2-norm of the surplus vector of the buyers increases by at most a factor 1 + O(1/n3). The total multiplicative increase of the 2-norm of the surplus vector of the buyers over all xmax-phases with type 3 buyers is nO(n). Proof. Consider the price and flow adjustments in an xmax-phase with type 3 buyers, and let r(cid:48) be the surplus vector with respect to the flow f(cid:48). The surpluses of the type 1 buyers are multiplied by the factor 1 + 1/(Cn3), the surpluses of the type 2 buyers go down, the surpluses of the type 3 buyers go up, and the surpluses of the type 4 buyers do not change. Also, the surpluses of the type 2 buyers do not fall below the surpluses of the type 3 buyers. The total decrease of the surpluses of the type 2 buyers is equal to the total increase of the surpluses of type 1 and type 3 buyers and hence is at least the total increase of the surpluses of the type 3 buyers. We split the surplus vector into three parts: the surpluses r1 corresponding to type 1 buyers, the sur- pluses r2,3 corresponding to the type 2 and 3 buyers, and the surpluses r4 corresponding to type 4 buyers. The norm of the first subvector is multiplied by x, the norm of the third subvector does not change, and we can bound the change in the norm of the second subvector by Lemma 5.1. In particular, the norm of the second subvector does not increase. Thus (cid:107)r(cid:48)(cid:107)2 − (cid:107)r(cid:107)2 = ((cid:107)r(cid:48) 23(cid:107)2 − (cid:107)r23(cid:107)2) 1(cid:107)2 − (cid:107)r1(cid:107)2) + ((cid:107)r(cid:48) 4(cid:107)2 − (cid:107)r4(cid:107)2) + ((cid:107)r(cid:48) ≤ ((1 + 1/(Cn3))2 − 1) · (cid:107)r1(cid:107)2 ≤ 3/(Cn3) · (cid:107)r(cid:107)2, and hence (cid:107)r(cid:48)(cid:107) ≤(cid:112)1 + 3/(Cn3)(cid:107)r(cid:107) ≤ (1 + 3/(Cn3))(cid:107)r(cid:107). The 2-norm of the surplus vector with respect to f(cid:48)(cid:48) is at most (cid:107)r(cid:48)(cid:107). The number of xmax-phases with type 3 buyers is O(n4 ln n). Hence the total multiplicative increase in xmax-phases with type 3 buyers is at most (1 + 3 Cn3 )O(n4 ln n) ≤ eO(n ln n) = nO(n). We next turn to xmax-phases without type 3 buyers. Lemma 5.4. Consider an xmax-phase with no type 3 buyer. Then (cid:107)r(cid:48)(cid:107) ≤ (1 + O(1/n3))(cid:107)r(cid:107). The total multiplicative increase of the norm of surplus vector in xmax-phases with no type 3 buyers is (nU )O(n). Proof. Let k be the number of type 1 buyers and let R = rmin(S) be the minimum surplus of any buyer in S. By Lemma 5.2, the surplus of any buyer is at most (1 + 4k/n)R. Also, xmax = 1 + 1/(Ckn2). The increase of the surpluses of the type 1 buyers is equal to the decrease of the surpluses of the type 2 buyers. Let δi be the change of surplus of buyer i, i ∈ S, and let ∆ be the total increase in surplus of the type 1 buyers. Let B1 and B2 be the type 1 and 2 buyers. Then (cid:107)r(cid:48)(cid:107)2 − (cid:107)r(cid:107)2 = (ri − δi)2 − r2 (ri + δi)2 − r2 (cid:88) (cid:88) i + i i∈B1 i∈B2 ≤ 2∆((1 + 4k/n)R − R) + 2∆2. 1 Next observe that ∆ ≤ (xmax − 1)k(1 + 4k/n)R ≤ Ckn2 · k · 5 · R ≤ 5R/(Cn2). Thus (cid:107)r(cid:48)(cid:107)2−(cid:107)r(cid:107)2 ≤ O( n3 )(cid:107)r(cid:107)2, since (cid:107)r(cid:107)2 ≥ kR2. Thus (cid:107)r(cid:48)(cid:107) ≤ (cid:112)1 + O(1/n3)(cid:107)r(cid:107) = kR2 n3 ) = O( R2 n4 ) = O( kR n R n2 + 1 (1 + O(1/n3))(cid:107)r(cid:107). The number of xmax-phases with no type 3 buyers is O(n4 log(nU )). Hence the multiplicative increase is bounded by (1 + O( 1 n3 ))n4 log(nU ) = exp(O(n log(nU ))) = (nU )O(n). 5.3 Balancing Phases. In a balancing phase, x < xmax. Our goal is to show that balancing phases reduce the norm of the surplus vector of the buyers by a factor 1 − Ω(1/n3). Lemma 5.5. Let r(cid:48)(cid:48) be the surplus vector with respect to f(cid:48)(cid:48). In balancing phases, (cid:107)r(cid:48)(cid:48)(cid:107) ≤ (1 − Ω( 1 n3 ))(cid:107)r(cid:107). Proof. In a balancing phase, we first increase the prices of the goods in Γ(S) and the flows into these goods by a common factor x = min(xeq , x23, x24, x2) to obtain a flow f(cid:48) and then construct a balanced flow f(cid:48)(cid:48) in the network Np(cid:48). The 2-norm of f(cid:48)(cid:48) is certainly no larger than the 2-norm of f(cid:48). We have rmin(S)/(1 + 1/n) ≥ rmax(B3 ∪ B4b) (equivalently rmin(S) − rmax(B3 ∪ B4b) ≥ rmin(S)/(n + 1)) at the beginning of the phase. The price and flow update affects this gap. We distinguish cases according to whether f(cid:48) closes half of the gap or not. We introduce R = rmin(S) as a shorthand. Case One, min(S) − r(cid:48) r(cid:48) max(B3 ∪ B4b) < rmin(S)/(2(n + 1)): This case occurs when x = x23 or x = x24 or x = x2. It can also occur, when x = xeq . Re- call, that the total decrease of the surpluses of the type 2 buyers is equal to the total increase of the surpluses of the type 1 and type 3 buyers, that surpluses of type 1 and type 3 buyers do not decrease and that surpluses of type 2 buyers do not increase. Thus, it must be the case that the total decrease of the surpluses of the type 2 buyers plus the total increase of the surpluses of the type 3 buyers is at least rmin(S)/(2(n + 1)). We split the surplus vector into three parts: the surplus vector r1 corresponding to type 1 buyers, the surplus vector r2,3 corresponding to the type 2 and 3 buyers, and the surplus vector r4 corresponding to type 4 buyers. The 2-norm of the third subvector does not change. The 2-norm of the first subvector increases. If there are type 3 buyers, x ≤ 1 + 1/(Cn3) and hence Cn3 )2 − 1) · n(eR)2 ≤ 3e2R2 Cn2 . If there are no type 3 buyers and k type 1 buyers, x ≤ 1 + 1/(Ckn2) and hence (cid:107)r(cid:48) 1(cid:107)2 − (cid:107)r1(cid:107)2 ≤ ((1 + 1 1 (cid:107)r(cid:48) 1(cid:107)2 − (cid:107)r1(cid:107)2 ≤ ((1 + Ckn2 )2 − 1) · k(eR)2 ≤ 3e2R2 Cn2 . We next bound the change in the norm of the second subvector by Lemma 5.1. Let D = rmin(B2)− rmax(B3) be the minimum distance between a type 2 and a type 3 surplus, and let ∆ be the total decrease of the surpluses of the type 2 buyers. Then D ≥ R/(n + 1) and ∆ ≥ R/(4(n + 1)). Thus the squared 2-norm of the the vector r23 decreases by at least R2/(4(n + 1)2). Thus 1(cid:107)2 − (cid:107)r1(cid:107)2) + ((cid:107)r(cid:48) (cid:107)r(cid:48)(cid:107)2 − (cid:107)r(cid:107)2 = ((cid:107)r(cid:48) 23(cid:107)2 − (cid:107)r23(cid:107)2) 4(cid:107)2 − (cid:107)r4(cid:107)2) + ((cid:107)r(cid:48) R2 ≤ 3e2R2 Cn2 − 4(n + 1)2 ≤ −Ω( 1 n3 )(cid:107)r(cid:107)2 since (cid:107)r(cid:107)2 ≤ ne2R2 and hence (cid:107)r(cid:48)(cid:107) ≤ (1 − Ω( 1 n3 ))(cid:107)r(cid:107). min(S) − r(cid:48) r(cid:48) Case Two, max(B3 ∪ B4b) ≥ rmin(S)/(2(n+1)): This can only be the case if x = xeq . We first observe that (cid:107)r(cid:48)(cid:48)(cid:107)2 − (cid:107)r(cid:107)2 = (cid:107)r(cid:48)(cid:48)(cid:107)2 − (cid:107)r(cid:48)(cid:107)2 + (cid:107)r(cid:48)(cid:107)2 − (cid:107)r(cid:107)2 ≤ (cid:107)r(cid:48)(cid:48)(cid:107)2 − (cid:107)r(cid:48)(cid:107)2 + 3e2R2 Cn2 , where the inequality follows from the proof of first case. We need to relate the squared 2-norm of the surplus vectors with respect to the flows f(cid:48)(cid:48) and f(cid:48). To this end, we construct a feasible flow f from f(cid:48) and argue about the 2-norm of its surplus vector. Since f(cid:48)(cid:48) is a balanced flow, its 2-norm is at most the 2-norm of f . The construction of f is described in Figure 5. We initialize f to f(cid:48), the flow after price and flow adjustment. Let (*) be a shorthand for rmin(S, f ) ≤ rmax(B3 ∪ B4b, f )’. Let Enew be the new equality edges connecting buyers in S with goods in C \ Γ(S). There may also be new equality edges5 from ¯S to C \ Γ(S); they are of no concern to us. We iterate over the edges (bi, cj) in Enew . For any such edge, we first increase the flow across the edge until either cj is completely sold or (*) holds. In the latter case, the construction of f is complete. In the former case, we consider the flow-carrying edges (bk, cj) with bk ∈ ¯S. Since type 4a nodes have no outgoing flow, bk has type 3 or type 4b and hence r(bk) ≤ r(bi)/(1 + 1/n). We increase the flow along the edge (bi, cj), decrease the flow across the edge (bk, cj) by the same amount until either the latter flow is zero or (*) holds. In the latter case, the construction of f is complete. Lemma 5.6. When the algorithm in Figure 5 termi- nates, either condition (*) holds for f or there is at least one buyer in S whose surplus with respect to f is one less than its surplus with respect to f(cid:48). Proof. Consider any new equality edge (bi, cj). If condition (*) does not hold for f , then all inflow to cj in f comes from bi and cj is completely sold. In f there was no flow from bi to cj and hence the surplus of bi with respect to f is one less than its surplus with respect to f(cid:48). In the construction of f from f(cid:48), the surpluses of type 1 and 2 players do not increase, and the surpluses of type 3 and 4 players do not decrease. Also, the total decrease of the former surpluses is at least the 5The buyers incident to such equality edges had only equality edges connecting them to Γ(S) before the price adjustment. These equality edges carried no flow. Let Enew be the set of new equality edges from S to C \ Γ(S); Let f = f(cid:48); If rmin(S, f ) ≤ rmax(B3 ∪ B4b, f ), terminate the construction of f ; For every edge (bi, cj) ∈ Enew do As long as cj rmax(B3 ∪ B4b, f ) or cj is completely sold; In the former case, terminate the construction; For all flow-carrying edges (bk, cj) with bk ∈ ¯S: is not completely sold, augment along (bi, cj) gradually until rmin(S, f ) = Augment along (bi, cj, bk) gradually until rmin(S, f ) = rmax(B3 ∪ B4b, f ) or the flow from bk to cj becomes zero; In the former case, terminate the construction; Figure 5: New equality edges: the construction of f from f(cid:48). total increase of the latter surpluses. Thus Lemma 5.1 applies. We have D ≥ R/(2(n + 1)) and ∆ ≥ D/2 if condition (*) holds for f and ∆ ≥ 1 otherwise. Thus (cid:107)r(cid:107)2 − (cid:107)r(cid:48)(cid:107)2 ≤ − R 2(n + 1) min( R 4(n + 1) , 1) = − R2 8(n + 1)2 , since R ≤ n by Lemma 5.2. Combining the bounds yields (cid:107)r(cid:48)(cid:48)(cid:107)2 − (cid:107)r(cid:107)2 ≤ (cid:107)r(cid:107)2 − (cid:107)r(cid:48)(cid:107)2 + ≤ − R2 8(n + 1)2 + n3 )(cid:107)r(cid:107)2. 1 = −Ω( 3e2R2 Cn2 3e2R2 Cn2 We can now prove a bound on the number of balancing phases. Lemma 5.7. The number of O(n4 log(nU )). balancing phases is Proof. Let T be the number of balancing phases. The √ 2-norm of the initial balanced flow is no larger than n. In the xmax-phases, the 2-norm of the surplus vector is multiplied by a factor of at most (nU )O(n). We exit from the loop once r < . Thus r ≥  n after T − 1 balancing phases. and hence (cid:107)r(cid:107) ≥ / Each balancing phase reduced the 2-norm by a factor of 1 − Ω(1/n3). Therefore √ √ √ n(nU )O(n)(1 − Ω(1/n3))T−1 ≥ / n. The bound follows. 6 Balanced Flows for Nondegenerate Instances We show that for nondegenerate instances, balanced flows can be computed with one maxflow computation and n maxflow computations in forest networks. It is known [5] that balanced flows in equality networks can be computed with n maxflow computations. All computations are in graphs with O(n) edges. Lemma 6.1. If Ep is a forest, a maximum flow in Np can be computed with O(n) arithmetic operations. Proof. For an edge e, we use cap(e) to denote its ca- pacity. The following algorithm constructs a maximum flow: As long as Ep is nonempty, let (bi, ck) be an equal- ity edge such that either bi or ck has degree one in Ep. We route q = min(cap((s, bi), cap(ck, t)) along the path (s, bi, ck, t), reduce the capacities of the edges (s, bi) and (cj, t) by q, and remove the edge (bi, ck) from the net- work. Let (N(cid:48), cap(cid:48)) be the resulting network. In order to show correctness, we construct a cut D such that the value of the flow constructed by the algorithm is equal to the capacity of D. We do so by induction on the number of edges in Ep. If Ep is empty, we take D = s ∪ B. Assume inductively, that f(cid:48) is a flow in (N(cid:48), cap(cid:48)) and D(cid:48) is a cut in this network with val (f(cid:48)) = cap(cid:48)(D(cid:48)). Let f be obtained from f(cid:48) by routing q units along the path (s, bi, ck, t). Then val (f ) = val (f(cid:48)) + q = cap(cid:48)(D(cid:48)) + q. If bi and ck belong to the same side of the cut (either both belong or neither belongs to D(cid:48)), then cap(D(cid:48)) = cap(cid:48)(D(cid:48)) + q, and we take D = D(cid:48). If bi and ck belong to different sides of the cut, we obtain D from D(cid:48) by moving the vertex of degree one to the other side. Then exactly one of (s, bi) and (ck, t) is cut by D, (bi, ck) is not cut, and no other equality edge is cut, since we move the vertex of degree one to the other side. Thus cap(D) = cap(cid:48)(D(cid:48)) + q. Lemma 6.2. If Ep is a forest, a balanced flow in Np can be computed with O(n2) arithmetic operations. Proof. A balanced flow can be computed with at most n maxflow computations. The maxflow computations are on a network with reduced capacities and some edges removed. Thus, the set of edges connecting buyers and goods always form a forest. Lemma 6.3. Let C0 ⊆ C be a set of goods. If Ep is a forest and there is a maximum flow in which all goods in C0 are completely sold, then a balanced flow in which all goods in C0 are completely sold can be computed with O(n2) arithmetic operations. Proof. Let f be a balanced flow in Np. Let B1, B2, . . . , Bh be the partition of the buyers into maximal classes with equal surplus. This partition is unique. Let ri be the surplus of the buyers in Bi with r1 > r2 > . . . > rh ≥ 0. If rh = 0, let h0 = h− 1. Otherwise, let h0 = h. Let C(cid:48) be the set of goods to which money from a buyer in B(cid:48) = ∪i≤h0Bi flows. The goods in C(cid:48) are completely sold, there is no money flowing from Bh0+1 (Bh+1 = ∅) to C(cid:48) and there is no equality edge from B(cid:48) to C \ C(cid:48). Thus s ∪ B(cid:48) ∪ C(cid:48) is a minimum cut. Let f(cid:48) be a maximum flow in which all goods in C0 are completely sold. Then f(cid:48) also sends no flow from Bh0+1 to C(cid:48) and f(cid:48) saturates all edges in the minimum cut. The flow f(cid:48)(cid:48) consisting of f on the edges in the subnetwork spanned by s ∪ B(cid:48) ∪ C(cid:48) ∪ t and of f(cid:48) on the edges in s ∪ Bh0+1 ∪ C \ C(cid:48) ∪ t. It is a balanced flow in which all goods in C0 are completely sold. We can construct f(cid:48)(cid:48) as follows. We first construct f . This requires O(n2) arithmetic operations by the preceding Lemma and gives us Bh0+1 and C(cid:48)(cid:48) := C \ C(cid:48). Let F be the value of a maximum flow in s∪Bh0+1∪C(cid:48)(cid:48)∪ t and let P be the total price of the goods in C(cid:48)(cid:48) ∩ C0. We introduce a new vertex t(cid:48), replace t by t(cid:48) in all edges from C(cid:48)(cid:48) \ C0 to t, and introduce an edge (t(cid:48), t) with capacity F − P , and compute a maximum flow in the network s ∪ Bh ∪ C(cid:48)(cid:48) ∪ t(cid:48) ∪ t. In this flow the goods in C(cid:48)(cid:48) ∩ C0 are completely sold. Theorem 6.1. For nondegenerate instances, the algo- rithm computes equilibrium prices with O(n6 log(nU )) arithmetic operations on rationals. Proof. The number of phases is O(n4 log(nU )) and each phase requires O(n2) arithmetic operations. Part B requires O(n4 log(nU )) arithmetic operations. 7 Perturbation A perturbation of the utilities replaces each nonzero utility uij by a nearby utility uij(), where  is a positive parameter and lim→0+ uij() = uij. We will usually write uij instead of uij(). The solution to a perturbed problem may or may not give information about the solution to the original problem. An example, where it does not is the following version of the convex hull problem. We are given a set of points in the plane; the task is to compute the number of points on the boundary of the convex hull (if points lie on the interior of hull edges, this number may be more than the number of vertices of the convex hull). A perturbation may move a point from the boundary into the interior and hence the number computed for the perturbed problem may be smaller than the number for the original problem. For the computation of equilibrium prices the situation is benign and the limit of solutions to the perturbed problem is a solution to the original problem. An equilibrium price vector p gives rise to a n × n linear system Ax = X of equations of full rank; the price vector p is the unique solution to this system. The entries of A depend on the utilities uij and X is a unit vector. The solution p to a perturbed problem gives rise to a linear system Ax = X. The entries of A depend on the perturbed utilities uij. We will show in Section 7.1 that for sufficiently small perturbations, a system Ax = X with solution p can be constructed from the system Ax = X by simply reversing the perturbation, i.e., by replacing occurrences of uij by uij. This implies lim→0+ p() = p. Once p is known, the computation of the money flow is tantamount to solving a maxflow problem. In the Appendix, we will review the perturbation suggested in [13] and argue that the description is incomplete. In Section 7.2, we introduce a novel perturbation. It is inspired by [14]. In Section 7.3 we review how phases are implemented in [6]. Finally, in Section 7.4, we combine the ingredients and show how to handle degenerate inputs efficiently. 7.1 Continuity for Sufficiently Small Perturba- tions. Let p be a set of prices. The extended equality graph Gp has edge set Ep ∪ {(bi, ci) 1 ≤ i ≤ n}. We call a set of prices canonical if the extended equality graph is connected and the minimum price is equal to one. Lemma 7.1. Let p be any equilibrium price vector. Then there is a canonical equilibrium price vector p such that Ep ⊆ E p. Proof. Let f be a feasible money flow with respect to p. We first multiply all prices and flows by a suitable constant so as to make all prices at least one. As long as the extended equality graph contains more than one component, we choose one of them subject to the constraint that it is not the only component that contains a good with price one. Let K be the component chosen. We increase the prices of all goods in K and the flows between the buyers and goods in K by a common factor x until a new equality edge between a buyer in K and a good outside K arises. This reduces the number of components. Continuing in this way, we obtain a canonical equilibrium price vector and the corresponding money flow. Let p be a canonical equilibrium price vector and let T be a spanning forest of the equality graph Gp. Consider the following system of equations. For a buyer bi with neighbors cj1 to cjk in T we have equations (7.4) uij1pj(cid:96) − uij(cid:96) pj1 = 0 for 2 ≤ (cid:96) ≤ k. For all but one component K of the equality graph (not the extended equality graph), we have the equation (cid:88) (cid:88) (7.5) pi = pj. bi∈B∩K cj∈C∩K Note that {i bi ∈ B ∩ K} (cid:54)= {j cj ∈ C ∩ K} since otherwise K would be a component of the extended equality graph. If the equality graph has only one component, there is no equation of type (7.5). Finally, we have the equation (7.6) pi = 1 for one of the goods of price 1. Lemma 7.2. The equation system (7.4), (7.5), (7.6) has full rank and p is the unique solution. Proof. Shown in [6]. Let u be a set of perturbed utilities and let p be a canonical solution with respect to u. Then p satisfies a system of equations consisting of equations of the form (7.4), (7.5) and (7.6). The utilities in the equations of type (7.4) are the perturbed utilities u. This is system Ax = X; it has solution p. We next construct a system Ax = X(cid:48), still with solution p, by replacing the equations of type (7.4) by the equivalent equations (7.7) uij1pj(cid:96)−uij(cid:96) pj1 = (uij1− uij1)pj(cid:96) +(uij(cid:96)−uij(cid:96))pj1 and keeping the other equations. Lemma 7.3. The system (7.7), (7.5), (7.6) has full rank. Let p∗ be a solution to the system Ax = X obtained from Ax = X(cid:48) by replacing the right hand side of equations (7.7) by zero. If δ = maxij uij − uij satisfies 2U 2(nU )2n + 2((nU )n + 6(nU )2nδ)δ < 1 and 2n(nU )2nδ < 1/2, then p∗ is an equilibrium price vector for the original utilities. Proof. We need to show that (s, B∪C∪t) is a minimum cut in the equality network Np∗ . To this end, we first show that equality edges with respect to p are also equality edges with respect to p∗, i.e., E p ⊆ Ep∗ . The following argument was essentially given in [6], although in a different context. Since prices are bounded by (nU )n, the right hand sides in equations (7.7) are bounded by 2(nU )nδ. The vector p∗ is a ratio- nal vector with a common denominator D = det A, say i = qi/D with qi ∈ N>0. Since (cid:107)X−X(cid:48)(cid:107)∞ ≤ 2(nU )nδ, p∗ we have p− p∗ = A−1(X − X(cid:48)) = B−1(X − X(cid:48))/(det A), where B−1 is an integral matrix whose entries are bounded by n!U n. Thus pi − p∗ . Let ε(cid:48) = 2(nU )2nδ. Consider any bi ∈ B and cj, ck ∈ C and assume uij/pj ≤ uik/pk. Then uijqk ≤ (uij + δ)(pkD + ε(cid:48)) i = pi − qi/D ≤ (nU )n2(nU )nδ 2(nU )2nδ D D = ≤ uij pkD + δ(pkD + ε(cid:48)) + uijε(cid:48) ≤ uik pjD + δ(pkD + ε(cid:48)) + uijε(cid:48) ≤ (uik + δ)(qj + ε(cid:48)) + δ(qk + 2ε(cid:48)) + uijε(cid:48) ≤ uikqj + uikε(cid:48) + δ(qj + ε(cid:48)) + δ(qk + 2ε(cid:48)) + uijε(cid:48) < uikqj + 1, Let Q =(cid:80) cut in N p. Its capacity is at least(cid:80) since uikε(cid:48)+δ(qj+ε(cid:48))+δ(qk+2ε(cid:48))+uijε(cid:48) ≤ (2U 2(nU )2n+ 2((nU )n + 6(nU )2nδ))δ < 1. i qi. The cut (s, B ∪ C ∪ t) is a minimum i pi ≥ (Q − nε(cid:48))/D. The cut (s, B ∪ C ∪ t) has capacity Q/D in Np∗ . If it is not a minimum cut, there is a cut of capacity at most (Q− 1)/D. Since E p ⊆ Ep∗ , this cut is also a cut in N p. Its capacity in N p is at most (Q − 1 + nε(cid:48))/D. This is less than (Q − nε(cid:48))/D, a contradiction. 7.2 Our Perturbation. R. Seidel [14] discusses the nature and meaning of perturbations in computational geometry. His advice is also applicable here. First, determine a set of inputs which are nondegenerate, i.e., a set of utilities for which for every cycle D; here D0 and D1 are the two classes of D. This is easy. We choose for each edge e = ij a distinct prime qe. Then (cid:81) (cid:81) (cid:81) (cid:81) U (D) := e∈D1 e∈D0 (cid:54)= 1 ue ue Q(D) := e∈D1 e∈D0 (cid:54)= 1 qe qe for every cycle D. Second, one defines the perturbed utilities by combining the original utilities and the non- degenerate utilities by means of a positive infinitesimal ε. Since our quantity of interest combines the utilities by multiplications and divisions, a multiplicative com- bination is appropriate, i.e., we define uij(ε) = uijqε ij. Lemma 7.4. For a cycle D, let (cid:81) (cid:81) U (D) := e∈D1 e∈D0 ue ue = U (D)Q(D)ε. for all Then, ε, sign(ln U (D)) (cid:54)= 0 and sign(ln U (D)) = sign(ln U (D)) if sign(ln U (D)) (cid:54)= 0. sufficiently positive small ln U (D) = ln U (D) + ε ln Q(D). Proof. Clearly, If U (D) (cid:54)= 1, sign(ln U (D)) = sign(ln U (D)) for every If U (D) = 1, sign(ln U (D)) = sufficiently small ε. sign(ln Q(D)) for every positive ε. Since there are at least Q/(2 ln Q) primes less than Q for any integer Q, we can choose the qe’s such that qe ≤ Q := 8n2 log n. The primes less than Q can be determined in time O(Q ln Q) = O(n2 log2 n) by use of the Sieve of Eratosthenes.6 We come to the implementation of the perturbation. The perturbed utilities are of the form ABε with A and B positive rational numbers. We will also restrict prices to numbers of this form; we will discuss below how this can be achieved in the balanced flow computation. We can either choose ε as a sufficiently small numerical value or, more elegantly, treat ε as a symbolic positive infinitesimal. Lemma 7.5. Let A, B, C, and D be positive rationals. Then ABε > CDε for all sufficiently small ε iff A > C or A = C and B > D. Also, ABε/CDε = (A/C) · (B/D)ε. Proof. Obvious. So prices and utilities are pairs (A, B) with A and B positive rationals. The pair (A, B) stands for ABε and comparisons are lexicographic. 7.3 The Implementation of a Phase: A Review of [6, Section 3]. Duan and Mehlhorn [6] already used perturbation in their algorithm, but for the purpose of keeping the cost of arithmetic low and not for the purpose of removing degeneracies. Fortunately, their perturbation extends to what is needed here. We 6We initialize all entries of an array A[2..Q] to true. Then, for i ∈ [2, Q], we do: if A[i] is true, we output i as prime and set all multiples A[(cid:96) · i], for 2 ≤ (cid:96) ≤ Q/i to false. All of this takes time O((cid:80) i≤Q Q/i) = O(Q ln Q). review their use of perturbation adapted to our modified definition of S. Let L = 128n5n+5U 4n. A real number b is an ad- ditive 1/L-approximation or simply additive approxima- tion of a real number a if a−b ≤ 1/L. It is a multiplica- tive (1 + 1/L)-approximation or simply multiplicative approximation if a/b ∈ [1/(1 + 1/L), 1 + 1/L]. [6] ap- proximates utilities by powers of (1 + 1/L). For a utility uij ∈ [1..U ], let eij ∈ N be such that uij := (1 + 1/L)eij is a multiplicative approximation of uij. Moreover, for part A of the algorithm, [6] restricts prices to the form (1 + 1/L)k, 0 ≤ k ≤ K, where K is chosen such that (nU )n ≤ (1 + 1/L)K. This choice of K guarantees that the full range [1..(nU )n] of potential prices is cov- ered. Then K = O(nL log(nU )). They represent a price pi = (1 + 1/K)ei by its exponent ei ∈ N. Here, N de- notes the natural numbers including zero. The bitlength of ei is log K = O(n log(nU )). The surplus vector with respect to p is computed only approximately. To this end, they replace each price pi by an approximation pi with denominator L (note that the denominator of pi might be as large as LK) and compute a balanced flow in a modified equality network N (p, p). The approximation pi is a rational number with denominator L and an additive and a multiplicative approximation of pi. For two price vectors p and p, the equality network N (p, p) has its edge set determined by p and its edge capacities determined by p, i.e., it has – an edge (s, bi) with capacity pi for each bi ∈ B, – an edge (ci, t) with capacity pi for each ci ∈ C, and – an edge (bi, cj) with infinite capacity whenever uij/pj = max(cid:96) ui(cid:96)/p(cid:96). We use Ep to denote this set of edges. Let f be a balanced flow in N (p, p). For a buyer bi, let r(bi) = pi − fsi be its surplus, for a good ci, let r(ci) = pi − fit be its surplus. We define S as in Section 3 except that we use the surplus vector r instead of the surplus vector r. Recall that [6] uses simpler definition. Since prices are now restricted to powers of 1 + 1/L, the update factor x has to be a power of 1 + 1/L, and hence they need to modify its definition and computation. They compute x in two steps. They first compute a factor x from p as in Section 3 and then obtain x from x by rounding to a near power of 1 + 1/L. They use x to update the price vector p. The prices of all goods in Γ(B(S)) are multiplied by x. They define x as the minimum of xeq (S), x23(S), x24(S), and xmax. The definition of xeq (S) is in terms of the rounded utilities: · pk xeq (S) = min{ uij pj uik bi ∈ B(S), (bi, cj) ∈ Ep, ck /∈ Γ(B(S))}. By definition, xeq (S) is a power of 1 + 1/L. They redefine xmax as a power of 1 + 1/L such that 1 + 1/(Rn3) ≥ xmax ≥ (1 + 1/R(n3))/(1 + 1/L)2. The quantities x23(S), x24(S), and x2(S) are defined in terms of the price vector p and the surplus vector r, e.g., x23(S) = min{ pi + pj − r(bj) pi + pj − r(bi) bi is type 2 and bj is type 3 buyer} Then x23(S), x24(S), x2(S) are multiplicative ap- proximations of x23(S), x24(S), and x2(S) and x = min(xeq , x23(S), x24(S), xmax). Clearly, x is a multi- plicative (1 + 1/L)-approximation of x. Finally, x is used to update the prices: p(cid:48) i = xpi for each good ci ∈ Γ(B(S)) and p(cid:48) i = pi for any ci (cid:54)∈ Γ(B(S)). It was shown in [6] that the above can be imple- mented with arithmetic (additions, subtractions, mul- tiplications, divisions) on integers whose bitlength is O(n log(nU )). The computation of multiplicative and additive approximations takes O(n log(nU )) operations. The following lemma summarizes the review: inputs, Theorem 7.1. For nondegenerate the al- gorithm computes equilibrium prices and requires O(n6 log2(nU )) arithmetic operations (additions, sub- tractions, multiplications, divisions) on integers of bitlength O(n log(nU )). complexity is O(n7 log3(nU )). time Its Proof. The number of phases is O(n4 log(nU )). At the beginning of a phase, we have the price vectors p and p and know a balanced flow f in the network N (p, p). We determine the set S, and the quantities xeq , x23, x24, and x2. This requires O(n2) arithmetic operations. We then compute x23, x24, and x2. This takes O(n log(nU )) arithmetic operations ([6, Lemma 17]). We then per- form the price update (n arithmetic operations), com- pute pnew from the new price vector pnew . This takes O(n log(nU )) arithmetic operations for each price ([6, Lemma 16]) for a total of O(n2 log(nU )) arithmetic op- eration. Finally, we compute a balanced flow in the network N (pnew , pnew ) (n2 arithmetic operations). In summary, each phase requires O(n2 log(nU )) arithmetic operations on integers of bitlength O(n log(nU )). Since the cost of arithmetic on a RAM with logarithmic word length has cost linear in the bitlength, the time bound follows. For each edge e with ue > 0, 7.4 Adaption to Degeneracy Removal. Recall that we have chosen a distinct prime qe ≤ Q = 8n2 ln n for every edge e ∈ B×C with ue > 0. Let L(cid:48) = 8n(cid:100)Q(cid:101)2n. let (cid:96)e be such that (1 + 1/L(cid:48))(cid:96)e is a 1 + 1/L(cid:48)-multiplicative approx- imation of qe. Consider any cycle D and assume qe > 1. Then the product is at least Q2n/(Q2n − 1), and hence w.l.o.g ((cid:81) e∈D1 e∈D0 qe)/(cid:81) (cid:32)(cid:81) (cid:81) 1 ln(1 + 1 L(cid:48) ) ln ≥ (cid:33) (cid:18) Q2n L(cid:48) )(cid:96)e L(cid:48) )(cid:96)e (1 + 1 (1 + 1 e∈D0 e∈D1 1 ln Q2n − 1 ln(1 + 1 L(cid:48) ) ≥ 1 2 L(cid:48) Q2n − 2n > 0, (cid:19) · 1 (1 + 1 L(cid:48) )2n where the next to last inequality follows from x/2 ≤ ln(1 + x) ≤ x for x ≤ 1, and the last inequality follows from the definition of L(cid:48). We now combine the perturbations described in Sections 7.2, 7.3, and the paragraph above. We replace a utility uij ∈ [1..U ] by uij(ε) = (1 + 1 L )eij (1 + 1 L(cid:48) )(cid:96)ij ε, is as in Section 7.3 and (cid:96)ij where eij is as in the preceding paragraph. For part A of the algorithm, prices are restricted to the form (1 + 1/L)a(1 + 1/L(cid:48))bε, where a is a nonnegative integer and b is an integer. For the computation of balanced flows, we proceed as in Section 7.3. In particular, we replace each price pi by an approximation pi (for this approximation, we ignore the infinitesimal part of the prices, i.e., ABε is replaced by A.) and then compute a balanced flow in the network N (p, p). The results of Section 7.3 carry over. We only have to replace U by max(U, O(n2 log n)) in the time bounds. Theorem 7.2. The algorithm computes equilibrium prices with O(n6 log2(nU )) arithmetic operations on in- tegers of bitlength O(n log(nU )). Its time complexity is O(n7 log3(nU )). 8 A Real Implementation Omar Darwish and Kurt Mehlhorn [3] have imple- mented the algorithm by Duan and Mehlhorn and parts of the improvements described in this paper. For ran- dom utilities, the running time seems to scale signifi- cantly better than n7. References [1] Kenneth J. Arrow and G´erard Debreu. Existence of an equilibrium for a competitive economy. Econometrica, 22:265–290, 1954. [2] Richard Cole and Vasilis Gkatzelis. Approximating the nash social welfare with indivisible items. In Proceed- ings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC ’15, pages 371–380, New York, NY, USA, 2015. ACM. [3] Omar Darwisch and Kurt Mehlhorn. An implementa- tion of combinatorial algorithms for the computation of equilibrium prices in the linear exchange market. in preparation. [4] Nikhil R. Devanur, Jugal Garg, and L´aszl´o A. V´egh. A rational convex program for linear Arrow-Debreu markets. arXiv:1307.803, 2013. [5] Nikhil R. Devanur, Christos H. Papadimitriou, Amin Saberi, and Vijay V. Vazirani. Market equilibrium via a primal–dual algorithm for a convex program. J. ACM, 55(5):22:1–22:18, November 2008. [6] Ran Duan and Kurt Mehlhorn. A Combinatorial Polynomial Algorithm for the Linear Arrow-Debreu Market. Information and Computation, 243:112–132, 2015. a preliminary version appeared in ICALP 2013, LNCS 7965, pages 425-436. [7] B. Curtis Eaves. A finite algorithm for the linear exchange model. Journal of Mathematical Economics, 3:197–203, 1976. [8] Martin Furer. Faster integer multiplication. SIAM J. Comput., 39(3):979–1005, 2009. [9] David Gale. Price equilibrium for linear models of exchange. Technical Report Report P-M56, Rand Corporation, 1957. [10] David Gale. The linear exchange model. Journal of Mathematical Economics, 3:205–209, 1976. [11] Jugal Garg, Ruta Mehta, Milind Sohoni, and Vijay V. Vazirani. A complementary pivot algorithm for mar- kets under separable, piecewise-linear concave utilities. In Proceedings of the Forty-fourth Annual ACM Sym- posium on Theory of Computing, STOC ’12, pages 1003–1016, New York, NY, USA, 2012. ACM. [13] James B. Orlin. [12] Kamal Jain. A polynomial time algorithm for com- puting an Arrow-Debreu market equilibrium for linear utilities. SIAM J. Comput., 37(1):303–318, April 2007. Improved algorithms for computing Fisher’s market clearing prices. In Proceedings of the 42nd ACM symposium on Theory of computing, STOC ’10, pages 291–300, New York, NY, USA, 2010. ACM. [14] R. Seidel. The nature and meaning of perturbations in geometric computing. Discrete & Computational Geometry, 19(1):1–17, 1998. [15] A. Wald. Uber einige Gleichungssysteme der mathema- tischen Okonomie. Zeitschrift fur Nationalokonomie, 7:637–670, 1936. Translated: Econometrica, Vol. 19(4), p.368–403, 1951. [16] L´eon Walras. Elements of Pure Economics, or the theory of social wealth. 1874. June 2007. Appendix: Orlin’s Perturbation In [13], Orlin sketches a perturbation technique. He suggests to replace a nonzero utility uij by7 uij = uij + εn2i + εj, where ε is a positive infinitesimal. He shows that for the perturbed utilities the equality graph Ep for any price vector p is a forest. He does not discuss how to maintain the prices and he suggests that the perturbation can be implemented at no extra cost. Consider the following example of a Fisher market. We have two buyers b0 and b1 and two goods c0 and c1. The budget of b0 is equal to 2 and the budget of b1 is equal to one. The utilities are u00 = u10 = 2 and u01 = u11 = 1. In an equilibrium, the prices are p0 = 2 and p1 = 1, and the equality graph Ep consists of all four edges. Money flows either on all four edges, or on edges (0, 0), (0, 1) and (1, 0) or on edges (0, 0) and (1, 1). In any case, there is flow on the edge (0, 0). The perturbation yields utilities u00 = 2, u01 = 1 + ε, u10 = 2 + ε4, u11 = 1 + ε4 + ε. Orlin writes: “If E is the equality graph prior to perturbations, and if E(cid:48) is the equality graph after perturbations, then E(cid:48) is the maximum weight forest of E obtained by assigning edge (i, j) a weight of in2 + j.” Thus E(cid:48) is Ep minus the edge (0, 0). The equilibrium prices are p0 = 1 and p1 = 2, and this is nowhere close to the true solution. Orlin ignores that the prices after perturbation are rational functions in ε. Assume p1 = 1. Then (0, 0) belongs to the equality graph if 2/p0 ≥ (1 + ε)/1 or p0 ≤ 2/(1 + ε), and (0, 0) and (0, 1) belong to the equality graph if p0 = 2/(1 + ε). Edge (1, 0) belongs to the equality graph if (2 + ε4)/p0 ≥ (1 + ε4 + ε)/1 or p0 ≤ (2 + ε4)/(1 + ε4 + ε). Since (2 + ε4)/(1 + ε4 + ε) < 2/(1 + ε) for ε sufficiently small and positive, we have the following possibilities: 1. p0 < (2+ε4)/(1+ε4 +ε): The equality graph consists of (0, 0) and (1, 0). 2. p0 = (2+ε4)/(1+ε4 +ε): The equality graph consists of (0, 0), (1, 0), and (1, 1). 3. (2 + ε4)/(1 + ε4 + ε) < p0 < 2/(1 + ε): The equality graph consists of (0, 0), and (1, 1). 4. p0 = 2/(1 + ε): The equality graph consists of (0, 0) and (0, 1) and (1, 1) 5. p0 > 2/(1 + ε): The equality graph consists of (0, 1) and (1, 1). Only cases 2, 3, and 4 lead to equality graphs for which the original problem has an equilibrium solution. The example demonstrates that prices must be maintained [17] Yinyu Ye. A path to the Arrow-Debreu competitive market equilibrium. Math. Program., 111(1):315–348, 7In the paper, he writes uij = uij + εni + εj . In personal communication, he corrected this to uij = uij + εn2i + εj . as rational functions in ε in Orlin’s scheme. Alterna- tively, that a concrete sufficiently small value is chosen for ε. Both alternatives incur additional cost. The equilibrium solution corresponds to case 4. The prices are p1 = (3 + 3ε)/(3 + ε) and p0 = 2/(1 + ε) · p1. The flow is 1 on the edge (1, 1), 2 on the edge (0, 0), and 2 − p0 = p1 − 1 on the edge (0, 1).
1209.4493
1
1209
2012-09-20T11:09:13
Minimum weight spanning trees of weighted scale free networks
[ "cs.DS", "physics.comp-ph" ]
In this lecture we will consider the minimum weight spanning tree (MST) problem, i.e., one of the simplest and most vital combinatorial optimization problems. We will discuss a particular greedy algorithm that allows to compute a MST for undirected weighted graphs, namely Kruskal's algorithm, and we will study the structure of MSTs obtained for weighted scale free random graphs. This is meant to clarify whether the structure of MSTs is sensitive to correlations between edge weights and topology of the underlying scale free graphs.
cs.DS
cs
Lecture given at the International Summer School Modern Computational Science 2012 -- Optimization University of Oldenburg, Germany, August 20-31, 2012 Minimum weight spanning trees of weighted scale free networks Oliver Melchert Institute of Physics Faculty of Mathematics and Science Carl von Ossietzky Universitat Oldenburg D-26111 Oldenburg Germany Abstract. In this lecture we will consider the minimum weight spanning tree (MST) problem, i.e., one of the simplest and most vital combinatorial optimization problems. We will discuss a particular greedy algorithm that allows to compute a MST for undi- rected weighted graphs, namely Kruskal's algorithm, and we will study the structure of MSTs obtained for weighted scale free random graphs. This is meant to clarify whether the structure of MSTs is sensitive to correlations between edge weights and topology of the underlying scale free graphs. The lecture is supplemented by a set of Python scripts that allow you to reproduce figures 4 and 5 shown in the course of the lecture. The supple- mentary material can be obtained from the MCS homepage (see Ref. [1]). Contents 1 Recap: Nodes, Edges, and Graphs . . . . . . . . . . . . . . 2 Minimum weight spanning trees (MSTs) . . . . . . . . . . 3 Computing MSTs via a "greedy" strategy . . . . . . . . . 4 Kruskal's algorithm . . . . . . . . . . . . . . . . . . . . . . . 5 MSTs of weighted scale free networks . . . . . . . . . . . . 2 3 4 4 7 1 Minimum weight spanning trees (Melchert) 1 Recap: Nodes, Edges, and Graphs Nodes: A node set V is a collection of elements i, termed nodes (also called sites or vertices). The number of nodes in a node set is subsequently referred to as N =V . Edges: An edge (or arc) eij consists of a pair of nodes i, j ∈ V . Edges can either be directed or undirected. In the former case the corresponding node pair is ordered, i.e., eij = (i, j) with (i, j)(cid:54)= (j, i), while in the latter case the node pair is unordered, i.e., eij ={i, j} with {i, j}≡{j, i}. In the following, if not stated otherwise, the term edge will always refer to an undirected edge, i.e., eij ={i, j}. The edge eij is said to be incident with the nodes i and j and it joins both nodes. Two distinct nodes are said to be adjacent, if they are incident with the same edge. Similarly, two distinct edges are adjacent, if they have a node in common. Consequently, an edge set E is a collection of elements eij with i, j ∈ V . In what follows, E is not allowed to contain self-edges, i.e., edges of type eii, or multiple parallel edges. The number of edges in an edge set is referred to as M =E. Graphs: A graph G = (V, E) is a tuple that consists of a node set V and an edge set E. Depending on the characteristics of the edge set, a graph can either be directed or undirected (see Fig. 1(a),(b)). In the following, if not stated otherwise, the term graph will always refer to an undirected graph. Within a graph, a particular node can have several adjacent nodes, given by the set adj(i) ={j eij ∈ E}. In this context, the degree d(i) =adj(i) of node i measures the number of its neighbors. Regarding directed graphs, one might distinguish between the in- and out-degree of a node, e.g. node 3 of the directed graph in Fig. 1(b) has dout(3) = 1 and din(3) = 2 while the corresponding node in the undirected graph (Fig. 1(a)) simply has d(3) = 2. Further, mappings can be used to relate additional information to the graph. Therefore, nodes as well as edges can be addressed. E.g., a weight function ω : E → R can be used in order to assign a certain weight ωij ≡ ω(eij) to each edge eij ∈ E, see Fig. 2. Such a weight might be interpreted as distance between the two nodes or as a cost to get from one node to the other. The triple G = (V, E, ω) is then called a weighted graph. A subgraph Gsub = (Vsub, Esub) is obtained from a graph G by deleting a (possibly empty) subset of its nodes and edges. That means, for a subgraph it holds that Vsub⊆ V and Esub⊆ E. A cut (C, V \ C) on an undirected graph G = (V, E) is a partition of its nodeset. An edge {i, j} ∈ E crosses the cut if i ∈ C and j ∈ V \ C (or vice versa). A cut Figure 1: Directed and undirected example graphs. (a) undirected graph with node set V = {1, 2, 3} and edge set E = {{1, 2}, {1, 3}, {2, 3}}, (b) directed graph with node set V ={1, 2, 3} and edge set E ={(1, 2), (1, 3), (2, 3), (3, 2)}. 2 212313(a)(b) 2 Minimum weight spanning trees (MSTs) respects a subset Esub ⊆ E if there is no edge in Esub that crosses the cut. An edge {i, j} is called candidate regarding the cut (C, V \ C) if it crosses the cut and has minimum weight amongst all edges that cross the cut. As an example consider the cut (C = {0, 1, 2}, V \ C = {3}) (the nodes in the set C are colored in grey) in Fig. 2(a). Therein, the edges {1, 3} and {2, 3} cross the cut. Amongst those two, {2, 3} signifies the candidate edge since it has the smaller weight. 2 Minimum weight spanning trees (MSTs) Given an undirected, connected and weighted graph G = (V, E, ω) where N = V and M = E signify the number of nodes and edges of G, respectively, and where ω assigns a weight to each edge. Compute a "minimum weight spanning tree" T [2 -- 4]. Minimum weight spanning tree (MST): A MST T is a connected, loopless subgraph of G, consisting of (N−1) edges, connecting all N nodes, thereby minimizing the sum of the edge weights. Note that there are several ways to represent a MST. Here, we will represent it by means of the set T of edges from which it is build up. For the small undirected graph shown in Fig. 2(b), the MST (indicated by bold black lines) reads T = {{0, 1},{1, 2},{2, 3}} and its corresponding weight is ωT =(cid:80){i,j}∈T ωij = 3. Depending on the precise topology of G and the distribution of edgeweights, T is not necessarily unique. Relevance of the MST problem: The minimum weight spanning tree (MST) problem is one of the simplest and most vital combinatorial optimization problems. As such, it arises in a vast number of applications. Either as a "standalone" problem or as subtask of a more intricate problem. The generic problem that is solved by an MST algorithm reads: "Connect a set of points using a minimum-weight set of edges". As such, broadcasting problems on networks typically relate to finding the MST on an appropriate weighted graph. E.g., consider a network where the edgeweights signify time delays (or transmission costs) between the respective incident nodes. Then, an "efficient" or "optimal" broadcasting of a message is made sure if the message is transmitted along the MST edges. The latter connects all nodes by using as few edges as possible, thereby minimizing the total time delay (or transmission cost). Further, MSTs find application in the context of single linkage cluster analyses [5]. Figure 2: (a) The dashed line illustrates the cut ({0, 1, 2},{3}) (for more details, see text). (b) example of a MST (bold black lines) for a small undirected weighted graph. 3 0112132101121321(a)(b) Minimum weight spanning trees (Melchert) 3 Computing MSTs via a "greedy" strategy Greedy problem solving strategy: At any time (during the solution procedure for a given problem) where a decision is required, a greedy problem solving strategy makes the locally optimal choice. Further, unlike in backtracking approaches, once a decision is made it is not revised later on. Albeit such an approach might fail to find a globally optimal solution for your particular optimization problem, an optimal solution for the MST problem can very well be obtained via efficient greedy algorithms. A generic greedy approach to compute a MST for a given network G reads: algorithm MST greedy(G) 1: T = {} 2: while T is not a MST do 3: 4: 5: end while 6: return MST T pick feasible edge e ∈ E \ T T ← T ∪ e Cut-property: In the above pseudocode the tricky part is to find proper selection criteria for the edges that are added to the MST. In this regard, a feasible edge has to satisfy the cut property: Consider a weighted undirected graph G = (V, E, ω). Let T (cid:48) ⊆ E so that there is a MST T ⊃ T (cid:48). Further, let (C, V \C) be an arbitrary cut that respects T (cid:48) and let {i, j} be a candidate regarding the cut. Then {i, j} is a feasible edge that can be used in order to extend T (cid:48). E.g., regarding the cut illustrated in Fig. 2(a), the edge {2, 3} is a feasible edge that can be used to amend (and also complete) the MST. 4 Kruskal's algorithm Idea behind the algorithm: The algorithm due to Kruskal [2] is a particular greedy algorithm that, for an instance of an undirected, connected and weighted graph, obtains a MST. The subsequent three steps summarize the solution strategy of Kruskal's algorithm: Step 1: In the beginning, each node forms a tree. Hence, there is a forest of N single-node trees. Further, an empty list T is initialized that will keep all those edges that are part of the MST. Step 2: Sort the edges in order of increasing weight. Visit the edges in order of increasing weight and apply the following edge-selection criterion: Step 3: If the currently considered edge {i, j} has both endnodes in different trees, add the edge to T and merge the respective trees. If {i, j} has both endnodes in the same tree, discard the edge. Proceed to the next edge or stop when there are no more edges to process. 4 4 Kruskal's algorithm After M iterations of step 3 (i.e., as soon as all edges are processed), T comprises the edges that comprise the MST. Efficient implementation: Albeit the pseudocode and the description above seem to be very simple, an efficient implementation of Kruskal's algorithm is more tricky than it appears at first sight. In this regard, step 2 can be accomplished by using merge-sort yielding a sorted edge list in time O(M log M ). Further, in step 1 single- node trees (one tree for each node in the graph) need to be initialized, and in step 3 it must be possible to efficiently determine the tree to which a node belongs. Finally, two selected trees need to be merged to a single tree, occasionally. These latter three tasks can be handled by using a union-find data structure that features the following three operations: Operation 1: make set(i): Generates a tree consisting of the node i, only Operation 2: find(i): Yields the "name" of the tree to which node i belongs Operation 3: union(a,b): Merges trees with names a and b to a new tree with name a For a connected graph, the total time for the union-find operations (i.e., N make set operations and O(M) find and union operations) can be approximated by O(M log M) (note that this also depends on the precise implementation of the union-find data structure [3]). The full (worst case) running time of Kruskal's algorithm amounts to O(M log N ). It summarizes the time spent to sort the edges, perform M find and N−1 union operations. A python [6] implementation of Kruskal's algorithm is contained in the supplementary material [1]. Generically, python uses Timsort [7], a hybrid sorting algorithm based on merge sort and insertion sort [3]. Further, the implementation of the union-find data structure contained in the supplementary material uses union-by- size: if two trees are merged by means of a call to union, the smaller tree (in terms of the number of nodes contained in the tree) is added to the larger tree. A particular implementation might read (see [3]): def mstKruskal(G): """Kruskals minimum spanning tree algorithm algorithm for computing a minimum spanning tree (MST) T=(V,E') for a connected, undirected and weighted graph G=(V,E,w) as explained in 'Introduction to Algorithms', Cormen, Leiserson, Rivest, Stein, Chapter 23.2 on 'The algorithms of Kruskal and Prim' Input: G - weighted graph data structure Returns: (T,wgt) 5 Minimum weight spanning trees (Melchert) Figure 3: Exemplary application of Kruskal's MST algorithm on a small example graph G consisting of 6 nodes and 9 edges. The bold black edges belong to the forest that is grown in order to construct an MST of G. In the course of the algorithm each edge is considered once (within the subfigures (a -- f), a small arrow indicates the edge currently considered). For each edge it is decided whether it can be used to extend the forest constructed so far in order to yield an MST. For more details on the steps (a) through (f), see text. - minimum spanning tree stored as edge list - weight of minimum weight spanning tree T wgt """ uf = unionFind_cls() T=[] # union find data structure # list to store MST edges # list of edges sorted in order of increasing weight K = sorted(G.E,cmp=lambda e1,e2: cmp(G.wgt(e1),G.wgt(e2))) # initialize forrest of sinlge-node trees for i in G.V: uf.makeSet(i) # construct MST for (v,w) in K: if uf.find(v)!=uf.find(w): uf.union(uf.find(v),uf.find(w)) T.append((v,w)) return T, sum(map(lambda e: G.wgt(e),T)) Example graph: In order to illustrate Kruskal's MST algorithm, consider the small graph G = (V, E, ω) consisting of N = 6 nodes and M = 9 edges, shown in Fig. 3(a -- f). In a first step, the graph edges are sorted in order of increasing weight, i.e., the 6 123456410410756210(a)123456410410756210(b)123456410410756210(c)123456410410756210(d)123456410410756210(e)123456410410756210(f) 5 MSTs of weighted scale free networks set K reads: K = {{5, 6},{2, 3},{1, 2},{4, 5},{4, 6},{3, 5},{1, 3},{2, 5},{2, 4}} Then, as a second step, the function make set is used to initialize a forest of trees. In the very beginning, each tree consists of a single node, only. In the third step, the edge selection procedure is carried out until all edges are processed. In detail, the following steps (illustrated in Fig. 3(a -- f)) are carried out: Step (a): Edge {5, 6} is considered. It can be used to merge two distinct trees in the forest and is hence added to T . Step (b): Edge {2, 3} is considered. It can be used to merge two distinct trees in the forest and is hence added to T . Step (c): Edge {1, 2} is considered. It can be used to merge two distinct trees in the forest and is hence added to T . Note that {2, 3} and {1, 2} had the same weight. However, no matter which of the two edges is picked first does not alter the structure of the final MST. Step (d): Edge {4, 5} is considered and added to T . Step (e): Edge {4, 6} is considered. It does not connect two distinct trees. Adding it to the forest would introduce a cycle. Hence, the edge is not added to T and the algorithm proceeds to the next edge in K. Step (f ): Edge {3, 5} is considered and added to T . All remaining edges would also lead to a cycle (as in step (e) above) and are hence not added to T . Finally, after the algorithm terminates, the edgeset T comprises a MST with weight ωT = 22. 5 MSTs of weighted scale free networks The subsequent simulations, reported in Ref. [8], were carried out to clarify whether the structure of MSTs change as a function of the correlations between edge weights and network topology. (Here, as an exercise, I re-implemented the model studied in Ref. [8] and re-performed their simulations and analysis. The resulting code is available as supplementary material at [1]. The figures presented below summarize the results of the simulations performed via the code in the supplementary material.) Simulation setup: For the numerical experiments scale free (SF) random networks were considered. These networks (also referred to as heterogeneous random graphs) are characterized by a power-law degree distribution pk ∼ k−γ. The construction In of such SF networks via preferential attachment [9] yields an exponent γ = 3. particular, SF networks containing N = 10000 nodes were used (the number of edges 7 Minimum weight spanning trees (Melchert) connecting a newly created node to existing nodes during the preferential attachment procedure was set to m = 2). Further, two qualitatively different weight distributions were considered (note that the authors of Ref. [8] considered more weight distributions, however, the two weight distributions considered here suffice in order to answer the question that kicked off the study): Disorder type 1: (1) where the weight associated to edge {i, j} is large if the degrees of its endnodes tend to be large, and, ωij = kikj, Disorder type 2: (2) where the weight related to an edge {i, j} is large if the degrees of its endnodes tend to be small. ωij = 1/kikj, For SF networks respecting the above two weight distributions, MSTs are computed using Kruskal's algorithm (in the original article they use a different MST algorithm due to Prim [3]) and the characteristics of the MSTs is studied. Results: Considering the degree distribution of the nodes regarding the MSTs, the results indicate that the topology of the MSTs falls into two distinct classes: 1. Disorder type 1 (Eq. (1)) yields MST with exponential degree distribution. The MST avoids edges with large weight, preferentially using edges that connect to low degree nodes (see Figs. 5(a) and 4(a)). 2. Disorder type 2 (Eq. (2)) yields MST with power law degree distribution. Edges with lowest weight are connected to the hubs of G. The MST uses these edges extensively (see Figs. 5(b) and 4(b)). Figure 4: MST of weighted scale free graphs (N = 500, m = 2). The size of the nodes reflect their degree in G. (a) Disorder type (i): most hubs are located on the outer branches. (b) Disorder type (ii): hubs of G are at the center of the MST, intermediate degree nodes (in G) are located on the branches of the MST. 8 (a)(b) 5 MSTs of weighted scale free networks Figure 5: Results for the MSTs computed for weighted scale free graphs (N = 10000, m = 2). (a) degree distribution for weight assignment ωij = kikj, (b) degree distribution for weight assignment ωij = 1/kikj, (c) weight distribution for weight assignment ωij = kikj, (d) weight distribution for weight assignment ωij = 1/kikj, (e) MST efficiency. 9 10-510-410-310-210-1100 1 2 3 4 5 6 7 8 9 10PT(k)k(a)ωij=kikj10-710-610-510-410-310-210-1100101102103PT(k)k∝ k-2.5(b)ωij=1/kikj10-810-710-610-510-410-310-210-1100101102103PT(ω)ω∝ ω-3(c)ωij=kikj 0.5 1 2 4 0 0.1 0.2 0.3 0.4 0.5 0.6PT(ω)ω(d)ωij=1/(kikj) 0.05 0.1 0.2 0.4102103104α = ωT/ωGN(e)ωij=1/kikjωij=kikj Minimum weight spanning trees (Melchert) Considering the weight distribution of the edges that comprise the MSTs, the results show that 1. Disorder type 1 yields MSTs with a power law weight distribution (see Fig. 5(c)). 2. Disorder type 2 yields MSTs with an exponential weight distribution (see Fig. 5(d)). A measure that tells how efficient a MST connects the nodes of a graph G is given by the MST efficiency α = ωT /ωG. Where the numerator signifies the weight ωT = (cid:80){i,j}∈T ωij of the MST, and where the denominator specifies the weight of the graph ωG = (cid:80){i,j}∈E ωij. The numerical results regarding the MST efficiency are shown in Fig. 5(e). As evident from the figure, disorder type 1 exhibits a power law decrease of the efficiency with increasing graph size. In contrast to this, the MST efficiency for disorder type 2 saturates at a finite value of α. This suggests that MSTs for disorder type 1 are more efficient than those obtained for disorder type 2. References [1] O. Melchert. The supplementary material can be downloaded from the site http://www.mcs.uni-oldenburg.de/. [2] J. B. Kruskal. On the Shortest Spanning Subtree of a Graph and the Traveling Salesman Problem. Proceedings of the American Mathematical Society, 7 (1956) 48. [3] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms, 2nd edition. MIT Press, 2001. [4] R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Network Flows: Theory, Algo- rithms, and Applications. Prentics Hall, 1993. [5] J. C. Gower, and G. J. S. Ross. Minimum spanning trees and single linkage cluster analysis. Applied Statistics, 18 (1969) 54. [6] Python is a high-level general-purpose programming language that can be applied to many different classes of problems, see http://www.python.org/. [7] For more information on the Timsort algorithm, see http://en.wikipedia.org/ wiki/Timsort. [8] P. J. McDonald, E. Almaas, and A.-L. Barab´asi. Minimum spanning trees of weighted scale-free networks. Europhys. Lett., 72 (2005) 308. [9] V. Batagelj, and U. Brandes. Efficient generation of large random networks. Phys. Rev. E, 71 (2005) 036113. 10
1312.6652
1
1312
2013-12-23T19:30:46
Rounding Sum-of-Squares Relaxations
[ "cs.DS", "cs.LG", "quant-ph" ]
We present a general approach to rounding semidefinite programming relaxations obtained by the Sum-of-Squares method (Lasserre hierarchy). Our approach is based on using the connection between these relaxations and the Sum-of-Squares proof system to transform a *combining algorithm* -- an algorithm that maps a distribution over solutions into a (possibly weaker) solution -- into a *rounding algorithm* that maps a solution of the relaxation to a solution of the original problem. Using this approach, we obtain algorithms that yield improved results for natural variants of three well-known problems: 1) We give a quasipolynomial-time algorithm that approximates the maximum of a low degree multivariate polynomial with non-negative coefficients over the Euclidean unit sphere. Beyond being of interest in its own right, this is related to an open question in quantum information theory, and our techniques have already led to improved results in this area (Brand\~{a}o and Harrow, STOC '13). 2) We give a polynomial-time algorithm that, given a d dimensional subspace of R^n that (almost) contains the characteristic function of a set of size n/k, finds a vector $v$ in the subspace satisfying $|v|_4^4 > c(k/d^{1/3}) |v|_2^2$, where $|v|_p = (E_i v_i^p)^{1/p}$. Aside from being a natural relaxation, this is also motivated by a connection to the Small Set Expansion problem shown by Barak et al. (STOC 2012) and our results yield a certain improvement for that problem. 3) We use this notion of L_4 vs. L_2 sparsity to obtain a polynomial-time algorithm with substantially improved guarantees for recovering a planted $\mu$-sparse vector v in a random d-dimensional subspace of R^n. If v has mu n nonzero coordinates, we can recover it with high probability whenever $\mu < O(\min(1,n/d^2))$, improving for $d < n^{2/3}$ prior methods which intrinsically required $\mu < O(1/\sqrt(d))$.
cs.DS
cs
Rounding Sum-of-Squares Relaxations Boaz Barak∗ Jonathan Kelner† David Steurer‡ December 24, 2013 Abstract We present a general approach to rounding semide finite progr amming relaxations obtained by the Sum-of-Squares method (Lasserre hierarchy). Our approach is based on using the connection between these relaxations and the Sum-of-Squares proof system to transform a combining algorithm —an algo- rithm that maps a distribution over solutions into a (possibly weaker) solution —into a rounding algorithm that maps a solution of the relaxation to a solution of the original problem. Using this approach, we obtain algorithms that yield improved results for natural variants of three well-known problems: 1. We give a quasipolynomial-time algorithm that approximates maxk xk2 =1 P( x) within an additive factor of εkPk s pectral additive approximation, where ε > 0 is a constant, P is a degree d = O(1), n-variate polynomial with nonnegative coefficients, and kPk s pectral is the spectral norm of a matrix corresponding to P’s coefficients. Beyond being of interest in its own right, obtaining such an approximation for general polynomials (with possibly negative coefficients) is a long-standing open question in quantum information theory, and our techniques have already led to improved results in this area (Brand ao and Harrow, STOC ’13). 2. We give a polynomial-time algorithm that, given a subspace V ⊆ ’n of dimension d that (almost) v ∈ V that satisfies …i v4 contains the characteristic function of a set of size n/k, finds a vector i > Ω(d−1/3k(…i v2 i )2 ). This is a natural analytical relaxation of the problem of fi nding the sparsest element in a subspace, and is also motivated by a connection to the Small Set Expansion problem shown by Barak et al. (STOC 2012). In particular our results yield an improvement of the previous best known algorithms for small set expansion in a certain range of parameters. 3. We use this notion of L4 vs. L2 sparsity to obtain a polynomial-time algorithm with substantially improved guarantees for recovering a planted sparse vector v in a random d-dimensional subspace of ’n . If v has µn nonzero coordinates, we can recover it with high probability whenever µ 6 In particular, when d 6 √n, this recovers a planted vector with up to Ω(n) O(min(1, n/d2)). nonzero coordinates. When d 6 n2/3 , our algorithm improves upon existing methods based on comparing the L1 and L∞ norms, which intrinsically require µ 6 O (cid:16)1/ √d(cid:17). 3 1 0 2 c e D 3 2 ] S D . s c [ 1 v 2 5 6 6 . 2 1 3 1 : v i X r a ∗Microsoft Research. †Department of Mathematics, Massachusetts Institute of Technology. ‡Department of Computer Science, Cornell University. Contents 1 Introduction 1.1 The Sum of Squares hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Optimizing polynomials with nonnegative coefficients bounded spectral norm . . 1.3 Optimizing hypercontractive norms and finding analytic ally sparse vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Organization of this paper . . 1.6 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 4 5 7 8 8 2 Overview of our techniques 2.1 Finding a planted sparse vector in a random low-dimensional subspace . . . . . . . 2.2 Finding “analytically sparse” vectors in general subsp aces . 2.3 Optimizing polynomials with nonnegative coefficients . . . . . . . . . . . . . . . . . . . . . . . . . 9 . . . . . . 10 . . . . . . 11 . . . . . . 13 3 Approximation for nonnegative tensor maximization . . . . . . . . . . . . . . . . 3.1 Direct Rounding . . 3.2 Making Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Finding an “analytically sparse” vector in a subspace . . . . . 4.1 Random function rounding . . . . . . . . . . . . 4.2 Coordinate projection rounding . . . . . . . . . . . . . . . . 4.3 Gaussian Rounding . . . . . 4.4 Conditioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Truncating functions 4.6 Putting things together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Finding planted sparse vectors 5.1 Recovering f0 approximately (Proof of Theorem 5.2) . . . . . . . . . . 5.2 Recovering f0 exactly (Proof of Theorem 5.3) . . . . . . . . . . . . . . . . . . . . . . . . 6 Results for Small Set Expansion 6.1 Small-set expansion of Cayley graphs . . . . . . . . . . . . 6.2 Approximating small-set expansion using ASVP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Discussion and open questions References 14 . . . . . . 15 . . . . . . 16 17 . . . . . . 18 . . . . . . 18 . . . . . . 19 . . . . . . 20 . . . . . . 21 . . . . . . 21 23 . . . . . . 25 . . . . . . 26 27 . . . . . . 28 . . . . . . 29 30 30 A Pseudoexpectation toolkit A.1 Spectral norm and SOS proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 . . . . . . 38 B Low-Rank Tensor Optimization C LOCC Polynomial Optimization 38 39 D The 2-to-q norm and small-set expansion D.1 Norm bound implies small-set expansion . . . . . . . . . . . . . . . . . . . . . . 41 . . . . . . 45 1 Introduction Convex programming is the algorithmic workhorse behind many applications in computer science and other fields. But its power is far from understood, especially in th e case of hierarchies of linear programming (LP) and semidefinite programming (SDP) relaxations. These are s ystematic approaches to make a convex relax- ation tighter by adding to it more constraints. Various such hierarchies have been proposed independently by researchers from several communities [Sho87, SA90, LS91, Nes00, Par00, Las01]. In general, these hierarchies are parameterized by a number ℓ called their level. For problems on n variables, the hierarchy of the ℓth level can be optimized in nO(ℓ) time, where for the typical domains used in CS (such as {0, 1}n or the n-dimensional unit sphere), n rounds correspond to the exact (or near exact) solution by brute force exponential-time enumeration. There are several strong lower bounds (also known as integrality gaps) for these hierarchies, in partic- ular showing that ω(1) levels (and often even nΩ(1) or Ω(n) levels) of many such hierarchies can’t improve by much on the known polynomial-time approximation guarantees for many NP hard problems, including SAT, Independent-Set, Max-Cut and more [Gri01b, Gri01a, ABLT06, dlVKM07, Sch08, Tul09, CMM09, BGMT12, BCV+12]. Unfortunately, there are many fewer positive results, and several of them only show that these hierarchies can match the performance of previously known (and often more efficient) algorithms, rather than using hierarchies to get genuinely new algorithmic results.1 For example, Karlin, Mathieu and Nguyen [KMN11] showed that ℓ levels of the Sum of Squares hierarchy can approximate the Knapsack problem up to a factor of 1 + 1/ℓ, thus approaching the performance of the standard dynamic program. Guruswami and Sinop [GS11] and (independently) Barak, Raghavendra, and Steurer [BRS11] showed that some SDP hierarchies can match the performance of the [ABS10] algorithm for Small Set Expansion and Unique Games, and their techniques also gave improved results for some other problems (see also [RT12, AG11, AGS13]). Chlamtac and Singh [CS08] (building on [Chl07]) used hierarchies to obtain some new approximation guarantees for the independent set problem in 3-uniform hypergraphs. Bhaskara, Charikar, Chlamtac, Feige, and Vijayaraghavan [BCC+10] gave an LP-hierarchy based approximation al- gorithm for the k-densest subgraph problem, although they also showed a purely combinatorial algorithm with the same performance. The famous algorithm of Arora, Rao and Vazirani [ARV04] for Sparsest Cut can be viewed (in retrospect) as using a constant number of rounds of an SDP hierarchy to improve upon the performance of the basic LP for this problem. Perhaps the most impressive use of super-constant levels of a hierarchy to solve a new problem was the work of Brand ao, Christandl and Yard [BCY11] who used an SDP hierarchy (first proposed by [ DPS04]) to give a quasipolynomial time algorithm for a variant of the quantum separability problem of testing whether a given density matrix corresponds to a separable (i.e., non-entangled) quantum state or is ε-far from all such states (see Section 1.2). One of the reasons for this paucity of positive results is that we have relatively few tools to round such convex hierarchies. A rounding algorithm maps a solution to the relaxation to a solution to the original program.2 In the case of a hierarchy, the relaxation solution satisfies more constraints, but we do not always know how to take advantage of this when rounding. For example, [ARV04] used a very sophisticated anal- ysis to get better rounding when the solution to a Sparsest Cut relaxation satisfies a constraint known as triangle inequalities, but we have no general tools to use the additional constraints that come from higher levels of the hierarchies, nor do we know if these can help in rounding or not. This lack of rounding tech- niques is particularly true for the Sum of Squares (SOS, also known as Lasserre) hierarchy [Par00, Las01].3 1 The book chapter [CT10] is a good source for several of the known upper and lower bounds, though it does not contain some of the more recent ones. 2 While the name derives from the prototypical case of relaxing an integer program to a linear program by allowing the variables to take non-integer values, we use “rounding algorithm” for any mapping from relaxation solutions to actual solutions, even in cases where the actual solutions are themselves non-integer. 3 While it is common in the TCS community to use Lasserre to describe the primal version of this SDP, and Sum of Squares (SOS) 1 This is the strongest variant of the canonical semidefinite p rogramming hierarchies, and has recently shown promise to achieve tasks beyond the reach of weaker hierarchies [BBH+12]. But there are essentially no general rounding tools that take full advantage of its power.4 In this work we propose a general approach to rounding SOS hierarchies, and instantiate this approach in two cases, giving new algorithms making progress on natural variants of two longstanding problems. Our approach is based on the intimate connection between the SOS hierarchy and the “Positivstellensatz” / “Sum of Squares” proof system. This connection was used in previo us work for either negative results [Gri01b, Gri01a, Sch08], or positive results for specific instances [ BBH+12, OZ13, KOTZ14], translating proofs of a bound on the actual value of these instances into proofs of bounds on the relaxation value. In contrast, we use this connection to give explicit rounding algorithms for general instances of certain computational problems. 1.1 The Sum of Squares hierarchy Our work uses the Sum of Squares (SOS) semidefinite programming hierarchy and in particular its re lation- ship with the Sum of Squares (or Positivstellensatz) proof system. We now briefly review both the hierarchy and proof system. See the introduction of [OZ13] and the monograph [Lau09] for a more in depth discus- sion of these concepts and their history. Underlying both the SDP and proof system is the natural approach to prove that a real polynomial P is nonnegative via showing that it equals a sum of squares: P = Pk i=1 Q2 i for some polynomials Q1 , . . . , Qk . The question of when a nonnegative polynomial has such a “ce rtificate of non-negativity” was studied by Hilbert who realized this doesn’t always hold and asked (as his 17th problem) whether a nonnegative polynomial is always a sum of squares of rational functions. This was proven to be the case by Artin, and also follows from the more general Positivstellensatz (or “Positive Locus Theorem ”) [ Kri64, Ste74]. The Positivstellensatz/SOS proof system of Grigoriev and Vorobjov [GV01] is based on the Positivstel- lensatz as a way to refute the assertion that a certain set of polynomial equations P1 ( x1 , . . . , xn ) = . . . = Pk ( x1 , . . . , xn ) = 0 (1.1) can be satisfied by showing that there exists some polynomial s Q1 , . . . , Qk and a sum of squares polynomial S such that X PiQi = 1 + S . ([GV01] considered inequalities as well, although in our context one can always restrict to equalities without loss of generality.) One natural measure for the complexity of such proof is the degree of the polynomials P1Q1 , . . . , Pk Qk and S . The sum of squares semidefinite program was proposed indepen dently by several authors [Sho87, Par00, Nes00, Las01] One way to describe it is as follows. If the set of equalities (1.1) is satisfiable then in particular there exists some random variable X over ’n such that (1.2) … P1 (X1 , . . . , Xn )2 = . . . = … Pk (X1 , . . . , Xn )2 = 0 . (1.3) That is, X is some distribution over the non-empty set of solutions to (1.1). For every degree ℓ, we can consider the linear operator L = Lℓ that maps a polynomial P of degree at most ℓ into the number … P(X1 , . . . , Xn ). Note that by choosing the monomial basis, this operator can to describe the dual, in this paper we use the more descriptive SOS name for both programs. We note that in all the applications we consider, strong duality holds, and so these programs are equivalent. 4 The closest general tool we are aware of is the repeated conditioning methods of [BRS11, GS11], though these can be implemented in weaker hierarchies too and so do not seem to use the full power of the SOS hierarchy. However, this technique does play a role in this work as well. 2 be described by a vector of length nℓ , or equivalently, by an nℓ/2 × nℓ/2 matrix. This operator satisfies the following conditions: Normalization If P is the constant polynomial 1 then LP = 1 Linearity L(P + Q) = LP + LQ for every P, Q of degree 6 ℓ. Positivity LP2 > 0 for every P of degree 6 ℓ/2. Following [BBH+12], we call a linear operator satisfying the above conditions a level ℓ pseudoexpectation function, or ℓ-p.e.f., and use the suggestive notation … P(X ) to denote LP. Correspondingly we will some- times talk about a level ℓ pseudodistribution (or ℓ-p.d.) X , by which we mean that there is an associated level ℓ pseudoexpectation operator. Given the representation of L as an nℓ dimension vector it is possible to efficiently check that it satisfies the above conditions e fficiently, and in particular the positivity condition corresponds to the fact that, when viewed as a matrix, L is positive semidefinite. Thus it is also possible to optimize over the set of operators satisfying these conditions in time nO(ℓ) , and this optimization procedure is known as the SOS SDP hierarchy. Clearly, as ℓ grows, the conditions become stricter. In Appendix A we collect some useful properties of these pseudoexpectations. In particular one can show (see Corollary A.3) that if … P2 (X ) = 0 then … P(X )Q(X ) = 0 for every polynomial Q (as long as Q, P have degrees at most ℓ/2). Thus, if there is a refutation to (1.1) of the form (1.2) where all polynomials involved have degree at most ℓ then there would not exist a level 2ℓ pseudoexpectation operator satisfying (1.3). This connection goes both ways, establishing an equivalence between the degree of Positivstellensatz proofs and the level of the corresponding SOS relaxation. Until recently, this relation was mostly used for negative results, translating proof complexity lower bounds into integrality gap results for the SOS hierarchy [BBH+12, OZ13, KOTZ14]. However, in 2012 Barak, Brand ao, Harrow, Kelner, Steurer and Zhou [ BBH+12] used this relation for positive results, showing that the SOS hierarchy can in fact solve some interesting instances of the Unique Games maximization problem that fool weaker hierarchies. Their idea was to use the analysis of the previous works that proved these integrality gaps for weaker hierarchies. Such proofs work by showing that (a) the weaker hierarchy outputs a large value on this particular instance but (b) the true value is actually small. [BBH+12]’s insight was that oftentimes the proof of (b) only uses arguments that can be captured by the SOS/Positivstellensatz proof system, and hence inadvertently shows that the SOS SDP value is actually small as well. Some follow up works [OZ13, KOTZ14] extended this to other instances, but all these results held for very specific instances which have been proven before to have small objective value. In this work we use this relation to get some guarantees on the performance of the SOS SDP on general instances. We give a more detailed overview of our approach in Section 2, but the high level idea is as follows. For particular optimization problems, we design a “rounding algorithm ” that on input the moment matrix of a distribution on actual solutions achieving a certain value ν, outputs a solution with some value ν which is a function of ν. We call such an algorithm a combining algorithm, since it “combines” a distribution over solutions into a single one. (Note that the solution output by the combining algorithm need not be in the support of the distribution, and generally, when ν , ν, it won’t be.) We then “lift” the analysis of this combining algorithm into the SOS framework, by showing that all the arguments can be captured in this proof system. This in turns implies that the algorithm would still achieve the value ν even if it is only given a pseudoexpectation of the distribution of sufficiently high level ℓ, and hence in fact this combining algorithm is a rounding algorithm for the level ℓ SOS hierarchy. We apply this idea to obtain new results for two applications— optimizing polynomials with nonnegativ e coefficients over the unit sphere, and finding “analytically sparse” vectors inside a subspace. Remark 1.1 (Relation to the Unique Games Conjecture.). While the SOS hierarchy is relevant to many algorithmic applications, some recent work focused on its relation to Khot’s Unique Games Conjecture 3 (UGC) [Kho02]. On a high level, the UGC implies that the basic semidefinite program is an optimal efficient algorithm for many problems, and hence in particular using additional constant or polylogarithmic levels of the SOS hierarchy will not help. More concretely, as discussed in Section 1.3 below, the UGC is closely related to the question of how hard it is to find sparse (or “ana lytically sparse”) vectors in a given subspace. Our work shows how the SOS hierarchy can be useful in general, and in particular gives strong average- case results and nontrivial worst-case results for finding s parse vectors in subspaces. Therefore, it can be considered as giving some (far from conclusive) evidence that the UGC might be false. 1.2 Optimizing polynomials with nonnegative coefficients bounded spectral norm Our first result yields an additive approximation to this optimization problem for polynomials with non- negative coefficients, when the value is scaled by the spectral norm of an associated matrix. If P is an n-variate degree-t homogeneous polynomial with nonnegative coefficient, then it can be represented by a tensor M ∈ ’nt such that P( x) = M · x⊗t for every x ∈ ’n . It is convenient to state our result in terms of this tensor representation: Theorem 1.2. There is an algorithm A, based on O(t log n/ε2 ) levels of the SOS hierarchy, such that for every even5 t and nonnegative M ∈ ’nt , M · x⊗t 6 A(M ) 6 max M · x⊗t + εkM k s pectral , max k xk=1 k xk=1 where · denotes the standard dot product, and kM k s pectral denotes the spectral norm of M , when considered as an nt/2 × nt/2 matrix. Note that the algorithm of Theorem 1.2 only uses a logarithmic number of levels, and thus it shows that this fairly natural polynomial optimization problem can be solved in quasipolynomial time, as opposed to the exponential time needed for optimizing over general polynomials of degree > 2. Indeed, previous work on the convergence of the Lasserre hierarchy for general polynomials [DW12] can be described in our language here as trying to isolate a solution in the support of the distribution, and this generally requires a linear number of levels. Obtaining the logarithmic bound here relies crucially on constructing a “combined” solution that is not necessarily in the support. The algorithm is also relatively simple, and so serves as a good demonstration of our general approach. Relation to quantum information theory. An equivalent way to state this result is that we get an ε additive approximation in the case that kM k s pectral 6 1, in which case the value maxk xk=1 M · x⊗t is in the interval [0, 1]. This phrasing is particularly natural in the context of quantum information theory. A general (potentially mixed) quantum state on 2ℓ-qubits is represented by a an n2 × n2 density matrix ρ for n = 2ℓ ; ρ is a positive semidefinite matrix and has trace 1. If ρ is separable, which means that there is no entanglement between ℓ qubits and the second ℓ qubits, then ρ = … x x∗ ⊗ yy∗ for some distribution over x, y ∈ ƒn , where the first v∗ denotes the complex adjoint operation. If we further restrict the amplitudes of the states to be real, and enforce symmetry on the two halves, then this would mean that ρ = … x⊗4 . (All our results should generalize to states without those restrictions to symmetry and real amplitudes, which we make just to simplify the statement of the problem and the algorithm.) A quantum measurement operator over this space is an n2 × n2 matrix M of spectral norm 6 1. The probability that the measurement accepts a state ρ is Tr(Mρ). Finding an algorithm that, given a measurement M , finds the separable state ρ that maximizes this probability is an important question in quantum information theory which amounts to finding a classical upper bound for the complexity class QMA(2) of Quantum Merlin Arthur proofs with two independent provers [HM13]. Note k xk=1 M · x⊗4 , and hence that if we consider symmetric real states then this is the same as finding argmax 5 The algorithm easily generalizes to polynomials of odd degree t and to non-homogenous polynomials, see Remark 3.5. 4 dropping the non-negativity constraint in our result would resolve this longstanding open problem. There is a closely related dual form of this question, known as the quantum separability problem, where one is given a quantum state ρ and wants to find the test M that maximizes (1.4) Tr(Mρ′ ) Tr(Mρ) − max ρ′ separable or to simply distinguish between the case that this quantity is at least ε and the case that ρ is separable. The best result known in this area is the paper [BCY11] mentioned above, which solved the distinguishing variant of quantum separability problem in the case that measurements are restricted to so-called Local Operations and one-way classical communication (one-way LOCC) operators. However, they did not have an rounding algorithm, and in particular did not solve the problem of actually finding a separable state that maximizes the probability of acceptance of a given one-way LOCC measurement. The techniques of this work were used by Brand ao and Harrow [ BH13] to solve the latter problem, and also greatly simplify the proof of [BCY11]’s result, which originally involved relations between several measures of entanglement proved in several papers.6 For completeness, in Appendix C we give a short proof of this result, specialized to the case of real vec- tors and polynomials of degree four (corresponding to quantum states of two systems, or two prover QMA proofs). We also show in Appendix B that in the case the measurement satisfies the stronger condi tion of having its ℓ2 (i.e., Frobenius) norm be at most 1, there is a simpler and more efficient algorithm for estimat- ing the maximum probability the measurement accepts a separable state, giving an ε additive approximation in poly(n) exp(poly(1/ε)) time. In contrast, [BCY11]’s algorithm took quasipolynomial time even in this case. Relation to small set expansion. Nonnegative tensors also arise naturally in some applications, and in partic- ular in the setting of small set expansion for Cayley graphs over the cube, which was our original motivation to study them. In particular, one corollary of our result is: Corollary 1.3 (Informally stated). There is an algorithm A, based on poly(K (G)) log n levels of the SOS hierarchy, that solves the Small Set Expansion problem on Cayley graphs G over †ℓ 2 (where ℓ = log n) where K (G) is a parameter bounding the spectral norm of an operator related to G’s top eigenspace. We discuss the derivation and the meaning of this corollary in Section 6 but note that the condition of having small value K (G) seems reasonable. Having K (G) = O(1) implies that the graph is a small set expander, and in particular the known natural examples of Cayley graphs that are small set expanders, such as the noisy Boolean hypercube and the “short code” graph of [ BGH+12] have K (G) = O(1). Thus a priori one might have thought that a graph that is hard to distinguish from small set expanders would have a small value of K (G). 1.3 Optimizing hypercontractive norms and finding analytic ally sparse vectors Finding a sparse nonzero vector inside a d dimensional linear subspace V ⊆ ’n is a natural task arising in many applications in machine learning and optimization (e.g., see [DH13] and the references therein). Related problems are known under many names including the “s parse null space”, “dictionary learning”, “blind source separation”, “min unsatisfy”, and “certifyi ng restricted isometry property” problems. (These problems all have the same general flavor but di ffer on various details such as worst-case vs. average case, affine vs. linear subspaces, finding a single vector vs. a basis, a nd more.) Problems of this type are often NP-hard, with some hardness of approximation results known, and conjectured average-case hardness (e.g., see [ABSS97, KZ12, GN10] and the references therein). 6The paper [BH13] was based on a previous version of this work [BKS12] that contained only the results for nonnegative tensors. 5 We consider a natural relaxation of this problem, which we call the analytically sparse vector problem (ASVP), which assumes the input subspace (almost) contains an actually sparse 0/1 vector, but allows the kvk4 /kvk2 is large. More algorithm to find a vector v ∈ V that is only “analytically sparse” in the sense that q p i )1/q /(E i v i )1/ p > µ1/q−1/ p . formally, for q > p and µ > 0, we say that a vector v is µ Lq /L p -sparse if (…i v That is, a vector is µ Lq/L p -sparse if it has the same q-norm vs p-norm ratio as a 0/1 vector of measure at most µ. This is a natural relaxation, and similar conditions have been considered in the past. For example, Spielman, Wang, and Wright [SWW12] used in their work on dictionary learning a subroutine finds a vector v in a subspace that maximizes the ratio kvk∞ /kvk1 (which can be done efficiently via n linear programs). However, because any subspace of dimension d contains an O(1/ √d) L∞/L1 -sparse vector, this relaxation can only detect the existence of vectors that are supported on less than O(n/ √d) coordinates. Some works have observed that the L2 /L1 ratio is a much better proxy for sparsity [ZP01, DH13], but computing it is a non-convex optimization problem for which no efficient algorithm is known. Similarly, the L4/L2 ratio is a good proxy for sparsity for subspaces of small dimension (say d = O( √n)) but it is non-convex, and it is not known how to efficiently optimize it.7 Nevertheless, because kvk4 4 is a degree 4 polynomial, the problem of maximizing it for v ∈ V of unit norm amounts to a polynomial maximization problem over the sphere, that has a natural SOS program. Indeed, [BBH+12] showed that this program does in fact yield a good approximation of this ratio for random subspaces. As we show in Section 5, we can use this to improve upon the results of [DH13] and find planted sparse vectors in random subspaces that are of not too large a dimension: Theorem 1.4. There is a constant c > 0 and an algorithm A, based on O(1)-rounds of the SOS program, such that for every vector v0 ∈ ’n supported on at most cn min(1, n/d2 ) coordinates, if v1 , . . . , vd are chosen independently at random from the Gaussian distribution on ’n , then given any basis for V = span{v0 , . . . , vd } as input, A outputs an ε-approximation of v0 in poly(n, log(1/ε)) time. In particular, we note that this recovers a planted vector with up to Ω(n) nonzero coordinates when d 6 √n, and it can recover vectors with more than the O(n/ √d) nonzero coordinates that are necessary for existing techniques whenever d ≪ n2/3 . Perhaps more significantly, we prove the following nontrivi al worst-case bound for this problem: Theorem 1.5. There is a polynomial-time algorithm A, based on O(1) levels of the SOS hierarchy, that on input a d-dimensional subspace V ⊆ ’n such that there is a 0/1-vector v ∈ V with at most µn nonzero coordinates, A(V ) outputs an O(µd1/3 ) L4 /L2 -sparse vector in V . Moreover, this holds even if v is not completely inside V but only satisfies kΠV vk2 2 > (1 − ε)kvk2 2 , for some absolute constant ε > 0, where ΠV is the projector to V . The condition that the vector is 0/1 can be significantly relaxed, see Remark 4.12. Theorem 4.1 is also motivated by the Small Set Expansion problem. The current best known algorithms for Small Set Expansion and Unique Games [ABS10] reduce these problems into the task of finding a sparse vecto r in a subspace, and then find this vector using brute force enumera tion. This enumeration is the main bottleneck 7 It seems that what makes our relaxation different from the original problem is not so much the qualitative issue of considering analytically sparse vectors as opposed to actually sparse vectors, but the particular choice of the L4/L2 ratio, which on one hand seems easier (even if not truly easy) to optimize over than the L2/L1 ratio, but provides better guarantees than the L ∞ /L1 ratio. However, this choice does force us to restrict our attention to subspaces of low dimension, while in some applications such as certifying the restricted isometry property, the subspace in question is often the kernel of a “short and fat ” matrix, an d hence is almost full dimensional. Nonetheless, we believe it should be possible to extend our results to handle subspaces of higher dimension, perhaps at the some mild cost in the number of rounds. 6 in improving the algorithms’ performance.8 [BBH+12] showed that, at least for the Small Set Expansion question, finding an L4/L2 analytically sparse vector would be good enough. Using their work we obtain the following corollary of Theorem 1.5: Corollary 1.6 (Informally stated). There is an algorithm that given an n-vertex graph G that contains a set S of size o(n/d1/3 ) with expansion at most ε, outputs a set S ′ of measure δ = o(1) with expansion bounded away from 1, i.e., Φ(S ) 6 1 − Ω(1), where d is the dimension of the eigenspace of G’s random walk matrix corresponding to eigenvalues larger than 1 − O(ε). The derivation and meaning of this result is discussed in Section 6. We note that this is the first result that gives an approximation of this type to the small set expansion in terms of the dimension of the top eigenspace, as opposed to an approximation that is polynomial in the number of vertices. 1.4 Related work Our paper follows the work of [BBH+12], that used the language of pseudoexpectation to argue that the SOS hierarchy can solve specific interesting instances of Unique Games, and perhaps more importantly, how it is often possible to almost mechanically “lift” arguments abo ut actual distributions to the more general setting of pseudodistribution. In this work we show how the same general approach be used to obtain positive results for general instances. The fact that LP/SDP solutions can be viewed as expectations of distributions is well known, and several rounding algorithms can be considered as trying to “reverse engineer” a relaxation solution to get a good distribution over actual solutions. Techniques such as randomized rounding, the hyperplane rounding of [GW95], and the rounding for TSP [GSS11, AKS12] can all be viewed in this way. One way to summarize the conceptual difference be- tween our techniques and those approaches is that these previous algorithms often considered the relaxation solution as giving moments of an actual distribution on “fake” solutions. For example, in [GW95]’s Max Cut algorithm, where actual solutions are modeled as vectors in {±1}n , the SDP solution is treated as the moment matrix of a Gaussian distribution over real vectors that are not necessarily ±1-valued. Similarly in the TSP setting one often considers the LP solution to yield moments of a distribution over spanning trees that are not necessarily TSP tours. In contrast, in our setting we view the solution as providing moments of a “fake” distribution on actual solutions. Treating solutions explicitly as “fake distributions” is p revalent in the literature on negative results (i.e., integrality gaps) for LP/SDP hierarchies. For hierarchies weaker than SOS, the notion of “fake” is di fferent, and means that there is a collection of local distributions, one for every small subset of the variables, that are consistent with one another but do not necessarily correspond to any global distribution. Fake distributions are also used in some positive results for hierarchies, such as [BRS11, GS11], but we make this more explicit, and, crucially, make much heavier use of the tools afforded by the Sum of Squares relaxation. The notion of a “combining algorithm ” is related to the notio n of polymorphisms [BJK05] in the study of constraint satisfaction problems. A polymorphism is a way to combine a number of satisfying assign- ments of a CSP into a different satisfying assignments, and some relations between polymorphism, their generalization to approximation problems, rounding SDP’s are known (e.g., see the talk [Rag10]). The main difference is polymorphisms operate on each bit of the assignment independently, while we consider here combining algorithms that can be very global. 8 This is the only step that takes super-polynomial time in [ABS10]’s algorithm for Small Set Expansion. Their algorithm for Unique Games has an additional divide and conquer step that takes subexponential time, but, in our opinion, seems less inherently necessary. Thus we conjecture that if the sparse-vector find ing step could be sped up then it would be possible to speed up the algorithm for both problems. 7 In a follow up (yet unpublished) work, we used the techniques of this paper to obtain improved results for the sparse dictionary learning problem, recovering a set of vectors x1 , . . . , xm ∈ ’n from random samples of µ-sparse linear combinations of them for any µ = o(1), improving upon previous results that required µ ≪ 1/ √n [SWW12, AGM13, AAJ+13]. 1.5 Organization of this paper In Section 2 we give a high level overview of our general approach, as well as proof sketches for (special cases of) our main results. Section 3 contains the proof of Theorem 1.2— a quasipolynomial time algorithm to optimize polynomials with nonnegative coefficients over the sphere. Section 4 contains the proof of The- orem 1.5 — a polynomial time algorithm for an O(d1/3 )-approximation of the “analytical sparsest vector in a subspace” problem. In Section 5 we show how to use the notion of analytical sparsity to solve the question of finding a “planted” sparse vector in a random subspace. Sec tion 6 contains the proofs of Corollaries 1.3 and 1.6 of our results to the small set expansion problem. Appendix A contains certain technical lemmas showing that pseudoexpectation operators obey certain inequalities that are true for actual expectations. Ap- pendix C contains a short proof (written in classical notation, and specialized to the real symmetric setting) of [BCY11, BH13]’s result that the SOS hierarchy yields a good approximation to the acceptance proba- bility of QMA(2) verifiers / measurement operators that have bounded one-way LOCC norm. Appendix B shows a simpler algorithm for the case that the verifier satis fies the stronger condition of a bounded L2 (Frobenius) norm. For the sake of completeness, Appendix D reproduces the proof from [BBH+12] of the relation between hypercontractive norms and small set expansion. Our papers raises many more questions than it answers, and some discussion of those appears in Section 7. 1.6 Notation Norms and inner products. We will use linear subspaces of the form V = RU where U is a finite set with an associated measure µ : U → [0, ∞]. The p-norm of a vector v ∈ V is de fined as kvk p = (cid:0)Pω∈U µ(ω)vω p (cid:1)1/ p . Similarly, hu, vi = Pω∈U µ(ω)uω vω . We will only use two measures in this work: the the inner product of v, w ∈ V is de fined as counting measure, where µ(ω) = 1 for every ω ∈ U , and the uniform measure, where µ(ω) = 1/U for all ω ∈ U . (The norms corresponding to this measure are often known as the expectation norms.) We will use vector notation (i.e., letters such as u, v, and indexing of the form ui ) for elements of subspaces with the counting measure, and function notation (i.e., letters such as f , g and indexing of the form f ( x)) for elements of subspaces with the uniform measure. The dot product notation u · v will be used exclusively for the inner product with the counting measure. Pseudoexpectations. We use the notion of pseudoexpectations from [BBH+12]. A level ℓ pseudoexpectation function (ℓ-p.e.f.) …X is an operator mapping a polynomial P of degree at most ℓ into a number denoted by … x∼X P( x) and satisfying the linearity, normalization, and positivity conditions as stated in Section 1.1. We sometimes refer to X as a level ℓ pseudodistribution (ℓ-p.d.) by which we mean that there exists an associated pseudoexpectation operator.9 If P, Q are polynomials of degree at most ℓ/2, and …X is an ℓ-p.e.f., we say that …X is consistent with the constraint … x∼X P( x)2 = 0. We say that it is consistent with the constraint Q( x) > 0, if it consistent with P( x) ≡ 0 if it satisfies the constraint Q( x) − S ( x) ≡ 0 for some polynomial S of degree 6 ℓ/2 which is a sum of squares. (In the context of optimization, to enforce the inequality constraint Q( x) > 0, it is always possible to add an auxiliary variable y and then enforce the equality constraint Q( x) − y2 ≡ 0.) Appendix A contains several useful facts about pseudoexpectations. 9 In the paper [BBH+12] we used the name level ℓ fictitious random variable for X, but we think the name pseudodistribution is better as it is more analogous to the name pseudoexpectation. The name “pseudo random variable” would of course be much too confusing. 8 2 Overview of our techniques Traditionally to design a mathematical-programming based approximation algorithm for some optimization problem O, one first decides what the relaxation is— i.e., whether it is a linear program, semidefinite pro- gram, or some other convex program, and what constraints to put in. Then, to demonstrate that the value of the program is not too far from the actual value, one designs a rounding algorithm that maps a solution of the convex program into a solution of the original problem of approximately the same value. Our approach is conceptually different— we design the rounding algorithm first, analyze it, an d only then come up with the relaxation. Initially, this does not seem to make much sense— how can you d esign an algorithm to round solutions of a relaxation when you don’t know what the relaxation is? We do this by considering an idealized version of a rounding algorithm which we call a combining algorithm. Below we discuss this in more detail but roughly speaking, a combining algorithm maps a distribution over actual solutions of O into a single solu- tion (that may or may not be part of the support of this distribution). This is a potentially much easier task than rounding relaxation solutions, and every rounding algorithm yields a combining algorithm. In the other direction, every combining algorithm yields a rounding algorithm for some convex programming relaxation, but in general that relaxation could be of exponential size. Nevertheless, we show that in several interesting cases, it is possible to transform a combining algorithm into a rounding algorithm for a not too large relax- ation that we can efficiently optimize over, thus obtaining a feasible approximation algorithm. The main tool we use for that is the Sum of Squares proof system, which allows to lift certain arguments from the realm of combining algorithms to the realm of rounding algorithms. We now explain more precisely the general approach, and then give an overview of how we use this approach for our two applications— finding “analytically sp arse” vectors in subspaces, and optimizing poly- nomials with nonnegative coefficients over the sphere. Consider a general optimization problem of minimizing some objective function in some set S , such as the n dimensional Boolean hypercube or the unit sphere. A convex relaxation for this problem consists of an embedding that maps elements in S into elements in some convex domain, and a suitable way to generalize the objective function to a convex function on this domain. For example, in linear programming relaxations we typically embed {0, 1}n into the set [0, 1]n , while in semidefinite programming relaxations we might embed {0, 1}n into the set of n × n positive semidefinite matrices using the map x 7→ X where Xi, j = xi xk . Given this embedding, we can use convex programming to find t he element in the convex domain that maximizes the objective, and then use a rounding algorithm to map this element back into the domain S in a way that approximately preserves the objective value. A combining algorithm C takes as input a distribution X over solutions in S and maps it into a single element C (X) of S , such that the objective value of C (X) is approximately close to the expected objective value of a random element in X. Every rounding algorithm R yields a combining algorithm C . The reason is that if there is some embedding f mapping elements in S into some convex domain T , then for every distribution X over S , we can define yX to be … x∈X f ( x). By convexity, yX will be in T and its objective value will be at most the average objective value of an element in X. Thus if we define C (X) to output R(yX ) then C will be a combining algorithm with approximation guarantees at least as good as R’s. In the other direction, because the set of distributions over S is convex and can be optimized over by an O(S )-sized linear program, every combining algorithm can be viewed as a rounding algorithm for this program. However, S is typically exponential in the bit description of the input, and hence this is not a very useful program. In general, we cannot improve upon this, because there is always a trivially lossless combining algorithm that “combines” a distribution X into a single solution x of the same expected value by simply sampling x from X at random. Thus for problems where getting an exact value is exponentially hard, this combining algorithm cannot be turned into a rounding algorithm for a subexponential-sized efficiently- 9 optimizable convex program. However it turns out that at least in some cases, nontrivial combining algo- rithms can be turned into a rounding algorithm for an efficient convex program. A nontrivial combining algorithm C has the form C (X) = C ′(M (X)) where C ′ is an efficient (say polynomial or quasipolynomial time) algorithm and M (X) is a short (say polynomial or quasipolynomial size) digest of the distribution X. In all the cases we consider, M (X) will consist of all the moments up to some level ℓ of the random variable X, or some simple functions of it. That is, typically M (X) is a vector in ’mℓ such that for every i1 , . . . , iℓ ∈ [m], Mi1 ,...,iℓ = …x∼X xi1 · · · xiℓ . We do not have a general theorem showing that any nontrivial combining algo- rithm can be transformed into a rounding algorithm for an efficient relaxation. However, we do have a fairly general “recipe” to use the analysis of nontrivial combining algorithms to transform them into rounding al- gorithms. The key insight is that many of the tools used in such analyses, such as the Cauchy–Schwarz and H older inequalities, and other properties of distributions, fall under the “Sum of Squares” proof framework, and hence can be shown to hold even when the algorithm is applied not to actual moments but to so-called rogramming hierarchy. “pseudoexpectations” that arise from the SOS semidefinite p We now turn to giving a high level overview of our results. For the sake of presentations, we focus on certain special cases of these two applications, and even for these cases omit many of the proof details and only provide rough sketches of the proofs. The full details can be found in Sections 5, 4 and 3. 2.1 Finding a planted sparse vector in a random low-dimensional subspace We consider the following natural problem, which was also studied by Demanet and Hand [DH13]. Let f0 ∈ ’U be a sparse function over some universe U of size n. That is, f0 is supported on at most µn coordinates for some µ = o(1). Let V be the subspace spanned by f0 and d random (say Gaussian) functions f1 , . . . , fd ∈ ’U . Can we recover f0 from any basis for V ? Demanet and Hand showed that if µ is very small, specifically µ ≪ 1/ √d , then f0 would be the most L∞ /L1 -sparse function in V , and hence (as mentioned above) can be recovered efficiently by running n linear programs. The SOS framework yields a natural and easy to describe algorithm for recovering f0 as long as µ is a sufficiently small constant and the dimension d is at most O( √n). The algorithm uses the SOS program for finding the most L4/L2 -sparse function in V , which, as mentioned above, is simply the polynomial optimization problem of maximizing k f k4 4 over f in the intersection of V and the unit Euclidean sphere. Since f0 itself is in particular µ L4 /L2 -sparse , the optimum for the program is at least µ. Thus a combining algorithm would get as input a distribution D over functions f ∈ V satisfying k f k2 = 1 and k f k4 4 > 1/µ, and need to output a vector closely correlated with f0 .10 (We use here the expectation norms, namely p p = …ω f (ω) p .) For simplicity, assume that the fi ’s are orthogonal to f0 (they are nearly orthogonal, and k f k so everything we say below will still hold up to a sufficiently good approximation, see Section 5). In this case, we can write every f in the support of D as f = h f0 , f i f0 + f ′ where f ′ ∈ V ′ = span{ f1 , . . . , fd }. It is not hard to show using standard concentration of measure results (see e.g., [BBH+12, Theorem 7.1]) that if d = O( √n) then every f ′ ∈ V ′ satisfies k f ′ k4 6 C k f ′ k2 , (2.1) for some constant C . Therefore using triangle inequality, and using the fact that k f ′ k2 6 k f k2 = 1, it must hold that 6 k f k4 6 h f , f0 iµ−1/4 + C µ−1/4 (2.2) or for µ = o(1). h f , f0 i > 1 − Cµ1/4 = 1 − o(1) (2.3) 10 Such a closely correlated vector can be corrected to output f0 exactly, see Section 5. 10 In particular this implies that if we apply a singular value decomposition (SVD) to the second moment matrix D of D (i.e., D = … f ∈D f ⊗2 ) then the top eigenvector will have 1 − o(1) correlation with f0 , and hence we can simply output it as our solution. To make this combining algorithm into a rounding algorithm we use the result of [BBH+12] that showed that (2.1) can actually be proven via a sum of squares argument. Namely they showed that there is a degree 4 sum of squares polynomial S such that kΠ′ f k4 4 + S ( f ) = C 4 k f k4 2 . (2.4) implies that even if D is merely a pseudodistribution then it must satisfy (2.1). (When the latter is raised to the fourth power to make it a polynomial inequality.) We can then essentially follow the argument, proving a version of (2.2) raised to the 4th power by appealing to the fact that pseudodistributions satisfy H older’s inequality, (Corollary A.11) and hence deriving that D will satisfy (2.3), with possibly slightly worse constants, even when it is only a pseudodistribution. In Section 5, we make this precise and extend the argument to obtain nontrivial (but weaker) guarantees when d > √n. We then show how to use an additional correction step to recover the original function f0 up to arbitrary accuracy, thus boosting our approximation of f0 into an essentially exact one. (2.4) 2.2 Finding “analytically sparse” vectors in general subsp aces We now outline the ideas behind the proof of Theorem 4.1 — finding analytically sparse vectors in general (as opposed to random) subspaces. This is a much more challenging setting than random subspaces, and indeed our algorithm and its analysis is more complicated (though still only uses a constant number of SOS levels), and at the moment, the approximation guarantee we can prove is quantitatively weaker. This is the most technically involved result in this paper, and so the reader may want to skip ahead to Section 2.3 where we give an overview of the simpler result of optimizing over polynomials with nonnegative coefficients. We consider the special case of Theorem 4.1 where we try to distinguish between a YES case where there is a 0/1 valued o(d−1/3 )-sparse function that is completely contained in the input subspace, and a NO case where every function in the subspace has its four norm bounded by a constant times its two norm. That is, we suppose that we are given some subspace V ⊆ ’U of dimension d and a distribution D over functions f : U → {0, 1} in V such that (cid:144)ω∈U [ f (ω) = 1] = µ for every f in the support of D, and µ = o(d−1/3 ). The goal of our combining algorithm to output some function g ∈ V such that kgk4 4 = …ω g(ω)4 ≫ (…ω g(ω)2 )2 = kgk4 2 . (Once again, we use the expectation inner product and norms, with uniform measure over U .) Since the f ’s correspond to sets of measure µ, we would expect the inner product h f , f ′ i of a typical pair f , f ′ (which equals the measure of the intersection of the corresponding sets) to be roughly µ2 . Indeed, one can show that if the average inner product h f , f ′ i is ω(µ2 ) then it’s easy to find such a desired function g. Intuitively, this is because in this case the distribution D of sets does not have an equal chance to contain all the elements in U , but rather there is some set I of o(U ) coordinates which is favored by D. Roughly speaking, that would mean that a random linear combination g of these functions would have most of its mass concentrated inside this small set I , and hence satisfy kgk4 ≫ kgk2 . But it turns out that letting g be a random gaussian function matching the first two moments of D is equivalent to taking such a random linear combination, and so our combining algorithm can obtain this g using moment information alone. Our combining algorithm will also try all n coordinate projection functions. That is, let δω be the func- tion such that δω (ω′ ) equals n = U if ω = ω′ and equals 0 otherwise, (and hence under our expectation inner product f (ω) = h f , δω i). The algorithms will try all functions of the form Πδu where Π is the projector to the subspace V . Fairly straightforward calculations show that 2-norm squared of such a function is ex- pected to be (d/n)kδω k2 2 = d, and it turns out in our setting we can assume that the norm is well concentrated around this expectation (or else we’d be able to find a good sol ution in some other way). Thus, if coordinate 11 projection fails then it must hold that (2.5) ω,ω′hΠδω , δω′ i4 . ω kΠδω k4 ω kΠδω k4 O(d2 ) = O(… 2 ) > … 4 = … It turns out that (2.5) implies some nontrivial constraints on the distribution D. Specifically we know that f ∼Dk f k4 f ∼D,ω∈Uh f , δω i4 . µ = … 4 = … But since f = Π f and Π is symmetric, the RHS is equal to (Πδω )⊗4 k2 , f ⊗4 k2 k … (Πδω )⊗4 i 6 k … f ⊗4 , … f ∼D,ω∈Uh f , Πδω i4 = h … … f ∼D f ∼D ω∈U ω∈U where the last inequality uses Cauchy–Schwarz. If we square this inequality we get that (Πδω )⊗4 i = … f , f ′∼Dh f , f ′ i4 ! … ω,ω′ hΠδω , Πδω′ i4 ! . f ⊗4 , … f ⊗4 ih … (Πδω )⊗4 , … 6 h … ω∈U ] f ∼D f ∼D ω∈U But since is a projector satisfying Π = Π2 , we can use (2.5) and obtain that f , f ′ ∼Dh f , f ′ i4 . Ω(µ2/d2 ) 6 … µ2 Since d = o(µ−3 ) this means that (2.6) f , f ′∼Dh f , f ′ i4 ≫ µ8 . … Equation (2.6), contrasted with the fact that … f , f ′ ∼D h f , f ′ i = O(µ2 ), means that the inner product of two random functions in D is somewhat “surprisingly unconcentrated”, which seems to be a nontrivial piece of information about D.11 Indeed, because the f ’s are nonnegative functions, if we pick a random u and consider the distribution Du where the probability of every function is reweighed proportionally to f (u), then intuitively that should increase the probability of pairs with large inner products. Indeed, as we show in Lemma A.4, one can use H older’s inequality to prove that there exist ω1 , . . . , ω4 such that under the distribution D′ where every element f is reweighed proportionally to f (ω1 ) · · · f (ω4 ), it holds that f , f ′ ∼Dh f , f ′ i4 !1/4 f , f ′ ∼D′ h f , f ′ i > … … (2.7) and (2.6) together imply that E f , f ′∼D′ h f , f ′ i ≫ µ2 , which, as mentioned above, means that we can find a function g satisfying kgk4 ≫ kgk2 by taking a gaussian function matching the first two moments o f D′ . Once again, this combining algorithm can be turned into an algorithm that uses O(1) levels of the SOS hierarchy. The main technical obstacle (which is still not very hard) is to prove another appropriate general- ization of H older’s inequality for pseudoexpectations (see Lemma A.4). Generalizing to the setting that in the YES case the function is only approximately in the vector space is a bit more cumbersome. We need to consider apart from f the function f that is obtained by first projecting f to the subspace and then “truncat- ing” it by rounding each coordinate where f is too small to zero. Because this truncation operation is not a low degree polynomial, we include the variables corresponding to f as part of the relaxation, and so our pseudoexpectation operator also contains the moments of these functions as well. (2.7) . 11 Interestingly, this part of the argument does not require µ to be o(d−1/3 ), and some analogous “non-concentration” property of D can be shown to hold for a hard to round D for any µ = o(1). However, we currently know how to take advantage of this property to obtain a combining algorithm only in the case that µ ≪ d−1/3 . 12 2.3 Optimizing polynomials with nonnegative coefficients (2.8) Mi, j,k,l xi x j xk xl , We now consider the task of maximizing a polynomial with nonnegative coefficients over the sphere, namely proving Theorem 3.1. We consider the special case of Theorem 3.1 where the polynomial is of degree 4. That is, we are given a parameter ε > 0 and an n2 × n2 nonnegative matrix M with spectral norm at most 1 and want to find an ε additive approximation to the maximum of Xi, j,k,l over all x ∈ Rn with k xk = 1, where in this section we let k xk be the standard (counting) Euclidean norm k xk = qPi x2 i . One can get some intuition for this problem by considering the case where M is 0/1 valued and x is 0/k−1/2 valued for some k. In this case one can think of M is a 4-uniform hypergraph on n vertices and x as a subset S ⊆ [n] that maximizes the number of edges inside S divided by S 2 , and so this problem is related to some type of a densest subgraph problem on a hypergraph.12 Let’s assume that we are given a distribution X over unit vectors that achieve some value ν in (2.8). This is a non convex problem, and so generally the average of these vectors would not be a good solution. However, it turns out that the vector x∗ defined such that x∗i = q… x∼X x2 i can sometimes be a good solution for this problem. Specifically, we will show that if it fails t o give a solution of value at least c − ε, then we can find a new distribution X′ obtained by reweighing elements X that is in some sense “simpler” than X. More precisely, we will define some nonnegative potential fu nction Ψ such that Ψ(X) 6 log n for all X and Ψ(X′ ) 6 Ψ(X) − Ω(ε2 ) under the above conditions. This will show that we will need to use this reweighing step at most logarithmically many times. Indeed, suppose that Xi, j,k,l Mi, j,k,l x∗i x∗j x∗k x∗l = ( x∗ ⊗2 )T M x∗⊗2 6 ν − ε . (2.9) We claim that in contrast yT My > ν , where y is the n2 -dimensional vector defined by yi, j = q… x∼X x2 i x2 j . Indeed, (2.10) follows from the non- negativity of M and the Cauchy–Schwarz inequality since Mi, j,k,l r … j r … xi x j xk xl 6 Xi, j,k,l ν = Xi, j,k,l x2 i x2 Mi, j,k,l … x∈X x∼X x∼X Note that since X is a distribution over unit vectors, both x∗ and y are unit vectors, and hence (2.9) and (2.10) together with the fact that M has bounded spectral norm imply that l = yT My k x2 x2 (2.10) ε 6 yT My − ( x∗ ⊗2 )T M x∗⊗2 = (y − x∗ ⊗2 )T M (y + x∗ ⊗2 ) k 6 2ky − x∗⊗2 k · ky + x∗ ⊗2 6 ky − x∗⊗2 (2.11) k . However, it turns out that ky − x∗ ⊗2 k equals √2 times the Hellinger distance of the two distributions D, D∗ over [n] × [n] defined as follows: (cid:144)[D = (i, j)] = … x2 i x2 j while (cid:144)[D∗ = (i, j)] = (… x2 i )(… x2 j ) (see 12 The condition of maximizing E(S )/S 2 is related to the log density condition used by [BCC+10] in their work on the densest S E(S ) > logn E . subgraph problem, since, assuming that the set [n] of all vertices is not the best solution, the set S satisfies that log However, we do not know how to use their algorithm to solve this problem. Beyond the fact that we consider the hypergraph setting, their algorithm manages to find a set of nontrivial density un der the assumption that there is a “log dense” subset, but it i s not guaranteed to find the “log dense” subset itself. 13 Section 3). At this point we can use standard information theoretic inequalities to derive from (2.11) that there is Ω(ε2 ) mutual information between the two parts of D. Another way to say this is that the entropy of the second part of D drops on average by Ω(ε2 ) if we condition on the value of the first part. To say the same thing mathematically, if we define D(X) to be the distribution (… x∼X x2 1 , . . . , …x∼X x2 n ) over [n] and D(Xi) to 1 1 , . . . , … x∼X x2 i x2 i x2 (… x∼X x2 n ) then be the distribution …x∼X x2 i H (Xi) 6 H (X) − Ω(ε2 ) . … i∼D(x) But one can verify that D(Xi) = D(Xi ) where Xi is the distribution over x’s such that (cid:144)[Xi = x] = x2 i x]/ …X x2 i , which means that if we define Ψ(X) = H (D(X)) then we get that Ψ(Xi ) 6 Ψ(X) − Ω(ε2 ) … i∼D(x) and hence Ψ is exactly the potential function we were looking for. To summarize our combining algorithm will do the following for t = O(log n/ε2 ) steps: given the first moments of the distribution X, define the vector x∗ as above and test if it yields an objective value of at least ν − ε. Otherwise, pick i with probability … x∼X x2 i and move to the distribution Xi . Note that given d level moments for X, we can compute the d − 1 level moments of Xi , and hence the whole algorithm can be carried out with only access to level O(log n/ε2 ) moments of X. We then see that the only properties of the moments used in this proof are linearity, the fact that P x2 i can always be replaced with 1 in any expression, and the Cauchy–Schwarz inequality used for obtaining ( 2.10). It turns out that all these properties hold even if we are not given access to the moments of a true distribution X but are only given access to a level d pseudoexpectation operator … for d equalling some constant times log n/ε2 . Such pseudoexpectations operators can be optimized over in d levels of the SOS hierarchy, and hence this combining algorithm is in fact a rounding algorithm. (cid:144)[X = 3 Approximation for nonnegative tensor maximization In this section we prove Theorem 1.2, giving an approximation algorithm for the maximum over the sphere of a polynomial with nonnegative coefficients. We will work in the space Rn endowed with the counting measure for norms and inner products. We will define the spectral norm of a degree-2t homogeneous polynomial M in x = x( x1 , . . . , xn ), denoted by kM kspectral , to be the minimum of the spectral norm of Q taken over all quadratic forms Q over (’n )⊗t such that Q( x⊗t ) = M ( x) for every x. Note that we can compute the spectral norm of an homogeneous polynomial in polynomial time using semidefinite programming. Thus we can restate our main theorem of this section as: Theorem 3.1 (Theorem 1.2, restated). Let M be a degree-2t homogeneous polynomial in x = ( x1 , . . . , xn ) with nonnegative coefficients. Then, there is an algorithm, based on O(t2 log n/ε2 ) levels of the SOS hierar- chy, that finds a unit vector x ∗ ∈ ’n such that M ( x∗ ) > max M ( x) − εkM kspectral . x∈’n ,k xk=1 To prove Theorem 3.1 we first come up with a combining algorithm, namely an algorithm that takes (the moment matrix of) a distribution X over unit vectors x ∈ Rn such that M ( x) > ν and find a unit vector x∗ such that M ( x∗) > ν − ε. We then show that the algorithm will succeed even if X is merely a level O(t log n/ε2 ) pseudo distribution; that is, the moment matrix is a pseudoexpectation operator. The combining algorithm is very simple: 14 Combining algorithm for polynomials with nonnegative coefficients: Input: distribution X over unit x ∈ ’n such that M ( x) = ν. Operation: Do the following for t2 log n/ε2 steps: Direct rounding: For i ∈ [n], let x∗i = q…x∼X x2 i . If M ( x∗ ) > ν − 4ε then output x∗ and quit. Conditioning: Try to find i1 , . . . , it−1 ∈ [n] such that the distribution Xi1 ,...,it−1 satisfies Ψ(Xi1 ,...,it−1 ) 6 Ψ(X) − ε2/t2 , and set X = Xi1 ,...,it−1 , where: – Xi1 ,...,it−1 is defined by letting (cid:144)[Xi1 ,...,it−1 = x] be proportional to (cid:144)[X = x] · Qt−1 j=1 x2 i j x ∈ ’n . – Ψ(X) is defined to be H (A(X)) where H (·) is the Shannon entropy function and A(X) is the distribution over [n] obtained by letting (cid:144)[A(X) = i] = …x∼X x2 i for every i ∈ [n]. Clearly Ψ(X) is always in [0, log n], and hence if we can show that we always succeed in at least one of the steps, then eventually the algorithm will output a good x∗ . We now show that if the direct rounding step fails, then the conditioning step must succeed. We do the proof under the assumption that X is an actual distribution. Almost of all of this analysis holds verbatim when X is a pseudodistribution of level at least 2t2 log n/ε2 , and we note the one step where the extension requires using a nontrivial (though easy to prove) property of pseudoexpectations, namely that they satisfy the Cauchy–Schwarz inequality. for every Some information theory facts. We recall some standard relations between various entropy and distance measures. Let X and Y be two jointly distributed random variables. We denote the joint distribution of X and Y by {XY }, and their marginal distributions by {X } and {Y }. We let {X }{Y } denote the product of the distribu- tions {X } and {Y } (corresponding to sampling X and Y independently from their marginal distribution). Re- call that the Shannon entropy of X , denoted by H (X ), is defined to be P x∈Support(X ) (cid:144)[X = x] log(− (cid:144)[X = x]). I (X, Y ) def The mutual information of X and Y is defined as = H (X ) − H (X Y ), where H (X Y ) is conditional entropy of X with respect to Y , defined as …y∼{Y } H (X Y = y). The Hellinger distance between two dis- . (In particular, dH ( p, q) equals 1/ √2 times = (cid:16)1 − Pi √ piqi (cid:17)1/2 tributions p and q is defined by dH ( p, q) def the Euclidean distance of the unit vectors √ p and √q.) The following inequality (whose proof follows by combining standard relations between the Hellinger distance, Kullback–Leibler divergence, and mutual information) would be useful for us Lemma 3.2. For any two jointly-distributed random variables X and Y , 2dH (cid:16){XY }, {X }{Y }(cid:17)2 6 I (X, Y ) 3.1 Direct Rounding the probability that Given X, we define the following correlated random variables A1 , . . . , At over [n]: (A1 , . . . , At ) = (i1 , . . . , it ) is equal to …x∼X x2 i1 · · · x2 . Note that for every i, the random variable Ai is dis- it tributed according to A(X). (Note that even if X is only a pseudodistribution, A1 , . . . , At are actual random variables.) The following lemma gives a sufficient condition for our direct rounding step to succeed: Lemma 3.3. Let M, X be as above. If dH ({A1 · · · At }, {A1 } · · · {At }) 6 ε, then the unit vector x∗ with x∗i = (… x∼X x2 i )1/2 satisfies M ( x∗ ) > ν − 4εkM kspectral . Moreover, this holds even if X is a level ℓ > 2t pseudodistribution. 15 Proof. Let Q be a quadratic form with Q( x⊗t ) = M ( x). Let y ∈ (’n )⊗t be the vector yi1 ···it = ( … x∼cX x2 i1 · · · x2 )1/2 . Then, it (3.1) … M ( x∗ ) = h M , … x∗ ⊗2t i 6 h M , y ⊗ yi = Q(y) M ∈ (’n )⊗2t contains the coefficients of M . In particular, M > 0 entry-wise. The Here, the vector … xα xβ 6 ( …( xα )2 · …( xβ )2 )1/2 = yα yβ . The final inequality in (3.1) uses Cauchy–Schwarz; namely that equality in (3.1) uses that y is symmetric. Next, we bound the difference between Q(y) and M ( x∗ ) Q(y) − M ( x∗ ) = Q(y) − Q( x∗ ⊗t ) = hy + x∗ ⊗t , Q(y − x∗⊗t )i 6 kQk · ky + x∗⊗t k · ky − x∗ ⊗t k . (Here, h·, Q ·i denotes the symmetric bilinear form corresponding to Q.) Since both x∗⊗t and y are unit vectors, ky + x∗⊗t k 6 2. By construction, the vector y corre- sponds to the distribution {A1 · · · At } and x∗ ⊗t corresponds to the distribution {A1 } · · · {At }. In particular, dH ({A1 · · · At }, {A1 } · · · {At }) = 1 √2 ky − x∗ ⊗t k. Together with the bounds (3.1) and (3.2), M ( x∗) > … M ( x) − 4kQk · dH ({A1 · · · At }, {A1} · · · {At }) . To verify this carries over when X is a pseudodistribution, we just need to use the fact that Cauchy– Schwarz holds for pseudoexpectations (Lemma A.2). (3.2) (cid:3) 3.2 Making Progress The following lemma shows that if the sufficient condition above is violated, then on expectation we can always make progress. (Because A1 , . . . , At are actual random variables, it automatically holds regardless of whether X is an actual distribution or a pseudodistribution.) Lemma 3.4. If dH ({A1 · · · At }, {A1} · · · {At }) > ε, then H (At A1 · · · At−1 ) 6 H (A) − 2ε2 /t2 Proof. The bound follows by combining a hybrid argument with Lemma 3.2. Let A′1 , . . . , A′t be independent copies of A1 , . . . , At so that {A1 · · · At · · · A′1 · · · A′t } = {A1 · · · At }{A1 } · · · {At } . We consider the sequence of distributions D0 , . . . , Dt with Di = {A1 · Ai · · · A′i+1 · · · A′t } . By assumption, dH (D0 , Dt ) > ε. Therefore, there exists an index i such that dH (Di−1 , Di ) > ε/t. Let X = A1 · · · Ai−1 and Y = AiA′i+1 · · · A′t . Then, Di = {XY } and Di−1 = {X }{Y }. By Lemma 3.2, H (Y ) − H (Y X ) = I (X, Y ) > 2dH ({XY }, {X }{Y }) > 2ε2 /t2 . Since A′i+1 , . . . , A′t are independent of A1 , . . . , Ai , H (Y ) − H (Y X ) = H (Ai ) − H (Ai A1 · · · Ai−1 ) . By symmetry and the monotonicity of entropy under conditioning, we conclude H (At A1 · · · At−1 ) 6 H (A) − 2ε2 /t2 . (cid:3) 16 Lemma 3.4 implies that if our direct rounding fails then the expectation of H (A1 ) conditioned on A2 , . . . , At is at most H (A) − 2ε2 /t2 , but in particular this means there exist i1 , . . . , it−1 so that H (At A1 = i1 , . . . , At−1 = it−1 ) 6 H (A) − 2ε2/t2 . The probability of i under this distribution At A1 = i1 , . . . , At−1 = it−1 i · Qt−1 is proportional to … x∼X x2 j=1 x2 , which means that it exactly equals the distribution A(Xi1 ,...,it−1 ). Thus i j we see that Ψ(Xi1 ,...,it−1 ) 6 Ψ(X) − 2ε2 /t2 . This concludes the proof of Theorem 3.1. (cid:3) Remark 3.5 (Handling odd degrees and non homogenous polynomials). If the polynomial is not homoge- nous but only has monomials of even degree, we can homogenize it by multiplying every monomial with an appropriate power of (P x2 i ) which is identically equal to 1 on the sphere. To handle odd degree monomials we can introduce a new variable x0 and set a constraint that it must be identically equal to 1/2. This way we can represent all odd degree monomials by even degree monomials with a blowup of 2 in the coefficients. Note that if the pseudoexpectation operator is consistent with this constraint then our rounding algorithm will in fact output a vector that satisfies it. 4 Finding an “analytically sparse” vector in a subspace In this section we prove Theorem 1.5. We let U be a universe of size n and L2 (U ) be the vector space of real-valued functions f : U → ’. The measure on the set U is the uniform probability distribution and hence we will use the inner product h f , gi = …ω f (ω)g(ω) and norm k f k p = (…ω f (ω) p )1/ p for f , g : U → ’ and p > 1. Theorem 4.1 (Theorem 1.5, restated). There is a constant ε > 0 and a polynomial-time algorithm A, based on O(1) levels of the SOS hierarchy, that on input a projector operator Π such that there exists a µ-sparse Boolean function f satisfying kΠ f k2 2 > (1 − ε)k f k2 2 , outputs a function g ∈ Image(Π) such that µ(rank Π)1/3 (cid:19) . 4 > Ω (cid:18) kgk4 kgk4 2 We will prove Theorem 4.1 by first showing a combining algorithm and then transforming it into a rounding algorithm. Note that the description of the combining algorithm is independent of the actual relaxation used, since it assumes a true distribution on the solutions, and so we first describe the algorithm before specifying the relaxation. In our actual relaxation we will use some auxiliary variables that will make the analysis of the algorithm simpler. Combining algorithm for finding an analytically sparse vect or: Input: Distribution D over Boolean (i.e., 0/1 valued) functions f ∈ L2 (U ) that satisfy: – µ( f ) = (cid:144)[ f (ω) = 1] = 1/λ. 2 > (1 − ε)k f k2 kΠ f k2 2 . Goal: Output g such that Operation: Do the following: kgk4 4 > γkgk2 2 where γ = Ω(1/µ(rank Π)1/3 ) (4.1) Coordinate projection rounding: For ω ∈ U , let δω : U → ’ be the function that satisfies h f , δω i = f (ω) for all f ∈ L2 (U ). Go over all vectors of the form gω = Πδω for ω ∈ U and if there is one that satisfies (4.1) then output it. Note that the output of this procedure is independent of the distribution D. Random function rounding: Choose a random gaussian vector t ∈ L2 (U ) and output g = Πt if it satisfies (4.1). (Note that this is also independent of the distribution D.) 17 – Conditioning: Go over all choices for ω1 , . . . , ω4 ∈ U and modify the distribution D to the distribution [ f ] is proportional to (cid:144)D [ f ] Q4 j=1 f (ω j )2 for every f . Dω1 ,...,ω4 defined such that (cid:144)Dω1 ,... ,ω4 Gaussian rounding: For every one of these choices, let t to be a random Gaussian that matches the first two moments of the distribution D, and output g = Πt if it satisfies ( 4.1). Because we will make use of this fact later, we will note when certain properties hold not just for expectations of actual probability distributions but for pseudoexpectations as well. The extension to pseudo- expectations is typically not deep, but can be cumbersome, and so the reader might want to initially restrict attention to the case of a combining algorithm, where we only deal with actual expectations. We show the consequences for each of the steps failing, and then combine them together to get a contradiction. 4.1 Random function rounding We start by analyzing the random function rounding step. Let e1 , . . . , en be an orthonormal basis for the space of functions L2 (U ). Let t be a standard Gaussian function in L2 (U ), i.e., t = ξ1e1 + . . . + ξnen for independent standard normal variable ξ1 , . . . , ξn (each with mean 0 and variance 1). The following lemmas combined show what are the consequences if kΠtk4 is not much bigger than kΠtk2 . Lemma 4.2. For any f , g : U → ’, t h f , tihg, ti = h f , gi . … f = Pi ai ei and g = P j b j e j . Then, h f , gi = Pi aibi and h f , tihg, ti = Proof. In the {e1 , . . . , en } basis, Pi j aib j ξiξ j , which has expectation Pi ai bi . Hence, the left-hand side is the same as the right-hand side. (cid:3) Lemma 4.3. The 4th moment of kΠtk4 satisfies t kΠtk4 ω kΠδω k4 2 . … 4 > … Proof. By the previous lemma, the Gaussian variable Πt(ω) = hΠδω , ti has variance kΠδω k2 2 . Therefore, t hδω , Πti4 Πt(ω)4 t kΠtk4 4 = … 4 = … … … … t ω ω t hΠδω , ti2 (cid:19)4 ω (cid:18)… ω kΠδω k4 = 3 … = 3 … 2 , since 3 = …X∼N (0,1) X 4 . Lemma 4.4. The 4th moment of kΠtk2 satisfies 2 6 10 · (rank Π)2 . t kΠtk4 … Proof. The random variable kΠtk2 has a χ2 -distribution with k = rank Π degrees of freedom. The mean of 2 6 10(rank Π)4 . this distribution is k and the variance is 2k. It follows that …t kΠtk4 (cid:3) 4.2 Coordinate projection rounding (cid:3) We now turn to showing the implications of the failure of projection rounding. We start by noting the following technical lemma, that holds for both the expectation and counting inner products: 18 Lemma 4.5. Let x and y be two independent, vector-valued random variables. Then, …h x, yi4 6 (cid:16)…h x, x′ i4 (cid:17)1/2 · (cid:16)…hy, y′ i4 (cid:17)1/2 Moreover, this holds even if x, y come from a level ℓ > 10 pseudodistribution. . Proof. By Cauchy–Schwarz, x,yh x, yi4 = h …x x⊗4 , …y y⊗4 i … 6 k … x x⊗4 k2 · k …y y⊗4 k2 = (cid:16) …x, x′ h x, x′ i4 (cid:17)1/2 · (cid:16) …y,y′ hy, y′ i4 (cid:17)1/2 We now consider the case of pseudodistributions. In this case the pseudoexpectation over two indepen- dent x and x′ is obtained using Lemma A.5. Let X and Y be the n4 -dimensional vectors … x⊗4 and … y⊗4 respectively. We can use the standard Cauchy–Schwarz to argue that X · Y 6 kX k2 · kY k2 , and so what is left is to 2 = … x, x′ h x, x′ i4 , and similarly for Y . This holds by linearity for the same reason this is argue that kX k2 true for actual expectations, but for the sake of completeness, we do this calculation. We use the counting inner product for convenience. Because the lemma’s statement is scale free, this will imply it also for the expectation norm. . … xi x j xk xl x′i x′j x′k x′l = Xi, j,k,l x, x′ Xi, j,k,l x, x′ h x, x′ i4 = … … where the last equality holds by independence. But this is simply equal to Xi, j,k,l xi x j xk xl )2 = kX k2 2 ( … x ( … x xi x j xk xl )( … x′ x′i x′j x′k x′l ) , (cid:3) The following lemma shows a nontrivial consequence for kΠδω k4 4 being small: Lemma 4.6 (Coordinate projection rounding). For any distribution D over L2 (U ), 4 6 (cid:16)… f , f ′∼D h f , Π f ′ i4 (cid:17)1/2 4 (cid:17)1/2 · (cid:16)…ω kΠδω k4 f ∼DkΠ f k4 . … Moreover, this holds even if D is a level ℓ > 104 pseudodistribution. (Note that ω is simply the uniform distribution over U , and hence the last term of the right hand side always denotes an actual expectation.) Proof. By the previous lemma, 6 (cid:16) … f , f ′ ∼D h f , Π f ′ i4 (cid:17)1/2 … f ∼DkΠ f k4 ω hδω , Π f i4 4 = … … f ∼D = (cid:16) … f , f ′ ∼D h f , Π f ′ i4 (cid:17)1/2 4 (cid:17)1/2 · (cid:16)…ω kΠδω k4 . 4.3 Gaussian Rounding · (cid:16)…ω,ω′ hδω , Πδω′ i4 (cid:17)1/2 (cid:3) In this subsection we analyze the gaussian rounding step. Let t be a random function with the Gaussian distribution that matches the first two moments of a distribu tion D over L2 (U ). 19 Lemma 4.7. The 4th moment of kΠtk4 satisfies f , f ′ ∼D D(Π f )2 , (Π f ′ )2E . t kΠtk4 4 = 3 … … Moreover, this holds even if D is a level ℓ > 100 pseudodistribution. (Note that even in this case t is still an actual distribution.) Proof. t kΠtk4 4 = … … t … ω f , f ′ ∼D D(Π f )2 , (Π f ′ )2E . (cid:3) … ω (cid:16)…t Πt(ω)2 (cid:17)2 Πt(ω)4 = 3 … = 3 ω (cid:16)… f ∼D Π f (ω)2 (cid:17)2 = 3 … Fact 4.8. If {A, B, C, D} have Gaussian distribution, then … ABCD = … AB · … CD + … AC · … BD + … BC · … AD . Lemma 4.9. The fourth moment of kΠtk2 satisfies 2 !2 2 6 3 … f ∼DkΠ f k2 t kΠtk4 … Moreover, this holds even if D is a level ℓ > 4 pseudodistribution. Proof. By the previous fact, . t kΠtk4 2 = … … ω,ω′ … t Πt(ω)2 · Πt(ω′ )2 = … ω,ω′ … f Π f (ω)2 · … f Π f (ω′ )2 + 2 … f Π f (ω)Π f (ω′ )!2 2 !2 = 3 … f kΠ f k2 . (cid:3) 4.4 Conditioning We now show the sense in which conditioning can make progress. Let D be a distribution over L2 (U ). For ω ∈ U , let Dω be the distribution D reweighed by f (ω)2 for f ∼ D. That is, (cid:144)Dω { f } ∝ f (ω)2 · (cid:144)D { f }, or in other words, for every function P(·), … f ∼Dω P( f ) = (… f simD f (ω)2 P( f ))/(… f ∼D f (ω)2 ). Similarly, we write Dω1 ,...,ωr for the distribution D reweighed by f (ω1 )2 · · · f (ωr )2 . Lemma 4.10 (Conditioning). For every even r ∈ Ž, there are points ω1 , . . . , ωr ∈ U such that the reweighed distribution D′ = Dω1 ,...,ωr satisfies f ,g∼D′ D f 2 , g2 E > (cid:16)… f ,g∼D D f 2 , g2 Er (cid:17)1/r … Moreover, this holds even if D is a level ℓ > r + 4 pseudodistribution. Proof. We have that ω1 ,...,ωr  f ,g∼Dω1 ,... ,ωr D f 2 , g2 E = max … … f (ω1 )2 · · · f (ωr )2 · g(ω1 )2 · · · g(ωr )2 D f 2 , g2 E (cid:16) … f f (ω1 )2 · · · f (ωr )2 (cid:17) (cid:16) …g g(ω1 )2 · · · g(ωr )2 (cid:17) 20 max ω1 ,...,ωr  but using …(X/Y ) 6 (max X )/(max Y ) and …ω1 ,...,ωr f (ω1 )2 · · · f (ωr )2 g(ω1 )2 · · · g(ωr )2 = Dg2 , f 2Er is lower bounded by … f ,g∼D D f 2 , g2 Er+1 … f (ω1 )2 · · · f (ωr )2 · g(ω1 )2 · · · g(ωr )2 D f 2 , g2 E …ω1 ,...,ωr …ω1 ,...,ωr (cid:16) … f f (ω1 )2 · · · f (ωr )2 (cid:17) (cid:16) …g g(ω1 )2 · · · g(ωr )2 (cid:17) = … f ,g∼D (cid:10) f 2 , g2 (cid:11)r Now, if D was an actual expectation, then we could use H older’s inequality to lower bound the numerator which would lower bound the RHS by (cid:16)… f ,g∼D D f 2 , g2Er (cid:17)1/r of the RHS by (cid:16)… f ,g∼D D f 2 , g2 Er (cid:17)(r+1)/r . For pseudoexpectations this follows by appealing to Lemma A.4. (cid:3) 4.5 Truncating functions , the RHS The following observation would be useful for us for analyzing the case that the distribution is over functions that are not completely inside the subspace. Note that if the function f is inside the subspace, we can just take f = f in Lemma 4.11, and so the reader may want to skip this section in a first readi ng and just pretend that f = f below. Lemma 4.11. Let ε < 1/400, Π be a projector on ’U and suppose that f : U → {0, 1} satisfies that (cid:144)[ f (ω) = 1] = µ and kΠ f k2 2 > (1 − ε)µ. Then there exists a function f : ’U → ’ such that: 1. kΠ f k4 4 > Ω(µ). 2. For every ω ∈ U , Π f (ω)2 > Ω( f (ω)). Proof. Fix τ > 0 to be some sufficiently small constant (e.g., τ = 1/2 will do). Let f ′ = Π f . We define f = f ′ · 1 f ′ >τ (i.e., f (ω) = f ′ (ω) if f ′ (ω) > τ and f (ω) = 0 otherwise) and define f = f ′ · 1 f ′ <τ . Clearly f ′ (ω)2 > τ f (ω) for every ω ∈ U . Since f ( x) , 0 if and only if f ′ ( x) ∈ (0, τ), clearly f ( x) 6 f ( x) − f ′ ( x) and hence k f k2 2 6 εµ. Using f ′ = f + f , we see that Π f = f + ( f ′ − f ) − f + (Π f − f ). Now since f ′ is in the subspace, kΠ f − f k2 6 k f ′ − f k2 = k f k2 and hence for g = ( f ′ − f ) − f + (Π f − f ), kgk2 6 3 √εµ. Therefore the probability that g(ω) > 10 √ε is at most µ/2. This means that with probability at least µ/2 it holds that f (ω) = 1 and g(ω) 6 10 √ε, in which case f (ω) > 1 − 10 √ε > 1/2. In particular, we get that … f (ω)4 > Ω(µ). (cid:3) Remark 4.12 (Non-Boolean functions). The proof of Lemma 4.11 establishes much more than its statement. In particular note that we did not make use of the fact that f is nonnegative, and a function f into {0, ±1} with (cid:144)[ f (ω) , 0] = µ would work just the same. We also did not need the nonzero values to have magnitude exactly one, since the proof would easily extend to the case where they are in [1/c, c] for some constant c. One can also allow some nonzero values of the function to be outside that range, as long as their total contribution to the 2-norm squared is much smaller than µ. 4.6 Putting things together We now show how the above analysis yields a combining algorithm, and we then discuss the changes needed to extend this argument to pseudodistributions, and hence obtain a rounding algorithm. 2 > 0.99k f k2 2 = µ and kΠ f k2 Let D be a distribution over Boolean functions f : U → {0, 1} with k f k2 2 . The goal is to compute a function t : U → ’ with kΠtk4 ≫ ktk2 2 , given the low-degree moments of D. Suppose that random-function rounding and coordinate-projection rounding fail to produce a function t with kΠtk4 4 > γktk4 2 . Then, …ω kΠδω k4 2 6 O(γ) · (rank Π)2 (from failure of random-function rounding and 21 f , f ′∼D D f , f ′ E4 6 O(γ) · … Lemmas 4.3 and 4.4). By the failure of coordinate-projection rounding (and using Lemma 4.6 applied to the distribution over f ) we get that 4 !2 … f ∼DkΠ f k4 Combining the two bounds, we get 4 !2 > Ω(1/(γ rank Π)2 ) … f , f ′ ∼D D f , f ′ E4 f ∼DkΠ f k4 … Since (by Lemma 4.11), (Π f )(ω)2 > Ω( f (ω)) for every ω ∈ U and f in the support of D, we have h(Π f )2 , (Π f ′ )2 i > Ω(h f , f ′ i) for all f , f ′ in the support. Thus, 4 !2 > Ω(1/(γ rank Π)2 ) … f , f ′∼D D(Π f )2 , (Π f ′ )2E4 f ∼DkΠ f k4 … By the reweighing lemma, there exists ω1 , . . . , ω4 ∈ U such that the reweighted distribution D′ = Dω1 ,...,ω4 satisfies 4 !1/2 f , f ′ ∼D D(Π f )2 , (Π f ′ )2 E4 !1/4 f , f ′∼D′ D(Π f )2 , (Π f ′ )2 E > … > Ω(1/(γ rank Π))1/2 … f ∼DkΠ f ]k4 … The failure of Gaussian rounding (applied to D′ ) implies 2 !2 f , f ′ ∼D′ D(Π f )2 , (Π f ′ )2E 6 O(γ) … f ∼D′ kΠ f k2 … Combining these two bounds, we get ω kΠδω k4 · … 2 . . 2 !4 4 6 O(γ3 rank Π) · … f ∼DkΠ f k4 f ∼D′ kΠ f k2 … By the properties of D and Lemma 4.11, the left-hand side is Ω(µ) and the right-hand side is O(γ3 rank Πµ4 ). Therefore, we get (rank Π)1/3 µ (cid:19) γ > Ω (cid:18) 1 Extending to pseudodistributions. We now consider the case that D is a pseudodistribution of level ℓ > 10. Most of the statements above just go through as is, given that the analysis of all individual steps does extend (as noted) for pseudoexpectations. One issue is that the truncation operation used to obtain f is not a low degree polynomial. While it may be possible to approximate it with such a polynomial, we sidestep the issue by simply adding f as additional auxiliary variables to our program, and enforcing the conclusions of Lemma 4.11 as constraints that the pseudoexpectation operator must be consistent with. This is another example of how we design our relaxation to fit the ro unding/combining algorithm, rather than the other way around. With this step, we can replace statements such as “(*) holds for all functions in the support of D” (where (*) is some equality or inequality constraint in the variables f , f ) with the statement “ D is consistent with (*)” and thus complete the proof. (cid:3) 22 5 Finding planted sparse vectors As an application of our work, we show how we can find sparse (or analytically sparse) vectors in- In particular, this improves upon a recent result of Demanet and side a sufficiently generic subspace. Hand [DH13] who used the L∞ /L1 optimization procedure of Spielman et al. [SWW12] to show one can recover a µ-sparse vector planted in a random d-dimension subspace V ′ ⊆ ’n when µ ≪ 1/ √d . Our result, combined with the bound on the SDP value of the 2 → 4 norm of a random subspace from [BBH+12], implies that if d = O( √n) then we can in fact recover such a vector as long as µ ≪ 1. Problem: PlantedRecovery(µ, d, U , ε) Input: An arbitrary basis for a linear subspace V = span (V ′ ∪ { f0 }), where: – V ′ ⊆ ’U is a random d-dimensional subspace, chosen as the span of d vectors drawn indepen- dently from the standard Gaussian distribution on ’U , and f0 is an arbitrary µ-sparse vector, i.e., S = supp( f0 ) has S 6 µU . Goal: Find a vector f ∈ V with h f , f0 i2 > (1 − ε) k f k2 k f0 k2 . The goal here should be thought of as recovering f0 to arbitrarily high precision (“exactly”), and thus the running time of an algorithm should be logarithmic in 1/ε. We note that f0 is not required to be random, and it may be chosen adversarially based on the choice of V ′ . We will prove the following theorem, which is this section’s main result: Theorem 5.1. (Theorem 1.4, restated) For some absolute constant K > 0, there is an algorithm that solves PlantedRecovery(µ, d, U , ε) with high probability in time poly(U , log(1/ε)) for any µ < K µ0 (d), where if d 6 √ µ0 (d) =  1 U , and if d > √ n/d2 U . Our algorithm will work in two stages. It will first solve a con stant-degree sum-of-squares relaxation to find a somewhat noisy approximate solution. It will then solv e an auxiliary linear program that converts any sufficiently good approximate solution into an exact one. The first stage is based on the following theorem (proven in Se ction 5.1), which shows that we can approximately recover a vector when it is planted in a subspace consisting of vectors with substantially smaller L4/L2 ratio, provided that we can certify this property of the subspace using a low-degree sum-of- squares proof. To avoid unnecessary notation, we will use a degree 4 certificate in the statement and proof of the theorem; the proof goes through in greater generality, but this suffices for our application. Theorem 5.2. Let V = span (V ′ ∪ { f0 }), where f0 ∈ ’U is a vector with k f0 k4 /k f0 k2 > C , and V ′ ⊆ ’U is a linear subspace with k f k4 (5.1) max 6 c. k f k2 0, f ∈V ′ Furthermore, assume that (5.1) has a degree 4 sum-of-squares proof, i.e., that kΠV ′ f k4 4 = c4 kΠV ′ f k4 2 − S , where ΠV ′ is the orthogonal projection onto V ′ , and S is a degree 4 sum of squares. There is a polynomial-time algorithm based on a constant-degree sum-of-squares relaxation that returns a vector f ∈ V with h f , f0 i2 > (cid:16)1 − (c/C )Ω(1) (cid:17) k f0 k2 k f k2 . (5.2) 23 – If V ′ is a random subspace of dimension d, [BBH+12, Theorem 7.1] showed that (5.1) has a degree 4 sum-of-squares proof with high probability for c = O(1) when d 6 √U , and for c = O (cid:16)d1/2 /U 1/4 (cid:17) when d > √U .13 We can concisely write these two cases together in our present notation as c = O (cid:16)µ0 (d)−1/4 (cid:17). Since f0 is µ-sparse, we know that k f0 k4 > µ−1/4 k f0 k2 , so we can take C = µ−1/4 . We can thus solve a constant-degree sum-of-squares program to obtain a vector f with h f , f0 i = (1 − O(1)) k f0 k2 k f k2 whenever c ≪ O(µ−1/4 ), i.e., when µ ≪ O 1 c4 ! = O (µ0 (d)) . For the second stage, we will consider the following linear program, which can be thought of as search- ing for a sparse vector in V with a large inner product with f : (5.3) (5.4) kyk1 such that hy, f i = 1. arg min y∈V In Section 5.2, we will prove the following theorem, which provides conditions under which the linear program will exactly recover f0 from any f that is reasonably correlated to it: Theorem 5.3. Let V = span (V ′ ∪ { f0 }), and suppose that the following conditions hold: supp( f0 ) = S , S = µn [ f0 is a µ-sparse vector] kV ′ k2:1 6 α where kV ′ k2:1 = maxk f ′ k2 /k f ′ k1 for all 0 , f ′ ∈ V ′ ) L2/L1 -sparse vectors] h f0 , f i > (1 − ε) k f0 k2 k f k2 h f ′ , f i 6 η k f ′ k2 k f k2 for all f ′ ∈ V ′ [ f is not very correlated with anything in V ′ ]. [V ′ doesn’t contain any 1/α2 [ f is correlated with f0 ] If < 1 η α √µ − 2, 1 − ε then f0 /h f0 , f i is the unique optimal solution to (5.4). Remark 5.4. Because we believe the result might be useful elsewhere, we state the theorem in much more generality than needed for our application. In particular in our application we only need the trivial bound η 6 1. Also, a bound on kV ′ k2:1 can also be derived using the relations between the 4 norm and the 2 norm on vectors in V ′ . To prove Theorem 5.1, we take f to be the vector with h f ′ , f i > (cid:16)1 − (c/C )Ω(1) (cid:17) k f0 k2 k f k2 given by Theorem 5.2 and solve the linear program from Equation (5.4). The theorem is vacuous for d > √K n, so we may assume that d is less than any fixed constant times n. In this case, the following classic result on almost- spherical sections of the ℓ1 ball ([Kas77, FLM77], as stated in [DH13]) guarantees that kV ′ k2:1 6 O(1): Lemma 5.5. Fix δ ∈ (0, 1), let d 6 δn, and let W ⊆ ’U be a random d-dimensional subspace given by the span of d independent standard Gaussians. There exists a constant Cδ > 0 and absolute constants γ1 , γ2 > 0 such that 2 6 (cid:13)(cid:13)(cid:13) f ′ (cid:13)(cid:13)(cid:13) 6 (cid:13)(cid:13)(cid:13) f ′(cid:13)(cid:13)(cid:13) Cδ (cid:13)(cid:13)(cid:13) f ′(cid:13)(cid:13)(cid:13) 2 for all f ′ ∈ W with probability 1 − γ1e−γ2 n . 13Their proof actually directly shows that the polynomial P in the RHS of (5.2) has kPkspectral 6 c4 , which corresponds to a degree 4 SOS proof via Lemma A.12. 2 2 2 1 24 – – – – By Cauchy-Schwarz, we have h f ′ , f i 6 k f ′ k2 k f k2 , so Theorem 5.3 implies that we recover f0 exactly as long as14 < s Cδ 1 µ − 2. (1 − O(c/C )) Cδ is a constant for any fixed δ, so, by taking K sufficiently small in the statement of the theorem, we may assume that µ < Cδ /16, and thus that the right-hand side of (5.5) is at least 2. In this case, we can recover f0 as long as c ≪ O(C ). Combining this with Equation (5.3) and choosing K appropriately thus completes the proof of Theorem 5.1. (cid:3) It thus suffices to prove Theorems 5.2 and 5.3, which we will do in sections 5.1 and 5.2, respectively. We note that Theorems 5.2 and 5.3 hold for any V ′ that meets certain norm requirements, and they do not require V ′ to be a uniformly random subspace. As such, the results of this section hold in a broader context. (For example, they immediately generalize to other distributions of subspaces that meet the norm bounds.) We hope that the technical results of this section will find ot her uses, so we have stated them in a somewhat general way to facilitate their application in other settings. (5.5) 5.1 Recovering f0 approximately (Proof of Theorem 5.2) In this section, we prove Theorem 5.2, which allows us to recover a vector that is reasonably well-correlated with f0 . The basic idea is that f0 has a much larger L4/L2 ratio than anything in V ′ , so maximizing the the L4/L2 ratio should give a vector near f0 . The key ingredient of the theorem is the following lemma about (pseudo-)distributions supported on L4/L2 -sparse functions in V ′ . Note that this lemma does not need the space to be random, but only that it can be certified to have no L4 /L2 sparse vectors by the SOS SDP. Lemma 5.6. Let V ′ ⊆ ’U be a linear subspace such that k f k4 max 6 c k f k2 0, f ∈V ′ Let f0 be a unit function in V ′⊥ with k f0 k4 = C > 100c, and let X be a distribution over ’U over unit functions f ∈ SpanV ′ ∪ { f0 } satisfying k f k4 > C . Then …h x, f0 i2 > 1 − O(c/C ) . Moreover this holds even if X is a pseudodistribution of level ℓ > 8, as long as (5.6) has a degree 4 sum-of- squares proof. (5.6) We can obtain a pseudodistribution X meeting the requirements in Lemma 5.6 by solving a degree 8 sum-of-squares program that maximizes k f k4 4 over f ∈ V with k f k2 2 = 1. If we sample a random Gaussian consistent with the first two moments of X, then we will obtain a vector g whose expected 2-norm squared is 1 and whose expected inner product with f0 is (1− o(1)) k f0 k, so Lemma 5.6 therefore implies Theorem 5.2. Proof of Lemma 5.6. Write every vector f in the support of X in the form f = α f0 + f ′ where f ′ ∈ V ′ and α = h f , f0 i. We know that C = k f k4 6 αk f0 k4 + k f ′ k4 6 αC + ck f ′ k2 6 αC + c, 14 We note that the last two bounds were somewhat weak: Lemma 5.5 holds for subspaces of linear dimension, but we only applied it to a subspace with d 6 √U ; and the application of Cauchy-Schwarz could have been tightened using a better analysis. However, these were sufficient to prove Theorem 5.1. (5.7) 25 so α > 1 − c/C . This concludes the proof for actual expectations. To argue about pseudoexpectations, we need to use only constraints involving polynomials, and therefore we use 4 = … C 4 = k f k4 f (α f0 (ω) + f ′ (ω))4 … ω which equals … 0 , f ′ i + 6 … α2 h f 2 4 + 4 … α3 h f 3 0 , f ′2 i + 4 … αh f0 , f ′3 i + …k f ′ k4 α4 k f0 k4 4 . f The existence of a degree 4 sum-of-squares proof of (5.7) implies that X must be consistent with the con- straint k f k4 4 6 c4 . We can thus use Cauchy–Schwarz and H older’s inequality (L emma A.10 and Corol- lary A.11), to bound all of the terms except the first one by a constant ti mes α3C 3c, and so we get C 4 6 … α4C 4 + 15α3C 3c. Using the fact that the expectation is consistent with the constraint α 6 1, we obtain … α4 > 1 − 15c/C . Since we satisfy α 6 1, we know that … α6 6 1, so we can apply Cauchy-Schwarz to show that … α4 6 p … α2 p … α6 6 p … α2 , … α2 > 1 − 30c/C. 5.2 Recovering f0 exactly (Proof of Theorem 5.3) which allows us to conclude that (cid:3) In this section, we prove Theorem 5.3, which allows us to use a vector near f0 to recover f0 exactly (up to the precision used when solving the linear program). Intuitively, this is relies on the same tendency towards sparsity of vectors with minimal 1-norm that underlies the earlier works that are based on L∞ /L1 -sparsity. Minimizing the L∞ /L1 -sparsity amounts to solving the linear program in (5.4) with y equal to each of the unit basis vectors, and then taking the best of the U solutions. When f0 is sparse enough, it will have at least one fairly large coefficient, and f0 will then be sufficiently correlated with the corresponding unit basis vector for the linear program to find it. This breaks down when µ = Ω(1/ √d), at which point any one basis vector is expected to be more correlated with some vector in V ′ than it is with f0 . Here, instead of using the unit basis vectors, we use a vector y that shares many coordinates with f0 , which then lets us handle a much broader range of µ. = Proof of Theorem 5.3. To analyze the optimum of (5.4), we decompose y ∈ V as y = t f0 + f ′ for t ∈ ’ and f ′ ∈ V ′ . We will show that kt f0 + f ′ k1 k f0 k1 6 kyk1 th f0 , f i + h f ′ , f i hy, f i h f0 , f i for all y ∈ V , with equality only if f ′ = 0, which immediately implies Theorem 5.3. be the vectors obtained from f ′ by zeroing out the coordinates outside S and S , respec- Let f ′S and f ′S . Since f0 is zero outside of S , we have tively, so that f ′ = f ′S + f ′S > t k f0 k1 − (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 + (cid:13)(cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)(cid:13)1 (cid:13)(cid:13)(cid:13)t f0 + f ′(cid:13)(cid:13)(cid:13)1 = (cid:13)(cid:13)(cid:13)t f0 − f ′S (cid:13)(cid:13)(cid:13)1 + (cid:13)(cid:13)(cid:13)(cid:13) 26 f ′S (cid:13)(cid:13)(cid:13)(cid:13)1 (5.8) . (5.9) Equation (5.9) and the inequality give > (5.11) 6 6 = . , (5.10) k f0 k1 h f0 , f i C > min (cid:26) A A + B D (cid:27) , B C + D t k f0 k1 − (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 + (cid:13)(cid:13)(cid:13)(cid:13) , (cid:13)(cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)(cid:13)1 − (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 f ′S (cid:13)(cid:13)(cid:13)(cid:13)1  > min  k f0 k1 kt f0 + f ′ k1 h f0 , f i th f0 , f i + h f ′ , f i th f0 , f i + h f ′ , f i h f ′ , f i where the second inequality in (5.10) is strict unless the two terms inside the min are equal. To prove the inequality asserted in (5.8), and thus Theorem 5.3, it therefore suffices to show that f ′S (cid:13)(cid:13)(cid:13)(cid:13)1 − (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 < (cid:13)(cid:13)(cid:13)(cid:13) h f ′ , f i for all 0 , f ′ ∈ V ′ . We can bound the left-hand side of (5.11) using the assumptions that h f0 , f i > 1 − ε and that f0 is µ-sparse: √µ √µ k f0 k2 k f0 k1 k f0 k1 (1 − ε) k f k2 (1 − ε) k f0 k2 k f k2 (1 − ε) k f0 k2 k f k2 h f0 , f i To bound the numerator of the right-hand side of (5.11), we need to show that f ′ cannot have too large a fraction of its 1-norm concentrated in the coordinates in S . We first note that, if this occurred, it would lead to a large contribution to the 2-norm: f ′ (i)2 6 µ s 1 i∈S f ′ (i) 6 µ q … (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 = µ … i∈S µ Combining this with our assumption that kV ′ k2:1 6 α, gives f ′S (cid:13)(cid:13)(cid:13)(cid:13)1 − (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 = (cid:13)(cid:13)(cid:13) f ′(cid:13)(cid:13)(cid:13)1 − 2 (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 (cid:13)(cid:13)(cid:13)(cid:13) > α−1 (cid:13)(cid:13)(cid:13) f ′ (cid:13)(cid:13)(cid:13)2 − 2 √µ (cid:13)(cid:13)(cid:13) f ′(cid:13)(cid:13)(cid:13)2 = (cid:16)α−1 − 2 √µ(cid:17) (cid:13)(cid:13)(cid:13) f ′(cid:13)(cid:13)(cid:13)2 , f ′S (cid:13)(cid:13)(cid:13)(cid:13)1 − (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 (cid:13)(cid:13)(cid:13)(cid:13) = (cid:16)α−1 − 2 √µ(cid:17) > (cid:16)α−1 − 2 √µ(cid:17) k f ′ k2 . h f ′ , f i η k f ′ k2 k f k2 η k f k2 1−ε < (α √µ)−1 − 2, this implies that η f ′S (cid:13)(cid:13)(cid:13)(cid:13)1 − (cid:13)(cid:13)(cid:13) f ′S (cid:13)(cid:13)(cid:13)1 (cid:13)(cid:13)(cid:13)(cid:13) (cid:16)α−1 − 2 √µ(cid:17) (1 − ε) (cid:16)(α √µ)−1 − 2(cid:17) k f k2 h f ′ , f i from which our desired result follows. √µ (1 − ε) k f k2 f ′ (i)2 = √µk f ′ k2 . > k f0 k1 h f0 , f i , and thus > = … i If (cid:3) 6 Results for Small Set Expansion As stated in Corollaries 1.3 and 1.6, our results imply two consequences for the Small Set Expansion problem of [RS10]. This is the problem of deciding, given an input graph G and parameters δ, ε, whether there is a measure-δ subset S of G’s vertices where all but an ε fraction of S ’s edges stay inside it, or that G is a small set expander in the sense that every sufficiently small set has almost all its edges leaving it. Beyond 27 being a natural problem in its own right, Small Set Expansion is also closely related to the Unique Games problem whose conjectured hardness is known as Khot’s “Uniq ue Games Conjecture” [ Kho02]. [RS10] gave a reduction from Small Set Expansion to Unique Games. While a reduction in the other direction is not known, all currently known algorithmic and integrality gap results apply to both problems equally well (e.g., [ABS10, RST10, BGH+12, BBH+12]), and thus they are likely to be computationally equivalent. We give an algorithm to solve Small Set Expansion in quasipolynomial time on an interesting family of Cayley graphs, and a new polynomial-time approximation algorithm for this problem on general graphs, with the approximation guarantee depending on the dimension of the input graph’s top eigenspace. 6.1 Small-set expansion of Cayley graphs 2 . One reason We consider the problem of solving the small set expansion problem on Cayley graphs over †ℓ to consider such graphs is that, until recently, the hardest looking instances for this problem were graphs of this type (i.e., the noisy hypercube [KV05] and the “short code” graph [ BGH+12]). [BBH+12] showed that these instances can in fact be solved via constant rounds of the SOS hierarchy, but we still do not have any other good candidate hard instances, and so it is natural to ask whether Cayley graphs can provide such candidates. Also, since the SOS algorithm does not make use of the algebraic structure of Cayley graphs, it is plausible that if this algorithm can efficiently solve the Small-Set Expansion on Cayley graphs, then it can in fact solve it on all graphs. Let G be a Cayley graph on †ℓ 2 with n = 2ℓ vertices. Let V>λ be the linear subspace spanned by (We identify G here with its random-walk matrix.) the eigenfunctions of G with eigenvalue at least λ. Let Pλ be the degree-4 polynomial Pλ ( f ) = kΠ>λ f k4 4 , where Π>λ is the projector into V>λ . We define Kλ (G) = kPλ kspectral . In this section, we describe approximation algorithms with running times that depend on Kλ (G). The algorithms run in quasipolynomial time if Kλ (G) is polylogarithmic. We will show interesting families of graphs with Kλ (G) = O(1). (See Theorem 6.3.) The following theorem shows that low-degree sum-of-squares relaxations can detect L4/L2 -sparse func- tions in the subspaces V>λ (in the case when Kλ (G) is not too large). This result follows from Theorem 3.1 and the fact that the polynomial Pλ has nonnegative coefficients in an appropriate basis. Theorem 6.1. Sum-of-squares relaxations of degree ε−O(1) Kλ (G)O(1) log n provide an additive ε- approximation to the maximum of k f k4 /k f k2 over all non-zero functions f ∈ V>λ . Proof. The problem of maximizing k f k4 /k f k2 over the subspace V>λ is equivalent to maximizing the poly- nomial Pλ over functions with norm 1. (Also notice that k f k4 > k f k2 for every function f .) In order to apply Theorem 3.1, we need to verify that Pλ has nonnegative coefficients in an appropriate basis. Since G is a as an eigenbasis. (Here, χα ( x) = (−1)Pi αi xi .) If 2 , we can take the characters {χα }α∈†ℓ Cayley graph over †ℓ 2 fαχα in this eigenbasis and let S >λ = {α λα > λ} be the indices of the eigenfunctions we represent f = Pα with eigenvalue at least λ, then fαχα (cid:17)4 fβ′ … χαχβ χα′ χβ′ = Xα,β,α′ ,β′ ∈S >λ = Xα,β,α′ ,β′ ∈S >λ 4 = … (cid:16) Xα∈S >λ Pλ ( f ) = kΠ>λ f k4 α+β=α′ +β′ It follows that Pλ has nonnegative coefficients in the monomial basis corresponding to the eigenfunctions O(1) of G . By Theorem 3.1, sum-of-squares relaxations of degree ε−O(1) kPλ k spectral log n provides an additive f 2 approximation to the maximum of Pλ over functions with k f k2 = Pα α = 1. (cid:3) Using the characterization of small-set expansion in terms of L4 /L2 -sparse functions [BBH+12], Theorem 6.1 implies the following approximation algorithm for small-set expansion on Cayley graphs. This theorem implies Corollary 1.3. fα fβ fα′ fα fβ fα′ fβ′ . 28 Theorem 6.2. For some absolute constant C > 1 and all µ, ε > 0 small enough, sum-of-squares relaxations of degree Kλ (G)O(1) log n can distinguish between the following two cases with λ = 1 − Cε. Yes: The Cayley graph G contains a vertex set of measure at most µ and expansion at most ε. No: All vertex sets of measure at most C/ √µ in G have expansion at least 1 − 1/C . Proof. We will show that the maximum of k f k4 /k f k2 over f ∈ V>λ distinguishes the two cases (by a constant margin). Therefore, Theorem 6.1 implies that we can distinguish between the cases using sum-of-squares relaxations. Yes-case: Let f be the indicator function of a set with measure at most µ and expansion at most ε. Then, kΠ>λ f k2 > 0.99k f k2 . It follows that kΠ>λ f k4 4 > 0.9k f k4 (See Lemma 4.11.) Therefore, 4 . 4/kΠ>λ f k4 kΠ>λ f k4 4 /k f k4 2 > Ω(1)k f k4 2 = Ω(1) · 1/µ. No-case: Let µ′ = C/ √µ. By [BBH+12, Theorem 2.4], graphs with this kind of small-set expansion 2 6 O(1)/(µ′ )2 ≪ 1/µ for all functions f ∈ V>λ (G). 4 /k f k4 satisfy k f k4 (cid:3) The following theorem shows that there are interesting Cayley graphs that satisfy Kλ (G) = O(1) for λ = Ω(1). We consider constructions based on the long code and the short code [BGH+12]. These constructions are parameterized by the size of the graph and its eigenvalue gap. In the context of the Unique Games Conjecture and the Small-Set Expansion Hypothesis, the most relevant case is that the eigenvalue gap is a constant. (The eigenvalue gap corresponds to the gap to perfect completeness.) Theorem 6.3. Long-code and short-code based graphs with constant eigenvalue gap satisfy Kλ (G) = O(1) for all λ = Ω(1). Proof. By [BBH+12, Lemma 5.1], there exists a constant C such that Pλ ( f ) = C k f k4 2 − S ( f ) where S (·) is a sum of squares (the same constant C works for both graph constructions). Therefore, by Lemma A.12, kPλ kspectral 6 C . (cid:3) 6.2 Approximating small-set expansion using ASVP The approximation algorithm for the analytical sparse vector problem (Theorem 4.1) implies the follow- ing approximation algorithm for small-set expansion. An algorithm for the same problem with the factor (dim V>λ )1/3 replaced by a constant would refute the Small-Set Expansion Hypothesis [RS10, RST12].15 Theorem 6.4. For some absolute constant C > 1 and all µ, ε > 0 small enough, sum-of-squares relaxations with constant degree can solve the promise problem on regular graphs G: Yes: The graph contains a vertex with measure at most µ/(dim V>λ )1/3 and expansion at most ε, where λ = 1 − C · ε. No: All vertex sets of measure at most C √µ have expansion at least 1 − 1/C . Proof. Suppose G satisfies the Yes property. Let f be the indicator functions of a set with measure at most µ′ = µ/(dim V>λ )1/3 and expansion at most ε. Then, kΠ>λ f k2 2 > (1 − 1/C ′ )k f k2 2 , where we can make C ′ as large as we like by making C larger. By Theorem 4.1, constant-degree sum-of-squares relaxations allow us to find an L4/L2 -sparse function g ∈ V>λ , so that kgk4 4 > Ω(1/µ)kgk4 2 . By [BBH+12, Theorem 2.4] (see also Appendix D), such a function certifies that we are not in the No case. (cid:3) 15 It’s plausible that, under standard complexity assumptions such as NP * SUBEXP, even a smaller improvement to a (dim V>λ )o(1) factor instead of (dim V>λ )1/3 would refute this hypothesis, though we have no proof of such an implication. 29 7 Discussion and open questions A general open question is to find other applications of our ap proach for rounding sum-of-squares relax- ations. Natural candidates would be problems where it seems that they do not display a “dichotomy” behav- ior, where beating some simple algorithm is likely to be exponentially hard, but rather suggest more of a 16 lower-bound smooth tradeoff between time and performance. As far as we are aware, all known “robust” results for the sum-of-squares method are non-constructive, i.e., they show that hard instances for the sos method exist but do not give an efficient way of constructing them. More concretely, the results use the probabilistic method and show that with high probability, random instances are hard for sum-of-squares relaxations [Gri01b, Sch08]. Therefore, SOS seems promising for problems where random instances do not seem to be the most difficult, e.g., problems related to the Unique Games Conjecture. A concrete problem of that type to look at is Sparsest Cut. In particular, can we obtain even a small improvement17 to [ARV04]’s algorithm using more SOS levels? In fact, we believe that even finding a natural reinterpretation of [ ARV04] result in our framework would be interesting. That said, our result for finding a planted sparse vector shows that SOS can be useful for average-case problems as well, and in particular we believe SOS might be a strong tool for solving unsupervised learning problems, especially for nonlinear models. A relaxation-based approximation algorithm can be thought of as having three components: the relax- ation, the rounding algorithm, and its analysis. In our approach there is almost no creativity in choosing the relaxation, which is simply taken to be a sufficiently high level of the SOS hierarchy. (Though there may be some flexibility in how we represent solutions.) Can we simil arly show a “universal” rounding algorithm, thus pushing all the creative choices into the analysis? A related question is whether one can formulate a theorem giving a translation from combining algorithms into rounding algorithms under sufficiently general conditions, so that results like ours would follow as special cases, and as mentioned in Section 1.4, have already made some progress in this direction. The notion of “analytically sparse” vectors seems potentia lly useful for more applications. It would be interesting to explore the different choices for Lq /L p sparsity, and what tradeoffs they yield in terms of computation time versus usefulness as a proxy for actual sparsity. In particular, for the planted sparse vector question, it is natural to conjecture that there is an analytical relaxation that we can optimize over in nO(ℓ) time, and can detect sparse vectors in random subspaces of dimension n1−1/ℓ . In the context of the Small-Set-Expansion Hypothesis / Unique Games Conjecture, the most important question is whether our results of Section 4 can be further improved. We do not know of any candidate hard instances for this problem (in the relevant range of parameters) and so conjecture that our algorithm (or at least our analysis of it) is not optimal and can be improved further. Related to the question of finding hard instances, our work su ggests a different type of negative results for convex relaxations. While integrality gaps are instances that are hard for a particular relaxation, regardless of the rounding algorithm, one can consider the notion of “co mbining gaps”. These will be instances where there is a distribution of good solutions, but a particular combining algorithm C fails to find one. Hence, viewing C as a rounding algorithm, such a result shows that C will fail regardless of the relaxation used. (Karloff ’s work [Kar99] on hard instances for the [GW95] hyperplane cut rounding algorithms can be viewed as such an example.) Studying such gaps can shed more light on our approach and computational difficulty in general. In particular, it might be interesting to consider this question for random satisfiable instances of SAT or other constraint satisfaction problems. 16For knapsack-like problems, there exist explicit lower bounds [Gri01a], but here low-degree sum-of-squares proofs provide very good approximation (in this sense, the lower bound is not robust). 17An approach to obtain constant-factor approximations for sparsest cut in subexponential time is outlined in the disserta- tion [Ste10a, Chapter 9]. However, this approach also works with weaker hierarchies. An approach tailored to sum-of-squares would be interesting. 30 References [AAJ+13] Alekh Agarwal, Animashree Anandkumar, Prateek Jain, Praneeth Netrapalli, and Rashish Tan- don, Learning sparsely used overcomplete dictionaries via alternating minimization, arXiv preprint 1310.7991 (2013), http://arxiv.org/abs/1310.7991. 8 [ABLT06] Sanjeev Arora, B ´ela Bollob ´as, L ´aszl ´o Lov ´asz , and Iannis Tourlakis, Proving integrality gaps without knowing the linear program, Theory of Computing 2 (2006), no. 1, 19–51, Preliminary version in FOCS ’02. 1 [ABS10] Sanjeev Arora, Boaz Barak, and David Steurer, Subexponential algorithms for unique games and related problems, FOCS, 2010, pp. 563–572. 1, 6, 7, 28 [ABSS97] Sanjeev Arora, L ´aszl ´o Babai, Jacques Stern, and Z. Sweedyk, The hardness of approximate optima in lattices, codes, and systems of linear equations, J. Comput. Syst. Sci. 54 (1997), no. 2, 317–331. 5 [AG11] Sanjeev Arora and Rong Ge, New tools for graph coloring, APPROX-RANDOM, 2011, pp. 1– 12. 1 [AGM13] and Ankur Moitra, New algorithms Sanjeev Arora, Rong Ge, for 1308.6723 preprint arXiv dictionaries, incoherent overcomplete and http://arxiv.org/abs/1308.6273. 8 learning (2013), [AGS13] [AKS12] [ARV04] Sanjeev Arora, Rong Ge, and Ali Kemal Sinop, Towards a better approximation for sparsest cut?, FOCS, 2013. 1 Hyung-Chan An, Robert Kleinberg, and David B. Shmoys, Improving christofides’ algorithm for the s-t path tsp, STOC, 2012, pp. 875–886. 7 Sanjeev Arora, Satish Rao, and Umesh V. Vazirani, Expander flows, geometric embeddings and graph partitioning, STOC, 2004, pp. 222–231. 1, 30 [BBH+12] Boaz Barak, Fernando G. S. L. Brand ao, Aram Wettroth Har row, Jonathan A. Kelner, David Steurer, and Yuan Zhou, Hypercontractivity, sum-of-squares proofs, and their applications, STOC, 2012, pp. 307–326. 2, 3, 6, 7, 8, 10, 11, 23, 24, 28, 29, 35, 37, 41, 45 [BCC+10] Aditya Bhaskara, Moses Charikar, Eden Chlamtac, Uriel Feige, and Aravindan Vijayaraghavan, Detecting high log-densities: an O(n1/4 ) approximation for densest k-subgraph, STOC, 2010, pp. 201–210. 1, 13 [BCV+12] Aditya Bhaskara, Moses Charikar, Aravindan Vijayaraghavan, Venkatesan Guruswami, and Yuan Zhou, Polynomial integrality gaps for strong sdp relaxations of densest k-subgraph, SODA, 2012, pp. 388–405. 1 [BCY11] Fernando G. S. L. Brand ao, Matthias Christandl, an d Jon Yard, A quasipolynomial-time algo- rithm for the quantum separability problem, STOC, 2011, pp. 343–352. 1, 5, 8, 39 [BGH+12] Boaz Barak, Parikshit Gopalan, Johan H åstad, Raghu Meka , Prasad Raghavendra, and David Steurer, Making the long code shorter, FOCS, 2012, pp. 370–379. 5, 28, 29, 45 [BGMT12] Siavosh Benabbas, Konstantinos Georgiou, Avner Magen, and Madhur Tulsiani, Sdp gaps from pairwise independence, Theory of Computing 8 (2012), no. 1, 269–289. 1 31 [BH13] [BJK05] [BKS12] [BRS11] [Chl07] Fernando G. S. L. Brand ao and Aram Wettroth Harrow, Quantum de finetti theorems under local measurements with applications, STOC, 2013, pp. 861–870. 5, 8, 39 Andrei Bulatov, Peter Jeavons, and Andrei Krokhin, Classifying the complexity of constraints using finite algebras , SIAM Journal on Computing 34 (2005), no. 3, 720–742, Preliminary version in ICALP ’00. 7 Boaz Barak, Jonathan Kelner, and David Steurer, Iterative rounding for sum-of-squares relax- ations, Prliminary version of the current work, unpublished., 2012. 5 Boaz Barak, Prasad Raghavendra, and David Steurer, Rounding semidefinite programming hierarchies via global correlation, FOCS, 2011, To appear. arXiv:1104.4680v1 . 1, 2, 7, 39 Eden Chlamtac, Approximation algorithms using hierarchies of semidefinit e programming re- laxations, FOCS, 2007, pp. 691–701. 1 [CMM09] Moses Charikar, Konstantin Makarychev, and Yury Makarychev, Integrality gaps for sherali- adams relaxations, STOC, 2009, pp. 283–292. 1 [CS08] [CT10] [DH13] [DKL11] Eden Chlamtac and Gyanit Singh, Improved approximation guarantees through higher levels of sdp hierarchies, APPROX-RANDOM, 2008, pp. 49–62. 1 Eden Chlamtac and Madhur Tulsiani, Convex relaxations and integrality gaps, 2010, Chapter in Handbook on Semidefinite, Cone and Polynomial Optimizati on. 1 L. Demanet and P. Hand, Recovering the Sparsest Element in a Subspace, October 2013, Arxiv preprint 1310.1654. 5, 6, 10, 23, 24 Etienne De Klerk and Monique Laurent, On the lasserre hierarchy of semidefinite program- ming relaxations of convex polynomial optimization problems, SIAM Journal on Optimization 21 (2011), no. 3, 824–832. 35 [dlVKM07] Wenceslas Fernandez de la Vega and Claire Kenyon-Mathieu, Linear programming relaxations of maxcut, Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algo- rithms, Society for Industrial and Applied Mathematics, 2007, pp. 53–61. 1 [DPS04] [DW12] Andrew C Doherty, Pablo A Parrilo, and Federico M Spedalieri, Complete family of separabil- ity criteria, Physical Review A 69 (2004), no. 2, 022308. 1 Andrew C Doherty and Stephanie Wehner, Convergence of sdp hierarchies for polynomial optimization on the hypersphere, arXiv preprint arXiv:1210.5048 (2012). 4 [FLM77] Tadeusz Figiel, Joram Lindenstrauss, and Vitali D Milman, The dimension of almost spherical sections of convex bodies, Acta Mathematica 139 (1977), no. 1, 53–94. 24 [GN10] [Gri01a] [Gri01b] Lee-Ad Gottlieb and Tyler Neylon, Matrix sparsification and the sparse null space problem , APPROX-RANDOM, 2010, pp. 205–218. 5 Dima Grigoriev, Complexity of positivstellensatz proofs for the knapsack, computational com- plexity 10 (2001), no. 2, 139–154. 1, 2, 30 Dima Grigoriev, Linear lower bound on degrees of positivstellensatz calculus proofs for the parity, Theor. Comput. Sci. 259 (2001), no. 1-2, 613–622. 1, 2, 30 32 [GS11] [GSS11] [GV01] [GW95] [HM13] [Kar99] [Kas77] Venkatesan Guruswami and Ali Kemal Sinop, Lasserre hierarchy, higher eigenvalues, and approximation schemes for graph partitioning and quadratic integer programming with psd objectives, FOCS, 2011, pp. 482–491. 1, 2, 7 Shayan Oveis Gharan, Amin Saberi, and Mohit Singh, A randomized rounding approach to the traveling salesman problem, FOCS, 2011, pp. 550–559. 7 Dima Grigoriev and Nicolai Vorobjov, Complexity of null-and positivstellensatz proofs, Annals of Pure and Applied Logic 113 (2001), no. 1, 153–160. 2 Michel X. Goemans and David P. Williamson, Improved approximation algorithms for maxi- mum cut and satisfiability problems using semidefinite progr amming, J. ACM 42 (1995), no. 6, 1115–1145, Preliminary version in STOC ’94. 7, 30 Aram Wettroth Harrow and Ashley Montanaro, Testing product states, quantum merlin-arthur games and tensor optimization, J. ACM 60 (2013), no. 1, 3, Preliminary version in FOCS ’10. 4 Howard J. Karloff, How good is the goemans-williamson max cut algorithm?, SIAM J. Comput. 29 (1999), no. 1, 336–350, Preliminary version in STOC ’96. 30 Boris Sergeevich Kashin, Diameters of some finite-dimensional sets and classes of smo oth functions, Izvestiya Rossiiskoi Akademii Nauk. Seriya Matematicheskaya 41 (1977), no. 2, 334–351, [Math. USSR-Izv. 11, 317333 (1978)]. 24 [Kho02] Subhash Khot, On the power of unique 2-prover 1-round games, IEEE Conference on Compu- tational Complexity, 2002, p. 25. 4, 28 [KMN11] Anna R. Karlin, Claire Mathieu, and C. Thach Nguyen, Integrality gaps of linear and semi- definite programming relaxations for knapsack , IPCO, 2011, pp. 301–314. 1 [KOTZ14] M. Kauers, R. O’Donnell, L.-Y. Tan, and Y. Zhou, Hypercontractive inequalities via sos, and the frankl-r odl graph, SODA, 2014. 2, 3 [Kri64] [KV05] [KZ12] [Las01] [Lau09] Jean-Louis Krivine, Anneaux pr ´eordonn ´es , Journal d’analyse math ´ematique 12 (1964), no. 1, 307–326. 2 Subhash Khot and Nisheeth K. Vishnoi, The unique games conjecture, integrality gap for cut problems and embeddability of negative type metrics into ℓ1 , FOCS, 2005, pp. 53–62. 28, 45 Pascal Koiran and Anastasios Zouzias, Hidden cliques and the certification of the restricted isometry property, CoRR abs/1211.0665 (2012). 5 Jean B. Lasserre, Global optimization with polynomials and the problem of moments, SIAM Journal on Optimization 11 (2001), no. 3, 796–817. 1, 2, 35 Laurent, Monique optimiza- and matrices moment squares, of Sums geometry, algebraic of applications Emerging polynomials, tion over Springer, homepage author’s at the version available on 2009, Updated http://homepages.cwi.nl/monique/files/moment-ima-update-new.pdf, pp. 157– 270. 2 [LS91] L ´aszl ´o Lov ´asz and Alexander Schrijver, Cones of matrices and set-functions and 0-1 optimiza- tion, SIAM Journal on Optimization 1 (1991), no. 2, 166–190. 1 33 [Nes00] Y. Nesterov, Squared functional systems and optimization problems, High performance opti- mization 13 (2000), 405–440. 1, 2 [O’D07] Ryan O’Donnell, Analysis of boolean functions, Lecture Notes. Available online at , 2007. 45 [OZ13] [Par00] [Rag10] [RS10] [RST10] [RST12] [RT12] [SA90] [Sch08] [Sho87] [Ste74] [Ste10a] Ryan O’Donnell and Yuan Zhou, Approximability and proof complexity, SODA, 2013, pp. 1537–1556. 2, 3 Pablo A Parrilo, Structured semidefinite programs and semialgebraic geomet ry methods in robustness and optimization, Ph.D. thesis, California Institute of Technology, 2000. 1, 2 Prasad Raghavendra, Complexity of constraint satisfaction problems: Exact and ap- proximate, 2010, Talk at the Institute for Advanced Study, video available on http://video.ias.edu/csdm/complexityconstraint. 7 Prasad Raghavendra and David Steurer, Graph expansion and the unique games conjecture, STOC, 2010, pp. 755–764. 27, 28, 29, 42 Prasad Raghavendra, David Steurer, and Prasad Tetali, Approximations for the isoperimetric and spectral profile of graphs and related parameters , STOC, 2010, pp. 631–640. 28 Prasad Raghavendra, David Steurer, and Madhur Tulsiani, Reductions between expansion prob- lems, IEEE Conference on Computational Complexity, 2012, pp. 64–73. 29, 42 Prasad Raghavendra and Ning Tan, Approximating csps with global cardinality constraints using sdp hierarchies, SODA, 2012, pp. 373–387. 1 Hanif D Sherali and Warren P Adams, A hierarchy of relaxations between the continuous and convex hull representations for zero-one programming problems, SIAM Journal on Discrete Mathematics 3 (1990), no. 3, 411–430. 1 Grant Schoenebeck, Linear level Lasserre lower bounds for certain k-CSPs, FOCS, 2008, pp. 593–602. 1, 2, 30 NZ Shor, An approach to obtaining global extremums in polynomial mathematical program- ming problems, Cybernetics and Systems Analysis 23 (1987), no. 5, 695–700. 1, 2 Gilbert Stengle, A nullstellensatz and a positivstellensatz in semialgebraic geometry, Mathe- matische Annalen 207 (1974), no. 2, 87–97. 2 Steurer, David and complexity the games unique of On sion, 2010, Princeton University, TR-887-10, Tech. Report ftp://ftp.cs.princeton.edu/techreports/2010/887.pdf. 30 expan- graph Available at [Ste10b] , Subexponential algorithms for d-to-1 two-prover games and for certifying almost perfect expansion, Manuscript, available from the author’s website., 2010. 42 [SWW12] Daniel A. Spielman, Huan Wang, and John Wright, Exact recovery of sparsely-used dictionar- ies, Journal of Machine Learning Research - Proceedings Track 23 (2012), 37.1–37.18. 6, 8, 23 [Tul09] [ZP01] Madhur Tulsiani, Csp gaps and reductions in the lasserre hierarchy, STOC, 2009, pp. 303–312. 1 Michael Zibulevsky and Barak A Pearlmutter, Blind source separation by sparse decomposi- tion in a signal dictionary, Neural computation 13 (2001), no. 4, 863–882. 6 34 A Pseudoexpectation toolkit We recall here the definition of pseudoexpectation from [ BBH+12] and prove some of its useful properties. Some of these were already proven in [BBH+12] but others are new. Definition A.1. Let … be a functional that maps polynomial P over ’n of degree at most r into a real number which we denote by … x P( x) or … P for short. We say that … is a level-r pseudo-expectation functional (r- p.e.f. for short) if it satisfies: Linearity For every polynomials P, Q of degree at most r and α, β ∈ ’, …(αP + βQ) = α … P + β … Q. Positivity For every polynomial P of degree at most r/2, … P2 > 0. Normalization … 1 = 1 where on the RHS, 1 denotes the degree-0 polynomial that is the constant 1. The functional … can be represented by a table of size nO(r) containing the pseudo-expectations of every monomial of degree at most r (or some other linear basis for polynomials of degree at most r). For a linear …, the map P 7→ … P2 is a quadratic form. Hence, … satisfies the positivity condition if and functional only if the corresponding quadratic form is positive semidefinite. It follows that the convex set of level- r pseudo-expectation functionals over ’n admits an nO(r) -time separation oracle, and hence the r-round SoS relaxation can be solved up to accuracy ε in time (mn · log(1/ε))O(r) . … P := … P(X ) is a level-r pseudo-expectation For every random variable X over ’n , the functional functional for every r. As r → ∞, this hierarchy of pseudo-expectations will converge to the expectations of a true random variable [Las01], in general the convergence is not guaranteed to happen in a finite number of steps [DKL11], although for most problems of interest in TCS, n levels would suffice for either exact convergence or sufficiently close approximation. We now record various useful ways in which pseudoexpectations behave close to actual expectations. For two polynomials P and Q, we write P (cid:22) Q if Q = P + Pm i=1 R2 i for some polynomials R1 , . . . , Rm . If P and Q have degree at most r, then P (cid:22) Q implies that … P 6 … Q every r-p.e.f. …. This follows using linearity and positivity, as well as the (not too hard to verify) observation that if Q − P = Pi R2 i then it must hold that deg(Ri ) 6 max{deg(P), deg(Q)}/2 for every i. One of the most useful properties of pseudo-expectation is that it satisfies the Cauchy–Schwarz inequal- ity: Lemma A.2 (Pseudo Cauchy–Schwarz,[ BBH+ 12]). Let P and Q be two polynomials of degree at most r. Then, … PQ 6 √ … P2 · p … Q2 for any degree-2r pseudo-expectation functional …. … P2 , … Q2 > 0. Then, by linearity of …, we may assume that … P2 = Proof. We first consider the case … Q2 = 1. Since 2PQ (cid:22) P2+Q2 (by expanding the square (P−Q)2 ), it follows that … PQ 6 1 … P2+ 1 … Q2 = 2 2 It remains to consider the case … P2 = 0. In this case, 2αPQ (cid:22) P2 + α2Q2 implies that 1 as desired. … PQ 6 α · 1 … Q2 for all α > 0. Thus … PQ = 0, as desired. (cid:3) 2 In particular this implies the following corollary Corollary A.3 ([BBH+12]). If P is a polynomial of degree 6 r, and … x is a 2r-p.e.f. such that … P( x)2 = 0, then … P( x)Q( x) = 0 for every Q of degree 6 r. Proof. By Lemma A.2, … PQ 6 p … P2 q … Q2 = 0 35 (cid:3) … X∼D where r = ck and r′ = (c + 1)k. In this paper we also need the following variant of H older’s inequality: Lemma A.4 (Pseudoexpectation H older). Let d, c, k ∈ Ž, D be a level ℓ > 10dck pseudodistribution over ’n , and P a sum of squares n-variate polynomial of degree d, then P(X )r (cid:19)r ′ /r P(X )r ′ > (cid:18) … X∼D Proof. We’ll do the proof by induction on r. The base case is r = c in which case this is simply the pseudoexpectation Cauchy Schwarz that … P(X )2c > ( … P(X )c )2 . Define D′ to be the pseudodistribution obtained by reweighing D according to P(X )r−c . Using …D′ P(X )2c > (cid:16) …D′ P(X )c (cid:17)2 we can write !2 …D P(X )r+x > …D P(X )r−c P(X )c …D P(X )r−cP(X )2c = …D P(X )r−c …D P(X )r−c …D P(X )r−c moving things around we get that P(X )r−c P(X )r (cid:19)2 P(X )r+c > (cid:18) … / … … D D D which using our induction hypothesis on r vs r − c, we can lower bound by P(X )r (cid:19)(r+c)/r P(X )r (cid:19)(r−c)/r P(X )r (cid:19)2 = (cid:18) … / (cid:18) … (cid:18) … D D D We sometime would need to extend a pseudoexpectation of one random variable to a pseudoexpectation of two independent copies of it. The following lemma would be useful there (cid:3) Lemma A.5. Suppose that X and Y are two pseudodistributions of level ℓ. Then we can define a level ℓ pseudoexpectation operator on X, Y such that for every two polynomials P Q of degree at most ℓ/2, … P(X )Q(Y ) = ( … P(X ))( … Q(Y )). are monomials, Proof. We define the pseudoexpectation operator in the obvious way— for every set of ℓ indices i1 , . . . , ik , jk+1 , . . . , jℓ we let pE Xi1 · · · Xik · Y jk+1 · · · Y jd = ( … Xi1 · · · Xik ) · ( … Y jk+1 · · · Y jd ) and extend it lin- early to all monomials. Clearly … 1 = 1 and so the only thing left to do is to prove that for every polynomial P of degree 6 ℓ/2 in the X, Y variables … P(X, Y )2 > 0. P Mi (X )Ni (Y ) where Mi , Ni Write P(X, Y ) = Pi, j Mi (X )M j (X )Ni (Y )N j (Y ) and so under our definition … P(X, Y )2 = Xi, j ( … Mi (X )M j (X ))( … Ni (Y )N j (Y )) = hA, Bi where A and B are the matrices defined by Ai, j = … Mi(X )M j (X ) and Bi, j = … Ni (Y )N j (Y ). But the pseudo- expectation conditions on X, Y implies that both these matrices are p.s.d and so their dot product is nonneg- ative. (cid:3) We would like to understand how polynomials behave on linear subspaces of ’n . A map P : ’n → ’ is polynomial over a linear subspace V ⊆ ’n if P restricted to V agrees with a polynomial in the coefficients for some basis of V . Concretely, if g1 , . . . , gm is an (orthonormal) basis of V , then P is polynomial over V if P( f ) agrees with a polynomial in h f , g1 i, . . . , h f , gm i. We say that P (cid:22) Q holds over a subspace V if P − Q, as a polynomial over V , is a sum of squares. then P(X, Y )2 = 36 Lemma A.6 ([BBH+12]). Let P and Q be two polynomials over ’n of degree at most r, and let B : ’n → ’k be a linear operator. Suppose that P (cid:22) Q holds over the kernel of B. Then, … P 6 … Q holds for any r-p.e.f. … over ’n that satisfies … f kB f k2 = 0. i ( f ) + Pk Proof. Since P (cid:22) Q over the kernel of B, we can write Q( f ) = P( f ) + Pm i=1 R2 j=1 (B f ) jS j ( f ) for … f R2 polynomials R1 , . . . , Rm and S 1 , . . . , S k over ’n . By positivity, i ( f ) > 0 for all i ∈ [m]. We claim that … f (B f ) jS j ( f ) = 0 for all j ∈ [k] (which would finish the proof). This claim follows from the f act that … f (B f )2 j = 0 for all j ∈ [k] and Lemma A.2. (cid:3) Lemma A.7 ([BBH+12]). The relation P2 (cid:22) P holds if and only if 0 (cid:22) P (cid:22) 1. Furthermore, if P2 (cid:22) P and 0 (cid:22) Q (cid:22) P, then Q2 (cid:22) Q. Proof. If P (cid:23) 0, then P (cid:22) 1 implies P2 (cid:22) P. (Multiplying both sides with a sum of squares preserves the order.) On the other hand, suppose P2 (cid:22) P. Since P2 (cid:23) 0, we also have P (cid:23) 0. Since 1− P = P − P2 + (1− P)2 , the relation P2 (cid:22) P also implies P (cid:22) 1. For the second part of the lemma, suppose P2 (cid:22) P and 0 (cid:22) Q (cid:22) P. Using the first part of the lemma, we have P (cid:22) 1. It follows that 0 (cid:22) Q (cid:22) 1, which in turn implies Q2 (cid:22) Q (using the other direction of the first part of the lemma). (cid:3) Fact A.8. If f is a d-f.r.v. over ’U and {Pv }v∈U are polynomials of degree at most k, then g with g(v) = Pv ( f ) is a level-(d/k) pseudodistribution over ’U . (For a polynomial Q of degree at most d/k, the pseudo- …g Q({g(v)}v∈U ) := … f Q({Pv ( f )}v∈U ) .) expectation is defined as Lemma A.9 ([BBH+12]). For f , g ∈ L2 (U ), 2 k f k2 + 1 2 kgk2 . h f , gi (cid:22) 1 Proof. The right-hand side minus the LHS equals the square polynomial 1 2 h f − g, f − gi (cid:3) Here is another form of the Cauchy–Schwarz inequality. Lemma A.10 (Function Cauchy–Schwarz inequality,[ BBH+ 12]). If ( f , g) is a level-2 p.d. over ’U × ’U , then f k f k2 · r … f ,gh f , gi 6 r … … g kgk2 . Proof. Let ¯f = f / q … f k f k2 and ¯g = g/ q …g kgk2 . Note … ¯f k ¯f k2 = … ¯g k ¯gk2 = 1. Since by Lemma A.9, h ¯f , ¯gi (cid:22) 1/2k ¯f k2 + 1/2k ¯gk2 , we can conclude the desired inequality, g kgk2 · 1 ¯g k ¯gk2 ! f k f k2 · r … f k f k2 · r … f ,gh f , gi = r … ¯f , ¯gh ¯f , ¯gi 6 r … ¯f k ¯f k2 + 1 … g kgk2 … … . … (cid:3) 2 2 {z } =1 And it implies another form of H older’s inequality Corollary A.11 (Function H older’s inequality,[BBH+ 12]). If ( f , g) is a level 4 p.d. over ’U × ’U , then 4 !1/4 … 4 !3/4 f (ω)g(ω)3 6 … … f k f k4 g kgk4 … f ,g ω∈U Proof. Using Lemma A.2 twice, we have f (ω)2 g(ω)2 !1/2 … 4 !1/2 6 … g kgk4 f ,g 4 !1/4 … 4 !3/4 6 … f k f k4 g kgk4 f (ω)g(ω)3 . . … f ,g … ω∈U … ω∈U 37 (cid:3) A.1 Spectral norm and SOS proofs Here we note the following alternative characterization of the spectral norm of a polynomial: Lemma A.12. Let P be a degree-4 homogenous polynomial , then kPkspectral 6 c if and only if there is a sum of squares degree 4 polynomial S such that P( x) = ck xk4 2 − S ( x). Proof. Suppose that kPkspectral 6 C . Then there is an n2 × n2 matrix M such that M · x⊗4 = P( x) for all x M = cI − S where I is the n2 × n2 identity and S is a positive semidefinite matrix. That is, S = P λiQ⊗2 for i some λi > 0 and Qi ∈ ’n2 . Now, if we consider S as a degree 4 polynomial S ( x) = S · x⊗4 then it equals P λi (Qi · x⊗2 )2 and hence it is a sum of squares, and it satisfies P( x) = cI · x⊗4 − S ( x) = c Xi, j x2 i x2 j − S ( x) = ck xk4 2 − S ( x) . 2 − P Ri ( x)2 where the Ri ’s are quadratic polynomials. We On the other hand, suppose that P( x) = ck xk4 can let ri ∈ ’n2 be such that ri · x⊗2 = Ri ( x), and then let M be the quadratic operator on Rn2 such that 2 − P(ri · y)2 for every y ∈ ’n2 . One can easily verify that the spectral norm of M is at most c M (y) = ckyk2 and M · x⊗4 = P( x) for every x ∈ ’n . (cid:3) B Low-Rank Tensor Optimization For a vector x ∈ ’n , let k xk denote the Euclidean norm of x. For a polynomial P ∈ ’[X1 , . . . , Xn ], we define def its norm as kPk = max{P( x) k xk = 1}. Consider an n-variate degree-4 polynomial P of the form P( x) = Pr i=1 Qi ( x)2 for quadratic polynomials Q1 , . . . , Qr . Theorem B.1. There exists an algorithm that, given P and ε, computes kPk up to multiplicative error ε in time exp(poly(r, ε)). Proof. For λ ∈ ’n , consider the polynomial Qλ ( x) = Pr i=1 λiQi ( x). First, we claim that maxkλk=1 kQλ k = kPk1/2 . On the one hand, kQλ k 6 kλk · kPk1/2 by Cauchy–Schwarz. 1 P(x∗ )1/2 (Q1 ( x), . . . , Qr ( x)) for some vector x∗ ∈ ’n , then Qλ ( x∗ ) = P( x∗ )1/2 . On the other hand, if λ = Therefore, if we choose x∗ as a unit vector that maximizes P, then kQλ k > P( x∗ )1/2 = kPk1/2 . Next, we claim that we can compute maxkλk=1 kQλ k up to error ε in time exp(poly(r, ε)). Since Qλ is quadratic, we can compute kQλ k in polynomial time. (The norm of Qλ is equal to the largest singular value of the coefficient matrix of Qλ .) The idea is to compute kQλ k for all vectors λ ∈ Nε , where Nε is an ε-net of the unit ball in ’r . Let λ∗ be the vector that achieves the maximum, x∗ be the corresponding input, and u∗ be the vector (Q1 ( x∗ ), . . . , Qr ( x∗ )). Thus maxkλk=1 kQλ k2 = hλ∗ , u∗ i2 and ku∗ k = kPk. Therefore, for every λ kQλ k2 > kQλ ( x∗ )k2 = hλ, u∗ i2 . But if kλ − λ∗ k 6 ε then hλ∗ , u∗ i − hλ, u∗ i 6 kλ − λ∗ kku∗ k = kλ − λ∗ kkPk . Thus if kλ − λ′ k 6 ε then we get a 1 − O(ε) multiplicative approximation to kPk. (cid:3) Corollary B.2. If M is a symmetric n2 × n2 PSD matrix with Frobenius norm at most 1 then we can compute an ε additive approximation to k xk=1hM, x⊗4 i max in poly(n) exp(poly(1/ε)) time. 38 Proof. Write M in its eigenbasis as M = P λiQ⊗2 for n × n matrices {Qi } with Frobenius norm at most 1, i and let M ′ = Pλi>ε λiQ⊗2 i = 1 we know that the rank of M ′ is at most 1/ε2 , and therefore . Since P λ2 i we can compute a 1 ± ε multiplicative approximation to the maximum of hM ′ , x⊗4 i over unit x (which in particular implies an ε additive approximation since this value is bounded by 1). But this implies an ε-additive approximation for this maximum over M since these quantities can differ by at most ε. (cid:3) C LOCC Polynomial Optimization Let P ∈ ’[X ]4 be a degree-4 homogeneous polynomial of the form P(X ) = A1 (X ) · B1(X )+ · · ·+ Am (X ) · Bm (X ) for quadratic polynomials A1 , . . . , Am ∈ ’[X ]2 with 0 (cid:22) Ai (cid:22) kX k2 and quadratic polynomials B1 , . . . , Bm ∈ ’[X ]2 with Bi (cid:23) 0 and Pi Bi (cid:22) kX k2 . Note that this corresponds to the tensor corresponding to P having a one-way local operations and classical communication (LOCC) norm bounded by 1 [BCY11]. Without loss of generality, we may assume Pi Bi = kX k2 . (We can choose Am = 0 and choose Bm appropriately without changing P.) Our goal is to compute the norm of P, defined as kPk = maxk xk=1 P( x). In the quantum setting, this corresponds to finding the maximum probability of accep tance by a separable state for the measurement operator P. In this section, we will show that sum-of-squares relaxations provide good approximation for the norm of polynomials of the form above. (For the case that the variables of A1 , . . . , Am are disjoint from the variables for B1 , . . . , Bm , the theorem is due to Brand ao, Christandl, and Yard [ BCY11]. Up to the Gaussian rounding step, the proof here is essentially the same as the proof by Brand ao and Harrow [ BH13].) Theorem C.1. Sum-of-squares relaxations with degree d achieve the following approximations for the norm of degree-4 polynomials P of the form above: – the value of the relaxation is at most 3kPk + ε for degree d > O(1/ε2 ) · log n. – in the case that the variables in A 1 , . . . , Am are disjoint from the variables in B1 , . . . , Bm , the value of the relaxation is at most kPk + ε for degree d > O(1/ε2 ) log n. Direct Rounding. As direct rounding for a distribution {X }, we choose a Gaussian variable with the same first two moments as {X }. To analyze this rounding procedure, the following lemma is useful. The lemma considers an arbitrary distribution over unit vectors in ’n (intended to maximize P). We express the second moment ρ = … X X⊤ of this distribution as convex combination ρ = Pi βiρi for βi = …X Bi (X ) and ρi = …X X X T Bi (X )/βi . By the assumptions on the distribution {X }, the matrices ρ and ρ1 , . . . , ρm are positive semidefinite and have trace 1 ( density matrices). The quantum entropy H (ρ) = − Tr ρ log ρ is concave so that H (ρ) > Pi βiH (ρi ). The assumption of the lemma is that the in- equality is approximately tight. Roughly speaking, this condition means that the ρi matrices are close ρ. For the distribution {X }, this condition means that reweighing by the polynomials Bi does not affect second moments of the distribution. We say that the distribution has low global correlation with respect to the poly- nomials B1 , . . . , Bm . (This notion is related to but distinct from the notion of global correlation in [BRS11]). The lemma asserts that if the distribution {X } has low global correlation with respect to the polynomials B1 , . . . , Bm, then sampling X independently for the A-part and B-part of the polynomial P gives roughly the same value as sampling X in a correlated way. (The next lemma explains why our direct rounding achieves at least the quantity corresponding to sampling X independently for the two parts.) Lemma C.2. Let {X } be a distribution over ’n that satisfies the constraint kX k2 = 1. Suppose Pi βiH (ρi ) > H (Pi βiρi ) − ε2 for ρi = …X X X⊤ Bi(X )/βi and βi = …X Bi (X ). Then, Xi Bi (X ) > Xi Ai (X ) · … Ai (X )Bi (X ) − ε . … … X X X 39 … X Moreover, the statement holds if {X } is a degree-4 pseudo-distribution. Proof. Consider the block-diagonal density matrix ρ = Pi βiρi ⊗ ei e⊤i , and the block-diagonal measurement matrix A = Pi Ai ⊗ ei e⊤i . (In this construction, we identify the quadratic polynomial A with its representation as a symmetric square matrix.) Furthermore, consider the partial traces ρA = TrB ρ = Pi βiρi and ρB = TrA ρ = Pi βi ei eT i . We can express the two sides of the conclusion of the lemma as follows, Xi Ai (X ) · Bi(X ) = Tr Aρ , … X Xi Bi(X ) = Tr A(ρA ⊗ ρB ) . Ai (X ) · … X Since A has spectral norm at most 1, we can bound the difference byTr A(ρ − ρA ⊗ ρB ) 6 kρ − ρA ⊗ ρBk∗ . s inequality, kρ − ρA ⊗ ρB k2 6 (Here, k·k∗ is the trace norm —the dual of the spectral norm.) By Pinsker’ H (ρA ) + H (ρB ) − H (ρ). By the chain rule, H (ρ) = H (ρB ) + Pi βiH (ρi ). The assumption of the lemma allows us to bound the trace norm by kρ − ρA ⊗ ρB k2 6 H (Pi βiρi ) − Pi βiH (ρi ) 6 ε2 . At this point, the conclusion of the lemma follows from the bound Tr A(ρ − ρA ⊗ ρB ) 6 kρ − ρA ⊗ ρB k∗ 6 ε. (cid:3) The following lemma shows that Gaussian rounding achieves a value at least as large as the value achieved by sampling {X } independently for the A-part and B-part of the polynomial P. kX k2 = 1. Suppose {X ′ } is a Lemma C.3. Let {X } be a distribution over ’n that satisfies the constraint Gaussian distribution with the same first two moments as {X }. Then, {X ′ } satisfies …X ′ kX ′ k2 = 1, …X ′ kX ′ k4 = 3, and Ai (X ′ ) · Bi (X ′ ) > Xi X ′ Xi Bi (X ) . Ai (X ) · … … … X X Moreover, the statement holds if {X } is a degree-4 pseudo-distribution. Proof. Using the assumption Ai , Bi (cid:23) 0, the lemma follows from the fact that Gaussian variables P, Q satisfy … P2Q2 > … P2 … Q2 . (cid:3) The previous two lemmas together yield the following corollary. kX k2 = 1. Suppose {X ′ } and Corollary C.4. Let {X } be a distribution over ’n that satisfies the constraint ε > 0 are as in the previous two lemmas, that is, {X ′ } is a Gaussian distribution with the same first two moments as {X } and Pi βiH (ρi ) > H (Pi βiρi ) − ε2 for ρi = …X X X⊤ Bi(X )/βi and βi = …X Bi(X ). Then, X ′ kX ′ k4 = 3 . P(X ′ ) > … P(X ) − ε and … … X ′ X Moreover, the statement holds if {X } is a degree-4 pseudo-distribution. Making progress. The following lemma shows that there exists a low-degree polynomial so that reweigh- ing by the polynomial results in a distribution that has low global correlation with respect to the polynomials B1 , . . . , Bm. kX k2 = 1. Then, there exists Lemma C.5. Let {X } be a distribution over ’n that satisfies the constraint a polynomial B ∈ ’[X ]2d of the form B = Bi(1) · · · Bi(d) with d = O(1/ε2 ) log n such that Pi βiH (ρi ) > H (Pi βiρi ) − ε2 for ρi = …X X X⊤ B(X )Bi(X )/βi and βi = …X B(X )Bi(X ). Moreover, the statement holds if {X } is a degree-d + 4 pseudo-distribution. 40 Proof. By contraposition, suppose that Pi βiH (ρi ) < H (Pi βiρi ) − η holds for all polynomials B of the form B = Bi(1) · · · Bi(d ′ ) with d′ 6 d = 10/ε2 · log n. Then, we can greedily construct a sequence of polynomial Bi∗ (1) , . . . , Bi∗ (d) such that in each step the entropy decreases by at least η. In particular, H (ρ∗ ) 6 H (ρ) − η · d for ρ∗ ∝ …X X X⊤ Bi∗ (1) · · · Bi∗ (d) (X ) and ρ = …X X X⊤ . Since H (ρ) 6 log n and H (ρ∗ ) > 0, we have η > 1/d · log n = ε2/10. As desired it follows that there exists a polynomial B of the desired form such that Pi βiH (ρi ) > H (Pi βiρi ) − ε2 . (cid:3) Putting things together. The following lemma combines the conclusion about direct-rounding and making-progress. kX k2 = 1 and P(X ) > c. Then, Lemma C.6. Let {X } be a distribution over ’n that satisfies the constraints there exists a polynomial B ∈ ’[X ]2d of the form B = Bi(1) · · · Bi(d) with d = O(1/ε2 ) log n such that the {X } reweighted by B(X ) satisfies Gaussian distribution X ′ that matches the first two moments of X ′ kX ′ k4 = 3 . P(X ) > c − ε and … … X ′ (Concretely, {X ′ } is the Gaussian distribution that satisfies …X ′ Q(X ′ ) = …X Q(X )B(X )/ …X B(X ) for quadratic polynomial Q). Moreover, the statement holds for degree-2d + 4 pseudo-distributions. Proof. Take the polynomial B as in Lemma C.5. Reweigh the distribution {X } by the polynomial B. Apply Corollary C.4 to the resulting distribution. (cid:3) At this time, we have all ingredients for the proof of Theorem C.1. Proof of Theorem C.1. Let {X } be a degree-d + 4 pseudo-distribution over ’n that satisfies the constraints kX k2 = 1 and P(X ) > c for d = O(1/ε2 ) log n. By the previous lemma, there exists a distribution {X ′ } over ’n such that …X ′ P(X ′ )/ …X ′ kX ′ k4 > c/3− ε. It follows that there exists a vector x ∈ ’n with P( x)/k xk4 > c/3− ε. (We can also find such a vector e fficiently because we can sample from the distribution {X ′ } efficiently and the random variables P(X ′ ) and kX ′ k are well-behaved.) By homogeneity, we get kPk > c/3 − ε. In the case that the variables Y in A1 , . . . , Am are disjoint from the variables Z in B1 , . . . , Bm , we can modify the direct-rounding distribution {X ′ } = {(Y ′ , Z ′)} slightly and sample the variables Y ′ for the Ai polynomials independently from the variables Z ′ for the Bi polynomials. By Lemma C.2, we still have …X ′ P(X ′ ) > c − ε. We can assume that …kY ′ k2 = …kZ ′ k2 = 1/2 (by adding the corresponding constraint to the sos relaxation). Therefore, …kY ′ k2 kX ′ k2 = 1/4. It follows that there exists a vector x = (y, z) in ’n with P(y, z)/(kyk2 · kzk2 ) > 4(c − ε). By homogeneity, we can assume that kyk2 = 1/2 and kzk2 = 1/2. In this case, k xk2 = 1 and P( x)gc − ε as desired. (cid:3) D The 2-to-q norm and small-set expansion This appendix reproduces from [BBH+12] the proof that a graph is a small-set expander if and only if the projector to the subspace of its adjacency matrix’s top eigenvalues has a bounded 2 → q norm for even q > 4. We also note that while [BBH+12] stated their result for the decision question, it does yield an efficient algorithm to transform a vector in the top eigenspace with large 4 norm into a small set that does not expand. Notation. For a regular graph G = (V, E ) and a subset S ⊆ V , we define the measure of S to be µ(S ) = S /V and we define G(S ) to be the distribution obtained by picking a random x ∈ S and then outputting a random neighbor y of x. We define the expansion of S , to be ΦG (S ) = (cid:144)y∈G(S )[y < S ], where y is a random neighbor of x. For δ ∈ (0, 1), we define ΦG (δ) = minS ⊆V :µ(S )6δ ΦG (S ). We often drop the subscript G from 41 ΦG when it is clear from context. We identify G with its normalized adjacency (i.e., random walk) matrix. For every λ ∈ [−1, 1], we denote by V>λ (G) the subspace spanned by the eigenvectors of G with eigenvalue at least λ. The projector into this subspace is denoted P>λ (G). For a distribution D, we let cp(D) denote the collision probability of D (the probability that two independent samples from D are identical). Our main theorem of this section is the following: Theorem D.1. For every regular graph G , λ > 0 and even q, 1. (Norm bound implies expansion) For all δ > 0, ε > 0, kP>λ (G)k2→q 6 ε/δ(q−2)/2q implies that ΦG (δ) > 1 − λ − ε2 . 2. (Expansion implies norm bound) There is a constant c such that for all δ > 0, ΦG (δ) > 1 − λ2−cq implies kP>λ (G)k2→q 6 2/ √δ. Moreover there is an efficient algorithm such that given a function f ∈ V>λ (G) such that k f kq > 2k f k2 / √δ finds a set S of measure less than δ such that ΦG (S ) 6 1 − λ2−cq . Corollary D.2. If there is a polynomial-time computable relaxation R yielding good approximation for the 2 → q, then the Small-Set Expansion Hypothesis of [RS10] is false. Proof. Using [RST12], to refute the small-set expansion hypothesis it is enough to come up with an efficient algorithm that given an input graph G and sufficiently small δ > 0, can distinguish between the Yes case: ΦG (δ) < 0.1 and the No case ΦG (δ′ ) > 1 − 2−c log(1/δ′ ) for any δ′ > δ and some constant c. In particular for all η > 0 and constant d, if δ is small enough then in the No case ΦG (δ0.4 ) > 1 − η. Using Theorem D.1, in the Yes case we know kV1/2 (G)k2→4 > 1/(10δ1/4 ), while in the No case, if we choose η to be smaller then η(1/2) in the Theorem, then we know that kV1/2 (G)k2→4 6 2/ √δ0.2 . Clearly, if we have a good approximation for the 2 → 4 norm then, for sufficiently small δ we can distinguish between these two cases. (cid:3) The first (easier) part of Theorem D.1 is proven in Section D.1. The second part will follow from the following lemma: Lemma D.3. Set e = e(λ, q) := 2cq /λ, with a constant c 6 100. Then for every λ > 0 and 1 > δ > 0, if G is a graph that satisfies cp(G(S )) 6 1/(eS ) (D.1) for all S with µ(S ) 6 δ, then k f kq 6 2k f k2 / √δ for all f ∈ V>λ (G). Moreover, there is an efficient algorithm that given a function f ∈ V>λ (G) such that k f kq > 2k f k2 / √δ finds a set S that violates ( D.1). Proving the second part of Theorem D.1 from Lemma D.3. We use the variant of the local Cheeger bound obtained in [Ste10b, Theorem 2.1], stating that if ΦG (δ) > 1 − η then for every f ∈ L2 (V ) satisfying 2 6 c √ηk f k2 k f k2 1 6 δk f k2 2 , kG f k2 2 . The proof follows by noting that for every set S , if f is the characteristic function of S then k f k1 = k f k2 2 = µ(S ), and cp(G(S )) = kG f k2 2 /(µ(S )S ). Because this local Cheeger bound is algorithmic (and transforms a function with large L2 /L1 ratio into a set by simply using a threshold cut), this part is algorithmic as well. (cid:3) Proof of Lemma D.3. Fix λ > 0. We assume that the graph satisfies the condition of the Lemm a with e = 2cq /λ, for a constant c that we’ll set later. Let G = (V, E ) be such a graph, and f be function in V>λ (G) with k f k2 = 1 that maximizes k f kq . We write f = Pm i=1 αiχi where χ1 , . . . , χm denote the eigenfunctions of G with values λ1 , . . . , λm that are at least λ. Assume towards a contradiction that k f kq > 2/ √δ. We’ll prove that g = Pm i=1 (αi /λi )χi satisfies kgkq > 10k f kq /λ. This is a contradiction since (using λi ∈ [λ, 1]) kgk2 6 k f k2 /λ, and we assumed f is a function in V>λ (G) with a maximal ratio of k f kq /k f k2 . (To prove the “moreover” part, where we don’t assume f is the maximal function, we repeat this process with g until we get stuck.) 42 Let U ⊆ V be the set of vertices such that f ( x) > 1/ √δ for all x ∈ U . Using Markov and the fact that … x∈V [ f ( x)2 ] = 1, we know that µ(U ) = U /V 6 δ, meaning that under our assumptions any subset S ⊆ U q q > 2q /δq/2 , we know that U contributes at satisfies cp(G(S )) 6 1/(eS ). On the other hand, because k f k q q q = … x∈V f ( x)q . That is, if we define α to be µ(U ) … x∈U f ( x)q then α > k f k least half of the term k f k q /2. q We’ll prove the lemma by showing that kgk q > 10α/λ. f ( x) ∈ Let c be a sufficiently large constant (c = 100 will do). We define U i to be the set { x ∈ U : [ci / √δ, ci+1 / √δ)}, and let I be the maximal i such that U i is non-empty. Thus, the sets U0 , . . . , U I form a partition of U (where some of these sets may be empty). We let αi be the contribution of U i to α. That is, αi = µi … x∈U i f ( x)q , where µi = µ(U i ). Note that α = α0 + · · · + αI . We’ll show that there are some indices i1 , . . . , iJ such that: > α/(2c10 ). (i) αi1 + · · · + αiJ (ii) For all j ∈ [ J ], there is a nonnegative function g j : V → ’ such that …x∈V g j ( x)q > eαi j /(10c2 )q/2 . (iii) For every x ∈ V , g1 ( x) + · · · + gJ ( x) 6 g( x). Showing these will complete the proof, since it is easy to see that for two nonnegative functions and even q, g′ , g′′ , …(g′ ( x) + g′′ ( x))q > … g′ ( x)q + … g′′ ( x)q , and hence (ii) and (iii) imply that > (e/(10c2 )q/2 ) Xj kgk4 4 = … g( x)4 Using (i) we conclude that for e > (10c)q /λ, the right-hand side of (D.2) will be larger than 10α/λ. i1 , . . . , iJ iteratively. We let I be initially the set {0..I } of all indices. For j = 1, 2, ... We find the indices we do the following as long as I is not empty: 1. Let i j be the largest index in I. 2. Remove from I every index i such that αi 6 c10αi j /2i−i j . We let J denote the step when we stop. Note that our indices i1 , . . . , iJ are sorted in descending order. For every step j, the total of the αi ’s for all indices we removed is less than c10αi j and hence we satisfy (i). The crux of our argument will be to show (ii) and (iii). They will follow from the following claim: Claim D.4. Let S ⊆ V and β > 0 be such that S 6 δ and f ( x) > β for all x ∈ S . Then there is a set T of size at least eS such that … x∈T g( x)2 > β2/4. The claim will follow from the following lemma: (D.2) αi j . Lemma D.5. Let D be a distribution with cp(D) 6 1/N and g be some function. Then there is a set T of size N such that … x∈T g( x)2 > (… g(D))2 /4. Proof. Identify the support of D with the set [M ] for some M , we let pi denote the probability that D outputs i, and sort the pi ’s such that p1 > p2 · · · pM . We let β′ denote … g(D); that is, β′ = PM i=1 pig(i). We separate to two cases. If Pi>N pig(i) > β′/2, we define the distribution D′ as follows: we set (cid:144)[D′ = i] to be pi for i > N , and we let all i 6 N be equiprobable (that is be output with probability (PN i=1 pi )/N ). Clearly, … g(D′ ) > Pi>N pig(i) > β′ /2, but on the other hand, since the maximum probability of any element in D′ is at most 1/N , it can be expressed as a convex combination of flat distribut ions over sets of size N , implying that one of these sets T satisfies …x∈T g( x) > β′/2, and hence … x∈T g( x)2 > β′2 /4. The other case is that PN i=1 pig(i) > β′/2. In this case we use Cauchy–Schwarz and argue that g(i)2   i  β′2 /4 6  N N Xi=1 Xi=1 p2 43 (D.3) . the right-hand side of (D.3) is upper bounded by (cid:3) But using our bound on the collision probability, 1 N PN i=1 g(i)2 = …x∈[N ] g( x)2 . Proof of Claim D.4 from Lemma D.5. By construction f = Gg, and hence we know that for every x, f ( x) = …y∼x g(y). This means that if we let D be the distribution G(S ) then g(y) = … y∼x g(y) > … … g(D) = … x∈S f ( x) > β . x∈S … … y∼x x∈S By the expansion property of G , cp(D) 6 1/(eS ) and thus by Lemma D.5 there is a set T of size eS satisfying … x∈T g( x)2 > β2 /4. (cid:3) We will construct the functions g1 , . . . , gJ by applying iteratively Claim D.4. We do the following for j = 1, . . . , J : 1. Let T j be the set of size eU i j that is obtained by applying Claim D.4 to the function f and the set U i j . /4, where we let βi = ci / √δ (and hence for every x ∈ U i , βi 6 f ( x) 6 cβi ). Note that …x∈T j g( x)2 > β2 i j 2. Let g′j be the function on input x that outputs γ · g( x) if x ∈ T j and 0 otherwise, where γ 6 1 is a scaling factor that ensures that … x∈T j g′ ( x)2 equals exactly β2 /4. i j 3. We define g j ( x) = max{0, g′j ( x) − Pk< j gk ( x)}. Note that the second step ensures that g′j ( x) 6 g( x), while the third step ensures that g1 ( x) + · · · + g j ( x) 6 g′j ( x) for all j, and in particular g1 ( x) + · · · + gJ ( x) 6 g( x). Hence the only thing left to prove is the following: Claim D.6. … x∈V g j ( x)q > eαi j /(10c)q/2 Proof. Recall that for every i, αi = µi … x∈U i f ( x)q , and hence (using f ( x) ∈ [βi , cβi ) for x ∈ U i ): q q i 6 αi 6 µicq β µiβ i . Now fix T = T j . Since … x∈V g j ( x)q is at least (in fact equal) µ(T ) … x∈T g j ( x)q and µ(T ) = eµ(U i j ), we can use (D.4) and … x∈T g j ( x)q > (E x∈T g j ( x)2 )q/2 , to reduce proving the claim to showing the following: g j ( x)2 > (cβi j )2/(10c2 ) = β2 (D.5) /10 . … i j x∈T /4. We claim that (D.5) will follow by showing that for every k < j, (D.4) We know that … x∈T g′j ( x)2 = β2 i j /4 , (D.6) g′k ( x)2 6 100−i′ · β2 … i j x∈T where i′ = ik − i j . (Note that i′ > 0 since in our construction the indices i1 , . . . , iJ are sorted in descending order.) Indeed, (D.6) means that if we let momentarily kg j k denote q…x∈T g j ( x)2 then ∞Xi′ =1 kg j k > kg′j k − kPk< j gk k > kg′j k − Xk< j kgk k > kg′j k(1 − 10−i′ ) > 0.8kg′j k . The first inequality holds because we can write g j as g′j − h j , where h j = min{g′j , Pk< j gk }. Then, on the one hand, kg j k > kg′j k − kh j k, and on the other hand, kh j k 6 kPk< j gk k since g′j > 0. The second inequality holds because kgk k 6 kg′k k. By squaring (D.7) and plugging in the value of kg′j k2 we get (D.5). 44 (D.7) Proof of (D.6). By our construction, it must hold that c10αik /2i′ 6 αi j , (D.8) since otherwise the index i j would have been removed from the I at the kth step. Since βik = βi j ci′ , we can plug (D.4) in (D.8) to get µik c10+4i′ /2i′ 6 c4µi j or 6 µi j (2/c)4i′ c−6 . µik Since T i = eU i for all i, it follows that T k /T 6 (2/c)4i′ c−6 . On the other hand, we know that /4 = c2i′ β2 … x∈T k g′k ( x)2 = β2 /4. Thus, ik i j … x∈T and now we just choose c sufficiently large so that c2/24 > 100. 6 24i′ c2i′ −4i′ −6 β2 i j g′k ( x)2 /4 6 (24 /c2 )i′ β2 i j /4 , (cid:3) (cid:3) D.1 Norm bound implies small-set expansion In this section, we show that an upper bound on 2 → q norm of the projector to the top eigenspace of a graph implies that the graph is a small-set expander. This proof appeared elsewhere implicitly [KV05, O’D07] or explicitly [BGH+12, BBH+12] and is presented here only for completeness. Fix a graph G (identified with its normalized adjacency matrix), and λ ∈ (0, 1), letting V>λ denote the subspace spanned by eigenfunctions with eigenvalue at least λ. If p, q satisfy 1/ p + 1/q = 1 then k xk p = maxy:kykq61 h x, yi. Indeed, h x, yi 6 k xk p kykq by H older’s in- equality, and by choosing yi = sign( xi ) xi p−1 and normalizing one can see this equality is tight. In particular, for every x ∈ L(U ), k xkq = maxy:kykq/(q−1)61 h x, yi and kykq/(q−1) = maxk xkq 61 h x, yi. As a consequence kykq/(q−1)61 hAT y, xi = kAT kq/(q−1)→2 kAk2→q = max max k xk2 61,kykq/(q−1)61 hA x, yi = max k xk261kA xkq = Note that if A is a projection operator, A = AT . Thus, part 1 of Theorem D.1 follows from the following lemma: Lemma D.7. Let G = (V, E ) be regular graph and λ ∈ (0, 1). Then, for every S ⊆ V , Φ(S ) > 1 − λ − kVλ k2 q/(q−1)→2 µ(S )(q−2)/q Proof. Let f be the characteristic function of S , and write f = f ′ + f ′′ where f ′ ∈ Vλ and f ′′ = f − f ′ is the projection to the eigenvectors with value less than λ. Let µ = µ(S ). We know that Φ(S ) = 1 − h f , G f i/k f k2 2 = 1 − h f , G f i/µ , And k f kq/(q−1) = (cid:16)… f ( x)q/(q−1) (cid:17)(q−1)/q = µ(q−1)/q , meaning that k f ′ k 6 kVλ kq/(q−1)→2 µ(q−1)/q . We now write h f , G f i = h f ′ , G f ′i + h f ′′ , G f ′′ i 6 k f ′ k2 2 + λk f ′′ k2 2 6 kVk2 q/(q−1)→2 k f k2 q/(q−1) + λµ 6 kVk2 2→qµ2(q−1)/q + λµ . (D.10) (D.9) Plugging this into (D.9) yields the result. (cid:3) 45
1805.06821
1
1805
2018-05-17T15:28:49
External memory BWT and LCP computation for sequence collections with applications
[ "cs.DS" ]
We propose an external memory algorithm for the computation of the BWT and LCP array for a collection of sequences. Our algorithm takes the amount of available memory as an input parameter, and tries to make the best use of it by splitting the input collection into subcollections sufficiently small that it can compute their BWT in RAM using an optimal linear time algorithm. Next, it merges the partial BWTs in external memory and in the process it also computes the LCP values. We prove that our algorithm performs O(n AveLcp) sequential I/Os, where n is the total length of the collection, and AveLcp is the average Longest Common Prefix of the collection. This bound is an improvement over the known algorithms for the same task. The experimental results show that our algorithm outperforms the current best algorithm for collections of sequences with different lengths and for collections with relatively small average Longest Common Prefix. In the second part of the paper, we show that our algorithm can be modified to output two additional arrays that, used with the BWT and LCP arrays, provide simple, scan based, external memory algorithms for three well known problems in bioinformatics: the computation of maximal repeats, the all pairs suffix-prefix overlaps, and the construction of succinct de Bruijn graphs. To our knowledge, there are no other known external memory algorithms for these problems.
cs.DS
cs
External memory BWT and LCP computation for sequence collections with applications Lavinia Egidi1 University of Eastern Piedmont, Alessandria, Italy [email protected] https://orcid.org/0000-0002-9745-0942 Felipe A. Louza2 Department of Computing and Mathematics, University of São Paulo, Ribeirão Preto, Brazil [email protected] https://orcid.org/0000-0003-2931-1470 Giovanni Manzini3 University of Eastern Piedmont, Alessandria, Italy IIT CNR, Pisa Italy [email protected] https://orcid.org/0000-0002-5047-0196 Guilherme P. Telles4 Institute of Computing, University of Campinas, Campinas, Brazil [email protected] Abstract We propose an external memory algorithm for the computation of the BWT and LCP array for a collection of sequences. Our algorithm takes the amount of available memory as an input parameter, and tries to make the best use of it by splitting the input collection into subcollections sufficiently small that it can compute their BWT in RAM using an optimal linear time algorithm. Next, it merges the partial BWTs in external memory and in the process it also computes the LCP values. We prove that our algorithm performs O(n avelcp) sequential I/Os, where n is the total length of the collection, and avelcp is the average Longest Common Prefix of the collection. This bound is an improvement over the known algorithms for the same task. The experimental results show that our algorithm outperforms the current best algorithm for collections of sequences with different lengths and for collections with relatively small average Longest Common Prefix. In the second part of the paper, we show that our algorithm can be modified to output two additional arrays that, used with the BWT and LCP arrays, provide simple, scan based, external memory algorithms for three well known problems in bioinformatics: the computation of maximal repeats, the all pairs suffix-prefix overlaps, and the construction of succinct de Bruijn graphs. To our knowledge, there are no other known external memory algorithms for these problems. 2012 ACM Subject Classification Theory of computation → Design and analysis of algorithms Keywords and phrases Burrows-Wheeler Transform, Longest Common Prefix Array, All pairs suffix-prefix overlaps, Succinct de Bruijn graph, Maximal repeats Digital Object Identifier 10.4230/LIPIcs.CVIT.2016.23 8 1 0 2 y a M 7 1 ] S D . s c [ 1 v 1 2 8 6 0 . 5 0 8 1 : v i X r a 1 L.E. was partially supported by the University of Eastern Piedmont project Behavioural Types for Dependability Analysis with Bayesian Networks 2 F.A.L. was supported by the grant #2017/09105-0 from the São Paulo Research Foundation (FAPESP) 3 G.M. was partially supported by PRIN grant 201534HNXC 4 G.P.T. acknowledges the support of CNPq © John Q. Public and Joan R. Public; 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:13 Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 23:2 External memory LCP and BWT computation with applications 1 Introduction A fundamental problem in bioinformatics is the ability to efficiently search into the billions of DNA sequences produced by NGS studies. The Burrows Wheeler transform (BWT) is a well known structure which is the starting point for the construction of compressed indices for collection of sequences [24]. The BWT is often complemented with the Longest Common Prefix (LCP) array since the latter makes it possible to efficiently emulate Suffix Tree algorithms [14, 30]. The construction of such data structures is a challenging problem. Although the final outcome is a compressed index, construction algorithms can be memory hungry and the necessity of developing lightweight, i.e. space economical, algorithms was recognized since the very beginning of the field [8, 26, 27]. When even lightweight algorithms do not fit in RAM, one has to resort to external memory construction algorithms (see [13, 18, 19, 23] and references therein). Although the space efficient computation of the BWT in RAM is well studied, and remarkable advances have been recently obtained [2, 29], for external memory computation the situation is less satisfactory. For collections of sequences, the first external memory algorithm is the BCR algorithm described in [1] that computes the multi-string BWT for a collection of total size n, performing a number of sequential I/Os proportional to nK, where K is the length of the longest sequence in the collection. This approach is clearly not competitive when the sequences have non homogeneous lengths, and it is far from the theoretical optimal even for sequences of equal length. Nevertheless, the simplicity of the algorithm makes it very effective for collections of relatively short sequences, and this has become the reference tool for this problem. This approach was later extended [10] to compute also the LCP values with the same asymptotic number of I/Os. When computing also the LCP values, or when the input strings have different lengths, the algorithm uses O(m) words of RAM, where m is the number of input sequences. In this paper, we present a new external memory algorithm for the computation of the BWT and LCP array for a collection of sequences. Our algorithm takes the amount of available RAM as an input parameter, and tries to make the best use of it by splitting the input into subcollections sufficiently small so that it can compute their BWT in internal memory using an optimal linear time algorithm. Next, it merges the partial BWTs in external memory and in the process it also computes the LCP values. Since the LCP values are computed in a non-standard order, the algorithm is completed by an external memory merge sort procedure that computes the final LCP array. We prove that our algorithm performs O(n avelcp) sequential I/Os, where avelcp is the average Longest Common Prefix of the input sequence. The experimental results show that our algorithm is indeed much faster than BCR for collections of strings of different lengths and when the average LCP is relatively small. To our knowledge, the only other known external memory algorithm for computing the BWT and LCP arrays is the one recently proposed in [4]. The algorithm performs O(n maxlcp) sequential I/Os where maxlcp is the maximum of the LCP values. Since avelcp ≤ maxlcp ≤ K (the maximum string length), in terms of complexity the algorithm in [4] is between BCR and our proposal while the RAM usage is O(m + k). We plan to experimentally compare this algorithm to ours in the near future. Another contribution of the paper, which follows from our main result, is the design of simple external memory algorithms for three well known problems, namely: the computation of maximal repeats [21, 33], the computation of the all pairs suffix-prefix overlaps [16, 32, 34], and the construction of succinct de Bruijn graphs [3, 6, 7]. This is achieved using the BWT and LCP arrays, together with two additional arrays that our algorithm can compute without L. Egidi, F. A. Louza, G. Manzini, G. P. Telles 23:3 bwt b c $1 a a b context $1 ab$1 abcab$1 b$1 bcab$1 cab$1 lcp -1 0 2 0 1 0 -1 bwt c $2 c a a a b b context $2 aabcabc$2 abc$2 abcabc$2 bc$2 bcabc$2 c$2 cabc$2 lcp -1 0 1 3 0 2 0 1 -1 id 1 2 2 1 2 1 2 1 2 1 2 2 1 2 lcp12 -1 0 0 1 2 3 5 0 1 2 4 0 1 3 -1 bwt12 b c $2 c c $1 a a a a a b b b context $1 $2 aabcabc$2 ab$1 abc$2 abcab$1 abcabc$2 b$1 bc$2 bcab$1 bcabc$2 c$2 cab$1 cabc$2 Figure 1 LCP array and BWT for s1 = abcab$1 and s2 = aabcabc$2, and multi-string BWT and corresponding LCP array for the same strings. Column id shows, for each entry of bwt12 = bc$2cc$1aaaabbb whether it comes from s1 or s2. any asymptotic slowdown. The first one is the so called Document Array providing for each suffix the ID of the sequence it belongs to; the second one is a bit array indicating whether each suffix is a substring of the one immediately following it in lexicographic order. Our external memory algorithms for these problems are derived from known internal memory algorithms, but they process the input data in a single sequential scan. In addition, for the problem of the all pairs suffix-prefix, we go beyond the recent solutions [32, 34] that compute all the overlaps, by computing only the overlaps above a certain length, still spending constant time per reported overlap. 2 Background Let s[1, n] denote a string of length n over an alphabet Σ of size σ. As usual, we assume s[n] is a special symbol (end-marker) not appearing elsewhere in s and lexicographically smaller than any other symbol. We write s[i, j] to denote the substring s[i]s[i + 1]··· s[j]. If j ≥ n we assume s[i, j] = s[i, n]. If i > j or i > n then s[i, j] is the empty string. Given two strings s1 and s2 we write s1 (cid:22) s2 (s1 ≺ s2) to denote that s1 is lexicographically (strictly) smaller than s2. We denote by LCP(s1, s2) the length of the longest common prefix between s1 and s2. order of s's suffixes, that is, for i = 1, . . . , n − 1, s[sa[i], n] ≺ s[sa[i + 1], n]. The suffix array sa[1, n] associated to s is the permutation of [1, n] giving the lexicographic The longest common prefix array lcp[1, n + 1] is defined for i = 2, . . . , n by lcp[i] = LCP(s[sa[i − 1], n], s[sa[i], n]); (1) the lcp array stores the length of the longest common prefix (LCP) between lexicographically consecutive suffixes. For convenience we define lcp[1] = lcp[n + 1] = −1. Let s1[1, n1], . . . , sk[1, nk] be such that s1[n1] = $1, . . . , sk[nk] = $k, where where $1 < . . . < $k are k symbols not appearing elsewhere in s1, . . . , sk and smaller than any other symbol. Let sa1···k[1, n] denote the suffix array of the concatenation s1 ··· sk of total length CVIT 2016 23:4 External memory LCP and BWT computation with applications h=1nh. The multi-string BWT [10, 25] of s1, . . . , sk, denoted by bwt1···k[1, n], is defined n = Σk as (sj[nj] bwt1···k[i] = sj[sa1···k[i] − Σj−1 h=1nh − 1] if sa1···k[i] = Σj−1 if Σj−1 h=1nh + 1 < sa1···k[i] ≤ Σj h=1nh + 1 h=1nh. (2) Essentially bwt1···k is a permutation of the symbols in s1, . . . , sk such that the position in bwt1···k of si[j] is given by the lexicographic rank of its context si[j + 1, ni] (or si[1, ni] if j = ni). Fig. 1 shows an example with k = 2. Notice that for k = 1, this is the usual Burrows-Wheeler transform [9]. Given the suffix array sa1···k[1, n] of the concatenation s1 ··· sk, we consider the corres- ponding LCP array lcp1···k[1, n] defined as in (1) (see again Fig. 1). Note that, for i = 2, . . . , n, lcp1···k[i] gives the length of the longest common prefix between the contexts of bwt1···k[i] and bwt1···k[i − 1]. We stress that all practical implementations use a single $ symbol as end-marker for all strings to avoid alphabet explosion, but end-markers from different strings are then sorted as described, i.e., on the basis of the index of the strings they belong to. Computing multi-string BWTs. The gSACA-K algorithm [22], based on algorithm SACA- K [31], computes the suffix array for a string collection. Given a collection of strings of total length n, gSACA-K computes the suffix array for their concatenation in O(n) time using (σ +1) log n additional bits (in practice, only 2KB are used for ASCII alphabets). It is optimal for alphabets of constant size σ = O(1). The multi-string bwt1···k of s1, . . . , sk can be easily obtained from the suffix array as in (2). gSACA-K can compute also the lcp array lcp1···k still in linear time using only the additional space for the lcp values. Merging multi-string BWTs. The Gap algorithm [11], based on an earlier algorithm by Holt and McMillan [17], is a simple procedure to merge multi-string BWTs. In its original formulation the Gap algorithm can also merge LCP arrays, but in this paper we compute LCP values using a different approach more suitable for external memory execution. We describe here only the main idea behind Gap and refer the reader to [11] for further details. Given k multi-string BWTs for disjoint subcollections, the Gap algorithm computes a multi-string BWT for the whole collection. The computation does not explicitly need the collection but only the multi-string BWTs to be merged. For simplicity in the following we assume we are merging k single-string BWTs bwt1 = bwt(s1), . . . , bwtk = bwt(sk); the algorithm does not change in the general case where the inputs are multi-string BWTs. Recall that computing bwt1···k amounts to sorting the symbols of bwt1, . . . , bwtk according to the lexicographic order of their contexts, where the context of symbol bwtj[i] is sj[saj[i], nj], for j = 1, . . . , k. The Gap algorithm works in successive iterations. After the h-th iteration the entries of each bwtλ are sorted on the basis of the first h symbols of their context. More formally, the output of the h-th iteration is a k-valued vector Z(h) containing nλ = sλ entries λ for each λ = 1, . . . , k, such that the following property holds. (cid:73) Property 1. For λ1, λ2 ∈ {1, . . . , k}, λ1 < λ2, and i = 1, . . . , nλ1 and j = 1, . . . , nλ2 the i-th λ1 precedes the j-th λ2 in Z(h) iff sλ1[saλ1[i], saλ1[i]+h−1] (cid:22) sλ2[saλ2[j], saλ2[j]+h−1]. (cid:74) Following Property 1 we identify the i-th λ in Z(h) with bwtλ[i] so that Z(h) corresponds to a permutation of bwt1···k. Property 1 is equivalent to state that we can logically partition Z(h) into b(h) + 1 blocks Z(h)[1, '1], Z(h)['1 + 1, '2], . . . , Z(h)['b(h) + 1, n] (3) L. Egidi, F. A. Louza, G. Manzini, G. P. Telles 23:5 such that each block is either a singleton or corresponds to the set of bwt1···k symbols whose contexts are prefixed by the same length-h string. Within each block, for λ1 < λ2, the symbols of bwtλ1 precede those of bwtλ2 and the context of any symbol in block Z(h)['j + 1, 'j+1] is lexicographically smaller than the context of any symbol in block Z(h)['k + 1, 'k+1] with k > j. We keep explicit track of such blocks using a bit array B[1, n + 1] such that at the end of iteration h it is B[i] 6= 0 if and only if a block of Z(h) starts at position i, i.e. lcp1···k[i] = h − 1. By Property 1, when all entries in B are nonzero, Z(h) describes how the bwtj (j = 1, . . . , k) should be merged to get bwt1···k. The eGap algorithm 3 At a glance, the eGap algorithm for computing the multi-string BWT and LCP array in external memory works in three phases. First it builds multi-string BWTs for sub-collections in internal memory, then it merges these BWTs in external memory and generates the LCP values. Finally, it merges the LCP values in external memory. Phase 1: BWT computation. Given a collection of sequences s1, s2, . . . , sk, we split it into sub-collections sufficiently small that we can compute the multi-string SA for each one of them using the linear time internal memory gSACA-K algorithm (Section 2). After computing each SA, Phase 1 writes each multi-string BWT to disk in uncompressed form using one byte per character. Phase 2: BWT merging and LCP computation. This part of the algorithm is based on the Gap algorithm described in Section 2 but it is designed to work efficiently in external memory and it computes LCP values in addition to merging the input (multi-string) BWTs. In the following we assume that the input consists of k BWTs bwt1, . . . , bwtk of total length n over an alphabet of size σ. The input BWTs are read from disk and never moved to internal memory. We denote by bwt1···k and lcp1···k the output BWT and LCP arrays. The algorithm initially sets Z(0) = 1n12n2 . . . knk and B = 10n−11. Since the context of every symbol is prefixed by the same length-0 string (the empty string), initially there is a single block containing all symbols. At iteration h the algorithm computes Z(h) from Z(h−1) as follows. We define an array F[1, σ] such that F[c] contains the number of occurrences of characters smaller than c in bwt1···k. F partitions Z(h) into σ buckets, one for each symbol. Using Z(h−1) we scan the partially merged BWT, and whenever we encounter the BWT character c coming from bwti, with i ∈ {1, . . . , k}, we store it in the next free position of bucket c in Z(h); note that c is not actually moved, instead we write i in its corresponding position in Z(h). Instead of using distinct arrays Z(0), Z(1), . . . we only use two arrays Zold and Znew, that are kept on disk. At the beginning of iteration h it is Zold = Z(h−1) and Znew = Z(h−2); at the end Znew = Z(h) and the roles of the two files are swapped. While Zold is accessed sequentially, Znew is updated sequentially within each bucket, that is within each set of positions corresponding to a given character. Since the boundary of each bucket is known in advance we logically split the Znew file in buckets and write to each one sequentially. The key to the computation of the LCP array by eGap is to exploit the bitvector B used by Gap to mark the beginning of blocks. We observe that entry B[i] is set to 1 during iteration h = lcp1···k[i] + 1, when it is determined that the contexts of bwt1···k[i] and bwt1···k[i − 1] have a common prefix of length exactly h − 1 (and a new block is created). We introduce an additional bit array Bx such that, at the beginning of iteration h, Bx[i] = 1 iff B[i] has been set to 1 at iteration h − 2 or earlier. During iteration h, if B[i] = 1 we look at Bx[i]. If Bx[i] = 0 then B[i] has been set at iteration h − 1: thus we output to a temporary file Fh−2 the pair hi, h − 2i to record that lcp1···k[i] = h − 2, then we set Bx[i] = 1 so no pair for CVIT 2016 23:6 External memory LCP and BWT computation with applications position i will be produced in the following iterations. At the end of iteration h, file Fh−2 contains all pairs hi, lcp1···k[i]i with lcp[i] = h − 2; the pairs are written in increasing order of their first component, since B and Bx are scanned sequentially. These temporary files will be merged in Phase 3. As proven in [11, Lemma 7], if at iteration h of the Gap algorithm we set B[i] = 1, then at any iteration g ≥ h + 2 processing the entry Z(g)[i] will not change the arrays Z(g+1) and B. Since the roles of the Zold and Znew files are swapped at each iteration, and at iteration h we scan Zold = Z(h−1) to update Znew from Z(h−2) to Z(h), we can compute only the entries Z(h)[j] that are different from Z(h−2)[j]. In particular, any range [', m] such that Bx['] = Bx[' + 1] = ··· = Bx[m] = 1 can be added to a set of irrelevant ranges that the algorithm may skip in successive iterations (irrelevant ranges are defined in terms of the array Bx as opposed to the array B, since before skipping an irrelevant range we need to update both Zold and Znew). We read from one file the ranges to be skipped at the current iteration and simultaneously write to another file the ranges to be skipped at the next iteration (note that irrelevant ranges are created and consumed sequentially). Since skipping a single irrelevant range takes O(k + σ) time, an irrelevant range is stored only if its size is larger than a given threshold t and we merge consecutive irrelevant ranges whenever possible. In our experiments we used t = max(256, k + σ). In the worst case the space for storing irrelevant ranges could be O(n) but in actual experiments it was always less than 0.1n bytes. As in the Gap algorithm, when all entries in B are nonzero, Zold describes how the BWTs bwtj (j = 1, . . . , k) should be merged to get bwt1···k, and a final sequential scan of the input BWTs along with Zold allows to write bwt1···k to disk, in sequential order. Our implementation can merge at most 27 = 128 BWTs at a time because we use 7 bits to store each entry of Zold and Znew. These arrays are maintained on disk in two separate files; the additional bit of each byte are used to keep the current and the next copy of B. The bit array Bx is stored separately in a file of size n/8 bytes. To merge of a set of k > 128 BWTs we split the input in subsets of cardinality 128 and merge them in successive rounds. We have also implemented a semi-external version of the merge algorithm that uses n bytes of RAM. The i-th byte is used to store Zold[i] and Znew[i] (3 bits each), B[i] and Bx[i]. Phase 3: LCP merging At the end of Phase 2 all LCP-values have been written to the temporary files Fh on disk as pairs hi, lcp[i]i. Each file Fh contains all pairs with second component equal to h in order of increasing first component. The computation of the LCP array is completed using a standard external memory multiway merge [20, ch. 5.4.1] of maxlcp sorted files, where maxlcp = maxi(lcp1···k[i]) is the largest LCP value. 3.1 Analysis During Phase 1, gSACA-K computes the suffix array for a sub-collection of total length m using 9m bytes. If the available RAM is M, the input is split into subcollections of size ≈ M/9. Since gSACA-K runs in linear time, if the input collection has total size n, Phase 1 takes O(n) time overall. A single iteration of Phase 2 consists of a complete scan of Z(h−1) except for the irrelevant ranges. Since the algorithm requires maxlcp iterations, without skipping the irrelevant ranges the algorithm would require maxlcp sequential scans of O(n) bytes of data. Reasoning as in [11, Theorem 8] we get that by skipping irrelevant ranges the overall cost of this phase is O(n avelcp) time and sequential I/Os, where avelcp is the arithmetic average of the entries in the final LCP array. L. Egidi, F. A. Louza, G. Manzini, G. P. Telles 23:7 Phase 3 takes O(dlogK maxlcpe) rounds; each round merges K LCP files by sequen- tially reading and writing O(n) bytes of data. The overall cost of Phase 3 is therefore O(n logK maxlcp) sequential I/Os. In our experiments we used K = 256; since in our tests maxlcp < 216 two merging rounds were always sufficient. The above analysis suggests that Phase 2 is the most expensive phase of the eGap algorithm. Indeed, in our experiments we found that Phase 2 always took at least 95% of the overall running time. 4 Experiments In this section we report some preliminary experiments on the eGap algorithm. Testing external memory algorithms is extremely time consuming since, to make a realistic external memory setting, one has to use an amount of RAM smaller than the size of the data. If more RAM is available, even if the algorithm is supposedly not using it, the operative system will use it to temporary store disk data and the algorithm will be no longer really working in external memory. This phenomenon will be apparent also from our experiments. For this reasons we used datasets of size 8GB, reported in Table 1, and a machine with 32GB of RAM but reduced at boot time to 1GB, to simulate input data much larger than the available RAM, and 8GB, to simulate input data of approximately the same size as the available RAM and test also the semi external version of our algorithm. Note that for a 8GB input, the output BWT+LCP data has size 24GB, so even 8GB RAM is still significantly less than the input and the output combined. We implemented eGap in ANSI C based on the source code of Gap [11] and gSACA- K [22]. Our algorithm was compiled with GNU GCC ver. 4.6.3, with optimizing option -O3. The source code is freely available at https://github.com/felipelouza/egap/. The experiments were conducted on a machine with GNU/Linux Debian 7.0/64 bits operating system using an Intel i7-3770 3.4 GHz processor with 8 MB cache, 32 GB of RAM and a 2.0 TB SATA hard disk with 7200 RPM and 64 MB cache. Table 1 Datasets used in our experiments. shortreads are DNA reads from human genome5 trimmed to length 100. longreads are Illumina HiSeq 4000 paired-end RNA-seq reads from plant Setaria viridis6 trimmed to length 300. pacbio are PacBio RS II reads from Triticum aestivum (wheat) genome7 with different lengths. pacbio.1000 are the strings from pacbio trimmed to length 1,000. Columns 5 and 6 show the maximum and average lengths of the single strings. Columns 7 and 8 show the maximum and average LCPs of the collections. Name shortreads longreads pacbio.1000 pacbio Size GB σ N. of strings Max Len Ave Len Max LCP Ave LCP 27.90 90.28 18.05 18.32 85,899,345 28,633,115 8,589,934 942,248 99 299 876 3,084 100 300 1,000 71,561 100 300 1,000 9,116 8.0 8.0 8.0 8.0 6 5 5 5 We compared eGap with BCR+LCP8 from the BEETL Library [1] which is the currently most used tool for the construction of BWT and LCP arrays in external memory. The tool 5 ftp://ftp.sra.ebi.ac.uk/vol1/ERA015/ERA015743/srf/ 6 https://trace.ncbi.nlm.nih.gov/Traces/sra/?run=ERR1942989 7 https://trace.ncbi.nlm.nih.gov/Traces/sra/?run=SRR5816161 8 https://github.com/BEETL/BEETL/ CVIT 2016 23:8 External memory LCP and BWT computation with applications BCR+LCP cannot handle input sequences of different lengths, so for the pacbio dataset we used the tool extLCP [10] by the same authors. As a reference we also tested the external memory tool eGSA [23] that computes the Suffix and LCP arrays for a collection of sequences. However, we tested eGSA only using 32GB of RAM since the authors in [23] showed its running time degrades about 25 times when the RAM is restricted to the input size. The results in Table 2 show that, as predicted by the theory, eGap's running time per input byte is roughly proportional to the average LCP. Again according to the theoretical analysis in [1], BCR+LCP running time per input byte is proportional to the sequence length. Using 1GB RAM the tool BCR+LCP could not handle the shortreads dataset because of insufficient internal memory, and it stopped with an internal error after four days of computation on the pacbio.1000 dataset. Due to lack of time we could not complete the experiments with extLCP with the pacbio dataset. We have contacted the authors about the error and plan to complete the comparison in the near future. We also plan to include in the comparison the two recent algorithms proposed in [4, 5]. Table 2 Running times in µ seconds per input byte. Name shortreads longreads pacbio.1000 pacbio eGap 8GB 32GB 2.87 3.76 6.76 9.75 1.81 3.54 3.42 1.82 BCR+LCP 8GB 1GB × 5.65 16.01 18.54 × 54.00 > 70 > 50 eGSA 32GB 32GB 2.08 3.96 1.89 10.88 1.89 36.96 1.74 – 1GB 17.19 52.39 24.88 23.43 Although incomplete, the results show that BCR+LCP is competitive for short reads or collections with a large average LCP, while eGap clearly dominates in datasets with long reads and relatively small average LCP. In particular, when the available RAM is at least equal to the size of the input, eGap can use the semi-external strategy described in Section 3 and becomes significantly faster. Note that using 32GB RAM both algorithms become much faster: even though they allocate for their use a small fraction of that RAM, the operative system uses the remaining RAM as a buffer and avoids many disk accesses. Applications 5 In this section we show that the eGap algorithm, in addition to the BWT and LCP arrays, can output additional information that can be used to design efficient external memory algorithms for three well known problems on sequence collections: the computation of maximal repeats, the all pairs suffix-prefix overlaps, and the construction of succinct de Bruijn graphs. For these problems we describe algorithms which are derived from known (internal memory) algorithms but they process the input data in a single sequential scan. In addition, the amount of RAM used by the algorithms is usually much smaller than the size of inputs since it grows linearly with the number of sequences and the maximum LCP value. Our starting point is the observation that the eGap algorithm can also output an array which provides, for each bwt entry, the id of the sequence to which that entry belongs. In information retrieval this is usually called the Document Array, so in the following we will denote it by da. In Phase 1 the gSACA-K algorithm can compute the da together with the lcp and bwt using only additional 4n bytes of space to store the da entries. These partial da's can be merged in Phase 2 using the Znew array in the same way as the BWT entries. In the following we use bwt, lcp, and da to denote the multistring BWT, LCP and Document Array L. Egidi, F. A. Louza, G. Manzini, G. P. Telles 23:9 of a collection of m sequences of total length n. We write s to denote the concatenation s1 ··· sm and sa to denote the suffix array of s. We will use s and sa to prove the correctness of our algorithms, but neither s nor sa are used in the computations. 5.1 Computation of Maximal Repeats Different notions of maximal repeats have been used in the bioinformatic literature to model different notions of repetitive structure. We use a notion of maximal repeat from [15, Ch. 7]: we say that a string α is a Type 1 maximal repeat if α occurs in the collection at least twice and every extension, i.e. cα or αc with c ∈ Σ, occurs fewer times. We consider also a more restrictive notion: we say that a string α is a Type 2 maximal repeat if α occurs in the collection at least twice and every extension of α occurs at most once. We first show how to compute Type 1 maximal repeats with a sequential scan of the arrays bwt and lcp. The crucial observation is that we have a substring of length ' that prefixes sa entries j, j + 1, . . . , i iff lcp[h] ≥ ' for h = j + 1, . . . , i, and both lcp[j] and lcp[i + 1] are smaller than '. To ensure that the repeat is maximal, we also require that there exists h ∈ [j + 1, i] such that lcp[h] = ' and that bwt[j, i] contains at least two distinct characters. During the scan, we maintain a stack containing pairs hj, lcp[h]i such that j ≤ h; in addition ifhj0, lcp[h0]i is below hj, lcp[h]i on the stack, then h0 < j. If, when we reach position i ≥ h, the pair hj, lcp[h]i is in the stack this means that all positions k between j and i we have lcp[k] ≥ lcp[h]. To maintain this invariant, when we reach position i, if the current top pair hj, lcp[h]i has lcp[h] < lcp[i], then hi, lcp[i]i is pushed on top of the stack. Otherwise, all pairs hj, lcp[h]i with lcp[h] ≥ lcp[i] are popped from the stack; if  is the index of the last pair popped from the stack, pair h, lcp[i]i is pushed on the stack. The rationale for the latter addition is that for all  ≤ j ≤ i it is lcp[j] ≥ lcp[i] and therefore the prefix of length lcp[i] of s[sa[j], n] is the same as the prefix of the same length of s[sa[i], n]. It is not difficult to prove that for each stack entry hj, lcp[h]i, it is lcp[j − 1] < lcp[h]. If entry hj + 1, lcp[h]i is removed from the stack at iteration i + 1, by the above discussion lcp[j] < lcp[h]; lcp[i + 1] < lcp[h] (because hj + 1, lcp[h]i is being removed), and for k = j + 1, . . . , i lcp[k] ≥ lcp[h]. To ensure that we have found a Type 1 maximal repeat we only need to check that bwt[j, i] contains at least two distinct characters. To efficiently check this latter condition, for each stack entry hj, lcp[h]i we maintain a bitvector bj of size σ keeping track of the distinct characters in the array bwt from position j − 1 to the next stack entry, or to the last seen position for the entry at the top of the stack. When hj, lcp[h]i is popped from the stack its bitvector is or-ed to the previous stack entry in constant time; if hj, lcp[h]i is popped from the stack and immediately replaced with hj, lcp[i]i its bitvector survives as it is (essentially because it is associated with an index, not with a stack entry). Clearly, maintaining the bitvector does not increase the asymptotic cost of the algorithm. To find Type 2 maximal repeats, we are interested in consecutive LCP entries lcp[j], lcp[j + 1], . . . , lcp[i], lcp[i + 1], such that lcp[j] < lcp[j + 1] = lcp[j + 2] = ··· = lcp[i] > lcp[i + 1]. Indeed, this ensures that for h = j, . . . , i all suffixes s[sa[h], n] are prefixed by the same string α of length lcp[j + 1] and every extension αc occurs at most once. If this is the case, then α is a Type 2 maximal repeat if all characters in bwt[j, i] are distinct since this ensures that also every extension cα occurs at most once. In order to detect this situation, as we scan the lcp array we maintain a candidate pair hj + 1, lcp[j + 1]i such that j + 1 is the largest index seen so far for which lcp[j] < lcp[j + 1]. When we establish a candidate at j + 1 as above, we init a bitvector b marking entries bwt[j] and bwt[j + 1]. As long as the following values lcp[j + 2], lcp[j + 3], . . . are equal to lcp[j + 1] we go on updating b and if the same position is marked twice we discard hj + 1, lcp[j + 1]i. If we reach an index i + 1 such that CVIT 2016 23:10 External memory LCP and BWT computation with applications lcp[i + 1] > lcp[j + 1], we update the candidate and reinitialize b. If we reach i + 1 such that lcp[i + 1] < lcp[j + 1] and hj + 1, lcp[j + 1]i has not been discarded, then a repeat of Type 2 (with i − j + 1 repetitions) has been located. Note that when our algorithms discover Type 1 or Type 2 maximal repeats, we know the repeat length and the number of occurrences, so one can easily filter out non-interesting repeats (too short or too frequent). In some applications, for example the MUMmer tool [28], one is interested in repeats that occur in at least r distinct sequences, maybe exactly once for each sequence. Since for these applications the number of distinct sequences is relatively small, we can handle this requirements by simply scanning the da array simultaneously with the lcp and bwt arrays and keeping track of the sequences associated to a maximal repeat using a bitvector (or a union-find structure) as we do with characters in the bwt. 5.2 All pairs suffix-prefix overlaps In this problem we want to compute, for each pair of sequences si sj, the longest overlap between a suffix of si and a prefix of sj. Our solution follows closely the one in [32] which in turn was inspired by an earlier Suffix-tree based algorithm [16]. The algorithm in [32] solves the problem using a Generalized Enhanced Suffix array (consisting of the arrays sa, lcp, and da) in O(n + m2) time, which is optimal since there are m2 overlaps. However, for large collections it is natural to consider the problem of reporting only the overlaps larger than a given threshold τ still spending constant time per reported overlap. Our algorithm solves this more challenging problem. In the following we say that the suffix starting at sa[i] is special iff s[sa[i] + lcp[i + 1]] = $ or, in other words, if the suffix starting at sa[i] is a substring of the suffix starting at sa[i + 1] (not considering the end-marker $). For example, in Fig. 1 (right) the suffixes ab$0, abc$1, abcab$0 are all special. We can modify Phase 2 of our algorithm so that it outputs also a bit array xlcp such that xlcp[i] = 1 iff the suffix starting at sa[i] is special. This modification does not increase the asymptotic cost and requires only 2n bits of disk working space (details in the full paper). Our algorithm consists of a sequential scan of the arrays bwt, lcp, and da, and xlcp. We maintain m distinct stacks, stack[1], . . . , stack[m], one for each input sequence; stack[k] stores only special suffixes belonging to sequence k. When the scanning reaches position j, we store the pair hj, lcp[j + 1]i in stack[da[j]] if and only if xlcp[j] = 1 and lcp[j + 1] > τ. During the scanning we maintain the invariant that for all stack entries hj, lcp[j + 1]i, lcp[j + 1] is the length of longest common prefix between s[sa[j], n] and s[sa[i], n], where i is the next position to be scanned. To this end, when we reach position i we remove all entries hj, lcp[j + 1]i such that lcp[j + 1] > lcp[i + 1]. To do this spending constant time for removed entry requires some additional machinery: We maintain an array of lists top such that top['] contains the indexes k for which the entry at the top of stack[k] has LCP component equal to ' (this array is a stripped down version of [32]'s list). In addition, we maintain an additional stack lcpStack containing, in increasing order, the values ' such that some stack[k] contains an entry with LCP component equal to '. At iteration i, we use lcpStack and the lists in top[·] to reach all stack[k] containing entries with LCP component greater than lcp[i + 1] and we remove them. After the removal, we update top['] where ' is the LCP value now at the top of stack[k]. Finally, if xlcp[i] = 1 and lcp[i + 1] > τ, we add hi, lcp[i + 1]i to stack[da[i]]; this requires that we also add da[i] to top[lcp[i + 1]], and that we remove da[i] from the list top['] where ' is the previous top LCP value in stack[da[i]] (to do this we need to maintain for each element at the top of the stack a pointer to its corresponding da entry in top). Since we perform a constant number of L. Egidi, F. A. Louza, G. Manzini, G. P. Telles 23:11 operations per entry, maintaining the above data structures takes O(n) time overall. The computation of the overlaps is done as in [32]. When the scanning reaches position i, we check whether bwt[i] = $. If this is the case, then s[sa[i], n] is prefixed by the whole sequence sda[i], hence the longest overlap between a prefix of sda[i] and a suffix of sk is given by the element currently at the top of stack[k], since by construction these stacks only contain special suffixes whose overlap with s[sa[i], n] is larger than τ. To spend time proportional to the number of reported overlaps, instead of accessing all stacks we access only those which are non-empty. This requires that we maintain an additional list containing all values ' such that top['] is non-empty. For each entry ' in this list, top['] gives us the id of the sequences with a suffix-prefix overlap with da[i] of length '. As in [32], we have to handle differently the case in which the whole sda[i] is a suffix of another sequence, but this can be done without increasing the overall complexity. Since we spend constant time for reported overlap, the overall cost of the algorithm, in addition to the scanning of the bwt/lcp/xlcp/da arrays, is O(n + Eτ), where Eτ is the number of suffix-prefix overlaps greater than τ. 5.3 Construction of succinct de Bruijn graphs A recent remarkable application of compressed data structures is the design of efficiently navigable succinct representations of de Bruijn graphs [3, 6, 7]. Formally, a de Bruijn graph for a collection of strings consists of a set of vertices representing the distinct k-mers appearing in the collection, with a directed edge (u, v) iff there exists a (k + 1)-mer α in the collection such that α[1, k] is the k-mer associated to u and α[2, k + 1] is the k-mer associated to v. The starting point of all de Bruijn graphs succinct representation is the BOSS repres- entation [7], so called from the authors' initials. For simplicity we now describe the BOSS representation of a k-order de Bruijn graph using the lexicographic order of k-mers, instead of the co-lexicographic order as in [7], which means we are building the graph with the direction of the arcs reversed. This is not a limitation since arcs can be traversed in both directions (or we can apply our construction to the input sequences reversed). Consider the N k-mers appearing in the collection sorted in lexicographic order. For each k-mer αi consider the array Ci of distinct characters c ∈ Σ ∪ {$} such that cαi appears in the collection. The concatenation W = C1C2 ··· CN is the first component of the BOSS representation. The second component is a binary array last, with last = W, such that last[j] = 1 iff W[j] is the last entry of some array Ci. Clearly, there is a bijection between entries in W and graph edges; in the array last each sequence 0i1 (i ≥ 0) corresponds to the outgoing edges of a single vertex with outdegree i + 1. Finally, the third component is a binary array W −, with W − = W, such that W −[j] = 1 iff W[j] comes from the array Ci, where αi is the lexicographically smallest k-mer prefixed by αi[1, k − 1] and preceded by W[j] in the collection. Informally, this means that αi is the lexicographically smallest k-mer with an outgoing edge reaching W[j]αi[1, k − 1]. Note that the number of 1's in last and W − is exactly N, i.e. the number of nodes in the de Bruijn graph. We now show how to compute W, last and W − by a sequential scan of the bwt and lcp array. The crucial observation is that the suffix array range prefixed by the same k-mer αi is identified by a range [bi, ei] of LCP values satisfying lcp[bi] < k, lcp['] ≥ k for ' = bi+1, . . . , ei and lcp[ei + 1] < k. Since k-mers are scanned in lexicographic order, by keeping track of the corresponding characters in the array bwt[bi, ei] we can build the array Ci and consequently W and last. To compute W − we simply need to keep track also of suffix array ranges corresponding to (k − 1)-mers. Every time we set an entry W[j] = c we set W −[j] = 1 iff this is the first occurrence of c in the range corresponding to the current (k − 1)-mers. If, in addition to the bwt and lcp arrays, we also scan the da array, then we can keep CVIT 2016 23:12 External memory LCP and BWT computation with applications track of which sequences contain any given graph edge and therefore obtain a succinct representation of the colored de Bruijn graph [12]. Finally, we observe that if our only objective is to build the k-order de Bruijn graph, then we can stop the phase 2 of our algorithm after the k-th iteration. Indeed, we do not need to compute the exact values of LCP entries greater than k, and also we do not need the exact BWT but only the BWT characters sorted by their length k context. References 1 Markus J. Bauer, Anthony J. Cox, and Giovanna Rosone. Lightweight algorithms for constructing and inverting the BWT of string collections. Theor. Comput. Sci., 483:134– 148, 2013. 2 Djamal Belazzougui. Linear time construction of compressed text indices in compact space. In STOC, pages 148–193. ACM, 2014. 4 3 Djamal Belazzougui, Travis Gagie, Veli Mäkinen, Marco Previtali, and Simon J. Puglisi. Bidirectional variable-order de Bruijn graphs. In LATIN, volume 9644 of Lecture Notes in Computer Science, pages 164–178. Springer, 2016. Paola Bonizzoni, Gianluca Della Vedova, Yuri Pirola, Marco Previtali, and Raffaella Rizzi. Computing the BWT and LCP array of a set of strings in external memory. CoRR, abs/1705.07756, 2017. Paola Bonizzoni, Gianluca Della Vedova, Yuri Pirola, Marco Previtali, and Raffaella Rizzi. Divide and conquer computation of the multi-string BWT and LCP array. In Proc. Com- putability in Europe (CiE), 2018. To appear. 6 Christina Boucher, Alexander Bowe, Travis Gagie, Simon J. Puglisi, and Kunihiko 5 Sadakane. Variable-order de Bruijn graphs. In DCC, pages 383–392. IEEE, 2015. 7 Alexander Bowe, Taku Onodera, Kunihiko Sadakane, and Tetsuo Shibuya. Succinct de Bruijn graphs. In WABI, volume 7534 of Lecture Notes in Computer Science, pages 225– 235. Springer, 2012. S. Burkhardt and J. Kärkkäinen. Fast lightweight suffix array construction and checking. In Proc. 14th Symposium on Combinatorial Pattern Matching (CPM '03), pages 55–69. Springer-Verlag LNCS n. 2676, 2003. 9 Michael Burrows and David J. Wheeler. A block-sorting lossless data compression al- 8 gorithm. Technical report, Digital SRC Research Report, 1994. 10 Anthony J. Cox, Fabio Garofalo, Giovanna Rosone, and Marinella Sciortino. Lightweight LCP construction for very large collections of strings. J. Discrete Algorithms, 37, 2016. Lavinia Egidi and Giovanni Manzini. Lightweight BWT and LCP merging via the Gap algorithm. In SPIRE, volume 10508 of Lecture Notes in Computer Science, pages 176–190. Springer, 2017. 11 13 14 12 Martin D. Muggli et. al. Succinct colored de Bruijn graphs. Bioinformatics, 33(20):3181– 3187, 2017. P. Ferragina, T. Gagie, and G. Manzini. Lightweight data indexing and compression in external memory. Algorithmica, 2011. Simon Gog and Enno Ohlebusch. Compressed suffix trees: Efficient computation and storage of LCP-values. ACM Journal of Experimental Algorithmics, 18, 2013. 15 D. Gusfield. Algorithms on Strings, Trees, and Sequences: Computer Science and Compu- tational Biology. Cambridge University Press, 1997. 16 Dan Gusfield, Gad M. Landau, and Baruch Schieber. An efficient algorithm for the all pairs suffix-prefix problem. Inf. Process. Lett., 41(4):181–185, 1992. James Holt and Leonard McMillan. Merging of multi-string BWTs with applications. Bioin- formatics, 30(24):3524–3531, 2014. 17 L. Egidi, F. A. Louza, G. Manzini, G. P. Telles 23:13 18 19 22 Juha Kärkkäinen and Dominik Kempa. LCP array construction in external memory. ACM Journal of Experimental Algorithmics, 21(1):1.7:1–1.7:22, 2016. Juha Kärkkäinen and Dominik Kempa. Engineering a lightweight external memory suffix array construction algorithm. Mathematics in Computer Science, 11(2):137–149, 2017. 20 D. E. Knuth. Sorting and Searching, volume 3 of The Art of Computer Programming. Addison-Wesley, Reading, MA, USA, second edition, 1998. 25 23 21 M. Oguzhan Külekci, Jeffrey Scott Vitter, and Bojian Xu. Efficient maximal repeat finding using the burrows-wheeler transform and wavelet tree. IEEE/ACM Trans. Comput. Biology Bioinform., 9(2):421–429, 2012. Felipe A. Louza, Simon Gog, and Guilherme P. Telles. Inducing enhanced suffix arrays for string collections. Theor. Comput. Sci., 678:22–39, 2017. Felipe A. Louza, Guilherme P. Telles, Steve Hoffmann, and Cristina D. A. Ciferri. Gen- eralized enhanced suffix array construction in external memory. Algorithms for Molecular Biology, 12(1):26:1–26:16, 2017. 24 Veli Mäkinen, Djamal Belazzougui, Fabio Cunial, and Alexandru I. Tomescu. Genome-Scale Algorithm Design: Biological Sequence Analysis in the Era of High-Throughput Sequencing. Cambridge University Press, 2015. Sabrina Mantaci, Antonio Restivo, Giovanna Rosone, and Marinella Sciortino. An extension of the Burrows-Wheeler transform. Theor. Comput. Sci., 387(3):298–312, 2007. 26 G. Manzini. Two space saving tricks for linear time LCP computation. In Proc. of 9th Scandinavian Workshop on Algorithm Theory (SWAT '04), pages 372–383. Springer-Verlag LNCS n. 3111, 2004. 27 G. Manzini and P. Ferragina. Engineering a lightweight suffix array construction algorithm. In Proc. 10th European Symposium on Algorithms (ESA), pages 698–710. Springer Verlag LNCS n. 2461, 2002. 28 Guillaume Marçais, Arthur L. Delcher, Adam M. Phillippy, Rachel Coston, Steven L. Salzberg, and Aleksey V. Zimin. Mummer4: A fast and versatile genome alignment system. PLoS Computational Biology, 14(1), 2018. J. Ian Munro, Gonzalo Navarro, and Yakov Nekrich. Space-efficient construction of com- pressed indexes in deterministic linear time. In SODA, pages 408–424. SIAM, 2017. 30 G. Navarro and V. Mäkinen. Compressed full-text indexes. ACM Computing Surveys, 29 39(1), 2007. 31 Ge Nong. Practical linear-time O(1)-workspace suffix sorting for constant alphabets. ACM 32 33 Trans. Inf. Syst., 31(3):15, 2013. Enno Ohlebusch and Simon Gog. Efficient algorithms for the all-pairs suffix-prefix problem and the all-pairs substring-prefix problem. Inf. Process. Lett., 110(3):123–128, 2010. Enno Ohlebusch, Simon Gog, and Adrian Kügel. Computing matching statistics and max- imal exact matches on compressed full-text indexes. In SPIRE, volume 6393 of Lecture Notes in Computer Science, pages 347–358. Springer, 2010. 34 William H. A. Tustumi, Simon Gog, Guilherme P. Telles, and Felipe A. Louza. An improved algorithm for the all-pairs suffix-prefix problem. J. Discrete Algorithms, 37:34–43, 2016. CVIT 2016
1905.00640
1
1905
2019-05-02T09:44:28
Tight Approximation Bounds for Maximum Multi-Coverage
[ "cs.DS" ]
In the classic maximum coverage problem, we are given subsets $T_1, \dots, T_m$ of a universe $[n]$ along with an integer $k$ and the objective is to find a subset $S \subseteq [m]$ of size $k$ that maximizes $C(S) := |\cup_{i \in S} T_i|$. It is well-known that the greedy algorithm for this problem achieves an approximation ratio of $(1-e^{-1})$ and there is a matching inapproximability result. We note that in the maximum coverage problem if an element $e \in [n]$ is covered by several sets, it is still counted only once. By contrast, if we change the problem and count each element $e$ as many times as it is covered, then we obtain a linear objective function, $C^{(\infty)}(S) = \sum_{i \in S} |T_i|$, which can be easily maximized under a cardinality constraint. We study the maximum $\ell$-multi-coverage problem which naturally interpolates between these two extremes. In this problem, an element can be counted up to $\ell$ times but no more; hence, we consider maximizing the function $C^{(\ell)}(S) = \sum_{e \in [n]} \min\{\ell, |\{i \in S : e \in T_i\}| \}$, subject to the constraint $|S| \leq k$. Note that the case of $\ell = 1$ corresponds to the standard maximum coverage setting and $\ell = \infty$ gives us a linear objective. We develop an efficient approximation algorithm that achieves an approximation ratio of $1 - \frac{\ell^{\ell}e^{-\ell}}{\ell!}$ for the $\ell$-multi-coverage problem. In particular, when $\ell = 2$, this factor is $1-2e^{-2} \approx 0.73$ and as $\ell$ grows the approximation ratio behaves as $1 - \frac{1}{\sqrt{2\pi \ell}}$. We also prove that this approximation ratio is tight, i.e., establish a matching hardness-of-approximation result, under the Unique Games Conjecture.
cs.DS
cs
Tight Approximation Bounds for Maximum Multi-Coverage Siddharth Barman∗ Omar Fawzi† Suprovat Ghoshal‡ Emirhan Gürpınar § Abstract In the classic maximum coverage problem, we are given subsets T1, . . . , Tm of a universe [n] along with an integer k and the objective is to find a subset S ⊆ [m] of size k that maximizes C(S) := ∪i∈S Ti. It is well-known that the greedy algorithm for this problem achieves an approximation ratio of (1 − e−1) and there is a matching inapproximability result. We note that in the maximum coverage problem if an element e ∈ [n] is covered by several sets, it is still counted only once. By contrast, if we change the problem and count each element e as many times as it is covered, then we obtain a linear objective function, C(∞)(S) = ∑i∈S Ti, which can be easily maximized under a cardinality constraint. We study the maximum ℓ-multi-coverage problem which naturally interpolates between these two extremes. In this problem, an element can be counted up to ℓ times but no more; hence, we consider maximizing the function C(ℓ)(S) = ∑e∈[n] min{ℓ, {i ∈ S : e ∈ Ti}}, subject to the constraint S ≤ k. Note that the case of ℓ = 1 corresponds to the standard maximum coverage setting and ℓ = ∞ gives us a linear objective. We develop an efficient approximation algorithm that achieves an approximation ratio of 1 − ℓℓe−ℓ for the ℓ-multi-coverage problem. In particular, when ℓ = 2, this factor is 1 − 2e−2 ≈ 0.73 and as ℓ grows the approximation ratio behaves as 1 − 1√2πℓ. We also prove that this approximation ratio is tight, i.e., establish a matching hardness-of-approximation result, under the Unique Games Conjecture. ℓ! This problem is motivated by the question of finding a code that optimizes the list-decoding success probability for a given noisy channel. We show how the multi-coverage problem can be relevant in other contexts, such as combinatorial auctions. 1 Introduction Coverage problems lie at the core of combinatorial optimization and have been extensively stud- ied in computer science. A quintessential example of such problems is the maximum coverage prob- lem wherein we are given subsets T1, . . . , Tm of a universe [n] along with an integer k ∈ Z+, and the objective is to find a size-k set S ⊆ [m] that maximizes the covering function C(S) := ∪i∈S Ti. It is well-known that a natural greedy algorithm achieves an approximation ratio of 1 − e−1 for this problem (see, e.g., [16]). Furthermore, the work of Feige [12] shows that this approximation factor is tight, under the assumption that P 6= NP. Over the years, a large body of work has been ∗Indian Institute of Science. [email protected] †Univ Lyon, ENS Lyon, UCBL, CNRS, LIP, F-69342, Lyon Cedex 07, France. [email protected] ‡Indian Institute of Science. [email protected] §ENS Lyon. [email protected] 1 directed towards extending these fundamental results and, more generally, coverage problems have been studied across multiple fields, such as operations research [7], machine learning [15], and algorithmic game theory [11]. In this paper, we study the ℓ-multi-coverage (ℓ-coverage for short) problem, which is a natural generalization of the classic maximum coverage problem. Here, we are given a universe of ele- i=1. For any integer ℓ ∈ Z+ and a choice of ments [n] and a collection of subsets F = {Ti ⊆ [n]}m index set S ⊆ [m], we define the ℓ-coverage of an element e to be C(ℓ) e (S) := min{ℓ, i ∈ S : e ∈ Ti}, i.e., C(ℓ) e (S) counts -- up to ℓ -- how many times element e is covered by the subsets indexed in S. We extend this definition to that of ℓ-coverage of all the elements, C(ℓ)(S) := ∑e∈[n] C(ℓ) The ℓ-multi-coverage problem is defined as follows: given a universe of elements [n], a collection F of subsets of [n] and an integer k ≤ m, find a size-k subset S ⊆ [m] which maximizes C(ℓ)(S). For ℓ = 1, it is easy to see that this reduces to the standard maximum coverage problem. e (S). 1.1 Our Results and Techniques Our main result is a polynomial-time algorithm that achieves a tight approximation ratio for the ℓ-multi-coverage problem, with any ℓ ≥ 1. Theorem 1.1 Let ℓ be a positive integer. There exists a polynomial-time algorithm that takes as input an integer n, a set system F = {Ti ⊆ [n]}m i=1 along with an integer k ≤ m and outputs a size-k set S ⊆ [m] (i.e., identifies k subsets {Ti}i∈S from F ) such that C(ℓ)(S) ≥(cid:18)1 − ℓ! (cid:19) max One way to interpret this approximation ratio ρℓ := (cid:16)1 − ℓℓe−ℓ where Poi(ℓ) denotes a Poisson random variable with rate parameter ℓ. C(ℓ)(S′). S′∈([m] k ) ℓℓe−ℓ ℓ! (cid:17) is that ρℓ = 1 ℓ E(cid:2) min{ℓ, Poi(ℓ)}(cid:3), We complement Theorem 1.1 by proving that the achieved approximation guarantee is tight, un- der the Unique Games Conjecture. Formally, Theorem 1.2 Assuming the Unique Games Conjecture, it is NP-hard to approximate the maximum ℓ- multi-coverage problem to within a factor greater than(cid:16)1 − ℓℓ ℓ! e−ℓ + ε(cid:17), for any constant of ε > 0. The Approximation Algorithm We first observe that for the maximum multi-coverage problem the standard greedy algorithm fails: the approximation guarantee does not improve with ℓ. As the function C(ℓ) is a monotone, submodular function, the greedy algorithm will certainly still achieve an approximation ratio of 1− e−1. However, it is simple to construct instances wherein exactly this ratio is achieved. In fact, if F is a collection of distinct subsets, let F (ℓ) contain the same subsets as F but each one appearing ℓ times. Then, it is easy to see that the greedy algorithm, when applied to F (ℓ), will simply choose ℓ times the sets chosen by the algorithm on input F. So the greedy algorithm is not able to take advantage when we have ℓ > 1. Instead, we use another algorithmic idea, which is standard in the context of submodular function maximization. We consider the natural linear programming (LP) relaxation of the problem to obtain a fractional, optimal solution and apply pipage rounding [1, 26, 5]. Pipage rounding is a 2 the core of the analysis of this algorithm is to compute the expected ℓ-coverage, method that maps a fractional solution x ∈ [0, 1]m into an integral one xint ∈ {0, 1}m, in a way that does not decrease the expected value of the objective function; here the fractional solution x ∈ [0, 1]m is viewed as a (product) distribution over the index set [m]. Hence, ES∼x(cid:2)C(ℓ)(S)(cid:3), and relate it to the optimal value of the linear program (which, of course, upper bounds the value of an integral, optimal solution). With a careful use of convexity, one can es- tablish that the analytic form of this expectation corresponds to the expected value of a binomial random variable truncated at ℓ. To obtain the claimed approximation ratio (which, as mentioned above, has a Poisson interpre- tation), one would like to use the well-known Poisson approximation for binomial distributions. However, this convergence statement is only asymptotic and thus will lead to an error term that will depend on the size of the problem instance and on the value of ℓ. One can alternatively try to compare the two distributions using the natural notion of stochastic domination. It turns out that indeed a binomial distribution can be stochastically dominated by a Poisson distribution, but this again cannot be used in our setting for two reasons: there is a loss in terms of the underlying parameters (and, hence, this cannot lead to a tight approximation factor) and more importantly the inequality goes in the wrong direction.1 The right tool for us turns out to be the notion of convex order between distributions. It expresses the property that one distribution is more "spread" than the other. While this notion has found sev- eral applications in statistics, economics, and other related fields (see [24] and references therein), to the best of our knowledge, its use in the context of analyzing approximation algorithms is novel. In particular, it leads to tight comparison inequalities between binomial and Poisson distributions, even in non-asymptotic regimes (see Lemma 2.3). Overall, using this tool we are able to obtain optimal approximation guarantees for all values of ℓ. We also note that our algorithmic result directly generalizes to the weighted version of maximum ℓ-coverage and we can replace the constraint S ≤ k by a matroid constraint S ∈ M; here, M is any matroid that admits an efficient, optimization algorithm (equivalently, any matroid whose basis polytope admits an efficient separation oracle). To keep the exposition simple, we conform to the unweighted case and to the cardinality constraint S ≤ k and only discuss the generalization in Section 2.3. Hardness Result We now give a brief description of our hardness result and the techniques used to establish it. In [12], the (1 − 1/e) inapproximability of the standard maximum coverage problem was shown using the tight ln n inapproximability of the set cover problem, which in turn was obtained via a reduction from a variant of max-3-sat. However, in our setting, one cannot hope to show tight inapproximability for the maximum ℓ-multi-coverage problem by a similar sequence of reductions. This is because, as detailed in Section 1.2, the multi-coverage analogue of the set cover problem is as inapproximable as the usual set cover problem. Therefore, one cannot hope to directly reuse the arguments from Feige's reduction in order to get tight inapproximability for the maximum ℓ-multi-coverage problem. We bypass this by developing a direct reduction to the maximum ℓ-multi-coverage problem without going through the set cover variant. Our reduction is from a h-ary hypergraph variant of UNIQUEGAMES [18, 19], which we call h- ARYUNIQUEGAMES. Here the constraints are given by h-uniform hyperedges on a vertex set V 1Here, the Poisson distribution stochastically dominates the binomial. Hence, instead of a lower bound, we obtain an upper bound. 3 with a label set Σ. A salient feature of the h-ARYUNIQUEGAMES, which is crucially used in our reduction, is that it involves two distinct notions of satisfied hyperedges, namely strongly and weakly satisfied hyperedges. A labeling σ : V 7→ Σ strongly satisfies a hyperedge e = (vi)i∈[h] if all the labels project to the same alphabet, i.e., πe,v1(σ(v1)) = πe,v2(σ(v2)) = · · · = πe,v3(σ(vh)). We say a labelling σ weakly satisfies the hyperedge e if at least two of the projected labels match, i.e., πe,vi(σ(vi)) = πe,vj(σ(vj)) for some i, j ∈ [h], i 6= j. The equivalent of Unique Games Conjecture for these instances is the following: It is NP-Hard to distinguish between whether (YES): most hyperedges can be strongly satisfied or (NO): even a small fraction of hyperedges cannot be weakly satisfied. We employ the above variant of UNIQUEGAMES with a generalization of Feige's partitioning gad- get, which has been tailored to work with the ℓ-coverage objective C(ℓ)(·). This gadget is essen- tially a collection of s set families P1, P2, . . . , Ps over a universe [bn] satisfying (i) Each family Pi is a collection of sets such that each element in [bn] is covered exactly ℓ-times i.e, it has (normalized) ℓ-coverage 1 (ii) Any choice of sets S1, S2, . . . , Sh from distinct families has ℓ-coverage at most ρℓ (the target approximation ratio). We combine the h-ARYUNIQUEGAMES instance with the parti- tioning gadget by associating each hyperedge constraint with a disjoint copy of the gadget. The construction of the set family in our reduction ensures that sets corresponding to strongly satisfied edges use property (i), whereas sets corresponding to not even weakly satisfied hyperedges use property (ii). Since in the YES case, most hyperedges can be strongly satisfied, we get that there exists a choice of sets for which the normalized ℓ-multi-coverage is close to 1. On the other hand, in the NO case, since most hyperedges are not even weakly satisfied, for any choice of sets, the normalized ℓ-multi-coverage will be at most ρℓ. Combining the two cases gives us the desired inapproximability. 1.2 Related Covering Problems and Submodular Function Maximization Another fundamental problem in the covering context is the set cover problem: given subsets T1, . . . , Tm of a universe [n], the objective is to find the set S ⊆ [m] of minimal cardinality that cover all of n, i.e., C(S) = ∪i∈STi = [n]. This is one of the first problems for which approxima- tion algorithms were studied: Johnson [17] showed that the natural greedy algorithm achieves an approximation ratio of 1 + ln n and much later Feige [12], building on a long line of works, established a matching inapproximability result. Along the lines of maximum coverage, one can also consider the ℓ-version of set cover. In this version, the goal is to find the smallest set S such that C(ℓ)(S) = ℓn (this corresponds to every element being covered at least ℓ times). Here, with ℓ > 1, we observe an interesting dichotomy: while one achieves improved approximation guarantees for the maximum ℓ-multi-coverage, this is not the case for set ℓ-cover. In particular, set ℓ-cover is essentially as hard as to approximate as the standard set cover problem. To see this, consider the instance where F (ℓ) is obtained from F by adding ℓ − 1 copies of the whole set [n]. Then, we have that [n] can be 1-covered with k sets in F if and only if [n] can be ℓ-covered with k + ℓ − 1 sets in F (ℓ). A well-studied generalization of the set cover problem, called the set multicover problem, requires element e ∈ [n] to be covered at least de times, where the demand de is part of the input. The greedy algorithm was shown to also achieve 1 + ln n approximation for this problem as well [8, 23]. Even though there has been extensive research on set multicover, its variants, and applications (see e.g., [3]), we are not aware of any previous work that considers the maximum multi-coverage problem. The problem of maximum coverage fits within the larger framework of submodular function maxi- mization [21]. In fact, the covering function C : 2[n] → R is submodular in the sense that it satisfies 4 a diminishing-returns property: C(S ∪{i}) − C(S) ≥ C(S′ ∪{i}) − C(S′) for any S ⊆ S′ and i /∈ S′. Nemhauser et al. [21] showed that the greedy algorithm achieves the ratio 1 − e−1 not only for the coverage function C but for any submodular function. Submodular functions are a central object of study in combinatorial optimization and appear in a wide variety of applications; we refer the reader to [20] for a textbook treatment of this topic. Here, an important thread of research is that of maximizing submodular functions that have an additional structure which render them closer to linear functions. Specifically, the notion of curvature of a function was introduced by [6]. The curvature of a monotone submodular function f : 2[m] → R is a parameter c ∈ [0, 1] such that for any S ⊂ [m] and j /∈ S, we have f (S ∪ {j}) − f (S) ≥ (1 − c) f ({j}). Note that if c = 0, this means that f is a linear function and if c = 1, the condition is mute. Conforti and Cornuéjols [6] have shown that when the greedy algorithm is applied to a function with curvature c, the approximation guarantee is 1 c (1 − e−c). Using a different algorithm, this was later improved by Sviridenko et al. [25] to a factor of approximately 1− c e. This notion of curvature does have applications in some settings (see e.g., [25] and references therein), but the requirement is too strong and does not apply to the ℓ-coverage function C(ℓ). In fact, if S is such that the sets Ti for i ∈ S cover all the universe at least ℓ times, then adding another set Tj will not change the function C(ℓ). Another way to see that this condition is not adapted to our ℓ-coverage problem is that we know that the greedy algorithm will not be able to beat the factor 1− e−1 for any value of ℓ. We hope that this work will help in establishing a more operational way of interpolating between general submodular functions and linear functions. 1.3 Applications We now briefly discuss some applications of the ℓ-coverage problem, the main message being that for most settings where coverage is used, ℓ-coverage has a very natural and meaningful interpre- tation as well. We leave the more detailed discussion of such applications for future work. Our initial motivation for studying the maximum multi-coverage problem was in understanding the complexity of finding the code for which the list-decoding success probability is optimal. More precisely, consider a noisy channel with input set X and output set Y that maps an input x ∈ X to y ∈ Y with probability W(yx). To simplify the discussion, assume that for any input x, the output is uniform on a set Tx of size t, i.e., W(yx) = 1 t if y ∈ Tx and 0 otherwise. We would like to send a message m belonging to the set {1, . . . , k} using this noisy channel in such a way to maximize the probability of successfully decoding the message m. It is elementary to see that this problem can be written as one of maximizing the quantity 1 tk ∪x∈S Tx over codes S ⊆ X of size k [2]. Thus, the problem of finding the optimal code can be written as a covering problem, and handling general noisy channels corresponds to a weighted covering problem. This connection was exploited in [2] to prove tightness of the bound known as the meta-converse in the information theory literature [22] and to give limitations on the effect of quantum entanglement to decrease the communication errors. Suppose we now consider the list-decoding success probability, i.e., the receiver now decodes y into a list of size ℓ and we deem the decoding successful if m is in this list. Then the success probability can be written as: 1 tk ∑y∈Y min{ℓ, {x ∈ S : y ∈ Tx}}, i.e., an ℓ-coverage function. Our main result thus shows that the code with the maximum list-decoding success probability can be approximated to a factor of ρℓ = 1 − ℓℓe−ℓ ℓ! and it shows that the meta- converse for list-decoding is tight within the factor ρℓ. The applicability of the multi-coverage can also be observed in game-theoretic settings in which the (standard) covering function is used to represent valuations of agents; see, e.g., works on com- binatorial auctions [10, 9]. As a stylized instantiation, consider a setup wherein the elements in the 5 ground set represent types of goods and the given subsets correspond to bundles of goods (of dif- ferent types). Assuming that, for each agent, goods of a single type are perfect substitutes of each other, one obtains valuations (defined over the bundles) that correspond to covering functions. In this context, the ℓ-multi-coverage formulation provides an operationally-useful generalization: additional copies (of the same type of the good) are valued, till a threshold ℓ. Indeed, our algo- rithmic result shows that if the diminishing-returns property does not come into effect right away, then better (compared to 1 − e−1) approximation guarantees can be obtained. 2 Approximation Algorithm for the ℓ-Multi-Coverage Problem The algorithm we analyze is simple and composed of two steps (relax and round): First, we solve the natural linear programming relaxation (see (1)) obtaining a fractional, optimal solution x∗ ∈ [0, 1]m, which satisfies ∑i∈[m] x∗i = k. The second step is to use pipage rounding to find an integral vector xint ∈ {0, 1}m with the property that ∑i∈[m] xint i = k. This is the size-k set returned by the algorithm, S = {i ∈ [m] : xint i = 1}. These two steps are detailed below. Step 1. Solve the Linear Programming Relaxation: Specifically, we consider the following linear programming relaxation of the ℓ-multi-coverage problem. Here, with the given collection of sets F = {T1, T2, . . . , Tm}, the set Γe := {i ∈ [m] : e ∈ Ti} denotes the indices of Tis that contain the element e. ce max x,c ∑ e∈[n] subject to ce ≤ ℓ ce ≤ ∑ i∈Γe 0 ≤ xi ≤ 1 m xi = k . ∑ i=1 ∀e ∈ [n] xi ∀e ∈ [n] ∀i ∈ [m] (1) In this linear program (LP), the number of variables is n + m and the number of constraints is O(n + m) and, hence, an optimal solution can be found in polynomial time. Step 2. Round the fractional, optimal solution: We round the computed fractional solution x∗ by considering the multilinear extension of the objective, and applying pipage rounding [1, 26, 5] : {0, 1}m → R, one can define the multilinear extension on it. Formally, given any function f F : [0, 1]m → R by F(x1, . . . , xm) := E(cid:2) f (X1, . . . , Xm)(cid:3), where X1, . . . , Xm ∈ {0, 1} are independent random variables with Pr(cid:2)Xi = 1(cid:3) = xi. For a submodular function f , one can use pipage rounding to transform, in polynomial time, any fractional solution x ∈ [0, 1]m satisfying ∑i∈[m] xi = k into an integral vector xint ∈ {0, 1}m such that ∑i∈[m] xint i = k and F(xint) ≥ F(x). We apply this strategy for the ℓ-coverage function and the fractional, optimal solution x∗ of the LP relaxation (1). It is simple to check that the ℓ-coverage function C(ℓ) is submodular. We thus get the following lower bound for the ℓ-coverage value of 6 the set returned by the algorithm:2 1 ,...xint C(ℓ)(xint) = E (X1,...Xm)∼(xint m )(cid:2)C(ℓ)(X1, . . . , Xm)(cid:3) ≥ E(X1,...Xm)∼(x∗1,...x∗m)(cid:2)C(ℓ)(X1, . . . , Xm)(cid:3). (X1,...Xm)∼(x∗1,...x∗m)(cid:2)C(ℓ)(X1, . . . , Xm)(cid:3) to the value taken by the LP To conclude it suffices to relate E at the optimal solution x∗ = (x∗1, . . . , x∗m). In particular, Theorem 1.1 directly follows from the following result (Theorem 2.1), which provides a lower bound in terms of the value achieved by the LP relaxation. Indeed, this deterministic algorithm is quite direct: it simply solves a linear program and applies pipage rounding. We consider this as a positive aspect of the work and note that our key technical contribution lies in the underlying analysis. Theorem 2.1 Let x ∈ [0, 1]m and c ∈ [0, 1]n constitute a feasible solution of the LP relaxation (1). Then we have, E(X1,...,Xm)∼(x1,...,xm)(cid:2)C(ℓ)(X1, . . . , Xm)(cid:3) ≥ ρℓ ∑ e∈[n] ce where ρℓ is defined by ρℓ := 1 − ℓℓ ℓ! e−ℓ. (2) In fact, as we show in Lemma 2.4 below, the inequality holds for every element e ∈ [n]. Before getting into the proof of this result, we establish some useful properties of the quantity ρℓ. 2.1 Some Properties of the Approximation Ratio ρℓ Throughout, we will use Poi(·), Bin(·, ·), and Ber(·) to, respectively, denote Poisson, Binomial, and Bernoulli random variables with appropriate parameters. Lemma 2.2 We have ρℓ = 1 − ℓ−1 ∑ m=0 ℓ − m ℓ ℓm m! e−ℓ = 1 ℓ ℓ ∑ m=1 In addition, the following inequality holds for any t ≥ ℓ, 1 ℓ ρℓ ≤ Proof. To see the first equality, write ℓ−1 ∑ m=0 (ℓ − m) ℓm m! e−ℓ = e−ℓ 2That is, a lower bound for the ℓ-coverage value of the size-k set {i ∈ [m] : xint i = 1}. 1 ℓ E(cid:2) min{ℓ, Poi(ℓ)}(cid:3) . ℓ Pr(cid:2)Poi(ℓ) ≥ m(cid:3) = t(cid:19)(cid:27)(cid:3) . (m − 1)!(cid:19) + ℓe−ℓ E(cid:2) min(cid:26)ℓ, Bin(cid:18)t, m=1(cid:18) ℓm+1 (ℓ − 1)! m! − ℓ−1 ∑ = e−ℓ ℓm ℓℓ (3) (telescoping sum) , 7 which gives the desired expression. The second equality is obtained by substituting the distribution function of Poi(ℓ) and the third inequality follows from the tail-sum formula (applied over the random variable min{ℓ, Poi(ℓ)}). To prove inequality (3), it suffices to apply Lemma 2.3 (stated and proved below) to the concave function φℓ : x 7→ min{x, ℓ} with N = t and p = ℓ t . (cid:3) The following lemma gives a relation between the binomial distribution Bin(N, p) and the Poisson distribution Poi(N p). It is well-known that, for a constant c, Bin(N, c/N) converges to Poi(c) as N grows. For the analysis of our algorithm, we in fact need a non-asymptotic relation between these two distributions ensuring that E(cid:2)φℓ(Poi(c))(cid:3) ≤ E(cid:2)φℓ(Bin(N, c/N))(cid:3), for the function φℓ : x 7→ min{ℓ, x}. Such a property is captured by the notion of convex order between distributions [24]. The next lemma uses this notion to prove the desired relation and, hence, highlights an interesting application of convex orders in the context of approximation algorithms. Lemma 2.3 For any convex function f , any integer N ≥ 1 and parameter p ∈ [0, 1], we have E(cid:2) f (Bin(N, p))(cid:3) ≤ E(cid:2) f (Poi(N p))(cid:3) . (4) (cid:3) Proof. The notion of convex order between two distributions is defined as follows. If X and Y are random variables, we say that X ≤cvx Y iff E(cid:2) f (X)(cid:3) ≤ E(cid:2) f (Y)(cid:3) holds for any convex function f : R → R. We refer the reader to [24, Section 3.A] for more information and properties of this order. As a result, the lemma will follow once we show that Bin(N, p) ≤cvx Poi(N p). (5) First, we note that it suffices to prove this inequality for N = 1; this is a direct consequence of the fact that the convex order is closed under convolution [24, Theorem 3.A.12] (i.e., it is closed under the addition of independent random variables).3 Now, using [24, Theorem 3.A.2], we have that equation (5) for N = 1 is equivalent to showing that E(cid:2)Ber(p) − a(cid:3) ≤ E(cid:2)Poi(p) − a(cid:3) for any a ∈ R. To prove this, we perform a case analysis. The cases a ≤ 0 or a ≥ 1 are simple: here, we have E(cid:2)Ber(p) − a(cid:3) = p − a and we always have E(cid:2)Poi(p) − a(cid:3) ≥ max{E(cid:2)Poi(p) − a(cid:3), E(cid:2)a − Poi(p)(cid:3)} = p − a. If a ∈ (0, 1), then E(cid:2)Ber(p) − a(cid:3) = (1 − p)a + p(1 − a) = p + a − 2ap E(cid:2)Poi(p) − a(cid:3) = 2ae−p + p − a ≥ p + a − 2ap , which concludes the proof. We also need a lemma about the convexity of the following function. The proof of this lemma is deferred to Appendix A. Lemma 2.4 For any nonnegative integers s and t, the function f : x 7→ s−1 ∑ m=0 (s − m)(cid:18) t m(cid:19)xm(1 − x)t−m is non-increasing and convex in the interval [0, 1]. Note that ( t m) = 0 when m > t. 3Recall that if X and Y are independent, Poisson random variables with rate parameters λ1 and λ2, respectively, then X + Y is Poisson-distributed with parameter λ1 + λ2. 8 2.2 Proof of Theorem 2.1 We now state and prove the main lemma for the analysis of the algorithm. Lemma 2.4 Let x ∈ [0, 1]m and c ∈ [0, 1]n constitute a feasible solution of the linear program (1). Then, we have for any e ∈ [n]: E(X1,...,Xm)∼(x1,...,xm)(cid:2)C(ℓ) e (X1, . . . , Xm)(cid:3) ≥ ρℓce . e = C(ℓ) e (X1, . . . , Xm) with indicators Xi ∼ Ber(xi). e = min{ℓ, ∑i∈Γe Xi}, where Γe := {i ∈ [m] : e ∈ Ti} denotes the indices of all the Proof. To make the notation lighter, we write C(ℓ) Recall that C(ℓ) given subsets Ti ∈ F that contain the element e. The tail-sum formula gives us e (cid:3) = E(cid:2)C(ℓ) ℓ ∑ a=1 = ℓ − i∈Γe Pr(cid:2) ∑ Xi ≥ a(cid:3) (ℓ − a) Pr(cid:2) ∑ ℓ−1 ∑ a=0 i∈Γe Xi = a(cid:3) . Now we can apply Lemma 2.5 (stated and proved at the end of this section) and get that the e (cid:3) is minimum when for all i ∈ Γe, xi ∈ {0, 1, q} for some q ∈ (0, 1). We now expression for E(cid:2)C(ℓ) assume x has this form. Let ℓ be the number of elements i ∈ Γe such that xi = 1. As we have in this case Pr(cid:2) ∑i∈Γe Xi = a(cid:3) = 0 for a < ℓ, we can write e (cid:3) = ℓ − E(cid:2)C(ℓ) (ℓ − a) Pr(cid:2) ∑ e (cid:3) ≥ ℓ ≥ ce. Assume now that ce ≥ ℓ and we Note that, if ce ≤ ℓ, then we are done as E(cid:2)C(ℓ) write de = ce − ℓ ≥ 0. We also write t for the number of elements i ∈ Γe such that xi = q; hence, ∑i∈Γe xi = ℓ + qt. Note that ∑i∈Γe Xi − ℓ has a binomial distribution with parameters t and q. We can then write Xi = a(cid:3) . ℓ−1 ∑ a=ℓ i∈Γe e (cid:3) = ℓ − E(cid:2)C(ℓ) = ℓ − ℓ−1 ∑ a=ℓ ℓ−ℓ−1 ∑ a=0 (ℓ − a)(cid:18) t (ℓ − ℓ − a)(cid:18)t a − ℓ(cid:19)qa−ℓ(1 − q)t−(a−ℓ) a(cid:19)qa(1 − q)t−a , where we implemented the change of variable a → a − ℓ. We now use Lemma 2.4 with s = ℓ − ℓ and t. Using the fact that this expression is increasing in q together with the inequality de ≤ qt (this follows from the linear program (1)), we get e (cid:3) ≥ ℓ − E(cid:2)C(ℓ) ℓ−ℓ−1 ∑ a=0 (ℓ − ℓ − a)(cid:18)t a(cid:19)(cid:18) de t (cid:19)a(cid:18)1 − de t (cid:19)t−a . 9 From Lemma 2.4 again, we have that the function x 7→ ∑ℓ−ℓ−1 convex in the interval [0, t]. We now distinguish two cases. We start with the simple case when ℓ − ℓ > t. Then we write de = de e (cid:3) = ℓ − E(cid:2)C(ℓ) a)(cid:0) x t(cid:1)a(cid:0)1 − x (ℓ − ℓ − a)( t t ) · 0 and using convexity we get (ℓ − ℓ − a)(cid:18)t t (cid:19)t−a t (cid:19)a(cid:18)1 − t(cid:1)t−a is t · t + (1 − de t ∑ a=0 a=0 de a(cid:19)(cid:18) de (ℓ − (ℓ − ℓ − t)) + (1 − de t )(ℓ − (ℓ − ℓ)) de ≥ t = ce, which concludes the first case. If t ≥ ℓ − ℓ, we instead write de = de Applying convexity, we get ℓ−ℓ · (ℓ − ℓ) + (1 − de ℓ−ℓ ) · 0. a(cid:19) ℓ − ℓ t !a 1 − (ℓ − ℓ − a)(cid:18)t t !a 1 − a(cid:19) ℓ − ℓ (ℓ − ℓ − a)(cid:18)t )}(cid:3) de ℓ − ℓ ℓ − ℓ t )ℓ de ℓ − ℓ ℓ − ℓ t !t−a + (1 − t !t−a de ℓ − ℓ ℓ − ℓ de ℓ−ℓ−1 ∑ a=0 ℓ−ℓ−1 ∑ a=0 ℓ − ℓℓ − e (cid:3) ≥ E(cid:2)C(ℓ) = ℓ +(ℓ − ℓ) − = ℓ + E(cid:2) min{ℓ − ℓ, Bin(t, = ℓ ce ! ce , ce (cid:17) = ≥ ℓ + ρℓ−ℓ · de + ρℓ−ℓ ℓ(1−ρℓ−ℓ) ce − ℓ ce where to obtain the last inequality, we used equation (3) from Lemma 2.2. Now observe that + ρℓ−ℓ is a decreasing function of ce and so we can lower bound it with + ρℓ−ℓ ce−ℓ the value it takes when ce = ℓ. So it only remains to show that (cid:16) ℓ ce ce Recalling that ρℓ = 1 − ℓℓe−ℓ ℓ! ℓ − ℓ ℓ ≥ ρℓ . ℓ ℓ + ρℓ−ℓ , this is equivalent to (ℓ − ℓ)ℓ−ℓe−(ℓ−ℓ) ℓ − ℓ ℓ ≤ In other words, it suffices to show that the sequence ℓℓ+1e−ℓ is an increasing sequence. To see this, we can take the logarithm of the ratio of the ℓth term to the (ℓ + 1)th term and get (ℓ + 1) ln(1 − ℓ+1 ) + 1 ≤ 0. The following lemma used in the analysis is standard, see e.g., [13]. (ℓ − ℓ)! ℓ! (cid:3) ℓ! 1 ℓℓe−ℓ . Lemma 2.5 Let x ∈ [0, 1]m be such that x1 + · · · + xm = t with t integer. We use the notation Prx(cid:2).(cid:3) to compute probabilities where X1, . . . , Xm are independent Bernouilli random variables with Pr(cid:2)Xi = i=1 Xi = τ(cid:3), there exists a q ∈ (0, 1) and 1(cid:3) = xi. Then for any expression of the form ∑τ aτ Prx(cid:2) ∑m x′ ∈ [0, 1]m such that x′i ∈ {0, 1, q} for all i ∈ [m] and ∑i x′i = t and ∑τ aτ Prx(cid:2) ∑m i=1 Xi = τ(cid:3) ≤ ∑τ aτ Prx′(cid:2) ∑m i=1 Xi = τ(cid:3). This also works for minimizing the probability. 10 Proof. Let x ∈ [0, 1]m be such that it achieves the maximum for the quantity ∑τ aτ Prx(cid:2) ∑m τ(cid:3) subject to x1 + · · · + xm = t. For the purpose of contradiction, assume x1 and x2 take different values in (0, 1). Then let p = x1 + x2. And assign x′1 = y and x′2 = p − y. Then for any τ, we have i=1 Xi = Pr x′ (cid:2) ∑ i i≥3 + Pr x′ (cid:2) ∑ Xi = τ(cid:3) = Pr x′ (cid:2) ∑ x′ (cid:2) ∑ + Pr i≥3 i≥3 Xi = τ(cid:3) Pr Xi = τ − 1(cid:3) Pr Xi = τ − 2(cid:3) Pr x′ (cid:2)X1 + X2 = 0 ∑ x′ (cid:2)X1 + X2 = 1 ∑ x′ (cid:2)X1 + X2 = 2 ∑ Xi = τ(cid:3) Xi = τ − 1(cid:3) Xi = τ − 2(cid:3) . i≥3 i≥3 i≥3 Consider the first term. We have Prx′(cid:2)X1 + X2 = 0 ∑i≥3 Xi = τ(cid:3) = (1− y)(1− (p − y)) and so the first term is a polynomial of degree 2 in y and symmetric under the exchange y ↔ p − y. The same holds for the other two terms. Furthermore, even if we are considering a sum of such terms, then we still get a symmetric polynomial of degree 2. So the minimum and the maximum are either achieved at the boundary with y ∈ {0, p} (or {p, 1} if p > 1) or when y = p − y. This contradicts the fact that x maximizes ∑τ aτ Prx(cid:2) ∑m i=1 Xi = τ(cid:3). 2.3 Generalization to weighted cover subject to a matroid constraint As mentioned previously, the algorithm can be easily generalized by allowing the objective func- tion to be a weighted ℓ-coverage function and the constraint to be one that requires S ∈ M, for a matroid M. More precisely, we are now given a collection of real weights {wi,e}i∈[m],e∈[n]. For an integer ℓ and a set S ⊆ [m], we define the weighted ℓ-coverage of an element e to be C(ℓ) e (S) := maxi1,...,iℓ∈S wi1,e + · · · + wiℓ,e; here the maximization is over all distinct indices i1, . . . , iℓ in the set S. In other words, C(ℓ) e (S) is the sum of the largest ℓ weights in the list (wi,e)i∈S. Then, as before, we define C(ℓ)(S) = ∑e∈[n] C(ℓ) e (S). The problem at hand is to maximize C(ℓ)(S) subject to the matroid constraint S ∈ M. The algorithm has exactly the same structure as the one described at the beginning of this section. We consider the following linear program. (cid:3) max x,c ∑ ci,ewi,e i∈[m],e∈[n] ci,e ≤ ℓ subject to ∑ i∈[m] ci,e ≤ xi 0 ≤ xi ≤ 1 x ∈ P(M) . ∀e ∈ [n] ∀i ∈ [m], e ∈ [n] ∀i ∈ [m] (6) Here P(M) is the matroid polytope of M. Again, once we obtain an optimal fractional solu- tion x∗, we use pipage rounding to obtain an integral vector xint ∈ {0, 1}m, such that xint ∈ M (X1,...Xm)∼(x∗1,...x∗m)(cid:2)C(ℓ)(X1, . . . , Xm)(cid:3) (see, e.g., [26, Lemma 3.4]).4 Thus, it only and C(ℓ)(xint) ≥ E remains to relate this expectation to the objective value achieved by the linear program. For a fixed e ∈ [n], we can express the weighted coverage function C(ℓ) e (·) as follows. First order the weights so that w1,e ≥ w2,e ≥ · · · ≥ wm,e. Then, for X1, X2, . . . , Xm ∈ {0, 1}, write Ci,e = 4Note that, as before, the function C(ℓ)(·) is submodular. 11 j=1 Xj} for all i ∈ [m]. Note that C(ℓ) min{ℓ, ∑i Thus, the following lemma is sufficient to obtain the desired result. j=1 Xj} − min{ℓ, ∑i−1 e (X1, . . . , Xm) = ∑i∈[m] wi,eCi,e. Lemma 2.6 Let e ∈ [n]. Assume that w1,e ≥ w2,e ≥ · · · ≥ wm,e. Let x, c be a feasible solution of the above linear program and X1, X2, . . . , Xm ∈ {0, 1} be independent random variables with Pr(cid:2)Xi = 1(cid:3) = xi. Then, for Ci,e = min{ℓ, ∑i j=1 Xj} − min{ℓ, ∑i−1 j=1 Xj}, we have ∑ i∈[m] wi,eE(cid:2)Ci,e(cid:3) ≥ ρℓ ∑ i∈[m] ci,e. Proof. Fixing wm+1,e = 0 and using the definition of Ci,e, we can write m ∑ i=1 wi,eE(cid:2)Ci,e(cid:3) = = m ∑ i=1 m ∑ i=1 i ∑ j=1 wi,eE(cid:2) min{ℓ, (wi,e − wi+1,e)E(cid:2) min{ℓ, Xj} − min{ℓ, Xj}(cid:3) . i ∑ j=1 i−1 ∑ j=1 Xj}(cid:3) Our objective now is to show that for every i, E(cid:2) min{ℓ, i ∑ j=1 Xj}(cid:3) ≥ ρℓ i ∑ j=1 cj,e . (7) But this follows from Lemma 2.4 applied to the setting where we only consider sets j ∈ {1, . . . , i} and replacing ∑i j=1 cj,e with ce. This concludes the proof of the lemma. (cid:3) 3 Hardness of Approximating the Multi-Coverage Problem In this section we establish an inapproximability bound for the maximum ℓ-multi-coverage prob- lem. Throughout this section we will use Γ to denote the universe of elements and, hence, an instance of the ℓ-multi-coverage problem will consist of Γ, along with a collection of subsets i=1 and an integer k. Recall that the objective of this problem is to find a size-k F = {Ti ⊆ Γ}m subset S ⊆ [m] that maximizes C(ℓ)(S) = ∑e∈Γ min{ℓ, {i ∈ S : e ∈ Ti}}. Formally, we establish Theorem 1.2 (restated below for completeness).5 Theorem 1.2 Assuming the Unique Games Conjecture, it is NP-hard to approximate the maximum ℓ- multi-coverage problem to within a factor greater than(cid:16)1 − ℓℓ ℓ! e−ℓ + ε(cid:17), for any constant of ε > 0. Our reduction is from the h-ARYUNIQUEGAMES problem, as detailed in Definition 3.1. Specif- ically, we will rely on Conjecture 3.2, which asserts the hardness of the h-ARYUNIQUEGAMES problem by showing that it is equivalent to the Unique Games Conjecture (UGC). Definition 3.1 (h-ARYUNIQUEGAMES) An instance G(V, E, Σ, {πe,v}e∈E,v∈e) of h-ARYUNIQUEGAMES is characterized by an h-uniform regular hypergraph, (V, E), and bijection (projection) constraints πe,v : Σ 7→ Σ. Here, each h-uniform hyperedge represents a h-ary constraint. Additionally, for any labeling σ : V 7→ Σ, we have the following notions of strongly and weakly satisfied constraints: 5As mentioned above, for brevity, we will sometimes refer to ℓ-multi-coverage as ℓ-coverage. 12 πe,vx(σ(vx)) = πe,vy(σ(vy)). • A hyperedge e = (v1, v2, . . . , vh) ∈ E is strongly satisfied by σ if for every x, y ∈ [h] we have • A hyperedge e = (v1, v2, . . . , vh) ∈ E is weakly satisfied by σ if there exists x, y ∈ [h], x 6= y such that πe,vx(σ(vx)) = πe,vy(σ(vy)). The following conjecture is equivalent to UGC (see, Appendix C): Conjecture 3.2 For any constant ε > 0 and constant integer h ≥ 2, given an instance G of h-ARYUNIQUEGAMES, it is NP-hard to distinguish between • (YES): There exists a labeling σ that strongly satisfies at least 1 − ε fraction of the edges. • (NO): No labeling weakly satisfies more than ε fraction of the edges. Furthermore, the constraint hypergraph for instance G is regular and the size of the underlying alphabet set depends only on the parameter ε. Our reduction uses a gadget that generalizes a partitioning system used by Feige [12]. We will begin by describing the partitioning gadget (Section 3.1) and then the use it for the reduction (Section 3.2). 3.1 The Partitioning Gadget reduction. For any set of elements [bn] (withbn ∈ Z+) and a collection of subsets Q ⊆ 2[bn], we use C(ℓ)(Q) to denote the ℓ-coverage of [bn] by the subsets contained in Q,6 i.e., C(ℓ)(Q) := ∑e∈[bn] minnℓ, {P ∈ Q : e ∈ P} o. Furthermore, we will say that the collection of subsets Q is an ℓ-cover of S if C(ℓ)(Q) = ℓbn, i.e., if every element of [bn] is covered at least ℓ times. We begin by defining the ([bn], h, s, ℓ, η)-partitioning system which is the basic gadget used in our Definition 3.3 Given a ground set [bn], an ([bn], h, s, ℓ, η)-partitioning system consists of s-distinct collec- tion of subsets of [bn] -- say, P1, P2, . . . , Ps ⊆ 2[bn] -- that satisfy (1) For every i ∈ [s], the family Pi is a collection of h-subsets Pi,1, Pi,2, . . . , Pi,h ⊆ [bn] each of size ℓbn/h such that every element of [bn] is contained in exactly ℓ of the sets. In particular, each family Pi is an ℓ-cover of the ground set [bn]. for all i ∈ T, we have C(ℓ)(Q) ≤(cid:16)ψ T,h + η(cid:17)bn, where (ℓ − i)(cid:18)T i (cid:19)(cid:18) ℓ T,h := ℓ − In particular, if T = h(1 + µ), for some 0 < µ < ε C(ℓ)(Q) ≤(cid:18)ℓ(cid:18)1 − (2) For any subset of indices T ⊆ [s] and any collection of subsets Q = {Pi i ∈ T} such that Pi ∈ Pi, ℓℓ ℓ! 6Here, the notation C(ℓ)(·) is overloaded for ease of presentation. e−ℓ(cid:19) + ε(cid:19)bn. h(cid:19)i(cid:18)1 − ℓ h(cid:19)T−i 2ℓ2 eℓ ℓ! ℓℓ , then (ℓ) ℓ−1 ∑ i=0 (ℓ) ψ . (8) 13 which shows that such partitioning systems exist for a useful range of parameters. Note that we can restate equation (8) as C(ℓ)(Q) ≤ (ρℓ ℓ + ε)bn. We now state and prove a lemma Lemma 3.4 For every choice ofbn, h, s, ℓ ∈ Z+ and η > 0 such that s ≥ h ≥ ℓ andbn ≥ 100η−2sℓ2 log h, there exists an ([bn], h, s, ℓ, η)-partitioning system. Moreover, such a partitioning system can be found in time exp(sbn logbn) · poly(h). Proof. The existential proof is based on the probabilistic method. Given integersbn, s, h, for every i ∈ [s] we set the collection of subsets Pi to be an h-equi-sized uniformly random ℓ-cover of [bn]. Hence, in the collection Pi, each of the h subsets is of cardinality ℓbn h . Write P = (P1, P2, . . . , Ps). Note that for each element a ∈ [bn], and any subset Pi,j ∈ Pi, we have Pr [a ∈ Pi,j] = ℓ/h. Also, by construction, condition (1) of Definition 3.3 is satisfied, hence all that remains is to show that the partitioning system P also satisfies condition (2). Towards that, we fix an index set T ⊆ [s] and a collection of subsets Q = {Pi,j(i)i ∈ T} from the T-distinct ℓ-covering families in P. For ease of notation, we will denote Pi,j(i) by Pi; hence, bounded as Q = {Pi}i∈T. Note that, for a fixed element a ∈ [bn] the expected ℓ-coverage of Q can be upper ℓ−1 ∑ i=1 = ℓ−1 ∑ i=1 i · Prh {P ∈ Q : P ∋ a} = ii + ℓ · Prh {P ∈ Q : P ∋ a} ≥ ℓi i · Prh {P ∈ Q : P ∋ a} = ii + ℓ 1 − (ℓ − i) Prh {P ∈ Q : P ∋ a} = ii (ℓ − i)(cid:18)T h(cid:19)T−i h(cid:19)i(cid:18)1 − i (cid:19)(cid:18) ℓ ℓ−1 ∑ i=0 ℓ−1 ∑ i=0 ℓ−1 ∑ i=0 ℓ = ℓ − = ℓ − Prh {P ∈ Q : P ∋ a} = ii! (Pis are constructed independently) (ℓ) T,hbn. Now, we claim that (9) Therefore, by linearity of expectations we have EPhC(ℓ)(Q)i = ψ Pr P hC(ℓ)(Q) >(cid:16)ψ (ℓ) T,h + η(cid:17)bni ≤ 2 exp(cid:16) − (η/ℓ)2bn(cid:17) (ℓ) The above concentration bound can be argued as follows. Given a random choice of P, for any element a ∈ [bn], let the random variable Ca denote the ℓ-coverage of element a by Q.7 Then, EPh∑a∈[bn] Cai = ψ T,hbn. Since, the random variables satisfy 0 ≤ Ca ≤ ℓ (i.e., a bounded difference property), the concentration bound follows using the Azuma-Hoeffding's inequality. Note that equation (9) holds for a fixed choice of T and Q. Applying union bound over all the (h + 1)s possible choices of T and Q, we have that with probability at least 0.9, the ℓ-covering value satisfies C(ℓ)(Q) ≤(cid:16)ψ T,h + η(cid:17)bn (sincebn ≥ 100sℓ2η−2 log h). 7Note that, the index set T and indices of subsets that constitute Q are fixed for now. (ℓ) 14 e−ℓ(1+2µ). Therefore, ψ To prove the last statement of the lemma, we consider T = h(1 + µ) for 0 < µ < ε h(cid:17)T−i h(cid:17)T follows that for a large enough (compared to ℓ) h and i ≤ T, we have(cid:16)1 − ℓ ≥(cid:16)1 − ℓ (ℓ − i)(cid:18)T i (cid:19)(cid:18) ℓ h(cid:19)i T,h can be upper bounded as i (cid:19)(cid:18) ℓ h(cid:19)T−i (ℓ − i)(cid:18)T h(cid:19)i(cid:18)1 − ≤ ℓ − e−ℓ(1+2µ) ℓ−1 ∑ i=0 ℓ−1 ∑ i=0 ℓ − ℓ! ℓℓ . Then, it ≥ (10) (ℓ) ℓ ℓ For (ℓ − 1) = o(pT) and i ≤ ℓ − 1, the following bound holds for the binomial coefficients (cid:18)T i (cid:19) ≥ (1 − o(1))Ti = (1 − o(1)) i! i! hi(1 + µ)i (11) (12) Therefore, the right-hand-side of inequality (10) satisfies8 ℓ − e−ℓ(1+2µ) ℓ−1 ∑ i=0 (ℓ − i)(cid:18)T h(cid:19)i i (cid:19)(cid:18) ℓ ≤ ℓ − e−ℓ(1+2µ) ℓi i! ∑ (ℓ − i) ≤ ℓ − e−ℓ(1+2µ) = ℓ − e−ℓ(1+2µ) ℓ−1 i=1(cid:18) ℓi+1 = ℓ − e−ℓ(1+2µ) (ℓ − 1)! ≤ ℓ − e−ℓ(1 − 2ℓµ) = ℓ − e−ℓ ≤ ℓ − e−ℓ Here, the last inequality follows from the fact µ < ε (ℓ − 1)! + e−ℓℓ (ℓ − 1)! + ε ℓℓ ℓℓ ℓℓ ℓℓ hi(1 + µ)i (ℓ − i) i! (cid:18) ℓ h(cid:19)i (since (1 + µ)i ≥ 1) ℓ−1 ∑ i=0 ℓ−1 ∑ i=0 ℓi (i − 1)!(cid:19) + ℓ! i! − (telescoping sum) (e−x ≥ 1 − x) (13) ℓℓ (ℓ − 1)! · 2µ (ℓ − 1)! 2ℓ2 eℓ ℓ! ℓℓ ℓ! ℓℓ . Overall, in this setting we get that ψ (ℓ) T,h ≤ ℓ(cid:18)1 − e−ℓ(cid:19) + ε Therefore, C(ℓ)(Q) satisfies the stated bound C(ℓ)(Q) ≤(cid:16)ℓ(cid:16)1 − ℓℓ Since, a random choice of P = (P1, P2, . . . , Ps) satisfies the desired properties, we can enumerate over all choices of (P1, P2, . . . , Ps) in time exp(sbn logbn)poly(h) to find such a partitioning system.9 8Here we ignore the (1 − o(1)) multiplicative factor from equation (11) to keep the calculation clean. The (1 − o(1)) 9Note that in our setting, m, h, and s will be treated as constants and, hence, such a partitioning system can be ℓ! e−ℓ(cid:17) + ε(cid:17)bn. term can be accounted for in equation (13), where it can be absorbed into ε. (cid:3) constructed in constant time. 15 Finally, we will also need the notion of piecewise linear extension of a function defined on integers. Definition 3.5 (Piecewise Linear Extension) Let f : Z+ 7→ R be a function defined on the nonnegative integers. We denote its piecewise linear extension f : R+ 7→ R as f (a) := λ f (i) + (1− λ) f (i + 1), where a ∈ R+ lies between the integers i and i + 1 (i.e., a ∈ [i, i + 1)) and λ satisfies a = λi + (1 − λ)(i + 1). By definition, f (a) = f (a) for every integer a ∈ Z+. Consequently, for any distribution D sup- ported over the integers, we have EX∼D [ f (X)] = EX∼D(cid:2) f (X)(cid:3). 3.2 The Reduction We now describe the reduction from h-ARYUNIQUEGAMES to the multi-coverage problem. Given an instance G(V, E, Σ, {πe,v}e∈E,v∈e) of h-ARYUNIQUEGAMES (as described in Definition 3.1), we construct an instance of the maximum ℓ-multi-coverage problem with ground set Γ and set system F as follows. 2, . . . , P e s . β as a subset in the set system F. i.e., the size of the alphabet set from the h-ARYUNIQUEGAMES instance. For each hyperedge Ground Set: For every h-uniform hyperedge e ∈ E, we introduce a distinct copy of the set [bn], which we denote by [bn]e. The overall ground set is Γ = ∪e∈E[bn]e. Set System: Fix an ([bn], h, s, ℓ, η)-partitioning gadget as described in Lemma 3.4, with s = Σ e = (v1, v2, . . . , vh) ∈ E, consider the copy of the ([bn], h, s, ℓ, η)-partitioning gadget on the elements corresponding to the hyperedge e. Say for e, the partitioning gadget is comprised of the collections 1, P e P e Using these collections, we will first define sets Te,v for each hyperedge e ∈ E, vertex v ∈ e, and β alphabet β ∈ Σ in the given instance G. Then, for every vertex v and alphabet β, we will include ∪e∈E:e∋v Te,v i with labels For each i ∈ [s], we consider the ith alphabet of Σ, say αi, and associate the h sets in P e for v1, v2, . . . , vh which map (under bijection πe,vj) to αi. This is done by renaming the subsets (πe,v2 )−1(αi), . . . , Te,vh )−1(αi), respectively. In other words, if in P e (πe,vh e,vj alphabet β ∈ Σ satisfies πe,vj(β) = αi, then we assign T i,j. Since πe,vj is a bijection, its β = Pe inverse (i.e., β) is well-defined. For every vertex v and alphabet β ∈ Σ, we construct eTv ∪e∈E[bn]e constitute the set system of the ℓ-coverage problem, i.e., F := neTv β v ∈ V, β ∈ Σo. Finally, we set the (cardinality constraint) threshold k = V, i.e., in the constructed instance (Γ, F ) the objective is to select k = V subsets (from F) with as large an ℓ-coverage value as possible. We quickly point out that in order to ensure that guarantees of the partitioning gadgets hold, we need Σ = s ≥ T ≥ 2h. However, since h is a constant, without loss of generality, we can always consider h-ARYUNIQUEGAMES instances with alphabet sizes large enough without losing out on the completeness and soundness parameters. We detail this observation in Section D. β . These subsets eTv β := ∪e∈ETe,v i = {Pe i,1, . . . , Pe i,h} to Te,v1 (πe,v1 )−1(αi), Te,v2 β ⊆ Γ = 3.3 Proof of Theorem 1.2 In the following subsections we argue the completeness and soundness directions of the reduction. This will establish the stated inapproximability result. 16 3.3.1 Completeness Suppose the given h-ARYUNIQUEGAMES instance G is a YES instance. Then, there exists a labeling σ : V 7→ Σ which strongly satisfies 1 − δ fraction of edges. Consider the collection of V subsets T := {eTv σ(v) v ∈ V}. Let e = (v1, v2, . . . , vh) be a hyperedge which is strongly satisfied by σ. Then, πe,v1(σ(v1)) = πe,v2(σ(v2)) = · · · = πe,vh(σ(vh)) = αr, for some αr ∈ Σ. By construction, σ(vx) x ∈ [h]o. Therefore, condition (1) r = nTe,vx for every x ∈ [h], we have Te,vx σ(vx) ⊂ eTvx of Definition 3.3 ensures that the sets eTvx σ(vx) forms an ℓ-cover of [bn]e. Since this is true for at least (1 − δ) fraction of the edges, we have C(ℓ)(T ) ≥ (1 − δ)ℓΓ. 3.3.2 Soundness We establish the contrapositive for the soundness claim, i.e., if there exists a family of V sets with large C(ℓ)-value, then there exists a labeling which weakly satisfies a significant fraction of the edges of the given instance G. Formally, suppose there exists a collection T ⊂ F of V subsets such that σ(vx) and P e ℓℓ ℓ! C(ℓ)(T ) ≥(cid:18)1 − e−ℓ(cid:19) ℓΓ + δΓ For every vertex v ∈ V, we define L(v) := {β ∈ Σ eTv β ∈ T } to be the candidate set of labels that can be associated with the vertex v. We extend this definition to hyperedges e = (v1, v2, . . . , vh), where we define L(e) := L(v1) ∪ L(v2) ∪ · · · L(vh) to be the multiset of all labels associated with the edge. We say that a hyperedge e = (v1, v2, . . . , vh) ∈ E is consistent iff there exists x, y ∈ [h] such that πe,vx(L(vx)) ∩ πe,vy(L(vy)) 6= ∅, i.e., e is consistent if there exists two vertices vx and vy in this hyperedge such that the projections of the label sets of vx and vy are not disjoint. We will need the following basic lemma which says that the ℓ-coverage of any inconsistent hyperedge (i.e., a hyperedge which is not consistent) must be small. (14) Lemma 3.6 Let e = (v1, v2, . . . , vh) ∈ E be any hyperedge which is inconsistent with respect to T . Then, e (T ) ≤(cid:16)ψ (ℓ) L(e),h + η(cid:17)bn. the ℓ-coverage of T , restricted to elements [bn]e, is upper bounded as follows C(ℓ) Proof. Since e is inconsistent, we have that for every x, y ∈ [h], the projected label sets are disjoint i.e., πe,vx(L(vx)) ∩ πe,vy(L(vy)) = ∅. Therefore, for every αi ∈ Σ, there exists at most one v ∈ e such that πe,v(L(v)) ∋ αi, which implies that for every i ∈ [s], the family T intersects with the collection P e i in at most one subset. Therefore, we can invoke condition (2) from Definition 3.3 (with T = L(e)), to obtain C(ℓ) Since the overall ℓ-coverage value of T is large and inconsistent edges admit small ℓ-coverage, we can show that there exists a large fraction of consistent edges. To begin with, we claim that for a significant fraction of the edges e, the associated label sets L(e) cannot be too large. Specifically, we note that L(e),h + η(cid:17)bn. e (T ) ≤(cid:16)ψ (ℓ) (cid:3) E e=(v1,...,vh)∼EhL(v1) ∪ L(v2) ∪ · · · ∪ L(vh)i ≤ h V ∑ v∈V L(v) = h. (15) 17 δ δ h for 16ℓ2 fraction of the hyperedges. Next, we provide a decoding which weakly satisfies a Here, we use the fact that the underlying hypergraph is regular and, hence, picking a hyperedge uniformly at random corresponds to selecting vertices with probability h/V each. Therefore, via Markov's inequality, the size of the label set (i.e., L(e)) is greater than 16ℓ2 at most significant fraction of hyperedges which are consistent and have small-sized label sets. In particular, we say that a hyperedge e ∈ E is nice if (i) e is consistent and (ii) the associated label set L(e) is of cardinality at most 16ℓ2 δ h. Since inconsistent edges with small label sets must result in small ℓ-coverage (Lemma 3.6), it must be that a significant fraction of edges must be nice. This observation is formalized in the following lemma: Lemma 3.7 At least δ 16ℓ2 fraction of hyperedges must be nice. Proof. Assume not, for the purpose of contradiction. Then, applying a union bound gives us Pr(cid:2)e is consistent(cid:3) ≤ Pr(cid:2)e is nice(cid:3) + Pr(cid:20)L(e) ≥ 16ℓ2 δ δ 8ℓ2 h(cid:21) ≤ 8ℓ2E · ℓbn = δ δ δ ℓ! e−ℓ(cid:17) + δ 2(cid:17) Γ. Ee∼EinchC(ℓ) e (T )i ≤ Ee∼Einchψ Furthermore, focusing on inconsistent edges and applying Lemma 3.6 we get where the tail bound on L(e) follows from Markov's inequality (as mentioned above). There- 8ℓΓ.10 Fur- fore, the ℓ-coverage contribution from consistent edges is at most thermore, using equation (14), we get that the ℓ-coverage from inconsistent edges is at least (cid:16)ℓ(cid:16)1 − ℓℓ To obtain a contradiction, we will now prove that the ℓ-coverage of inconsistent hyperedges cannot be this large. Write Einc ⊂ E to denote the set of inconsistent hyperedges. Since Einc ≥ (1 − 8ℓ2 )E, by averaging it follows that Ee∼Einc[L(e)] ≤(cid:0)1 + δ 4ℓ2(cid:1) h. L(e),h + ηi 1 = Ee∼Eincheψ L(e),h + ηi ≤(cid:16)eψ h(1+µ),h + η(cid:17)bn =(cid:16)ψ h(1+µ),h + η(cid:17)bn ≤(cid:18)ℓ(cid:18)1 − Here, in Steps 1 and 3 we use the fact that, by construction, eψ 2 follows via Jensen's inequality along with the observation that eψ (cid:16)ℓ(cid:16)1 − ℓℓ 10Recall that Γ = Ebn. (ℓ) x,h for every x ∈ Z+. Step x,h = ψ (ℓ) x,h is increasing (Lemma B.1) and concave in x (Lemma B.3). Now, the last inequality follows from the last statement of Defi- nition 3.3. This implies that the total ℓ-coverage contribution of inconsistent edges Einc is at most ℓ! e−ℓ(cid:17) + δ/4(cid:17) Γ. Hence, we obtain a contradiction and the claim follows. e−ℓ(cid:19) + δ/4(cid:19)bn (setting µ = δ 4ℓ2 ) (ℓ) (ℓ) ℓℓ ℓ! (ℓ) (ℓ) (ℓ) 2 3 (cid:3) 18 Finally, we construct a randomized labeling σ : V 7→ Σ as follows. For every vertex v, if L(v) 6= ∅, we set σ(v) uniformly from L(v), otherwise we set σ(v) arbitrarily. We claim that, in expectation, this labeling must weakly satisfy Ω(δ3) fraction of the hyperedges. To see this, fix any nice hyperedge e = (v1, v2, . . . , vh). Without loss of generality, we can assume that πe,v1(L(v1)) ∩ πe,v2(L(v2)) 6= ∅. Furthermore, the niceness also implies that L(v1), L(v2) ≤ δ h. Therefore, with probability at least 1/L(v1)L(v2) ≥ δ2 16ℓ2 256ℓ4h2 , we must have πe,v1(σ(v1)) = πe,v2(σ(v2)). Therefore, EσEe∼E [1{σ weakly satisifies e}] ≥ δ 16ℓ2 EσEe∼E [1{σ weakly satisifies e} e ∈ Enice] ≥ Ω(δ3) which, for fixed ℓ and h, gives us the soundness direction. 4 Concluding remarks The standard coverage function C(S) counts the number of elements e ∈ [n] that are covered by at least one set Ti with i ∈ S. Note that the contribution of an e ∈ [n] to C(S) is exactly the same whether e appears in just one set Ti or in all of them. As previously mentioned, it is very natural to consider settings wherein having more than one copy of e is more valuable than just one copy of it. The ℓ-coverage function we introduced does exactly that: having c copies of element e has a value of min{ℓ, c}. We showed that when this is the case, we can take advantage of this structure and obtain a better approximation guarantee as a function of ℓ. It would be interesting to consider the general setting where c copies have a value ϕ(c) for some function ϕ, and identify what properties of ϕ lead to better approximation bounds. More generally, we believe that our work paves the way towards an operationally motivated notion of submodularity that interpolates between linear functions and completely general submodular functions. The previously mentioned notion of curvature studied in [6, 25] does this interpolation but the definition is unfortunately too restrictive and thus difficult to interpret operationally. Another interesting question is whether there exists combinatorial algorithms that achieve the approximation ratio ρℓ for maximum ℓ-coverage for ℓ ≥ 2. For ℓ = 1, the simple greedy algo- rithm does the job, but as we mentioned previously, the greedy algorithm only gives a 1 − e−1 approximation ratio even for ℓ ≥ 2. Is it possible to generalize the greedy algorithm to give an approximation ratio beating 1 − e−1? Acknowledgements We are very grateful to Guillaume Aubrun for referring us to the notion of convex order between distributions and Barı¸s Nakibuglu for asking us about the list-decoding variant of [2] during the workshop Beyond IID in Information Theory held at the Institute for Mathematical Sciences, Na- tional University of Singapore in 2017. We would also like to thank Edouard Bonnet for referring us to the literature on set multicover. This research is supported by the French ANR project ANR- 18-CE47-0011 (ACOM). Siddharth Barman gratefully acknowledges the support of a Ramanujan Fellowship (SERB - SB/S2/RJN-128/2015) and a Pratiksha Trust Young Investigator Award. Part of this work was conducted during the first author's visit to École Normale Supérieure de Lyon and was supported by the Administration de la recherche (ADRE), France. References [1] A. A. Ageev and M. I. Sviridenko. Pipage rounding: A new method of constructing algo- rithms with proven performance guarantee. J. Comb. Optim., 8(3):307 -- 328, 2004. 19 [2] S. Barman and O. Fawzi. Algorithmic aspects of optimal channel coding. IEEE Trans. Inform. Theory, 2018. arXiv:1508.04095. [3] P. Berman, B. DasGupta, and E. Sontag. Randomized approximation algorithms for set mul- ticover problems with applications to reverse engineering of protein and gene networks. Dis- crete Applied Mathematics, 155(6):733 -- 749, 2007. Computational Molecular Biology Series, Issue V. [4] A. Bhangale, R. Gandhi, M. T. Hajiaghayi, R. Khandekar, and G. Kortsarz. Bi-covering: Cover- ing edges with two small subsets of vertices. SIAM Journal on Discrete Mathematics, 31(4):2626 -- 2646, 2017. [5] G. Calinescu, C. Chekuri, M. Pál, and J. Vondrák. Maximizing a monotone submodular func- tion subject to a matroid constraint. SIAM Journal on Computing, 40(6):1740 -- 1766, 2011. [6] M. Conforti and G. Cornuéjols. Submodular set functions, matroids and the greedy algorithm: tight worst-case bounds and some generalizations of the Rado-Edmonds theorem. Discrete applied mathematics, 7(3):251 -- 274, 1984. [7] G. Cornuejols, M. L. Fisher, and G. L. Nemhauser. Location of bank accounts to optimize float: An analytic study of exact and approximate algorithms. Management Science, 23(8):789 -- 810, 1977. [8] G. Dobson. Worst-case analysis of greedy heuristics for integer programming with nonnega- tive data. Mathematics of Operations Research, 7(4):515 -- 531, 1982. [9] S. Dobzinski and M. Schapira. An improved approximation algorithm for combinatorial auc- tions with submodular bidders. In Proceedings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, pages 1064 -- 1073. Society for Industrial and Applied Mathematics, 2006. [10] S. Dughmi, T. Roughgarden, and Q. Yan. Optimal mechanisms for combinatorial auctions and combinatorial public projects via convex rounding. Journal of the ACM (JACM), 63(4):30, 2016. [11] S. Dughmi and J. Vondrák. Limitations of randomized mechanisms for combinatorial auc- In Proceedings of the 2011 IEEE 52Nd Annual Symposium on Foundations of Computer tions. Science, FOCS '11, pages 502 -- 511, Washington, DC, USA, 2011. IEEE Computer Society. [12] U. Feige. A threshold of ln n for approximating set cover. J. ACM, 45(4):634 -- 652, 1998. [13] U. Feige. On maximizing welfare when utility functions are subadditive. SIAM J. Comput., 39(1):122 -- 142, 2009. [14] V. Feldman, V. Guruswami, P. Raghavendra, and Y. Wu. Agnostic learning of monomials by halfspaces is hard. SIAM Journal on Computing, 41(6):1558 -- 1590, 2012. [15] V. Feldman and P. Kothari. Learning coverage functions and private release of marginals. In Conference on Learning Theory, pages 679 -- 702, 2014. [16] D. S. Hochbaum. Approximating covering and packing problems: set cover, vertex cover, In Approximation Algorithms for NP-Hard Problem, independent set, and related problems. pages 94 -- 143. PWS Pub., 1997. 20 [17] D. S. Johnson. Approximation algorithms for combinatorial problems. J. Comput. Syst. Sci., 9(3):256 -- 278, 1974. [18] S. Khot. On the power of unique 2-prover 1-round games. In Proceedings of the thiry-fourth annual ACM symposium on Theory of computing, pages 767 -- 775. ACM, 2002. [19] S. Khot and N. K. Vishnoi. On the unique games conjecture. In FOCS, volume 5, page 3, 2005. [20] A. Krause and D. Golovin. Submodular function maximization. Tractability: Practical Ap- proaches to Hard Problems, 3:19, 2012. [21] G. L. Nemhauser, L. A. Wolsey, and M. L. Fisher. An analysis of approximations for maximiz- ing submodular set functions. Math. Program., 14(1):265 -- 294, 1978. [22] Y. Polyanskiy, H. V. Poor, and S. Verdú. Channel coding rate in the finite blocklength regime. IEEE Trans. Inform. Theory, 56(5):2307 -- 2359, 2010. [23] S. Rajagopalan and V. V. Vazirani. Primal-dual rnc approximation algorithms for set cover and covering integer programs. SIAM J. Comput., 28(2):525 -- 540, 1998. [24] M. Shaked and J. G. Shanthikumar. Stochastic orders. Springer Science & Business Media, 2007. [25] M. Sviridenko, J. Vondrák, and J. Ward. Optimal approximation for submodular and supermodular optimization with bounded curvature. Mathematics of Operations Research, 42(4):1197 -- 1218, 2017. [26] J. Vondrák. Submodularity in combinatorial optimization. 2007. A Proof of Lemma 2.4 Lemma 2.4 For any nonnegative integers s and t, the function f : x 7→ s−1 ∑ m=0 (s − m)(cid:18) t m(cid:19)xm(1 − x)t−m is non-increasing and convex in the interval [0, 1]. Note that ( t m) = 0 when m > t. Proof. Let us start with the case s ≥ t. In this case, m(cid:19)xm(1 − x)t−m = (s − m)(cid:18) t s−1 ∑ m=0 s ∑ m=0 = t ∑ m=0 (s − m)(cid:18) t m(cid:19)xm(1 − x)t−m (s − m)(cid:18) t m(cid:19)xm(1 − x)t−m m(cid:18) t m(cid:19)xm(1 − x)t−m t(cid:18) t − 1 m − 1(cid:19)xm(1 − x)t−m t ∑ m=1 t ∑ m=1 = s − = s − 21 = s − tx · = s − tx , which proves the statement. Now we assume s < t. Then we have t−1 ∑ m=0(cid:18) t − 1 m − 1(cid:19)xm(1 − x)t−1−m f ′(x) = −st(1 − x)t−1 + s−1 ∑ m=1 (s − m)(cid:18) t m(cid:19)(mxm−1(1 − x)t−m − (t − m)xm(1 − x)t−m−1) . If we now combine the two terms of the form xm(1 − x)t−m−1 for m ∈ {0, . . . , s − 2}, we get a coefficient of −(s − m)(t − m)(cid:18) t m(cid:19) + (s − m − 1)(cid:18) t m + 1(cid:19)(m + 1) = −(s − m)(m + 1)(cid:18) t m + 1(cid:19) + (s − m − 1)(cid:18) t m + 1(cid:19)(m + 1) = −(m + 1)(cid:18) t m + 1(cid:19) . s − 1(cid:19)(t − s + 1)xs−1(1 − x)t−s ≤ 0 . Thus, for x ∈ [0, 1] s−2 ∑ f ′(x) = − m=0(cid:18) t m + 1(cid:19)(m + 1)xm(1 − x)t−m−1 −(cid:18) t This proves the fact that f is non-increasing. Now, if we differentiate one more time, we get f ′′(x) = (t − 1) · t · (1 − x)t−2 + s−2 ∑ m=1(cid:18) t m + 1(cid:19)(m + 1)(−mxm−1(1 − x)t−m−1 + (t − m − 1)xm(1 − x)t−m−2) = s−2 ∑ −(cid:18) t s − 1(cid:19)(t − s + 1)(s − 1)xs−2(1 − x)t−s +(cid:18) t m=0(cid:18)(cid:18) t m + 1(cid:19)(m + 1)(t − m − 1) −(cid:18) t +(cid:18) t s − 1(cid:19)(s − 1)(t − s + 1)xs−2(1 − x)t−s −(cid:18) t s − 1(cid:19)(t − s + 1)(s − 1)xs−2(1 − x)t−s +(cid:18) t =(cid:18) t s − 1(cid:19)(t − s + 1)(t − s)xs−1(1 − x)t−s−1 ≥ 0 , which proves the convexity of f . s − 1(cid:19)(t − s + 1)(t − s)xs−1(1 − t)t−s−1 m + 2(cid:19)(m + 2)(m + 1)(cid:19) xm(1 − x)t−m−2 s − 1(cid:19)(t − s + 1)(t − s)xs−1(1 − x)t−s−1 (cid:3) In this section, we prove that the linear piecewise extension of the function ψ (ℓ) x,h (which we denote (ℓ) x,h) is concave in x. Our strategy would be to show that for a fixed choice of ℓ, h, the quantity B Concavity of eψ by eψ 22 ψ (ℓ) x,h is increasing and satisfies a diminishing marginals property in x. Using these properties, the concavity ofeψ follows immediately. We setup some additional notation. For the rest of this section, we will fix ℓ and h, and let p := ℓ/h. Therefore, we will drop by indexing by ℓ and h, and denote ψ(x) = ψ (ℓ) x,h. We will use Zx,p to denote a random variable drawn from the distribution Bin(x, p) i.e., the bino- + 7→ R denote the piecewise linear mial distribution with bias p and number of trials x. Let s : R function defined as follows: s(x) := x for all x ≤ ℓ and s(x) = ℓ for all x > ℓ. Recall that from the proof of Lemma 3.4 we can alternatively write ψ(x) as ψ(x) = x ∑ i=0 s(i)(cid:18)x i(cid:19)pi(1 − p)x−i = Ehs(cid:0)Zx,p(cid:1)i (16) Going forward, the above expression for ψ(x) will prove to be useful. We begin by the following lemma, which says that ψ(x) is increasing in x. Lemma B.1 For every x ∈ Z+ we have ψ(x + 1) ≥ ψ(x). Proof. This is a direct consequence of stochastic dominance between binomial distributions with x and x + 1 trials, respectively. Recall that ψ(x) = Ehs(cid:0)Zx,p(cid:1)i. The tail-sum formula gives us Ehs(cid:0)Zx,p(cid:1)i = ∞ ∑ t=0 Pr(cid:2)s(Zx,p) ≥ t(cid:3) = ℓ ∑ t=0 Pr(cid:2)s(Zx,p) ≥ t(cid:3) = ℓ ∑ t=0 Pr(cid:2)Zx,p ≥ t(cid:3) . Here, the second equality follows from the fact that, by definition, s(z) ≤ ℓ for all z ∈ Z+. The third inequality relies on the observation that, for any t ∈ [ℓ], we have s(z) ≥ t iff z ≥ t. Analogously, we have ψ(x + 1) = ∑ℓ Since the random variable Zx+1,p stochastically dominates Zx,p -- in particular, Pr(cid:2)Zx+1,p ≥ t(cid:3) ≥ Pr(cid:2)Zx,p ≥ t(cid:3) -- the desired inequality follows ψ(x + 1) ≥ ψ(x). t=0 Pr(cid:2)Zx+1,p ≥ t(cid:3). (cid:3) Additionally, the following lemma proves that ψ satisfies a diminishing marginals property. Lemma B.2 For every x, y ∈ Z+ such that x ≤ y we have ψ(x + 1) − ψ(x) ≥ ψ(y + 1) − ψ(y). Proof. We again use the alternative expression for ψ as given in (16): ψ(x + 1) = Ehs(cid:0)Zx+1,p(cid:1)i = ∑ Ehs(cid:0)i + Z1,p(cid:1)(cid:12)(cid:12)(cid:12)Zx,p = ii · PrhZx,p = ii Ehs(cid:0)i + Z1,p(cid:1) − s(i) + s(i)(cid:12)(cid:12)(cid:12)Zx,p = ii · PrhZx,p = ii Ehs(cid:0)Z1,p(cid:1) − s(i)(cid:12)(cid:12)(cid:12)Zx,p = ii · PrhZx,p = ii Ehs(i)(cid:12)(cid:12)(cid:12)Zx,p = ii · PrhZx,p = ii i≥0 = ∑ i≥0 = ∑ i≥0 + ∑ i≥0 23 = ∑ i≥0 = ∑ i≥0 Ehs(cid:0)i + Z1,p(cid:1) − s(i)(cid:12)(cid:12)(cid:12)Zx,p = ii · PrhZx,p = ii + Ehs(cid:0)Zx,p(cid:1)i Ehs(cid:0)i + Z1,p(cid:1) − s(i)(cid:12)(cid:12)(cid:12)Zx,p = ii · PrhZx,p = ii + ψ(x) Rearranging the above expression we get ψ(x + 1) − ψ(x) = ∑ i≥0 ℓ−1 ∑ i=0 ℓ−1 ∑ i=0 ℓ−1 ∑ i=0 2 = 1 = Ehs(cid:0)i + Z1,p(cid:1) − s(i)i PrhZx,p = ii Ehs(cid:0)i + Z1,p(cid:1) − s(i)i PrhZx,p = ii EhZ1,pi PrhZx,p = ii p PrhZx,p = ii = p PrhZx,p ≤ ℓ − 1i ≥ p PrhZy,p ≤ ℓ − 1i = ψ(y + 1) − ψ(y) = 3 4 Steps 1 and 2 follow from the construction of the function s; in particular, for any 0 ≤ z ≤ 1, we have s(i + z) = s(i) whenever i ≥ ℓ and s(i + z) = s(i) + z if i ≤ ℓ − 1. Step 3 follows from the stochastic dominance of Zy,p over Zx,p; recall that x ≤ y. Step 4 is obtained by reapplying the arguments used till Step 3 for y, i.e., by instantiating the expressions with y, instead of x. (cid:3) (ℓ) x,h. (ℓ) x,h be the piecewise linear extension of ψ Now we are ready to prove the concavity of eψ Lemma B.3 Let eψ Proof. For ease of notation, we drop the indexing by ℓ, h and denote eψ(x) = eψ Proposition B.4 A function g : A 7→ R is concave over A ⊆ R iff for every choice of x1, x2, x3, x4 ∈ A such that x1 ≤ x2 ≤ x3 ≤ x4 we have the following equivalent characterization of concavity of function: x,h. Then, eψ (ℓ) x,h. We shall need (ℓ) x,h is concave in x. (ℓ) g(x2) − g(x1) x2 − x1 ≥ g(x4) − g(x3) x4 − x3 (17) Using the above proposition, the concavity of eψ follows almost directly. Fix any xii∈[4] as in Proposition B.4. For every j ∈ {1, 2, 3, 4, }, let (ij, ij + 1] be the semi-closed interval such that xj ∈ (ij, ij + 1]. Then, 24 eψ(x2) −eψ(x1) x2 − x1 1 2 = x2 − i2 (eψ(x2) −eψ(i2)) + ∑i2 (x2 − i2) + ∑i2 ≥ max(cid:26)eψ(x2) −eψ(i2) ≥ max(cid:26)eψ(x2) −eψ(i2) = max(cid:26)eψ(i2 + 1) −eψ(i2) (i2 + 1) − i2 = eψ(i2 + 1) −eψ(i2) (i2 + 1) − i2 x2 − i2 3 4 (18) r=i1+2(eψ(r) −eψ(r − 1)) + (eψ(i1 + 1) −eψ(x1)) r=i1+2(r − (r − 1)) + ((i1 + 1) − x1) (i1 + 1) − x1 (cid:27) (cid:17), eψ(i1 + 1) −eψ(x1) r∈{i1+2,...,i2}(cid:16)eψ(r) −eψ(r − 1) , max (i1 + 1) − x1 (cid:27) , eψ(i1 + 1) −eψ(x1) , eψ(i1 + 2) −eψ(i1 + 1) (i1 + 2) − (i1 + 1) (i1 + 1) − i1 (cid:27) , eψ(i1 + 1) −eψ(i1) , eψ(i1 + 2) −eψ(i1 + 1) (i1 + 2) − (i1 + 1) r − (r − 1) (19) We briefly justify the above steps. Step 1 uses the following known observation that for any se- quence of pairs of nonnegative integers (ai, bi)i∈[r] we have a1 + a2 + · · · + ar b1 + b2 + · · · + br ≥ min i∈[r] ai bi (20) Combining the above observation with the fact that eψ(x) is increasing in x gives us the inequality. In steps 2 and 4, we use the diminishing marginal property of eψ (Lemma B.2). Step 3 follows from the piecewise linearity of eψ. A similar sequence of arguments also gives us (21) eψ(x4) −eψ(x3) x4 − x3 ≤eψ(i3 + 1) −eψ(i3) (i3 + 1) − i3 (Lemma B.1) we have Since x3 ≥ x2, we have i3 ≥ i2, and therefore, using the diminishing marginals property of eψ (i3 + 1) − i3 ≥ eψ(i3 + 1) −eψ(i3) eψ(i3 + 1) −eψ(i3) (i3 + 1) − i3 (22) Combining the inequalities from Equations (18-19), (21) and (22) gives us eψ(x2)−eψ(x1) x2−x1 ≥ eψ(x4)−eψ(x3) Since this holds for any choice of x1 ≤ x2 ≤ x3 ≤ x4, using Proposition B.4, we get that eψ is concave. x4−x3 (cid:3) . C Reduction to h-ARYUNIQUEGAMES Here, we give the reduction from the graph variant of the UNIQUEGAMES to the h-ARYUNIQUEGAMES that we use in our reduction. We point out that this variant is well known, and in particular, a near identical variant can be found in [14]. However the variant from [14] does not explicitly guarantee that the underlying constraint hypergraph is regular, a feature we use crucially in our reduction. Hence, we include the full reduction for the sake of completeness. We begin by introducing the conjecture for bi-regular variant of UNIQUEGAMES. 25 Definition C.1 (UNIQUEGAMES) An instance G(U, V, E, Σ, {πe,u : Σ 7→ Σ}e∈E,v∈V) of UNIQUEGAMES is characterized by a bipartite graph on vertices (U, V) and bijection projection constraints πe,v : Σ 7→ Σ. Here, each edge represents a constraint involving the vertices participating in the edge. We say that a labeling σ : U ∪ V 7→ Σ satisfies the edge (u, v) ∈ E if and only if πe,v(σ(v)) = σ(u). The following is known to be equivalent to the Unique Games Conjecture Conjecture C.2 (See Conjecture 1 [4] ) For every constant ε > 0 the following holds. Given an instance G of UNIQUEGAMES, it is NP-Hard to distinguish between the following cases: • (YES): There exists a labeling σ of the vertices which satisfies at least 1 − ε fraction of the constraints. • (NO): No labeling σ of the vertices satisfies more than ε fraction of the edges. Additionally, the underlying constraint graph is regular. Here the degree of the constraint graph and the alphabet size depend only on the parameter ε. The following theorem says that there exists a polynomial time reduction from UNIQUEGAMES to h-ARYUNIQUEGAMES. Theorem C.3 For all constant choices of ε > 0 and h ∈ , there exists a polynomial time reduction which on input a UNIQUEGAMES instance G(U, V, E, Σ, {πe,u}e∈E,u∈e) (as in Conjecture C.2) outputs h-ARYUNIQUEGAMES instance G′(V, E′, Σ, { πe,u}e∈E′,u∈e) satisfying the the following properties: • If G is a YES instance, then there exists a labeling which strongly satisfies 1− ε fraction of hyperedges in G′. • If G is a NO instance, then no labeling weakly satisfies more than h2√ε fraction of the hyperedges in G′. Additionally, the instance G′ output by the reduction satisfy the following properties. • The alphabet set of G′ is the same as the alphabet set of G. • The underlying constraint hypergraph is regular i.e., every vertex v ∈ V participates in the same number of hyperedge constraints. Proof. We construct the h-ARYUNIQUEGAMES instance as follows. The vertex set of the h- ARYUNIQUEGAMES instance G′ is going to be V i.e., the right vertex set of the UNIQUEGAMES The underlying constraint hypergraph is the following h-ary hypergraph H. instance G. Fix a left vertex u ∈ U, and let N(u) denote its neighborhood. For every h-sized subset (v1, v2, . . . , vh) ⊂ (N(u) h ) we add the hyperedge e = (v1, v2, . . . , vh) to the hyperedge set E′. Furthermore, we set the corresponding bijection constraint to be πe,vi = π(u,vi),vi. This is done for every choice of left vertex u, and every h-sized subset of its neighborhood. Overall, for a constant h, the reduction runs in time VO(h)poly(U, V, Σ). From its construction, it is clear that every vertex in v participates in the same number of h-ary constraints (this follows from the bi-regularity of the original constraint graph). Furthermore, we shall need the following observation which is again a consequence of the bi-regularity of the UNIQUEGAMES instance G. Observation 1 The following process is an equivalent way of sampling a random hyperedge e ∈ E′. 26 • Sample a random left vertex u ∼ U. • Sample h-random neighbors v1, v2, . . . , vh ∼ N(u) without replacement, and output the hy- peredge e = (v1, v2, . . . , vh) Equipped with the above observations, we now argue the completeness and soundness directions of our reduction. Completeness: Suppose G is a YES instance. Then, there exists a labeling σ : U ∪ V 7→ Σ of the vertices which satisfies at least 1 − ε fraction of the edges. Let σ′ : V 7→ Σ be the restriction of the labeling σ to the set of right vertices V i.e., for all v ∈ V we have σ′(v) = σ(v). We now show that the labeling σ′ strongly satisfies at least 1 − εh fraction of hyperedges in G′. (Observation 1) Pr Pr Pr e=(v1,v2,...,vh)∼E′hσ′strongly satsifies ei = Eu∼U" ≥ Eu∼U" = Eu∼U" ≥ 1 − ∑ i∈[h] ≥ 1 − εh v1,v2,...,vh∼N(u)h ∀i 6= j, πe,vi(σ′(vi)) = πe,vj(σ′(vj))i# v1,v2,...,vh∼N(u)h ∀i ∈ [h], πe,vi (σ′(vi)) = σ(u)i# v1,v2,...,vh∼N(u)h ∀i ∈ [h], π(u,vi),vi(σ(vi)) = σ(u)i# u∼U,vi∼N(u)hπ(u,vi),vi(σ(vi)) 6= σ(u)i Pr Pr The inequality in the last step can be justified as follows. We use the fact that for u drawn uni- formly random from U and vi drawn uniformly random from N(u), the pair (u, vi) is marginally distributed as a uniformly random edge from E (since G is bi-regular). Since the labeling σ satis- fies at least 1 − ε fraction of edges, for each i ∈ [h], the probability that σ does not satisfy the edge (u, vi) is at most ε. Combining the two observations gives us the inequality. Soundness: Suppose in the h-ARYUNIQUEGAMES instance, there exists a labeling of the vertices σ′ : V 7→ Σ which weakly satisfies at least ε fraction of the hyperedges in G′. Using Observation 1 and the construction of π, this is equivalent to u,{v1,v2,...,vh}∼N(u)h∃i 6= j s.t. π(u,vi),vi(σ′(vi)) = π(u,vj),vj(σ′(vj))i ≥ ε Pr By averaging over the choices of pairs of indices, there exists indices i, j ∈ [h], i 6= j, such that Eu∼U" vi,vj∼N(u)hπ(u,vi),vi(σ′(vi)) = π(u,vj),vj(σ′(vj))i# ≥ Pr ε (h 2) ≥ 2ε/h2 (23) (24) Again by an averaging argument, we know that for at least ε/h2 choices of left vertices u, we have Pr vi,vj∼N(u)hπ(u,vi),vi(σ′(vi)) = π(u,vj),vj(σ′(vj))i ≥ ε/h2 (25) 27 We call such a left vertex u as good. Then, for any fixed good vertex u ∈ U, there exists a right vertex v(u) ∈ V, for which Pr vi∼N(u)hπ(u,v(u)),v(u)(σ′(v(u))) = π(u,vi),vi(σ′(vi))i ≥ ε/h2 (26) In other words, for at least ε/h2 fraction of right vertices of v′ ∈ N(u), the corresponding right vertex label σ′(v′) projects under π(u,v′),v′ to the same left vertex label, say σu ∈ Σ. In particular, we denote the set of all right vertices v′ ∈ V′ which project to σu as V(u). We shall use these left vertex labels and the labeling σ′ to construct a labeling σ : U ⊎ V 7→ Σ which shall satisfy a significant fraction of edges in G. Specifically, for every good vertex u ∈ U, we assign σ(u) = σu. We complete the labeling of left vertices by assigning labels to unlabeled vertices arbitrarily. The right vertices are labeled exactly according to the labeling σ′. We now show that this labeling satisfies at least ε2/h4-fraction of edges in the UNIQUEGAMES instance G. e=(u,v)h1{σ satisfies e}i = E = Eu∈U E ≥ Pr u∼L ε ≥ E h2 ε ≥ h2 ε2 ≥ h4 ε2 = h4 v∼N(u)h1{π(u,v),v(σ(v))=σ(u)}i u∼U,v∼N(u)h1{π(u,v),v(σ(v))=σu}u is goodi u∼U,v∼N(u)h Pr[v ∈ V(u)]1{π(u,v),v(σ(v))=σu}u is good, v ∈ V(u)i u∼U,v∼N(u)h1{π(u,v),v(σ(v))=σu}u is good, v ∈ V(u)i v∼N(u)h1{π(u,v),v(σ(v))=σ(u)}u is goodi E E E e=(u,v)h1{πe,v(σ(v))=σ(u)}i [u is good] E where in the first step we use the fact that the UNIQUEGAMES instance G is bi-regular, and hence left regular. In the last step we know that for any choice of u ∈ U such that u is good, and any choice of v ∈ V(u), we must have σu = π(u,v),v(σ(v)). This completes the proof of soundness direction. (cid:3) D Increasing Alphabet Size While Preserving Completeness and Soundness In this section, we state and prove the following lemma which shows that one can always choose alphabet size of the UNIQUEGAMES instance to be large enough while preserving the complete- ness and soundness parameters of the instance. Lemma D.1 Let G(V, E, Σ, {πe,v}e,v) be an instance of h-ARYUNIQUEGAMES. Let r ∈  be a nonneg- ative integer. Then there exists a polynomial time algorithm which constructs a h-ARYUNIQUEGAMES instance G′(V, E, Σ′, {π′e,v}e,v) such that Σ′ = rΣ satisfying the following property for any choice of γ ∈ [0, 1]. There exists a labeling σ : V 7→ Σ which strongly (or weakly) satisfies at least γ fraction of the hyperedges in G iff there exists a labeling σ′ : V 7→ Σ′ which strongly (or weakly) satisfies at least γ fraction of hyperedges in G′. 28 (i) 1 , α (i) (i) (i) 2 , . . . , α Proof. The underlying idea here is to define the large alphabet set Σ′ for the h-ARYUNIQUEGAMES instance G′ to be the disjoint union of r copies of the smaller alphabet set Σ. Specifically, we define Σ′ = Σ1 ⊎ Σ2 ⊎ . . . ⊎ Σr, where Σ1, Σ2, . . . , Σr are disjoint copies of the alphabet set Σ. Let s }. As stated in the lemma, Σ := {α1, α2, . . . , αs}, and for every i ∈ [r], let Σi = {α the vertex set and the hyperedge set for G′ are the same as those of G. Additionally, for any h-ary hyperedge e and any vertex v ∈ E, we define the projection constraint π′e,v : Σ′ 7→ Σ′ as follows. For every i ∈ [r], the restriction of the projection π′e,v to the alphabet set Σi is the corresponding copy of πe,v : Σ 7→ Σ on the alphabet set Σi. Formally, for every index i ∈ [r], and label α j ∈ Σi, and e ∈ E′, v ∈ e, we assign πe,v(α if πe,v(αj) = αj′. This completes the description of the h-ARYUNIQUEGAMES instance G′. Note that we can construct G′ from G in time poly(V, Σ, r). We shall prove the claim for strongly satisfied hyperedges; the case involving the weakly sat- isfied hyperedges follows similarly. We begin by arguing the forward direction of the claim. Suppose there exists labeling σ : V 7→ Σ which strongly satisfies at least γ fraction of the hy- peredges in G. Then, we construct labeling σ′ : V 7→ Σ′ for G′ from σ as follows. For every (1) v ∈ V, we let σ′(v) = α i(v) if σ(v) = αi(v). We claim that the labeling σ′ will strongly satisfy any hyperedges strongly satisfied by σ in G. To see this, we fix a hyperedge e = (v1, v2, . . . , vh) (which are w.l.o.g., labeled with α1, α2, . . . , αh respectively) which is strongly satisfied by σ. Then πe,v1(σ(v1)) = πe,v2(σ(v2)) = · · · = πe,vh(σ(v(h))) = αi(e) for some αi(e) ∈ Σ. But then, our construction of Σ′ ensures that for every j ∈ [h] we have (i) j ) = α (i) j′ π′e,vj (σ′(vj)) = π′e,vj (α (1) i(vj)) = α (1) i(e) (27) The above implies that the labeling σ′ strongly satisfies the hyperedge e in the h-ARYUNIQUEGAMES instance G′. Note that these observations hold for any hyperedge e ∈ E strongly satisfied by the labeling σ in the h-ARYUNIQUEGAMES instance G. Therefore, the labeling σ′ must also strongly satisfy at least γ-fraction of the hyperedges in G′. Now we prove the reverse direction of the claim. Let σ′ : V 7→ Σ′ be a labeling strongly satisfying at least γ fraction of the hyperedges in G′. We shall construct from σ′ a labeling σ : V 7→ Σ of the vertices of G which will strongly satisfy at least γ fraction of the hyperedges in G. Formally, for any vertex v ∈ V, we assign σ(v) = αi(v) if σ′(v) ∈ {α i(v)w ∈ [r]}. As in the previous part, we claim that if the labeling σ′ strongly satisfies a hyperedge e = (v1, v2, . . . , vh) in G′, then the labeling σ (wj) must strongly satisfy the hyperedge e in G. For j ∈ [h] let σ′(vj) = α i(vj) be the label assigned to the jth vertex in e. Then by construction of σ, for any vertex vj ∈ e we have σ(vj) = αi(vj). Since σ′ strongly satisfies the hyperedge e ∈ E, we have π′e,v1(σ′(v1)) = π′e,v2(σ′(v2)) = · · · = π′e,vh ie ∈ Σwe. But then by construction of σ, for every choice of j ∈ [h] we must have πe,vj(σ(vj)) = πe,vj(αi(vj)) = αie, which implies that σ strongly satisfies the hyperedge e in G. Again, note that this holds for any hyperedge e strongly satisfied by the labeling σ′ in G′. Since σ′ strongly satisfies at least γ fraction of the hyperedges in G′, we can conclude that the labeling σ strongly satisfies at least γ fraction of the hyperedges in G. (σ′(vh)) = αwe ie for some αwe (w) (cid:3) 29
1503.09168
1
1503
2015-03-31T19:19:11
On Convergence and Threshold Properties of Discrete Lotka-Volterra Population Protocols
[ "cs.DS" ]
In this work we focus on a natural class of population protocols whose dynamics are modelled by the discrete version of Lotka-Volterra equations. In such protocols, when an agent $a$ of type (species) $i$ interacts with an agent $b$ of type (species) $j$ with $a$ as the initiator, then $b$'s type becomes $i$ with probability $P\_{ij}$. In such an interaction, we think of $a$ as the predator, $b$ as the prey, and the type of the prey is either converted to that of the predator or stays as is. Such protocols capture the dynamics of some opinion spreading models and generalize the well-known Rock-Paper-Scissors discrete dynamics. We consider the pairwise interactions among agents that are scheduled uniformly at random. We start by considering the convergence time and show that any Lotka-Volterra-type protocol on an $n$-agent population converges to some absorbing state in time polynomial in $n$, w.h.p., when any pair of agents is allowed to interact. By contrast, when the interaction graph is a star, even the Rock-Paper-Scissors protocol requires exponential time to converge. We then study threshold effects exhibited by Lotka-Volterra-type protocols with 3 and more species under interactions between any pair of agents. We start by presenting a simple 4-type protocol in which the probability difference of reaching the two possible absorbing states is strongly amplified by the ratio of the initial populations of the two other types, which are transient, but "control" convergence. We then prove that the Rock-Paper-Scissors protocol reaches each of its three possible absorbing states with almost equal probability, starting from any configuration satisfying some sub-linear lower bound on the initial size of each species. That is, Rock-Paper-Scissors is a realization of a "coin-flip consensus" in a distributed system. Some of our techniques may be of independent value.
cs.DS
cs
On Convergence and Threshold Properties of Discrete Lotka-Volterra Population Protocols Jurek Czyzowicz ∗ Evangelos Kranakis § Leszek Gasieniec † Paul G. Spirakis†¶ Adrian Kosowski ‡ Przemys(cid:32)law Uzna´nski (cid:107) June 26, 2021 Abstract In this work we focus on a natural class of population protocols whose dynamics are modelled by the discrete version of Lotka-Volterra equations. In such protocols, when an agent a of type (species) i interacts with an agent b of type (species) j with a as the initiator, then b's type becomes i with probability Pij. In such an interaction, we think of a as the predator, b as the prey, and the type of the prey is either converted to that of the predator or stays as is. Such protocols capture the dynamics of some opinion spreading models and generalize the well-known Rock-Paper-Scissors discrete dynamics. We consider the pairwise interactions among agents that are scheduled uniformly at random. We start by considering the convergence time and show that any Lotka-Volterra-type protocol on an n-agent population converges to some absorbing state in time polynomial in n, w.h.p., when any pair of agents is allowed to interact. By contrast, when the interaction graph is a star, even the Rock-Paper-Scissors protocol requires exponential time to converge. We then study threshold effects exhibited by Lotka-Volterra-type protocols with 3 and more species under interactions between any pair of agents. We start by presenting a simple 4-type protocol in which the probability difference of reaching the two possible absorbing states is strongly amplified by the ratio of the initial populations of the two other types, which are transient, but "control" convergence. We then prove that the Rock-Paper-Scissors protocol reaches each of its three possible absorbing states with almost equal probability, starting from any configuration satisfying some sub-linear lower bound on the initial size of each species. That is, Rock-Paper-Scissors is a realization of a "coin-flip consensus" in a distributed system. Some of our techniques may be of independent value. 1 Introduction Population protocols are a recent model of computation that captures the way in which the complex behavior of systems (biological, sensor nets, etc.) emerges from the underlying local interactions of agents. Agents are modeled as anonymous automata with a finite number of states, and interactions (changes of state) occur between randomly chosen pairs of agents under some fixed set of local rules. The interaction follows from the mobility of agents in the popula- tion, as in the case of birds flying past each other in a flock in the setting originally described ∗Universit´e du Qu´ebec en Outaouais, Dep. d'Informatique, Gatineau, QC, Canada. †University of Liverpool, Department of Computer Science, Liverpool, UK. ‡Inria Paris and LIAFA, Universit´e Paris Diderot, France. §Carleton University, School of Computer Science, Ottawa, ON, Canada. ¶CTI, Patras, Greece. (cid:107)Helsinki Institute for Information Technology HIIT, Aalto University, Finland. 1 Figure 1: Examples of objective functions for opinion spreading: probability p that a given type becomes dominant in the population as a function of the fraction r of its supporters in the initial population. by Angluin et al. [2, 4]. More generally, we can model agents as nodes of an interaction graph G, and assume interactions take place along the edges of this graph. Population protocols provide a way of describing dynamical effects which may occur in a population. For example, one can imagine that members of a population can be either healthy or infected, and whenever two individuals meet, if one is infected, then the other one also becomes infected. Thus the interesting question becomes: how fast can the infection spread? Quite naturally, population protocols are also used to model opinion spread in populations under interactions. An interaction between a pair of agents, one holding opinion A and the other opinion B, results in a possible change of opinion by one of the interacting agents. Such local interactions result in a change over time of the relative sizes of the options holding opinions A and B. Eventually, the population protocol may lead the system to converge to a state in which one type, A or B, becomes dominant in the population. The probability of convergence to a given dominant type may potentially depend on the initial state of the population in different ways, e.g., exhibiting linear behavior, or transitions at one or more thresholds (cf. Fig. 1). In fact, the ability of population protocols to converge to an opinion presented by at least some threshold ratio of the population (e.g., a majority) lies at the heart of their study (cf. [5, 21]). In this work, we focus on a natural scenario of interactions modeled by the discrete version of Lotka-Volterra equations, with the goal of better understanding their applicability in the computational framework of opinion spreading and voting protocols. In their original form, the (continuous) Lotka-Volterra differential equation were initially applied in the modeling of peri- odic chemical reactions and also in the predator-prey dynamics of fish in the Adriatic Sea [14, p.11], and are perhaps best known for their connection to replicator dynamics and to evolving strategies in game theory [14, 24]. In discrete Lotka-Volterra-type (LV-type) population proto- cols, during an interaction, the initiating agent (holding some state A) tries to impose its state on the other agent (holding some other state B) and succeeds with some probability PAB. The LV-type protocol on k states is fully characterized by its k × k probability matrix P . LV-type interactions are natural both in the context of predator-prey protocols, in that they correspond to a possible expansion of the predating (initiating) agent into the ecological niche of its prey, and in opinion propagation, in that they do not allow a new derived state C to be created as a result of an interaction. Unlike their continuous variant, discrete LV-type protocols always converge to an absorbing state in which no further state changes occur. We study the time until such convergence happens in general, and look at the probability of achieving different absorbing states depending on the initial distribution of states in the population for specific protocols. 2 ppprrr111111½½coin-flip consensusmajoritylinear000 1.1 Our Results We start by proving in Section 2 a general convergence result: any LV-type protocol on a n-agent population converges to some absorbing state in time O(poly(n)), w.h.p., under the model of uniformly random interactions between agents (i.e., when the interaction graph is the complete graph G = Kn). Whereas studies of the behavior of the continuous LV dynamics under artificial stochastic noise of the random walk type have been performed for some particular dynamics in the statistical physics community (cf. [24] for a survey), this is, to the best of our knowledge, the first mathematically rigorous study of the impact of finite populations on the behavior of the dynamics, and the first one to present results which hold for an arbitrary probability matrix P of the protocol. Our proof takes advantage of the structure of the replicator dynamics corresponding to the continuous Lotka-Volterra equations, which admit either stationary orbits in the state space or have a repeller, depending on the parameters of the protocol. By contrast, we also show in Section 2 that introducing an interaction constraint can severely impact the convergence time for LV-type protocol. We consider a specific LV-type protocol known as rock-paper-scissors (RPS), in which each of the three types overcomes exactly one other type in cyclic manner, and show that RPS requires exponential time to converge to an absorbing state when the interaction graph is a star (G = K1,n). Next, we look at the applicability of LV-type protocols in the context of their threshold behavior in voting problems which require a consensus of opinion. For the case of 2 types, the only unbiased LV-type protocol encompasses the so-called "game of life and death" between the 2 types, converging to a given absorbing state with probability proportional to its initial representation in the population (regardless of the interaction graph G). We show, however, that for 3 and more types, threshold effects become apparent even under uniform interactions (G = Kn). We start by proposing in Section 3 a simple 4-type majority-type protocol, in which the probability difference of reaching the two absorbing types is amplified with respect to the ratio of the initial populations of the two other states. We close the paper by exhibiting in Section 4, for the before-mentioned RPS protocol a completely different type of threshold effect in the small population region. We prove that RPS reaches each of its three absorbing types with almost equal probability (1/3± o(1)), starting from any configuration satisfying some sub- linear lower bound on the sizes of the three types. Our proof proceeds by a Martingale-type analysis, which may be of independent interest, and takes into account the symmetries of the state space of the protocol. We can thus view the RPS protocol as an embodiment of the "coin-flip consensus" illustrated in Fig. 1(c): any opinion with non-negligible representation in the population, even a minority one, has an equal chance of success in the opinion-spreading process. To the best of our knowledge, this is the first population protocol with polynomial-time convergence for which such a property has been identified. 1.2 Related Work Population Protocols and Majority Computation. The population protocol model of Angluin et al. [2, 3] captures random interactions between finite-state agents, motivated by applications in sensor mobility. Despite the limited computational capabilities of individual sensors, such protocols permit at least (depending on available extensions to the model) the computation of two important classes of functions: threshold predicates, which decide if the weighted average of types appearing in the population exceeds a certain value, and modulo remainders of similar weighted averages. With respect to threshold behavior, a major problem is the design of majority protocols, which consist in obtaining convergence of all agents of the population to a type initially represented by the majority of agents. Such a protocol, converging to a population of a single type, was first proposed in [3]. Given the complete interaction graph, 3 √ the type reached by the protocol is the initial majority type, w.h.p., provided that the initial difference between the majority and minority type is ω( n log n) for a n-agent population. This protocol relies on 3 types, two of which represent the original types present in the population, while the third is a transient type representing a blank opinion. A 4-state protocol for finding a majority is presented in [5], based on a different principle of "leader" and "follower" agents, and achieves similar performance guarantees. By contrast, [20] presented the first protocol which converges to the initial majority type with probability 1, even when the difference between types in the original population is constant. This protocol makes use of 4 states and finds a majority in expected polynomial time, even in the case when interactions are not spread uniformly over the population, but restricted to a connected subgraph of agent pairs. (We remark that none of the mentioned majority protocols belongs to the LV-type considered in this paper, in particular, due to the creation of transient states which do not exist in the initial population.) Other applications and models of population protocols are surveyed in [5, 17, 21]. Spreading of opinion and voting. The spread of trust and opinion in a social network was one of the original motivations for the study of population protocols [11]. Problems in which a set of nodes has to converge to a consensus decision chosen from a candidate set of values pro- posed by the participating nodes, are also of fundamental importance in distributed computing, in tasks such as serialization of database operations or leader election [13]. Models of voting processes, which solve such questions, involve the propagation of opinion through multiple push- or pull-operations between pairs of agents, usually performed in parallel throughout the system. From the perspective of security and simplicity of design, a desirable property of the protocols is that at any time during the execution, the state of the node should describe its current opinion, belonging to the set of opinions initially represented in the population. Under this constraint, given a set of only 2 initial opinions, it is impossible to obtain convergence to the majority opinion w.h.p. of correctness in the standard model of voting (cf. e.g. [8]). However, majority voting can be achieved in many graph classes by extensions of the population protocol frame- work, allowing simultaneous interactions between more than 2 nodes. Specifically, protocols in which a node polls a constant number k of randomly chosen neighbors in the interaction graph and changes its opinion as the majority opinion in the chosen neighborhood set, have been considered in the literature. The number of required interactions until convergence is achieved is shown to be O(n log n) for the complete interaction graph (both under sequential and parallel pull actions of nodes [6, 9]), O(n log n) for random regular interaction graphs when k = 2 (under parallel pull actions of nodes [8]) and O(n log log n) for Erdos-R´enyi random interaction graphs when k = 5 (under additional constraints on the initial placement of opinions [1]). Our work is also related to the voting model of DeGroot [10], in which opinions spread through the network due to weighted interactions between agents. However, the DeGroot model associates weights of influence with particular agents, rather than with the opinions they hold, and consequently the obtained equations for propagation of opinion are inherently linear. Discrete Lotka-Volterra dynamics and cyclic games. The continuous Lotka-Volterra dynamics, first defined in [19], give rise to several discrete variants of so-called predator-prey models of interaction in a population, which differ essentially in the way the population size is maintained after the prey is attacked by the predator. Such models studied in the literature include the discrete May-Leonard model, in which the attacked agent (prey) disappears from the system, leaving behind a special state representing an empty niche, which can be later filled by another species, as well as the LV-type discrete dynamics studied in this work, in which the niche left by the prey is immediately filled by the species of the predator (cf. [24] for further generalizations of the framework). The LV-type model is particularly worthy of study due to 4 its transient stability in a setting in which several species are in a cyclic predator-prey relation. Cyclic LV-type protocols have been consequently identified as a potential mechanism for de- scribing and maintaining biodiversity, e.g., in bacterial colonies [15, 16]. Cycles of length 3, in which type 1 attacks type 2, type 2 attacks type 3, and type 3 attacks type 1, form the basis of the best-known protocol, called rock-paper-scissors (RPS). The transient properties of RPS and related protocols, describing in particular the time until the system collapses to an absorbing state, have been studied in the statistical physics literature using a variety of experimental and analytical techniques (mostly based on approximation with physical equations), under various scheduler models: the standard model of sequentially occurring random interactions, models with Θ(n) parallel encounters, models in which the discrete process is described by adding stochastic noise to a continuous-time process, etc. The original analytical estimation method applied to RPS was based on approximation with the Fokker-Planck equation [23]. A subse- quent analysis of cyclic 3- and 4-species models using Khasminskii stochastic averaging can be found in [12], together with a general discussion of the classification of dynamics according to convergence speed. A mean field approximation-based analysis of RPS was performed in [22]. All of these results provide a qualitative understanding of cyclic protocols, and at a quanti- tative level, provide evidence that the RPS protocol reaches an absorbing state after roughly O(n2) interactions. Finally, we remark that in a computer science setting, [7] made the connec- tion between the Lotka-Volterra equations and (computational) population protocols, defining the class of so-called Linear Viral Protocols, in which the capacity of agents to participate in interactions changes over time. 1.3 Model and Preliminaries We consider population protocols in the following setting. The population V with k types (species) is a set of n agents, with each agent v ∈ V assigned a state variable s, whose value at time t is denoted st(v) ∈ {1, . . . , k} ≡ [k], describing its current type. The elements of V are connected into an (undirected, connected) interaction graph G = (V, E). Agents assigned to type i at time t, 1 ≤ i ≤ k, are called the population of type i at time t. The population protocol P is a probability distribution over [k]2, taking values in [k]2. In an execution of protocol P , at each time step t = 1, 2, 3, . . ., a scheduler daemon picks a pair of interacting agents u, v ∈ V such that (u, v) ∈ E u.a.r., and updates the state variables of these agents, sampling the pair (st+1(u), st+1(v)) according to the distribution P (st(u), st(v)). We will say that the population protocol is of the Lotka-Volterra type (LV-type for short) if the state of the initiating agent (the predator) never changes during an interaction, and the state of the other agent (the prey) either remains unchanged or changes to that of the initiator, i.e., for any transition which occurs with non-zero probability, we have st+1(u) = st(u) and st+1(v) ∈ {st(u), st(v)}. For i ∈ [k] and a fixed execution of protocol P , we will denote the size of the i-th population as ni(t) = {v ∈ V : st(v) = i}, and its relative size as xi(t) = ni(t)/n. The set of states of all n agents at time t is referred to as the state or configuration of the system. When the interaction graph is the complete graph Kn, then we identify the state of the system with the vector x(t). For G = Kn, the protocol P defines a Markov chain on the set X of possible states x(t). We note that in this case, the size of the state space can be trivially bounded as O(nk), i.e., is polynomial in n for any fixed protocol. In the sequel, any LV-type protocol P will be identified with its k × k probability matrix P , such that for an interaction (u, v), we have st+1(v) = st(u) with probability Pst(u),st(v), and (Informally, we may write: "ij → ii with st+1(v) = st(v) with probability 1 − Pst(u),st(v). probability Pij".) In general, matrix P need not be skew-symmetric nor stochastic. We only 5 assume that Pii = 0, for 1 ≤ i ≤ k, and that every type interacts in some way with at least one other type (for every i, 1 ≤ i ≤ k, there exists j, 1 ≤ i ≤ k, such that Pij > 0 or Pji > 0). We will denote the value of the minimal non-zero entry of matrix P as Pmin. For every LV-type protocol, we construct the corresponding digraph (cid:126)D(P ), whose vertex set is the set of types [k], and an arc (i, j) exists if Pi,j > 0. We call the dynamics irreducible if the digraph (cid:126)D(P ) has no sources (i.e., there are no types without a predator, so each column of matrix P has at least one non-zero entry) and is connected. We remark that as n → ∞, our random process converges to its (deterministic) limit con- tinuous dynamics, given by the following set of first-order differential equations (a special case of the continuous Lotka-Volterra equations): k(cid:88) j=1 dxi(t) dt = xi(t) [(Pij − Pji)xj(t)] , for 1 ≤ i ≤ k. (1) The above dynamics is non-linear and exhibits non-trivial properties in terms of limit behavior and stability measures such as the Lyapunov exponent (cf. [14]). Our discrete population case with finite n can be informally seen as a special form of "noise" introduced into the Lotka- Volterra equation (1). In this paper, we also give our attention to two specific LV-type protocols: • Rock-Paper-Scissors (RPS) is the LV-type protocol with k = 3 types (denoted 1, 2, 3), whose probability matrix P has the following non-zero entries: P12 = P23 = P31 = 1. • Wolves-and-Sheep (WS) is the LV-type protocol with k = 4 types (denoted X, Y, x, y), whose probability matrix P has the following non-zero entries: PXY = PXx = PY X = PY y = 1, PXy = PY x = 1/2. Throughout the paper, we use the term "with very high probability" (w.v.h.p.) to denote events occurring with probability at least 1 − e−Ω(log2 n) and the term "with high probability" (w.h.p.) for events occurring with probability at least 1 − n−Ω(1). Thus, polynomially (resp., logarithmically) many events which individually hold w.v.h.p. (w.h.p.) also hold jointly w.v.h.p. (w.h.p.) by virtue of the union bound. In time and distance analysis, we will use the notation (cid:101)O and (cid:101)Ω to conceal poly-logarithmic factors ((cid:101)O(f ) = O(f polylog(n)), (cid:101)Ω(f ) = Ω(f /polylog(n))). 2 Convergence of Discrete LV-type Protocols For any LV-type protocol, there exists a subset Xs ⊆ X of stationary absorbing states, which remain unchanged under transformation P (for any x ∈ Xs, applying any transformation gov- erned by protocol P to x preserves x). Note that for any state x ∈ X \ Xs, there exists an execution of the system which reaches some absorbing state in a finite number of steps with strictly positive probability. 2.1 Bound on Convergence Time under Complete Interactions We start by showing that any LV-type protocol on a population of size n converges to an absorbing state in time O(poly(n)), when there are no population constraints (the interaction graph is Kn). Theorem 2.1 (LV-type convergence for complete interactions). For any probability matrix P , there exists a constant c such that the LV-type protocol defined by P converges for the complete interaction graph to an absorbing state in O(nc) steps, w.v.h.p. 6 Before proceeding with the proof, we introduce some auxiliary notation. For a fixed matrix P , we define the skew-symmetric nett interaction matrix A as A = P − P T . Observe that Aij = Pij − Pji and equation (1) describing the continuous dynamics now takes the simpler form: = xi(Aix), (2) or in vector notation: dxi dt dx dt = x (cid:12) (Ax), k(cid:88) i=1 U (x) = bi ln xi, where we treat x as a column vector, and Ai is the i-th row vector of matrix A, and (cid:12) denotes the element-by-element product of two column vectors (cf. [14, Chapter 7] for a more detailed exposition of the properties of this continuous dynamics). For a fixed real vector b ∈ Rk, which we will appropriately choose later, we define the potential U of a system state x as (compare [14, equation (5.3)]): and by U (t) we will mean U (x(t)). Observe that under evolution of the system given by the continuous dynamics (2), we have: k(cid:88) i=1 dU dt = bi 1 xi dxi dt = k(cid:88) (cid:32)(cid:32) k(cid:88) k(cid:88) (cid:33) (cid:33) bi(Aix) = biAij xj = bT Ax. i=1 j=1 i=1 We define vector b as follows: (i) if there exists a non-zero vector b ≥ 0, such that bT A = 0, choose b as any such vector with (cid:107)b(cid:107)∞ = 1. (ii) otherwise, choose b as any vector satisfying bT A > 0, with (cid:107)b(cid:107)∞ = 1. The completeness of the above definition follows from a basic theorem of linear optimiza- tion, known as the "no arbitrage theorem" in financial mathematics (cf. also [14, proof of Thm. 5.2.1])1. Proof of Theorem 2.1. Observe that by the definition of the LV-type process, if a certain type i has been eliminated by time t (xi(t) = 0), then it will never reappear (xi(τ ) = 0, for all τ ≥ t). We will now show that the number of non-zero values of xi, 1 ≤ i ≤ k, is reduced by at least one within a polynomial number of steps, w.h.p. Note that this is sufficient to obtain the claim of the theorem, since we may iterate the argument, each time restricting the definition of the dynamics and the matrix A to those of the k types which are non-empty. In the rest of the proof, we will be assuming w.l.o.g. that xi > 0, for all i. We will also be assuming that the dynamics is irreducible; otherwise, if digraph (cid:126)D(P ) is disconnected, we can consider each of the weakly connected components separately, and if any of the weakly connected components has a source, then one can easily show that all the prey of this source is eliminated in a polynomial number of steps. 1For completeness, we provide a short version of the argument. If (i) does not hold, then the non-negative cone Rk≥0 intersects with the kernel ker AT only at point 0. It follows that there must exist a strictly positive vector h ∈ Rk + orthogonal to the kernel, h ⊥ ker(AT ). Since the orthogonal complement of ker(AT ) is the column space of matrix A, which is equal to the row space of A (since A = −AT ), the equation bT A = h admits a solution b, and it is possible to satisfy condition (ii). 7 The main part of the proof is contained in the following claim. Claim. For any irreducible LV-type protocol, there exists a constant nmin, such that for any n > 0, for any initialization of the protocol with n agents, w.v.h.p. there exists a time step T ∈ O(poly(n)) in which ni(T ) < nmin, for some type i, 1 ≤ i ≤ k. Proof (of claim). For any t > 0, we consider the random variable δ representing the change of the value of the potential function U between time steps t and t + 1: δ(t) = U (t + 1) − U (t). (3) We start by remarking that in a single time step, the change of potential is restricted to a single interaction between some pair (i, j), and thus bounded by the following expression when ni ≥ nmin, for all 1 ≤ i ≤ k: δ(t) ≤ max 1≤i,j≤k (cid:19)(cid:12)(cid:12)(cid:12)(cid:12) < (cid:12)(cid:12)(cid:12)(cid:12)bi nj − 1 − ln − ln (cid:18) (cid:19) (cid:18) nj n + bj ln n ln ni + 1 ni n ln(ni) − ln(ni − 1) < n <2 max 1≤i≤k 4 nmin . (4) Since the probability of the interaction of the form (i, j) in the (t + 1)-st step is ninj n2 , and this interaction increases ni by 1 and decreases nj by 1 with probability Pij, the expectation Eδ(t) takes the form: (cid:18) (cid:18) (cid:19) (cid:18) ninj n2 Pij bi ln ni + 1 n − ln ni n + bj ln nj − 1 n − ln nj n (cid:19)(cid:19) = k(cid:88) k(cid:88) k(cid:88) k(cid:88) j=1 i=1 1 n2 i=1 j=1 Eδ(t) = = bininj (Pij (ln(ni + 1) − ln(ni)) + Pji (ln(ni − 1) − ln(ni))) . We now introduce the following notation for Taylor series remainders in the expansion with 2x2 (1 + r−(x) respect to 1/x: ln(x + 1)− ln(x) = 1 ), where 0 ≤ r+(x) ≤ 2/3 and 0 ≤ r−(x) ≤ 2/3, for every x > 1. Next, we obtain after elementary (cid:19)(cid:19) transformations: ) and ln(x)− ln(x− 1) = 1 x + 1 (cid:18) (cid:19) x x 1 − r+(ni) Pij + Pji 1 + r−(ni) ni 2x2 (1− r+(x) x − 1 (cid:18) k(cid:88) k(cid:88) (cid:19) (cid:18) nj ni j=1 i=1 1 − r+(ni) bi Pij ni (cid:18) biAijnj − 1 2n2 Aij − 1 2ni (cid:18) (cid:19)(cid:19)(cid:19) (cid:18) ni r−(ni) ni k(cid:88) k(cid:88) i=1 1 n2 k(cid:88) (cid:18) j=1 binj k(cid:88) i=1 j=1 Eδ(t) = = 1 n2 + Pji 1 + . (5) We now use (5) to bound the expectation Eδ(t) depending on whether condition (i) or (ii) is satisfied by vector b. (cid:80)k • Case (i): Let bi ≥ 0 for all 1 ≤ i ≤ k, bT A = 0, and bα = 1 for some α, 1 ≤ α ≤ k. We j=1 biAijnj = 0. Consequently, assuming ni ≥ 2, for all 1 ≤ i ≤ k, we may have(cid:80)k i=1 write: k(cid:88) k(cid:88) k(cid:88) k(cid:88) j=1 i=1 bi i=1 j=1 Eδ(t) = − 1 2n2 ≤ − 1 3n2 (cid:18) Pij bi nj ni (cid:18) 1 − r+(ni) ni (cid:19) (cid:18) (cid:19)(cid:19) 1 + r−(ni) ni (6) + Pji k(cid:88) j=1 nj (Pαj + Pjα) ≤ − Pmin 3n3 . nj ni (Pij + Pji) ≤ − bα 3n2nα 8 Eδ(t) = bi Pij + Pji 1 + hmin hini − k(cid:88) k(cid:88) hminni − k(cid:88) j=1 i=1 1 n2 nj k(cid:88) i=1 j=1 (cid:18) (cid:18) 4 nj 2ni ≥ 1 n2 1 − r+(ni) ni (cid:18) (cid:19) = (cid:19) (cid:18) (cid:18) (cid:19)(cid:19) r−(ni) ni (cid:19) Clearly, Xt =(cid:80)t In the above transformations, we took into account the fact that all bi are non-negative, that 0 ≤ r+(ni), r−(ni) ≤ 2/3 for ni > 1, and that by convention, the nonnegative-valued matrix P has a non-zero entry in every row or corresponding column. We now define a random variable δ(cid:48)(t), given as δ(cid:48)(t) = δ(t) + Pmin in every step of the process where ni ≥ 2, for all 1 ≤ i ≤ k, and set δ(cid:48)(t) = 0 for all other steps of the process. (cid:21) τ =0 δ(cid:48)(τ ) is a super-martingale in t, satisfying the bound Xt − Xt−1 ≤ δ(t) < 2 by (4). By Azuma's inequality, Pr[Xt < Pmin = 1−O(e−n), for any sufficiently large value of t = Ω(n7). Observe, however, that the events "δ(cid:48)(τ ) = δ(τ ) + Pmin 6n3 t" cannot hold simultaneously, since otherwise we have U (0) − U (t + 1) = Pmin 6n3 t = Θ(n4). On the other hand, xi ≥ 1/n and so every potential U (τ ) satisfies: for all τ ≤ t" and "Xt < Pmin 3n3 t − Xt > Pmin 6n3 t] ≥ 1 − exp −(cid:16) Pmin (cid:17)2 6n3 t (cid:20) 1 8t 3n3 3n3 U (τ ) ≤ k ln n = O(ln n), hence such a potential difference is impossible. It follows that the probability that we have ni ≤ 1, for some 1 ≤ i ≤ k, for all except at most Θ(n7) steps of the process, is 1 − O(e−n). • Case (ii): Let h = bT A, with hi ≥ hmin > 0 for all 1 ≤ i ≤ k, and let (cid:107)b(cid:107)∞ = 1. Assuming ni ≥ nmin = max{2, 2k }, for 1 ≤ i ≤ k, we now have: 2nmin 3 + 4 3 hmin n 1 − 4k 3nminhmin ≥ hmin 3n . Similarly as in the case of condition (i), we define a random variable δ(cid:48)(t), given as δ(cid:48)(t) = 0 for all other steps of the process. This time, Xt =(cid:80)t δ(cid:48)(t) = δ(t) − hmin 6n in every step of the process where ni ≥ nmin, for all 1 ≤ i ≤ k, and set τ =0 δ(cid:48)(τ ) is a sub-martingale (cid:17)2 −(cid:16) hmin in t, satisfying the bound Xt− Xt−1 ≤ δ(t) < 4 by (4). Applying Azuma's inequality once again, we obtain Pr[Xt > − hmin 6n t] ≥ 1 − exp = 1 − O(e−n), for a sufficiently large value of t = Θ(n2). By a similar potential difference argument as before, we obtain that the event ni < nmin, for some 1 ≤ i ≤ k, occurs within the first Θ(n2) steps with probability 1 − O(e−n). 1 2(4/n2 min)t 6n t (cid:20) (cid:21) nmin This completes the proof of the claim. To obtain the claim of the theorem, we now need to notice that whenever the population of some type drops below a constant threshold nmin, the probability that the population is eliminated completely within the next O(1) steps of the irreducible protocol is polynomially large in n. Indeed, suppose we have ni(t) ≤ nmin. Then, by the irreducibility of the protocol, there must exist an active predator j of type i, 1 ≤ j ≤ k, with Pji ≥ Pmin and nj ≥ 1 by assumption. The probability that species i is eliminated in the next ni(t) steps can be lower- bounded by the probability of the occurrence of elimination of a representative of population i n2 )nmin = 1/O(n2nmin). Overall, by a representative of population j in each of those steps, ( Pmin after at most O(n2nmin+1) occurrences of the event "there exists 1 ≤ i ≤ k such that ni < nmin", each of which takes place every polynomial number of steps w.v.h.p. by the Claim, one of the species will have been eliminated completely w.v.h.p., which gives the claim of the theorem. 9 We remark that the key property of LV-type protocols (i.e., that prey is changed to the same type as the predator) is essential in guaranteeing the polynomial time of reaching an absorbing state. For example, consider the following (non-LV) population protocol on 3 types a,b, and c: {ab → ac, ac → aa, ca → cb, ba → bb, bb → ba}, where all the transitions occur with probability 1. This protocol always preserves the type of the predator, but sometimes sets the third type as the type of the prey. For this protocol, for any initialization such that na(0) = Ω(n), nb(0) = Ω(n), the expected time to reach an absorbing state is exponential in n. 2.2 Rock-Paper-Scissors with the Star Interaction Graph It turns out that for LV-type protocols, the convergence time may become exponential when the interaction graph is not complete. Whereas all LV-type protocols with 2 species (e.g., the game of life-and-death [14]) converge in polynomial time to an absorbing state for any interaction graph, this is no longer true when the number of species is at least 3. We observe this for the rock-paper-scissors (RPS) protocol on the star.  0 1 0 0 0 1 1 0 0 . Definition 2.1. The Rock-Paper-Scissors (RPS) protocol is the LV-type protocol with k = 3 populations, given by the following matrix: P = Theorem 2.2 (RPS convergence on the star). The RPS protocol with a K1,n interaction graph, initialized so that initially each type has at least nmin ≥ n/3−n/200 agents, reaches the absorbing state in expected time Tabs ≥ enΩ(1). Proof. In this section we will fix G = (V, E) as a star on n + 1 vertices, or equivalently full bipartite graph K1,n: V = {0, 1, . . . , n}, E = {(0, 1), (0, 2), . . . , (0, n)}. Full state of the system is encoded by a quadruple St = (st(0), n1(t), n2(t), n3(t)) (for clarity of notation, we do not count the state of a middle vertex towards any of ni(t)). Thus, the transition probabilities of system are given as follow (assuming st(0) = 1 w.l.o.g.): St+1 =(st+1(0), n1(t + 1), n2(t + 1), n3(t + 1)) = (1, n1(t), n2(t), n3(t)) with probability n1(t) n (1, n1(t) + 1, n2(t) − 1, n3(t)) with probability n2(t) n with probability n3(t) (3, n1(t), n2(t), n3(t)) n = We define a sequence of timesteps of RPS process, that marks changes of st(0). More specifically, we define a sequence of timesteps, where t0 = 0, and ti+1 is the smallest value larger than ti such that sti+1(0) (cid:54)= sti(0). Let us denote by d(t) = nmax(t) − nmin(t) the difference between largest and smallest of the Let T be an arbitrary timestep such that U (T ) ≤ 0.037025·n3, while U (T−1) ≥ 0.037025·n3. population. We denote the potential U (t) = n1(t)n2(t)n3(t). Since min x∈[−1/300,1/300] (1/3 + x)(1/3 − 1/200 − x/2)(1/3 − 1/200 + x/2) ≥ 0.037025 then d(T ) ≥ n/100. ti = T < ti+1 < ... < ti+∆i ≤ T + ∆T . Let ∆T = n/1000. Thus, for any t ∈ [T, T + ∆T ], d(t) ∈ [ 8 1000 n, 12 1000 n]. Thus we denote 10 With probability at least (1 − e−nΩ(1)) we have tj+1 − tj ≤ n0.1. Thus below we assume this bound on length of this gap, and at the end of this analysis we will have to acknowledge the failure probability of e−nΩ(1). Thus, ∆i ≥ n0.9. Let us take arbitrary tj such that T ≤ tj ≤ tj+3 ≤ T + ∆T . W.l.o.g. we can assume that Stj = 1. Denote ∆1 = tj+1 − tj, ∆2 = tj+2 − tj+1 and ∆3 = tj+3. Thus, the state at tj+3 fulfills: (n1(tj+3), n2(tj+3), n3(tj+3)) = (n1(tj), n2(tj), n3(tj)) + (∆1 − ∆2, ∆3 − ∆1, ∆2 − ∆3), where: E[∆1Stj ] = λ1 E[∆2Stj ] = λ2 E[∆3Stj ] = λ3 n2(tj) n3(tj) n1(tj) n2(tj) n3(tj) n1(tj) λ1, λ2, λ3 ∈ [1 − O(n−0.9), 1 + O(n−0.9)] We can bound the expected potential change: E[U (tj+3) − U (tj)Stj ] = λ2n1(tj)2 − λ3n2(tj)n3(tj) + λ3n3(tj)2− − λ1n1(tj)n2(tj) + λ1n2(tj)2 − λ2n1(tj)n3(tj) + R(tj) (7) where R(tj) = n1(tj)E[(∆3 − ∆1)(∆2 − ∆3)Stj ] + n2(tj)E[(∆1 − ∆2)(∆2 − ∆3)Stj ]+ + n3(tj)E[(∆1 − ∆2)(∆3 − ∆1)Stj ] + E[(∆1 − ∆2)(∆3 − ∆1)(∆2 − ∆3)Stj ] and satisfies Lemma 2.3. R(tj) = O(n). E[U (tj+3) − U (tj)Stj ] ≥ 1 2 d(tj)2(1 − O(n−0.9)) Proof. Let us denote: (cid:126)u = (λ2n1(tj), λ1n2(tj), λ3n3(tj)), (cid:126)v = (n1(tj), n2(tj), n3(tj)), (cid:126)w = (n3(tj), n1(tj), n2(tj)). We can rewrite (7) to: E[U (tj+3) − U (tj)Stj ] = (cid:126)u ◦ ((cid:126)v − (cid:126)w) + R(tj). We denote (cid:93)((cid:126)u, (cid:126)v) = ε, (cid:93)((cid:126)v − (cid:126)w, (cid:126)v) = α and (cid:93)((cid:126)v − (cid:126)w, (cid:126)u) = α(cid:48). Observe, that (cid:126)u − (cid:126)v ≤ O(n−0.9)(cid:126)v. Thus, from sin(ε) ≤ (cid:126)u−(cid:126)v (cid:126)v Observe, that (cid:126)v = (cid:126)w and that (cid:126)v − (cid:126)w = Θ(d(tj)), thus (cid:126)v − (cid:126)w cos α = sin( (cid:93)((cid:126)v, (cid:126)w)) = 1/2 , we have ε = O(n−0.9). 1 2 (cid:126)v = Θ(1) Thus, since: (cid:126)v ◦ ((cid:126)v − (cid:126)w) = 1 2 ((n1(tj) − n2(tj))2 + (n2(tj) − n3(tj))2 + (n3(tj) − n1(tj))2), 11 we can bound: (cid:126)u ◦ ((cid:126)v − (cid:126)w) = (cid:126)u(cid:126)v − (cid:126)w cos α(cid:48) = ((cid:126)v ◦ ((cid:126)v − (cid:126)w)) (cid:126)u (cid:126)v cos α(cid:48) cos α ≥ ≥ 1 2 1 2 = cos(α + ε) d(tj)2(1 − O(n−0.9)) d(tj)2(1 − O(n−0.9))(1 − O(n−0.9)2 − Θ(1) · O(n−0.9)) = d(tj)2(1 − O(n−0.9))(cos ε − tan α sin ε) = d(tj)2(1 − O(n−0.9)) cos α = 1 2 1 2 which, since R(tj) = O(n), gives the desired claim. We also observe following bound on potential change: U (tj+3) − U (tj) ≤ 3 · n0.1 · O(n) · O(n) = O(n2.1) We define a following submartingale: W(i) = U (t3i) − i · 1 2 · 1 1252 n2 · (1 − O(n−0.9)) (being submartingale follows from application of Lemma 2.3 and observation that d(tj) ≥ 1 125 n). By application of Azuma's inequality: P (W(0) − W( 1 3 ∆i)) ≥ Θ(n2.75)) ≤ e − Θ(n5.5) ∆i·O(n4.2) = e−Ω(n0.3) which is equivalent to saying, that w.v.h.p.: U (t∆i) ≥ U (t0) − Θ(n2.75) + ∆i · Θ(n2)(1 − O(n−0.9)) > U (t0). Thus, taking into account original e−nΩ(1) probability of failure, we get a following: for any timestep T such that U (T ) falls below particular threshold, there exists w.v.h.p. a timestep T (cid:48) > T such that U (T (cid:48)) > U (T ). Thus the expected time to reach the absorbing state (which requires U = 0) is at least enΩ(1). 3 The Wolves-and-Sheep (WS) Protocol In this section, we investigate the dynamics of the Wolves-and-Sheep LV-type protocol, aiming at replicating dynamics of infection spreading for two different infections and two types of partial immunity to infections. Definition 3.1. The Wolves-and-Sheep (WS) protocol is the LV-type protocol with k = 4  0 1 1 0 0 0 0 0  1 1 2 0 0 1 2 1 0 0 populations (denoted X, Y, x, y), given by the following matrix: P = In the considered setting, initially almost all the population consists of types x and y (sus- ceptible agents known as "sheep"). A constant number of infected agents of types X and Y (the "wolves") are introduced into the population. Following the definition of the protocol, a wolf acting as a predator infects a sheep of a type denoted by the same lower-case with probability 1, and a sheep of the opposite lower-case type with smaller probability (1/2). Thus, in the protocol, population x of sheep has affinity towards X (or resistance for Y ), and population y has affinity towards Y (or resistance for X). 12 A real-world setting for such a protocol is the following. Initially, a population of users has smartphones of two different manufacturers (say, xPhones and yPhones). Simultaneously, each of the manufacturers introduces a new smartphone model into the market. Upon meet- ing someone with a new phone, a user will be convinced to upgrade to this model with some probability, which is higher if they are already a user of the older product of the same manufac- turer. How will the balance of market share of the two manufacturers change after the whole market has adopted the new phone? It turns out that the market share of the new products grows exponentially in time, until almost all users have upgraded. However, the growth rate for the manufacturer with the initially (slightly) larger market share is larger, hence eventually, it dominates almost all of the market. We note that in the definition of the WS protocol, we also add some random drift between the species X and Y , which does not affect the nature of the process, but allows us to achieve an absorbing state in which eventually only the dominant type is represented. Theorem 3.1 (majority amplification by WS). Let nX (0) = 1, nY (0) = 1, nx(0) = Θ(n) and ny(0) = Θ(n), such that nx(0) 1−ε for some absolute constant ε > 0. Then the system reaches the absorbing state with only population X, w.h.p. ny(0) = 1+ε Proof. We will divide the analysis into three consecutive phases. Phase I. In the first steps of the process, we experience rather random behavior due to the small populations of the wolves. Whereas we would like to show that nX (t) (cid:29) nY (t), this may initially not be the case: after cn steps, for c (cid:28) log n, with probability roughly e−c we still have nX (t) = 1, while nY (t) satisfies exponential growth and in expectation we have EnY (t) = 2Ω(c). However, we can bound this behavior, showing that at some time tf = Θ(n log n), population X has grown to nX (tf ) = Ω(log n), while nY (tf ) is bounded by a small polynomial of n, w.h.p. Specifically, in Phase I we run the process for f = log2(α ln n) − 4 iterations, with the i-th iteration, i = 1, 2, . . . , f starting at time ti−1 and ending at time ti (we assume t0 = 0). The duration of the i-th iteration is δti = ti − ti−1 = αn ln n time steps, with α = 0.01ε. 2i Y (t) given by the dependence: n(cid:48) We start by upper-bounding the size of population nY (tf ) at the end of the phase; note that tf < 2αn ln n. We can trivially dominate the growth process for nY (t) by a simpler unbounded growth process n(cid:48) and Y (t), otherwise. For any c1 log2 n < s < log2 n − 1, where c1 > 0 is an arbitrarily Y (t + 1) = n(cid:48) n(cid:48) small positive absolute constant, by an application of Chernoff bounds for the negative binomial distribution, we can lower-bound the length of the time interval during which n(cid:48) Y grows from 2s to 2s+1 as at least n/4, with probability 1 − n−Ω(1). Thus, we have at time tf : Y (t) + 1 with probability n(cid:48) Y (t + 1) = n(cid:48) Y (t) n nY (tf ) ≤ n(cid:48) Y (tf ) ≤ 2c1 log2 n2 tf n/4 < nc1+8α < n10α, w.h.p, for a suitably chosen value of c1. Likewise, we can show that nX (t) < n10α and nY (t) < n10α for all t ≤ tf , w.h.p. n n10α n10α n ) = (cid:101)O(n−1+20α), thus we can assume that no such interaction occurs during Phase Next, conditioned on the above events, we lower-bound the size of nX (tf ), considering the value nX (ti) at the end of each iteration. Note that the probability of an interaction between an individual from X and an individual from Y during Phase I can be upper-bounded as O(tf I, w.h.p. We now prove by induction that in each of the f iterations of the phase, the value of nX increases by a multiplicative factor of 2, w.h.p. By the inductive assumption, fix 1 ≤ i ≤ f and let nX (ti−1) ≥ 2i−1. Since we have throughout the i-th iteration that nX (t) < n10α and nY (t) < n10α, it follows that nx(t) + ny(t) ≥ 1 − n20α > 1 2 . Thus, process nX during our i-th X , such that nX (ti−1) = 2i−1 and nX (t+1) = nX (t)+1 iteration dominates the growth process n(cid:48) 13 with probability 2i−1 X (t), otherwise. Once again, applying the Chernoff bound for the negative binomial distribution, we can upper-bound w.h.p. the length of the time interval τi during which n(cid:48) X grows from 2i−1 to 2i as: X (t + 1) = n(cid:48) 4n and n(cid:48) τi ≤ 4n 2i−1 (c2 ln n + 2(2i − 2i−1)) = 2i (8c2)n ln n + 8n ≤ (8c2 + α/2)n ln n < 2i αn ln n 2i = δti, where the first inequality holds with probability 1 − nΩ(1) for any arbitrarily small absolute In this way, we constant c2 > 0, and the last inequality holds when we choose c2 < α/16. have obtained the inductive claim, and overall, we have nX (tf ) ≥ 2f > α 16 ln n, w.h.p. By an analogous analysis, we obtain nY (tf ) ≥ 2f > α 16 ln n, w.h.p. In the second phase, we start with populations of wolves α 16 ln n < nX (tf ) < n10α Phase II. and α 16 ln n < nY (tf ) < n10α. We will show that both populations now experience exponential growth, but with a larger growth rate for population X. By the time the total population of wolves has grown to a level of Θ(n/ log n), we have that nX asymptotically outgrows nY . log n or nY (T ) = n log n , i.e., nX (T ) = n Let T be the first time step such that at least one of the populations of wolves exceeds the threshold n log n . Starting from time step tf , we will divide time into intervals of duration βn, where β > 0 is a sufficiently small positive constant (we put β = ε 128 ). We will now obtain w.h.p. bounds on the growth rate of the two processes during each such time interval, until time T . (Since the population of wolves treated as a whole undergoes exponential growth, we have T = O(n log n) w.h.p., thus we will need to perform union bounds on only a small number of events associated with the O(log n) time intervals until time T .) Now, fix a time interval It = [t, t + βn], for tf ≤ t ≤ T . Within this interval, we construct an undirected graph Gt = (V, Et), where V is the population, and Et is the set of all pairs of agents {i, j}, such that there exists an interaction between i and j during interval It. We observe that Gt ∼ G(cid:48)(n, m) where G(cid:48)(n, m) is a variant of the Erdos-R´enyi random graph model where we choose m = βn edges uniformly at random, discarding repeated edges. This corresponds to an n . For i ≥ 1, let V = S≤2 ∪ S>2, where S≤2 and ∪S>2 average edge density of approximately 2β are subsets of agents belonging to connected components of Gt having at most 2 vertices and (cid:19)n−1 more than 2 vertices, respectively. By performing a random graph analysis, we have w.h.p.: (cid:19)(cid:33) (cid:32)(cid:18) (cid:19)2n−3(cid:18)n (cid:18) S≤2 ≥(1 − o(1)) 1 − 2β n n + 2 2β n 1 − 2β n ≥ 2 ≥(1 − 2β)n + 2βn(1 − 4β) ≥ n − 8β2n. Thus, we have S>2 < 8β2n, w.h.p. Denoting by Y>2 = S>2 ∩ Y (t), by independence of choice of sets S>2 and Y (t) and a simple Chernoff bound, we obtain Y>2 < 16β2nY (t), w.h.p. We will upper bound the size of set Y (t + βn) as follows: nY (t + βn) ≤ nY (t) + ∆Y [t, t + βn] + Y>2, where ∆Y [t, t + βn] is the number of individuals which joined Y as a result of interactions having individuals from set Y (t) as the initiator in the time interval [t, t + βn]. The number of considered interactions can be upper-bounded as (1+c3)βnY (t), for an arbitrarily small positive constant c3 > 0, w.h.p. In each interaction involving an element of set Y (t), the current size of Y increases by 1 if the interaction involves an element from y, and remains unchanged otherwise. We can thus upper-bound the value ∆Y [t, t + βn] through stochastic domination, 0 = 0 and increasing Y (cid:48) by 1 with running a process Y (cid:48) for (1 + c3)βnY (t) steps, starting from Y (cid:48) probability pY in each step, where: (cid:19) (cid:18) 1 2 pY = − ε + 1 2 − ε ≤ 3 4 − ε 2 . (cid:19) (cid:18) 1 2 14 Applying another simple Chernoff bound, we eventually obtain w.h.p.: (cid:18) 3 4 (cid:19) (cid:19) − ε 2 (cid:19) (cid:18) 3 4 (cid:19) − ε 4 (cid:18) 3 − ε 8 4 (cid:18) βnY (t), (cid:19) (cid:19) β nY (t). (8) ∆Y [t, t + βn] ≤(1 + c3)βnY (t) · (1 + c3)pY ≤ βnY (t) ≤ ≤(1 + 3c3) for sufficiently small choice of constant c3. Overall, we have w.h.p. nY (t + βn) ≤ 1 + + 16β β nY (t) ≤ 1 + (cid:18) (cid:18) 3 4 − ε 4 Now, we lower-bound the rate of growth of nX in the time interval [t, t + βn]. Since we have nY ≤ n log n throughout the considered interval, the number of interactions in the time interval [t, t + βn] having an element from X(t) as the prey can be upper-bounded as c4 ln n, w.h.p., for an arbitrarily small positive constant c4 > 0. We denote by X∗(t) the subsect of individuals from X(t) which do not become prey during the considered time interval; we have X∗(t) ≥ nX (t)− c4 ln n ≥ (1− 16c4 α )nX (t), for a suitable choice of constant c4. Now, we lower-bound the number of interactions involving an individual from X∗ as the initiator during the time interval [t, t + βn] as (1 − c5)βX∗(t), w.h.p., for an arbitrarily small constant c5 > 0. Since we have nx ≥ (1 + ε) n log n throughout the considered Phase II of the process, it follows that the probability of increasing nX by 1 in a step in which an element from X∗ is the initiator is at least: (cid:18) 1 (cid:1) X∗(t), w.h.p., for an arbitrarily small positive constant c6 > 0. Of these log n and ny ≥ (1− ε) n 2 − 2n (cid:19) Overall, we get that the number of new elements joining X in time interval [t, t + βn] is at least (1 − c6)β(cid:0) 3 − ε − 2 log n + ε − 2 log n − 3 log n 2 − 2n (cid:18) 1 ≥ 3 4 (cid:19) pX = 1 2 ε 2 + + 2 2 . 4 + ε 2 elements, we likewise have that (an arbitrarily small) constant proportion will be lost due to interactions initiated by Y within the interval [t, t + βn], whereas the remaining ones will belong to X(t + βn). Overall, we obtain w.h.p.: nX (t + βn) ≥ X∗(t) + (1 − c7)β X∗(t) ≥ (cid:18) 3 (cid:19) + (cid:19)(cid:19)(cid:18) (cid:18) 3 4 + ε 2 4 1 − 16c4 α (cid:19) ε 2 nX (t) ≥ (cid:18) (cid:19) (cid:19) (cid:18) 3 4 + 3ε 8 1 + β nX (t) (9) (cid:18) 1 + (1 − c7)β for some suitable choice of arbitrarily small positive constant c7 > 0 and of c4. Equations (8) and (9) provide a separation of the growth rates of processes X and Y . Observe, that for small enough β, we have (since 3/4+ε3/8 3/4−ε/8 < 1 + 2 3 ε): (cid:18) nY (t + βn) (cid:19)1+ 2 3 ε . nY (t) nX (t + βn) nX (t) ≥ Thus, we eventually obtain at the end of Phase II, w.h.p.: nX (T ) = n 10 ) for ε ≤ 1. O(n0.1ε+1/(1+2/3ε)) = O(n1−ε 3 Phase III. We are now in a situation that, w.h.p., in some timestep T0, nX (T0) ≥ n log n , 4 ≤ κ < 1. We can safely assume, that nY (T0) = Θ(nκ), nY (T0) = O(nκ) for some constant 3 since by a simple coupling argument, swapping some of x and y for Y cannot help with reaching absorbing state of only X. log n , nY (T ) = We will analyse the speed of growth of both nX (t) and nY (t). 15 Claim 3.2. There is increasing sequence of steps T0, T1, T2, . . . , Tj such that Tj is the first ele- ment of this sequence satisfying nx(Tj) + ny(Tj) < n3/4, such that, w.h.p.: nY (Ti) nY (T0) ≤(cid:16) nX (Ti) and that nX (Ti) = (cid:101)Θ(nX (T0)). (cid:101)Θ(nY (T0)) = (cid:101)Θ(nκ), and that nx(Ti) + ny(Ti) = Ω(n3/4). We pick as Ti+1 a timestep such 2 − o(1))n−1/4 there is Proof. We proceed by induction on i: We assume we have a moment Ti ≥ T0. From the inductive assumption: nY (Ti) = that in timesteps {Ti, . . . , Ti+1} there are nY (Ti)) events of X or Y attacking x or y. (cid:17)12 Since nx(t) + ny(t) ≥ 1 2 n3/4, at each step with probability at least ( 1 attack of X or Y on x or y. Thus, by Chernoff bound, following is w.h.p.: nX (T0) , Ti+1 − Ti = 4n1/4nY (Ti) Thus, the attacks of X on Y and of Y on X (a random walk, so to speak) accounts, w.h.p., for a change of population in the timesteps Ti, . . . , Ti+1 (denoted as ∆i): ∆i ≤ (Ti+1 − Ti)2/3 = (cid:101)O(nκ · n1/4)2/3 = o(nκ) = o(nY (Ti)) Observe that for any Ti ≤ t ≤ Ti+1: nY (t) ≤ 2nY (Ti) + ∆i ≤ 2.01nY (Ti), nY (t) ≥ nY (Ti) − ∆i ≥ 0.99nY (Ti), nX (t) ≤ nX (Ti) + nY (Ti) + ∆i ≤ 1.01nX (Ti), nX (t) ≥ nX (Ti) − ∆i ≥ 0.99nX (Ti). Thus, if in the timestep t one of the members of populations x or y is drawn as a second participant and one of X or Y is drawn as a first participant, we have increase in population of X with probability at least (1 − pi)/2 and increase in population of Y with probability at most pi, for pi ≤ nY (t) nX (t) + nY (t) ≤ 2.03 · nY (Ti) nX (Ti) . So, by Chernoff bound, we have, w.h.p: nY (Ti+1) ≤ nY (Ti) + nY (Ti) · 1.1 · pi + ∆i ≤ nY (Ti) · (1 + 3 nY (Ti) nX (Ti) ) nX (Ti+1) ≥ nX (Ti) − ∆i + nY (Ti) · 0.9 · (1 − pi)/2 ≥ ≥ nX (Ti) · From the inductive assumption: nY (Ti) nX (Ti) Thus, we observe that (by (11) and (12)): (10) (11) (12) (cid:17)2(cid:19) (cid:16) nY (Ti) nX (Ti) (cid:19) (cid:18) 1 + 1 3 3 nY (Ti) nX (Ti) − 1 = (cid:101)Θ(nκ−1). (cid:18) 16 nX (Ti+1) ≥ nX (Ti) · 1 + 1 4 nY (Ti) nX (Ti) and using (10): (cid:18) nX (Ti+1) (cid:19)12 nX (Ti) nY (Ti+1) nY (Ti) ≤ which completes the inductive proof of claim. Thus, we can now complete the proof of main theorem. By Lemma 3.2, at moment Tj we will have following: nX (Tj) = Θ(n), nY (Tj) = O(nκ · (log n)12), nx(Tj) + ny(Tj) = O(n3/4). At this moment, we can as well assume that all of x and y becomes Y , giving us a win for X in following life-death game of wolves with probability at least 1 − n3/4+nκ(log n)12 , which holds w.h.p. n 4 The Rock-Paper-Scissors (RPS) Protocol In this section, our goal is to show that the RPS protocol reaches each of absorbing states with almost equal probability, given that the initial population of each species is linear (or slightly sub-linear) in n. We recall that the probability matrix of the RPS protocol is given by Definition 2.1. The corresponding matrix A is the following: A = RPS protocol admits a cyclic symmetry of behavior with respect to its species. For each of the species a ∈ {1, 2, 3}, the relative change ∆xa in population of this species in the given step can be expressed as: . The 1 −1 −1 1 0 1 −1 0  0 +1/n, with probability xaxa+1, −1/n, with probability xa+2xa, 0, otherwise, ∆xa = · ∆na = 1 n (13) where the population of at most one species changes in every step. The indices of populations are always 1, 2, or 3, and other values should be treated as mod 3, in the given range. We also introduce the continuous dynamics ¯x(t) corresponding to the RPS process, given for each species by the differential equation: d¯xa dt = ¯xa n (¯xa+1 − ¯xa+2), (14) which corresponds precisely to the continuous dynamics (1), up to an additional time-scaling factor of n introduced for easier comparison with the discrete process. In all further considera- tions, we set the potential U used in the analysis as: 3(cid:88) U (x) = ln xi = ln(x1x2x3). i=1 Lines U = const correspond to orbits in the continuous setting (14). Theorem 4.1 (coin-flip consensus property of RPS). For any state x such that xa > n−0.002 for all a ∈ {1, 2, 3}, the probability of the system reaching any one of its three possible absorbing states is 1 3 ± (cid:101)O(n−0.05). The rest of this section is devoted to the proof of Theorem 4.1. The proof of the theorem relies on the observation that the discrete RPS protocol approximately follows the limit cycle (orbit) of its continuous version. More precisely, we will observe that for an appropriately 17 chosen starting state x(0) = (x1, x2, x3) of the system, there is a time moment t (corresponding to an approximate traversal of 1/3 of the limit cycle) for which the state is given as x(t) = (x3 + ∆x3, x1 + ∆x1, x2 + ∆x2), with ∆xi sufficiently small. We will then use this to observe that if the probability of reaching any fixed absorbing state i from state (x1, x2, x3) is p and of reaching absorbing state i from state (x1 + ∆x1, x2 + ∆x2, x3 + ∆x3) is p∆, then by cyclic symmetry of populations, the probability of reaching state (i + 1) mod 3 from state x(t) is also p∆. If p ≈ p∆, then state x(0) leads to absorbing states i and (i + 1) mod 3 with almost the same probability. At an intuitive level, the main arguments of the proof are the following. To show that the probability of reaching an absorbing states are almost the same for points x(0) = (x1, x2, x3) and y(0) = (x3, x1, x2), we perform a coupling of walks starting from x(0) and y(0). Here, coupling of Markovian processes is understood in the usual sense (cf. e.g.[18]), though it is worth noting that since we are interested only in reaching an absorbing state (and not measuring the number of steps after which such a state is reached), we can in some steps of the coupling decide to delay one of the walks, allowing the other to run, provided that each of the processes remains unbiased. For simplicity, suppose that a walk x is located at a point at which all populations are of linear size in N and the difference in size between the largest and smallest population is also linear in n (e.g., U (x) = −20.) The behavior of the (undelayed) walk x under our evolution in the next t steps (for t sufficiently small with respect to n) can be seen as a superposition of three types of motion: 1. Propagation along the trajectory U (x) = const at a speed approximately given by the evolution of the continuous process (14). The Euclidean distance traversed in a single step is Θ(1/n), or Θ(t/n) over t steps. 2. Random drift along the trajectory U (x) = const (slowing or accelerating with respect to the average speed). Over a short interval time of length t, this drift shifts the point by √ ±(cid:101)O( length t, this drift shifts the potential U of the point by ±(cid:101)O( t/n) along its trajectory. 3. Random drift orthogonal to the trajectory U (x) = const. Over a short interval time of √ t/n). The analysis of the process is somewhat technical, since the two types of random drift have slightly biased averages (in particular, in Section 2.1 we took advantage of the fact that the orthogonal drift has an outward bias over very long intervals of time), the probabilities of different moves are changing over time, and the motion in different directions is not independent. The drift and the propagation speed also depend on the relation between the maximum and minimum of the sizes of the three populations, which change in time. Nevertheless, the random drifts of our process behaves closely enough to a combination of independent random walks that we can deal with them with a martingale-type analysis. We present the necessary tools in Subsection 4.1, formulating them so that the claims hold even when the smallest population is sublinear. After that, in Subsection 4.2 we formalize our coupling framework and perform the claimed coupling of the points x and y (Lemma 4.8). 4.1 Technical lemmas √ √ [−(cid:101)O( T ), (cid:101)O( √ T )] w.v.h.p, but is likely to hit all points at a distance of o( To begin with, we recall the following simple property of a simple random walk on a line: a walk starting from point 0 and proceeding for T steps is confined to an interval of the form T ) from 0. By a Doob martingale analysis, we state a generalization of this property applicable to a wider class of processes (to the best of our knowledge requiring weaker assumptions than those in bounds given in the literature). 18 t = 1, . . . , T , let X(t) =(cid:80)t Lemma 4.2 (concentration and anti-concentration). Let ε > 0 be an absolute constant. For √ τ =1 δ(τ ), be a random process which satisfies the following condition for some non-negative parameters c, α, σ: If X(t − 1) ≤ c T 1+ε + αT , then: (i) δ(t) is a bounded random variable, regardless of the history of the process: δ(t) δ(t − 1), δ(t − 2), . . . , δ(0) ≤ c, (ii) The expectation of δ(t) is bounded, regardless of the history of the process: E(δ(t)δ(t − 1), δ(t − 2), . . . , δ(0)) ≤ α, (iii) The standard deviation of δ(t) is lower-bounded, regardless of the history of the process: Var(δ(t)δ(t − 1), δ(t − 2), . . . , δ(0)) ≥ σ2. Then: • (Concentration bound) With probability at least 1 − e−Ω(T ε) we have: • (Anti-concentration bound) For any D ≥ c, with probability (cid:16) c2 σ2 at least 1 − 82 (D+αT ) ln T √ σ T T 1+ε + αT. √ ∀t∈{1,...,T} X(t) ≤ c (cid:17)2/3 , we have: ∃t∈{1,...,T} X(t) ≥ D. (15) (16) For a given realization of the process, let X(cid:48)(t) =(cid:80)t T 1+ε, and δ(cid:48)(τ ) ≡ 0, otherwise. Proof. We apply a succession of Doob-type martingale filters to the process under consideration. τ =1 δ(cid:48)(τ ), where δ(cid:48)(τ ) ≡ δ(τ )− E(δ(τ )δ(τ − √ 1), δ(τ − 2), . . . , δ(0)) if X(cid:48)(t − 1) ≤ c In other words, we √ convert our process into a martingale by subtracting expectations of increments, and at the same time enclose X(cid:48)(t) between two "barriers" placed at ±(c T 1+ε). If one of these barriers is crossed, X(cid:48) becomes fixed at this value thereafter. For the concentration bound, we start by showing that X(cid:48)(t) has very small probability of crossing one of the barriers. Indeed, for all moments of time t before the barriers are hit we √ T 1+ε. We immediately have by induction on time that then the conditions X(t) ≤ c T 1+ε + αT and E(δ(τ )δ(τ − 1), δ(τ − 2), . . . , δ(0)) ≤ α are satisfied, and so δ(t) ≤ c and also δ(cid:48)(t) ≤ 2c. For any moment of time t after one of the barriers is hit we have δ(cid:48)(t) = 0; thus, the condition δ(cid:48)(t) ≤ 2c holds throughout the time interval t = 1, . . . , T . By Azuma's inequality for martingales, we have for any time t: √ τ =1 E(δ(τ )δ(τ − 1), δ(τ − 2), . . . , δ(0)), and X(cid:48)(t) ≤ c have, X(t) = X(cid:48)(t) +(cid:80)t √ Pr[X(cid:48)(t) ≥ c T 1+ε] ≤ 2 exp (cid:18) (cid:19) − c2T 1+ε 2(2c)2T = 2e−T ε/8. Thus, taking the union bound over all moments of time, the bound [X(cid:48)(t) < c T 1+ε] holds throughout the time interval t = 1, . . . , T with probability p1 = 1 − T e−T ε/8 = 1 − eln T−T ε/8. Thus, with probability p1 the barriers are not reached, and we have δ(cid:48)(t)−δ(τ ) ≤ α throughout the entire time interval [1, T ]. Thus, we obtain that the sought concentration bound for process X holds with probability p1 = 1 − e−Ω(T ε). √ 19 close to 0. Define martingale X(cid:48)(cid:48)(t) = (cid:80)T To show the anti-concentration bound, fix D(cid:48) > c arbitrarily. We will upper-bound the probability p2 that the martingale X(cid:48) does not hit a barrier located at level D(cid:48) (i.e., p2 = Pr[∀t∈{1,...,T} X(cid:48)(t) < D(cid:48)]). Unlike probability p1, which is very close to 1, we expect p2 to be τ =1 δ(cid:48)(cid:48)(τ ), where δ(cid:48)(cid:48)(τ ) ≡ δ(cid:48)(τ ) if X(cid:48)(cid:48)(τ − 1) < D(cid:48), and δ(cid:48)(cid:48)(τ ) = 0 otherwise. Observe that, conditioned on the events that process X(cid:48) does not hit √ either of its barriers at ±(c T 1+ε) (which holds with probability at least p1) and that process X(cid:48)(cid:48) does not hit its barrier at D(cid:48) (which holds with probability p2), in a given realization of the process, δ(cid:48)(cid:48)(t) and δ(t) have the same variance. Thus, by (iii) we can write the following bound on the variance of δ(cid:48)(cid:48)(t) which holds without conditioning: where we introduce the notation: p∗ p2 ≤ 16 + eln T−T ε/8. Suppose, to the contrary, that p∗ the additivity of variance of a martingale over its elements, we have: σ2T 1−2ε D(cid:48)2 σ4 2σ2, Var(δ(cid:48)(cid:48)(t)) ≥ p∗ 2 = p2 − (1 − p1) = p2 − eln T−T ε/8. We now show that . By (cid:17)1/3 (cid:16) c4 D(cid:48)2 (cid:17)1/3 (cid:16) c4 σ2T 1−2ε σ4 2 > 16 E(X(cid:48)(cid:48)2(T )) = Var(X(cid:48)(cid:48)(T )) = Var(δ(cid:48)(cid:48)(t)) ≥ p∗ √ √ On the other hand, since X(cid:48)(cid:48)(t) ≤ c T 1+ + c ≤ 2c process X(cid:48)(t) through its definition, t ∈ {1, . . . , T}, we also have: t=1 2σ2T. T 1+ by the same bound imposed on Since X(cid:48)(cid:48)2(T ) is an upper-bounded non-negative random variable, we can apply Markov's in- equality to lower-bound its heavy tail: and by transforming the expression on the left-hand side, we get: Since the maximum value attained by X(cid:48)(cid:48)(T ) is upper-bounded by D(cid:48) +c < 2D(cid:48), and by assump- √ p∗ tion we have p∗ 2σ 4D(cid:48) 0. So, we can drop the absolute value in expression (18): p∗ 2σ 4D(cid:48) > 1 and Pr X(cid:48)(cid:48)(T ) ≥ 2D(cid:48) σ2T , we have > 16D(cid:48)2 σ2T 1−2ε 2 > 16 D(cid:48)2 √ √ √ σ4 T T X(cid:48)(cid:48)(T ) < −2D(cid:48) Pr ≥ 1 8 p∗ 2σ2c−2T −. On the other hand, EX(cid:48)(cid:48)(T ) = 0 and X(cid:48)(cid:48)(T ) < 2D(cid:48), so by Markov's inequality: T(cid:88) (cid:35) (cid:35) X(cid:48)(cid:48)2(T ) ≤ 4c2T 1+. (cid:20) Pr 2σ2T 4 X(cid:48)(cid:48)2(T ) ≥ p∗ (cid:34) X(cid:48)(cid:48)(T ) ≥ 2D(cid:48) Pr ≥ 1 2 (cid:21) (cid:112)p∗ √ 2σ 4D(cid:48) T p∗ 2σ2T 4c2T 1+ = p∗ 2σ2c−2T − 1 8 ≥ 1 8 p∗ 2σ2c−2T −, (cid:20) (cid:17)1/3 (cid:34) (cid:16) c4 (cid:34) X(cid:48)(cid:48)(T ) < −2D(cid:48) Pr √ 2σ T 4D(cid:48) (cid:112)p∗ (cid:35) T (cid:112)p∗ √ 2σ 4D(cid:48) ≤ √ 1 √ p∗ 2σ 4D(cid:48) T < 1 + 4D(cid:48)(cid:112)p∗ 2σ √ . T (cid:21) = (17) (18) (19) (20) Combining the right-hand sides of expressions (20) and (19), we obtain: 4D(cid:48)(cid:112)p∗ 2σ √ , T 2σ2c−2T − < p∗ 1 8 20 and subsequently: (cid:18) 1024c4 p∗ 2 < (cid:19)1/3 (cid:18) c4 D(cid:48)2 (cid:19)1/3 , σ2T 1−2ε a contradiction with our assumption. In this way, we have shown: σ2T 1−2ε σ4 σ4 < 16 D(cid:48)2 (cid:18) c4 p2 ≤ 16 D(cid:48)2 σ2T 1−2ε σ4 + eln T−T ε/8. √ Now, conditioned on the event that X(cid:48)(t) does not hit any of the points ±(c T 1+ε) which holds with probability at least p1 = 1 − eln T−T ε/8, having X(cid:48)(t) ≥ D(cid:48) at some time t implies X(t) ≥ D(cid:48) − at ≥ D(cid:48) − αT . Thus, putting D(cid:48) = D + αT , we have: (cid:19)1/3 (cid:18) c4 (cid:19)1/3 (cid:19)1/3 Pr[∀t∈{1,...,T X(t) < D] ≤ p2 + p1 = 16 (D + αT )2 σ2T 1−2ε Choosing ε so that T ε = 11 ln T , we can rewrite the above as: σ4 + 2eln T−T ε/8. Pr[∀t∈{1,...,T}X(t) < D] ≤ 16 < 82 121(D + αT )2 ln2 T + 2T −3/8 < σ2T √ (D + αT ) ln T σ2 σ T (cid:19)2/3 , (cid:18) c4 (cid:18) c2 σ4 which completes the proof of our anti-concentration bound. We now need to define a meaningful random process based on the RPS protocol, for which we could take advantage of Lemma 4.2 in the proof of Theorem 4.1. In fact, we will need to bound more than one such process to close the analysis. We first introduce two measures of distance of a pair of points x(a), x(b) in our state space: • dU (x(a), x(b)) = U (x(a)) − U (x(b)), • d∞(x(a), x(b)) = (cid:107)x(a) − x(b)(cid:107)∞ = max{x(a) 1 − x(b) 1 ,x(a) 2 − x(b) 2 ,x(a) 3 − x(b) 3 }. Lemma 4.3. Let x(0) be a point in the state space of RPS with U (x(0)) > −γ ln n for some absolute constant 0 < γ < 1/6, let x(t) be the random variable representing the point reached after following the population protocol for t steps starting from point x(0). Then, for sufficiently large n and T ≤ n5/3, the following claim holds: ∀t∈{1,...,T} dU (x(t), x(0)) = (cid:101)O(T 0.5/n1−γ), U (x(0)). We have X(t) = (cid:80)t w.v.h.p. Proof. To show the claim, we apply concentration bound (15) to the process X(t) = U (x(t)) − τ =1 δ(τ ), with random variable δ(t) given by: δ(t) = U (x(t)) − U (x(t − 1)). Let v = eU (x(0)) > e−γ ln n = n−γ. We verify that the first two conditions of Lemma 4.2 hold for ε such that T ε = log2 n, c = 4 Indeed, suppose that the condition from Lemma 4.2: nv , α = 8 n2v . U (x(t − 1)) − U (x(0)) = X(t − 1) ≤ cT 0.5 log n + αT is satisfied at some time t − 1, l ≤ t ≤ T . Under this assumption, we have for T ≤ n5/3 and sufficiently large n: U (x(t − 1)) ≥U (x(0)) − 4T 0.5 log n − 8T n2v > >U (x(0)) − n−1/6+log log n+γ > U (x(0)) − ln 2, nv 21 hence the minimum size of a species at time t − 1 is then lower-bounded by: eU (x(t−1)) > v 2 . (cid:18) (cid:19) (cid:12)(cid:12)(cid:12)(cid:12)(cid:18) Following (4), we then have: δ(t) ≤ max a∈{1,2,3} na(t − 1) + 1 n − ln na(t − 1) n ln na+1(t − 1) − 1 + ln < max a∈{1,2,3} ln(na(t − 1)) − ln(na(t − 1) − 1) < max a∈{1,2,3} − ln na+1(t − 1) n (cid:19)(cid:12)(cid:12)(cid:12)(cid:12) < < 2 neU (x(t−1)) < 4 nv = c. n 2 na(t − 1) Next, we bound the expectation Eδ(t) by transforming the equality in (6) at point x(t − 1): Eδ(t) ≤ − 1 3n2 Eδ(t) ≥ − 2 3n2 3(cid:88) 3(cid:88) a=1 a=1 (cid:18) na(t − 1) (cid:18) na(t − 1) na+1(t − 1) na+1(t − 1) 4 (cid:19) (cid:19) < 0, ≥ na+1(t − 1) na(t − 1) na+1(t − 1) na(t − 1) + + ≥ − n · mina∈{1,2,3} na(t − 1) > −8 n2v = −α. (21) (22) Thus, we can apply concentration bound (15), obtaining that: = (cid:101)O(T 0.5/n1−γ) ∀t∈{1,...,T} U (x(t)) − U (x(0)) = X(t) ≤ 4T 0.5 log n holds with very high probability 1 − e−Ω(T ε) = 1 − e−Ω(log2 n). Lemma 4.4. For a pair of points p, q lying on the same orbit U (p) = U (q) = U < −6, let ¯t = ¯t(p, q) > 0 denote that smallest time such that for the continuous process (14) originating at p we have ¯p(¯t) = q. If q is separated from p by at most 1/3 of the orbit (¯t(p, q) ≤ ¯t(p, p)/3), then the following relations hold: 8T n2v nv + 0.05 ¯t n eU ≤ d∞(p, q) ≤ ¯t n . n follows immediately from the observation that for any t ≥ 0 Proof. The bound d∞(p, q) ≤ ¯t and infinitesimal time interval dt, we have for the continuous process (14): d∞(¯p(t + dt), ¯p(t)) ≤ n . To show the lower bound on d∞(p, q), observe that the linear distance covered in each infinitesimal time step can be lower-bounded as follows: dt a∈{1,2,3} pa(t)· (cid:107)p(t + dt) − ¯p(t)(cid:107)2 ≥ d∞(¯p(t + dt), ¯p(t)) ≥ 1 n dt ≥ eU a∈{1,2,3} pa(t) − min − eU/3 · ( max where we took into account that eU =(cid:81)3 6n a∈{1,2,3} pa(t))dt ≥ eU (cid:18) 1 (cid:19) min n 3 dt, a=1 pa(t) and that U < −6. Denoting by l the length of the traversal from p to q along the orbit U , we obtain: l ≥ eU 6n ¯t 22 The orbit x1x2x3 = eU is the boundary of a convex subset of the plane x1 + x2 + x3 = 1. Moreover, the entire fragment of the considered orbit between points p and q is contained within the triangle (p, q, o), where o is the intersection point of the straight lines in the considered plane, adjacent to the orbit at points p and q, respectively. By the rotational symmetry of the orbit under rotation by 2π/3 in its plane around the point (1/3, 1/3, 1/3) and the fact that p and q are apart from each other by at most 1/3 of the orbit, it follows that ∠(poq) ≥ π/3. By applying the law of cosines to triangle (p, q, o) we obtain: (cid:107)p − o(cid:107)2 + (cid:107)q − o(cid:107)2 ≤ 2(cid:107)p − q(cid:107)2. Now, we can write the following bounds: d∞(p, q) ≥ 1√ 2 √ (cid:107)p − q(cid:107)2 ≥ 1 2 2 ((cid:107)p − o(cid:107)2 + (cid:107)o − q(cid:107)2) > √ l 2 2 ≥ eU √ 12 2n ¯t > 0.05 eU n ¯t, which completes the proof. Lemma 4.5. Let x be a point in the state space and let p be a point with minimum in- finity norm distance to x from among all points having the same potential as p, i.e., p ∈ arg minp(cid:48){d∞(p(cid:48), x(ti)) : U (p(cid:48)) = U (p)}. If U (x) < −3 and d∞(x, p) < eU (x), then d∞(x, p) < dU (x, p). Proof. Let d = d∞(x, p). Let xmin = mina∈{1,2,3} xa and let xmax = maxa∈{1,2,3} xa. We note that xmin < eU (x) < 0.05 and xmax ≥ 1/3. Assume first that U (p) > U (x), and let r be the point reached from x by moving d individuals from the largest population in x to the smallest population in x. By the definition of the potential, we have: U (r) ≥ U (x) + ln xmin + d xmin − ln xmax + d xmax ≥ U (x) + d − 1 xmax 2xmin > U (x) + d. Since d = d∞(x, p) = d∞(x, r), the straight line segment connecting x and r does not intersect with the potential orbit U = U (p), hence U (p) ≥ U (r) > U (x) + d, which completes the proof for the considered case. When U (p) < U (x), we define r by moving d individuals from the smallest population in x to the largest population in x; we omit the details of the analogous argument. (cid:18) 1 (cid:19) Lemma 4.6. Let x(0) be a point in the state space of RPS and let x(t) be the random variable representing the point reached after following the population protocol for t steps starting from point x(0). Then, for sufficiently large n and any positive integer T , the following claim holds: (i) If T ≤ n2/3, then: ∀t∈{1,...,T} d∞(x(t), x(t)) = (cid:101)O(T 0.5/n), w.v.h.p., where x(t) = (x1(t), x2(t), x3(t)) is the following linear approximation to the considered process: (cid:18) t n (cid:19) xa(t) = xa(0) 1 + (xa+1(0) − xa+2(0)) , for a ∈ {1, 2, 3}. Next, consider the process ¯x(t) governed by the continuous RPS dynamics (14) with any starting point ¯x(0) such that d∞(¯x(0), x(0)) ≤ ∆, for some ∆ > 0. Then, the following claims hold: (ii) If T ≤ n2/3, then: ∀t∈{1,...,T} d∞(x(t), ¯x(t)) = (cid:101)O(∆ + T 0.5/n), w.v.h.p. ∀t∈{1,...,T} d∞(x(t), ¯x(t)) = (cid:101)O((T nγ−2/3 + 1) · (∆ + T 0.5nγ−1)), w.v.h.p. (iii) If T ≤ n5/3 and −10 > U (x(0)) > −γ ln n for some absolute constant 0 < γ < 1/6, then: 23 Figure 2: Illustration of the proof of Lemma 4.6: (a) Short-term view (T < n2/3) and (b) Long-term view (T > n2/3). (iv) If n6γ ≤ T ≤ n4/3−8γ, ∆ ≤ T 0.5nγ−1, and −10 > U (x(0)) > −γ ln n for some absolute constant 0 < γ < 1/6, then there exists an integer time step T (cid:48) = (1 + o(1))T , such that d∞(x(T (cid:48)), ¯x(T )) = (cid:101)O(T 0.5nγ−1), w.v.h.p. cesses Xa(t) = xa(t)− xa(t), for a ∈ {1, 2, 3}. We have Xa(t) =(cid:80)t Proof. To show Claim (i), we apply the concentration bound (15) to each of the random pro- τ =1 δa(τ ), where δa(t) is given as: δa(t) = ∆xa(t − 1) − 1 n xa(0)(xa+1(0) − xa+2(0)), 1 n xa(t− 1)(xa+1(t− 1)− xa+2(t− 1))− xa(0)(xa+1(0)− xa+2(0)) < and ∆xa is a random variable with distribution described by (13). We have δa(t) ≤ 2 n2 ≤ 6T Eδa(t) = n2 , (23) where we took into account that xi(t − 1) − xi(0) < t/n, for all i ∈ {1, 2, 3} by the definition of the population dynamics, which changes the size of each species by at most 1 in each step. n2 , and ε = log2 n, we have that for Thus, applying the concentration bound with c = 2 T ≤ n2/3: n , α = 6T n and 6t ∀t∈{1,...,T} xa(t) − xa(t) = Xa(t) ≤ 2T 0.5 log n n + n2 = (cid:101)O(T 0.5/n) 6T 2 holds with very high probability 1 − e−Ω(T ε) = 1 − e−Ω(log2 n). Applying the union bound over all a ∈ {1, 2, 3}, we obtain the claim. We now proceed to prove Claim (ii), assuming T ≤ n2/3 (see Fig. 2(a)). By Claim (i), It remains to observe that the we have d∞(x(t), x(t)) = (cid:101)O(T 0.5/n) for all t ≤ T , w.v.h.p. 24 U=U(x(0))U=U(x(0))x(T)x(0)(b)x(t1)p(1)x(0)x(T)~x(0)=x(0)x(T)~x(0)q(1)x(t2)p(2)q(2)(a) continuous process is also close to the linear approximation x (compare with (23)): (cid:90) t (cid:90) t τ =0 τ =0 1 n d∞(¯x(t), x(t)) ≤ ≤ ∆ + max a∈{1,2,3} ≤ ∆ + max a∈{1,2,3} (cid:90) t + max a∈{1,2,3} (cid:90) t ≤ ∆ + (cid:90) t τ =0 6τ n2 dτ + τ =0 τ =0 ¯xa(τ )(¯xa+1(τ ) − ¯xa+2(τ )) − xa(0)(xa+1(0) − xa+2(0)) dτ ≤ 1 n ¯xa(τ )(¯xa+1(τ ) − ¯xa+2(τ )) − ¯xa(0)(¯xa+1(0) − ¯xa+2(0)) dτ + 1 n ¯xa(0)(¯xa+1(0) − ¯xa+2(0)) − xa(0)(xa+1(0) − xa+2(0)) dτ ≤ 6∆ n dτ = ∆ + 3t2 n2 + 6t∆ n ≤ ∆ + 3T 2 n2 + 6T ∆ n = O(∆ + T 0.5/n). Taking into account that d∞(x(t), ¯x(t)) ≤ d∞(x(t), x(t)) + d∞(x(t), ¯x(t)), we obtain the claim. To prove Claim (iii), we only need to consider the case of T > n2/3, which is not covered by the stronger Claim (ii). Let 0 = t0 < t1 < . . . < tl = T be fixed integer moments of time chosen so that ti − ti−1 ≤ n2/3, for 1 ≤ i ≤ l, and l = O(T /n2/3). For 1 ≤ i ≤ l, let p(i) denote the random variable representing the point on the orbit of the considered continuous dynamics ¯x, located closest in the infinity norm to the point x(ti) obtained after ti steps of evolution of the discrete dynamics: p(i) ∈ arg min {d∞(p, x(ti)) : U (p) = U (¯x(0))}, and for consistency of notation, let p(0) = ¯x(0). By Lemma 4.3, we have w.v.h.p. that for all 0 ≤ i ≤ l: dU (x(0), x(ti)) = (cid:101)O(T 0.5/n1−γ) and taking into account that dU (x(0), p(i)) ≤ ∆, we p obtain By Lemma 4.5, we have d∞(x(ti), p(i)) < dU (x(ti), p(i)), thus, dU (x(ti), p(i)) = (cid:101)O(∆ + T 0.5/n1−γ). d∞(x(ti), p(i)) = (cid:101)O(∆ + T 0.5/n1−γ). (24) Now, for 1 ≤ i ≤ l, define q(i) as the point obtained by applying the continuous dynamics (14) to point p(i−1) for δti = ti − ti−1 steps. Note that q(1) = ¯x(t1), but that for i > 1, a similar correspondence need not hold precisely. However, since δti ≤ n2/3, we can apply Claim (ii) to the discrete dynamics starting at point x(ti−1) and the continuous dynamics starting at point p(i−1) and running for δti steps. Substituting (cid:101)O(∆ + T 2/3/n1−γ) for "∆" and O(n2/3) for "T " in Claim (ii), we have: d∞(x(ti), q(i)) = (cid:101)O (cid:32) (n2/3)0.5 n + (∆ + T 0.5/n1−γ) (cid:33) = (cid:101)O(∆ + T 0.5/n1−γ), (25) with very high probability. Combining the above bound with (24), we obtain: d∞(p(i), q(i)) = (cid:101)O(∆ + T 0.5/n1−γ). By applying the union bound, the above also holds for all 1 ≤ i ≤ l, w.v.h.p. Now, we introduce the following auxiliary notation. For any pair of points p, q, such that U (p) = U (q), we define by ¯t(p, q) the smallest value of time t such that either point p is obtained by applying the continuous dynamics (14) to starting point q for time t, or vice versa. For the considered set of points, the following bound holds: ¯t(¯x(T ), q(l)) ≤ l−1(cid:88) ¯t(p(i), q(i)). i=1 25 By Lemma 4.4, we obtain that for a pair of points p, q at distance o(n) on the considered orbit −10 > U = U (¯x(0)) > −γ ln n, the following relations hold: and d∞(p, q) = Ω(¯t(p, q)/n1+γ) d∞(p, q) = O(¯t(p, q)/n). Thus, we have: d∞(¯x(T ), q(l)) = (cid:101)O(l · (∆ + T 0.5nγ−1) ) = (cid:101)O((T nγ−2/3) · (∆ + T 0.5nγ−1)). d∞(¯x(T ), x(T )) = (cid:101)O((T nγ−2/3) · (∆ + T 0.5nγ−1)) + (cid:101)O(∆ + T 0.5nγ−1) = n1+γ n Combining the above with bound (25) for point q(l), we get: = (cid:101)O((T nγ−2/3) · (∆ + T 0.5nγ−1)) To show claim (iv), we consider the set of points p(U ) which lie at minimum distance The above holds w.v.h.p. By stating the obtained claim for all values of T (cid:48) ∈ [n2/3, T ], and applying a union bound over all such T (cid:48), as well as for the case of smaller T (cid:48) covered by Claim (ii), we obtain Claim (iii). d∞ from point ¯x(T ), taken over all potential orbits U = U (x(0)) ± (cid:101)O(T 0.5/n1−γ). Taking d∞(x(T ), ¯x(T )) = (cid:101)O((T nγ−2/3 + 1) · (∆ + T 0.5nγ−1)) ≤ (cid:101)O(T n−1−2γ), w.v.h.p. Taking into into account Lemma 4.3, we will show that the evolution x(t) will intersect with set p(U ) after T (cid:48) = (1 ± o(1))T steps; in this way, we will obtain the claim directly from Lemma 4.5. By claim (iii), after T steps, our discrete evolution has reached a point x(T ) such that d = account Lemma 4.4, we conclude that the intersection of the trajectory with set p(U ) took place at time T (cid:48) = T ± O(dn1+γ) = (1 ± o(1))T . 4.2 The coupling framework For a fixed absorbing state r ∈ {(1, 0, 0), (0, 1, 0), (0, 0, 1)}, we denote by pr(x) the probability that the RPS population protocol (13), starting from initial state x, reaches absorbing state r. To show that for a pair of states x, y we have pr(x) ≈ pr(y), we define a coupling on the evolution of states x and y over time. Formally, we denote by R the set of possible actions which can be taken in any step by the considered population protocol. In the context of RPS, we define R = {1, . . . , n(n − 1)}, and treat elements of R as identifiers of ordered pairs of elements of the population. By convention, we will assume that the elements are ordered in each step, so that in a state (x1, x2, x3), the x1 elements belonging to species 1 have the smallest identifiers, while the x3 elements belonging to species 3 have the largest. For any s ≥ 0 and sequence S = (S1, . . . , Ss) ∈ Rs, we denote by x[S] the state reached by executing the population protocol for s steps, starting from state x, choosing in the i-th step, 1 ≤ i ≤ s, an action of the protocol encoded by the value Si ∈ R. We will define F to be a random number generator over R if subsequent calls to F return elements from R chosen uniformly and independently at random; formally, F = (F1, F2, . . . , ), where all Fi ∼ unif (R) are independent random variables. By a slight abuse of notation, we will denote by x[F, s] the random variable in the state space corresponding to the sequence of actions x[(F1, . . . , Fs)]. We now provide a method for "skipping" some elements returned by a random number generator, to create a new random number generator. We recall that if the decision whether or 26 not to skip the i-th element in the sequence returned by a random number generator depends only on the values of the previously generated elements (up to the (i − 1)-st, then such a gen- erator remains unbiased. Formally, we call a sequence of functions φ = (φ1, φ◦ 1, φ2, φ◦ 2, . . .), with φi : Ri−1 → {0, 1} being measurable (an elimination function) and φ◦ i : Fi (cid:55)→ φ◦ i (Fi) ∼ unif (R) acting as a transformation of random variable Fi, a resampler on random number genera- tors. For a random number generator F , we denote by φF = ((φF )1, (φF )2, . . .) the se- quence of random variables with values in R, realized inductively as follows. The first ran- dom variable (φF )1 takes the value of φ◦ (Fi1), where i1 > 0 is the smallest index such that φi1(F1, F2, . . . , Fi1−1) = 1. Next, (φF )2 takes the value of φ◦ (Fi2), where i2 > i1 is the smallest index larger than i1 such that φi1(F1, F2, . . . , Fi2−1) = 1, and so on. We note that the resampled distribution φF is also a (uniform, independent) random number generator over R. i2 i1 We are now ready to formulate the standard coupling technique in terms of applying resam- plers to random number generators. Proposition 4.7 (Coupling of delayed walks). Let F be a random number generator over R, let x, y be two arbitrary starting points in the state space, and let r be an arbitrary absorbing state. If there exist two filters φx, φy on a random number generator such that limt→+∞(x[φxF, t]) = limt→+∞(y[φyF, t]) holds with probability 1 − ε, for some ε ≥ 0, then pr(x) − pr(y) ≤ ε. The validity of the above proposition follows from the fact that each of the marginals φxF , φyF represents an unbiased evolution of the system. Informally, we will apply the above tech- nique as follows. We will sample numbers from R from a random number generator. Based on all the numbers sampled so far, we will decide if the next number to be sampled should be applied only in the evolution of the process originating from x, in the evolution of the process originating from y, or in both those processes. (If only one process undergoes evolution in the given step, the other process can be thought of as delayed in this step). In the following, we will consider the walks in the state space originating from x and y, and we will execute the following types of phases: • One of the walks progresses until a given termination condition is met, while the other walk is delayed. • Both walks progress simultaneously in a given step t, with one walk following action φ◦ x t(Ft) and the other following action φ◦ y t(Ft) in this step. We are now ready to apply the coupling technique to obtain the main technical result of this section. Lemma 4.8. Fix γ = 0.005 and ε = 0.05. Let x(0) = (x1(0), x2(0), x3(0)) be arbitrarily fixed with −12 > U (x(0)) > −γ ln n, and let y(0) = (x3(0), x1(0), x2(0)). Then, there exist a coupling of x and y which leads to the same absorbing state with probability 1 − (cid:101)O(n−ε). Proof. The proof proceeds by a coupling of walks originating from x and y in the above-described framework. By a slight abuse of notation, we will denote by x(t) and y(t) the position of each of the two walks in the state space after t steps (i.e., after t applications of the random generator F ), which may include steps in which a given walk is delayed. Our goal is to make points x(t) and y(t) coalesce within a small number of steps T , i.e., to obtain x(T ) = y(T ) with probability 1 − O(n−ε), where T (cid:28) n1.33. Consequently, taking into account Lemma 4.3, we will silently assume that the bounds −(1 + o(1))12 > U (x(t)) > −(1 + o(1))γ ln n and −(1 + o(1))12 > U (y(t)) > −(1 + o(1))γ ln n are preserved throughout the coupling. The coupling proceeds in five phases, illustrated in Fig. 3. We start by providing a high level overview, thinking for now of the potential U (x(0)) = Θ(1) to simplify calculations. In Phase 1, 27 point x approaches point y, which is stopped. In this way, the infinity norm distance between x and y is reduced, at the cost of increasing the dU distance to slightly over n−0.5. Next, in Phase 2 we run both walks independently, so that the distance dU in time follows a random evolution resembling a random walk, and after slightly more than n steps, the value dU = 0 is hit with sufficiently high probability. Whereas the walks are now orthogonally aligned, we also need to align them along the orbit, since we may at this point have them at a distance of d∞ > n−1/3 apart. By allowing the slower walk to catch up, we reduce d∞ to slightly more than n−2/3, at the cost of increasing dU to a similar value. In this way, we have decreased the norm in both distances (from about n−0.5 to about n−2/3). We iterate Phase 2, reducing each time the distance between the two walks in both norms, up to an iteration in which the size of the populations in x and y differ by an arbitrarily small polynomial in n. (We remark that multiple iterations of Phase 2 may also be replaced by a path-coupling argument of the type used in [18], but this does not necessarily simplify the proof.) At this point, only a very small number of time steps remains until coalescence. We first align the two states by evolving one of them until the size of one of the three populations is identical for x and y at the end of Phase 3, and then perform a standard coupling by correlating the evolution of x and y in Phase 4, so as to make the sizes of the other two populations meet for x and y, while maintaining equality on the size of the population coalesced in Phase 3. Finally, after the coupling is achieved, we evolve the coalesced state into an absorbing state in Phase 5. Figure 3: Illustration of the coupling for the proof of Lemma 4.8 • Phase 1. In the first t1 steps, for all t < t1 the walk x(t) progresses while the walk y(t) is delayed. We choose the duration of the phase so that x(t1) and y(t1) as close to each other in the infinity norm as possible, after walk x(t) has traversed approximately 1/3 of its orbit around the state space. Formally, let T be the number of steps of the continuous evolution which transforms point x(0) into point y(0); we have by Lemma 4.4 28 Phase 1:x = x(0)y = y(0)= y(t1)x(t1)dU(x(t1), y(t1))= Õ(n -0.5+1.5γ)d∞(x(t1), y(t1))= Õ(n -0.5+1.5γ) Phase 2:y(ti+1)U=U(x(ti'))U(y(ti'))y(ti')x(ti')= x(ti+1)y(ti)x(ti)dU(x(ti), y(ti))≤ Dd∞(x(ti), y(ti))≤ Dd∞(x(ti), y(ti'))= di'dU(x(ti+1), y(ti+1))≤ D/2d∞(x(ti+1), y(ti+1))≤ D/2Phase 3Phase 4Phase 5d∞(x(ts), y(ts))= O(n -1+r)y(ts')y(ts)x(ts)= x(ts')x(tf)= y(tf)d∞(x(ts'), y(ts'))= O(n -1+r +g)Phases 3-5: that t1 = O(n/eU (x)) = O(n1+γ). Next, let t1 be chosen as the time T (cid:48) = (1 + o(1))T which follows from Lemma 4.6(iv), i.e., the time such that the discrete process starting from x(0) after T (cid:48) steps satisfies d∞(y(0), x(T (cid:48))) = (cid:101)O(T 0.5nγ−1) = (cid:101)O(n−0.5+1.5γ)), w.v.h.p. Moreover, we also have dU (y(0), x(T (cid:48))) = (cid:101)O(T 0.5nγ−1) = (cid:101)O(n−0.5+1.5γ)) by Lemma 4.3, (y(t1) = y(0)), at the end of this phase, we obtain dU (y(t1), x(t1)) = (cid:101)O(n−0.5+1.5γ) and d∞(y(t1), x(t1)) = (cid:101)O(n−0.5+1.5γ), w.v.h.p. w.v.h.p. Since walk x progresses for t1 = T (cid:48) steps and walk y is delayed throughout i), x(t(cid:48) tion: X(t) =(cid:80)t • Phase 2 consists of a certain number (logarithmic in n) of iterations. We start iteration i at time ti with dU (y(ti), x(ti)) ≤ D and d∞(y(t1), x(t1)) ≤ D, where D ≤ n−0.5+1.5γ. In each iteration, we start by running both walks in parallel until a time t(cid:48) i at which the two evolu- tions are located on the same potential orbit (up to integer rounding): dU (y(t(cid:48) i)) = O(nγ−1). We introduce the following notation: let r(t) ≡ U (x(ti + t)) − U (y(ti + t)) and consider the process X(t) = r(t) − r(0). We can use the following sum representa- τ =1 δ(τ ), with the increment δ(τ ) given as δ(τ ) = r(τ ) − r(τ − 1). Notice that r(0) = dU (y(ti), x(ti)) = O(nαi). We now apply the anticoncentration bound of Lemma 4.2 to process X(t) with r(0) = d∞(y(ti), x(ti)) ≤ D to bound the probability of r(t) having opposite sign to r(0), for some t ∈ [0, T ], where the length of the inter- val is suitably chosen (T = n2+7γ+εD2). Without loss of generality of the argument, let r(0) ≤ 0; then, we and ask about the probability of the event r(t) ≥ 0, which is equivalent to X(t) = r(t)−r(0) > −r(0) = D occurring. (If r(0) > 0, we apply the anticoncentration bound to process −X instead.) Now, by analyzing the change of potential U in a step of the discrete dynamics (13), for the different pairs of possible agents, we obtain that Lemma 4.2 is applicable to process X with the following parameters (compare with the proof of Lemma 4.3 for a related derivation):  c = (cid:101)O(n−1+γ) α = (cid:101)O(n−2+γ) σ =(cid:101)Ω(n−1−0.5γ) T = n2+7γ+εD2, where ε is an absolute constant belonging to the range 0 < ε < 0.25 − 4.75γ. Then, we can bound the probability of failure for equation (16) as follows: (cid:19)2/3 (cid:32)(cid:18) (n−1+γ)2 (n−1−0.5γ)2 = (cid:101)O D + nγ−2T √ n−1−0.5γ T (cid:19)2/3(cid:33) = (cid:18) c2 (cid:32) = (cid:101)O σ2 82 (D + αT ) ln T √ σ T n2/3+7γ/3 D2/3 T 1/3 + n−2/3+3γT 1/3 (cid:33) = (cid:101)O(n−ε). At this point, the time shift of the two processes can be bounded as: d(cid:48) i = d∞(x(t(cid:48) i), y(t(cid:48) i)) = (cid:101)O((T nγ−2/3 + 1) · (D + T 0.5nγ−1)) = = (cid:101)O((D2n4/3+8γ+ε + 1)Dn4.5γ+0.5ε). Now, we proceed from time t(cid:48) generality, suppose that x(t(cid:48) (i.e., that a continuous evolution from point x(t(cid:48) We now continue the evolution of point x(t(cid:48) i to time ti+1 by aligning the two walks. Without loss of i) is lagging behind along its trajectory with respect to y(t(cid:48) i) i) reduces its distance to point y(t(cid:48) i)). i), which i) until it becomes close to point y(t(cid:48) 29 remains motionless. By Lemma 4.6 (iv), we then have: i)0.5 (cid:19) (cid:19) = (cid:101)O (cid:18) (d(cid:48) d∞(x(ti+1), y(ti+1)) = (cid:101)O (cid:18) (ti+1 − t(cid:48) = (cid:101)O((Dn2/3+4γ+0.5ε + 1)D0.5n−0.5+3.75γ+0.25). d∞(x(ti+1), y(ti+1)) = (cid:101)O(Dn2/3+4γ+0.5ε(n−0.5+1.5γ)0.5n−0.5+3.75γ+0.25) = = (cid:101)O(Dn−1/12+8.5γ+0.75ε) < D/2 = d∞(x(ti), y(ti))/2, in1+γ)0.5 n1−γ n1−γ = For D > n−2/3−4γ−0.5ε, we further bound this as: where the final inequality holds when we set γ = 0.005, ε = 0.05, and sufficiently large n. For D ≤ n−2/3−4γ−0.5ε, we apply the following bound: d∞(x(ti+1), y(ti+1)) = (cid:101)O(D0.5n−0.5+3.75γ+0.25) < D/2 = d∞(x(ti), y(ti))/2, where the final inequality holds for sufficiently large n when D = ω(n−1+7.5γ+0.5). We also recall that by Lemma 4.6 (iv), we can bound dU (x(ti+1), y(ti+1)) similarly to d∞(x(ti+1), y(ti+1)), obtaining dU (x(ti+1), y(ti+1)) < D/2 under the same assumptions. Thus, in every iteration of the coupling phase, starting from a pair of points (x(ti), y(ti)) such that D = ω(n−1+7.5γ+0.5), with probability 1 − (cid:101)O(n−ε) we reach in O(n2+7γ+εD2) less than s iterations, where s = O(log n), with success probability 1 − (cid:101)O(n−ε). For the steps a new pair of points (x(ti+1), y(ti+1)) such that d∞(x(ti+1), y(ti+1)) < D/2 and dU (x(ti+1), y(ti+1)) < D/2. The next iteration then starts. The phase is completed after chosen values of constants γ and ε, at the end of the phase, we obtain that D < n−1+ρ, where ρ = 0.07. • Phase 3. We start this phase from a pair of points (x(ts), y(ts)), such that d∞(x(ts), y(ts)) < n−1+ρ. Our goal is to reach in a small number of steps a pair of points (x(t(cid:48) s)) such that one of the species has populations of exactly the same size in x(t(cid:48) s)), with- out increasing d∞(x(t(cid:48) s)) too much. Let a be the species such that the value of xa+1(ts)− xa+2(ts) is maximized over a ∈ {1, 2, 3} (a represents the species which is most likely to grow quickly in the next few steps). We then continue to evolve that of the walks x(ts), y(ts), which has a smaller size of population a, while the other walk remains paused throughout this phase. The phase ends at a time t(cid:48) s). We restrict ourselves to a consideration of the case when ya(ts) < xa(ts) (walk y progresses, while x is paused). Then, at each of the considered steps ts + t, for 0 ≤ t < n0.5, we have: s), y(t(cid:48) s) and y(t(cid:48) s, such that xa(t(cid:48) s) = ya(t(cid:48) s), y(t(cid:48) ya(ts + t) n (ya+1(ts + t) − ya+2(ts + t)) ≥ E(ya(ts + t + 1) − ya(ts + t)) = ≥ ya(ts) = Ω(n−1−γ). n (ya+1(ts) − ya+2(ts)) − 3t n2 ≥ n−1−γ(xa+1(ts) − xa+2(ts) − 2n−1+ρ) − 3t we obtain that w.v.h.p. the deviation of ya from its expectation is bounded by (cid:101)O( The change of ya in each step of the walk is bounded by 1/n. Applying Azuma's inequality, t/n). n2 = √ Thus, w.v.h.p., for t = cnγ+ρ for a sufficiently large constant c, we have: ya(ts + t) = ya(ts) + Ω(n−1−γcnγ+ρ ≥ ya(ts) + d∞(x(ts), y(ts)) > xa(ts). Thus, the phase is completed within O(nγ+ρ) steps w.v.h.p. At the end of the phase, we have xa(t(cid:48) s)) = O(n−1+γ+ρ). s), and d∞(x(t(cid:48) s) = ya(t(cid:48) s), y(t(cid:48) 30 • Phase 4. In this penultimate phase, we allow both walks to progress simultaneously in each time step starting from step t(cid:48) s until they coalesce, under the following coupling. At time step t(cid:48) s, we arrange the elements of the populations of x(t) and y(t) in linear order, from 1 to n, putting those from population 1 leftmost and those from population 3 rightmost. Every step of a coupling corresponds to drawing a uniformly random pair (i, j) ∈ {1, . . . , n}2 from our random number generator, which corresponds to an interaction in which the i-th and j-th agents in x(t) and y(t) interact with each other (the roles of i and j as predator and prey will be defined later). We label the species of the agents as follows s : {1, . . . , n} → {−1, 1, 2, 3}, where s(i) = 1, 2, or 3 if both of the agents located at the i- th position (counting from the left) in x(t(cid:48) s) belong to the same respective species, and s(i) = −1 otherwise. We remark that by the condition d∞(x(ts), y(ts)) = n−1+γ+ρ, we have that {i : s(i) = −1} = O(n−1+γ+ρ). Note that the labels s are defined at time t(cid:48) s and never change afterwards. The coupling process will be required to finish within T = n0.5−ε time steps of Phase 4. We will only consider the success of the coupling under the event that the generator never makes any agent participate in more than one interaction throughout Phase 4. (By a birthday paradox computation, this event holds with probability 1 − (cid:101)O(n−ε).) s) and y(t(cid:48) We will also condition the success of our coupling on the event that no agent i with s(i) = −1 is chosen to interact throughout the phase (this event holds with probability 1−O(T n−1+γ+ρ) > 1−O(n−ε)). Under these conditions, we define the interactions for a drawn random pair (i, j) in step t of Phase 4 as follows (independently of the step number, until the termination condition x(t) = y(t) is reached): -- If {s(i), s(j)} = {a + 1, a + 2}, then we perform the interaction i → j with probability 0.5 and the interaction j → i with probability 0.5, chosen independently for processes s) = ya(t(cid:48) x(t) and y(t). We recall that species a was defined in Phase 3 so that xa(t(cid:48) s). -- If {s(i), s(j)} (cid:54)= {a + 1, a + 2}, then we perform the interaction i → j for both processes. Notice that since we take into account only the interaction of agents having a positive value of s(i), and we never allow any agent to interact more than once, all interactions performed by agents from population a will have the same outcome for both processes x and y. Thus, we have xa(t) = ya(t) throughout Phase 4, and it suffices to show that a similar equality will hold for the other populations. Equivalently, we will require that Z(t) = X(t)−Y (t) = 0, where the processes X and Y are defined as X = xa+1(t)−xa+2(t) and Y = ya+1(t) − ya+2(t). Let p = = Ω(n−2γ). Observe that X and Y are walk processes along the real line, such that in each step we have Pr[X(t + 1) − X(t) = 1] = p and Pr[X(t + 1) − X(t) = 0] = 1 − p. Likewise, we have independently Pr[Y (t + 1)− Y (t) = 1] = p and Pr[Y (t + 1)− Y (t) = 0] = 1− p. (Note that probability p does not change over time.) Thus, we have that process Z follows a lazy random walk on the integer axis, with Pr[Z(t + 1) − Z(t) = 1] = Pr[Z(t + 1) − Z(t) = −1] = 2p(1 − p) and Pr[Z(t + 1) − Z(t) = 0] = 1 − 2p(1 − p). Since Z(t(cid:48) s)) = nγ+ρ), by the standard properties of hitting times of the random walk, we have that Z(t(cid:48) s + t) = 0 is s) = O(nd∞(x(t(cid:48) {i:s(i)=a+1}·{i:s(i)=a+2} s), y(t(cid:48) n2 achieved within time t = (cid:101)O( we have coalesced to a point x(tf ) = y(tf ) with probability at least 1 − (cid:101)O(n−ε). 2p(1−p) (nγ+ρ)2) = (cid:101)O(n4γ+2ρ), w.v.h.p. Noting that t < T = n0.5−ε, we have that Phase 4 is successfully completed. Overall, at some time tf = t(cid:48) s + t, 1 • Phase 5. After the two processes have coalesced at the end of Phase 4, we allow them to progress under a complete coupling until they reach the same absorbing state. 31 Lemma 4.8 almost completes the proof of Theorem 4.1. We only need to note that the assumption on potential U (x(0)) made in Lemma 4.8 can be applied to any point x meeting the assumptions of Theorem 4.1. The claim of the Theorem clearly holds for all points x such that −12 ≥ U (x) ≥ −γ ln n. Note, however, that the given upper bound on U (x) can be dropped: for any point x having potential too large, we can evolve it arbitrarily until a point with potential at most −12 is reached, and then apply the claim of the Theorem. Finally, we note that the required lower bound on U (x) follows from the assumptions made in Theorem 4.1: if xa > n−0.002 for all a ∈ {1, 2, 3}, then U (x) ≥ 2 ln(n−0.002) + ln 1 3 > n−0.005 for sufficiently large n. We close the paper by remarking about the rate of convergence of RPS to an absorbing state. In the RPS protocol, as soon as one of the populations becomes empty, xa = 0, it is immediate to show that species a + 1, without having any natural predators, will eliminate all representatives of species a + 1, and the system will stabilize to the absorbing state: xa+1 = 1, xa = xa+2 = 0 within O(n log n) steps. To bound the time until the first population is eliminated, we can perform a special case of the analysis from the proof of Theorem 2.1, obtaining an overall bound of (cid:101)O(n2) on convergence time. This corresponds to the quantitative results obtained in the stochastic noise model presented in [12, 23]. Acknowledgment The authors would like to thank Benjamin Doerr for helpful discussions. This research was partially funded by the EU IP FET Proactive project MULTIPLEX, by ANR project DIS- PLEXITY, and by NCN grant DEC-2011/02/A/ST6/00201. References [1] M.A. Abdullah and M. Draief. Global majority consensus by local majority polling on graphs of a given degree sequence. Discrete Applied Mathematics 180:1 -- 10 (2015). [2] D. Angluin, J. Aspnes, Z. Diamadi, M.J. Fischer, and R.Peralta. Computation in networks of passively mobile finite-state sensors. Distributed Computing 18(4):235 -- 253 (2006). [3] D. Angluin, J. Aspnes, and D. Eisenstat. A simple population protocol for fast robust approximate majority. Distributed Computing 21(2):87 -- 102 (2008). [4] D. Angluin, J. Aspnes, D. Eisenstat, and E. Ruppert: The computational power of popu- lation protocols. Distributed Computing 20(4):279 -- 304 (2007). [5] J. Aspnes and E. Ruppert. An introduction to population protocols. In: Middleware for Network Eccentric and Mobile Applications, pp. 97 -- 120. Springer Verlag (2009). [6] L. Becchetti, A.E.F. Clementi, E. Natale, F. Pasquale, R. Silvestri, and L. Trevisan. Simple Dynamics for Majority Consensus. In: Proc. SPAA, pp. 247 -- 256 (2014). [7] I. Chatzigiannakis and P.G. Spirakis. The Dynamics of Probabilistic Population Protocols. In: Proc. DISC, pp. 498 -- 499 (2008). [8] C. Cooper, R. Elsasser, and T. Radzik. The Power of Two Choices in Distributed Voting. In: Proc. ICALP, pp. 435-446 (2014). 32 [9] J. Cruise and A. Ganesh. Probabilistic consensus via polling and majority rules. Queueing Systems: Theory and Applications, 78(2):99 -- 120 (2014). [10] M.H. DeGroot. Reaching a Consensus. Journal of the American Statistical Association, 69, 118 -- 121 (1974). [11] Z. Diamadi and M.J. Fischer. A simple game for the study of trust in distributed systems. Wuhan University Journal of Natural Sciences 6(1 -- 2):72 -- 82 (2001). [12] A. Dobrinevski and E. Frey. Extinction in neutrally stable stochastic Lotka-Volterra models. Phys. Rev. E 85:051903 (2012). [13] Y. Hassin and D. Peleg. Distributed probabilistic polling and applications to proportionate agreement. Information & Computation 171(2):248 -- 268 (2001). [14] J. Hofbauer and K. Sigmund. Evolutionary Games and Population Dynamics. Cambridge University Press (1998). [15] B . Kerr, M.A. Riley, M.W. Feldman, and B.J.M. Bohannan. Local dispersal promotes biodiversity in a real-life game of rock-paper-scissors. Nature 418(6894):171 -- 174 (2002). [16] B.C. Kirkup and M.A. Riley. Antibiotic-mediated antagonism leads to a bacterial game of rock-paper-scissors in vivo. Nature 428(6981):412 -- 414 (2004). [17] X. Koegler. Population protocols, games, and large populations. PhD thesis, Universit´e Paris Diderot (2012). [18] D.A. Levin, Y. Peres, and E.L. Wilmer. Markov chains and mixing times. American Math- ematical Society (2006). [19] A.J. Lotka. Contribution to the Theory of Periodic Reactions. J. Phys. Chem. 14(3):271 -- 274 (1910). [20] G.B. Mertzios, S.E. Nikoletseas, C. Raptopoulos, and P.G. Spirakis. Determining Majority in Networks with Local Interactions and Very Small Local Memory. In: Proc. ICALP, pp. 871 -- 882 (2014). [21] O. Michail, I. Chatzigiannakis, and P.G. Spirakis. New Models for Population Protocols. Morgan & Claypool Synthesis Lectures on Distributed Computing Theory (2011). [22] M. Parker and A. Kamenev. Extinction in the Lotka-Volterra model. Phys. Rev. E 80:021129 (2009). [23] T. Reichenbach, M. Mobilia M, and E. Frey. Coexistence versus extinction in the stochastic cyclic LotkaVolterra model. Phys. Rev. E 74:051907 (2006). [24] A. Szolnoki, M. Mobilia, L-L. Jiang, B. Szczesny, A.M. Rucklidge, and M. Perc. Cyclic dominance in evolutionary games: a review. J. R. Soc. Interface 11:20140735 (2014). 33
1609.05715
1
1609
2016-09-15T19:05:21
SpectroMeter: Amortized Sublinear Spectral Approximation of Distance on Graphs
[ "cs.DS" ]
We present a method to approximate pairwise distance on a graph, having an amortized sub-linear complexity in its size. The proposed method follows the so called heat method due to Crane et al. The only additional input are the values of the eigenfunctions of the graph Laplacian at a subset of the vertices. Using these values we estimate a random walk from the source points, and normalize the result into a unit gradient function. The eigenfunctions are then used to synthesize distance values abiding by these constraints at desired locations. We show that this method works in practice on different types of inputs ranging from triangular meshes to general graphs. We also demonstrate that the resulting approximate distance is accurate enough to be used as the input to a recent method for intrinsic shape correspondence computation.
cs.DS
cs
SpectroMeter: Amortized Sublinear Spectral Approximation of Distance on Graphs Roee Litman Tel-Aviv University tau.ac.il/roeelitm Alex M. Bronstein Technion, Israel Institute of Technology cs.technion.ac.il/bron ij ij ij ij ij Exact polyhedral [24] N/A∗ (cid:5) 2.3s Fast Marching [30] 60ms (cid:5) 18ms Heat method [11] 335ms (cid:5) 7ms SpectroMeter 10s (cid:5) 1.5ms full SpectroMeter 15s (cid:5) 0.034ms sublinear Figure 1: Comparison of five methods for distance map calculations on a triangular mesh from the TOSCA [8] dataset. Each result is presented from two viewpoints, underwhich the timiming result for pre-calculations (left) and run-time (right) are presented. Distances are measured from the magenta point on the cat shoulder, and are colormapped from blue (low) to red (high), and equidistant fronts are marked by black contours. The leftmost 'exact' map dictates the colormap values on the other four, as well as the locations of the black contours (set at steps of 10% the maximal distance). Both SpectroMeter maps (two rightmost) are very similar to the exact ones (two leftmost), but obtained with a fraction of the computational cost. Non-differentiable locations are harder to approximate, as in the smoothed cusp is highlighted by a magenta circle. Abstract We present a method to approximate pairwise distance on a graph, having an amortized sub-linear complexity in its size. The proposed method follows the so called heat method due to Crane et al. [11]. The only additional in- put are the values of the eigenfunctions of the graph Lapla- cian at a subset of the vertices. Using these values we esti- mate a random walk from the source points, and normalize the result into a unit gradient function. The eigenfunctions are then used to synthesize distance values abiding by these constraints at desired locations. We show that this method works in practice on different types of inputs ranging from triangular meshes to general graphs. We also demonstrate that the resulting approximate distance is accurate enough to be used as the input to a recent method for intrinsic shape correspondence computation. 1. Introduction navigation, where one searches the best route to traverse a city, minimizing either distance or commute time. An- other common application is packet routing through the in- ternet, where two of the most commonly used algorithms (OSPF [26] and IS-IS [27]) allow multiple machines to col- laboratively find the best route for a packet. Two other common domains of application of distance on graphs are computer graphics and geometry process- ing, where images and shapes are often described as graphs (perhaps, with some additional structure as in the case of meshes). For example, being able to calculate distances be- tween points on a shape allows to represent the intrinsic in- formation in a way invariant to bending or other extrinsic deformations. While existing methods for calculating distances on graphs are very efficient, they are still at least linear in the graph size. This may become prohibitively expensive when the graph is very big or when the number of distance calcu- lations grows. Distances on graphs are used on a daily basis, in many hardware and software applications, sometimes without us being fully aware of it. The best known example is map ∗Pre-calculation time could not be separated from the runtime in the implementation we used. 1 Our contribution. We introduce a spectral method to ap- proximate distances on graphs, given only a few of the eigen functions of the graph Laplacian, possibly sampled at a sub- set of the vertex set. We see two main contributions of this paper: First, we show how to perform pairwise distance ap- proximation in sub-linear time in the size of the graph (ex- cluding some preprocessing). Second, unlike the previous method [11], we do not rely on a discrete divergence oper- ator, which allows extension to types of graphs where such an operator is not trivial to define. 2. Distance maps on graphs There exists a wealth of literature dedicated to distance computation on graphs. A useful dichotomy is to catego- rize such algorithms into heap based methods that gradu- ally propagate distances over the graph, usually accessing its vertices in an unpredictable order, and stack based meth- ods operating on the entire vertex set or on pre-fixed subsets thereof. 2.1. Heap based methods Heap-based approaches for the computation of distances on graphs have been dominant until, probably, the last decade. One of the first such algorithms was suggested by Dijksrta [14], solving the shortest path problem for any directed graph with n vertices in O(n log n). Mitchell et al. [24] extended this algorithm to polyhedral meshes, pro- viding an exact solution for the discrete geodesic distance computation in O(n2 log n). It was later shown by Surazh- sky et al. [33] that an approximation with rather low worst- case error bounds can be achieved in O(n log n). Since graphs often constitute a discretization of a con- tinuous domain, the question of consistency with the con- tinuous geodesic distances naturally arises. While discrete geodesics are often inconsistent, "sampling theorems" have been derived guaranteeing the convergence of the discrete solution to the continuous one under certain conditions [5]. When a manifold is discretized as a graph satisfying these conditions, the discrete geodesic distances computed on it are guaranteed to converge to the continuous ones. As an alternative to solving a discrete geodesic problem, another line of approaches suggests to discretize directly the par- tial differential equation governing the distance map on the underlying continuous domain, (cid:107)∇d(cid:107) = 1 s.t. dsource = 0, known as the eikonal equation. Sethian [30] and Tsitsik- lis [36] have independently developed an efficient eikonal solver having O(n log n) runtime, which is essentially a continuous variant of Dijkstra's algorithm. This method, known as the fast marching method (FMM), was later ex- tended from regular grids to other types of graphs like tri- angular meshes [19] and point clouds [22], just to mention a few. A faster version was introduced by Yatziv et al.[42], solving at O(n) at the cost of quantizing the distances. Even though the mentioned methods differ in the types of data handled and the specific calculations performed, they are all dynamic programming algorithms and share the property of gradually propagating the distance calcu- lation from the source(s) to the rest of the vertices. One potential advantage of this is that one can stop the calcula- tion before covering the entire graph once the destination is achieved, saving time for 'close' distances. However, as a result of their inherent sequential structure and data- dependent access to memory, these methods are hard to parallelize and implement efficiently on modern computer architectures. Furthermore, they usually cannot reuse the calculations from previous runs. 2.2. Stack based methods The other category of algorithms, in contrast to the for- mer, operate on the entire vertex set or fixed subsets thereof. One line of methods that provide a fast approximation of FMM are called fast sweeping, and can be dated back to Danielsson [13] who proposed to calculate a complete Eu- clidean distance map using only four 'sweeps' of a 2D plane in O(n). The method was later expanded to other types of manifolds, as formally suggested by Zhao [43], after it was implicitly used in other works [44, 34, 35]. Even though these methods have O(n) complexity, their main drawback is that for some manifolds it might require several repeti- tions to achieve sufficient accuracy, up to O(2n) for an exact solution, as shown by Hysing et al. [17]. A highly parallel variant called parallel marching was suggested by Weber et al. [40], who proposed to decompose the surface into reg- ular grids, solving each in a manner similar to [13]. Even though parallel marching requires a low-distortion param- eterization into quadrilateral patches, it is still one of the fastest implementations of surface distance computation to date. The newest line of works in this category follows the heat method by Crane et al. [11], which will be covered in greater detail in the sequel. Finally, we would like to mention a recent work by Aflalo et al. [3], where spectral-based distance approxima- tions are also performed as the input of a subspace param- eterized multidimensional scaling (MDS) problem. While this approach performs some approximation in a manner seemingly similar to ours, we will show in the sequel that it does not scale to general pairwise distance approximations. 3. Background Prior to detailing how the heat method works, we briefly review some preliminaries, mainly regarding graph Lapla- cian. Graph Laplacian. Let G = (V, E) be an undirected graph with V = n vertices. Let the graphs edges be fur- ther equipped with nonnegative weights {wij}, defining the n × n weighted adjacency matrix of the graph as Graph geodesics. A path on the graph is a sequence of p vertices P = {v1, . . . , vp} ∈ V , where each consecutive pair is one of the graph edges, i.e. (vi, vi+1) ∈ E. The length of a path P is the sum of all its edge weights, (cid:40) [W]ij = wij, 0, if (i, j) ∈ E otherwise. (cid:88) Additionally, the vertex degree matrix is an n × n diagonal matrix, whose elements are usually defined as [A]ii = aii = wij. (1) j The unnormalized Laplacian of a graph is defined as the n×n matrix Lu = A−W. As with all Laplacians, it is easy to observe that the sum of all rows and columns is zero. For an undirected graph, the Laplacian is a symmetric positive semidefinite matrix. For other properties of the Laplacian, the reader is referred to [25]. One of the ways to normalize the Laplacian adopted here is the so-called random walk Laplacian [21, 10], defined as Lrw = A−1Lu = I − A−1W. (2) The name stems from its relation to the row-stochastic tran- sition probability matrix P = I − Lrw. Mesh Laplacian. A triangular mesh is a specific type of graph, realizing a homogeneous simplicial complex of or- der 2. Since meshes typically represent continuous geo- metric objects (manifolds), specific constructions of mesh Laplacians exist that consistently discretize some properties of the Laplace-Beltrami operator (LBO) of the underlying continuous manifold. Mesh Laplacians have been exten- sively used in geometry processing; for a review, the reader is referred to [31]. We adopt the popular cotangent weight scheme first formalized in its current form by Meyer et al. [23]. Under this scheme, the n × n stiffness matrix Lc is constructed as an unnormalized Laplacian whose edge weights are j α β i wij = 1 2 cot(α) + cot(β), with α and β being the two angles facing the edge (i, j), and the diagonal of degree matrix is the same as in (1). This scheme also defines the mass matrix M whose elements are 3 the area of all triangles incident [M]ii = mi, where mi is 1 on vertex i. Finally, the mesh Laplacian is defined as Lm = M−1Lc. p−1(cid:88) L(P ) = wvi,vi+1. i=1 A shortest path (also known as minimum geodesic on a con- tinuous manifold) between two vertices v and v(cid:48) is a path starting at v1 = v and ending at vp = v(cid:48) whose length is minimum over all such paths. Note that a minimizer might not be unique as there might be several such paths. As mentioned previously, sometimes graphs are used as a discretization of a continuous manifold. In these cases the above definition of a geodesic has to be relaxed in order to allow convergence of the discrete solution to the continues one [5]. Paths on a mesh, for example, will not be restricted to the edges and are allowed to traverse the faces. Discretized gradient. We follow the definition of the in- trinsic gradient for triangular meshes from [11], for the ease of comparison. Other realizations exist, e.g., by Pokrass et al. [28]. Let f be a piece-wise linear function on the mesh defined by the values fi on the vertices. Let δ be a triangle formed w.l.o.g. by the vertices 1, 2 and 3 with the corresponding function values f1, f2 and f3. The gradient of f on δ is constant and is defined by 3(cid:88) i=1 ∇δ = 1 2 · area(δ) fi (ns × ei) (3) where ns is the normal to δ, and ei is the edge opposing vertex i oriented counterclockwise. In a general (non-mesh) graph, we can no longer rely on faces, and define the gradient on edges. Specifically, an edge e = (vi, vj) whose vertices have scalar values {fi, fj} will have a gradient ∇eij = (fi − fj) /wij. 3.1. The heat method A recent seminal work by Crane et al. [11] proposed a new approach to distance calculation dubbed as the heat method. This method, which is extended in this paper, is summarized in Algorithm 1. While we focus on the specific realization of the heat method on triangular meshes, it is more general and can be applied to other types of data, as mentioned in [11]. The key idea behind the heat method stems from Varad- han's equation [37]: it can be shown that the solution ut of the heat equation (M + tLc) ut = u0 (4) input : Laplacian L, Gradient ∇, Divergence ∆, time value t0 and origin point(s) output: Distance map d 1. Solve the heat equation (4) from the source point(s) for time value t, obtaining ut. 2. Calculate the gradient of the result ut, and normal- ize to unit length according to (5), obtaining(cid:98)g. normalized gradient(cid:98)g, obtaining d. 3. Solve Poisson equation (6) for the divergence of the Algorithm 1: The Heat method [11] describing the heat distribution at time t is a function whose gradient direction coincides with that of a distance map from the same source (yet, unlike the distance map, the gra- dient magnitude (cid:107)∇ut(cid:107) is not necessarily unit). The initial heat placement u0 at t = 0 is a discretized Dirac distribu- tion, having 1 in the source location(s) and 0 elsewhere. Following this observation, we can normalize the gradi- ∇ut (cid:107)∇ut(cid:107) , ent of ut to unit length(cid:98)g = divergence of the normalized gradient(cid:98)g Lcd = ∇ ·(cid:98)g. and solve Poisson's equation for the distance map d from the same source such that its Laplacian coincides with the (5) (6) We did not specify here the exact implementation of the divergence operator for triangular mesh, and refer the reader to Section 3.2 in [11] for details. Note however, that the discretization or even a consistent definition of this operator on more general graphs is a limitation of the heat method. In what follows, we describe an alternative technique for distance map calculation similar in spirit to the heat method, yet relying only on the gradient but not on the divergence. 4. Proposed method - SpectroMeter The proposed method which we dub SpectroMeter can be thought of as a variant of the heat method [11] in the spectral (frequency) domain. The details of the method are given in the following section and are summarized in Al- gorithm 2. The proposed method relies on several spectral properties of the Laplacian that we briefly highlight next. Laplacian Spectrum. Spectral graph theory is a vast field with numerous and ramified applications [25, 12]. For ex- ample, a recent tutorial by von Luxburg [39] covers ap- plications of different types of Laplacians to clustering input : Laplacian eigenfunctions Φ, their gradient ∇Φ, O(k) locations, origin point(s) output: Approximate distance map 1. Calculate the heat kernel ht from the source points at the given O(k) locations on the mesh, according to (7). 2. Calculate ∇ht the gradient of ht at these locations and normalize to unit length(cid:98)g = ∇h/(cid:107)∇h(cid:107) . 3. Find coefficients a that best approximate (cid:98)g, i.e. (cid:98)g ≈(cid:80)k i=1 ai∇φi, according to (8). 4. Set the first coefficient(s) ai corresponding to con- stant φi's so that the result is non-negative (or has zero value at the source). 5. Synthesize approximate distance at desired loca- tion(s) x according to d(x) = φ(x)a. Algorithm 2: SpectroMeter - the proposed sublinear dis- tance map approximation algorithm. The full (non- sublinear) flavor of this algorithm simply uses all the graph points rather than the given O(k) samples. and graph-cuts. Being essentially an averaging operator, graph Laplacian excels at promoting smooth functions on the graph [31], and specifically, it has been shown that the Laplacian eigenbasis is optimal in the (cid:96)2 sense for the ap- proximation of smooth functions [2]. We denote the eigendecomposition of a Laplacian L as Lφi = λiφi, with λi and φi being the eigenvalues and the corresponding eigenfunctions. We will assume ordering by increasing value of λi. It is easy to show that the smallest eigenvalue λ0 has the value 0 with a constant correspond- ing eigenvector and has multiplicity equal to the number of connected components in the graph. Preprocessing. As with the other distance methods [30, 11], some of the calculations have to be done for any input, and can be pre-computed and stored to reduce the amortized cost of distance computation. The proposed technique, being a spectral method, relies on first performing eigendecomposition of the graph Lapla- cian. Specifically, we require the first smallest k (cid:28) n eigenvalues and the corresponding eigenfunctions. These low-frequency harmonics can be reused for many other tasks relying on the Laplacian spectrum. We henceforth denote the truncated eigenbasis collectively by the matrix Φ = (φ1, . . . , φk). Next, we also calculate the (intrisic) gradients of all the eigenvectors (the constant one(s) have vanishing gradients), denoting the results collectively as ∇Φ = (∇φ1, . . . ,∇φk). Finally, we sample the graph at O(k) locations, prefer- ably using farthest point sampling [15] (FPS) based on an 'exact' method like FMM. This sampling is used for the sublinear version of the algorithm, as detailed in the sequel. k(cid:88) Heat in the spectrum. The major difference between [11] and the proposed method is that the solution is done in the spectral domain. This has two implications. First, the heat equation (4) can be solved using the eigenbasis. One way to do this is to apply the Woodbury matrix inversion identity [41] to (4), which will still cost at least O(n2) and might be inaccurate. We chose to approximate the solution directly through the spectrum (following, e.g., [32]) as the truncated series ht(xs, y) = e−λitφi(xs)φi(y). (7) i=1 The function ht(xs, y) approximates as the heat kernel, which measures the amount of heat that flows from a source point xs to point y after time t. For the case of multiple (or non-point) sources, the solution for a set of source points χs = {xi}s i=1 is the average of the heat kernel of all source ht(xi, y). We will henceforth de- points, ht(χs, y) = 1 s note the values of ht(xs, y) at all vertices y, and averaged over all sources χs in the graph as ht. (cid:80) i In essence (7) is the spectral approximation of the solu- tion of the 'exact' heat diffusion (4), but is more efficient as it can be done in O(nk) instead of O(n2) with k (cid:28) n. The approximation is accurate as long as the time constant t is sufficiently big and the residual of the truncated series (7) is small. This formulation allows further acceleration down to O(k2) as described in the sequel. The second implication is that we no longer need to solve the full n × n Poisson equation (6), but rather find a set of k Fourier coefficients a defining a low-rank approximation of the function g = Φa, such that its gradient ∇d = ∇Φa is the closest in the (cid:96)2 sense to the normalized gradient g = ∇ht/(cid:107)∇ht(cid:107) of the approximate heat kernel, resulting in the following closed-form expression (cid:107)(cid:98)g − ∇Φa(cid:107)2 = (∇Φ)†(cid:98)g, a∗ = argmin a (8) where † marks pseudo inverse. Note that this formulation does not rely on the divergence operator. Since the coef- ficient(s) of the constant eigenfunction(s) cannot be deter- mined from (8) (as the corresponding gradients vanish), we set them to make the entire map non-negative or zero at the source. Random walk. The only difference for general (non- mesh) graphs is that the heat equation is replaced with ran- dom walk process, where the notion of 'heat' is replaced with probability of arrival at a location y after t steps. We follow the definition from [39] for this probability (cid:98)ht(xs, y) = k(cid:88) (1 − λi)t φi(xs)φi(y), (9) i=1 where here {λi, φi} are the eigenvalues and the correspond- ing eigenfunctions of the random-walk laplacian Lrw. Sublinear approximation. Both the approximation of the heat kernel (7) and the solution of (8) are O(nk). How- ever, we observe that both (7) and (8) are highly over- determined, in the case of k (cid:28) n, and still can be solved un- ambiguously if only a subset of O(k) graph vertices is con- sidered. This reduces the overall complexity of the method to O(k2), which is sublinear in n. This excludes, of course, the pre-computation mentioned above which costs no less than o(nk) for eigen decomposition, then O(nk log n) for FPS, and finally O(k3) for the matrix inversion in (8). It is important to emphasize that this sublinear complex- ity is for a single pairwise distance, and increasing the num- ber of sources or destinations will increase the overall com- plexity. For example, approximating the distance from one point to the entire vertex set will still cost O(nk). That said, empirical results show that our method is still considerably faster than all mentioned methods, even in the latter case. In practice we sample the graph using FPS based on one of the 'exact' method mentioned previously. The minimum amount of samples is the number of non-constant eigen- functions. We use an amount of distinct samples slightly higher than what makes ∇Φ in (8) numerically full rank. A similar sampling is performed by Aflalo et al. [3], but is not limited by the basis size O(k), nor can it be general- ized to full distance computation, as shown below. Finding optimal value of t. In [11], the time value t in the heat equation was set to be the squared average edge length, based on discretization arguments. This selection seem to work in practice for most shapes even though there is no worst-case guarantee, and still failing in some isolated cases (e.g. in Figure 1 we had to use ten times the latter value). As shown in [8], the spectral heat kernel in (7) does not depend on the discretization, but does not scale trivially with the global scaling of the shape. A scale agnostic ver- sion of (7) would then be ht(xs, y) = tr(M) e−λittr(M)φi(xs)φi(y), (10) k(cid:88) i=1 basis size relative (cid:96)2 (cid:96)∞ 25 4.28 1.36 4.90 50 2.51 0.87 3.18 100 1.79 0.64 2.39 250 0.77 0.29 1.39 350 0.60 0.24 1.15 500 0.43 0.17 0.96 Table 1: Average error of projecting FMM distance on the Laplacian basis of the cat shape (26 × 103 vertices) from TOSCA [8] shown in Figure 1. Shown for different number of harmonics are the (cid:96)2 and (cid:96)∞ errors in % of intrinsic di- ameter as well as the relative error in %. The (cid:96)∞ error does not decay fast due to the Gibbs phenomenon [16]. The er- rors are averaged over several runs with difference source points. full, which uses the vors of SpectroMeter will be tested: entire vertex set, and sublinear, which uses only the pre- defined O(k) samples. For comparison, we used a Matlab mex implementation of FMM from the authors of [19], and a Matlab implementation of the Heat method accelerated by the CHOLMOD algorithm [9], used originally in [11]. We chose not to compare to the exact geodesic distance on polyhedra [24] in the large scale experiments, as its results are very similar to FMM result (less than 0.5% error), while the computational time is prohibitively slow. dref + Errors are measured using the (cid:96)2 and (cid:96)∞ norms, normal- ized by the graph diameter. Another criterion we measure is relative error, defined as d−dref for a result d versus a reference value of dref . We emphasize that latter error is somewhat biased against our method: errors of spectral rep- resentation usually concentrate in points where the function is non-differentiable, e.g., at the sources, where the relative error is most sensitive (small denominator). Nevertheless, we include these statistics here as it was used in previous studies [3, 11, 33] to which we compare. 5.1. Spectral representation accuracy First, we test the accuracy of projecting (essentially, compressing) distance maps on the Laplacian eigenbasis. Table 1 shows reconstruction error of FMM distance maps, averaged over the shapes from Figure 2, using different numbers of harmonics. As suggested by [2], the (cid:96)2 error is decaying very fast, and is quite negligible even for k = 100 harmonics. We attribute this to the fast decay of coefficients of distance maps, which can be shown to be quadratic for Euclidean domains [1]. The (cid:96)∞ error does not decay as fast, which can be related to the Gibbs phenomenon [16]. Next, for comparison, we repeat the experiment only this time using SpectroMeter sublienar (full has very similar stats). The result, summarized in Table 2, suggest that our method achieves maximum performance around k = 250 harmonics after which diminishing returns are observed. This as well, may be due to the fast decay of coefficients [1]. Since this result was consistent across many shapes we Figure 2: Average error (measured relative to FMM and nor- malized by the shape diameter) as a function of the multiplier m in the selection of the time parameter t = m tr(M). Each curve corresponds to a shape set from Table I in [11] or from the TOSCA dataset [8]. Notice that in most examples a uni- form setting m = 8 × 10−3 is close to the shape-specific optimal parameter value (black dots) and yields mean er- ror below 5% (dashed line). This figure was inspired by its counterpart in [11]. where tr(M) is the shape area. In a manner similar to [11], we also choose define the time value t by empirically setting a multiplier m t = m tr(M). (11) Testing on several shapes from various sources, we set m = 8 × 10−3, as can be drived from Figure 2. Note, that while in [11] the time value is discretization dependent, our time value depends only on the total area of the shape. Comparison to spectral MDS. As mentioned previously, one part of the Spectral MDS (SMDS) method [3] includes distance calcu- lations seemingly similar the Spec- troMeter. This part of the SMDS algorithm includes interpolation of distance maps sampled on a sparse set of points, based on a projection SMDS [3] on the Laplacian eigenbasis. While [3] report very low reconstruction errors, these are true only for maps whose origin is close to one of the former samples. If one would use the same method with origin far from these samples, the result will look similar to the result of (7), i.e. non-unit magnitude gradients with the correct direction (as can be seen in the inset). FMM [19] 5. Experimental evaluation In what follows, we assess the actual performance of the discussed approximation method compared to the 'exact' methods, and highlight some of its limitations. Two fla- 10-310-210-1multiplier10-210-1Average error basis size relative (cid:96)2 (cid:96)∞ 50 25 250 100 9.93 55.86 32.41 15.80 6.35 19.33 2.84 2.88 22.14 7.46 6.88 46.17 500 350 9.74 9.81 3.10 7.65 13.63 37.05 Table 2: Average error of our method compared to FMM, in the same setting as Table 1. It can be seen that our method achieves its best performance at k = 250, and does not improve with more harmonics, which can be attributed to the fast decay of coefficients [1] in the presence of noise. The relative error is high since spectral reconstruction has high error around non-differentiable areas like the source. Figure 3: Runtime of different methods, on different graph sizes. Presented is the time for calculating pairwise distance from 15% of the vertices to all the rest on a sphere mesh. Shown are: FMM, Heat method and SpectroMeter, both full and sublinear. Even though this task has quadratic complex- ity, our method scales better than the exact ones, even when counting the complexity of basis construction (marked 'LBO' in the plot). tested, in all the following experiments we set k = 250. 5.2. Complexity analysis In order to measure how all methods scale with the graph size, we ran them on an implicit shape discretized as a mesh, with gradually increasing vertex count. For each mesh, we measured the distance from 5% of the vertices to all the rest. Note that due to the size of the result, this task has quadratic complexity in the size of graph, even for our sub- linear method. As can be seen in Figure 3, our approach outperforms the other ones, and the incline of the sub-linear flavor of our method is the lowest. If we include the eigen- decomposition into the timing, both SpectroMeter imple- mentations are still faster for large graphs. Table 3 shows error of the latter experiment compared to FMM. While the errors of SpectroMeter are roughly twice as high as the heat method, it scales more gracefully for larger graphs. 5.3. Distance on a nearest neighbor graph One of the contributions of this work is that we do not need do define a divergence operator. This allows us to method heat method [11] full sublinear # vertices err type relative (cid:96)2 (cid:96)∞ relative (cid:96)2 (cid:96)∞ relative (cid:96)2 (cid:96)∞ 0.6K 2.5K 10K 20K 3.24 1.35 1.95 6.25 2.37 2.92 6.23 2.36 2.92 2.19 0.92 1.42 6.53 2.39 3.41 6.53 2.39 3.40 1.52 0.66 1.08 6.32 2.27 3.69 7.17 2.26 3.67 1.11 0.51 0.86 6.09 2.16 3.82 6.77 2.13 3.79 Table 3: Errors of distance methods w.r.t. to an FMM result on the same corpus, measured in % of the intrinsic diameter of a sphere mesh with different vertex count. apply the method on non-manifold graphs, for example a graph generated by running k nearest neighbors (k-NN) on data from a Euclidean domain. We generated a graph from 7-NN of 3 × 103 points in R5, which resulted in a graph Laplacian with similar sparsity to the meshes in other ex- periments. Figure 4 depicts distance maps from three source points, visualized in two dimensions using t-SNE [20]. The result- ing maps are very similar to the exact ones generated using Dijkstra's method [14], but require a fraction of the compu- tational cost. In order to give a qualitative measure for the results, we sorted the vertices according to the resulting distance in each map separately, and measured Kendel's τ [18] as the permutation distance τ = # discordant pairs n (n − 1) / 2 , (12) compared to Dijkstra's result. On average, projection onto the Laplacian eigenbasis gave 12% error, while both types of SpectroMeter gave 14% error. While this may seem high, note that random guess results in 50% error, and the prob- ability of randomly achieving error below 30% vanishes quickly even for permutations with n = 50. 5.4. Shape correspondence We now show our methods' result on a recent method for shape correspondence by Vestner et al. [38]. Due to lack of space, this section is not self-contained, as we only cover the parts relevant for this work. We refer the reader to the aforementioned manuscript for details. In a nutshell (skip- ping all theoretic justification), the latter method finds bijec- tive correspondence by solving a linear assignment problem (LAP) over all the vertices Π∈P tr(cid:0)exp(−D2/σ2)Π0D1Π(cid:1) , Π∗ = min (13) 0.5K1.0K4.0K16.0K64.0K# of vertices10-210-1100101102103runtime [sec]FMMHeatMethodSpectroMeter fullSpectroMeter sublinearSpectroMeter full + LBOSpectroMeter sublinear + LBO Exact Spectrally- projected SpectroMeter SpectroMeter Dijkstra [14] Dijkstra [14] Full Sublinear Figure 4: Distance maps produced by four methods on a graph created using 7-NN in R5. The graph vertices are visualized in 2D using t-SNE [20]. Shown in each row is a results for a different source, color mapped from blue (small distance) to red (large distance). where D1 and D2 are pairwise distance matrices, exp is element-wise exponent, Π0 is an initial correspondence guess (possibly non bijective) and P is the set of all pos- sible permutations of size n. LAP has an O(n3) worse-case complexity, but can be solved in O(n2 log n) operation on average using the auction method [6] (taking, e.g., a few seconds for a problem of size n = 103). In practice, the smooth geometry of the problem allows further multi-scale acceleration, which makes the LAP cost matrix sparse (zero entries indicate forbidden matches). In the particular case of triangular meshes, truncating the pairwise distance matrices at 5% of the diameter we can achieve about 99% sparsity, allowing solution of a large LAP problem of size n = 104 in about one minute. The main bottleneck that remains is the calculation of the full pairwise distance matrices. We tested the correspondence method on the FAUST dataset [7] containing 3D scans of human shapes with 7 × 103 vertices. We solve LAP using the sparse auction solver publicly provided by the authors of [4]. The initial guess input Π0 was a obtained by using the current state- of-the-art correspondence method by Rodol`a et al. [29] on a coarse version of the shape with 2×103 vertices, and inter- polating the result to full resolution using nearest neighbors. Note that the initial guess method [29] also uses the Lapla- cian eigendecomposition, making Spectrometer's complex- ity even more attractive in this case: Average run times in seconds (excluding LAP) is 260 for FMM [19], 120 for the heat method [11], compared to 42 and 24 respectively for the full and sublinear flavors of SpectroMeter. Figure 5 shows results of the method [38] using several Figure 5: Performance of the shape correspondence method from [38] on the FAUST dataset [7], based on different dis- tance methods as input. Dashed lines indicate that the dis- tance was projected onto the LBO basis (i.e. compressed). SperctroMeter yields slightly lower results due to the fact it is an approximation, but can further scale up to very big shapes. distance methods as input. We also tested the effect of pro- jecting the distance matrix onto the Laplacian eigenbasis. While the performance is lower for Spectrometer compared to the exact distance, the overall method of [38] becomes more scalable as it can be run for shapes of very high vertex count. 6. Conclusion We presented an algorithm allowing to approximate pair- wise distances on sparsely-connected graphs (such as, for example, triangular meshes) in sub-linear time given the low-frequency eigenfunctions of the Laplacian. Empirical evidence exhibits very good (cid:96)2 approximation errors and reasonable (cid:96)∞ errors. Similarly to both the heat method [11] and FMM [30], the obtained distance map might violate the triangle in- equality or distance symmetry. For similar reasons, it is possible that these distance maps cannot be used to compute the geodesics themselves via back-tracking, due to possible existence of local extrema along the path. The influence of boundary conditions that has been ig- nored here deserves attention. Additionally, we would like to devise a criterion more robust than (cid:96)2 for the solution of (8). Lastly, but most importantly, rigorous theoretical bounds on the average and worst-case approximation errors shall be developed. Acknowledgments RL is supported by the European Google PhD fellow- ship in machine learning. AB is supported by ERC StG RAPID 335491. The authors are grateful to Dana Berman, Or Litani, and the anonymous reviewers, for many helpful pointers. 012345678910Geodesic error [% of diameter]5060708090100% of verticesFMMFMM projheat methodheat method projSpectroMeter fullSpectroMeter sublinear References [1] The fourier transform of absolute value of t. http://www.thefouriertransform.com/ pairs/absT.php. Accessed: 2016-07-11. 6, 7 [2] Y. Aflalo, H. Brezis, and R. Kimmel. On the optimal- ity of shape and data representation in the spectral do- main. SIAM Journal on Imaging Sciences, 8(2):1141– 1160, 2015. 4, 6 [3] Y. Aflalo and R. Kimmel. Spectral multidimensional scaling. Proceedings of the National Academy of Sci- ences, 110(45):18052–18057, 2013. 2, 5, 6 [4] F. Bernard, N. Vlassis, P. Gemmar, A. Husch, J. Thun- berg, J. Goncalves, and F. Hertel. Fast correspon- dences for statistical shape models of brain structures. In SPIE Medical Imaging, pages 97840R–97840R. In- ternational Society for Optics and Photonics, 2016. 8 [5] M. Bernstein, V. De Silva, J. C. Langford, and J. B. Tenenbaum. Graph approximations to geodesics on embedded manifolds. Technical report, Technical re- port, Department of Psychology, Stanford University, 2000. 2, 3 [6] D. P. Bertsekas. Network optimization: continuous and discrete models. Citeseer, 1998. 8 [7] F. Bogo, J. Romero, M. Loper, and M. J. Black. FAUST: Dataset and evaluation for 3D mesh regis- tration. In Proceedings IEEE Conf. on Computer Vi- sion and Pattern Recognition (CVPR), Piscataway, NJ, USA, June 2014. IEEE. 8 [8] A. M. Bronstein, M. M. Bronstein, and R. Kimmel. Numerical geometry of non-rigid shapes. Springer Science & Business Media, 2008. 1, 5, 6 [9] Y. Chen, T. A. Davis, W. W. Hager, and S. Rajaman- ickam. Algorithm 887: Cholmod, supernodal sparse cholesky factorization and update/downdate. ACM Transactions on Mathematical Software (TOMS), 35(3):22, 2008. 6 [10] F. R. Chung. Spectral graph theory, volume 92. Amer- ican Mathematical Soc., 1997. 3 [11] K. Crane, C. Weischedel, and M. Wardetzky. Geodesics in Heat: A New Approach to Computing Distance Based on Heat Flow. ACM Trans. Graph., 32, 2013. 1, 2, 3, 4, 5, 6, 7, 8 [12] D. M. Cvetkovi´c, M. Doob, and H. Sachs. Spectra of graphs: theory and application, volume 87. Academic Pr, 1980. 4 [13] P.-E. Danielsson. Euclidean distance mapping. Com- puter Graphics and image processing, 14(3):227–248, 1980. 2 [14] E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269–271, 1959. 2, 7, 8 [15] Y. Eldar, M. Lindenbaum, M. Porat, and Y. Y. Zeevi. The farthest point strategy for progressive image sam- IEEE Transactions on Image Processing, pling. 6(9):1305–1315, 1997. 5 [16] E. Hewitt and R. E. Hewitt. The gibbs-wilbraham phe- nomenon: an episode in fourier analysis. Archive for history of Exact Sciences, 21(2):129–160, 1979. 6 [17] S.-R. Hysing and S. Turek. The eikonal equation: numerical efficiency vs. algorithmic complexity on quadrilateral grids. In Proceedings of ALGORITMY, volume 2005, pages 22–31, 2005. 2 [18] M. G. Kendall. A new measure of rank correlation. Biometrika, 30(1/2):81–93, 1938. 7 [19] R. Kimmel and J. A. Sethian. Fast marching methods In Proceedings of the Na- on triangulated domains. tional Academy of Science, volume 95, pages 8341– 8435, 1998. 2, 6, 8 [20] L. v. d. Maaten and G. Hinton. Visualizing data us- Journal of Machine Learning Research, ing t-sne. 9(Nov):2579–2605, 2008. 7, 8 [21] M. Meila and J. Shi. A random walks view of spectral segmentation. 2001. 3 [22] F. M´emoli and G. Sapiro. Distance functions and geodesics on submanifolds of \rd and point clouds. SIAM Journal on Applied Mathematics, 65(4):1227– 1260, 2005. 2 [23] M. Meyer, M. Desbrun, P. Schroder, and A. H. Barr. Discrete differential-geometry operators for triangu- lated 2-manifolds. In Visualization and mathematics III, pages 35–57. Springer, 2003. 3 [24] J. S. Mitchell, D. M. Mount, and C. H. Papadim- itriou. The discrete geodesic problem. SIAM Journal on Computing, 16(4):647–668, 1987. 1, 2, 6 [25] B. Mohar. The laplacian spectrum of graphs. In Graph Theory, Combinatorics, and Applications, 1991. 3, 4 [26] J. Moy. Ospf version 2. 1997. 1 [27] D. Oran. Osi is-is intra-domain routing protocol. 1990. 1 [28] J. Pokrass, A. M. Bronstein, and M. M. Bronstein. A correspondence-less approach to matching of de- In International Conference on formable shapes. Scale Space and Variational Methods in Computer Vi- sion, pages 592–603. Springer, 2011. 3 [29] E. Rodola, M. Moeller, and D. Cremers. Point-wise map recovery and refinement from functional corre- In International Symposium on Vision, spondence. Modeling and Visualization (VMV), 2015. 8 from unorganized data using a variational level set method. Computer Vision and Image Understanding, 80(3):295–314, 2000. 2 [30] J. A. Sethian. A fast marching level set method for monotonically advancing fronts. Proceedings of the National Academy of Sciences, 93(4):1591–1595, 1996. 1, 2, 4, 8 [31] O. Sorkine. Differential representations for mesh pro- In Computer Graphics Forum, volume 25, cessing. pages 789–807. Wiley Online Library, 2006. 3, 4 [32] J. Sun, M. Ovsjanikov, and L. Guibas. A concise and provably informative multi-scale signature based on heat diffusion. In Computer graphics forum, vol- ume 28, pages 1383–1392. Wiley Online Library, 2009. 5 [33] V. Surazhsky, T. Surazhsky, D. Kirsanov, S. J. Gortler, and H. Hoppe. Fast exact and approximate geodesics on meshes. In ACM transactions on graphics (TOG), volume 24, pages 553–560. ACM, 2005. 2, 6 [34] Y.-h. R. Tsai. Rapid and accurate computation of the distance function using grids. Journal of Computa- tional Physics, 178(1):175–195, 2002. 2 [35] Y.-H. R. Tsai, L.-T. Cheng, S. Osher, and H.-K. Zhao. Fast sweeping algorithms for a class of hamilton– jacobi equations. SIAM journal on numerical analysis, 41(2):673–694, 2003. 2 [36] J. N. Tsitsiklis. Efficient algorithms for globally op- IEEE Transactions on Automatic timal trajectories. Control, 40(9):1528–1538, 1995. 2 [37] S. R. S. Varadhan. On the behavior of the fundamental solution of the heat equation with variable coefficients. Communications on Pure and Applied Mathematics, 20(2):431–455, 1967. 3 [38] M. Vestner, R. Litman, A. Bronstein, E. Rodola, and D. Cremers. Bayesian inference of bijective arXiv preprint non-rigid shape correspondence. arXiv:1607.03425, 2016. 7, 8 [39] U. Von Luxburg. A tutorial on spectral clustering. Statistics and computing, 17(4):395–416, 2007. 4, 5 [40] O. Weber, Y. S. Devir, A. M. Bronstein, M. M. Bron- stein, and R. Kimmel. Parallel algorithms for approxi- mation of distance maps on parametric surfaces. ACM Transactions on Graphics (TOG), 27(4):104, 2008. 2 [41] M. A. Woodbury. Inverting modified matrices. Mem- orandum report, 42:106, 1950. 5 [42] L. Yatziv, A. Bartesaghi, and G. Sapiro. O (n) imple- mentation of the fast marching algorithm. Journal of computational physics, 212(2):393–399, 2006. 2 [43] H. Zhao. A fast sweeping method for eikonal equa- tions. Mathematics of computation, 74(250):603–627, 2005. 2 [44] H.-K. Zhao, S. Osher, B. Merriman, and M. Kang. Implicit and nonparametric shape reconstruction
1810.13187
1
1810
2018-10-31T09:53:50
Non-Empty Bins with Simple Tabulation Hashing
[ "cs.DS" ]
We consider the hashing of a set $X\subseteq U$ with $|X|=m$ using a simple tabulation hash function $h:U\to [n]=\{0,\dots,n-1\}$ and analyse the number of non-empty bins, that is, the size of $h(X)$. We show that the expected size of $h(X)$ matches that with fully random hashing to within low-order terms. We also provide concentration bounds. The number of non-empty bins is a fundamental measure in the balls and bins paradigm, and it is critical in applications such as Bloom filters and Filter hashing. For example, normally Bloom filters are proportioned for a desired low false-positive probability assuming fully random hashing (see \url{en.wikipedia.org/wiki/Bloom_filter}). Our results imply that if we implement the hashing with simple tabulation, we obtain the same low false-positive probability for any possible input.
cs.DS
cs
Non-Empty Bins with Simple Tabulation Hashing Anders Aamand and Mikkel Thorup November 1, 2018 Abstract We consider the hashing of a set X ⊆ U with X = m using a simple tabulation hash function h : U → [n] = {0, . . . , n − 1} and analyse the number of non-empty bins, that is, the size of h(X). We show that the expected size of h(X) matches that with fully random hashing to within low-order terms. We also provide concentration bounds. The number of non-empty bins is a fundamental measure in the balls and bins paradigm, and it is critical in applications such as Bloom filters and Filter hashing. For example, normally Bloom filters are proportioned for a desired low false-positive probability assuming fully random hashing (see en.wikipedia.org/wiki/Bloom_filter). Our results imply that if we implement the hashing with simple tabulation, we obtain the same low false-positive probability for any possible input. 8 1 0 2 t c O 1 3 ] S D . s c [ 1 v 7 8 1 3 1 . 0 1 8 1 : v i X r a 1 Introduction We consider the balls and bins paradigm where a set X ⊆ U of X = m balls are distributed into a set of n bins according to a hash function h : U → [n]. We are interested in questions relating to the distribution of h(X), for example: What is the expected number of non-empty bins? How well is h(X) concentrated around its mean? And what is the probability that a query ball lands in an empty bin? These questions are critical in applications such as Bloom filters [3] and Filter hashing [7]. In the setting where h is a fully random hash function, meaning that the random variables (h(x))x∈U are mutually independent and uniformly distributed in [n], the situation is well un- derstood. The random distribution process is equivalent to throwing m balls sequentially into n bins by for each ball choosing a bin uniformly at random and independently of the placements of the previous balls. The probability that a bin becomes empty is thus (1 − 1/n)m; so the expected number of non-empty bins is exactly µ0 := n (1 − (1 − 1/n)m) and, unsurprisingly, the number of non-empty bins turns out to be sharply concentrated around µ0 (see for example Kamath et al. [8] for several such concentration results). In practical applications fully random hashing is unrealistic and so it is desirable to replace the fully random hash functions with realistic and implementable hash functions that still provide at least some of the probabilistic guarantees that were available in the fully random setting. However, as the mutual independence of the keys is often a key ingredient in proving results in the fully random setting most of these proofs do not carry over. Often the results are simply no longer true and if they are one has to come up with alternative techniques for proving them. In this paper, we study the number of non-empty bins when the hash function h is chosen to be a simple tabulation hash function [14, 21]; which is very fast and easy to implement (see description below in Section 1.1). We provide estimates on the expected size of h(X) which asymptotically match1 those with fully random hashing on any possible input. To get a similar match within the classic k-independence paradigm [20], we would generally need k = Ω((log n)/(log log n)). For comparison, simple tabulation is the fastest known 3-independent hash function [14]. We will also study how h(X) is concentrated around its mean. Our results complements those from [14], which show that with simple tabulation hashing, we get Chernoff-type concentration on the number of balls in a given bin when m ≫ n. For example, the results from [14] imply that all bins are non-empty with high probability (whp) when m = ω(n log n). More precisely, for any constant γ > 0, there exists a C > 0 such that if m ≥ Cn log n, all bins are non-empty with probability 1 − O(n−γ). As a consequence, we only have to study h(X) for m = O(n log n) below. On the other hand, [14] does not provide any good bounds on the probability that a bin is non-empty when, say, m = n. In this case, our results imply that a bin is non-empty with probability 1 − 1/e ± o(1), as in the fully random case. The understanding we provide here is critical to applications such as Bloom filters [3] and Filter hashing [7], which we describe in section 2.1 and 2.2. We want to emphasize the advantage of having many complementary results for simple tabulation hashing. An obvious advantage is that simple tabulation can be reused in many contexts, but there may also be applications that need several strong properties to work in tandem. If, for example, an application has to hash a mix of a few heavy balls and many light balls, and the hash function do not know which is which, then the results from [14] give us the Chernoff-style concentration of the number of light balls in a bin while the results of this paper give us the right probability that a bin contains a heavy ball. For another example where an interplay of properties becomes important see section 2.2 on Filter hashing. The reader is 1Here we use "asymptotically" in the classic mathematical sense to mean equal to within low order terms, not just within a constant factor. 1 referred to [18] for a survey of results known for simple tabulation hashing, as well as examples where simple tabulation does not suffice and where slower more sophisticated hash functions are needed. 1.1 Simple tabulation hashing Recall that a hash function h is a map from a universe U to a range R chosen with respect to some probability distribution on the set of all such functions. If the distribution is uniform (equiva- lently the random variables (h(x))x∈U are mutually independent and uniformly distributed in R) we will say that h is fully random. Simple tabulation was introduced by Zobrist [21]. For simple tabulation U = [u] = {0, . . . , u− 1} and R = [2r] for some r ∈ N. The keys x ∈ U are viewed as vectors x = (x[0], . . . , x[c − 1]) of c = O(1) characters with each x[i] ∈ Σ := [u1/c]. The simple tabulation hash function h is defined by h(x) = Mi∈[c] hi(x[i]), where h0, . . . , hc−1 : Σ → R are independent fully random hash functions and where ⊕ denotes the bitwise XOR. What makes it fast is that the character domains of h0, . . . , hc−1 are so small that they can be stored as tables in fast cache. Experiments in [14] found that the hashing of 32-bit keys divided into 4 8-bit characters was as fast as two 64-bit multiplications. Note that on machines with larger cache, it may be faster to use 16-bit characters. As useful computations normally involve data and hence cache, there is no commercial drive for developing processors that do multiplications much faster than cache look-ups. Therefore, on real-world processors, we always expect cache based simple tabulation to be at least comparable in speed to multiplication. The converse is not true, since many useful computations do not involve multiplications. Thus there is a drive to make cache faster even if it is too hard/expensive to speed up multiplication circuits. Other important properties include that the c character table lookups can be done in parallel and that when initialised the character tables are not changed. For applications such as Bloom filters where more than one hash function is needed another nice property of simple tabulation is that the output bits are mutually independent. Using (kr)-bit hash values is thus equivalent to using k independent simple tabulation hash functions each with values in [2r]. This means that we can get k independent r-bit hash values using only c lookups of (kr)-bit strings. 1.2 Main Results We will now present our results on the number of non-empty bins with simple tabulation hashing. The expected number of non-empty bins: Our first theorem compares the expected num- ber of non-empty bins when using simple tabulation to that in the fully random setting. We denote by p0 = 1 − (1 − 1/n)m < m/n the probability that a bin becomes non-empty and by µ0 = np0 the expected number of non-empty bins when m balls are distributed into n bins using fully random hashing. Theorem 1.1. Let X ⊆ U be a fixed set of X = m balls. Let y ∈ [n] be any bin and suppose that h : U → [n] is a simple tabulation hash function. If p denotes the probability that y ∈ h(X) then p − p0 ≤ m2−1/c n2 and hence E[h(X)] − µ0 ≤ m2−1/c n . 2 If we let y depend on the hash of a distinguished query ball q ∈ U\X, e.g., y = h(q), then the bound on p above is replaced by the weaker p − p0 ≤ 2m2−1/c n2 . The last statement of the theorem is important in the application to Bloom filters where we wish to upper bound the probability that h(q) ∈ h(X) for a query ball q /∈ X. To show that the expected relative error E[h(X)] − µ0 /µ0 is always small, we have to complement Theorem 1.1 with the result from [14] that all bins are full, whp, when m ≥ Cn log n for some large enough constant C. In particular, this implies E[h(X)] − µ0 /µ0 ≤ 1/n when m ≥ Cn log n. The relative error from Theorem 1.1 is maximized when m is maximized, and with m = Cn log n, it is bounded by m2−1/c n2 = O((log2 n)/n1/c) = O(n−1/c). Thus we conclude: Corollary 1.2. Let X ⊆ U be a fixed sets of X = m balls and let h : U → [n] be a simple tabulation hash function. Then E[h(X)] − µ0 /µ0 = O(n−1/c). As discussed above, the high probability bound from [14] takes over when the bounds from Theorem 1.1 get weaker. This is because the analysis in this paper is of a very different nature than that in [14]. λ2 2µ0(cid:19) , Concentration of the number of non-empty bins: We now consider the concentration of h(X) around its mean. In the fully random setting it was shown by Kamath et al. [8] that the concentration of h(X) around µ0 is sharp: For any λ ≥ 0 it holds that λ2(n − 1/2) µ0(2n − µ0)(cid:19) ≤ 2 exp(cid:18)− Pr(h(X) − µ0 ≥ λ) ≤ 2 exp(cid:18)− which for example yields that h(X) = µ0 ± O(√µ0 log n) whp, that is, with probability 1 − O(n−γ) for any choice of γ = O(1). Unfortunately we cannot hope to obtain such a good concentration using simple tabulation hashing. To see this, consider the set of keys [2]ℓ × [m/2ℓ] for any constant ℓ, e.g. ℓ = 1, and let E be the event that hi(0) = hi(1) for i = 0, . . . , ℓ− 1. This event occurs with probability 1/nℓ. Now if E occurs then the keys of Xi = [2]ℓ × {i} all hash to the same value namely h0(0)⊕···⊕ hℓ−1(0)⊕ hℓ(i). Furthermore, these values are independently and uniformly distributed in [n] for i ∈ [m/2ℓ] so the distribution of h(X) becomes identical to the distribution of non-empty bins when m/2ℓ balls are thrown into n bins using truly random hashing. This observation ruins the hope of obtaining a sharp concentration around µ0 and shows that the lower bound in the theorem below is best possible being the expected number of non-empty bins when Ω(m) balls are distributed into n bins. Theorem 1.3. Let X ⊆ U be a fixed sets of X = m keys. Let h : U → [n] be a simple tabulation hash function. Then whp h(X) ≥ n 1 −(cid:18)1 − 1 n(cid:19)Ω(m)! As argued above, the lower bound in Theorem 1.3 is optimal. Settling with a laxer require- ment than high probability, it turns out however that h(X) is somewhat concentrated around µ0. This is the content of the following theorem which also provides a high probability upper bound on h(X). Theorem 1.4. Let X ⊆ U be a fixed sets of X = m keys. Let h : U → [n] be a random simple tabulation hash function. For t ≥ 0 it holds that Pr [h(X) ≥ µ0 + 2t] = O(cid:18)exp(cid:18) −t2 Pr [h(X) ≤ µ0 − 2t] = O(cid:18)exp(cid:18) −t2 2m2−1/c(cid:19)(cid:19) , 2m2−1/c(cid:19) + and (1.1) (1.2) m2 nt2 (cid:19) . 3 The term m2/(nt2) in the second bound in the theorem may be unexpected but it has to be there (at least when m = O(n)) as we will argue after proving the theorem. Theorem 1.4 is proved using Azuma's inequality (which we will state and describe later). It turns out that when m ≪ n one can obtain stronger concentration using a stronger martingale inequality. For intuition, the reader is encouraged to think of the fully random setting where m balls are thrown sequentially into n bins independently and uniformly at random: In this setting the allocation of a single ball can change the conditionally expected number of non- empty bins by at most 1 and this is the type of observation that normally suggests applying Azuma's inequality. However, when m ≪ n, it is unlikely that the allocation of a ball will change the conditional expectation of the number of non-empty bins by much -- for that to happen the ball has to hit a bin that is already non-empty, and the probability that this occurs is at most m/n ≪ 1. Using a martingale inequality by Mcdiarmid [9], that takes the variance of our martingale into consideration, one can obtain the following result which is an improvement over Theorem 1.4 when m ≪ n, and matches within O-notation when m = Θ(n). Theorem 1.5. Let X ⊆ U be a fixed sets of X = m keys. Let h : U → [n] be a random simple tabulation hash function. Assume m ≤ n. For t ≥ 0 it holds that m1−1/c)!! , m1−1/c)!! + O(cid:18) m2 Pr [h(X) ≥ µ0 + t] = exp −Ω min( t2 Pr [h(X) ≤ µ0 − t] = exp −Ω min( t2 nt2 (cid:19) . m3−1/c m3−1/c (1.3) (1.4) and t t , , n n The above bounds are unwieldy so let us disentangle them. First, one can show using simple calculus that when 2 ≤ m ≤ n then µ0 = m − Θ(m2/n). If m1+1/c = o(n) we thus have that µ0 = m − o(m1−1/c). To get a non-trivial bound from (1.3) we have to let t = Ω(m1−1/c) and then µ0 + t = m + ω(m1−1/c). This means that (1.3) is trivial when m1+1/c = o(n) as we can never have more than m non-empty bins. For comparison, (1.1) already becomes trivial when m1+1/(2c) = o(n). Suppose now that m1+1/c = Ω(n). For a given δ put t0 = η max(r m3−1/c n log 1 δ , m1−1/c log 1 δ) , for some sufficiently large η = O(1). Then (1.3) gives that Pr [h(X) ≥ µ0 + t0] ≤ δ. It remains δ(cid:19). to understand t0: Assuming that m1+1/c ≥ n log 1 For comparison, to get the same guarantee on the probability using (1.1) we would have to put t0 = Ω(cid:16)qm2−1/c log 1 nt2 (cid:17) that dominates the bound. For a given δ we would choose t = max{t0, m/√nδ} to get Pr [h(X) ≤ µ0 − t] = O(δ). Turning to (1.4), it will typically in applications be the term O(cid:16) m2 δ(cid:17), which is a factor of pn/m larger. δ , we have that t0 = O(cid:18)q m3−1/c log 1 n 1.3 Projecting into Arbitrary Ranges Simple tabulation is an efficient hashing scheme for hashing into r-bit hash values. But what do we do if we want hash values in [n] where 2r−1 < n < 2r, say n = 3 × 2r−2? Besides being of theoretical interest this is an important question in several practical applications. For example, when designing Bloom filters (which we will describe shortly), to minimize the false positive probability, we have to choose the size n of the filters such that n ≈ m/ ln(2). When n has to 4 be a power of two, we may be up to a factor of √2 off, and this significantly affects the false positive probability. Another example is cuckoo hashing [13], which was shown in [14] to succeed with simple tabulation with probability 1 − O(n−1/3) when 2m(1 + ε) ≤ n. If m = 2r we have to choose n as large as 2r+2 = 4m to apply this result, making it much less useful. The way we remedy this is a standard trick, see e.g. [17]. We choose r such that 2r ≫ n, and hash in the first step to r-bit strings with a simple tabulation hash function h : U → [2r]. Usually 2r ≥ n2 suffices and then the entries of the character tables only becomes twice as long. Defining s : [2r] → [n] by s(y) = ⌊yn/2r⌋ our combined hash function U → [n] is simply defined as s ◦ h. Note that s is very easy to compute since we do just one multiplication and since the division by 2r is just an r-bit right shift. The only property we will use about s is that it is most uniform meaning that for z ∈ [n] either, s−1({z}) = ⌊ 2r n ⌉. For example, we could also use s′ : [2r] → [n] defined by s′(y) = y (mod n), but s is much faster to compute. n ⌋ or s−1({z}) = ⌈ 2r Note that if 2r ≥ n2, then (cid:12)(cid:12)(cid:12) s−1({z}) 2r − 1 n(cid:12)(cid:12)(cid:12) ≤ 2−r ≤ n−2. A priori it is not obvious that s ◦ h has the same good properties as "normal" simple tabu- lation. The set of bins can now be viewed as {s−1({z}) : z ∈ [n]}, so each bin consists of many "sub-bins", and a result on the number of non-empty sub-bins does not translate directly to any useful result on the number of non-empty bins. Nonetheless, many proofs of results for simple tabulation do not need to be modified much in this new setting. For example, the simplified proof given by Aamand et al. [1] of the result on cuckoo hashing from [14] can be checked to carry over to the case where the hash functions are implemented as described above if r is sufficiently large. We provide no details here. For the present paper the relevant analogue to Theorem 1.1 is the following: Theorem 1.6. Let X ⊆ U be a fixed set of X = m balls, and let S ⊆ [2r] with S/2r = ρ. 0 = 1− (1− ρ)m. If p denotes Suppose h : U → [2r] is a simple tabulation hash function. Define p′ the probability that h(X) ∩ S 6= ∅, then p − p′ 0 ≤ m2−1/cρ2 If we let S (and hence ρ) depend on the hash of a distinguished query ball q ∈ U\X, then the bound on p above is replaced by the weaker p − p0 ≤ 2m2−1/cρ2. If we assume 2r ≥ n2, say, and let S = s−1({z}) be a bin of S ⊂ [2r] we obtain the following estimate on p: p − p0 ≤ p − p′ 0 + p′ 0 − p0 2r(cid:19)2 ≤ m2−1/c(cid:18) 1 + n 1 + m 2r = m2−1/c n2 (1 + o(1)) This is very close to what is obtained from Theorem 1.1 and to make the difference smaller we can increase r further. There are also analogues of Theorem 1.3, 1.4 and 1.5 in which the bins are partitioned into groups of almost equal size and where the interest is in the number of groups that are hit by a ball. To avoid making this paper unnecessarily technical, we refrain from stating and proving these theorems, but in Section 5 we will show how to modify the proof of Theorem 1.1 to obtain Theorem 1.6. 1.4 Alternatives One natural alternative to simple tabulation is to use k-independent hashing [20]. Using an easy variation2of an inclusion-exclusion based argument by Mitzenmacher and Vadhan [11] one can 5 show that if k is odd and if m ≤ n the probability p that a given bin is non-empty satisfies p0 − O(cid:18)(cid:16) m n(cid:17)k 1 k!(cid:19) ≤ p ≤ p0 + O(cid:18)(cid:16) m n(cid:17)k+1 1 (k + 1)!(cid:19) , (1.5) and this is optimal, at least when k is not too large, say k = o(√m) -- there exist two (different) k-independent families making respectively the upper and the lower bound tight for a certain set of m keys. A similar result holds when k is even. Although p approaches p0 when k increases, for k = O(1) and m = Ω(n), we have a deviation by an additive constant term. In contrast, the probability that a bin is non-empty when using simple tabulation is asymptotically the same as in the fully random setting. Another alternative when studying the number of non-empty bins is to assume that the input comes with a certain amount of randomness. This was studied in [11] too and a slight variation2 of their argument shows that if the input X ⊆ U has enough entropy the probability that a bin is empty is asymptotically the same as in the fully random setting even if we only use 2-independent hashing. This is essentially what we get with simple tabulation. However, our results have the advantage of holding for any input with no assumptions on its entropy. Now (1.5) also suggests the third alternative of looking for highly independent hash functions. For the expectation (1.5) shows that if m ≤ n we would need k = Ω(log n/ log log n) to get guarantees comparable to those obtained for simple tabulation. Such highly independent hash functions were first studied by Siegel [15], the most efficient known construction today being the double tabulation by Thorup [16] which gives independence uΩ(1/c2) ≫ log n using space O(cu1/c) and time O(c). While this space and time matches that of simple tabulation within constant factors, it is slower by at least an order of magnitude. As mentioned in [16], double tabulation with 32-bit keys divided into 16-bit characters requires 11 times as many character table lookups as with simple tabulation and we lose the same factor in space. The larger space of double tabulation means that tables may expand into much slower memory, possibly costing us another order of magnitude in speed. There are several other types of hash functions that one could consider, e.g., those from [6, 12], but simple tabulation is unique in its speed (like two multiplications in the experiments from [14]) and ease of implementation, making it a great choice in practice. For a more thorough comparison of simple tabulation with other hashing schemes, the reader is refered to [14]. 2 Applications Before proving our main results we describe two almost immediate applications. 2.1 Bloom Filters Bloom filters were introduced by Bloom [3]. We will only discuss them briefly here and argue which guarantees are provided when implementing them using simple tabulation. For a thorough introduction including many applications see the survey by Broder and Mitzenmacher [4]. A Bloom filter is a simple data structure which space efficiently represents a set X ⊆ U and It uses k independent hash functions supports membership queries of the form "is q in X". h0, . . . , hk−1 : U → [n] and k arrays A0, . . . , Ak−1 each of n bits which are initially all 0. For each x ∈ X we calculate (hi(x))i∈[k] and set the hi(x)'th bit of Ai to 1 noting that a bit may 2Mitzenmacher and Vadhan actually estimate the probability of getting a false positive when using k- independent hashing for Bloom filters, but this error probability is strongly related to the expected number of non-empty bins E[h(X)] (in the fully random setting it is E[h(X)]/n). Thus only a slight modification of their proof is needed. 6 be set to 1 several times. To answer the query "is q in X" we check if the bits corresponding to (hi(q))i∈[k] are all 1, outputting "yes" if so and "no" otherwise. If q ∈ X we will certainly output the correct answer but if q /∈ X we potentially get a false positive in the case that all the bits corresponding to (hi(q))i∈[k] are set to 1 by other keys in X. In the case that q /∈ X the probability of getting a false positive is k−1 which with fully random hashing is pk Pr[hi(q) ∈ hi(X)], Yi=0 0 = (1 − (1 − 1/n)m)k ≈ (1 − e−m/n)k. k−1 0 − qk pk 0 = (p0 − q0) 0qk−i−1 pi 0 0 It should be noted that Bloom filters are most commonly described in a related though not identical way. In this related setting we use a single (kn)-bit array A and let h1, . . . , hk−1 : U → [kn], setting the bits of A corresponding to (hi(x))i∈[k] to 1 for each x ∈ X. With fully random hashing the probability that a bit is set to 1 is then q0 := 1 −(cid:0)1 − 1 and the probability of a false positive is thus at most qk calculus shows that p0 − q0 = O(1/n) and so Xi=0 0 = (cid:16)1 −(cid:0)1 − 1 n ! . = O kpk−1 0. Despite the difference, simple kn(cid:1)mk(cid:17)k kn(cid:1)mk ≤ pk In particular if p0 = 1− Ω(1) or if the number of filters k is not too large (both being the case in practice) the failure probability in the two models are almost identical. We use the model with k different tables each of size n as this makes it very easy to estimate the error probability using Theorem 1.1 and the independence of the hash functions. We can in fact view hi as a map from U to [kn] but having image in [(i + 1)n]\[in] getting us to the model with just one array. From Theorem 1.1 we immediately obtain the following corollary. Corollary 2.1. Let X ⊆ U with X = m and y ∈ U\X. Suppose we represent X with a Bloom filter using k independent simple tabulation hash functions h0, . . . , hk−1 : U → [n]. The probability of getting a false positive when querying q is at most p0 + 2m2−1/c n2 !k . At this point one can play with the parameters. In the fully random setting one can show that if the number of balls m and the the total number of bins kn are fixed one needs to choose k and n such that p0 ≈ 1/2 in order to minimise the error probability (see [4]). For this, one needs m ≈ n ln(2) and if n is chosen so, the probability above is at most (p0 + O(n−1/c))k. In applications, k is normally a small number like 10 for a 0.1% false positive probability. In particular, k = no(1), and then (p0 + O(n−1/c))k = pk 0(1 + o(1)), asymptotically matching the fully random setting. To resolve the issue that the range of a simple tabulation function has size 2r but that we wish to choose n ≈ m/ ln(2), we choose r such that 2r ≥ n2 and use the combined hash function s ◦ h : U → [n] described in Section 1.3. Now appealing to Theorem 1.6 instead of Theorem 1.1 we can again drive the false positive probability down to pk 0(1 + o(1)) when k = no(1). Alternatives: The argument by Mitzenmacher and Vadhan [11] discussed in relation to (1.5) actually yields a tight bound on the probability of a false positive when using ℓ-independent hashing for Bloom filters. We do not state their result here but mention that when ℓ is constant 7 the error probability may again deviate by an additive constant from that of the fully random setting. It is also shown in [11] that if the input has enough entropy we can get the probability of a false positive to match that from the fully random setting asymptotically even using 2- independent hashing, yet it cannot be trusted for certain types of input. Now, imagine you are a software engineer that wants to implement a Bloom filter, pro- portioning it for a desired low false-positive probability. You can go to a wikipedia page (en.wikipedia.org/wiki/Bloom_filter) or a texbook like [10] and read how to do it assuming full randomness. If you read [11], what do you do? Do you set ℓ = 2 and cross your fingers, or do you pay the cost of a slower hash function with a larger ℓ, adjusting the false-positive probabilities accordingly? Which ℓ do you pick? With our result, there are now hard choices. The answer is simple. We just have to add that everything works as stated for any possible input if the hashing is implemented with simple tabulation hashing (en.wikipedia.org/wiki/Tabulation_hashing) which is both very fast and very easy to implement. 2.2 Filter Hashing In Filter hashing, as introduced by Fotakis et al. [7], we wish to store as many elements as possible of a set X ⊆ U of size X = m = n in d hash tables (Ti)i∈[d]. The total number of entries in the tables is at most n and each entry can store just a single key. For i ∈ [d] we pick independent hash functions hi : U → [ni] where ni is the number of entries in Ti. The keys are allocated as follows: We first greedily store a key from h−1 0 ({y}) in T0[y] for each y ∈ h0(X). This lets us store exactly h0(X) keys. Letting S0 be the so stored keys and X1 = X\S0 the remaining keys, we repeat the process, storing h(X1) keys in T1 using h1 etc. An alternative and in practice more relevant way to see this is to imagine that the keys arrive sequentially. When a new key x arrives we let i be the smallest index such that Ti[hi(x)] is unmatched and store x in that entry. If no such i exists the key is not stored. The name Filter hashing comes from this view which prompts the picture of particles (the keys) passing through filters (the tables) being caught by a filter only if there is a vacant spot. The question is for a given ε > 0 how few filters that are needed in order to store all but at most εn keys with high probability. Note that the remaining εn keys can be stored using any hashing scheme which uses linear space, for example Cuckoo hashing with simple tabulation [13, 14], to get a total space usage of (1 + O(ε))n. One can argue that with fully random hashing one needs Ω(log2(1/ε)) filters to achieve that whp at least (1 − ε)n keys are stored. To see that we can achieve this bound with simple tabulation we essentially proceed as in [7]. Let γ > 0 be any constant and choose δ > 0 according to Theorem 1.3 so that if X ⊆ U with X = m and h : U → [n] is a simple tabulation hash function, then h(X) ≥ n(1 − (1 − 1/n)δm) with probability at least 1 − n−γ. Let m0 = n. For i = 0, 1, . . ., we pick ni to be the largest power of two below δmi/ log(1/ε). We then set mi+1 = n−Pi j=0 nj, terminating when mi+1 ≤ εn. Then Ti is indexed by (log2 ni)- bit strings -- the range of a simple tabulation hash function hi. Letting d be minimal such that md ≤ εn we have that (1 − ε)n ≤ Pi∈[d] ni ≤ n and as mi decreases by at least a factor of (cid:16)1 − at least mi balls left and so with probability 1 − O(n−γ 2 log(1/ε)(cid:17) in each step, d ≤ ⌈2 log(1/ε)2/δ⌉. How many bins of Ti get filled? Even if all bins from filters (Tj)j<i are non-empty we have δ ) the number of bins we hit is at least i ni(1 − (1 − 1/ni)δmi ) ≥ ni(1 − e−δmi/ni) ≥ ni(1 − ε). Thus, with probability at least 1 − O(dn−γ d ), for each i ∈ [d], filter i gets at least (1 − ε)ni balls. Since Pi∈[d] ni ≥ (1 − ε)n, the number of overflowing balls is at most 2εn in this case. 8 Assuming for example that ε = Ω(n−1/2), as would be the case in most applications, we get that the fraction of balls not stored is O(ε) with probability at least 1 − O(n−γ/2). Alternatives The hashing scheme for Filter hashing described in [7] uses (12⌈ln(4/ε) + 1⌉)- independent polynomial hashing to achieve an overflow of at most εn balls. In particular the choice of hash functions depends on ε and becomes more unrealistic the smaller ε is. In contrast when using simple tabulation (which is only 3-independent) for Filter hashing we only need to change the number of filters, not the hashing, when ε varies. It should be mentioned that only ⌈ln(4/ε)2⌉ filters are needed for the result in [7] whereas we need a constant factor more. It can however be shown (we provide no details) that we can get down to d = ⌈2 log(1/ε)2⌉ filters by applying (1.2) of Theorem 1.4 if we settle for an error probability of O(n−1+η) for a given constant η > 0. Taking a step back we see the merits of a hashing scheme giving many complementary prob- abilistic guarantees. As shown by Patraşcu and Thorup [14], Cuckoo hashing [13] implemented with simple tabulation succeeds with probability 1− O(n−1/3) (for a recent simpler proof of this result, see Aamand et al. [1]). More precisely, for a set X ′ of m′ balls, let n′ be the least power 1 of size n′, and using simple tabulation of two bigger than (1 + Ω(1))m′. Allocating tables T ′ hash functions h′ 1 : U → [n′], with probability 1 − O(n−1/3) Cuckoo hashing succeeds in placing the keys such that every key x ∈ X ′ is found in either T ′ 1(x)]. In case it fails, we just try again with new random h′ 0(x)] or T ′ 0, T ′ 0, h′ 0, h′ 1. 0[h′ 1[h′ We now use Cuckoo hashing to store the n′ = O(εn) keys remaining after the filer hashing, appending the Cuckoo tables to the filter tables so that Td+i = T ′ i for i = 0, 1. Then x ∈ X if and only if for some i ∈ [d + 2], we have x = Ti[hi(x)]. We note that all these d + 2 lookups could be done in parallel. Moreover, as the output bits of simple tabulation are mutually independent, the d + 2 hash functions hi : U → [2ri], 2ri = ni, can be implemented as a single simple tabulation hash function h : U → [2r1+···+rd+2] and therefore all be calculated using just c = O(1) look-ups in simple tabulation character tables. i and hd+i = h′ 3 Preliminaries As in [16] we define a position character to be an element (j, a) ∈ [c] × Σ. Simple tabulation hash functions are initially defined only on keys in U but we can extend the definition to sets of position characters S = {(ij, aj) : j ∈ [k]} by letting h(S) =Lj∈[k] hij (aj). This coincides with h(x) when the key x ∈ U = [Σ]c is viewed as the set of position characters {(i, x[i]) : i ∈ [c]}. We start by describing an ordering of the position characters, introduced by Patraşcu and Thorup [14] in order to prove that the number of balls hashing to a specific bin is Chernoff concentrated when using simple tabulation. If X ⊆ U is a set of keys and ≺ is any ordering of the position characters [c]×Σ we for α ∈ [c]×Σ define Xα = {x ∈ X ∀β ∈ [c]×Σ : β ∈ x ⇒ β (cid:22) α}. Here we view the keys as sets of position characters. Further define Gα = Xα\(Sβ≺α Xβ) to be the set of keys in Xα containing α as a position character. Patraşcu and Thorup argued that the ordering may be chosen such that the groups Gα are not too large. Lemma 3.1 (Patraşcu and Thorup [14]). Let X ⊆ U with X = m. There exists an ordering ≺ of the position characters such that Gα ≤ m1−1/c for all position characters α. If q is any (query) key in X or outside X, we may choose the ordering such that the position characters of q are first in the order and such that Gα ≤ 2m1−1/c for all position characters α. Let us throughout this section assume that ≺ is chosen as to satisfy the properties of Lemma 3.1. A set Y ⊆ U is said to be d-bounded if h−1({z}) ∩ Y ≤ d for all z ∈ R. In other words no bin gets more than d balls from Y . 9 Lemma 3.2 (Patraşcu and Thorup [14]). Assume that the number of bins n is at least m1−1/(2c). For any constant γ, and d = min(cid:8)2c(3 + γ)c, 22c(3+γ)(cid:9) all groups Gα are d-bounded with prob- ability at least 1 − n−γ. Lemma 3.2 follows from another lemma from [14] which we restate here as we will use it in one of our proofs. Lemma 3.3 (Patraşcu and Thorup [14]). Let ε > 0 be a fixed constant and assume that m ≤ n1−ε. For any constant γ no bin gets more than min(cid:0)((1 + γ)/ε)c, 2(1+γ)/ε(cid:1) = O(1) balls with probability at least 1 − n−γ. Let us describe heuristically why we are interested in the order ≺ and its properties. We will think of h as being uncovered stepwise by fixing h(α) only when (h(β))β≺α has been fixed. At the point where h(α) is to be fixed the internal clustering of the keys in Gα has been settled and h(α) acts merely as a translation, that is, as a shift by an XOR with h(α). This viewpoint opens up for sequential analyses where for example it may be possible to calculate the probability of a bin becoming empty or to apply martingale concentration inequalities. The hurdle is that the internal clustering of the keys in the groups are not independent as the hash value of earlier position characters dictate how later groups cluster so we still have to come up with ways of dealing with these dependencies. 4 Proofs of main results In order to pave the way for the proofs of our main results we start by stating two technical lemmas, namely Lemma 4.1 and 4.2 below. We provide proofs at the end of this section. Lemma 4.1 is hardly more than an observation. We include it as we will be using it repeatedly in the proofs of our main theorems. Lemma 4.1. Assume α ≥ 1 and m, m0 ≥ 0 are real numbers. Further assume that 0 ≤ g1, . . . , gk ≤ m0 and Pk i=1 gi = m. Then k (4.1) i ≤ mα−1 gα 0 m. Xi=1 In our applications of Lemma 4.1, g1, . . . , gk will be the sizes of the groups Gα described in Lemma 3.1, and m0 will be the upper bound on the group sizes provided by the same lemma. For the second lemma we assume that the set of keys X has been partitioned into k groups (Xi)i∈[k]. Let Ci denote the number of sets {x, y} ⊆ Xi such that x 6= y but h(x) = h(y), that is, the number of pairs of colliding keys internal to Xi. Denote by C = Pk i=1 Ci the total number of collisions internal in the groups. The second lemma bounds the expected value of C as well as its variance in the case where the groups are not too large. Lemma 4.2. Let X ⊆ U with X = m be partitioned as above. Suppose that there is an m0 ≥ 1 such that for all i ∈ [k], Xi ≤ m0. Then E[C] ≤ Var[C] ≤ , m · m0 2n (3c + 1)m2 n and (4.3) (4.4) + m · m2 n2 0 . 10 If further m0 ≤ n for some real n then Yi=1(cid:16)1 − k gi n(cid:17) ≥(cid:16)1 − m0 n (cid:17)m/m0 . (4.2) For a given query ball q ∈ U\X and a bin z ∈ [n], the upper bound on E[C] is also an upper bound on E[C h(q) = z]. For the variance estimate note that if in particular m2 0 = O(mn), then Var[C] = O(m2/n). We will apply this lemma when the Xi are the groups arising from the order ≺ of Lemma 3.1. With these results in hand we are ready to prove Theorem 1.1. Proof of Theorem 1.1. Let us first prove the theorem in the case where y is a fixed bin not chosen dependently on the hash value of a query ball. If m1−1/c ≥ n the result is trivial as then the stated upper bound is at least 1. Assume then that m1−1/c ≤ n. Consider the ordering α1 ≺ ··· ≺ αk of the position characters obtained from Lemma 3.1 such that all groups Gi := Gαi have size at most m1−1/c. We will denote by m0 := m1−1/c the maximal possible group size. We randomly fix the h(αi) in the order obtained from ≺ not fixing h(αi) before having fixed h(αj) for all j < i. If x ∈ Gi then h(x) = h(αi)⊕ h(x\{αi}) and since β ≺ αi for all β ∈ x\{αi} only h(αi) has to be fixed in order to settle h(x). The number of different bins hit by the keys of Gi when fixing h(αi) is thus exactly the size of the set {h(x\{αi}) : x ∈ Gi} which is simply translated by an XOR with h(αi) and for x ∈ Gi we have that h(x) is uniform in its range when conditioned on the values (h(αj))j<i. To make it easier to calculate the probability that y ∈ h(X) we introduce some dummy balls. At the point where we are to fix h(αi) we dependently on (h(αj ))j<i in any deterministic way choose a set Di ⊆ R = [n] of dummy balls, disjoint from {h(x\{αi}) : x ∈ Gi}, such that {h(x\{αi}) : x ∈ Gi}∪ Di has size exactly Gi. We will say that a bin z is hit if either z ∈ h(X) or there exists an i such that z = d⊕ h(αi) for some d ∈ Di. In the latter case we will say that z is hit by a dummy ball. This modified random process can be seen as ensuring that when we are to finally fix the hash values of the elements of Gi by the last translation with h(αi), we modify the group by adding dummy balls to ensure that exactly Gi bins are hit by either a ball in Gi or a dummy ball in Di. We let D =Pk Let H denote the event that y is hit and D denote the event that y is hit by a dummy ball. With the presence of the dummy balls, Pr[H] is easy to calculate: 1 i=1 Di denote the total number of dummy balls. k k Pr[H] = 1 − Yi=1(cid:18)1 − Gi n (cid:19) ≥ 1 − Yi=1(cid:18)1 − n(cid:19)Gi = p0. Clearly Pr[y ∈ h(X)] ≥ Pr[H] − Pr[D] so for a lower bound on Pr[y ∈ h(X)] it suffices to upper bound Pr[D]. Let Di denote the event that y is hit by a dummy ball from Di. We can calculate Pr[Di] = P∞ ℓ=0 Pr[Di Di = ℓ] × Pr[Di = ℓ]. The conditional probability Pr[Di Di = ℓ] is exactly ℓ/n as the choice of Di only depends on the hash values (h(αj))j<i and when translated by an XOR with h(αi) the bin y is hit with probability Di/n. It follows that Pr[Di] = E[Di]/n and thus that Pr[D] ≤ Pk i=1 Pr[Di] = E[D]/n. Finally the total number of dummy balls is upper bounded by the number C of internal collisions in the groups, so Lemma 4.2 gives that Pr[D] ≤ E[C]/n ≤ m2−1/c . This gives the desired lower bound on p (throwing away the factor of 1/2, in order to simplify the statement in the theorem). 2n2 For the upper bound note that Pr[y ∈ h(X)] ≤ Pr[H] so by Lemma 4.1 Using the inequality (cid:0)1 + x ℓ = m/m0 (note that x ≤ ℓ as we assumed that m1−1/c ≤ n) we obtain that ℓ (cid:17) holding for ℓ ≥ 1 and x ≤ ℓ with x = −m/n and m0 n (cid:17)m/m0 . p ≤ Pr[H] ≤ 1 −(cid:16)1 − ℓ(cid:1)ℓ ≥ ex(cid:16)1 − x2 m · m0 n2 (cid:17) ≤ 1 − e−m/n + 11 p ≤ 1 − e−m/n(cid:16)1 − m · m0 n2 ≤ p0 + m2−1/c n2 , as desired. The bound on E[h(X)] follows immediately as E[h(X)] =Py∈[n] Pr[y ∈ h(X)]. Finally consider the case where y is chosen conditioned on h(q) = z for a query ball q /∈ X and a bin z. Here we may assume that 2m1−1/c ≤ n as otherwise the claimed upper bound is at least 1. We choose the ordering ≺ such that the position characters of q are first in the order and such that all groups have size at most 2m1−1/c which is possible by Lemma 3.1. Let m0 = min(m, 2m1−1/c) denote the maximal possible group size. Introducing dummy balls the same way as before and repeating the arguments, the probability of the event H that y is hit satisfies p0 ≤ Pr[H h(q) = z] ≤ 1 −(cid:16)1 − The desired upper bound follows immediately as Pr[y ∈ h(X) h(q) = z] ≤ Pr[H h(q) = z]. For the lower bound we again let D denote the event that y is hit by a dummy ball and Di denote the event that y is hit by a dummy ball from Di. Then ≤ 1 − e−m/n(cid:16)1 − m · m0 n2 (cid:17) ≤ p0 + m0 n (cid:17)m/m0 n2 2m2−1/c . Pr[Di h(q) = z] = ∞ Xℓ=0 Pr[Di h(q) = z ∧ Di = ℓ] × Pr[Di = ℓ h(q) = z]. As before we have that Pr[Di h(q) = z ∧ Di = ℓ] = ℓ/n since the hash values of the position characters of q are fixed before h(αi). Thus, Pr[Di h(q) = z] = ℓ n ∞ Xℓ=0 Pr[Di = ℓ h(q) = z] = E[Di h(q) = z] n , and another union bound gives that Pr[D h(q) = z] ≤ E[D h(q) = z] n E[C h(q) = z] n ≤ m2−1/c n2 , ≤ where we in the last step used Lemma 4.2. (cid:4) We are now going to prove Theorem 1.3. We start out by recalling Azuma's inequality. Theorem 4.3 (Azuma's inequality [2]). Suppose (Xi)k Xi−1 ≤ si almost surely for all i = 1, . . . , k. Let s =Pk i=0 is a martingale satisfying that Xi − i=1 s2 i . Then for any t ≥ 0 it holds that Pr(Xk ≥ X0 + t) ≤ exp(cid:18)−t2 2s (cid:19) , and Pr(Xk ≤ X0 − t) ≤ exp(cid:18)−t2 2s (cid:19) . To apply Azuma's inequality we need to recall a little measure theory. Suppose (Ω,F, Pr) is a finite measure space (that is Ω is finite), and that Y : Ω → R is an F-measurable random variable. A sequence of σ-algebras (Fi)k i=1 on Ω is called a filter of the σ-algebra F if {∅, Ω} = F0 ⊆ ··· ⊆ Fk = F. Defining Yi = E[Y Fi], the sequence (Yi)k i=0 becomes a martingale with Y0 = E[Y ] and Yk = Y . It is for such martingales that we will apply Azuma's inequality. Proof of Theorem 1.3. By the result by Patraşcu and Thorup [14] we may assume that m ≤ Cn log n for some constant C as otherwise all bins are full whp from which the results of the theorem immediately follow. Let G1, . . . , Gk be the groups described in Lemma 3.1 and α1, . . . , αk be the corresponding position characters. Again we think of the h(αi) as being fixed sequentially. We let (Ω,F, Pr) be the underlying probability space when choosing h, that is, Ω is the set of all simple tabulation hash functions, F = P(Ω), and Pr is the uniform probability measure on Ω. For i = 0, . . . , k we 12 Ideally we would hope that for the martingale (Xi)k define Fi = σ(h(α1), . . . , h(αi)) to be the σ-algebra generated by the hash values of the first i position characters. Then {∅, Ω} = F0 ⊆ ··· ⊆ Fk = F is a filter of F. i=0 we could effec- tively bound Xi − Xi−1 and thus apply Azuma's inequality. This is however too much to hope for -- the example with keys [2]× [m/2] shows that the hash value of a single position character can have a drastic effect on the conditionally expected number of non-empty bins. To remedy this we will again be using dummy balls but this time in a different way. i=0 = (E[h(X)Fi])k First of all, we let γ > 0 be any constant. Since m ≤ Cn log n, Lemma 3.2 gives that there exists a d = d(γ) = O(1) such that all groups are d-bounded with probability at least 1 − n−γ. Here is how we use the dummy balls: After having fixed (h(αj ))j≺i we again look at the set G′ i := {h(x\{αi}) : x ∈ Gi} letting I − = {i ∈ [k] : G′ i ≥ ⌈Gi/d ⌉} and I + = {i ∈ [k] : i < ⌈Gi/d ⌉}. For i ∈ I − we dependently on (h(αj ))j≺i choose a set D− G′ i such that i\D− G′ i such that i ∪ D+ G′ 1. i ∈ I − and z = y ⊕ h(αi) for some y ∈ G′ 2. i ∈ I + and z = y ⊕ h(αi) for some y ∈ G′ i ⊆ G′ i = ⌈Gi/d ⌉. Similarly we for i ∈ I + choose a set D+ i ⊆ R disjoint from G′ i = ⌈Gi/d ⌉. We say that bin z is hit if there exists an i such that either i\D− i , or i ∪ D+ i . This modified random process obtained by adding balls if G′ i is too large and removing balls if it is too small can be seen as ensuring that when we are to finally fix the hash values of the elements of Gi by the last translation by h(αi) we first modify the group to ensure that we hit exactly ⌈Gi/d ⌉ bins. G′ Importantly, we observe that if Gi is d-bounded then G′ i ≥ ⌈Gi/d ⌉. Thus if all groups are d-bounded I + = ∅, and no dummy balls are added. Letting H denote the number of bins hit, we have that i ≥ Gi/d and since G′ i is integral E[H] = n 1 − k Yi=1(cid:18)1 − ⌈Gi/d ⌉ n (cid:19)! ≥ n 1 − k Yi=1(cid:18)1 − 1 n(cid:19)⌈Gi/d ⌉! ≥ n 1 −(cid:18)1 − i=0 = (E[H Fi])k 1 n(cid:19)m/d! . We now wish to apply Azuma's inequality to the martingale (Hi)k i=0. To do this we require a good upper bound on Hi − Hi−1 and we claim that in fact Hi − Hi−1 ≤ Gi. To see this, let the random variable Ni denote the number of bins not hit when the hash values (cid:17) and so of the first i position characters has been settled. Then Hi = n − NiQj>i(cid:16)1 − ⌈Gj /d⌉ (cid:12)(cid:12)(cid:12)(cid:12) ≤(cid:12)(cid:12)(cid:12)(cid:12) Hi − Hi−1 =Yj>i(cid:18)1 − ⌈Gj/d⌉ Ni − Ni−1 + ⌈Gi/d⌉ · Ni−1 (cid:19)(cid:12)(cid:12)(cid:12)(cid:12) Now Ni−1 −⌈Gi/d⌉ ≤ Ni ≤ Ni−1 as at least 0 and most ⌈Gi/d⌉ bins are hit after fixing h(αi) and from this it follows that Hi − Hi−1 ≤ ⌈Gi/d⌉ ≤ Gi. Letting si = Gi we have that Pk i ≤ m2−1/c by Lemma 4.1 and thus we can apply Azuma's inequality to obtain that Ni −(cid:18)1 − ⌈Gi/d⌉ (cid:19) Ni−1(cid:12)(cid:12)(cid:12)(cid:12) i=1 s2 n n n . n Pr(H ≤ E[H] − t) ≤ exp(cid:18) −t2 2m2−1/c(cid:19) . Putting t =pγ · 2m2−1/c log n we obtain that with probability at least 1 − n−γ n(cid:19)m/d! −qγ · 2m2−1/c log n. H ≥ ℓ(m, n) := n 1 −(cid:18)1 − 1 13 As I + = ∅ with probability at least 1 − n−γ and as we in this case have that h(X) ≥ H we have that h(X) ≥ ℓ(m, n) with probability at least 1 − 2n−γ. The remaining part of proof is just combining what we have together with a little calculus! We first consider the case m ≤ n. In this case the lower bound simply states that h(X) = Ω(m). To see that this bound holds observe that if (for example) m ≤ n1/2 then by Lemma 3.3 no bin gets more than a constant number of balls with probability at least 1 − n−γ. In particular h(X) = Ω(m) with probability at least 1−n−γ. If on the other hand m ≥ n1/2 thenpγ · 2m2−1/c log n = o(m) and ℓ(m, n) = Ω(m) − o(m) = Ω(m) which again gives the desired result. Finally suppose m ≥ n. Let α := (1 − 1/n)n/(2d) ≤ e−1/(2d) and let β be a constant so large that β ≥ 2d and n (1 − 1/n)m/β ≥ 1 1−αpγ · 2m2−1/c log n, the last requirement being possible as we assumed m ≤ Cn log n. Then n(cid:19)m/d − (1 − α)(cid:18)1 − n(cid:19)m/β (cid:18)1 − n(cid:19)m/(2d) n(cid:19)m/β Since h(X) ≥ ℓ(m, n) with probability at least 1 − 2n−γ this gives the desired result. n(cid:19)m/β + (1 − α)! ≥ 1 −(cid:18)1 − ≥ 1 −(cid:18)1 − ≥ 1 −(cid:18)1 − ℓ(m, n) n (cid:4) 1 1 1 1 1 . We now prove Theorem 1.4. Proof of Theorem 1.4. When m1−1/(2c) ≥ n the probability bounds of the theorem are trivial since they are Ω(1) when t ≤ n . We therefore assume henceforth that m1−1/(2c) ≤ n. Again consider the order ≺ obtained from Lemma 3.1 such that for all i we have Gi ≤ m1−1/c. We again think of the hash values of the position characters as being fixed in the order obtained from ≺. We also introduce dummy balls in exactly the same way as we did in the proof of Theorem 1.1 using the same definition of a bin being hit. Letting H denote the number of bins hit (by an x ∈ X or a dummy ball) we have that E[H] = n(cid:16)1 −Qk n (cid:17)(cid:17), like in the proof of Theorem 1.1, and i=1(cid:16)1 − Gi µ0 ≤ E[H] ≤ µ0 + m2−1/c . n Furthermore letting Fi = σ(h(α1), . . . , h(αi)) be the σ-algebra generated by (h(αj))j≤i, the same argument as in the proof of Theorem 1.3 gives that Hi = E[HFi] is a martingale satisfying that Hi − Hi−1 ≤ Gi for all i. We can thus apply Azuma's inequality with si = Gi and s =Pk i=1 s2 i ≤ m2−1/c (here we used Lemma 4.1) to obtain that 2m2−1/c(cid:19) , 2m2−1/c(cid:19) . Pr[H ≥ E[H] + t] ≤ exp(cid:18) −t2 Pr[H ≤ E[H] − t] ≤ exp(cid:18) −t2 and (4.5) (4.6) We now wish to translate this concentration result on the number of bins hit when the dummy balls are included to a concentration result on h(X). We begin with the bound in (1.1). As h(X) ≤ H it suffices to bound the probability Pr[H ≥ µ0 + 2t]. Since E[H] ≤ µ0 + m2−1/c n , Pr[H ≥ µ0 + 2t] ≤ Pr"H − E[H] ≥ 2t − m2−1/c n # , 14 n t2 so when t ≥ m2−1/c m2−1/c < m2−1/c then as Ω(1) which is a valid upper bound on any probability. the result follows immediately from (4.5). If on the other hand t < m2−1/c n2 ≤ 1 and the result is trivial as the right hans size in (1.1) can be as large We now turn to the proof of (1.2). Letting E denote the event that h(X) ≤ µ0 − 2t and A n the event that H ≤ µ0 − t we have that Pr[h(X) ≤ µ0 − 2t] = Pr[E] ≤ Pr[A] + Pr[E ∧ ¬A]. 2m2−1/c(cid:17). For the other term By (4.6) and since µ0 ≤ E[H] we can upper bound Pr[A] ≤ exp(cid:16) −t2 we note that E ∧ ¬A entails that at least t bins are hit by a dummy ball. In particular the number of dummy balls is at least t. As the number C of internal collisions of the groups is an upper bound on the number of dummy balls this in turn implies, t ≤ C. We may assume that t ≥ m1−1/(2c) as otherwise (1.1) is trivial. As we assumed, m1−1/(2c) ≤ n it follows from Lemma 4.2 that E[C] ≤ m2−1/c ≤ t/2 and so t − E[C] ≥ t/2. Applying Chebychev's inequality as well as (4.4) of Lemma 4.2 we thus obtain, 2n ≤ tm1−1/(2c) 2n Pr[E ∧ ¬A] ≤ Pr[C ≥ t] ≤ Pr[C − E[C] ≥ t/2] ≤ 4 Var[C] t2 = O(cid:18) m2 t2n(cid:19) . Combining the two bounds completes the proof. (cid:4) We promised to argue why we cannot dispose with the term m2/(nt2) in general. Suppose that m = O(n) and let t = m1/2+α for an α ∈ [1/2, 1) such that m1/2+α ∈ [√m, m/2], and consider the set of keys [m/t] × [t]. With probability Ω((m/t)2/n) = Ω(m2/(t2n)) we have that h0(a0) = h0(a1) for two distinct a0, a1 ∈ [m/t]. Conditioned on this event the expected number n (cid:17)t(cid:19) which can be shown to be µ0 − Ω(t) by of non-empty bins is at most n(cid:18)1 −(cid:16)1 − m/t−1 standard calculus. The additive term Ω(t) comes from the fact that the t pairs of colliding keys {(a0, b), (a0, b)}b∈[t] causes the expected number of non-empty bins to decrease by Ω(t) when m = O(n). Thus the deviation by Ω(t) from µ0 occurs with probability Ω(m2/(nt2)). We will now set the stage for the proof of Theorem 1.5. As mentioned in the introduction we require a stronger martingale inequality than that by Azuma. The one we use is due to Mcdiarmid [9]. Again assume that (Ω,F, Pr) is a finite probability space, that X : Ω → R is an F-measurable random variable, that (Fi)k i=0 is a filter of F, and that Xi = E[X Fi]. Also recall the definition of conditional variance: If G ⊆ F is a σ-algebra, then Var[X G] = E[(X − E[X G])2 G] = E[X 2 G] − E[X G]2. Theorem 4.4 (Mcdiarmid [9]). Assume that Var[Xi Fi−1] ≤ σ2 that Xi − Xi−1 ≤ M for i = 1, . . . , k. Then for t ≥ 0, i for i = 1, . . . , k and further Pr[X − E[X] ≥ t] ≤ exp  −t2 i + M t/3(cid:17) i=1 σ2   . 2(cid:16)Pk With this tool in hand we are ready to prove Theorem 1.5, the main technical challenge being to argue why we can apply Theorem 4.4. Proof of Theorem 1.5. We introduce dummy balls exactly in the proof of Theorem 1.4 and Theorem 1.1 and consider the same martingale (Hi)k i=0, where H is the number of bins hit (by either a dummy ball or a ball from X). We already saw that Hi− Hi−1 ≤ Gi ≤ i=0 = (E[HFi])k 15 m1−1/c, so we let M := m1−1/c. What remains is to upper bound Var[Hi Fi−1]. First note that Var[Hi Fi−1] =E[(Hi − E[Hi Fi−1])2 Fi−1] =E[(Hi − Hi−1)2 Fi−1]. We denote by Ni the number of bins that are empty after the hash values of the first i position characters has been settled. Then, by the same reasoning as in the proof of Theorem 1.3, we have that Ni − Ni−1 + Gi · Ni−1 n Hi − Hi−1 ≤(cid:12)(cid:12)(cid:12)(cid:12) . (cid:12)(cid:12)(cid:12)(cid:12) Now let Ti = Gi − Ni−1 + Ni denote the number of bins hit in the i'th step that were already hit in the (i − 1)'st step. As E[Ti Fi−1 ] = (n − Ni−1)Gi/n, the above inequality reads and so, Hi − Hi−1 ≤ Ti − E[Ti Fi−1], Var[Hi Fi−1] ≤ Var[Ti Fi−1] ≤ E[T 2 i Fi−1]. Now, T 2 i counts the number of 2-tuples (y, z) with y, z ∈ {h(x\{αi}) : x ∈ Gi} ∪ Di such that h(y) and h(z) are already hit after the (i− 1)'st step. Conditioned on Fi−1 the probability that this occurs for a given such pair is at most n−Ni−1 n , and there are exactly Gi2 such pairs. Hence n ≤ m m n Gi2 := σ2 i . Var[Hi Fi−1] ≤ By Lemma 4.2, Pk i=1 σ2 so Theorem 4.4 gives that for t ≥ 0 n i ≤ m3−1/c Pr[H − E[H] ≥ t] ≤ exp  2(cid:16) m3−1/c ≤ exp − min( t2 2m1−1/c)! . 4 m3−1/c 3t , n −t2 n + m1−1/ct/3(cid:17)   (4.7) n n i)k i=0 = (E[H ′ Fi])k i=0. Then H ′ As E[H] ≤ µ0 + m2−1/c same argument as in the proof of Theorem 1.4 leads to the upper bound (1.3). this is also an upper bound on Prhh(X) ≥ µ0 + t + m2−1/c i. Now the Finally, to prove (1.4) we use the same strategy as above but this time we define H ′ = −H and the martingale (H ′ i−1 = Hi − Hi−1 ≤ M and Var[H ′ i Fi−1] = Var[Hi Fi−1] for i = 1, . . . , k, so we get a bound as in (4.7), but this time on Pr[H ′ − E[H ′] ≥ t] = Pr[H − E[H] ≤ −t]. As in the proof of Theorem 1.4, the event h(X) ≤ µ0− t implies that either A: H − E[H] ≤ −t/2 or B: the number of internal collisions C is at least t/2. Pr[A] is bounded using (4.7), giving us the first term of the bound in (1.4). For Pr[B], note that we may assume that t ≥ 4m1−1/c as otherwise (4.7) is trivial. In that case E[C] ≤ m2−1/c/n ≤ t 4 , so t/2 − E[C] ≥ t/4. Lemma 4.2 thus gives that Pr[B] = O( m2 nt2 ) -- the second term in the bound (1.4). The proof is (cid:4) i − H ′ n ≤ t m 4 complete. 16 4.1 Proofs of technical lemmas For proving Lemma 4.2 and Lemma 4.1 we need to briefly discuss the independence of simple tabulation. In the notion of k-independence introduced by Wegman and Carter [20] simple tab- ulation is only 3-independent as shown by the set of keys S = {(a0, b0), (a0, b1), (a1, b0)(a1, b1)}. IndeedLx∈S h(x) = 0 showing that the keys do not hash independently. The issue is that since each position character appears an even number of times in S the addition over Z2 causes the terms to cancel out. This property in a sense characterises dependencies of keys as shown by Thorup and Zhang [19] Lemma 4.5 (Thorup and Zhang [19]). The keys x1, . . . , xk ∈ U are dependent if and only if there exists a non-empty subset I ⊆ {1, . . . , k} such that each position character in (xi)i∈I appears an even number of times. In this case we have that Li∈I h(xi) = 0. For keys x, y ∈ U we write x ⊕ y for the symmetric difference of x and y when viewed as sets of position characters. Then the property that each position character appearing an even number of times in (xi)i∈I can be written as Li∈I xi = ∅. As shown by Dahlgaard et al. [5] we Lemma 4.6 (Dahlgaard et al. [5]). Let A1, . . . , A2t ⊆ U . The number of 2t-tuples (x1, . . . , x2t) ∈ A1 × ··· × A2t such that x1 ⊕ ··· ⊕ x2t = ∅ is at most ((2t − 1)!!)cQ2t i=1pAi. Here a!! denotes the product of all the positive integers in {1, . . . , a} having the same parity as a. can efficiently bound the number of such tuples (xi)i∈I . We now provide the proofs of Lemma 4.2 and Lemma 4.1. Since we need Lemma 4.1 in the proof of Lemma 4.2 we prove that first. Proof of Lemma 4.1. We prove the following more general statement: Let f : [0, m0] → R be convex with f (0) = 0. Let 0 ≤ g1, . . . , gk ≤ m0 be such that m = Pk i=1 gi. Define S := Pk i=1 f (gi). Then S ≤ (m/m0)f (m0). To see why the statement holds note that by convexity, f (x) + f (y) ≤ f (x − t) + f (y + t) if 0 ≤ t ≤ x ≤ y ≤ m0− t. To maximize S we thus have to set k = ⌈m/ m0⌉, g1 = ··· = gk−1 = m0 and gk = m −Pk−1 i=1 gi = εm0, where ε ∈ [0, 1). It follows that m0 − ε(cid:19) f (m0) + f (εm0) . S ≤(cid:18) m Finally f (εm0) ≤ εf (m0) using convexity and that f (0) = 0, so S ≤ (m/m0)f (m0) as desired. The first inequality (4.1) of the lemma follows immediately from the above statement with f (x) = xα which is convex since α ≥ 1. For inequality (4.2) we may assume that n > m0 as the result is trivial when n = m0. We then define f (x) = − log(1 − x/n) which is convex with f (0) = 0. Then S = − log(cid:16)1 − gi n(cid:17) ≤ − m m0 log(cid:16)1 − m n(cid:17) , k Xi=1 which upon exponentiation leads to inequality (4.2). (cid:4) Proof of Lemma 4.2. We define gi = Xi for i ∈ [k]. Now (4.3) is easily checked. Indeed, since simple tabulation is 2-independent, E[C] = k Xi=1(cid:18)gi 2(cid:19) 1 n ≤ 1 2n t Xi=1 g2 i ≤ m · m0 2n , 17 where in the last step we used Lemma 4.1. The last statement of the lemma concerning E[C h(q) = z] follows from the same argument this time however using that simple tabulation is 3-independent. We now turn to (4.4). Writing Var[C] = E[C 2] − (E[C])2 our aim is to bound E[C 2]. Note that C 2 counts the number of tuples ({x, y},{z, w}) such that x 6= y and z 6= w but h(x) = h(y) and h(z) = h(w) and furthermore x, y ∈ Gi and z, w ∈ Gj for some i, j ∈ [k]. We denote the set of such tuples T and for τ = ({x, y},{z, w}) ∈ T we let Xτ be the indicator for the event that both h(x) = h(y) and h(z) = h(w). Then E[C 2] = Xτ ∈T Pr(Xτ = 1). (4.8) We now partition T by letting • T1 be the elements of T for which {x, y} = {z, w}. • T2 be the elements of T for which {x, y, z, w} = 3. • T3 be the elements of T for which x, y, z, w are distinct and independent. • T4 be the elements of T for which x, y, z, w are distinct and dependent and there is an i ∈ [k] such that x, y, z, w ∈ Gi. • T5 be the remaining elements of T , that is, those element ({x, y},{z, w}) such that x, y, z, w are distinct and dependent and such that {x, y} ⊆ Gi and {z, w} ⊆ Gj for some distinct i, j ∈ [k]. efficiently upper bound each of the inner sums as we now show. Clearly, Pr(Xτ = 1) the sum in (4.8) can be written as P5 Putting Sj = Pτ ∈Tj j=1 Sj and we can S1 = k Xi=1(cid:18)gi 2(cid:19) 1 n = E[C]. For the second sum we use that simple tabulation is 3-independent and that {x, y, z, w} = 3 implies that x, y, z, w belongs to the same group Gi for some i ∈ [k]. Hence m · m2 n2 g3 i ≤ 2(cid:19) · 2 ·(cid:18)gi − 2 1 (cid:19) 1 n2 ≤ 1 n2 S2 = k k 0 , Xi=1(cid:18)gi Xi=1 again using Lemma 4.1 to bound the sum of cubes. Finally we upper bound S3 as S3 ≤ k 1 n2   Xi=1(cid:18)gi 2(cid:19)(cid:18)gi − 2 2 (cid:19) + Xi,j∈[k]:i6=j(cid:18)gi 2(cid:19) 2(cid:19)(cid:18)gj  ≤ 1 n2 k Xi=1 (cid:18)gi 2(cid:19)!2 = E[C]2. Note that in the first three steps we have not been using anything about simple tabulation except it being 3-independent. However, if ({x, y},{z, w}) ∈ T4 ∪ T5 then by Lemma 4.5 we have that x ⊕ y ⊕ z ⊕ w = ∅ and thus that h(x) = h(y) exactly if h(z) = h(w) which happens with probability n−1. Thus in this case we have to efficiently bound the sizes of T4 and T5. Luckily Lemma 4.6 comes to our rescue and we can bound S4 + S5 ≤ 3c n   k Xi=1 g2 i + Xi,j∈[k]:i6=j gigj  = 3c n k Xi=1 gi!2 = 3cm2 n . 18 Combining all this we find that Var[C] = E[C 2] − E[C]2 ≤ E[C] + m · m2 n2 + 0 3cm2 n ≤ m · m2 n2 + 0 (3c + 1)m2 n , as desired. (cid:4) 5 Handling bins consisting of many subbins In this section we show how to modify the proof of Theorem 1.1 to obtain Theorem 1.6. Proof of Theorem 1.6. We may assume that ρm1−1/c ≤ 1 as otherwise the result is trivial. As usual we consider the ordering on the position characters, α1 ≺ ··· ≺ αk, obtained from Lemma 3.1, and we fix the values h(αi) in this order. Suppose that (h(αj ))j<i are fixed and let Vi = {y ∈ [2r] ∃x ∈ Gi : h(x\{αi}) + y ∈ S} denote those hash values h(αi) that would cause S ∩ h(Gi) 6= ∅. Note that Vi is a random variabel depending only on (h(αj))j<i. Let Di ⊆ [2r]\Vi be a set of dummy hash values chosen dependently on (h(αj ))j<i such that (Di + Vi)/2r = ρGi. As Gi ≤ m1−1/c and so ρGi ≤ ρm1−1/c ≤ 1 this is in fact possible. We say that S is hit if there exists and i ∈ {1, . . . , k} such that h(αi) ∈ Vi ∪ Di, and we denote this event H. Defining m0 = m1−1/c we then have k Pr[H] = 1 − (1 − Giρ) ≤ 1 − (1 − m0ρ)m/m0 ≤ 1 − e−mρ(1 − mm0ρ2) ≤ p′ Yi=1 0 + m2−1/cρ2, using the same inequality as in the proof of Theorem 1.1. This is clearly also an upper bound i=1(h(αi) ∈ Vi)]. on p = Pr[h(X) ∩ S 6= ∅] = Pr[Sk Now for the lower bound: For i ∈ {1, . . . , k} we let Di and Ri denote events that h(αi) ∈ Di and that h(αi) ∈ Vi respectively. Then Xi=1 (Pr[Ri ∪ Di] − Pr[Ri]) = ρm − Pr" k [i=1 Di# ≤ Pr[Di] = k Xi=1 k k Xi=1 Pr[Ri]. By the Bonferroni inequality, and 2-independence so it follows that Pr[Sk 2 (cid:19)ρ2, Pr[Ri] = Pr[h(Gi) ∩ S 6= ∅] ≥ Giρ −(cid:18)Gi i=1 Di] ≤Pk i=1(cid:0)Gi 2 (cid:1)ρ2 ≤ m2−1/cρ2. Finally p ≥ Pr[H] − Pr" k [i=1 0 − m2−1/cρ2, Di# ≥ p′ which completes the proof of the lower bound. The case where we condition on the event E that h(q) = z for a z ∈ [2r] is handled analogously but this time choosing the order ≺ as described in the second part of Lemma 3.1. The upper bound on p then follows as before and for the lower bound we use 3-independence of simple tabulation when applying the Bonferroni inequality to lower bound Pr[Vi E]. (cid:4) 19 References [1] Anders Aamand, Mathias Baek Tejs Knudsen, and Mikkel Thorup. Power of d choices with In Proc. 45st International Colloquium on Automata, Languages and simple tabulation. Programming, ICALP, pages 5:1 -- 5:14, 2018. [2] Kazuoki Azuma. Weighted sums of certain dependent random variables. Tohoku Mathe- matical Journal, 19(3):357 -- 367, 1967. [3] Burton H. Bloom. Space/time trade-offs in hash coding with allowable errors. Communi- cations of the ACM, 13(7):422 -- 426, July 1970. [4] Andrei Broder and Michael Mitzenmacher. Network applications of bloom filters: A survey. In Internet Mathematics, pages 636 -- 646, 2002. [5] Søren Dahlgaard, Mathias B. T. Knudsen, Eva Rotenberg, and Mikkel Thorup. Hashing for statistics over k-partitions. In Proc. 56th Symposium on Foundations of Computer Science, FOCS, pages 1292 -- 1310, 2015. [6] Martin Dietzfelbinger and Philipp Woelfel. Almost random graphs with simple hash func- In Proc. 35th ACM Symposium on Theory of Computing, STOC, pages 629 -- 638, tions. 2003. [7] Dimitris Fotakis, Rasmus Pagh, Peter Sanders, and Paul G. Spirakis. Space efficient hash tables with worst case constant access time. In Proceedings of the 20th Annual Symposium on Theoretical Aspects of Computer Science, STACS '03, pages 271 -- 282, 2003. [8] Anil Kamath, Rajeev Motwani, Krishna V. Palem, and Paul G. Spirakis. Tail bounds for occupancy and the satisfiability threshold conjecture. Random Struct. Algorithms, 7(1):59 -- 80, 1995. [9] Colin Mcdiarmid. Concentration. In Probabilistic methods for algorithmic discrete mathe- matics, Algorithms and combinatorics, pages 195 -- 248. Springer, Berlin, 1998. [10] Michael Mitzenmacher and Eli Upfal. Probability and Computing: Randomized Algorithms and Probabilistic Analysis. Cambridge University Press, New York, NY, USA, 2005. [11] Michael Mitzenmacher and Salil Vadhan. Why simple hash functions work: Exploiting the entropy in a data stream. In Proc. 19. ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 746 -- 755, 2008. [12] Anna Pagh and Rasmus Pagh. Uniform hashing in constant time and optimal space. SIAM Journal of Computing, 38(1):85 -- 96, March 2008. [13] Rasmus Pagh and Flemming F. Rodler. Cuckoo hashing. Journal of Algorithms, 51(2):122 -- 144, May 2004. Announced at ESA'01. [14] Mihai Patraşcu and Mikkel Thorup. The power of simple tabulation hashing. Journal of the ACM, 59(3):14:1 -- 14:50, June 2012. Announced at STOC'11. [15] Alan Siegel. On universal classes of extremely random constant-time hash functions. SIAM Journal of Computing, 33(3):505 -- 543, March 2004. Announced at FOCS'89. [16] Mikkel Thorup. Simple tabulation, fast expanders, double tabulation, and high indepen- dence. In Proc. 54th Symposium on Foundations of Computer Science, FOCS, pages 90 -- 99, 2013. 20 [17] Mikkel Thorup. High speed hashing for integers and strings. CoRR, abs/1504.06804, 2014. [18] Mikkel Thorup. Fast and powerful hashing using tabulation. Commun. ACM, 60(7):94 -- 101, 2017. [19] Mikkel Thorup and Yin Zhang. Tabulation-based 5-independent hashing with applications to linear probing and second moment estimation. SIAM Journal of Computing, 41(2):293 -- 331, April 2012. Announced at SODA'04 and ALENEX'10. [20] Mark N. Wegman and Larry Carter. New hash functions and their use in authentication and set equality. J. Comput. Syst. Sci., 22(3):265 -- 279, 1981. Announced at FOCS'79. [21] Albert L. Zobrist. A new hashing method with application for game playing. Tech. Report 88, Computer Sciences Department, University of Wisconsin, Madison, Wisconsin, 1970. 21
1804.04102
1
1804
2018-04-11T17:18:16
Fast Feasible and Unfeasible Matrix Multiplication
[ "cs.DS" ]
Fast matrix-by-matrix multiplication (hereafter MM) is a highly recognized research subject. The record upper bound 3 of 1968 on the exponent of the complexity MM decreased below 2.38 by 1987, applies to celebrated problems in many areas of computing, and is extensively cited in the Theory of Computing. Further decrease of the exponent remains a celebrated challenge. Acceleration of MM in the Practice of Computing is a distinct challenge, because all known algorithms supporting the exponents below 2.7733 improve straightforward MM only for unfeasible MM of immense size, greatly exceeding the sizes of interest nowadays and in any foreseeable future. We first survey the mainstream study of the acceleration of MM of unbounded sizes, cover the progress in decreasing the exponents of MM, comment on its impact on the theory and practice of computing, and recall various fundamental concepts and techniques supporting fast MM and naturally introduced in that study by 1980. Then we demonstrate how the curse of recursion naturally entered the game of decreasing the record exponents. Finally we cover the State of the Art of efficient feasible MM, including some most efficient known techniques and algorithms as well as various issues of numerical and symbolic implementation. We hope that our review will help motivate and properly focus further effort in this highly important area.
cs.DS
cs
Fast Feasible and Unfeasible Matrix Multiplication Victor Y. Pan [1] Department of Computer Science Lehman College of the City University of New York Bronx, NY 10468 USA [email protected] http://comet.lehman.cuny.edu/vpan/ and [2] Ph.D. Programs in Mathematics and Computer Science The Graduate Center of the City University of New York New York, NY 10036 USA Abstract Matrix-by-matrix multiplication (hereafter referred to as MM) is a fundamental operation omnipresent in modern computations in Numerical and Symbolic Linear Algebra. Its accel- eration makes major impact on various fields of Modern Computation and has been a highly recognized research subject for about five decades. The researchers introduced amazing novel techniques, found new insights into MM and numerous related computational problems, and devised advanced algorithms that performed n × n MM by using less than O(n2.38) scalar arith- metic operations versus 2n3 − n2 of the straightforward MM, that is, more than half-way to the information lower bound n2. The record upper bound 3 of 1968 on the exponent of the complex- ity MM decreased below 2.38 by 1987 and has been extended to various celebrated problems in many areas of computing and became most extensively cited constant of the Theory of Comput- ing. The progress in decreasing the record exponent, however, has virtually stalled since 1987, while many scientists are still anxious to know its sharp bound, so far restricted to the range from 2 to about 2.3728639. Narrowing this range remains a celebrated challenge. Acceleration of MM in the Practice of Computing is a distinct challenge, much less popular, but also highly important. Since 1980 the progress towards meeting the two challenges has fol- lowed two distinct paths because of the curse of recursion – all the known algorithms supporting the exponents below 2.38 or even below 2.7733 involve long sequences of nested recursive steps, which blow up the size of an input matrix. As a result all these algorithms improve straight- forward MM only for unfeasible MM of immense size, greatly exceeding the sizes of interest nowadays and in any foreseeable future. It is plausible and surely highly desirable that someone could eventually decrease the record MM exponent towards its sharp bound 2 even without ignoring the curse of recursion, but currently there are two distinct challenges of the acceleration of feasible and unfeasible MM. In particular various known algorithms supporting the exponents in the range between 2.77 and 2.81 are quite efficient for feasible MM and have been implemented. Some of them make up a valuable part of modern software for numerical and symbolic matrix computations, extensively worked on in the last decade. Still, that work has mostly relied on the MM algorithms proposed more than four decades ago, while more efficient algorithms are well known, some of them appeared in 2017. In our review we first survey the mainstream study of the acceleration of MM of unbounded sizes, cover the progress in decreasing the exponents of MM, comment on its impact on the theory and practice of computing, and recall various fundamental concepts and techniques supporting fast MM and naturally introduced in that study by 1980. Then we demonstrate how the curse of recursion naturally entered the game of decreasing the record exponents. Finally we cover the State of the Art of efficient feasible MM, including some most efficient known techniques and algorithms as well as various issues of numerical and symbolic implementation. We hope that our review will help motivate and properly focus further effort in this highly important area. 2000 Math. Subject Classification: 68Q25, 65F05, 15A06, 15A69, 01A60, 15-03 1 Key Words: Matrix multiplication (MM), Bilinear algorithms, Tensor decomposition, Trilinear aggregation, Disjoint MM, APA-algorithms, Computational Complexity, Exponent of MM, Curse of recursion, Feasible MM, Numerical MM, Symbolic MM 1 Introduction Matrix-by-matrix multiplication (MM) is omnipresent in modern computations for Applied Mathe- matics, Statistics, Physics, Engineering, Combinatorics, Computer Science, Signal and Image Pro- cessing, and Bioinformatics (cf., e.g., [106], [129]) and is performed billions times per day around the globe. For a couple of specific examples, computing radiation exchange in enclosures can be written in matrix form, mainly as an N × N MM with N up to 10,000 [76], and gene expression analysis in bioinformatics involves N × N MMs with N up to 4,000 [148]. The straightforward MM involves cubic time, namely 2n3 − n2 arithmetic operations for n × n, and until 1969 it was commonly believed that the order of n3 operations are necessary. This belief died in 1969, when Volker Strassen decreased the exponent 3 of the complexity of MM to 2.8074 in [151]. Further decrease of the exponent towards its information lower bound 2 has instantly become the subject of worldwide interest and the goal of intensive study by literally all experts in this field. Various novel amazing but fundamental techniques have been proposed, new insights into fast MM and some related areas of modern computations have been introduced, and the MM exponent has been decreased below 2.38, that is, more than half-way from the classical 3 to the information lower bound 2. These results have been widely recognized in the Theory of Computation, and 2.38 became the absolute constant of that field, most frequently cited there, because it bounds the exponents of the complexity of various celebrated problems in many areas of computing linked to MM. The progress was not going smoothly. It stalled for nearly a decade after 1969, resumed in 1978 with [118], followed with new significant advances in 1979–1982 and again in 1986, and since then again virtually stalled. Even more serious problem with the record-breaking MM algorithms is the curse of recursion – they rely on long sequences of nested recursive processes, which blow up the input size. The resulting algorithms supersede the straightforward MM only when this size becomes immense – greatly exceeding the level of MM in use nowadays or even in any foreseeable future. It is plausible and of course highly desirable that new breakthrough would eventually result in an algorithm for fast feasible MM supporting a nearly sharp exponent close to 2, but so far the acceler- ation of feasible MM of realistic sizes is studied as a distinct hard task for which one cannot ignore the curse of recursion. So far the known algorithms for feasible MM only support the exponents below 2.7734 (see [123]), unbeaten for 36 years since 1982 but not much recognized. Nevertheless in spite of their association with relatively large exponents, some fast algorithms for feasible MM make up a valuable part of modern software for numerical and symbolic matrix computations. Implemen- tation work for fast feasible MM has been intensified within the last decade but still mostly relies on algorithms that are more than four decades old and have already been significantly improved (see [91], [149], and [98]). In our present survey we first trace the history of the decrease of the exponent of MM, list some celebrated problems of the Theory of Computing linked to MM and sharing with MM the exponent of the complexity, and naturally recall the fundamental concepts and techniques for fast MM, introduced by 1981, such as recursive bilinear and trilinear algorithms, tensor decomposition, trilinear aggregation, disjoint MM, any precision approximation, and the EXPAND, PRUNE, and CONQUER techniques. We also show how the curse of recursion naturally entered the game. Finally we bring our survey closer to the earth by covering the acceleration of feasible MM of realistic sizes and some relevant methods and techniques such as the 3M method for complex MM, its extension to polynomial MM, computer-aided ALS search, and randomization technique for fast MM. We also discuss the implementation issues of fast MM, including numerical stability, data movement, and symbolic implementation. We hope that our work will help motivate and properly focus further study and further progress in this highly important area of Modern Computations. 2 2 Straightforward MM and First Fast MM Algorithms 2.1 MM and its subproblems MV and VV. Optimality of straightforward MV and VV k × m by m × n MM (hereafter referred to as MM(k, m, n)) is the computation of the product C of two matrices A of size k × m and B of size m × n whose entries can be numbers, variables, or matrices: (2.1) C = AB, for A = (ai,j)k,m i,j=1, B = (bj,h)m,n j,h=1, C = (ci,h)k,n i = 1, . . . , k, h = 1, . . . , n. i,h=1, ci,h = ai,1b1,h + ai,2b2,h + ··· + ai,mbm,h, MM(k, m, 1) is matrix-by-vector multiplication (hereafter referred to as MV), M (1, m, 1) is the computation of the inner product of two vectors of length m (hereafter VV), ci = ai,1b1 + ai,2b2 + ··· + ai,mbm, i = 1, 2, . . . , k; c = a1b1 + a2b2 + ··· + ambm, and we write MM(n) for MM(n, n, n). MV and MM(n) are made up of their n and kn subproblems VV, respectively. Like MM both MV and VV are omnipresent in modern computations in Linear and Multilinear Algebra. The straightforward classical algorithm for VV first computes the m products a1b1, a2b2, . . . , ambm and then sum them together. For MV and MM we can apply the same algorithm k and kn times, respectively. This is optimal for VV and MV – any algorithm that performs VV or MV by using only scalar arithmetic operations, that is, add, subtract, multiply, and divide, and that uses no branching must perform at least as many scalar additions and subtractions and at least as many scalar multiplications and divisions as the straightforward algorithm. The proofs rely on the techniques of active operation – basic substitution from [116], also covered and extended in [31, Section 2.3], [94], and Sections "Pan's method" in [152] and [154]. Sparse and structured MV, also omnipresent in modern computations, can be performed much faster. In particular arithmetic time linear in n up to a logarithmic or polylogarithmic factor is sufficient in order to multiply by a vector an n×n matrix with a structure of Toeplitz, Hankel, Cauchy, or Vandermonde type and even to solve a nonsingular structured linear system of n equations with such a coefficient matrix versus quadratic or cubic time required for the same computations with a general matrix. See [130], [133], and the bibliography therein for computations with structured matrices (aka data sparse matrices); see [41], [11], [7], and the bibliography therein for computations with sparse matrices. 2.2 The first fast MM algorithms The straightforward MM uses kmn scalar multiplications and kmn− kn scalar additions, that is, n3 and n3 − n2 for k = m = n. Until 1969 the scientific world believed that this algorithm is optimal, although already in 1968 the experts knew from the following example that this was not true (see [165] and notice technical similarity to the algorithms for polynomial evaluation with preprocessing in [116] and [94]). Example 2.1. For any even positive integer n, the inner product of two vectors a = (aj)n b = (bj)n j=1 satisfies the following identity, j=1 and n/2 aT b = Xi=1 (a2i−1 + b2i)(b2i−1 + a2i) − n/2 Xi=1 a2i−1a2i − n/2 Xi=1 b2i−1b2i. (2.2) By combining such identities for n2 inner products defining n × n MM, perform MM(n) by using 0.5n3+n2 scalar multiplications and 1.5n3+2n2−2n scalar additions and subtractions, thus replacing about 50% of multiplications of the straightforward MM by additions. 3 In the 1960s a floating point multiplication was usually two or three times slower than a floating point addition, and so the algorithm had some practical value. Not so anymore nowadays because multiplication is about as fast as addition, but the algorithm is still a historical landmark as the first fast MM. It was not fast enough in order to attract the attention of non-experts, however, and so the news that the straightforward MM is not optimal has awaken scientific world only a little later, when Volker Strassen presented the following celebrated algorithm. Example 2.2. Strassen's 2 × 2 MM [151]. Compute the product C = AB of a pair of 2 × 2 matrices, for A = (cid:18)a11 a21 a12 a22(cid:19) , B = (cid:18)b11 b21 b12 b22(cid:19) , C = AB = (cid:18)c11 c21 c12 c22(cid:19) , (2.3) by using the following expressions, p1 = (a11 + a22)(b11 + b22), p2 = (a21 + a22)b11, p3 = a11(b12 − b22), p4 = a22(b21 − b11), p5 = (a11 + a12)b22, p6 = (a21 − a11)(b11 + b12), p7 = (a12 − a22)(b21 + b22), c11 = p1 + p4 + p7 − p5, c12 = p3 + p5, c21 = p2 + p4, c22 = p1 + p3 + p6 − p2. The algorithm uses 7 scalar multiplications and 18 scalar additions and subtractions versus 8 scalar multiplications and 4 scalar additions of the straightforward MM. The trade-off seems to favor the straightforward algorithm, but let all matrix entries be 2 × 2 matrices, reapply the algorithm for all 7 auxiliary 2 × 2 MMs, and arrive at 4 × 4 MM using 49 scalar multiplications versus 64 in the straightforward MM. Then replace the input entries of the new algorithm by 2 × 2 matrices and reapply the algorithm of Example 2.2 to all 49 auxiliary 2 × 2 MMs. Perform d such recursive steps and arrive at n× n MM that uses 7g = nlog2(7) scalar multiplications for n = 2g versus 8g = n3 in the straightforward algorithm. Addition or subtraction of s × s matrix involves just s2 scalar additions or subtractions, and the recursive algorithm based on Example 2.2 performs MM(n) for n = 2g by applying 6 · 7g − 6 · 4g < 6nlog2(7) scalar additions and subtractions. This is an example of the large class of divide and conquer algorithms, which recursively reduce an original computational problem to those of smaller size. Such algorithms have been extensively used in various areas of computing, fast Fourier transform being a notable example (see Appendix B). One can decrease the arithmetic cost to 5 · 7g − 5 · 4g < 5nlog2(7) by applying similar recursive divide and conquer process based on the algorithm of the following example, which performs 2 × 2 MM by using 7 scalar multiplications and 15 scalar additions and subtractions. Example 2.3. Winograd's 2 × 2 MM (cf. [74], [31, pages 45–46]). Compute a 2 × 2 matrix product C = AB of (2.3) by using the following expressions, s1 = a21 + a22, s2 = s1 − a11, s3 = a11 − a21, s4 = a12 − s2, s5 = b12 − b11, s6 = b22 − s5, s7 = b22 − b12, s8 = s6 − b21, p1 = s2s6, p2 = a11b11, p3 = a12b21, p4 = s3s7, p5 = s1s5, p6 = s4b22, p7 = a22s8, t1 = p1 + p2, t2 = t1 + p4, t3 = t1 + p5, c11 = p2 + p3, c12 = t3 + p6, c21 = t2 − p7, c22 = t2 + p5. With some additional care one can perform n × n MM for any n by using c · nlog2(7) arithmetic operations for c ≈ 4.54 and c ≈ 3.92 based on Examples 2.2 and 2.3, respectively (see [74]). 2.3 Impact of the acceleration of MM The news that the cubic arithmetic time of the straightforward MM is not a barrier anymore flew many times around the globe as a scientific sensation of the year of 1969, and the scientists expected that very soon the classical exponent 3 will be decreased to its information lower bound 2, that is, that very soon n×n MM will be performed in quadratic or nearly quadratic time, required already in order to access the 2n2 input entries as well as in order to output n2 entries of the matrix. Of course this decrease was a most exciting perspective – according to [158, page 248] "such a development would trigger the greatest upheaval in the history of numerical computations." 4 The scientists in many fields were excited because it was known that the acceleration of MM can be readily extended to a variety of popular and long-studied problems of Linear Algebra and Computer Science, linked to MM and sharing with MM the exponent of their complexity estimates.1 Their list includes Boolean MM, computation of paths and distances in graphs, parsing context-free grammars, the solution of a nonsingular linear system of equations, computations of the inverse, determinant, characteristic and minimal polynomials, and various factorizations of a matrix (see [151], [42], [1, Sections 6.3–6.6], [31, pages 49–51], [160], [127, Sections 18–20], [25, Chapter 2], [2], [59], [102], [175], [172], [173], [174], [89], [32], [5], [66], [171], [145], [103], and [87]. In particular Strassen's acceleration of MM in [151] implied the decrease of the known complexity exponent 3 of the cubic solution time to log2(7) ≈ 2.8074 for all these computational problems. The challenge brought MM and the complexity of algebraic computations to the limelight and motivated tremendous effort of numerous researchers around the globe, who competed for breaking the record of [151]. As Donald E. Knuth recalls, this "was not only a famous unsolved problem for many years, it also was worked on by all of the leading researchers in the field, worldwide." 3 Bilinear Computational Problems and Bilinear Algorithms A natural framework for their effort was the class of noncommutative bilinear algorithms, also called just bilinear algorithms. Such an algorithm solves a bilinear computational problem of the evaluation of a set of bilinear forms ch, h = 1, . . . , γ, in two sets of variables. MM(k, m, n) is a special case of this problem where one evaluates a set of kn bilinear forms ci,h such that C = (ci,h)k,n i,h=1 = AB for a pair of input matrices A = (ai,j )k,m j,h=1, but it is more convenient to study the general case first. i,j=1 and B = (bj,h)m,n Let these sets fill two vectors a = (ai)α i,j,h=1 denote the 3-dimensional tensor filled with constants ti,j,h from a fixed ring (e.g., integers, rational, real, or complex numbers, or matrices filled with such numbers), and represent that problem as follows, j=1, let T = (ti,j,h)α,β,γ i=1 and b = (bj)β ch(a, b) = α,β Xi,j=1 ti,j,haibj, for h = 1, . . . , γ. (3.1) A bilinear algorithm BA solves this problem of size (α, β, γ) by successively computing (i) two sets of 2r linear forms, lq = lq(a) and l′ q(b), q = 1, . . . , r, in the variables a1, . . . ,aα q = l′ and b1, . . . ,bβ, which are the coordinates of the vectors a = (ai)α (ii) r pairwise products l1l1, . . . , lrl′ (iii) the γ bilinear forms c1(a, b), . . . , cγ(a, b) as γ linear combinations of these products. The straightforward VV and MV and the algorithms of Examples 2.2 and 2.3 for 2 × 2 MM are examples of bilinear algorithms for MM. At the end of this section we recall two other bilinear algorithms for two important and popular bilinear problems (see Examples 3.1 and 3.1). r, and i=1 and b = (bj)β j=1, respectively, The number r of bilinear multiplications at stage (ii) is called the rank of the algorithm. The constant coefficients in parts (i), (ii), and (iii) form three matrices U = (u(q) )α,r i,q=1, V = j,q=1, and W = (w(q) )β,r h,q=1, such that h )γ,r i (v(q) j ch = r Xq=1 w(q) h lql′ q, for lq = α Xi=1 u(q) i ai, l′ q = β Xj=1 v(q) j bj, h = 1, . . . , γ, and q = 1, . . . , r. (3.2) The rank of a bilinear computational problem is the minimal rank of bilinear algorithms for that problem. It depends on the field of constants, e.g., can be different for real and complex constants. 1The algorithm designers try hard to reduce various problems of modern numerical and symbolic computations to MM, with no considerable overhead, because MM, and even the straightforward cubic time MM, has been very efficiently implemented on modern computers. 5 A bilinear algorithm BA above performs (i) r bilinear multiplications of lq by l′ (ii) (α + β + γ)r multiplications by scalars u(q) q for q = 1, . . . , r; h = 1, . . . , γ, and q = 1, . . . , r; , v(q) j , and w(q) h , for i = 1, . . . , α; j = 1, . . . , β; i (iii) (α − 1)r additions of scaled variables ai, i = 1, . . . , α; (β − 1)r additions of scaled variables bj, j = 1, . . . , β, and (r − 1)γ additions of scaled bilinear products lql′ q, q = 1, . . . , r. These upper estimates decrease in the case of sparse matrices U , V , and W . Let nnz(M ) and n∗(M ) denote the numbers of entries of a matrix M that are nonzero and are neither of 0,1, and −1, respectively. Then the above bilinear algorithm performs at most n∗(U ) + n∗(V ) + n∗(W ) scalar multiplications and at most (nnz(U ) − r) + (nnz(V ) − r) + (nnz(W ) − γ) scalar additions and subtractions. Fast bilinear algorithms for the following two bilinear problems enable fast practical complex and polynomial MM, respectively (see Section 16.1). Example 3.1. Multiplication of two complex numbers. Evaluate the two bilinear forms a1b1 − a2b2 and a1b2 + a2b1, which represent the real and imaginary parts, respectively, of the product of two complex numbers a1 + ia2 and b1 + ib2. The straightforward bilinear algorithm for this problem has rank 4, but here is a rank-3 algorithm: 1 = a1b1, l2l′ l1l′ a1b1 − a2b2 = l1l′ 2 = a2b2, l3l′ 3 = (a1 + a2)(b1 + b2), 3 − l1l′ 1 − l2l′ 2. 2, a1b2 + a2b1 = l3l′ 1 − l2l′ Example 3.2. Convolution. Compute the coefficients of the product c(x) = Pm+n h=0 chxh of two i=0 aixi and b(x) = Pn polynomials a(x) = Pm j=0 bjxj or, equivalently, the convolution of the coeffi- cient vectors of these two polynomials, ch = Pk g=0 agbh−g, for h = 0, . . . , m + n, where ai = bj = 0 for i > m and j > n. The straightforward algorithm solves this problem by applying (m + 1)(n + 1) scalar multiplications and (m+1)(n+1)−m−n−1 scalar additions, but FFT-based bilinear algorithm uses just O((m + n) log(m + n)) arithmetic operations (see Appendix B). We refer the reader to [73], [72], [117], [36], [85], [153], [139], [37], and [38] for the early study of bilinear algorithms and to [31, Section 2.5] for its concise exposition, and to [117, part 3 of Theorem 1], [141], and [131, part 3 of Theorem 0.1] for some results on the reduction from non-bilinear MM to bilinear MM. 4 Tensor Representation of Bilinear Algorithms and Tensor Product Observe that a bilinear algorithm BA of rank r of Section 3 can be equivalently represented as a rank-r decomposition of the tensor T = (ti,j,h)i,j,h: ti,j,h = r Xq=1 i v(q) u(q) j w(q) h for i = 1, . . . , k; j = 1, . . . , m; h = 1, . . . , n. (4.1) This implies that the rank of a bilinear computational problem is precisely the rank of its tensor. Now suppose that two tensors T = (ti,j,h)α,β,γ i′,j ′,h′=1 define two sets of bilinear forms of the sizes (α, β, γ) and (α′, β′, γ ′), respectively, and define another set of bilinear forms of the size (αα′, ββ′, γγ ′) by the tensor product i,j,h=1 and T ′ = (t′ ′i,j ′,h′)α′,β ′,γ ′ T ⊗ T ′ = (ti,i′,j,j ′,h,h′)k,m,m,n,n,k i,i′,j,j ′,h,h′=1. (4.2) Theorem 4.1. Given two tensors T = (ti,j,h)i,j,h of rank r and T ′ = (t′ i′ v′(q) such that ti,j,h = Pr all i′, j′, and k′, the tensor product T ⊗ T ′ = (ti,i′,j,j ′,h,h′)i,i′,j,j ′,h,h′ has rank at most rr′. i′(q) ,j ′(q) ,h′(q) = Pr′ for all i, j, and k and t′ q′=1 u′(q) q=1 u(q) i v(q) j w(q) h i′,j ′,h′)i′,j ′,h′, of rank r′, for j ′ w′(q) h′ 6 Proof. Decompose the tensor T ⊗ T ′ by using the equations ti,i′,j,j ′,h,h′ = (cid:16) j w(q) r i v(q) u(q) Xq=1 , v(qq′) j,j ′ = v(q) j v′(q) j ′ r′ h (cid:17) (cid:16) Xq′=1 , w(qq′) h,h′ = w(q) i′ v′(q) u′(q) j ′ w′(q) h′ (cid:17) = r,r′ Xq,q′=1 i,i′ v(qq′) u(qq′) j,j ′ w(qq′) h,h′ where u(qq′) i,i′ = u(q) i u′(q′) i′ h w′(q) h′ for all 6-tuples (i, i′, j, j′, h, h′). 5 Bilinear MM and the Associated Tensors The tensor T associated with the problem MM(k, m, n) has entries with subscripts represented by three pairs of integers (i, i′), (j, j′), and (h, h′), rather than by three integers i, j, and h: T = (t(i,i′),(j,j ′),(h,h′))k,m,m,n,n,k i,i′,j ′,j ′,h,h′=1, t(i,i′),(j,j ′),(h,h′) = δi′,j δj ′,hδh′,i for all i, i′, j, j′, h, and h′., (5.1) Here and hereafter We can represent a bilinear algorithm of rank r for the computation of the matrix product δq,q = 1, δq,s = 0 if q 6= s. (5.2) C = AB by the following equations: ci,h = Xj ai,jbj,h = r Xq=1 w(q) h,i lql′ q for i = 1, . . . , k; h = 1, . . . , n. (5.3) Here lq and l′ q are linear forms in the entries of the matrices A and B (cf. (3.2)), lq = lq(A) = k,m Xi,j=1 u(q) i,j ai,j and l′ q = l′ q(B) = m,n Xj,h=1 v(q) j,hbj,h, q = 1, . . . , r, (5.4) and the algorithm is defined by a triple of 3-dimensional tensors, U = (cid:16)u(q) i,j(cid:17)k,m,r i,j,q=1 , V = (cid:16)v(q) j,h(cid:17)m,n,r j,h,q=1 , W = (cid:16)w(q) h,i(cid:17)n,k,r h,i,q=1 . (5.5) We can rewrite the above expressions removing the links among the subscripts: U = (cid:16)u(q) i,i′(cid:17)k,m,r i,i′,q=1 , V = (cid:16)v(q) j,j ′(cid:17)m,n,r j,j ′,q=1 , W = (cid:16)w(q) h,h′(cid:17)n,k,r h,h′,q=1 . (5.6) Then simultaneous equations (5.3) and (5.4) can be equivalently rewritten as follows (cf. [35]), r Xq=1 i,i′ v(q) u(q) j,j ′ w(q) h,h′ = δi′,j δj ′,h δh′,i for i, h′ = 1, . . . , k; i′, j = 1, . . . , m; j′, h = 1, . . . , n, (5.7) We can rewrite the tensor T as 3-dimensional tensor by replacing every pair of subscripts by a single index, namely, (i, i′) by ¯i = i + mi′ for i = 1, . . . , k, (j, j′) by ¯j = j + ni′ for j = 1, . . . , m, and (h, h′) by ¯h = h + kh′ for h = 1, . . . , n, so that t(i,i′),(j,j ′),(h,h′) = t¯i,¯j,¯h for ¯i = 1, . . . , km; ¯j = 1, . . . , mn; ¯h = 1, . . . , nk. (5.8) We can similarly write r Xq=1 u(q) ¯i v(q) ¯j w(q) ¯h = t¯i,¯j,¯h for ¯i = 1, . . . , km; ¯j = 1, . . . , mn; ¯h = 1, . . . , nk. (5.9) 7 6 Recursive Bilinear Algorithms for MM. Exponents of MM The tensor product construction of equation (4.2) provides useful insight into recursive algorithm for MM. Given the problem MM(k, m, n) of the computation of matrix product C = AB, we can fix a triple of positive integers (k′, m′, n′) substitute matrices of sizes k′ × m′, m′ × n′, and k′ × n′ for the entries of the matrices A, B, and C, respectively, and arrive at the problem MM(kk′, mm′, nn′). Equivalently we can define this problem by its tensor, which is the product T ⊗ T ′ of the two tensors T and T ′ associated with the two problems MM(k, m, n) and MM(k′, m′, n′), respectively. Apply Theorem 4.1 and obtain rank(MM(kk′, mm′, nn′)) ≤ rank(MM(k, m, n)) · rank(MM(k′, m′, n′)). (6.1) By recursively applying inequality (6.1) for k = k′ = m = m′ = n = n′ = 2i, for i = 1, 2, . . . we can bound the ranks in recursive extensions of the algorithms of Examples 2.2 and 2.3 for 2 × 2 MM. Next we generalize the recursive processes based on Examples 2.2 and 2.3 – we define recursive bilinear algorithms based on any bilinear algorithm for MM(n) of a fixed n. Theorem 6.1. Given a bilinear algorithm of rank r for n × n MM, one can perform K × K MM for all K by using at most c · K ωn,r scalar arithmetic operations for a fixed c independent of K and for the exponent ωn,r = logn(r). Proof. Substitute n× n matrices for variables, re-apply the algorithm recursively, and in d steps, for any d, arrive at a bilinear algorithm of rank rd for nd × nd MM. Then recall that a linear operation of multiplication of a q × q matrix by a scalar as well as an addition or subtraction of a pair of q × q matrices can be performed in q2 scalar arithmetic operations and deduce that the arithmetic cost of performing all linear operations involved in the algorithm stays within the claimed bound. By minimizing ωn,r = logn(r) over the ranks r of all bilinear algorithms for n × n MM define ωn = min r ωn,r. (6.2) Then, by minimizing ωn,r over all integers n not exceeding a fixed integer K, define the exponent ω≤K = min n≤K ωn. For K = ∞ obtain the universal or theoretical exponent of MM ω = inf n≤∞ ωn. (6.3) (6.4) Here and hereafter (except for Section 18) we consider MM over the fields of real and complex numbers, but the presented algorithms can be defined over other fields and rings as well and in some cases (to a more limited extent) over semirings (see [66], [171], [103], and the bibliography therein). Over the fields the theoretical exponent ω only depends on the field characteristic [146, Theorem 2.8], while the hidden overhead constants can vary greatly even over the fields having the same characteristic. 7 To the exponent 2.78 by means of trilinear aggregation Breaking Strassen's barrier of log2(7) ≈ 2.8074 for ω was considered to be almost in hands in 1969, but this goal of "literally all the leading researchers in the field, worldwide" has remained a dream for almost a decade. If one could build a recursive process on the algorithm of Example 2.1, then the dream would have come true even well before Strassen's discovery of [151]. Indeed the algorithm of this example has rank r = n3/2 + n2 for any even n, e.g., has rank r = 144 for n = 6. Substitute these data into the equation ω = logn(r) and obtain ω ≤ log6(144) ≈ 2.7737 < log2(7) ≈ 2.8074. 8 Theorem 6.1, however, cannot be applied here because MM is not commutative, and so the substi- tution of matrices for the variables ai and bj would have violated the basic identities of Example 2.1. For example, we cannot apply the equation v22a22 = u22v22 if u22 and v22 are matrices, e.g., if u22 = (cid:18)1 0 0 0(cid:19) and v22 = (cid:18)0 0 1 0(cid:19) because 0(cid:19) = (cid:18)0 1 0 (cid:18)1 0 0 0(cid:19) (cid:18)0 0 1 0(cid:19) 6= (cid:18)0 0 1 0(cid:19) (cid:18)1 0 0 0(cid:19) = (cid:18)0 0 0 0(cid:19) . The algorithm of Example 2.1, based on (2.2), belongs to the class of commutative bilinear or quadratic algorithms. They only differ from non-commutative bilinear algorithms at the stage of nonlinear multiplications lql′ q, q = 1, . . . , r; they multiply pairs of linear forms lq = lq(a, b) and l′ q = l′ q(a, b) in the coordinates of both input vectors a and b, but this difference turned out to be crucial when we try to apply the algorithm recursively. Strassen's record of [151] would have fallen if one performed 2 × 2 MM by using six bilinear multiplications, but [83], [84], [38] proved that 7 is the sharp lower bound on the rank of 2 × 2 MM. Actually 15 is the sharp lower bound on the number of additions and subtractions in all bilinear algorithms of rank 7 for 2 × 2 MM (cf. [140], [40]), and moreover the following theorem defines explicit expressions for all bilinear algorithms of rank 7 for 2 × 2 MM appeared in [117, Theorem 3] (see also [58] and [131, Theorem 0.3]). Two bilinear algorithms, both of rank r, for the same problem of MM(k, m, n) (see (5.5)), defined by two triples {U, V, W} and {U , V , W}, respectively, are said to be equivalent to one another if u(q) i,j = Σv,κσi,v∇j,κu(t(q)) v,κ , v(q) g,h = Σv,κλv,gµh,κv(t(q)) v,κ , and w(q) l,q = Σv,κγv,lβκ,qw(t(q)) v,κ , where the matrices in the three pairs (σi,v) and (γv,l), (∇j,κ) and (λv,g), and (µh,κ) and (βκ,q) are the inverses of one another; 1 ≤ t(s) ≤ r; tq1 6= tq2 if q1 6= q2, and all t(q) are integers. Theorem 7.1. Every bilinear algorithm of rank 7 for 2 × 2 MM is equivalent to the algorithms of Examples 2.2 and 2.3. We refer the reader to the paper [108] for the current record lower bounds on the rank of M M (n) for all n, to the papers [83], [84], [117, Theorem 1], [36], [38], [39], [26], [27], [142], [147], and [101] for some earlier work in this direction, and to the papers [64] and [149] for various lower and upper bounds on the arithmetic complexity and the ranks of rectangular MM of smaller sizes. Since the study of MM(2) could not help decrease the exponent log2(7), the researchers tried to devise a bilinear algorithm of rank 21 for MM(3) because log3(21) < log2(7) ≈ 2.8074. This turned out to be hard, and we still cannot perform 3× 3 MM by using less than 23 bilinear multiplications. The exponent log2(7) ≈ 2.8074 was decreased only in 1978, when the paper [118] presented a bilinear algorithm of rank 143,640 for 70× 70 MM. This implied the exponent ω = log70(143, 640) < 2.7962 for M M (n) and consequently for n× n matrix inversion, Boolean M M (n), and various other well-known computational problems linked to MM and partly listed in Section 2.3. The paper [118] has extended some novel techniques of the paper [117] of 1972, published in Russian2 and translated into English only in 2014 in [131]. Namely the paper [117] has accelerated the straightforward MM by combining trilinear interpretation of bilinear algorithms and the aggregation method. By following [118] we call this combination trilinear aggregation and briefly cover it in the next two sections. By refining trilinear aggregation of [117] the papers [118], [119], [121], [122], and [123] proposed various algorithms that further accelerated MM. In particular the paper [123] yielded the exponent and this still remains the record exponent ω≤K for feasible MM. The technique of trilinear aggregation has been recognized for its impact on the decrease of the MM exponent, but the paper [117] was also a landmark in the study of multilinear and tensor ω44 ≤ 2.7734, (7.1) 2Until 1976 the author of [116] and [117] lived in the Soviet Union. From 1964 to 1976 he has been working in Economics in order to make his living and has written the papers [116] and [117] in his spare time. 9 decompositions. Such decompositions introduced by Hitchcock in 1927 received little attention except for a minor response in 1963–70 with half of a dozen papers in the psychometrics literature. The paper [117] of 1972 provided the earliest known application of nontrivial multilinear and tensor decomposition to fundamental matrix computations, now a popular flourishing area in linear and multilinear algebra with a wide range of important applications to modern computing (see [159], [96], [113], [78], and the bibliography therein). 8 Trilinear Representation and Dual Bilinear Algorithms Trilinear representation of a bilinear algorithm enables transparent demonstration of the technique of trilinear aggregation. Otherwise it is equivalent and quite similar to its tensor representation. Let a bilinear algorithm of rank r be represented by equations (3.2). Multiply them by new variables dh, sum the products in h, and arrive at the following representation of the algorithm as a decomposition of a trilinear form, k,m,n Xi,j,h=1 ti,j,haibjdh = r Xs=1 lq(a)l′ q(b)l′′ q (d) (8.1) q = l′ for lq = lq(a) and l′ h dh, and q = 1, . . . , r. By equating the coefficients of the variables dh on both sides of this trilinear decomposition we come back to the original bilinear representation (3.2) of the same algorithm, and we can obtain its two alternative dual bilinear representations by equating the coefficients of the variables ai and bj instead. q(b) of (3.2), l′′ q (d) = Pn h=1 w(q) q = l′′ Here is a simple example of the trilinear representation of the bilinear algorithm of Example 3.1. Example 8.1. A trilinear decomposition of rank 3 for multiplication of two complex numbers. a1b1d1 − a2b2d1 + a1b2d2 + a2b1d2 = a1b1(d1 − d2) − a2b2(d1 + d2) + (a1 + a2)(b1 + b2)d2. By equating the coefficients of the variables dh on both sides we come back to the bilinear algorithm of Example 3.1. By equating the coefficients of a1 and a2 on both sides of this equations or alternatively the coefficients of b1 and b2 on their both sides, we arrive at two alternative bilinear algorithms of rank 3 for computing the product of two complex numbers. They are close to one another but not to the algorithm of Example 3.1. We display just one of the two. Example 8.2. A distinct trilinear decomposition of rank 3 for multiplying two complex numbers. 1 = d1 − d2, 2 = d1 + d2, 3 = d2, l1 = b1, l′ l2 = b2, l′ l3 = b1 + b2, l′ b1d1 + b2d2 = l1l′ b1d2 − b2d1 = l3l′ The book [167] demonstrates the power of duality technique in devising some efficient bilinear 1 + l3l′ 3, 3 − l2l′ 2. algorithms for FIR-filters and multiplication of complex numbers and polynomials. In the rest of this section we apply and extend the above discussion to the special case of i,j=1 and B = j,h=1. We can represent such an algorithm by means of the following trilinear decomposition, the algorithms for the problem MM(k, m, n) of multiplying two matrices A = (ai,j )k,m (bj,h)m,n r q(B)l′′ q (D) for l′′ q = l′′ ai,jbj,hdh,i = Trace(ABD) = Xi,j,h q of (5.4), and q = 1, . . . , r. Here D = (dh,i)n,k Pi mi,i denotes the trace of a matrix M = (mi,j)i,j. lq and l′ Xs=1 lq(A)l′ q (A) = n,m Xh,i=1 w(q) h,i dh,i, (8.2) h,i=1 is an auxiliary n×k matrix and Trace(M ) = 10 Example 8.3. A trilinear vesion of Strassen's bilinear algorithm of Example 2.2 for M M (2). l1l′ 1l′′ l2l′ l5l′ 1 = (a11 + a22)(b11 + b22)(d11 + d22), i,j,h=1 ai,jbj,hdh,i = P7 P2 sl′′ s=1 lsl′ s , 4l′′ 3l′′ 2l′′ 3 = a11(b12− b22)(d12 + d22), l4l′ 2 = (a21 + a22)b11(d21− d22), l3l′ 4 = (a21− a11)(b11 + b12)d22, 7l′′ 5l′′ 5 = (a11 + a12)b22(d12− d11), l6l′ 6l′′ 6 = a22(b21− b11)(d11 + d21), l7l′ 7 = (a12− a22)(b21 + b22)d11. We can come back to the original bilinear algorithm of Example 2.2 for the 2× 2 matrix product AB by equating the coefficients of the variables dh,i on both sides of a trilinear decomposition. By equating the coefficients of the variables ai,j also on both sides or alternatively of bj,h on both sides, we can obtain two dual bilinear algorithms. In this case the three dual algorithms differ little from each other, but let us be given a bilinear algorithm of a rank r for rectangular MM(k, m, n). Then we arrive at the dual algorithms of rank r for the problems M M (n, m, k), and M M (k, n, m) as well (cf. [117, part 5 of Theorem 1], [36], [85], [139]). A bilinear algorithm for MM(k, m, n) can be readily extended to three other dual algorithms of the same rank for the three other problems MM(m, k, n), M M (n, m, k), and M M (k, n, m) because we can interchange the subscripts of the variables. The number of linear operations (unlike the rank) can differ in the transition among the three dual algorithms, and this can possibly be exploited for minimizing this number. Here is a useful combination of duality with tensor product construction. Given a trilinear decom- position of rank r for the problem of MM(k, m, n), obtain that the dual problems of MM(m, n, k) and MM(n, k, m) also have rank r. Apply bound (6.1) and obtain that the problem MM(kmn, kmn, kmn) has rank at most r3. Now apply Theorem 6.1 for n replaced by kmn and obtain the following result, which first appeared as claim 1 of [117, Theorem 1]. Theorem 8.1. Given a bilinear or trilinear algorithm of rank r for M M (k, m, n) and any 4-tuple of integers k, m, n, and r such that kmn > 1, one can perform M M (K) by using cK ω arithmetic operations for any K, for ω = ωk,m,n,r = 3 logkmn(r), and for a constant c independent of K. 9 Trilinear Aggregation and Disjoint MM Aggregation technique is well-known in business, economics, computer science, telecommunication, natural sciences, medicine, and statistics. The idea is to mass together or cluster numerous in- dependent but similar units into much fewer aggregates. Then the study is simplified but is sup- posed to characterize all the units either directly or via disaggregation techniques. Such aggre- gation/disaggregation processes in [109] served as a springboard for the emergence of the field of Algebraic Multigrid, now quite popular. Aggregation/disaggregation techniques are behind the acceleration of MM in Example 2.1, pre- ceded by similar application of this technique to polynomial evaluation with preprocessing of coeffi- cients [116], [94]. The papers [117] and [118] apply aggregation in order to compress the decompo- sition of the trilinear form Trace(ABC) by playing with the shared subscripts of distinct variables. Other implementations of this technique appeared in [119], [120], [122], [123], and [100]. For demonstration of these techniques, consider disjoint MM of computing two independent matrix products AB and U V represented by the trilinear form Trace(ABD + U V W ) = k,m,n Xi,j,h=1 (ai,jbj,hdh,i + uj,hvh,iwi,j). For k = m = n, we would seek a pair of disjoint n × n matrix products, which is quite a realistic task in computational practice. For each triple i, j, h define the aggregate (ai,j + uj,h)(bj,h + vh,i)(dh,i + wi,j ) of two monomials ai,jbj,hdh,i and uj,hvh,iwi,j and let k,m,n T = Xi,j,h=1 (ai,j + uj,h)(bj,h + vh,i)(dh,i + wi,j ) 11 denote the sum of the kmn aggregates. Let T1 = k,m Xi,j=1 ai,jsi,jwi,j , T2 = m,n Xj,h=1 uj,hbj,hrj,h, and T3 = n,k Xh,i=1 qi,hvh,idh,i denote three groups of correction terms where qi,h = m Xj=1 (ai,j + uj,h), si,j = n (bj,h + vh,i), and rj,h = Xh=1 k Xi=1 (dh,i + wi,j). Then the equation defines a trilinear decomposition of rank mnp + mn + np + pm (versus the rank 2mnp of the straightforward algorithm). Table 9.1 displays this decomposition in compressed form. Trace(ABD + U V W ) = T − T1 − T2 − T3 (9.1) Table 9.1: Aggregation/disaggregation of a pair of MM terms. ai,j uj,h yj,h dh,i vh,i wi,j Sum the two entries in each column of the table, multiply the three products together, and obtain an aggregate. Multiply together the three entries in each row of the table and obtain the two output terms ai,jbj,hdh,i and uj,hvh,iwi,j . The cross-products of other triples of the table define six correction terms. Their sum over all n3 triples of indices i, j, and h has rank 2(km + mn + nk). By subtracting this sum from the sum of all kmn aggregates, we decompose 2kmn terms of Trace(ABD + U V W ) into the sum of kmn + 2(km + mn + nk) terms. For m = n = p = 34 this implies a decomposition of rank n3+6n2 for a pair of disjoint M M (n), versus the rank 2n3 of the straightforward decomposition. Demonstration of the power of trilinear aggregation can be made more transparent for disjoint MM, whose natural link to trilinear aggregation has been shown in [125], [126, Section 5], [127, Section 12], and [100]. The known constructions for pairs of disjoint n × n MM, however, have been extended to a single M M (n) for even n. In particular the paper [117] presented a trilinear decomposition of rank 0.5n3 + 3n2 for M M (n) and any even n similar to the above decomposition of Trace(ABD + U V W ). This implied the M M exponent logn(0.5n3 + 3n2), which is less than 2.85 for n = 34. The paper [118] presented a trilinear decomposition of rank (n3 − 4n)/3 + 6n2 for M M (n), n = 2s, and any positive integer s. For n = 70 this defines the MM exponent 2.7962. Then again it is convenient to demonstrate this design for disjoint MM associated with a decomposition of the trilinear form Trace(XY Z +U V W +ABD). The basic step is the aggregation/disaggregation defined by Table 9.2. Table 9.2: Aggregation/disaggregation of a triple of MM terms. xi,j uj,h ah,i bj,h zh,i vh,i wi,j bi,j dj,h Sum the kmn aggregates (xi,j + uj,h + ah,i)(yj,h + vh,i + bi,j)(zh,i + wi,j + dj,h), subtract order of n2 correction terms, and obtain a decomposition of rank n3 + O(n2) for Trace(XY Z + U V W + ABD), 12 versus the rank 3n3 of the straightforward decomposition. The trace represents three disjoint prob- lems of M M (n), that is, the computation of the three independent n× n matrix products XY , U V , and AB, and we obtain a trilinear decomposition of rank n3 + O(n2) for this task. With a little more work one obtains a similar trilinear decomposition of [118] of rank (n3−4n)/3+ 6n2, for any even n, and this implied the bound ω70 < 2.7962. Refinements of this construction implied smaller upper bounds (see Tables 15.1 and 15.2). In particular the algorithm of [123] yielded the bound ω44 ≤ 2.7734 of (7.1). 10 Any Precision Approximation (APA) Algorithms Based on the following table we arrive at the technique of Any Precision Approximation,3 which is quite efficient for fast symbolic MM and for other symbolic algebraic computations. Table 10.1: Aggregation/disaggregation of a pair of MM terms for Any Precision Approximation MM. ai,j λuj,h bj,h λvh,i λ2dh,i wi,j For λ = 1 this table turns into Table 9.1 but for variable λ helps us demonstrate the APA technique of [20], [24], and [21]. Let λ → 0 and obtain trilinear decomposition Trace(ABD + U V W ) = λ−2(S − T1 − T2 + O(λ)), (10.1) where S = k,m,n Xi,j,h=1 (ai,j + λuj,h)(bj,h + λvh,i)(λ2dh,i + wi,j ), is the sum of kmn aggregates, for ai,jqi,j wi,j, and T2 = T1 = k,m Xi,j=1 n qi,j = (bj,h + λvh,i) and rj,h = Xh=1 m,n Xj,h=1 uj,hbj,hrj,h k Xi=1 (λ2dh,i + wi,j ). The terms of order λ vanish as λ → 0. Counting only the remaining monomials on the right-hand side of (10.1), we define the border rank of the decomposition. It is equal to kmn + km + kn, versus the larger rank kmn + km + kn + mn of decomposition (9.1). Generally, given a trilinear form T (e.g., given by the 3-dimensional tensor of its coefficients), multiply it by λd for a fixed nonnegative integer d and define a trilinear decomposition of the trilinear form λd · T with coefficients being polynomials in λ. Delete the terms of order λd+1 and higher and call the number of the remaining terms the border rank of the decomposition and of the associated APA algorithm. The minimal border rank over all such APA algorithms for a fixed trilinear form λd · T define its border rank. All this can be readily restated for a set of bilinear forms replacing a single trilinear form T . We can equate the coefficients of the variables dh,i and wi,j in the trilinear APA decomposition above and arrive at the bilinear problem of the evaluation of two disjoint matrix products AB and 3Hereafter we use the acronym APA. 13 U V . The kmn trilinear aggregates turn into the kmn bilinear products (ai,j + λuj,h)(bj,h + λvh,i) for all i, j, and h. Clearly, ai,j + λuj,h → ai,j and bj,h + λvh,i → bj,h as λ → 0, but we must keep the terms λuj,h and λvh,i in the aggregates in order to compute the matrix U V . This forces us to double the precision of the representation of the multiplicands ai,j + λuj,h and bj,h + λvh,i compared to the precision of the representation of the entries ai,j, uj,h, bj,h, and vh,i. For example, suppose that λ = 2−s for a sufficiently large integer s and that ai,j, uj,h, bj,h, and vh,i are s-bit integers in the range [0, 2s). Then 2s bits are required in order to represent each of the multiplicands ai,j + λuj,h and bj,h + λvh,i. If s exceeds the half-length of the computer word, then using 2s bits in APA algorithms would move us beyond the length of the computer word, e.g., beyond the IEEE standard double precision. This can be costly in numerical computations, but APA is valuable in symbolic computation where efficient tchniques such as Chinese remainder algorithm and p-adic lifting facilitate computa- tions with long numbers (cf. our Section 18). The papers [20], [24], and [21] study border rank of MM and various other fundamental bilinear computational problems and show that border rank is quite frequently smaller than their rank. 11 Bini's Construction In the community of the Theory of Computing APA algorithms have been mostly and highly appre- ciated as a tool for decreasing the record upper bounds on the theoretical exponent ω of (6.4). Their power in this context is due to Bini's theorem in [19], according to which APA decomposition of border rank r and bilinear algorithms of rank r, both for the same bilinear problem, define the same upper estimate for the exponent ω. Bini's argument demonstrates generally fruitful idea of operating with matrix polynomials and finally recovering some scalar matrices of their coefficients. Histori- cally this became the springboard for the derivation of the MM technique of EXPAND, PRUNE, and CONQUER. Next we outline Bini's argument. Multiply trilinear decomposition (10.1) of Trace(ABD + U V W ) by the variable λ and arrive at a decomposition of λ · Trace(ABD + U V W ) whose coefficients are polynomials in λ of degree at most d = 2. Interpolate to Trace(ABD + U V W ) from d + 1 values of the polynomial. The interpolation increases the rank by a factor of at most (d + 1)2, that is, by at most a factor of 9 for d = 2,4 and the resulting rank 9θ · (mkn + mk + kn) for a constant θ > 1 greatly exceeds the rank 2mkn of the straightforward algorithm for Trace(ABD + U V W ). We can overcome this deficiency, however, if we recursively extend an APA algorithm to M M (n2q ) for q = 0, 1, . . . . At the qth recursive step substitute n2q × n2q matrices for the input entries and observe that this squares both dimension N of the M M (N ) and border rank br(N ) but only doubles the degree of the decomposition in λ. Hence in q recursive steps r(N ) ≤ INTq · br(N ), INTq = 2q(d + 1)2, br(N ) = (br(n))2q where r(N ) denotes rank, br(N ) and br(n) denote border ranks, N = n2q factor of the border rank in its transition to the rank in q recursive steps. Therefore , and INTq is the growth ωN,br(N ) ≤ logN (r(N )) ≤ logN (INTq · br(N )) = logn2q (INTq · br(n)2q Observe that (INTq)1/2q → 1 as q → ∞, recall bound (6.4), and deduce Bini's estimate ) = logn((INTq)1/2q br(n)). ω ≤ lim q→∞ ωN,br(N ) ≤ lim q→∞ logn(br(n)). The argument is readily extended to APA of rectangular MM, that is, ω ≤ 3 logkmn(br(k, m, n)) where br(k, m, n) denotes the border rank of MM(k, m, n) for a fixed triple of k, m, and n. 4By using FFT we can interpolate to a polynomial from its values at Kth roots of unity by using 1.5K log2 K + K arithmetic operations provided that K = 2k > d for a positive integer k [130, Theorem 2.2.2]; for d = k = 2, this implies interpolation factor 14. 14 12 Schonhage's Construction. EXPAND, PRUNE, and CONQUER Algorithms The above APA decomposition for Trace(ABD + U V W ) is associated with disjoint MM rather than MM, but Schonhage in [146] has extended Bini's theorem by proving that the theoretical exponent ω of MM can be bounded based on the APA decomposition for disjoint MM as follows. Theorem 12.1. [146]. The theoretical exponent ω of MM in (6.4) does not exceed 3τ if there exists a bilinear or trilinear algorithm of rank r or an APA algorithm of border rank r for s disjoint MM problems of sizes (ki, mi, ni), for i = 1, . . . , s, such that Ps i=1(kimini)τ = r. The theorem has interesting interpretation in terms of the following Direct Sum Conjecture (first stated and then retracted by V. Strassen): the rank of s disjoint MM problems of sizes (ki, mi, ni), for i = 1, . . . , s, is not less than Ps i=1 ri where ri denotes the rank of the problem MM(ki, mi, ni). This conjecture is still open but becomes wrong if in its statement border ranks replace ranks. Indeed decomposition (10.1) for disjoint pair of MM(k, m, n) and MM(m, n, k) has border rank knm + km + kn, that is, mn + m + n for k = 1. One can readily prove that the border rank of each of MM(1, m, n) and MM(m, n, 1) is mn and then observe that 2mn > mn + m + n for m = n > 2.5 Nevertheless Theorem 12.1 can be equivalently stated as follows: The bound of Theorem 12.1 on the exponent ω of (6.4) cna be immediately verified if the border rank version of the Direct Sum Conjecture held true. In [146] Schonhage proved the theorem without assuming that the Conjecture is true. His proof is the simplest in the case where ki = mi = ni = n, for i = 1, . . . , s, and s divides r, that is, where we are given an APA bilinear decomposition of border rank r = gs for s disjoint problems MM(n) and an integer g. Then substitute n × n matrices for the variables, reapply the algorithm for every s-tuple of bilinear multiplications, obtain an APA bilinear algorithm of border rank r · r/s = (r/s)2s for s disjoint problems of MM(n2), and extend this process recursively. q recursive steps define an APA bilinear algorithm of border rank (r/s)qs for s disjoint problems of MM(nq). Prune the input keeping just a single problem MM(nq), apply Bini's theorem, and deduce from (6.4) that ω ≤ log(nq)(cid:16)s ·(cid:16) r s(cid:17)q(cid:17) = logn(cid:16) r s(cid:17) + 1 q logn(s). For q → ∞ obtain Schonhage's bound ω ≤ logn(r/s) in this special case. We can quite readily relax the assumption that s divides r; furthermore by proceeding similarly to the proof of Theorem 8.1 we yield extension to the case of s · MM(k, m, n), where we are given an APA bilinear algorithm of a border rank r for s disjoint problems of rectangular MM(k, m, n). Let us extend these results to the pair of disjoint problems of MM(k, m, n) and MM(m, n, k) represented in Tables 9.1 and 10.1. Let a basic APA algorithm have a border rank r. Then q recursive steps define an APA algorithm of border rank rq for 2q disjoint MM problems. Grouping together the MM problems of the same size we obtain q + 1 disjoint groups of MM problems Ti · (kimq−i, minq−i, nikq−i) with binomial coefficients Ti = (cid:18)q i(cid:19) for i = 0, 1, . . . , q. Choose even q, term Ts · (K, M, N ) = (cid:18)2s s (cid:19) · (ksms, msns, nsks); restrict the given decomposition of border rank write q = 2s and (K, M, N ) = (ksms, msns, nsks), and prune the disjoint MM keeping only the r2s to this term. In this special case we have already proved Theorem 12.1, and so we obtain ω ≤ 3 logR((kmn)2s) = 3 logR1/2s(kmn), for R = r2s/(cid:18)2s s (cid:19). Since s (cid:19)(1/2s) (cid:18)2s → 2 as s → ∞ 5This counter-example to the conjecture appeared in [146]; a little more involved one, based on an APA-variant of the decomposition of Table 9.2, appeared in [119]. 15 it follows that which proves the theorem in this special case. R1/2s → r/2 as s → ∞, and so ω ≤ 3 logr/2(kmn), In the general case of s disjoint MM problems of various sizes (ki, mi, ni), for i = 1, . . . , s, the same construction and the same proof techniques work. We again perform q recursive steps and arrive at a decomposition of border rank rq for disjoint MM made up of the terms MM(K, M, N ) i , and d1, . . . , ds range over all s-tuples of i=1 mdi i=1 ndi i=1 kdi nonnegative integers summed to q. where K = Qs i , M = Qs i , N = Qs Group all MM problems of the same size together into the terms of the form T · MM(K, M, N ) with T denoting the coefficients of multinomial expansion. Prune the decomposition to each of these terms (that is, delete all other terms), define its APA decomposition of border rank rq. Then for every term T · MM(K, M, N ) we can obtain an upper bound ω ≤ 3 logR(KM N ) for R = rq/T . Maximize these bounds over all such terms, let q → ∞, and arrive at the claimed bound of Theorem 12.1 in the general case. The name of EXPAND, PRUNE, and CONQUER is more adequate for these techniques than the traditional DIVIDE and CONQUER, and similarly for the derivation of Bini's bound if we view the interpolation to a single term as pruning. 13 Faster Decrease of the Exponent of MM by Using the EXPAND, PRUNE, and CONQUER Techniques EXPAND, PRUNE, AND CONQUER techniques enabled significant decrease of the exponent ω. Already the above APA decomposition of Trace(ABD + U V W ) implies the upper bound ω ≤ 3 logmkn(0.5(kmn + km + kn)) for any triple of k, m, and n. Indeed for k = n = 7 and m = 1, we arrive at APA bilinear algorithm of border rank 63 for the pair of disjoint problems of MM(7,1,7) and MM(7,7,1) – of computing the outer product of two vectors of dimension 7 and of the product of 7 × 7 matrix by a vector, respectively. Apply Theorem 12.1 and obtain ω ≤ 3 log49 31.5 < 2.66. (13.1) Refinement of this construction in [146] yielded the record estimate ω < 2.548, and [122] promptly decreased this record bound to ω < 2.522 by means of combining APA technique and trilinear aggregation for disjoint MM represented by Trace(ABC + U V W + XY Z). Further record of 2.496 was soon established in [54]. By continuing this line of research, the papers [155] and [55] decreased the upper estimates for the theoretical exponent of MM below 2.479 and 2.376, respectively. The MM algorithms of these papers began with APA decomposition for disjoint MM of small sizes. It is instructive to compare the initial trilinear identities in [155] and [55] with the decompo- sition for disjoint MMs defined by Tables 9.1, 9.2, and 10.1. According to [55, page 255], "Strassen used the following trilinear identity, related to . . . trilinear aggregation of [118]:" q Xi=1 (cid:16)x[2] 0 + λx[1] i (cid:17)(cid:16)y[1] 0 + λy[2] i (cid:17)(ziλ−1) − x[2] 0 y[1] 0 q Xi=1 zi = q Xi=1 (x[1] i y[1] 0 zi + x[2] 0 y[2] i zi) + O(λ). This defined a basic APA algorithm of border rank q + 1 for a pair of block inner products. [55] strengthened this construction by proposing the following basic APA algorithm of border 16 rank q + 2 for a triple of block inner products: λ−3(cid:16)x[0] 0 + λ2x[1] q Xi=1 λ−2(cid:16)x[0] i (cid:17)(cid:16)y[0] 0 y[1] (x[0] Xi=1 q 0 + λx[1] 0 + λy[1] i (cid:17)(cid:16)y[0] i (cid:17)(cid:16)z[0] 0 z[1] i y[0] i (cid:17) − 0 + λz[1] i (cid:17)(cid:16)z[0] i (cid:17) + (λ3 − qλ2)x[0] i y[1] 0 ) + O(λ). i z[0] i z[1] i + x[1] i + x[1] 0 + λ2y[1] 0 + λ2z[1] 0 y[0] 0 z[0] 0 = In both papers [155] and [55] the derivation of new record upper bounds on the exponent ω from the simple basic designs above required long sophisticated recursive processes and intricate pruning based on amazing and advanced mathematical arguments. Actually paper [55] deduced "only" the record bound log8(4000/27) < 2.40364 from the above design, but then proposed some extended and more involved initial designs and decreased the bound to the famous barrier of 2.376. This record was only beaten by 0.002 in 2010 [150] and then by additional 0.001 in 2012–2014 [162]. The challenge of reaching the exponent 2 is still open – in 2018 the record bound is about 2.3728639 [104]. Moreover the study in [4] showed that the power of the extension of the approach of [55] in the directions of [150], [162], and [104] is limited, and so the decrease of the exponent below 2.37 should require some new dramatically different ideas and techniques. Likewise it was proven in [3] that the group-theoretical approach of [49], [48] to the acceleration of MM, initially considered highly promising for achieving MM in nearly quadratic time, must include some new dramatically different ideas and techniques in order to produce any competitive MM algorithm. 14 Some Impacts of the Study of Fast MM The progress in decreasing the exponent ω towards its lower bound 2 has been essentially in stalemate for the last three decades, both for feasible MM at the level of about 2.7724 and for unfeasible MM at the level of about 2.38. that direction, which has virtually stalled after 1986. In spite of that disappointment we believe that overall the study of fast MM was already a success story. • Within less than two decades (by 1987) the straightforward upper bound 3 on the MM exponent of (6.4) decreased more than half-way to its lower bound 2 (see details in Appendix A). • In order to achieve this progress researchers have found and revealed new surprising resources and have developed amazing novel techniques, all built on the top of each other, involving sophisticated combinations of trilinear aggregation, APA algorithms, disjoint MM, and EX- PAND, PRUNE, and CONQUER techniques. • The study of fast MM was highly important for the Theory of Computing – the exponent ω is one of the most cited quantities in that large field because progress in its estimation can be immediately extended to a great variety of well-known and intensively studied computational problems, partly listed in Section 2.3. • Besides its impact on the Theory, the progress in decreasing the exponent ω strengthened the effort of researchers for the reduction of various computational problems to MM; such a reduction can be efficient even where the straightforward MM is applied. • Some fast algorithms for feasible MM have been devised, developed, and implemented. Now they make a valuable part of modern software for both numerical and symbolic computations. Even limited progress in this direction is valuable because MM is a fundamental operation of modern computations in Linear and Multilinear Algebra, while Polynomial MM makes major impact on the field of Polynomial Algebra (cf. [1], [31], [25], [43], [94], [77]). Next we recall sample by-products of the study of fast MM and of its methodological impact. 17 • Although the origin of the field of fast Algebraic Computations can be traced back to [114], [111], [156], and [116], the studies of fast MM in [165], [117], [36], [85], [153], [139], [140], [118], and [125] as well as APA algorithms in [19] and [20] have greatly motivated the effort and the progress in that field. • The duality technique of [117] for generating new efficient bilinear algorithms, with applications shown in [167] is a valuable by-product of the MM research. • The MM paper [117] was pioneering in demonstrating the power of the application of tensor decomposition to matrix computations, now a thriving and highly popular area. Finally, in contrast to reasonable pessimism of many experts about current perspectives for further substantial decrease of the exponent ω, the acceleration of feasible MM is a highly promising and dynamic area and, together with the implementation issues, is the main subject of the rest of our survey. 15 The Curse of Recursion and Fast Feasible MM Already in 1981 it has become clear that the progress in decreasing the theoretical exponent of MM is going to be separated from the acceleration of feasible MM. Arnold Schonhage has concluded the introduction to his seminal paper [146] of 1981 as follows: "Finally it must be stressed, however, that so far all these new results are mainly of theoretical interest. The point of intersection with Strassen's method6 lies beyond any practical matrix size, and . . . Pan's estimates of 1978 for moderate values of n are still unbeaten". Schonhage's account can be extended to the subsequent algorithms supporting record estimates for the exponent ω, except that the estimate 2.7962 of 1978 for the exponents of feasible MM has successively been decreased (although by small margins) in [119], [120], [122], and [123], based purely on trilinear aggregation. By 2018 the estimate w44 < 2.7734 of [123] still remains the record upper bound on the exponents of feasible MM, unbeaten since 1982. 31 years later A.V. Smirnov in [149] came very close to this record by applying advanced computer-aided search: one of his algorithm supports an exponent below 2.7743 for M M (54) (see Section 16.3). Tables 15.1 and 15.2 trace the progress in estimating the record exponents of feasible MM. The overhead constants associated with the exponents are reasonably small because the supporting algorithms avoid recursive application of nested block MM and rely just on trilinear aggregation. This progress in the acceleration of feasible MM was much slower than the progress in breaking records for the theoretical exponent ω, which is no surprise – the powerful resource of using unlimited recursive processes had to be excluded for devising algorithms for feasible MM. In contrast the techniques of EXPAND, PRUNE, and CONQUER that supports Bini's and Schonhage's theorems as well as the derivation of all known exponents below 2.7733 involve long recursive processes, and so the associated algorithms remain inferior to the straightforward MM until the problem size is blown up and becomes immense. Due to such a curse of recursion all these record breaking works had no relevance to feasible MM of today, tomorrow, or foreseeable future. Table 15.1: Complexity Exponents of Feasible MM Exponent Reference Year 2.8074 [151] 1969 2.7962 [118] 1978 2.7801 [120] 1979 2.7762 [122] 1981 2.7734 [123] 1982 All in all, the concept of theoretical exponent of MM has been historically motivated but has not been related to feasible MM. The complexity exponents of feasible MM have much more relevance to the real world computations, but in the next section we significantly increase the efficiency of feasible MM without decreasing its record complexity exponent. 6Actually also with the straightforward MM. 18 Table 15.2: Ranks and Complexity Exponents of Feasible MM. year 1969 1978 1980 1981 1982 paper [151] [118] [120] [122] [123] rank of M M (n) bound on exponent n2.8074 (n3 + 18n2 − 4n)/3 (2n3 + 27n2 − 2n)/6 (n3 + 12n2 + 26n)/3 (4n3 + 45n2 + 128n + 108)/12 ω2 < 2.8074 ω70 < 2.7952 ω48 < 2.7802 ω46 < 2.7762 ω44 < 2.7734 16 Some Ways to Acceleration of Feasible MM with No De- crease of the Complexity Exponent 16.1 Acceleration of Complex and Polynomial MM Substitute matrices for variables of bilinear algorithms of Examples 3.1 and 3.1 and obtain efficeint algorithms for Complex and Polynomial MM. The 3M Method for Complex MM. The rank-3 bilinear algorithm of Example 3.1 for multiplying two complex numbers saves one multiplication but uses three extra additions and subtractions in comparison to the straightforward algorithm of rank 4. Now substitute N × N matrices for the variables a1, a2, b1, and b2 and arrive at the problem of multiplying a pair of N × N complex matrices A1 + iA2 by B1 + iB2. Then the latter algorithm, called the 3M method, involves 3N 3 scalar multiplications and 3N 3 + 2N 2 additions and subtractions versus straightforward 4N 3 and 4N 3 − 2N 2. This means saving of about 25% of all operations already for N = 30 (cf. [82]). Fast Polynomial MM. Consider n× n MM where the input matrices are filled with polynomials of degree at most d− 1. By applying the straightforward MM to these input matrices reduce our task to performing n3 multiplications and n3 − n2 additions of polynomials of degrees at most d. All these polynomial additions together involve just (n3 − n2)d scalar additions. All polynomial multiplications together involve (2d2 − 2d + 1)n3 scalar multiplications and additions if we apply straightforward polynomial multiplication, but this bound turns into (4.5K log2(K) + 2K)n3, for K = 2k, 2d− 1 < K < 4d− 2, if we apply the FFT-based convolution algorithm of Example 3.2. This is dramatic saving if the degree bound d is large, but we can save much more if we consider the input as two polynomials with matrix coefficients and apply to them fast convolution algorithm of Example 3.2. In this way we reduce our Polynomial MM to performing at most K MM(n) and at most 4.5K log2(K) + K additions, subtractions and multiplications by scalars of n × n scalar matrices for 2d − 1 < K < 4d − 2. With the straightforward MM we solve these tasks by using at most 2n3K + 4.5K log2(K)n2 scalar arithmetic operations overall, which additionally saves for us (4.5K log2(K) + d)(n − 1)n2 scalar operations versus our first accelerated Polynomial MM. We can further accelerate both Complex and Polynomial MM (decreasing all our estimates accordingly) if we incorporate fast algorithms for MM instead of applying the straightforward MM. 16.2 Randomized acceleration of feasible MM The paper [65] presented surprising acceleration of approximate rectangular MM by means of ran- domization (see a short exposition in [107, Section 3.1] and see arXiv 1710.07946 and the bibliography therein for the extension to low rank approximation of a matrix, which a highly popular task linked to fundamental matrix computations and Big Data mining and analysis). We sketch the main result of [65] by using the spectral and Frobenius matrix norms · 2 and · F , respectively, in the estimates for the approximation errors. 19 Given two matrices A = (aj )n with rows bT j , for j = 1, . . . , n, j=1, of size m× n, with columns aj, and B = (bT j )n j=1, of size n× q, (i) first compute the so called leverage scores (aka importance sampling probabilities), for j = 1, . . . , n, pj = aj2 bT j 2 Pn j ′=1 aj ′2 bT j ′2 (ii) then randomly select (and re-scale by 1/√cpj) c pairs of corresponding columns of A and rows of B, thereby forming an m × c matrix C and a c × n matrix R, and (iii) finally compute an approximation CR to the matrix product AB. It is proven in [65] that both in expectation and with a high probability. √c CR − ABF = O(AF BF ) 16.3 Tensors at Work Again: History and Perspectives of Computer-Aided Search for Fast MM Properly directed computer-aided search is a natural tool in the search for efficient basic designs for fast feasible MM, not necessarily directed to the decrease of the complexity exponent. According to [143], computer-aided search has helped already in 1979, in the design of the APA algorithm of [20]. Even earlier, in [35], Richard P. Brent reduced such a search to a system of nonlinear equations (5.7) and proposed to apply least-squares minimization techniques for its solution. It is more convenient to use the equivalent system of equations (5.9), whose solution is in turn equivalent to finding the standard canonical decomposition CANDECOMP/PARAFAC for the MM tensor (see, e.g., [96]). Unfortunately, none of the numerous techniques for 3D tensor decomposition has been successful in this particular case so far. Loosely speaking, the things are quite different from the cases favorable to the known techniques because solving Brent's equations requires tensor data expansion rather than compression (the latter being the essence of CANDECOMP/PARAFAC technique). The main reason seems to be rather large lower bounds on the rank of MM in comparison with the rank of the general trilinear form Pi,j,h ti,j,haibjdh. Now recall the uniqueness theorem of Kruskal [97], which in the case of the M M (n) tensor (and with account for the full-rank of the three n2 × r matrices involved) requires that r < 3n2/2 for the canonical decomposition to be essentially unique. This is a clear contradiction with the known lower bounds on the rank r of MM(n) (e.g., r ≥ 2n2 − 1 of [117] or r ≥ 3n2 − o(n2) of [147] and [108]). As a result non-unique solutions of various kind can be observed (see, e.g., [13]). Even more destructive for numerical optimization methods is the presence of infinitely grow- ing approximate solutions, which correspond to the existence of APA algorithms. This makes the customary tool of applying unconstrained ALS optimization inefficient, and its modification or al- ternatives are required. (ALS is the acronym for Alternating Least Squares.) Some success with the ALS method used for the minimization of the Euclidean norm of the residuals of Brent's equations was reported in [88] and [112]. Namely those two studies produced two alternatives to Laderman's bilinear algorithm of [99] for the M M (3) problem with the record rank r = 23. By cleverly extending Brent's approach A.V. Smirnov in [149] achieved important progress.7 He proposed a very special modification of the ALS procedure based on an adaptive "quantization" of iterated components, which luckily resulted in finding an exact solution to M M (3, 3, 6) with r = 40. This supports the MM complexity exponent ω54 < 2.7743, a remarkably low value for such small matrix sizes, almost matching the record 2.7734 of [123] for the exponents of feasible MM. 7He has included [88] in his reference list but has not explained that the application of the ALS method to devising fast MM was implicit already in Brent's paper [35] of 1970. 20 Unfortunately, the paper [149] contains neither estimates for the number of scalar additions and subtractions involved in its algorithms nor a constructive recipe for the implementation of their additive stages. In [18] Smirnov's recursive algorithm based on M M (3, 3, 6) has been implemented and tested for M M (n) for dimensions n less than 13,000. The test results are inferior to those for recursive bilinear processes based on Winograd's and Strassen's Examples 2.3 and 2.2, respectively. By no means this comparison is final, however. The models of communication complexity for serial and parallel computers are dynamic in time, Smirnov and other researchers have all chances to strengthen the ALS approach to fast MM, producing perhaps significant acceleration of practical MM. Furthermore the matrices U , V , and W of the algorithms of [149] are rather densely populated by nonzeros (near 50%) and may perhaps be sparsified if revised algorithms of [149] properly incorporate the techniques of TA and disjoint MM. Indeed success of TA in designing fast algorithms for feasible MM in [90] and [91] indicates potential value of that technique for simplifying computer-aided search. In particular trilinear aggregation can exploit the 6-way symmetry in order to reduce the search area for efficient MM algorithms. 17 Numerical Implementation of Fast MM Even the straightforward MM, if it is efficiently implemented, can compete in practice with fast MM. In this section we comment on numerical implementation of that and other efficient algorithms for feasible MM. Implementation of feasible MM must be efficient in arithmetic cost, decreasing vectorization, and data locality (cf. [78, Chapter 1]). We cover all these issues, and notice that quite frequently all three goals are well compatible with each other. So far in practical numerical computations MM is performed by means of either the straight- forward algorithm or recursive bilinear (2 × 2)-based MM, typically the recursive application of Winograd's Example 2.3 or, more rarely, Strassen's Example 2.2. The implementation of these old algorithms has been extensively worked on by many authors and makes up a valuable part of the present day MM software (cf. [14], [81], [63], [68], [69], [34], [56], [8], [18], [33], the references therein, and in [78, Chapter 1]). This work, intensified lately, is still mostly devoted to the implementation of very old algorithms, ignoring, for example, the advanced implementations of fast MM in [90] and [91] (see Section 17.1) and the significant improvement in [45] and [98] of the recursive bilinear MM based on Examples 2.2 and 2.3 by Winograd and Strassen. We hope that our survey will motivate advancing the State of the Art both in the design of fast algorithms for feasible MM and in their efficient implementation. 17.1 Implementation of Trilinear Aggregation Algorithms Already the first implementations in [90] and [91] of the fast algorithms for MM of moderate sizes based on trilinear aggregation showed their superiority to the alternative approaches regarding nu- merical stability, memory consumption, and efficiency for parallel MM. One can immediately see why so: in the 2- and 3-disjoint product algorithms in the implementation of [91], the coefficient tensors U , V , and W of (5.5) and (5.6) are "supersparse". This explains good numerical stability of the latter algorithms according to the customary mea- surement by the exponent 2.322 of distinct nature, estimated in [91]. Moreover the paper [91] shows significant reduction of the workspace consumption of its algorithms in comparison with (2 × 2)- based MM (that is, recursive bilinear algorithms based on Winograd's and Strassen's Examples 2.2 and 2.3, respectively). Namely, storage consumption decreases from (2/3)N 2 to (1/4)N 2 memory cells (corresponding to the MM exponent 2.776), that is, in 8/3 times. The recent important works [18] and [8], both covering the implementation and numerical sta- bility of fast MM algorithms, have omitted proper discussion of these significant benefits for the implementation of [91], apparently leaving the challenge to the study in the future. The papers [90] and [91] had bad luck also with their exposition in the influential paper [56], where the citation "The practical implementation of Pan's algorithm O(n2.79) is presented by Kaporin [Kaporin 1999; 2004]" 21 must be corrected into "The practical implementation of Pan's disjoint matrix product O(n2.811)- and O(n2.776)-algorithms is presented by Kaporin [Kaporin 1999; 2004]". Incidentally, the test results in the interesting experimental study in [56] should be accepted with some caution because they rely on pseudo random matrices, and such matrices tend to have too good numerical stability. No further implementation of trilinear aggregation algorithms followed so far. This can be understood because their design is technically more involved and has been much less advertised than the recursive MM algorithms based on Example 2.3. Clearly, further work is in order on the assessment, implementation, amelioration, and extension of such algorithms for fast feasible MM. 17.2 Some Imaginary and Real Issues 1. A considerable group of numerical analysts still believes in the folk "theorem" that fast MM is always numerical unstable, but in actual tests loss of accuracy in fast MM algorithms was lim- ited, and formal proofs of quite reasonable numerical stability of all known fast MM algorithms is available (see [23], [90], [91], [62], and [61]). 2. The paper [9] emphasizes the importance of non-arithmetic optimization of matrix algorithms: "The traditional metric for the efficiency of a numerical algorithm has been the number of arithmetic operations it performs. Technological trends have long been reducing the time to perform an arithmetic operation, so it is no longer the bottleneck in many algorithms; rather, communication, or moving data, is the bottleneck". This statement should be taken not too lightly, but still with a grain of salt: communication cost is limited to operating with the data in primary memory. For competent implementations of fast feasible MM their arithmetic cost is usually in a rather good accordance with vectorization and communication cost. Together (rather than in conflict) with vectorization, numerical stability, and restricting data movement, arithmetic cost is still a critical ingredient of the evaluation of practical efficiency of MM algorithms (cf. [78, Chapter 1], [18] and [8]). For a litmus test, smaller arithmetic cost of Winograd's algorithm of Example 2.3 has made it substantially more popular among the users than Strassen's algorithm of Example 2.2 in spite of its a little weaker numerical stability. 3. Most of nowadays computational methods are largely driven by technology. In particular presently computations in single precision are intensively promoted by the manufacturers (mainly NVIDIA) of the GP-GPU (general purpose graphic processing units). In such cir- cumstances, floating-point computations are less preferable compared to the integer residual- based arithmetic, where rational numbers can be used, but using the integers 1, 0, and −1 is preferable. 18 Non-numerical Implementation of Fast MM Implementation of MM in Computer Algebra has become highly efficient when it was reduced to performing MM over word size finite fields with the outputs combined by means of the Chinese Remainder Algorithm. The paper [67] spells out the following principles for computations in finite fields, which were basic for this success: 1. Reduce computations in a finite field to integer arithmetic with delayed or simultaneous mod- ular reductions; 2. perform integer arithmetic by invoking floating point units (taking advantage of SIMD instruc- tions and of numerical BLAS); 3. structure the computations in blocks in order to optimize the use of the memory hierarchy of the current architectures; 22 4. apply fast MM algorithms (so far in practice they are mostly recursive bilinear algorithm for MM based on Winograd's 2× 2 MM of Example 2.3 or less frequently based on Strassen's 2× 2 MM of 2.2, but also Kaporin's algorithms of [90] and [91] and the Any Precision Approximation (APA) algorithm of [20] are used). We have two further comments: • The implementations of fast MM in [90] and [91] are particularly attractive within this frame- work because it uses matrices U , V and W filled with shorter numbers. Therefore one can perform the Chinese Remainder Algorithm for fewer primes and invoke it fewer times. • We already pointed out that APA algorithms are prone to the problems of numerical stability, but have good promise for symbolic MM in Computer Algebra and for computations with integers (see such important computations in [134, Section 8]). The current level of the known implementations of APA MM, however, is rudimentary, staying at the level of the paper [20] of 1979, and must be moved forward dramatically; our survey should help to accelerate this process. We refer the reader to [70] and the bibliography therein on further details of fast symbolic MM. Appendix A Estimation of the Theoretical Exponent of MM Tables A.1 and A.2 show the dynamics of the record estimates for the theoretical exponent of M M (n) since 1969. The tables link each estimate to its recorded publication in a journal, a conference proceedings, or as a research report. It displays the chronological process and reflects the competition for the decrease of estimates for the theoretical exponent, particularly intensive in 1979–1981 and 1986. The record upper estimates for the theoretical exponent have been updated four times during the single year of 1979. At first the estimate 2.7801 for appeared in February in a Research Report (see [120]). The estimate 2.7799 appeared at first as one for an APA-based estimate for the exponent of MM in [20] in June and then for the theoretical exponent of MM in [19]. The next upper estimate 2.548 of [146] was followed by 2.522 of [122], both published in the book of abstracts of the conference on the Computational Complexity in Oberwolfach, West Germany, organized by Schnorr, Schonhage and Strassen (cf. [125, page 199] and [146]). The upper bound 2.496 of [54] was reported in October 1981 at the IEEE FOCS'81, but in Table A.1 we place it after the estimate 2.517 of the paper [144] of 1982, which was submitted in March 1980. The Research Report version of the paper [55] appeared in August of 1986, but in Table A.1 we place [55] after the paper [155], published in October of 1986 in the Proceedings of the IEEE FOCS, because the paper [155] has been submitted to FOCS'86 in the Spring of 1986 and has been widely circulated afterwards. One could complete the historical account of Tables A.1 and A.2 by including our estimate 2.7804 (announced in the Fall of 1978, but was superseded in February 1979 in [120]) and the bound 2.5218007, which decreased our estimate 2.5218128 of 1979 and appeared at the end of the final version of [146] in 1981,8 that is, before the publication, but after the submission of the estimate 2.517 of [144]. Table A.2 shows the decrease of the record estimates in 1986 – 2014. We refer the reader to [52], [105], [53], [86], [92], [103], and the bibliography therein for similar progress in asymptotic acceleration of rectangular MM and its theoretical implications. 8Observe cross-fertilization: Schonhage's disjoint MM and Partial MM have been motivated by trilinear aggregation of [117] and [118] and by the design of [20], respectively; in turn the paers [119] and [122] decreased the exponent 2.548 of [146] to 2.522 by combining his disjoint MM with the technique of trilinear aggregation. 23 Table A.1: Record upper estimates for the theoretical exponent of MM. Exponent Paper Year Exponent Paper Year 2.8074 [151] 1969 2.517 [144] 1980 2.7962 [118] 1978 2.496 [54] 1981 2.7801 [120] 1979 2.479 [155] 1986 2.7799 [20], [19] 1979 2.376 [55] 1986 2.548 [146] 1979 2.374 2.522 [122] 1979 2.373 [150], [57] [162], [104] 2010 2012 Table A.2: The records in 1986–2014. Exponent9 2.3754770 Paper Year [55] 1986 2.3736898 [150], [57] 2010 2.3729269 2.3728639 [162] 2012 [104] 2014 B FFT, Inverse FFT, and Convolution Fast Fourier transform (hereafter referred to as FFT) is a celebrated example of recursive divide and conquer algorithms. It computes discrete Fourier transform at K points, that is, evaluates a i=0 pixi at the Kth roots of 1. For K = 2k it reduces the task to two such polynomial p(x) = PK−1 problems of half-size: p(x) = p(0)(y) + xp(1)(y), p(0)(y) = K/2−1 Xi=0 p2iyi, p(1)(y) = K/2−1 Xi=0 p2i+1yi where y = x2 is a (K/2)nd root of 1 if x is a Kth roots of 1. Recursively, the problem is re- duced to four problems of quarter size and ultimately to K problems of size 1, whose solution ids instant, requiring no arithmetic operations. Each of k = log2(K) recursive stages involves K addi- tions/subtractions and K/2 multiplications (K/2 other multiplications are by −1 and are performed as subtractions). Thus the overall arithmetic cost of FFT is 1.5K log2(K), versus K 2 multiplications and K 2 additions required in the straightforward algorithm. This is dramatic saving for large K, e.g., more than 50,000-fold for K = 1, 000, 000. Now notice that discrete Fourier transform computes the vector of values v of a polynomial p(x) i=0 of the coefficients of p(x) and the i,j=0 filled with Kth roots of unity, where ωK is a primitive Kth root of 1, that is, at the Kth roots of unity, v = Ωp for the vector p = (pi)K−1 matrix Ω = (ωij ωK K = 1, ωh K)K−1 K 6= 1 for 0 < h < K, ωK = exp(2πi/K) for i = √−1. (B.1) Inverse discrete Fourier transform computes the vector p = Ω−1v of the coefficients from a given i,j=0, and one can just readily vector v of the values. It turned out that Ω−1 = 1 extend FFT and then perform K divisions by K. K Ω∗ = 1 K (ω−ij K )K−1 Due to the wide range of important applications of FFT in Modern Computations, this recursive divide and conquer algorithm has become immensely popular since its publication in 1965 in [51] and was justly included into the list of the Ten Top Algorithms of the 20th century [47], even though its origin has been traced back to posthumous notes of C. F. Gauss, 1777–1855. See [94] for early history of FFT and see [1], [25], [130, Sections 2.2–2.4], [138, Chapter 12. Fast Fourier Transform], [161], and the bibliography therein for derivation of FFT and inverse FFT, their structured matrix version, generalization to the case of any integer K, numerical stability of the output vector norm, parallel implementation, and further improvements. 24 The straightforward algorithm for convolution involves (m + 1)(n + 1) multiplications and mn additions, but the combination of the Toom's seminal method of evaluation–interpolation of [157] with FFT and Inverse FFT enables dramatic acceleration. Let m = n in order to simplify the estimates. Algorithm 1: Convolution via Evaluation, Interpolation, and FFT. INITIALIZATION. Fix the integer K = 2k being a power of 2 in the range 2n < K ≤ 4n, that is, k = 2 + ⌊log2(n)⌋. COMPUTATIONS. 1. Compute the values a(ωi K) and b(ωi K) for ωK of (B.1) and i = 0, . . . , K − 1. They are the values of the polynomials a(x) and b(x) at the Kth roots of 1. 2. Compute the products c(ωi K) = a(ωi K)b(ωi polynomial w(x) at the same K points. K) for i = 0, . . . , K − 1. They are the values of the 3. Interpolate to the polynomial c(x) from its values at these points. Stages 1 and 3 of the algorithm amount to multipoint evaluation and interpolation of polynomials at the Kth roots of 1, that is, Forward and Inverse Discrete Fourier Transforms, respectively. FFT and Inverse FFT perform these stages by using K + 4.5K log2(K) arithmetic operations. Add K bilinear multiplications, performed at Stage 2, and arrive at the overall arithmetic computational cost bound 2K + 4.5K log2(K). Toom's evaluation–interpolation method has a number of further applications to polynomial and rational computations. For example, it can be extended immediately to fast computation of the quotient q(x) = u(x)/v(x) of two polynomials u(x) and v(x) provided that the remainder of the division is 0; this restriction has been removed in [136]. References [1] A.V. Aho, J.E. Hopcroft, J.D. Ullman, The Design and Analysis of Algorithms. Addison-Wesley, Reading, MA, 1974. [2] N. Alon, Z. Galil, O. Margalit, On the Exponent of the All Pairs Shortest Path Prob- lem, J. of Computer and System Sciences, 54, 2, 255-262. 1997. [3] N. Alon, A. Shpilka, C. Umans, On Sunflowers and Matrix Multiplication. Computa- tional Complexity, 22, 2, 219–243, 2013. [4] A. Ambainis, Y. Filmus, F. Le Gall, Fast Matrix Multiplication: Limitations of the Laser Method. Electronic Colloquium on Computational Complexity (ECCC), year 2014, paper 154, http://eccc.hpi-web.de/report/2014/154. Available at arXiv:1411.5414, November 21, 2014. [5] R.R. Amossen, R. Pagh, Faster Join-projects and Sparse Matrix Multiplications. In Proceedings of the 12th International Conference on Database Theory, 121–126, 2009. [6] V. Z. Arlazarov, E. A. Dinic, M. A. Kronrod, I. A. Faradzhev, On economical con- struction of the transitive closure of a directed graph, Soviet Mathematics Doklady (DAN), 11, 5, 1209–1210, 1970. [7] A. Azad, G. Ballard, A. Bulu, J. Demmel, L. Grigori, O. Schwartz, S. Toledo, S. Williams, Exploiting multiple levels of parallelism in sparse matrix-matrix multiplica- tion, SIAM Journal on Scientific Computing (SISC), 38, 6, C624–C651, 2016. 25 [8] G. Ballard, A.R., Benson, A. Druinsky, B. Lipshitz, O. Schwartz, Improving the nu- merical stability of fast matrix multiplication algorithms, SIAM Journal on Matrix Analysis and Applications (SIMAX), 37, 4, 1382–1418, 2016. [9] G. Ballard, E. Carson, J. Demmel, M. Hoemmen, N. Knight, O. Schwartz, Commu- nication Lower Bounds and Optimal Algorithms for Numerical Linear Algebra. Acta Numerica, 23, 1–155, 2014. [10] G. Ballard, J. Demmel, O. Holtz, B. Lipshitz, O. Schwartz, Graph Expansion Analysis for Communication Costs of Fast Rectangular Matrix Multiplication, in Design and Analysis of Algorithms, G. Even and D. Rawitz (eds.), Lecture Notes in Computer Science, Springer, Berlin–Heidelberg, 7659, 13–36, December 2012. [11] G. Ballard, A. Druinsky, N. Knight, O. Schwartz, Hypergraph Partitioning for Sparse Matrix-Matrix Multiplication, arXiv:1603.05627. [12] N. Bansal, R. Williams, Regularity lemmas and combinatorial algorithms, Proc. 50th Ann. IEEE Symp. on Foundations of Computer Science (FOCS 2009), 745–754, 2009. [13] G. Bard, Algorithms for Solving Linear and Polynomial Systems of Equations over Fi- nite Fields with Applications to Cryptanalysis, Submitted in Partial Fulfillment for the degree of Doctor of Philosophy of Applied Mathematics and Scientific Computation. PhD Thesis, University of Maryland at College Park, April 30, 2007. [14] D.H. Bayley, Extra High Speed Matrix Multiplication on the Cray-2. SIAM J. on Scientific and Statistical Computing, 9, 3, 603–607, 1988. [15] B. Beckermann, A. Townsend, On the singular values of matrices with displacement structure, SIAM J. on Matrix Analysis, 38, 4, 1227–1248, 2017. Also arXiv:1609.09494 [math.NA], 22 pages, 4 figures (submitted on 29 September 2016). [16] E.G. Belaga, Some Problems in Computation of Polynomials, Doklady of Academy of Science of USSR, 123, 775–778, 1958. [17] T. Bella, Y. Eidelman, I. Gohberg, V. Olshevsky, Computations with Quasiseparable Polynomials and Matrices, Theor. Computer Science, 409, 2, 158–179, 2008. [18] A.R. Benson, G. Ballard, A framework for practical parallel fast matrix multiplication. In Proceedings of the 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, 42–53, ACM Press, New York, January 2015. [19] D. Bini, Relations Between Exact and Approximate Bilinear Algorithms: Applications. Calcolo, 17, 1, 87–97, 1980. [20] D. Bini, M. Capovani, G. Lotti, F. Romani, O(n2.7799) Complexity for n × n Ap- proximate Matrix Multiplication. Information Processing Letters, 8, 5, 234–235, June 1979. [21] D. Bini, M. Capovani, G. Lotti, F. Romani, Complessit`a Numerica, Boringhieri pub- lisher, 1981. [22] D. A. Bini, G. Fiorentino, Design, Analysis, and Implementation of a Multiprecision Polynomial Rootfinder, Numer. Algs., 23, 127–173, 2000. [23] D. Bini, G. Lotti, Stability of Fast Algorithms for Matrix Multiplication. Numerische Math., 36, 1, 63–72, 1980. [24] D. Bini, G. Lotti, F. Romani, Approximate solution for the bilinear form computa- tional problem, SIAM J. on Computing, 9, 4, 692–697, 1980. 26 [25] D. Bini, V.Y. Pan, Polynomial and Matrix Computations, Volume 1: Fundamental Algorithms. Birkhauser, Boston, 1994. [26] M. Blaser, A 5/2n2-Lower Bound for the Multiplicative Complexity of n × n Matrix Multiplication over Arbitrary Fields. Proc. 40th Ann. IEEE Symp. on Foundations of Computer Science (FOCS 1999), 45–50, IEEE Computer Society Press, Los Alamitos, CA 1999. [27] M. Blaser, Lower Bounds for the Multiplicative Complexity of Matrix Multiplication. J. of Computational Complexity, 9, 2, 73–112, 2000. [28] J. Blasiak, T. Church, H. Cohn, J. A. Grochow, E. Naslund, W. F. Sawin, C. Umans, On cap sets and the group-theoretic approach to matrix multiplication, arXiv:1605.06702, 2016. [29] M. Bodrato, A Strassen-like matrix multiplication suited for squaring and higher power computation, In Proceedings of the 2010 International Symposium on Symbolic and Algebraic Computation (ISSAC '2010), 273–280, ACM Press, New York, 2010. [30] A. Borodin, private communication, 1979. [31] A. Borodin, I. Munro, The Computational Complexity of Algebraic and Numeric Prob- lems. American Elsevier, New York, 1975. [32] A. Bostan, C.-P. Jeannerod, ´E. Schost, Solving structured linear systems with large displacement rank. Theoretical Computer Science, 407, 1–3, 155–181, 2008. [33] B. Boyer, J.-G. Dumas, Matrix Multiplication over Word-size Modular Rings Using Approximate formulae, ACM Transactions on Mathematical Software, 42, 3, 20:1– 20:12, 2016. [34] B. Boyer, J.-G. Dumas, C. Pernet, W. Zhou, Memory Efficient Scheduling of Strassen- Winograd's Matrix Multiplication Algorithm. Proc. Intern. Symposium on Symbolic and Algebraic Computation (ISSAC 2009), 55–62, ACM Press, New York, 2009. [35] R. P. Brent, Algorithms for matrix multiplication. Technical report 70-157, Stanford University, Computer Science Department, 1970. Available at http://maths-people.anu.edu.au/ brent/pub/pub002.html [36] R.W. Brockett, D. Dobkin, On Optimal Evaluation of a Set of Bilinear Forms. Proc. of the 5th Annual Symposium on the Theory of Computing (STOC 1973), 88–95, ACM Press, New York, 1973. [37] R.W. Brockett, D. Dobkin, On the Number of Multiplications Required for a Matrix Multiplication. SIAM Journal on Computing, 5, 4, 624–628, 1976. [38] R.W. Brockett, D. Dobkin, On Optimal Evaluation of a Set of Bilinear Forms. Linear Algebra and Its Applications, 19, 3, 207–235, 1978. [39] N.H. Bshouty, A Lower Bound for Matrix Multiplication. SIAM J. on Computing, 18, 4, 759–765, 1989. [40] N.H. Bshouty, On the Additive Complexity of 2×2 Matrix Multiplication, Information Processing Letters, 56, 6, 329–335, 1995. [41] A. Bulu, J. R. Gilbert, Parallel Sparse Matrix-Matrix Multiplication and Indexing: Implementation and Experiments, SIAM Journal of Scientific Computing, 34, 4, C170C191, 2012. 27 [42] J.R. Bunch, J.E. Hopcroft, Triangular Factorization and Inversion by Fast Matrix Multiplication. Mathematics of Computation, 28, 125, 231–236, 1974. [43] P. Burgisser, M. Clausen, M.A. Shokrollahi, Algebraic Complexity Theory. Springer Verlag, 1997. [44] J. Carrier, L. Greengard, V. Rokhlin, A Fast Adaptive Algorithm for Particle Simula- tion, SIAM J. Scientific Computing, 9, 669–686, 1998. [45] M. Cenk, M.A. Hasan, On the Arithmetic Complexity of Strassen-Like Matrix Multi- plications, J. of Symbolic Computation, 80, 2, 484–501, May–June 2017. [46] T. M. Chan, Speeding up the Four Russian?s algorithm by about one more logarithmic factor, Proc. ACM-SIAM Symp. on Discrete Algorithms (SODA 2015), 212–217, 2015. [47] B. A. Cipra, The Best of the 20th Century: Editors Name Top 10 Algorithms, SIAM News, 33 4, 2, published by the Society for Industrial and Applied Mathematics, May 16, 2000. [48] H. Cohn, R. Kleinberg, B. Szegedy, C. Umans, Group-theoretic Algorithms for Ma- trix Multiplication. Proceedings of the 46th Annual Symposium on Foundations of Computer Science (FOCS 2005), (Pittsburgh, PA), 379–388, IEEE Computer Society Press, 2005. [49] H. Cohn, C. Umans, A Group-theoretic Approach to Fast Matrix Multiplication. Pro- ceedings of the 44th Annual Symposium on Foundations of Computer Science (FOCS 2003), (Cambridge, MA), 438–449, IEEE Computer Society Press, 2003. [50] H. Cohn, C. Umans, Fast Matrix Multiplication Using Coherent Configurations. Pro- ceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2013), 1074–1087, 2013. [51] J.W. Cooley, J. W. Tukey, An algorithm for the machine calculation of complex Fourier series, Mathematics of Computation, 19 (90), 297–301, 1965. [52] D. Coppersmith, Rapid Multiplication of Rectangular Matrices. SIAM Journal on Computing, 11, 3, 467–471, 1982. [53] D. Coppersmith, Rectangular Matrix Multiplication Revisited. Journal of Complexity, 13, 1, 42–49, 1997. [54] D. Coppersmith, S. Winograd, On the Asymptotic Complexity of Matrix Multiplica- tion, SIAM J. on Computing, 11, 3, 472–492, 1982. Proceedings version in 23rd FOCS (Nashville, TN), 82–90, IEEE Computer Society Press, 1981. doi:10.1109/SFCS.1981.27 [55] D. Coppersmith, S. Winograd, Matrix Multiplicaton via Arithmetic Progressions. J. of Symbolic Computations, 9, 3, 251–280, 1990. Proc. version in 19th ACM Symposium on Theory of Computing (STOC 1987), (New York, NY), 1–6, ACM Press, New York, NY, 1987. Also Research Report RC 12104, IBM T.J. Watson Research Center, August 1986. [56] P. D'Alberto, A. Nicolau, Adaptive Winograd's Matrix Multiplication. ACM Trans- actions on Mathematical Software, 36, 1, paper 3, 2009. [57] A.M. Davie, A.J. Stothers, Improved Bound for Complexity of Matrix Multiplication. Proceedings of the Royal Society of Edinburgh, 143A, 351–370, 2013. [58] H.F. de Groot, On Varieties of Optimal Algorithms for the Computation of Bilinear Mappings. Theoretical Computer Science, 7, 2, 127–148, 1978. 28 [59] C. Demetrescu, G.F. Italiano, Fully Dynamic Transitive Closure: Breaking Through the O(n2) Barrier. In Proceedings of the 41st Annual Symposium on Foundations of Computer Science (FOCS 2000), 381–389, 2000. [60] J.W. Demmel, Numerical Linear Algebra, SIAM, Philadelphia, 1997. [61] J. Demmel, I. Dumitriu, O. Holtz, Fast Linear Algebra Is Stable. Numerische Mathe- matik, 108, 1, 59–91, 2007. [62] J. Demmel, I. Dumitriu, O. Holtz, R. Kleinberg, Fast Matrix Multiplication Is Stable. Numerische Mathematik, 106, 2, 199–224, 2007. [63] C.C. Douglas, M. Heroux, G. Slishman, R.M. Smith, GEMMW: A Portable Level 3 BLAS Winograd Variant Of Strassen's Matrix-Matrix Multiply Algorithm. J. of Computational Physics, 110, 1, 1–10, 1994. [64] C.-E. Drevet, Md. N. Islam, ´E. Schost, Optimization Techniques for Small Matrix Multiplication. Theoretical Computer Science, 412, 22, 2219–2236, 2011. [65] P. Drineas, R. Kannan, M.W. Mahoney, Fast Monte Carlo algorithms for matrices I: Approximating matrix multiplication, SIAM Journal on Computing, 36, 1, 132–157, 2006. [66] R. Duan, S. Pettie, Fast Algorithms for (max− min) Matrix Multiplication and Bot- tleneck Shortest Paths, Proceedings of the 15th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2009), 384–391, 2009. [67] J.-G. Dumas, T. Gautier, C. Pernet, Finite field linear algebra subroutines. In Teo Mora, editor, ISSAC'2002, Proceedings of the 2002 ACM International Symposium on Symbolic and Algebraic Computation, Lille, France, pages 63–74. ACM Press, New York, July 2002. [68] J.-G. Dumas, P. Giorgi, C. Pernet, FFPACK: Finite Field Linear Algebra Pack- age. Proc. Intern. Symposium on Symbolic and Algebraic Computation (ISSAC 2004), Jaime Gutierrez, editor, 119–126, ACM Press, New York, 2004. [69] J.-G. Dumas, P. Giorgi, C. Pernet, Dense Linear Algebra over Word-size Prime Fields: the FFLAS and FFPACK Packages. ACM Trans. Math. Software, 35, 3, Article 19, 2009. [70] J.-G. Dumas, V. Y. Pan, Fast Matrix Multiplication and Symbolic Computation, Available in arXiv: 1612.05766, December 2016. [71] J.-G. Dumas, C. Pernet, Z. Sultan, Computing the Rank Profile Matrix, Proc. ACM International Symposium on Symbolic and Algebraic Computations (ISSAC 2015), 146–153, ACM Press, New York, 2015. [72] C.M. Fiduccia, Polynomial Evaluation via the Division Algorithm: The Fast Fourier Transform Revisited. Proc. 4th Annual ACM Symposium on Theory of Computing (STOC 1972), 88–93, ACM Press, New York, 1972. [73] C.M. Fiduccia, On Obtaining Upper Bound on the Complexity of Matrix Multiplica- tion. In Analytical Complexity of Computations (edited by R.E. Miller, J. W. Thatcher, J. D. Bonlinger), in the the IBM Research Symposia Series, pp. 31–40, Plenum Press, NY, 1972. [74] P.C. Fischer, Further Schemes for Combining Matrix Algorithms. Proceedings of the 2nd Colloquium on Automata, Languages and Programming, Lecture Notes in Com- puter Science, 14, 428–436, Springer-Verlag, London, UK, 1974. 29 [75] M.J. Fischer, M.S. Paterson, String-Matching and Other Products. SIAM–AMS Proc., 7, 113–125, 1974. [76] B. Ghannam , K. El Khoury, M. Nemer, The Nonrecursive Plating Algorithm (NRPA) for Computing the Total Radiative Exchange Factors in Enclosures. Numerical Heat Transfer, Part B: Fundamentals: An International Journal of Computation and Methodology, 66, 2, 109–132, 2014. DOI: 10.1080/10407790.2014.901003 [77] J. von zur Gathen, J. Gerhard (2013). Modern Computer Algebra. Cambridge Univer- sity Press, Cambridge, UK, third edition, 2013. [78] G.H. Golub, C.F. Van Loan, Matrix Computations. Johns Hopkins University Press, Baltimore, Maryland, 2013 (4th addition). [79] L. Greengard, V. Rokhlin, A Fast Algorithm for Particle Simulation, Journal of Com- putational Physics, 73, 325–348, 1987. [80] Y. Han, A Θ(n2) Time Matrix Multiplication Algorithm, preprint, 2016. [81] N.J. Higham, Exploiting Fast Matrix Multiplication within Level 3 BLAS. ACM Trans. on Math. Software, 16, 4, 352–368, 1990. [82] N.J. Higham, Accuracy and Stability in Numerical Analysis, SIAM, Philadelphia, 2002 (second edition). [83] J.E. Hopcroft, L.R. Kerr, Some Techniques for Proving Certain Simple Programs Optimal. Proceedings of the Tenth Annual Symposium on Switching and Automata Theory, 36–45, IEEE Computer Society Press, 1969. [84] J.E. Hopcroft, L.R. Kerr, On Minimizing the Number of Multiplications Necessary for Matrix Multiplication. SIAM J. on Applied Math., 20, 1, 30–36, 1971. [85] J.E. Hopcroft, J. Musinski, Duality Applied to Matrix Multiplication and Other Bi- linear Forms. SIAM Journal on Computing, 2, 3, 159–173, 1973. [86] X. Huang, V.Y. Pan, Fast Rectangular Matrix Multiplication and Applications. Jour- nal of Complexity, 14, 2, 257–299, 1998. Proc. version in Proc. Annual ACM Inter- national Symposium on Parallel Algebraic and Symbolic Computation (PASCO'97), 11–23, ACM Press, New York, 1997. [87] Seung Gyu Hyun, R. Lebreton, ´E. Schost, Algorithms for structured linear systems solving and their implementation, Proc. Annual ACM International Symposium on Symbolic and Algebraic Computation (ISSAC 2017), 205–212, ACM Press, New York, 2017. [88] R. W. Johnson, A. M. McLoughlin, Noncommutative Bilinear Algorithms for 3 × 3 Matrix Multiplication, SIAM J. on Computing, 15, 2, 595–603, 1986. [89] H. Kaplan, M. Sharir, E. Verbin, Colored Intersection Searching via Sparse Rectan- gular Matrix Multiplication. In Proceedings of the 22nd ACM Symposium on Compu- tational Geometry, 52–60, 2006. [90] I. Kaporin, A Practical Algorithm for Faster Matrix Multiplication. Numerical Linear Algebra with Applications, 6, 8, 687–700, 1999. [91] I. Kaporin, The Aggregation and Cancellation Techniques as a Practical Tool for Faster Matrix Multiplication. Theoretical Computer Science, 315, 2–3, 469–510, 2004. [92] S. Ke, B. Zeng, W. Han, V. Y. Pan, Fast Rectangular Matrix Multiplication and Some Applications. Science in China, Series A: Mathematics, 51, 3, 389–406, 2008. 30 [93] P. Kirrinnis, Polynomial Factorization and Partial Fraction Decomposition by Simul- taneous Newton's Iteration, J. of Complexity, 14, 378–444, 1998. [94] D.E. Knuth, The Art of Computer Programming: Volume 2, Seminumerical Algo- rithms. Addison-Wesley, Reading, Massachusetts, 1969 (first edition), 1981 (second edition), 1997 (third edition). [95] D.E. Knuth, The Art of Computer Programming: Volume 3, Sorting and Searching. Addison-Wesley, Reading, Massachusetts, 19673 (first edition), 1998 (second edition). [96] T.G. Kolda, B.W. Bader, Tensor Decompositions and Applications. SIAM Review, 51, 3, 455–500, 2009. [97] J. B. Kruskal, Three-way arrays: rank and uniqueness of trilinear decompositions, with application to arithmetic complexity and statistics, Linear Algebra and Its Ap- plications, 18, 2, 95–138, 1977. [98] E. Karstadt, O. Shwatrz, Matrix Multiplication, a Little Faster, Proc. SPAA'17, 101– 110, 2017. [99] J.D. Laderman, A noncommutative algorithm for multiplying 33 matrices using 23 multiplications, Bull. Amer. Math. Soc., 82, 1, 126–128, 1976. [100] J. Laderman, V.Y. Pan, H.-X. Sha, On Practical Algorithms for Accelerated Matrix Multiplication. Linear Algebra and Its Applications, 162–164, 557–588, 1992. [101] J.M. Landsberg, New Lower Bound for the Rank of Matrix Multiplication. SIAM J. on Computing, 43, 1, 144–149, 2014. [102] L. Lee, Fast Context-free Grammar Parsing Requires Fast Boolean Matrix Multipli- cation. Journal of the ACM (JACM), 49, 1, 1–15, 2002. [103] F. Le Gall, Faster Algorithms for Rectangular Matrix Multiplication. Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS 2012), 514–523, IEEE Computer Society Press, 2012. [104] F. Le Gall, Powers of Tensors and Fast Matrix Multiplication. Proceedings of the 39th International Symposium on Symbolic and Algebraic Computation (ISSAC 2014), 296– 303, ACM Press, New York, 2014. [105] G. Lotti, F. Romani, On the Asymptotic Complexity of Rectangular Matrix Multipli- cation. Theoretical Computer Science, 23, 171–185, 1983. [106] R. G. Lerner, G. L. Trigg. Encyclopaedia of Physics (2nd ed.), VHC publishers, 1991. ISBN 3-527-26954-1. [107] M. W. Mahoney, Randomized Algorithms for Matrices and Data, Foundations and Trends in Machine Learning, NOW Publishers, 3, 2, 2011. (Abridged version in: Advances in Machine Learning and Data Mining for Astronomy, edited by M. J. Way, et al., pp. 647-672, 2012.) [108] A. Massarenti, E. Raviolo, Corrigendum to "The rank of n × n matrix multiplication is at least 3n2 − 2√2n3/2 − 3n" [Linear Algebra and its Applications, 438, 11 (2013) 4500–4509]. Linear Algebra and its Applications, 445, 369–371, 2014. [109] W. L. Miranker, V. Y. Pan, Methods of Aggregations, Linear Algebra and Its Appli- cations, 29, 231–257, 1980. [110] R. Moenck, A. Borodin, Fast Modular Transform via Division, Proc. 13th Ann. Symp. Switching Automata Theory, 90–96, IEEE Comp. Soc. Press, Washington, DC, 1972. 31 [111] T.S. Motzkin, Evaluation of Polynomials and Evaluation of Rational Functions. Bull. of Amer. Math. Society, 61, 2, 163, 1955. [112] Jinsoo Oh, Jin Kim, Byung-Ro Moon, On the inequivalence of bilinear algorithms for 3 3 matrix multiplication. Information Processing Letters, 113, 17, 640–645, 2013. [113] I.V. Oseledets, E.E. Tyrtyshnikov, TT-cross Approximation for Multidimensional Ar- rays. Linear Algebra Appls. 432, 1, 70–88, 2010. [114] A.M. Ostrowski, On Two Problems in Absract Algebra Connected with Horner's Rule. In the Studies Presented to R. von Mises, 40–48, Academic Press, New York, 1954. [115] V.Y. Pan, Some Schemes for the Evaluation of Polynomials with Real Coefficients, Doklady Akademii Nauk SSSR (in Russian), 127, 2, 266–269, 1959. [116] V.Y. Pan, On Methods of Computing the Values of Polynomials. Uspekhi Matematich- eskikh Nauk, 21, 1(127), 103–134, 1966. [Transl. Russian Mathematical Surveys, 21, 1(127), 105–137, 1966.] [117] V.Y. Pan, On Schemes for the Evaluation of Products and Inverses of Matrices (in Russian). Uspekhi Matematicheskikh Nauk, 27, 5 (167), 249–250, 1972. [118] V.Y. Pan, Strassen's Algorithm Is Not Optimal. Trilinear Technique of Aggregating for Fast Matrix Multiplication. Proc. the 19th Annual IEEE Symposium on Foundations of Computer Science (FOCS'78), 166–176, IEEE Computer Society Press, Long Beach, California, 1978. [119] V.Y. Pan, Fields Extension and Trilinear Aggregating, Uniting and Canceling for the Acceleration of Matrix Multiplication. Proceedings of the 20th Annual IEEE Sympo- sium on Foundations of Computer Science (FOCS'79), 28–38, IEEE Computer Society Press, Long Beach, California, 1979. [120] V.Y. Pan, New Fast Algorithms for Matrix Operations. SlAM J. on Computing, 9, 2, 321–342, 1980, and Research Report RC 7555, IBM T.J. Watson Research Center, February 1979. [121] V.Y. Pan, The Bit-Operation Complexity of the Convolution of Vectors and of the DFT. Technical report 80-6, Computer Science Dept., SUNY, Albany, NY, 1980. (Ab- stract in Bulletin of EATCS, 14, page 95, 1981.) [122] V.Y. Pan, New Combinations of Methods for the Acceleration of Matrix Multiplica- tions. Computers and Mathematics (with Applications), 7, 1, 73–125, 1981. [123] V.Y. Pan, Trilinear Aggregating with Implicit Canceling for a New Acceleration of Matrix Multiplication. Computers and Mathematics (with Applications), 8, 1, 23–34, 1982. [124] V.Y. Pan, Fast Matrix Multiplication without APA-Algorithms, Computers and Math- ematics (with Applications), 8, 5, 343–366, 1982. [125] V.Y. Pan, How Can We Speed up Matrix Multiplication? SIAM Review, 26, 3, 393– 415, 1984. [126] V.Y. Pan, Trilinear Aggregating and the Recent Progress in the Asymptotic Acceler- ation of Matrix Operations. Theoretical Computer Science, 33, 1, 117–138, 1984. [127] V.Y. Pan, How to Multiply Matrices Faster. Lecture Notes in Computer Science, 179, Springer, Berlin, 1984. 32 [128] V. Y. Pan, On Computations with Dense Structured Matrices, Math. of Computation, 55, 191, 179–190, 1990. Proceedings version in Proc. Intern. Symposium on Symbolic and Algebraic Computation (ISSAC'89), 34–42, ACM Press, New York, 1989. [129] C. B. Parker. McGraw Hill Encyclopaedia of Physics (2nd ed.), 1994. ISBN 0-07- 051400-3. [130] V. Y. Pan, Structured Matrices and Polynomials: Unified Superfast Algorithms, Birkhauser/Springer, Boston/New York, 2001. [131] V.Y. Pan, Better Late Than Never: Filling a Void in the History of Fast Matrix Multiplication and Tensor Decompositions, arXiv:1411.1972, November 2014. [132] V.Y. Pan, Fast Approximate Computations with Cauchy Matrices and Polynomials, Math. of Computation, in print. Proceedings version in Proc. of the Ninth International Computer Science Symposium in Russia (CSR'2014), (E. A. Hirsch et al., editors), Moscow, Russia, June 2014, Lecture Notes in Computer Science (LNCS), 8476, pp. 287–300 Springer International Publishing, Switzerland (2014). [133] V.Y. Pan, Transformations of Matrix Structures Work Again, Linear Algebra and Its Applications, 465, 1–32, 2015. [134] V.Y. Pan, Matrix Multiplication, Trilinear Decompositions, APA Algorithms, and Summation, arxiv 1412.1145 CS (16 pages, 2 figures), December 3, 2014, revised on February 5, 2015. [135] V.Y. Pan, How Bad Are Vandermonde Matrices?, SIAM Journal of Matrix Analysis, 37, 2, 676–694, 2016. [136] V. Y. Pan, E. Landowne, A. Sadikou, Univariate Polynomial Division with a Reminder by Means of Evaluation and Interpolation, Information Processing Letters, 44, 149– 153, 1992. [137] V. Y. Pan, E. P. Tsigaridas, Nearly Optimal Computations with Structured Ma- trices, Theoretical Computer Science, Special Issue on Symbolic–Numerical Algo- rithms (Stephen Watt, Jan Verschelde, and Lihong Zhi, editors), 681, 117–137, 2017. http://dx.doi.org/10.1016/j.tcs.2017.03.031/ Proceedings version in Proc. of the International Conference on Symbolic Numeric Computation (SNC 2014), ACM Press, New York, 2014. Also April 18, 2014, arXiv:1404.4768 [math.NA] and http://hal.inria.fr/hal-00980591 [138] W. H. Press, S. A. Teukolsky, W. T. Vetterling, B. P. Flannery, Numerical Recipes: The Art of Scientific Computing, (3 ed.). Cambridge University Press, New York, 2007. ISBN 978-0-521-88068-8. [139] R.L. Probert, On the Complexity of Symmetric Computations. Canadian J. of Infor- mation Processing and Operational Research, 12, 1, 71–86, 1974. [140] R. L. Probert, On the Additive Complexity of Matrix Multiplication. SIAM J. on Computing, 5, 2, 187–203, 1976. [141] R. Raz, On the complexity of matrix product. In Proceedings of the Thiry-fourth Annual ACM Symposium on Theory of Computing, 144–151, ACM Press, New York, 2002. [142] R. Raz, A. Shpilka, Lower Bounds for Matrix Product, in Bounded Depth Circuits with Arbitrary Gates. SIAM J. on Computing, 32, 2, 488–513, 2003. [143] F. Romani, private communication, 1979. 33 [144] F. Romani, Some Properties of Disjoint Sum of Tensors Related to MM, SIAM J. on Computing, 11, 2, 263–267, 1982. [145] P. Sankowski, M. Mucha, Fast Dynamic Transitive Closure with Lookahead. Algorith- mica, 56, 2, 180–197, 2010. [146] A. Schonhage, Partial and Total Matrix Multiplication. SIAM J. on Computing, 10, 3, 434–455, 1981. [147] A. Shpilka, Lower Bounds for Matrix Product. SIAM J. on Computing, 32, 5, 1185– 1200, 2003. Proceedings version in FOCS 2001. [148] A.A. Shabalin, Matrix eQTL: Ultra Fast eQTL Analysis via Large Matrix Operations. Bioinformatics, 28, 10, 1353–1358, 2012. [149] A.V. Smirnov, The Bilinear Complexity and Practical Algorithms for Matrix Multi- plication. Computational Mathematics and Mathematical Physics, 53, 12, 1781–1795 (Pleiades Publishing, Ltd), 2013. Original Russian Text in Zhurnal Vychislitel'noi Matematiki i Matematicheskoi Fiziki, 53, 12, 1970–1984, 2013. [150] A.J. Stothers, On the Complexity of Matrix Multiplication. Ph.D. Thesis, University of Edinburgh, 2010. [151] V. Strassen, Gaussian Elimination Is Not Optimal. Numerische Math., 13, 354–356, 1969. [152] V. Strassen, Evaluation of Rational Functions, in Analytical Complexity of Computa- tions (edited by R.E. Miller, J. W. Thatcher, and J. D. Bonlinger), pages 1-10, Plenum Press, New York, 1972. [153] V. Strassen, Vermeidung von Divisionen. J. Reine Angew. Math., 1973, 264, 184–202, 1973. [154] V. Strassen, Some Results in Algebraic Complexity Theory, Proceedings of the In- ternational Congress of Mathematicians, Vancouver, 1974 (Ralph D. James, editor), Volume 1, pages 497–501, Canadian Mathematical Society, 1974. [155] V. Strassen, The Asymptotic Spectrum of Tensors and the Exponent of Matrix Mul- tiplication. Proc. 27th Ann. Symposium on Foundation of Computer Science, 49–54, 1986. [156] J. Todd, Motivation for Working in Numerical Analysis. Communication on Pure and Applied Math., 8, 1, 97–116, 1955. [157] A. L. Toom, The Complexity of a Scheme of Functional Elements Realizing the Mul- tiplication of Integers, Soviet Mathematics Doklady, 3, 714–716, 1963. [158] N. L. Trefethen, D. Bau, III, Numerical Linear Algebra, SIAM, Philadelphia, 1997. [159] E. E. Tyrtyshnikov, Tensor Approximations of Matrices Generated by Asymptotically Smooth Functions. Mat. Sbornik, 194, 6, 147–160, 2003. [160] L. Valiant, General Context-Free Recognition in Less Than Cubic Time, J. of Com- puter and System Sciences, 10, 308–315, 1975. [161] C.F. Van Loan, Computational Frameworks for the Fast Fourier Transform. SIAM, Philadelphia, 1992. ISBN: 0-89871-285-8. 34 [162] V. Vassilevska Williams, Multiplying Matrices Faster than Coppersmith–Winograd. Version available at http://theory.stanford.edu/virgi/matrixmult-f.pdf, retrieved on January 30, 2014. Also see Proc. 44th Annual ACM Symposium on Theory of Com- puting (STOC 2012), 887–898, ACM Press, New York, 2012. [163] A. Waksman, On Winograd's Algorithm for Inner Products. IEEE Transactions on Computers, C-19, 4, 360–361, 1970. [164] S. Winograd, On the Number of Multiplications Required to Compute Certain Func- tions. Proc. of the National Academy of Sciences, 58, 5, 1840–1842, 1967. [165] S. Winograd, A New Algorithm for Inner Product. IEEE Transaction on Computers, C–17, 7, 693–694, 1968. [166] S. Winograd, On the Number of Multiplications Necessary to Compute Certain Func- tions. Communications on Pure and Applied Mathematics, 23, 2, 165–179, 1970. [167] S. Winograd, Arithmetic Complexity of Computations. CBMS-NSF Regional Confer- ence Series in Applied Math., 33, SIAM, Philadelphia, 1980. [168] Y. Xi, J. Xia, S. Cauley, V. Balakrishnan, Superfast and Stable Structured Solvers for Toeplitz Least Squares via Randomized Sampling, SIMAX, 35, 44–72, 2014. [169] J. Xia, Y. Xi, M. Gu, A Superfast Structured Solver for Toeplitz Linear Systems via Randomized Sampling, SIMAX, 33, 837–858, 2012. [170] H. Yu, An improved combinatorial algorithm for Boolean matrix multiplication, Proc. Int. Conf. Automata, Language, and Programming (ICALP 2015), 1094–1105, 2015. [171] R. Yuster, Efficient Algorithms on Sets of Permutations, Dominance, and Real- weighted APSP Proceedings of the 15th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2009), 384–391, 2009. [172] R. Yuster, U. Zwick, U. Detecting Short Directed Cycles Using Rectangular Matrix Multiplication and Dynamic Programming. In Proceedings of the 15th Annual ACM- SIAM Symposium on Discrete Algorithms (SODA 2004), 254–260, 2004. [173] R. Yuster, U. Zwick, Fast Sparse Matrix Multiplication. ACM Transactions on Algo- rithms, 1, 1, 2–13, 2005. [174] R. Yuster, U. Zwick, Answering Distance Queries in Directed Graphs Using Fast Ma- trix Multiplication. In Proceedings of 46th Annual IEEE Symposium on the Founda- tions of Computer Science (FOCS 2005), 389–396, IEEE Computer Society Press, 2005. [175] U. Zwick. All-pairs Shortest Paths Using Bridging Sets and Rectangular Matrix Mul- tiplication. Journal of the ACM, 49, 3, 289–317, 2002. 35
1202.3261
1
1202
2012-02-15T10:22:19
Quick Detection of Nodes with Large Degrees
[ "cs.DS", "cs.SI", "physics.soc-ph" ]
Our goal is to quickly find top $k$ lists of nodes with the largest degrees in large complex networks. If the adjacency list of the network is known (not often the case in complex networks), a deterministic algorithm to find a node with the largest degree requires an average complexity of O(n), where $n$ is the number of nodes in the network. Even this modest complexity can be very high for large complex networks. We propose to use the random walk based method. We show theoretically and by numerical experiments that for large networks the random walk method finds good quality top lists of nodes with high probability and with computational savings of orders of magnitude. We also propose stopping criteria for the random walk method which requires very little knowledge about the structure of the network.
cs.DS
cs
Quick Detection of Nodes with Large Degrees Konstantin Avrachenkov, Nelly Litvak, Marina Sokol, Don Towsley G N E + R F - - 1 8 8 7 - - RESEARCH REPORT N° 7881 February 2012 Project-Team Maestro N R S I 9 9 3 6 - 9 4 2 0 N S S I R R A R N I / I Quick Detection of Nodes with Large Degrees Konstantin Avrachenkov∗, Nelly Litvak†, Marina Sokol‡, Don Towsley§ Project-Team Maestro Research Report n° 7881 -- February 2012 -- 13 pages Our goal is to quickly find top k lists of nodes with the largest degrees in large Abstract: complex networks. If the adjacency list of the network is known (not often the case in complex networks), a deterministic algorithm to find a node with the largest degree requires an average complexity of O(n), where n is the number of nodes in the network. Even this modest complexity can be very high for large complex networks. We propose to use the random walk based method. We show theoretically and by numerical experiments that for large networks the random walk method finds good quality top lists of nodes with high probability and with computational savings of orders of magnitude. We also propose stopping criteria for the random walk method which requires very little knowledge about the structure of the network. Key-words: Complex networks, detection of nodes with the largest degrees, top k list, random walk, stopping criteria ∗ INRIA Sophia Antipolis, France, [email protected] † University of Twente, the Netherlands, [email protected] ‡ INRIA Sophia Antipolis, France, [email protected] § University of Massachusetts Amherst, USA, [email protected] RESEARCH CENTRE SOPHIA ANTIPOLIS -- MÉDITERRANÉE 2004 route des Lucioles - BP 93 06902 Sophia Antipolis Cedex Détection Rapide de Noeuds à Degrés Élevés Notre objectif est de trouver rapidement dans les grands réseaux complexes top Résumé : k listes de noeuds avec les plus grands degrés. Si la liste d'adjacence du réseau est connu (pas souvent le cas dans les réseaux complexes), un algorithme déterministe pour trouver un noeud avec le plus grand degré nécessite une complexité moyenne de O(n), où n est le nombre de noeuds dans le réseau. Même cette complexité modeste peut être très élevé pour les grands réseaux complexes. Nous proposons d'utiliser une méthode basé sur le marche aléatoire. Nous montrons théoriquement et par expérimentations numériques que pour les grands réseaux la méthode de marche aléatoire trouve top k listes de bonne qualité avec une forte probabilité de réussite et avec des économies de calcul de plusieurs ordres de grandeur. Nous proposons également des critères d'arrêt pour la méthode de marche aléatoire qui ne nécessite pas de connaissance de la structure du réseau. Mots-clés : marche aléatoire, critères d'arrêt réseaux complexes, détection de noeuds avec les plus grands degrés, top k liste, Quick Detection of Nodes with Large Degrees 3 1 Introduction We are interested in quickly detecting nodes with large degrees in very large networks. Firstly, node degree is one of centrality measures used for the analysis of complex networks. Secondly, large degree nodes can serve as proxies for central nodes corresponding to the other centrality measures as betweenness centrality or closeness centrality [8, 9]. In the present work we restrict ourself to undirected networks or symmetrized versions of directed networks. In particular, this assumption is well justified in social networks. Typically, friendship or acquaintance is a symmetric relation. If the adjacency list of the network is known (not often the case in complex networks), the straightforward method that comes to mind is to use one of the standard sorting algorithms like Quicksort or Heapsort. However, even their modest average complexity, O(n log(n)), can be very high for very large complex networks. In the present work we suggest using random walk based methods for detecting a small number of nodes with the largest degree. The main idea is that the random walk very quickly comes across large degree nodes. In our numerical experiments random walks outperform the standard sorting procedures by orders of magnitude in terms of computational complexity. For instance, in our experiments with the web graph of the UK domain (about 18 500 000 nodes) the random walk method spends on average only about 5 400 steps to detect the largest degree node. Potential memory savings are also significant since the method does not require knowledge of the entire network. In many practical applications we do not need a complete ordering of the nodes and even can tolerate some errors in the top list of nodes. We observe that the random walk method obtains many nodes in the top list correctly and even those nodes that are erroneously placed in the top list have large degrees. Therefore, as typically happens in randomized algorithms [12, 13], we trade off exact results for very good approximate results or for exact results with high probability and gain significantly in computational efficiency. The paper is organized as follows: in the next section we introduce our basic random walk with uniform jumps and demonstrate that it is able to quickly find large degree nodes. Then, in Section 3 using configuration model we provide an estimate for the necessary number of steps for the random walk. In Section 4 we propose stopping criteria that use very little information about the network. In Section 5 we show the benefits of allowing few erroneous elements in the top k list. Finally, we conclude the paper in Section 6. 2 Random walk with uniform jumps Let us consider a random walk with uniform jumps which serves as a basic algorithm for quick detection of large degree nodes. The random walk with uniform jumps is described by the following transition probabilities [1] pij =( α/n+1 di+α , α/n di+α , if i has a link to j, if i does not have a link to j, (1) where di is the degree of node i. The random walk with uniform jumps can be regarded as a random walk on a modified graph where all the nodes in the graph are connected by artificial edges with a weight α/n. The parameter α controls the rate of jumps. Introduction of jumps helps in a number of ways. As was shown in [1], it reduces the mixing time to stationarity. It also solves a problem encountered by a random walk on a graph consisting of two or more components, namely the inability to visit all nodes. The random walk with jumps also reduces the variance of the network function estimator [1]. This random walk resembles the PageRank random walk. However, unlike the PageRank random walk, the introduced random walk is reversible. One RR n° 7881 4 K. Avrachenkov & N. Litvak & M. Sokol & D. Towsley important consequence of the reversibility of the random walk is that its stationary distribution is given by a simple formula di + α 2E + nα πi(α) = ∀i ∈ V, (2) from which the stationary distribution of the original random walk can easily be retrieved. We observe that the modification preserves the order of the nodes' degrees, which is particularly important for our application. We illustrate on several network examples how the random walk helps us quickly detect large degree nodes. We consider as examples one synthetic network generated by the preferential attachment rule and two natural large networks. The Preferential Attachment (PA) network combines 100 000 nodes. It has been generated according to the generalized preferential attach- ment mechanism [6]. The average degree of the PA network is two and the power law exponent is 2.5. The first natural example is the symmetrized web graph of the whole UK domain crawled in 2002 [4]. The UK network has 18 520 486 nodes and its average degree is 28.6. The second natural example is the network of co-authorships of DBLP [5]. Each node represents an author and each link represents a co-authorship of at least one article. The DBLP network has 986 324 nodes and its average degree is 6.8. We carry out the following experiment: we initialize the random walk (1) at a node chosen according to the uniform distribution and continue the random walk until we hit the largest degree node. The largest degrees for the PA, UK and DBLP networks are 138, 194 955, and 979, respectively. For the PA network we have made 10 000 experiments and for the UK and DBLP networks we performed 1 000 experiments (these networks were too large to perform more experiments). In Figue 1 we plot the histograms of hitting times for the PA network. The first remarkable observation is that when α = 0 (no restart) the average hitting time, which is equal to 123 000, is nearly three orders of magnitude larger than 3 720, the hitting time when α = 2. The second remarkable observation is that 3 720 is not too far from the value 1/πmax(α) = (2E + nα)/(dmax + α) = 2 857, which corresponds to the average return time to the largest degree node in the random walk with jumps. 10000 8000 6000 4000 2000 0 0 0.5 1 1.5 2 2.5 x 106 (a) α = 0 6000 5000 4000 3000 2000 1000 0 0 1 2 3 4 x 104 (b) α = 2 Figure 1: Histograms of hitting times in the PA network. We were not able to collect a representative number of experiments for the UK and DBLP networks when α = 0. The reason for this is that the random walk gets stuck either in disconected Inria Quick Detection of Nodes with Large Degrees 5 or weakly connected components of the networks. For the UK network we were able to make 1 000 experiments with α = 0.001 and obtain the average hitting time 30 750. Whereas if we take α = 28.6 for the UK network, we obtain the average hitting time 5 800. Note that the expected return time to the largest degree node in the UK network is given by 1/πmax(α) = (2E + nα)/(dmax + α) = 5 432. For the DBLP graph we conducted 1 000 experiments with α = 0.00001 and obtained an average hitting time of 41 131. Whereas if we take α = 6.8, we obtain an average hitting time of 14 200. The expected return time to the largest degree node in the DBLP network is given by 1/πmax(α) = (2E + nα)/(dmax + α) = 13 607. The two natural network examples confirm our guess that the average hitting time for the largest degree node is fairly close to the average return time to the largest degree node. Let us also confirm our guess with asymptotic analysis. Theorem 1 Without loss of generality, index the nodes such that node 1 has the largest degree, (1, i) ∈ E, i = 2, ..., s, s = d1 + 1, and let ν denote the initial distribution of the random walk with jumps. Then, the expected hitting time to node 1 starting from any initial distribution ν is given by Eν[T1] = Pn i=2 di + (n − 1)α d1 + 2α(1 − 1/n) + o(cid:18) min i=2,...,s {(di + α), n}(cid:19) , Proof: The expected hitting time from distribution ν to node 1 is given by the formula Eν [T1] = ν[I − P−1]−11, where P−1 is a taboo probability matrix (i.e., matrix P with the 1-st row and 1-st column removed). The matrix P−1 is substochastic but is very close to stochastic. Let us represent it as a stochastic matrix minus some perturbation term: (3) (4) P−1 = P − εQ = P − 0 . . . 1+2α/n d2+α 0 0 1+2α/n ds+α 2α/n ds+1+α 0 . . . 0 0 2α/n dn+α     We add missing probability mass to the diagonal of P , which corresponds to an increase in the weights for self-loops. The matrix P represents a reversible Markov chain with the stationary distribution dj + α i=2 di + (n − 1)α . πj = Pn Now we can use the following result from the perturbation theory (see Lemma 1 in [2]): [I − P + εQ]−1 = 1π π(εQ)1 + X0 + εX1 + ... , (5) RR n° 7881 6 K. Avrachenkov & N. Litvak & M. Sokol & D. Towsley where π is the stationary distribution of the stochastic matrix P . In our case, the quantity maxi=2,...,s{1/(di + α), 1/n} will play the role of ε. We apply the series (5) to approximate the expected hitting time. Towards this goal, we calculate n π(εQ)1 = πjεqjj Xj=2 Xj=s+1 + n dj + α i=2 di + (n − 1)α 2α/n dj + α d1 + 2α(1 − 1/n) i=2 di + (n − 1)α . Pn Pn = = s Xj=2 Pn = dj + α i=2 di + (n − 1)α 1 + 2α/n dj + α d1(1 + 2α/n) + (n − d1 − 1)(2α/n) Observing that ν1π1 = 1, we obtain (3). i=2 di + (n − 1)α Pn (cid:3) Indeed, the asymptotic expression (3) is very close to (2E + nα)/(d1 + α), which is the expected return time to node 1. Based on the notion of the hitting time we propose an efficient method for quick detection of the top k list of largest degree nodes. The algorithm maintains a top k candidate list. Note that once one of the k nodes with the largest degrees appears in this candidate list, it remains there subsequently. Thus, we are interested in hitting events. We propose the following algorithm for detecting the top k list of largest degree nodes. Algorithm 1 Random walk with jumps and candidate list 1. Set k, α and m. 2. Execute a random walk step according to (1). 3. Check if the current node has a larger degree than one of the nodes in the current top k candidate list. If it is the case, insert the new node in the top-k candidate list and remove the worst node out of the list. 4. If the number of random walk steps is less than m, return to Step 2 of the algorithm. Stop, otherwise. The value of parameter α is not crucial. In our experiments, we have observed that as long as the value of α is neither too small nor not too big, the algorithm performs well. A good option for the choice of α is a value slightly smaller than the average node degree. Let us explain this choice by calculating a probability of jump in the steady state πj(α) α dj + α = n Xj=1 n Xj=1 dj + α α 2E + nα dj + α = nα 2E + nα = α 2E/n + α . If α is equal to 2E/n, the average degree, the random walk will jump in the steady state on average every two steps. Thus, if we set α to the average degree or to a slightly smaller value, on one hand the random walk will quickly converge to the steady state and on the other hand we will not sample too much from the uniform distribution. The number of random walk steps, m, is a crucial parameter. Our experiments indicate that we obtain a top k list with many correct elements with high probability if we take the number of random walk steps to be twice or thrice as large as the expected hitting time of the nodes in the top k list. From Theorem 1 we know that the hitting time of the large degree node is related to the value of the node's degree. Thus, the problem of choosing m reduces to the problem of estimating the values of the largest degrees. We address this problem in the following section. Inria Quick Detection of Nodes with Large Degrees 7 3 Estimating the largest degrees in the configuration net- work model The estimations for the values of the largest degrees can be derived in the configuration network model [7] with a power law degree distribution. In some applications the knowledge of the power law parameters might be available to us. For instance, it is known that web graphs have power law degree distribution and we know typical ranges for the power law parameters. We assume that the node degrees D1, . . . , Dn are i.i.d. random variables with a power law distribution F and finite expectation E[D]. Let us determine the number of links contained in the top k nodes. Denote F (x) = P [D ≤ x], ¯F (x) = 1 − F (x), x ≥ 0. Further let D(1) ≥ . . . ≥ D(n) be the order statistics of D1, . . . , Dn. Under the assumption that Dj's obey a power law, we use the results from the extreme value theory as presented in [11], to state that there exist sequences of constants (an) and (bn) and a constant δ such that lim n→∞ n ¯F (anx + bn) = (1 + δx)−1/δ. (6) This implies the following approximation for high quantiles of F , with exceedance probability close to zero [11]: xp ≈ an (pn)−δ − 1 δ + bn. For the jth largest degree, where j = 2, . . . , k, the estimated exceedance probability equals (j − 1)/n, and thus we can use the quantile x(j−1)/n to approximate the degree D(j) of this node: D(j) ≈ an (j − 1)−δ − 1 δ + bn. (7) The sequences (an) and (bn) are easy to find for a given shape of the tail of F . Below we derive the corresponding results for the commonly accepted Pareto tail distribution of D, that is, ¯F (t) = Cx−γ for x > x′, (8) where γ > 1 and x′ is a fixed sufficiently large number so that the power law degree distribution is observed for nodes with degree larger than x′. In that case we have lim n→∞ n ¯F (anx + bn) = lim n→∞ nC(anx + bn)−γ = lim n→∞ (C −1/γn−1/γanx + C −1/γn−1/γbn)−γ, which directly gives (6) with δ = 1/γ, an = δCδnδ, bn = Cδnδ. (9) Substituting (9) into (7) we obtain the following prediction for D(j), j = 2, . . . , k, in the case of the Pareto tail of the degree distribution: D(j) ≈ n1/γ[C1/γ(j − 1)−1/γ − C1/γ + 1]. (10) It remains to find an approximation for D(1), the maximal degree in the graph. From the extreme value theory it is well known that if D1, . . . , Dn obey a power law then lim n→∞ P (cid:18) D(1) − bn an ≤ x(cid:19) = Hδ(x) = exp(−(1 + δx)−1/δ), RR n° 7881 8 K. Avrachenkov & N. Litvak & M. Sokol & D. Towsley where, for Pareto tail, an, bn and δ are defined in (9). Thus, as an approximation for the maximal node degree we can choose anx + bn where x can be chosen as either an expectation, a median or a mode of Hδ(x). If we choose the mode, ((1 + δ)−δ − 1)/δ, then we obtain an approximation, which is smaller than the one for the 2nd largest degree. Further, the expectation (Γ(1−δ)−1)/δ is very sensitive to the value of δ = 1/γ, especially when γ is close to one, which is often the case in complex networks. Besides, the parameter γ is hard to estimate with high precision. Thus, we choose the median (log(2))−δ − 1)/δ, which yields D(1) ≈ an (log(2))−δ − 1 δ + bn = n1/γ[C1/γ(log(2))−1/γ − C1/γ + 1]. (11) For instance, in the PA network γ = 2.5 and C = 3.7, which gives according to (11) D(1) ≈ 127. (This is a good prediction even though the PA network is not generated according to the configuration model. We also note that even though the extremum distribution in the preferential attachment model is different from that of the configuration model their ranges seem to be very close [10].) This in turn suggests that for the PA network m should be chosen in the range 6 000-18 000 if α = 2. As we can see from Figure 2 this is indeed a good range for the number of random walk steps. In the UK network γ = 1.7 and C = 90, which gives D(1) ≈ 82 805 and suggests a range of 20 000-30 000 for m if α = 28.6. Figure 3 confirms that this is a good choice. The degree distribution of the DBLP network does not follow a power law so we cannot apply the above reasoning to it. 4 Stopping criteria Suppose now that we do not have any information about the range for the largest k degrees. In this section we design stopping criteria that do not require knowledge about the structure of the network. As we shall see, knowledge of the order of magnitude of the average degree might help, but this knowledge is not imperative for a practical implementation of the algorithm. Let us now assume that node j can be sampled independently with probability πj(α) as in (2). There are at least two ways to achieve this practically. The first approach is to run the random walk for a significant number of steps until it reaches the stationary distribution. If one chooses α reasonably large, say the same order of magnitude as the average degree, then the mixing time becomes quite small [1] and we can be sure to reach the stationary distribution in a small number of steps. Then, the last step of a run of the random walk will produce an i.i.d. sample from a distribution very close to (2). The second approach is to run the random walk uninterruptedly, also with a significant value of α, and then perform Bernoulli sampling with probability q after a small initial transient phase. If q is not too large, we shall have nearly independent samples following the stationary distribution (2). In our experiment, q ∈ [0.2, 0.5] gives good results when α has the same order of magnitude as the average degree. We now estimate the probability of detecting correctly the top k list of nodes after m i.i.d. samples from (2). Denote by Xi the number of hits at node i after m i.i.d. samples. We note that if we use the second approach to generate i.i.d. samples, we spend approximately m/q steps of the random walk. We correctly detect the top k list with the probability given by the multinomial distribution P [X1 ≥ 1, ..., Xk ≥ 1] = Xi1≥1,...,i1≥1 m! i1! · · · ik!(m − i1 − ... − ik)! πi1 1 · · · πik k (1 − πi)m−i1−...−ik k Xi=1 Inria Quick Detection of Nodes with Large Degrees 9 but it is not feasible for any realistic computations. Therefore, we propose to use the Pois- son approximation. Let Yj, j = 1, ..., n be independent Poisson random variables with means πj m. That is, the random variable Yj has the following probability mass function P [Yj = r] = e−mπj (mπj)r/r!. It is convenient to work with the complementary event of not detecting cor- rectly the top k list. Then, we have P [{X1 = 0} ∪ ... ∪ {Xk = 0}] ≤ 2P [{Y1 = 0} ∪ ... ∪ {Yk = 0}] = 2(1 − P [{Y1 ≥ 1} ∩ ... ∩ {Yk ≥ 1}]) = 2(1 − P [{Yj ≥ 1}]) k Yj=1 = 2(1 − k Yj=1 (1 − P [{Yj = 0}])) = 2(1 − k Yj=1 (1 − e−mπj )) =: a, (12) where the first inequality follows from [12, Thm 5.10]. In fact, in our numerical experiments we observed that the factor 2 in the first inequality is very conservative. For large values of m, the Poisson bound works very well as proper approximation. For example, if we would like to obtain the top 10 list with at most 10% probability of error, we need to have on average 4.5 hits per each top element. This can be used to design the stopping criteria for our random walk algorithm. Let ¯a ∈ (0, 1) be the admissible probability of an error in the top k list. Now the idea is to stop the algorithm after m steps when the estimated value of a for the first time is lower than the critical number ¯a. Clearly, am = 2(1 − (1 − e−Xj )) k Yj=1 is the maximum likelihood estimator for a, so we would like to choose m such that am ≤ ¯a. The problem, however, is that we do not know which Xj's are the realisations of the number of visits to the top k nodes. Then let Xj1 , ..., Xjk be the number of hits to the current elements in the top k candidate list and consider the estimator am,0 = 2(1 − k (1 − e−Xji )), Yi=1 which is the maximum likelihood estimator of the quantity k 2(1 − (1 − e−mπji )) ≥ a. Yi=1 (Here πji is a stationary probability of the node with the score Xji , i = 1, . . . , k). The estimator am,0 is computed without knowledge of the top k nodes or their degrees, and it is an estimator of an upper bound of the estimated probability that there are errors in the top k list. This leads to the following stopping rule. Stopping rule 0. Stop at m = m0, where m0 = arg min{m : am,0 ≤ ¯a}. RR n° 7881 10 K. Avrachenkov & N. Litvak & M. Sokol & D. Towsley The above stopping criterion can be simplified even further to avoid computation of am,0. Since am,1 := 2(1 − (1 − e−Xjk )k) ≥ am,0 ≥ a, where Xjk is the number of hits of the worst element in the candidate list. The inequality am ≤ ¯a is guaranteed if am,1 ≤ ¯a. This leads to the following stopping rule for the random walk algorithm. Stopping rule 1. Compute x0 = arg min{x ∈ N : (1 − e−x)k ≥ 1 − ¯α/2.} Stop at m1 = arg min{m : Xjk = x0}. We have observed in our numerical experiments that we obtain the best trade off between the number of steps of the random walk and the accuracy if we take α around the average degree and the sampling probability q around 0.5. Specifically, if we take ¯a/2 = 0.15 (x0 = 4) in Stopping rule 1 for top 10 list, we obtain 87% accuracy for an average of 47 000 random walk steps for the PA network; 92% accuracy for an average of 174 468 random walk steps for the DBLP network; and 94% accuracy for an average of 247 166 random walk steps for the UK network. We have averaged over 1000 experiments to obtain tight confidence intervals. 5 Relaxation of top k lists In the stopping criteria of the previous section we have strived to detect all nodes in the top k list. This costs us a lot of steps of the random walk. We can significantly gain in performance by relaxing this strict requirement. For instance, we could just ask for list of k nodes that contains 80% of top k nodes [3]. This way we can take an advantage of a generic 80/20 rule that 80% of result can be achieved with 20% of effort. Let us calculate the expected number of top k elements observed in the candidate list up to trial m. Define by Xj the number of times we have observed node j after m trials and Hj =(cid:26) 1, node j has been observed at least once, 0, node j has not been observed. Assuming we sample in i.i.d. fashion from the distribution (2), we can write E[ k Xj=1 Hj] = k Xj=1 E[Hj] = k Xj=1 P [Xj ≥ 1] = k Xj=1 (1 − P [Xj = 0]) = k (1 − (1 − πj)m). Xj=1 (13) In Figure 2 we plot E[Pk the PA network with α = 0 and α = 2. In Figure 3 we plot E[Pk j=1 Hj] (the curve "I.I.D. sample") as a function of m for k = 10 for j=1 Hj] as a function of m for k = 10 for the UK network with α = 0.001 and α = 28.6. The results for the UK and DBLP networks are similar in spirit. Here again we can use the Poisson approximation E[ k Xj=1 Hj] ≈ k Xj=1 (1 − e−mπj ). In fact, the Poisson approximation is so good that if we plot it on Figures 2 and 3, it nearly covers exactly the curves labeled "I.I.D. sample", which correspond to the exact formula (13). Similarly Inria Quick Detection of Nodes with Large Degrees 11 10 8 6 4 2 0 0 Random Walk I.I.D. sample 0.5 1 m 1.5 2 x 104 (a) α = 0 10 9 8 7 6 5 4 3 2 1 0 0 Random Walk I.I.D. sample 0.5 1 m 1.5 2 x 104 (b) α = 2 Figure 2: Average number of correctly detected elements in top-10 for PA. 9 8 7 6 5 4 3 2 1 0 0 Random Walk I.I.D. sample 0.5 1 m 1.5 2 x 104 7 6 5 4 3 2 1 0 0 Random Walk I.I.D. sample 0.5 1 m 1.5 2 x 104 (a) α = 0.001 (b) α = 28.6 Figure 3: Average number of correctly detected elements in top-10 for UK. to the previous section, we can propose stopping criteria based on the Poisson approximation. Denote bm = k Xi=1 (1 − e−Xji ). Stopping rule 2. Stop at m = m2, where m2 = arg min{m : bm ≥ ¯b}. Now if we take ¯b = 7 in Stopping rule 3 for top-10 list, we obtain on average 8.89 correct elements for an average of 16 725 random walk steps for the PA network; we obtain on average 9.28 correct elements for an average of 66 860 random walk steps for the DBLP network; and we obtain on average 9.22 correct elements for an average of 65 802 random walk steps for the UK network. (We have averaged over 1000 experiments for each network.) This makes for the UK network the gain of more than two orders of magnitude in computational complexity with respect to the deterministic algorithm. RR n° 7881 12 K. Avrachenkov & N. Litvak & M. Sokol & D. Towsley 6 Conclusions and future research We have proposed the random walk method with the candidate list for quick detection of largest degree nodes. We have also supplied stopping criteria which do not require knowledge of the graph structure. In the case of large networks, our algorithm finds top k list of largest degree nodes with few mistakes with the running time orders of magnitude faster than the deterministic sorting algorithm. In future research we plan to obtain estimates for the required number of steps for various types of complex networks. References [1] K. Avrachenkov, B. Ribeiro and D. Towsley, "Improving random walk estimation accuracy with uniform restarts", in Proceedings of WAW 2010, also Springer LNCS v.6516, pp.98-109, 2010. [2] K. Avrachenkov, V. Borkar and D. Nemirovsky, "Quasi-stationary distributions as centrality measures for the giant strongly connected component of a reducible graph", Journal of Comp. and Appl. Mathematics, v.234, pp.3075-3090, 2010. [3] K. Avrachenkov, N. Litvak, D. Nemirovsky, E. Smirnova and M. Sokol, "Quick detection of top-k personalized pagerank lists", in Proceedings of WAW 2011. [4] P. Boldi and S. Vigna, "The WebGraph framework I: Compression techniques", in Proceed- ings of WWW 2004. [5] P. Boldi, M. Rosa, M. Santini and S. Vigna, "Layered label propagation: A multiresolution coordinate-free ordering for compressing social networks", in Proceedings of WWW 2011. [6] S.N. Dorogovtsev, J.F.F. Mendes and A.N. Samukhin, "Structure of growing networks: Ex- act solution of the Barabasi-Albert model", Phys. Rev. Lett., v.85, pp.4633-4636, 2000. [7] R. van der Hofstad, Random graphs and complex networks, Lechture Notes, Available at http://www.win.tue.nl/rhofstad/NotesRGCN.pdf, 2009. [8] Y. Lim, D.S. Menasche, B. Ribeiro, D. Towsley and P. Basu, "Online estimating the k central nodes of a network", in Proceedings of IEEE NSW 2011. [9] A.S. Maiya and T.Y. Berger-Wolf, "Online sampling of high centrality individuals in social networks", in Proceedings of PAKDD 2010. [10] A.A. Moreira, J.S. Andrade Jr. and L.A.N. Amaral, "Extremum statistics in scale-free net- work models", Phys. Rev. Lett., v.89, 268703 4 pages, 2002. [11] G. Matthys and J. Beirlant, "Estimating the extreme value index and high quantiles with exponential regression models", Statistica Sinica, v.13, no.3, pp.853-880, 2003. [12] M. Mitzenmacher and E. Upfal, Probability and Computing: Randomized Algorithms and Probabilistic Analysis, Cambridge University Press, 2005. [13] R. Motwani and P. Raghavan, Randomized Algorithms, Cambridge University Press, 1995. Inria Quick Detection of Nodes with Large Degrees Contents 1 Introduction 2 Random walk with uniform jumps 3 Estimating the largest degrees in the configuration network model 4 Stopping criteria 5 Relaxation of top k lists 6 Conclusions and future research 13 3 3 7 8 10 12 RR n° 7881 RESEARCH CENTRE SOPHIA ANTIPOLIS -- MÉDITERRANÉE 2004 route des Lucioles - BP 93 06902 Sophia Antipolis Cedex Publisher Inria Domaine de Voluceau - Rocquencourt BP 105 - 78153 Le Chesnay Cedex inria.fr ISSN 0249-6399 This figure "logo-inria.png" is available in "png"(cid:10) format from: http://arxiv.org/ps/1202.3261v1 This figure "pagei.png" is available in "png"(cid:10) format from: http://arxiv.org/ps/1202.3261v1 This figure "rrpage1.png" is available in "png"(cid:10) format from: http://arxiv.org/ps/1202.3261v1
1607.04002
2
1607
2017-04-25T15:40:57
Directed Hamiltonicity and Out-Branchings via Generalized Laplacians
[ "cs.DS" ]
We are motivated by a tantalizing open question in exact algorithms: can we detect whether an $n$-vertex directed graph $G$ has a Hamiltonian cycle in time significantly less than $2^n$? We present new randomized algorithms that improve upon several previous works: 1. We show that for any constant $0<\lambda<1$ and prime $p$ we can count the Hamiltonian cycles modulo $p^{\lfloor (1-\lambda)\frac{n}{3p}\rfloor}$ in expected time less than $c^n$ for a constant $c<2$ that depends only on $p$ and $\lambda$. Such an algorithm was previously known only for the case of counting modulo two [Bj\"orklund and Husfeldt, FOCS 2013]. 2. We show that we can detect a Hamiltonian cycle in $O^*(3^{n-\alpha(G)})$ time and polynomial space, where $\alpha(G)$ is the size of the maximum independent set in $G$. In particular, this yields an $O^*(3^{n/2})$ time algorithm for bipartite directed graphs, which is faster than the exponential-space algorithm in [Cygan et al., STOC 2013]. Our algorithms are based on the algebraic combinatorics of "incidence assignments" that we can capture through evaluation of determinants of Laplacian-like matrices, inspired by the Matrix--Tree Theorem for directed graphs. In addition to the novel algorithms for directed Hamiltonicity, we use the Matrix--Tree Theorem to derive simple algebraic algorithms for detecting out-branchings. Specifically, we give an $O^*(2^k)$-time randomized algorithm for detecting out-branchings with at least $k$ internal vertices, improving upon the algorithms of [Zehavi, ESA 2015] and [Bj\"orklund et al., ICALP 2015]. We also present an algebraic algorithm for the directed $k$-Leaf problem, based on a non-standard monomial detection problem.
cs.DS
cs
Directed Hamiltonicity and Out-Branchings via Generalized Laplacians Andreas Bjorklund 1, Petteri Kaski2, and Ioannis Koutis3 1Department of Computer Science, Lund University, [email protected] 2Department of Computer Science, Aalto University, [email protected] 3Computer Science Department, UPR Rio Piedras, [email protected] Abstract We are motivated by a tantalizing open question in exact algorithms: can we detect whether an n-vertex directed graph G has a Hamiltonian cycle in time significantly less than 2n? We present new randomized algorithms that improve upon several previous works: a. We show that for any constant 0 < λ < 1 and prime p we can count the Hamiltonian cycles modulo p⌊(1−λ) n ⌋ in expected time less than cn for a constant c < 2 that depends only on p and λ. Such an algorithm was previously known only for the case of counting modulo two [Bjorklund and Husfeldt, FOCS 2013]. 3p b. We show that we can detect a Hamiltonian cycle in O∗(3n−α(G)) time and polyno- mial space, where α(G) is the size of the maximum independent set in G. In par- ticular, this yields an O∗(3n/2) time algorithm for bipartite directed graphs, which is faster than the exponential-space algorithm in [Cygan et al., STOC 2013]. Our algorithms are based on the algebraic combinatorics of "incidence assignments" that we can capture through evaluation of determinants of Laplacian-like matrices, inspired by the Matrix–Tree Theorem for directed graphs. In addition to the novel algorithms for directed Hamiltonicity, we use the Matrix–Tree Theorem to derive simple algebraic algorithms for detecting out-branchings. Specifically, we give an O∗(2k)-time randomized algorithm for detecting out-branchings with at least k internal vertices, improving upon the algorithms of [Zehavi, ESA 2015] and [Bjorklund et al., ICALP 2015]. We also present an algebraic algorithm for the directed k-Leaf problem, based on a non-standard monomial detection problem. 1 Introduction The Hamiltonian cycle problem has played a prominent role in development of techniques for the design of exact algorithms for hard problems. The early O∗(2n) algorithms based on dynamic programming and inclusion-exclusion [1, 20, 19], remained un-challenged for several decades. In 2010, Bjorklund [3], gave a randomized algorithm running in O(1.657n) time for the case of undirected graphs. The algorithm taps into the power of algebraic combinatorics, and in particular determinants that enumerate cycle covers. 1 Despite this progress in the undirected Hamiltonian cycle problem, a substantial improvement in the more general directed version of the problem remains an open problem and a key challenge in the area of exact algorithms. The currently best known general algorithm runs in O∗(2n−Θ(√n/ log n)) time [4], and there are no known connections with the theory of SETH- hardness [18] that would-at least partly-dash the hope for a faster algorithm. A number of recent works have attempted to crack directed Hamiltonicity, revealing that the problem is indeed easier in certain restricted settings. Cygan and Pilipczuk [12] showed that the problem admits an O∗(2(1−ǫd)n) time algorithm for graphs with average degree bounded by d, where ǫd is a constant with a doubly exponential dependence on d. Cygan et al. [11] showed that the problem admits an O∗(1.888n) time randomized algorithm for bipartite graphs and that the parity of directed Hamiltonian cycles can also be computed within the same time bound. Bjorklund and Husfeldt [6] showed that the parity of Hamiltonian cycles can be com- puted in O∗(1.619n) randomized time in general directed graphs. Finally, Bjorklund et al. [5] showed that the problem can be solved in O∗((2 − Θ(1))n) time when the graph contains less than 1.038n Hamiltonian cycles, via a reduction to the parity problem. In this paper we improve or generalize all of these works. Our results. As one would expect, all recent "below-2n" algorithm designs for the Hamil- tonicity problem rely on algebraic combinatorics and involve formulas that enumerate Hamil- tonian cycles. But somewhat surprisingly, none of these approaches employs the directed version of the Matrix–Tree Theorem (see e.g. Gessel and Stanley [17, §11]), one of the most striking and beautiful results in algebraic graph theory. The theorem enables the enumera- tion of spanning out-branchings, that is, rooted spanning trees with all arcs oriented away from the root, via a determinant polynomial. Our results in this paper derive from a detailed combinatorial understanding and generalization of this classical setup. The combinatorial protagonist of this paper is the following notion that enables a "two-way" possibility to view each arc in a directed graph: Definition 1 (Incidence assignment). Let G be a directed graph with vertex set V and arc set E. For a subset W ⊆ V we say that a mapping µ : W → E is an incidence assignment if for all u ∈ W it holds that µ(u) is incident with u. In particular, looking at a single arc uv ∈ E, an incidence assignment µ can assign uv in two1 possible ways: as an out-arc µ(u) = uv at u, or as an in-arc µ(v) = uv at v. From an enumeration perspective the serendipity of this "two-way" possibility to assign an arc becomes apparent when one considers how an incidence assignment µ can realize a directed cycle in its image µ(W ). Indeed, let u1u2, u2u3, . . . , uℓ−1uℓ, uℓu1 ∈ E be the arcs of a directed cycle C of length ℓ ≥ 2 in G with V (C) ⊆ W . It is immediate that there are now exactly two2 ways to realize C in the image µ(W ). Namely, we can realize C 1Strictly speaking we are here assuming that both u ∈ W and v ∈ W . To break symmetry in our applications we do allow also situations where uv has only one possible assignment due to either u /∈ W or v /∈ W . 2Again strictly speaking it will be serendipitous to break symmetry so that certain cycles will have only one realization instead of two. 2 either (i) using only in-arcs with µ(u1) = uℓu1, µ(u2) = u1u2, µ(u3) = u2u3, . . . , µ(uℓ) = uℓ−1uℓ , (1) or (ii) using only out-arcs with µ(u1) = u1u2, µ(u2) = u2u3, µ(u3) = u3u4, . . . , µ(uℓ) = uℓu1 . (2) Incidence assignments thus enable two distinct ways to realize a directed cycle. Furthermore, it is possible to switch between (1) and (2) so that only the images of u1, u2, . . . , uℓ under µ are affected. The algebraization of this combinatorial observation is at the heart of the directed Matrix–Tree Theorem (which we will review for convenience of exposition in Sect. 2) and all of our results in this paper. Our warmup result involves a generalization of the directed Hamiltonian path problem, namely the k-Internal Out-Branching problem, where the goal is to detect whether a given directed graph contains a spanning out-branching that has at least k internal vertices. This is a well- studied problem on its own, with several successive improvements the latest of which is an O∗(3.617k) algorithm by Zehavi [25] and an O∗(3.455k) algorithm by Bjorklund et al. [9] for the undirected version of the problem. Using a combination of the directed Matrix–Tree Theorem and a monomial-sieving idea due to Floderus et al. [15], in Sect. 3 we show the following: Theorem 2 (Detecting a k-Internal Out-Branching). There exists a randomized algorithm that solves the k-internal out-branching problem in time O∗(2k) and with negligible probability of reporting a false negative. In Appendix A we give a further application for the k-Leaf problem, that is, detecting a spanning out-branching with at least k leaves. We note that Gabizon et al. [16] have recently given another application of the directed Matrix–Tree Theorem for the problem of detecting out-branchings of bounded degree. Proceeding to our two main results, in Sect. 4 we observe that the directed Matrix–Tree Theorem leads to a formula for computing the number of Hamiltonian paths in arbitrary characteristic by using a standard inclusion–exclusion approach, which leads to a formula that involves the summation of 2n determinants. To obtain a below-2n design, we present a way to randomize the underlying Laplacian matrix so that the number of Hamiltonian paths does not change but in expectation most of the summands vanish modulo a prime power. Furthermore, to efficiently list the non-vanishing terms, we use a variation of an algorithm of Bjorklund et al. [8] that was used for a related problem, computing the permanent modulo a prime power. This leads to our first main result: Theorem 3 (Counting directed Hamiltonian cycles modulo a prime power). For all 0 < λ < 1 there exists a randomized algorithm that, given an n-vertex directed graph and a prime p as input, counts the number of Hamiltonian cycles modulo p⌊(1−λ)n/(3p)⌋ in expected time O∗(cid:0)2n(1−λ2/(19p log2 p))(cid:1). The algorithm uses exponential space. A corollary of Theorem 3 is that if G has at most dn Hamiltonian cycles, we can detect one in time O(cn d ), where d is any fixed constant and cd < 2 is a constant that only depends 3 on d. As a further corollary we obtain a randomized algorithm for counting Hamiltonian cycles in graphs of bounded average (out-)degree d in O(2(1−ǫd)n) time. The constant ǫd has a polynomial dependency in d. Previous algorithms had a constant ǫd with an exponential dependency on d [7, 12]. (The proofs of these results are relegated to Appendix B.) Returning to undirected Hamiltonicity, a key to the algorithm in [3] was the observation that determinants enumerate all non-trivial cycle covers an even number of times. This is due to the fact that each undirected cycle can be traversed in both directions. By picking a special vertex, one can break symmetry and force this to happen only for non-Hamiltonian cycle covers, so that the corresponding monomials cancel in characteristic 2. In Sect. 5 we present a "quasi-Laplacian" matrix whose determinant enables a similar approach for the directed case via algebraic combinatorics of incidence assignments, and furthermore enables one to accommodate a speedup assuming the existence of a good-sized independent set. We specifically prove the following as our second main result: Theorem 4 (Detecting a directed Hamiltonian cycle). There exists a randomized algorithm that solves the directed Hamiltonian cycle problem on a given directed graph G with a maximum independent set of size α(G), in O∗(3n(G)−α(G)) time, polynomial space and with negligible probability of reporting a false negative. Theorem 4 improves and generalizes the exponential-space algorithm of Cygan et al. [11]. Terminology and conventions. All graphs in this paper are directed and without loops and parallel arcs unless indicated otherwise. For an arc e starting from vertex u and ending at vertex v we say that u is the tail of e and v is the head of e. The vertices u and v are the ends of e. A directed graph is connected if the undirected graph obtained by removing orientation from the arcs is connected. A subgraph of a graph is spanning if the subgraph has the same set of vertices as the graph. A connected directed graph is an out-branching if every vertex has in-degree 1 except for the root vertex that has in-degree 0. We say that a vertex is internal to an out-branching if it has out-degree at least 1; otherwise the vertex is a leaf of the out-branching. The (directed) Hamiltonian cycle problem asks, given a directed graph G as input, whether G has a spanning directed cycle as a subgraph. The notation O∗( ) suppresses a multiplicative factor polynomial in the input size. We say that an event parameterized by n has negligible probability if the probability of the event tends to zero as n grows without bound. 2 The symbolic Laplacian of a directed graph This section develops the relevant preliminaries on directed graph Laplacians. Permutations and the determinant. A bijection σ : U → U of a finite set U is called a permutation of U . A permutation σ moves an element u ∈ U if σ(u) 6= u; otherwise σ fixes u. The identity permutation fixes every element of U . A permutation σ of U is a cycle of length k ≥ 2 if there exist distinct u1, u2, . . . , uk ∈ U with σ(u1) = u2, σ(u2) = u3 , . . . , σ(uk−1) = uk, σ(uk) = u1 and σ fixes all other elements of U . Two cycles are disjoint if every point moved by one is fixed by the other. The set of all permutations of U forms 4 the symmetric group Sym(U ) with the composition of mappings as the product operation of the group. Every nonidentity permutation factors into a unique product of pairwise disjoint cycles. The sign of a permutation σ that factors into c disjoint cycles of lengths k1, k2, . . . , kc is sgn(σ) = (−1)Pc j=1(kj −1). The sign of the identity permutation is 1. The determinant of a square matrix A with rows and columns indexed by U is the multivariate polynomial det A = Xσ∈Sym(U ) sgn(σ) Yu∈U au,σ(u) . The punctured Laplacian determinant via incidence assignments. Let G be a di- rected graph with n vertices. Associate with each arc uv ∈ E = E(G) an indeterminate xuv. The symbolic Laplacian L = L(G) of G is the n × n matrix with rows and columns indexed by the vertices u, v ∈ V = V (G) and the (u, v)-entry defined3 by Pw∈V :wu∈E xwu −xuv 0 if u = v; if uv ∈ E; if u 6= v and uv /∈ E. (3) ℓuv =  Observe that for each v ∈ V we have that column v of L sums to zero because the diagonal entries cancel the negative off-diagonal entries. Furthermore, for each u ∈ V we have that the monomials on row u of L correspond to the arcs incident to u. Indeed, each monomial at the diagonal corresponds to an in-arc to u, and each monomial at an off-diagonal entry corresponds to an out-arc from u. Thus, selecting one monomial from each row corresponds to selecting an incidence assignment. To break symmetry, select an r ∈ V . The symbolic Laplacian of G punctured at r is obtained from L by deleting both row r and column r. We write Lr = Lr(G) for the symbolic Laplacian of G punctured at r. Let us write Br = Br(G) for the set of all spanning out-branchings of G with root r ∈ V . The following theorem is well-known (see e.g. Gessel and Stanley [17, §11]) and is presented here for purposes of displaying a proof that presents the cancellation argument using incidence assignments. Theorem 5 (Directed Matrix–Tree Theorem). det Lr =PH∈BrQuv∈E(H) xuv. Proof. Let us abbreviate Vr = V (G) \ {r} and study the determinant det Lr = Xσ∈Sym(Vr ) sgn(σ) Yu∈Vr ℓu,σ(u) . (4) In particular, let us fix an arbitrary permutation σ ∈ Sym(Vr) and study the monomials of the polynomial Qu∈Vr ℓu,σ(u) with the assumption that this polynomial is nonzero. From (3) it is immediate for each u ∈ Vr that ℓu,σ(u) expands either (i) to the diagonal sumPw∈V :wu∈E xwu, which happens precisely when σ fixes u with σ(u) = u, or (ii) to the off-diagonal −xuv, which happens precisely when σ moves u with σ(u) = v. Let us write M (σ) for the set of all incidence assignments µ : Vr → E with the properties that (i) each u ∈ Vr fixed by σ is assigned to an in-arc µ(u) = wu ∈ E for some w ∈ V , and 3Recall that we assume that G is loopless so the entries with u = v are well-defined. 5 (ii) each u ∈ Vr moved by σ is assigned to the unique out-arc µ(u) = uv ∈ E with σ(u) = v. Let us write f = f (σ) for the number of elements in Vr fixed by σ. It is immediate by (i) and (ii) that we have Yu∈Vr ℓu,σ(u) = Xµ∈M (σ) (−1)n−1−f (σ) Yu∈Vr xµ(u) . (5) Next observe that from µ we can reconstruct σ = σ(µ) by (i) setting σ(u) = u for each u assigned to an in-arc in µ, and (ii) setting σ(u) = v for each u assigned to an out-arc uv in µ. Thus the union M = Sσ∈Sym(Vr ) M (σ) is disjoint. Let us call the elements of M proper incidence assignments. By (4) and (5) we have det Lr = Xµ∈M (−1)n−1−f (σ)sgn(σ(µ)) Yu∈Vr xµ(u) . (6) We claim that an incidence assignment µ is proper if and only if for every u ∈ Vr there is exactly one u′ ∈ Vr such that µ(u′) is an in-arc to u. For the "only if" direction, let σ be the permutation underlying a proper µ, and observe that vertices moved by σ partition to cycles so a σ never moves a vertex to a fixed vertex. Thus, we have u′ = u for the points fixed by σ, and u′ = σ−1(u) is the vertex preceding u along a cycle of σ for points moved by σ. For the "if" direction, define σ(u) = u if u = u′ and σ(u′) = u if u′ 6= u. In the latter case we have µ(u′) = u′u, which means that u′′ 6= u′ and thus σ(u′′) = u′; by uniqueness of u′ eventually a cycle must close so σ is a well-defined permutation underlying µ and thus µ is proper. Let us write Hr for the set of all spanning subgraphs of G with the property that every vertex in Vr has in-degree 1 and the root r has in-degree 0. From the previous claim it follows that we can view the set µ(Vr) = {µ(u) : u ∈ Vr} for a proper µ as an element of Hr. Furthermore, µ(Vr) is connected (and hence a spanning out-branching with root r) if and only if µ(Vr) is acyclic. Consider an arbitrary H ∈ Hr. If H has a cycle, let C be the least cycle in H according to some fixed but arbitrary ordering of the vertices of G. (Observe that any two cycles in H must be vertex-disjoint and cannot traverse r because r has in-degree 0.) Now consider an arbitrary proper µ that realizes H by µ(Vr) = H. The cycle C is realized in µ by either (1) (in which case σ(µ) fixes all vertices in C), or (2) (in which case σ(µ) traces the cycle C). Furthermore, we may switch between realizations (1) and (2) so that the number of fixed points in the underlying permutation changes by V (C) and the sign of the underlying permutation gets multiplied by (−1)V (C)−1. It follows that the realizations (1) and (2) have different signs and thus cancel each other in (6). If H does not have a cycle, that is, H ∈ Br, it follows that there is a unique proper µ that realizes H. Indeed, first observe that H can be realized only by assigning in-arcs since any assignment of an out-arc in µ implies a cycle in H = µ(Vr), a contradiction. Second, the in-arcs are unique since each u ∈ Vr has in- degree 1 in H. Finally, since µ assigns only in-arcs the underlying permutation σ(µ) is the identity permutation which has sgn(σ(µ)) = 1 and (−1)n−1−f (σ(µ)) = 1. Thus, each acyclic H contributes to (6) through a single µ ∈ M with coefficient 1. The theorem follows. 6 3 Corollary for k-internal out-branchings This section proves Theorem 2. We rely on a substitution idea of Floderus et al. [15, Theo- rem 1] to detect monomials with at least k distinct variables. Let G be an n-vertex directed graph given as input together with a nonnegative integer k. Without loss of generality we may assume that k ≤ n − 1. Iterate over all choices for a root vertex r ∈ V . Introduce an indeterminate yu for each vertex u ∈ V and an indeterminate Introduce one further indeterminate t. Construct the symbolic zuv for each arc uv ∈ E. Laplacian L of G given by (3) and with the assignment xuv = (1+tyu)zuv to the indeterminate xuv for each uv ∈ E. Puncture L at r to obtain Lr. Using, for example, Berkowitz's determinant circuit design [2] for an arbitrary commutative ring with unity, in time O∗(1) build an arithmetic circuit C of size O∗(1) for det Lr. Viewing det Lr as a multivariate polynomial over the polynomial ring R[t, yu, zuv : u ∈ V, uv ∈ E] where R is an abstract ring with unity, from Theorem 5 it follows that G has a spanning out-branching rooted at r with at least k internal vertices if and only if the coefficient of tk in det Lr (which is a polynomial that is either identically zero or both (i) homogeneous of degree k in the indeterminates yu and (ii) homogeneous of degree n− 1 in the indeterminates zuv) has a monomial that is multilinear of degree k in the indeterminates yu. Indeed, observe that the substitution xuv = (1 + tyu)zuv tracks in the degree of the indeterminate yu whether u occurs as an internal vertex or not; the indeterminates zuv make sure that distinct spanning out-branchings will not cancel each other. To detect a multilinear monomial in C restricted to the coefficient of tk we can invoke [10, Lemma 1] or [21, Lemma 2.8]. This results in a randomized algorithm that runs in time O∗(2k) and has a negligible probability of reporting a false negative. This completes the proof of Theorem 2. 4 Modular counting of Hamiltonian cycles This section proves Theorem 3. Fix an arbitrary constant 0 < λ < 1. Let 0 < β < 1/2 be a constant whose precise value is fixed later. Let p be a prime and let G be an n-vertex directed graph with vertex set V and arc set E given as input. Without loss of generality (by splitting any vertex u into two vertices, s and t, with s receiving the out-arcs from u, and t receiving the in-arcs to u) we may count the spanning paths starting from s and ending at t instead of spanning cycles. Similarly, without loss of generality we may assume that 2 ≤ p < n. (Indeed, for p ≥ n the counting outcome from Theorem 3 is trivial.) Sieving for Hamiltonian paths among out-branchings. Let s, t ∈ V be distinct ver- tices. Let us write hp(G, s, t) for the set of spanning directed paths that start at s and end at t in G. Recall that we write Vt = V \ {t} for the t-punctured version of the vertex set V . Let us also write Vst = V \ {s, t}. For O ⊆ Vt, let LO s be the matrix obtained from the Laplacian (3) by first puncturing at s and then substituting xuv = 0 for all arcs uv ∈ E with u ∈ Vt \ O. Since a path P ∈ hp(G, s, t) is precisely a spanning out-branching rooted at s such that every vertex u ∈ Vt has out-degree 1, we have, by Theorem 5 and the principle of 7 inclusion and exclusion, XP ∈hp(G,s,t) Yuv∈E(P ) xuv = XO⊆Vt (−1)Vt\O det LO s . (7) In particular observe that (7) holds in any characteristic. Cancellation modulo a power of p. With foresight, select k = ⌊(1−λ)(1/2−β)n/p⌋. Our objective is next to show that by carefully injecting entropy into the underlying Laplacian we can, in expectation and working modulo pk, cancel all but an exponentially negligible fraction of the summands on the right-hand side of (7). Furthermore, we can algorithmically narrow down to the nonzero terms, leading to an exponential improvement to 2n. Let us assign xuv = 1 for all uv ∈ E with u 6= t. Since no spanning path that ends at t may contain an arc tu ∈ E for any u ∈ Vt, we may without loss of generality assume that G contains all such arcs, and assign, independently and uniformly at random xtu ∈ {0, 1, . . . , p−1}. Thus, the summands det LO s for O ⊆ Vt are now integer-valued random variables and (7) evaluates to hp(G, s, t) with probability 1. Let us next study a fixed O ⊆ Vt. Let FO be the event that LO s has no more than k rows s 6≡ 0 (mod pk) implies FO. To bound where each entry is divisible by p. In particular, det LO the probability of FO from above, observe that LO s is identically zero at each row u ∈ Vst \ O except possibly at the diagonal entries. Furthermore, because of the random assignment to the indeterminates xtu, each diagonal entry at these rows is divisible by p with probability 1/p. Let us take this intuition and turn it into a listing algorithm for (a superset of the) sets O ⊆ Vt that satisfy FO. t = ⌈n/3⌉ and V (2) Bipartitioning. For listing we will employ a meet-in-the-middle approach based on building t = Vt be a = n − 1 − ⌈n/3⌉. Associate with each O1 ⊆ V (1) a each set O ⊆ Vt from two parts using the following bipartitioning. Let V (1) bipartition with V (1) vector zO1 ∈ {0, 1, . . . , p − 1,∞}Vst with the entry at u ∈ Vst defined by if u ∈ O1; (cid:0)xtu +Pw∈O1:wu∈E xwu(cid:1) mod p otherwise. u =(∞ t ∪ V (2) zO1 (8) t t Similarly, associate with each O2 ⊆ V (1) at u ∈ Vst defined by t a vector zO2 ∈ {0, 1, . . . , p − 1,∞}Vst with the entry zO2 u =(∞ if u ∈ O2; (cid:0)−Pw∈O2:wu∈E xwu(cid:1) mod p otherwise. (9) Suppose now that we have O1 ⊆ V (1) t with O = O1 ∪ O2. We claim that FO holds only if the vectors zO1 and zO2 agree in at most k entries. Indeed, observe that u = zO2 zO1 s is divisible by p. That is, zO1 s consists only of elements divisible by p. Thus it suffices to list all pairs (O1, O2) such that zO1 and zO2 have at most k agreements. u holds only if both u ∈ Vst \ O and the (u, u)-entry of LO implies the entire row u of LO and O2 ⊆ V (2) u = zO2 u t 8 Balanced and unbalanced sets. To set up the listing procedure, let us now partition the index domain Vst of our vectors into b = ⌊3 log2 p⌋ pairwise disjoint sets S1, S2, . . . , Sb such that we have ⌊(n − 2)/b⌋ ≤ Si ≤ ⌈(n − 2)/b⌉. Let us split the sets O ⊆ Vt into two types. Let us say that O is balanced if (1/2 − β)n/b ≤ (Vst\ O)∩ Si ≤ (1/2 + β)n/b holds for all i = 1, 2, . . . , b; otherwise O is unbalanced. Recalling that Pℓ j(cid:1) ≤ 2nH(ℓ/n) holds for all integers 1 ≤ ℓ ≤ n/2, where H(ρ) = −ρ log2 ρ − (1 − ρ) log2(1 − ρ) is the binary entropy function, observe that there are in total at most j=0(cid:0)n 2n+1−mini Sib ⌈(1/2−β)n/b⌉ Xj=0 j (cid:0)⌊n/b+2⌋ (cid:1) ≤ 2n−(n−2)/b+32(n/b+2)H(1/2−β)b ≤ 2n(1−(1−H(1/2−β))/b)+7b (10) sets O that are unbalanced. t t and O2 ⊆ V (1) Precomputation and listing. Suppose that O1 ⊆ V (1) are compatible in the sense that zO1 and zO2 agree in at most k entries. For S ⊆ Vst and a vector z whose entries are indexed by Vst, let us write zS for the restriction of z to S. If O1 and O2 are compatible, then by an averaging argument there must exist an i = 1, 2, . . . , b such that zO1 Si and zO2 agree in at most k/b entries. In particular, this enables us to iterate over O2 and list Si all compatible O1 by focusing only on each restriction to Si for i = 1, 2, . . . , b. Furthermore, the search inside Si can be precomputed to look-up tables. Indeed, for each i = 1, 2, . . . , b and each key g ∈ {0, 1, . . . , p − 1,∞}Si , let us build a complete list of all subsets O1 ⊆ V (1) such that zO1 Si processing in total at most and g agree in at most k/b entries. These b look-up tables can be built by t 2V (1) t b Xi=1 (p + 1)Si ≤ 2n/3+72(n/(⌊3 log2 p⌋)+2) log2(p+1) log2 p = O(20.87n) pairs (O1, g). This takes time O∗(20.87n) in total. The main listing procedure now considers each O2 ⊆ V (2) in turn, and for each i = 1, 2, . . . , b consults the look-up table for direct access to all O1 such that zO1 agree in at most k/b Si entries. In particular this will list all compatible pairs (O1, O2) and hence all sets O = O1∪O2 such that FO holds. and zO2 Si t Expected running time. Let us now analyze the expected running time of the algorithm. We start by deriving an upper bound for the expected number of pairs (O1, O2) considered by the main listing procedure. First, observe that the total number of pairs (O1, O2) considered by the procedure with O = O1 ∪ O2 unbalanced is bounded from above by our upper bound (10) for the total number of unbalanced O. Indeed, O1 = O ∩ V (1) are and O2 = O ∩ V (2) uniquely determined by O. Next, for a pair (O1, O2) with balanced O = O1 ∪ O2 and i = 1, 2, . . . , b, let GO1,O2,i be the event that zO1 agree in at most k/b entries. We seek an upper bound for the Si probability of GO1,O2,i to obtain an upper bound for the expected number of pairs with balanced O = O1 ∪ O2 considered by the main listing procedure. Let AO1,O2,i be the number and zO2 Si t t 9 and zO2 Si of entries in which zO1 agree. We observe that AO1,O2,i is binomially distributed with Si expectation (Vt \ O) ∩ Si/p. Since O is balanced, we have (1/2 − β)n/b ≤ (Vt \ O) ∩ Si ≤ (1/2 + β)n/b. We also recall that k = ⌊(1− λ)(1/2− β)n/p⌋. A standard Chernoff bound now gives Pr(GO1,O2,i) ≤ Pr(cid:0)AO1,O2,i ≤ k/b(cid:1) ≤ Pr(cid:0)AO1,O2,i ≤ (1 − λ)(Vt \ O) ∩ Si/p(cid:1) ≤ exp(cid:0)−λ2(Vt \ O) ∩ Si/(2p)(cid:1) ≤ exp(cid:0)−λ2(1/2 − β)n/(2pb)(cid:1) . Recalling that b = ⌊3 log2 p⌋, the main listing procedure thus considers in expectation at most 2n exp(cid:0)−λ2(1/2− β)n/(2p(3 log2 p)(cid:1) pairs (O1, O2) with O = O1 ∪ O2 balanced. Recalling our upper bound for the total number of unbalanced sets (10), we thus have that the main list- ing procedure runs in O∗(cid:0)2n exp(cid:0)−λ2(1/2 − β)n/(2p(3 log2 p))(cid:1) + 2n(1−(1−H(1/2−β))/(3 log2 p))(cid:1) expected time. Recalling that precomputation runs in O∗(20.87n) time, we thus have for β = 1/6 that the entire algorithm runs in O∗(2n(1−λ2/(19p log2 p))) expected time and computes hp(G, s, t) modulo p⌊(1−λ)n/(3p)⌋. This completes the proof of Theorem 3. 5 Directed Hamiltonicity via quasi-Laplacian determinants This section proves Theorem 4. Let G be a directed n-vertex graph given as input. Finding a maximum independent set. Let B ∪ Y = V (G) be a partition of the vertex set into two disjoint sets B ("blue") and Y ("yellow") such that no arc has both of its ends in Y . That is, Y is an independent set. We can find an Y of the maximum possible size as follows. First, in time polynomial in n compute the maximum-size matching in the undirected graph obtained from G by disregarding the orientation of the arcs. This maximum-size matching must consist of at least ⌊n/2⌋ edges or G does not admit a Hamiltonian cycle. (Indeed, from a Hamiltonian cycle we can obtain a matching with ⌊n/2⌋ edges by taking every other arc in the cycle.) Since for each matching edge it holds that both ends of the edge cannot be in an independent set, we can in time O∗(3n/2) find a maximum-size independent set Y of G. Furthermore, α(G) = Y ≤ ⌊n/2⌋ + 1, so we are within our budget of O∗(3n(G)−α(G)) in terms of running time. In fact, Y ≤ ⌊n/2⌋ or otherwise G trivially does not admit a Hamiltonian cycle. The symbolic quasi-Laplacian. We will first define the quasi-Laplacian and then give intuition for its design. Let us work over a field of characteristic 2. For each y ∈ Y introduce a copy yin and let Yin be the set of all such copies. Similarly, for each y ∈ Y introduce a copy yout and let Yout be the set of all such copies. We assume that Yin and Yout are disjoint. For each j ∈ Yin ∪ Yout let us write j ∈ Y for the underlying element of Y of which j is a copy. Let B∗ be a set of n− 2Y elements that is disjoint from both Yin and Yout. For each uv ∈ E and each j ∈ B∗ ∪ Yin ∪ Yout, introduce an indeterminate x(j) uv . Select an arbitrary vertex s ∈ B for purposes of breaking symmetry and let I, O ⊆ B. The quasi-Laplacian QI,O,s = QI,O,s(G) of G with skew at s be the n × n matrix whose rows are 10 indexed by u ∈ B ∪ Y and whose columns are indexed by j ∈ B∗ ∪ Yin ∪ Yout such that the (u, j)-entry is defined by qI,O,s uj =   wu x(j) uj x(j) ju Pw∈O:wu∈E,u∈I x(j) +Pw∈I:uw∈E,u∈O\{s} x(j) Pw∈O:wu∈E x(j) Pw∈I:uw∈E x(j) 0 wu uw uw (a) if u ∈ B and j ∈ B∗; (b) if u ∈ O \ {s} and j ∈ Yin with uj ∈ E; (c) if u ∈ I and j ∈ Yout with ju ∈ E; (d) if u ∈ Y and j ∈ Yin with u = j; (e) if u ∈ Y and j ∈ Yout with u = j; otherwise. (11) Let us next give some intuition for (11) before proceeding with the proof. Analogously to the Laplacian (3), the quasi-Laplacian (11) has been designed so that the monomials of each row u ∈ B ∪ Y of QI,O,s control the assignment of either an in-arc or an out-arc to u in an incidence assignment, and the skew at s is used to break symmetry so that s is always assigned an in-arc to s. In particular, without the skew at row s and with I = O, each column of QI,O,s would sum to zero, in analogy with the (non-punctured) Laplacian. Let us now give intuition for the columns j ∈ Yin and j ∈ Yout. First, observe by (b) and (d) in (11) that selecting a monomial from column j ∈ Yin corresponds to making sure that the in-degree of j is 1. Such a selection may be either a "quasi-diagonal" assignment of the in-arc wj to u = j ∈ Y via (d) for some w ∈ B; or an "off-diagonal" assignment of the out-arc uj to u ∈ B via (b). Second, observe by (c) and (e) in (11) that selecting a monomial from column j ∈ Yout corresponds to making sure that the out-degree of j is 1. Thus, the columns j ∈ Yin ∪ Yout enable us to make sure that an incidence assigment has both in-degree 1 and out-degree 1 at each u ∈ Y without the use of sieving. This gives us the speed-up from O∗(3n) to O∗(3n−Y ) running time. Observe also that the structure for the quasi-Laplacian QI,O,s is enabled precisely because Y is an independent set and thus no arc contributes to both in-degree and out-degree in Y . The quasi-Laplacian determinant sieve. Recalling that we are working over a field of characteristic 2, let us study the sum XI,O⊆B I∪O=B s∈I det QI,O,s = XI⊆B XO⊆B det QI,O,s = Xσ:B∪Y →B∗∪Yin∪Yout σ bijective XI⊆B XO⊆B Yu∈B∪Y qI,O,s u,σ(u) . (12) Observe that the first equality in (12) holds because QI,O,s has by (11) an identically zero row unless I ∪ O = B and s ∈ I; the second equality holds by definition of the determinant in characteristic 2 and changing the order of summation. From (11) and the right-hand side of (12) it is immediate that (12) is either identically zero or a homogeneous polynomial of degree n in the nE indeterminates x(j) uv for j ∈ B∗ ∪ Yin ∪ Yout and uv ∈ E.4 We claim that (12) is not identically zero if and only if G admits at least one spanning cycle. Furthermore, each spanning cycle in G defines precisely B∗! distinct monomials in (12). 4Our algorithm for deciding Hamiltonicity will naturally not work with a symbolic representation of (12) but rather in a homomorphic image under a random evaluation homomorphism. 11 To establish the claim, fix a bijection σ : B ∪ Y → B∗ ∪ Yin ∪ Yout. Let us write M (σ) for the set of all incidence assignments µ : B ∪ Y → E that are proper in the sense that all of the following six requirements hold (cf. (11)): • (s): µ(s) is an in-arc to s; • (a): for all u ∈ B with σ(u) ∈ B∗ it holds that µ(u) has both of its vertices in B; • (b): for all u ∈ B with σ(u) ∈ Yin it holds that µ(u) is an in-arc to σ(u); • (c): for all u ∈ B with σ(u) ∈ Yout it holds that µ(u) is an out-arc from σ(u); • (d): for all u ∈ Y with σ(u) ∈ Yin it holds that µ(u) is an in-arc to u and u = σ(u); and • (e): for all u ∈ Y with σ(u) ∈ Yout it holds that µ(u) is an out-arc from u and u = σ(u). Observe that each µ ∈ M (σ) defines a collection of n arcs µ(B∪ Y ) = {µ(u) : u ∈ B∪ Y }. Let us write Z µ out) for the set of vertices in B∪Y with zero in-degree (out-degree) with respect to the arcs in µ(B ∪ Y ). Since σ is a bijection and thus has a preimage for each j ∈ Yin ∪ Yout, from (b,c,d,e) above it follows that Z µ out ⊆ B. Furthermore, from (a,b,c,d,e) it follows that for the arcs in µ(B ∪ Y ) the sum of the in-degrees (and the sum of in and Z µ the out-degrees) of the vertices in B is B = B∗ + Y . Thus, we have that Z µ are both empty if and only if for the arcs µ(B ∪ Y ) both the in-degree and the out-degree of every vertex u ∈ B ∪ Y is 1. (Note that the claim is immediate for u ∈ Y by (b,c,d,e) and bijectivity of σ.) in ⊆ B and Z µ in (respectively, Z µ out Let us now study the right-hand side of (12) for a fixed σ. Using (a,b,c,d,e) and (11) to rearrange in terms of incidence assignments, we have XI⊆V XO⊆V Yu∈B∪Y qI,O,s u,σ(u) = Xµ∈M (σ) Yu∈B∪Y x(σ(u)) µ(u) XI⊆Z µ in XO⊆Z µ out 1 . (13) Since we are working in characteristic 2, all other µ ∈ M (σ) except those for which µ(B ∪ Y ) is a cycle cover will cancel in the right-hand side of (13). Take the sum of (13) over all bijections σ. Consider an arbitrary cycle cover of B ∪ Y . Let C be a cycle in this cycle cover. Assuming that C does not contain s, we can realize C in an incidence assignment µ : B ∪ Y → E either using (1) or (2). If C contains s and µ is proper, only the realization (1) is possible by (s). To see that realization with a proper µ ∈ M (σ) for some σ is possible, consider an arbitrary u ∈ B ∪ Y and observe that each image µ(u) by (b,c,d,e) uniquely determines the image σ(u) ∈ Yin ∪ Yout when µ(u) has one vertex in Y ; when µ(u) has both vertices in B, an unused σ(u) ∈ B∗ may be chosen arbitrarily so that µ ∈ M (σ). It follows that any cycle cover with c cycles is realized as exacly B∗! distinct monomials Qu∈B∪Y x(σ(u)) in (12), each with coefficient 2c−1. This coefficient is nonzero if and only if c = 1. µ(u) Completing the algorithm. To detect whether the given n-vertex directed graph G ad- mits a Hamiltonian cycle, first decompose the vertex set into disjoint V = B ∪ Y with Y an independent set of size Y = α(G) using the algorithm described earlier. Next, in time O∗(1) construct an irreducible polynomial of degree 2⌈log2 n⌉ over F2 (see e.g. von zur Gathen and 12 Gerhard [24, §14.9]) to enable arithmetic in the finite field of order q = 22⌈log2 n⌉ ≥ n2 in time O∗(1) for each arithmetic operation. Next, assign an independent uniform random value from Fq to each indeterminate x(j) uv with j ∈ B∗ ∪ Yin ∪ Yout and uv ∈ E. Finally, using the assigned values for the indeterminates, compute the left-hand side of (12) using, for example, Gaussian elimination to compute each determinant det QI,O,s in O∗(1) operations in Fq. Let us write r ∈ Fq for the result of this computation. In particular, we can compute r from a given G in total O∗(3B) = O∗(3n(G)−α(G)) operations in Fq, and consequently in total O∗(3n(G)−α(G)) time. If (12) is identically zero, then clearly r = 0 with probability 1. If (12) is not identically zero (and hence a homogeneous polynomial of degree d = n in the indeterminates) then by the DeMillo–Lipton–Schwartz–Zippel lemma [14, 22, 26] we have r 6= 0 with probability at least 1− d/q ≥ 1− n/n2 ≥ 1− 1/n = 1− o(1). Thus we can decide whether G is Hamiltonian based on whether r 6= 0. In particular this gives probability o(1) of reporting a false negative. This completes the proof of Theorem 4. Acknowledgements. The research leading to these results has received funding from the Swedish Research Council grants VR 2012-4730 "Exact Exponential-Time Algorithms" and VR 2016-03855 "Algebraic Graph Algorithms" (A.B.), the European Research Council under the European Union's Seventh Framework Programme (FP/2007-2013) / ERC Grant Agree- ment 338077 "Theory and Practice of Advanced Search and Enumeration" (P.K.), and grant NSF CAREER CCF-1149048 (I.K.). Work done in part while the authors were at Dagstuhl Seminar 17041 in January 2017 and at the Simons Institute for the Theory of Computing in December 2015. 13 APPENDIX A Detecting a k-Leaf Out-Branching The k-Leaf Out-Branching problems asks, given an n-vertex directed graph G and an integer k as input, whether G has a spanning out-branching with at least k leaves. Equivalently, we are asked to detect a spanning out-branching with at most n − k internal vertices. Let us algebraize the k-Leaf problem by pursuing an analogy with the approach in Sect. 3. Without loss of generality we may assume that 1 ≤ k ≤ n and n ≥ 2. Iterate over all choices for a root vertex r ∈ V . Since n ≥ 2 we have that r must be an internal vertex in any out-branching rooted at r. Introduce an indeterminate yu for each vertex u ∈ V . Construct the symbolic Laplacian L of G given by (3) and with the assignment xuv = yu to the indeterminate xuv for each uv ∈ E. Puncture L at r to obtain Lr. Viewing yr det Lr as a multivariate polynomial over the indeterminates yu, from Theorem 5 it follows that G has a spanning out-branching rooted at r with at most n − k internal vertices if and only if yr det Lr (which is a polynomial that is either identically zero or homogeneous of degree n in the indeterminates yu) has a monomial with at most n − k of the n indeterminates yu. This motivates the following parameterized monomial detection problem. Namely, the (n−k)- DV problem asks, given as input a polynomial P ∈ Z[y1, y2, . . . , yn] that is homogeneous of degree n and with nonnegative integer coefficients, whether P has a monomial with at most n − k distinct indeterminates. The k-DV problem was discussed in [15] and it was shown that it is W[2]-hard via a reduction from the parameterized hitting set problem. However, the (n − k)-DV problem is fixed- parameter tractable with respect to k. We prove the following: Theorem 6 (Detecting a monomial with few indeterminates). There is a randomized algo- rithm that decides the (n− k)-DV problem using O∗(2k+s) evaluations of P and with negligible probability for a false negative, where s ≤ k is the minimum number of indeterminates with degree greater than 1 taken over all monomials of P with at most n−k distinct indeterminates. Proof. We introduce a set of extra indeterminates W = w1, w2, . . . , wn, and two special indeterminates a, b. We will substitute these two indeterminates into X and Y and compute a homogeneous polynomial in {a, b}. The computation can be done either symbolically or with a sufficient number of numerical evaluations and interpolation. The algorithm iterates the following two steps O∗(2k+s) times: a. For each i = 1, 2, . . . , n independently, substitute: either (yi ← a, wi ← b) or (yi ← b, wi ← a), each with probability 1/2. b. Perform the random substitution on the polynomial P (y1, y2, . . . , yn)w1w2 ··· wn to ob- tain a homogeneous polynomial of degree 2n in a and b. If the result is not divisible by (ab)n−k+1 then halt with output YES. If none of the iterations halts, then halt with output NO. 14 Let us now analyze the algorithm. First, consider the effect of the substitution to a monomial with at least n− k + 1 of the indeterminates y1, y2, . . . , yn.Since the monomial gets multiplied by w1w2 ··· wn, the substitution yields a monomial in a, b that is a multiple of (ab)n−k+1. Thus, if all monomials of P have at least n− k + 1 indeterminates then by linearity the result of substitution to P (y1, y2, . . . , yn)w1w2 ··· wn is a multiple of (ab)n−k+1. Thus, the algorithm halts with output NO. Next, consider a monomial with exactly n − k′ indeterminates, among which exactly s have degree at least 2. Because the monomial has degree n, we have s ≤ k′. The monomial is thus of the form yd1 i1 yd2 i2 ··· yds is yis+1 ··· yin−k′ with d1, d2, . . . , ds ≥ 2. Multiplying with w1w2 ··· wn we thus have (cid:17) n Yt=n−k′+1 (yitwit)!(cid:16)yd1−1 n−k′ Yt=1 i1 ··· yds−1 is wit! . Under the random substitution the first product evaluates to (ab)n−k′ . Now note that each of the remaining indeterminates in the product has randomly and independently been assigned to a or b, with probability 1/2. There are s + k′ such indeterminates. It follows that with probability at least 2−(k′+s) the monomial becomes (ab)n−k′ . Thus, when k′ ≥ k the resulting monomial is not divisible by (ab)n−k+1 with probability at least 2−(k+s). Furthermore, by linearity the result of the substitution to P (y1, y2, . . . , yn)w1w2 ··· wn is not divisible either since P has nonnegative coefficients and thus cancellations are not possible. Repeating O∗(2k+s) times renders negligible the probability of a false negative. ak or (ab)n−k′ bk′ We thus have the following: Theorem 7 (Detecting a k-leaf out-branching). The k-Leaf Out-Branching problem can be decided with a randomized algorithm in O∗(2k+s) time, where s is the minimum number of internal vertices with out-degree greater than 1 taken over all out-branchings with at least k leaves. The algorithm has a negligible probability of reporting a false negative. Proof. Consider each root vertex r ∈ V in turn and let P be the polynomial yr det Lr intro- duced in the beginning of this section. For any fixed out-branching, the internal vertices with out-degree greater than 1 correspond to variables with degree greater than 1 in the associated monomial. The theorem follows by a direct application of Theorem 6. Note. As observed by M. Koivisto, the algorithm can be somewhat improved, by skewing the probabilities in the substitution (yi ← a, wi ← b) or (yi ← b, wi ← a) to p and 1 − p respectively, where p = k/(k + s). Using a very similar argument one can show that the problem can be decided with O∗(ck+s) evaluations of P , where c−1 = pp(1 − p)1−p. For example, when s = k/2 the running time becomes O∗(1.89s+k), and when s is some fixed constant (that is, when a tree has a small number of internal branching vertices) then the algorithm runs in polynomial time. The worst-case running time of the algorithm is O∗(2n) when k = s = n/2, but it gets smaller when k > n/2, nearly matching exhaustive search at the W[2]-hard side of the range, that is, when n − k is constant. 15 The best known algorithm for the directed k-leaf problem is based on a branch-and-bound approach and runs in O∗(3.72k) time [13]. Our algorithm runs in O∗(4k) time in the worst case, but it can adapt to properties of the input and actually be faster for instances containing a k-leaf tree with at most 10k/11 internal vertices of out-degree greater than 1. B Corollaries and variants of Theorem 3 This appendix proves corollaries and variants of Theorem 3 to demonstrate the versatility of the approach. Boosting the modulus for counting by Chinese remaindering. From number theory we know (Merten's First Theorem, cf. Tenenbaum [23, Theorem 7]) that if we take the sum over the primes p at most q > 2, we have ln p p ≥ ln q − 2 . Xp≤q Thus, using Theorem 3 for all primes p at most q, from the Chinese Remainder Theorem we obtain that there exists a constant c > 0 such for all large enough integers q we can in expected time O∗(2n(1−cn/(q log q))) compute the number of Hamiltonian cycles in a given n-vertex directed graph modulo an integer M that satisfies M ≥ Yp≤q p⌊n/(3p)⌋ ≥ exp(cid:18) 1 4 nXp≤q ln p p (cid:19) ≥ (e−2q)n/4 . Counting Hamiltonian cycles when there are few. The following result is an imme- diate corollary of modulus-boosting: Theorem 8 (Counting Hamiltonian cycles when there are few). There is a randomized algo- rithm and a constant c > 0 such that for all constants d > 1 the following holds: when given an n-vertex directed graph G with at most dn Hamiltonian cycles as input, the algorithm computes the exact number of Hamiltonian cycles in G in O∗(2n(1−c/d5)) expected time. Proof. Boost the modulus with q = e2d4 to observe that M > dn for all large enough n. Theorem 9 (Counting Hamiltonian cycles with bounded average out-degree). There is a ran- domized algorithm and a constant c > 0 such that for all constants d > 1 the following holds: when given an n-vertex directed graph G with average out-degree at most d, the algorithm computes the exact number of Hamiltonian cycles in G in O∗(2n(1−c/d5)) expected time. Proof. For each vertex u ∈ V (G), let du be the out-degree of u. We have that G has at most Qu∈V (G) du Hamiltonian cycles. On the other hand, the average degree of G is 1 nPu∈V du. From the inequality between arithmetic and geometric means it follows that there are at most dn Hamiltonian cycles in G, and Theorem 8 applies. 16 References [1] Richard Bellman. Dynamic programming treatment of the travelling salesman problem. J. ACM, 9(1):61–63, January 1962. [2] Stuart J. Berkowitz. On computing the determinant in small parallel time using a small number of processors. Information Processing Letters, 18:147–150, 1984. [3] Andreas Bjorklund. Determinant sums for undirected hamiltonicity. SIAM Journal on Computing, 43(1):280–299, 2014. [4] Andreas Bjorklund. Below All Subsets for Some Permutational Counting Problems . In Rasmus Pagh, editor, 15th Scandinavian Symposium and Workshops on Algorithm Theory (SWAT 2016), volume 53 of Leibniz International Proceedings in Informatics (LIPIcs), pages 17:1–17:11, Dagstuhl, Germany, 2016. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik. [5] Andreas Bjorklund, Holger Dell, and Thore Husfeldt. The parity of set systems under random restrictions with applications to exponential time problems. In Automata, Lan- guages, and Programming: 42nd International Colloquium, ICALP 2015, Kyoto, Japan, July 6-10, 2015, Proceedings, Part I, pages 231–242, Berlin, Heidelberg, 2015. Springer Berlin Heidelberg. [6] Andreas Bjorklund and Thore Husfeldt. The parity of directed hamiltonian cycles. In 2013 IEEE 54th Annual Symposium on Foundations of Computer Science, pages 724–735, Oct 2013. [7] Andreas Bjorklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto. The traveling salesman problem in bounded degree graphs. ACM Trans. Algorithms, 8(2):18:1–18:13, April 2012. [8] Andreas Bjorklund, Thore Husfeldt, and Isak Lyckberg. Computing the permanent modulo a prime power. Unpublished manuscript, 2015. [9] Andreas Bjorklund, Vikram Kamat, Lukasz Kowalik, and Meirav Zehavi. Spotting trees with few leaves. SIAM Journal on Discrete Mathematics, 31(2): 687–713, 2017. Prelim- inary version in Magn´us M. Halld´orsson, Kazuo Iwama, Naoki Kobayashi, and Bettina Speckmann, editors, Automata, Languages, and Programming - 42nd International Col- loquium, ICALP 2015, Kyoto, Japan, July 6-10, 2015, Proceedings, Part I, volume 9134 of Lecture Notes in Computer Science, pages 243–255. Springer, 2015. [10] Andreas Bjorklund, Petteri Kaski, and Lukasz Kowalik. Constrained multilinear detec- tion and generalized graph motifs. Algorithmica, 74(2):947–967, 2016. [11] Marek Cygan, Stefan Kratsch, and Jesper Nederlof. Fast hamiltonicity checking via bases of perfect matchings. In Proceedings of the Forty-fifth Annual ACM Symposium on Theory of Computing, STOC '13, pages 301–310, New York, NY, USA, 2013. ACM. [12] Marek Cygan and Marcin Pilipczuk. Faster exponential-time algorithms in graphs of bounded average degree. Information and Computation, 243:75 – 85, 2015. 40th Inter- national Colloquium on Automata, Languages and Programming (ICALP 2013). 17 [13] Jean Daligault, Gregory Gutin, Eun Jung Kim, and Anders Yeo. FPT algorithms and ker- nels for the directed k-leaf problem. Journal of Computer and System Sciences, 76(2):144 – 152, 2010. [14] R. A. DeMillo and R. J. Lipton. A probabilistic remark on algebraic program testing. Information Processing Letters, 7:193–195, 1978. [15] Peter Floderus, Andrzej Lingas, Mia Persson, and Dzmitry Sledneu. Detecting monomi- als with k distinct variables. Information Processing Letters, 115(2):82–86, 2015. [16] Ariel Gabizon, Daniel Lokshtanov, and Micha l Pilipczuk. Fast algorithms for parame- terized problems with relaxed disjointness constraints. In Algorithms - ESA 2015: 23rd Annual European Symposium, Patras, Greece, September 14-16, 2015, Proceedings, pages 545–556, Berlin, Heidelberg, 2015. Springer Berlin Heidelberg. [17] Ira M. Gessel and Richard P. Stanley. Algebraic enumeration. In R. L. Graham, M. Grotschel, and L. Lov´asz, editors, Handbook of Combinatorics, volume II, pages 1021–1061. North-Holland, Amsterdam, 1995. [18] Russell Impagliazzo and Ramamohan Paturi. On the complexity of k-sat. Journal of Computer and System Sciences, 62(2):367 – 375, 2001. [19] Richard M. Karp. Dynamic programming meets the principle of inclusion and exclusion. Operations Research Letters, 1(2):49 – 51, 1982. [20] Samuel Kohn, Allan Gottlieb, and Meryle Kohn. A generating function approach to In Proceedings of the Annual Conference (ACM'77), the traveling salesman problem. Association for Computing Machinery, pages 294–300, 1977. [21] Ioannis Koutis and Ryan Williams. Limits and applications of group algebras for param- eterized problems. ACM Transactions on Algorithms, 12:Art. 31, 18, 2016. [22] Jacob T. Schwartz. Fast probabilistic algorithms for verification of polynomial identities. Journal of the ACM, 27:701–717, 1980. [23] Gerald Tenenbaum. Introduction to Analytic and Probabilistic Number Theory. Cam- bridge University Press, Cambridge, 1995. [24] Joachim von zur Gathen and Jurgen Gerhard. Modern Computer Algebra. Cambridge University Press, Cambridge, 3rd edition, 2013. [25] Meirav Zehavi. Mixing color coding-related techniques. In Algorithms ESA 2015: 23rd Annual European Symposium, Patras, Greece, September 14-16, 2015, Proceedings, pages 1037–1049. Springer Berlin Heidelberg, 2015. [26] Richard Zippel. Probabilistic algorithms for sparse polynomials. In Proc. International Symposium on Symbolic and Algebraic Computati on, volume 72 of Lecture Notes in Computer Science, pages 216–226, Berlin, 1979. Springer. 18
1805.07232
1
1805
2018-05-17T02:29:42
Fast approximation of centrality and distances in hyperbolic graphs
[ "cs.DS" ]
We show that the eccentricities (and thus the centrality indices) of all vertices of a $\delta$-hyperbolic graph $G=(V,E)$ can be computed in linear time with an additive one-sided error of at most $c\delta$, i.e., after a linear time preprocessing, for every vertex $v$ of $G$ one can compute in $O(1)$ time an estimate $\hat{e}(v)$ of its eccentricity $ecc_G(v)$ such that $ecc_G(v)\leq \hat{e}(v)\leq ecc_G(v)+ c\delta$ for a small constant $c$. We prove that every $\delta$-hyperbolic graph $G$ has a shortest path tree, constructible in linear time, such that for every vertex $v$ of $G$, $ecc_G(v)\leq ecc_T(v)\leq ecc_G(v)+ c\delta$. These results are based on an interesting monotonicity property of the eccentricity function of hyperbolic graphs: the closer a vertex is to the center of $G$, the smaller its eccentricity is. We also show that the distance matrix of $G$ with an additive one-sided error of at most $c'\delta$ can be computed in $O(|V|^2\log^2|V|)$ time, where $c'< c$ is a small constant. Recent empirical studies show that many real-world graphs (including Internet application networks, web networks, collaboration networks, social networks, biological networks, and others) have small hyperbolicity. So, we analyze the performance of our algorithms for approximating centrality and distance matrix on a number of real-world networks. Our experimental results show that the obtained estimates are even better than the theoretical bounds.
cs.DS
cs
Fast approximation of centrality and distances in hyperbolic graphs Victor Chepoi1, Feodor F. Dragan2, Michel Habib3, Yann Vax`es1, and Hend Al-Rasheed2 1 Laboratoire d'Informatique et Syst`emes, Aix-Marseille Univ, CNRS, and Univ. de Toulon Facult´e des Sciences de Luminy, F-13288 Marseille Cedex 9, France {victor.chepoi, yann.vaxes}@lif.univ-mrs.fr 2 Algorithmic Research Laboratory, Department of Computer Science, Kent State University, Kent, Ohio, USA [email protected], [email protected] 3 Institut de Recherche en Informatique Fondamentale, University Paris Diderot - Paris7, F-75205 Paris Cedex 13, France [email protected] Abstract. We show that the eccentricities (and thus the centrality indices) of all vertices of a δ- hyperbolic graph G = (V, E) can be computed in linear time with an additive one-sided error of at most cδ, i.e., after a linear time preprocessing, for every vertex v of G one can compute in O(1) time an estimate e(v) of its eccentricity eccG(v) such that eccG(v) ≤ e(v) ≤ eccG(v) + cδ for a small constant c. We prove that every δ-hyperbolic graph G has a shortest path tree, constructible in linear time, such that for every vertex v of G, eccG(v) ≤ eccT (v) ≤ eccG(v) + cδ. These results are based on an interesting monotonicity property of the eccentricity function of hyperbolic graphs: the closer a vertex is to the center of G, the smaller its eccentricity is. We also show that the distance matrix of G with an additive one-sided error of at most c′δ can be computed in O(V 2 log2 V ) time, where c′ < c is a small constant. Recent empirical studies show that many real-world graphs (including Internet application networks, web networks, collaboration networks, social networks, biological networks, and others) have small hyperbolicity. So, we analyze the performance of our algorithms for approximating centrality and distance matrix on a number of real-world networks. Our experimental results show that the obtained estimates are even better than the theoretical bounds. 1 Introduction The diameter diam(G) and the radius rad(G) of a graph G = (V, E) are two fundamental metric parameters that have many important practical applications in real world networks. The problem of finding the center C(G) of a graph G is often studied as a facility location problem for networks where one needs to select a single vertex to place a facility so that the maximum distance from any demand vertex in the network is minimized. In the analysis of social networks (e.g., citation networks or recommendation networks), biological systems (e.g., protein interaction networks), computer networks (e.g., the Internet or peer-to-peer networks), transportation networks (e.g., public transportation or road networks), etc., the eccentricity ecc(v) of a vertex v is used to measure the importance of v in the network: the centrality index of v [69] is defined as 1 ecc(v) . Being able to compute efficiently the diameter, center, radius, and vertex centralities of a given graph has become an increasingly important problem in the analysis of large networks. The algorithmic complexity of the diameter and radius problems is very well-studied. For some special classes of graphs there are efficient algorithms [8,18,25,30,33,38,42,53,56,62,79]. However, for general graphs, the only known algorithms computing the diameter and the radius exactly compute the distance between every pair of vertices in the graph, thus solving the all-pairs shortest paths problem (APSP) and hence computing all eccentricities. In view of recent negative results [8,21,83], this seems to be the best what one can do since even for graphs with m = O(n) (where m is the number of edges and n is the number of vertices) the existence of a subquadratic time (that is, O(n2−ǫ) time for some ǫ > 0) algorithm for the diameter or the radius problem will refute the well known Strong Exponential Time Hypothesis (SETH). Furthermore, recent work [9] shows that if the radius of a possibly dense graph (m = O(n2)) can be computed in subcubic time (O(n3−ǫ) for some ǫ > 0), then APSP also admits a subcubic algorithm. Such an algorithm for APSP has long eluded researchers, and it is often conjectured that it does not exist (see, e.g., [84,90]). Motivated by these negative results, researches started devoting more attention to development of fast approximation algorithms. In the analysis of large-scale networks, for fast estimations of diameter, center, radius, and centrality indices, linear or almost linear time algorithms are desirable. One hopes also for the all-pairs shortest paths problem to have o(nm) time small-constant–factor approximation algorithms. In general graphs, both diameter and radius can be 2-approximated by a simple linear time algorithm which picks any node and reports its eccentricity. A 3/2-approximation algorithm for the diameter and the radius which runs in O(mn2/3)1 time was recently obtained in [31] (see also [12] for an earlier O(n2 + m√n) time algorithm and [83] for a randomized O(m√n) time algorithm). For the sparse graphs, this is an o(n2) time approximation algorithm. Furthermore, under plausible assumptions, no O(n2−ǫ) time algorithm can exist that (3/2 − ǫ′)-approximates (for ǫ, ǫ′ > 0) the diameter [83] and the radius [8] in sparse graphs. Similar results are known also for all eccentricities: a 5/3-approximation to the eccentricities of all vertices can be computed in O(m3/2) time [31] and, under plausible assumptions, no O(n2−ǫ) time algorithm can exist that (5/3 − ǫ′)-approximates (for ǫ, ǫ′ > 0) the eccentricities of all vertices in sparse graphs [8]. Better approximation algorithms are known for some special classes of graphs [27,34,35,42,43,50,51,54,94]. A number of heuristics for approximating diameters, radii and eccentricities in real-world graphs were proposed and investigated in [10,21,22,23,69,24,52]. Approximability of APSP is also extensively investigated. An additive 2-approximation for APSP in unweighted undirected graphs (the graphs we consider in this paper) was presented in [46]. It runs in O(min{n3/2m1/2, n7/3}) time and hence improves the runtime of an earlier algorithm from [12]. In [19], an O(n2) time algorithm was designed which computes an approximation of all distances with a multiplicative error of 2 and an additive error of 1. Furthermore, [19] gives an O(n2.24+o(1)ǫ−3 log(n/ǫ)) time algorithm that computes an approximation of all distances with a multiplicative error of (1 + ǫ) and an additive error of 2. The latter improves an earlier algorithm from [58]. Better algorithms are known for some special classes of graphs (see [25,35,49,89] and papers cited therein). The need for fast approximation algorithms for estimating diameters, radii, centrality indices, or all pairs shortest paths in large-scale complex networks dictates to look for geometric and topological properties of those networks and utilize them algorithmically. The classical relationships between the diameter, radius, and center of trees and folklore linear time algorithms for their computation is one of the departing points of this research. A result from 1869 by C. Jordan [66] asserts that the radius of a tree T is roughly equal to half of its diameter and the center is either the middle vertex or the middle edge of any diametral path. The diameter and a diametral pair of T can be computed (in linear time) by a simple but elegant procedure: pick any vertex x, find any vertex y furthest from x, and find once more a vertex z furthest from y; then return {y, z} as a diametral pair. One computation of a furthest vertex is called an FP scan; hence the diameter of a tree can be computed via two FP scans. This two FP scans procedure can be extended to exact or approximate computation of the diameter and radius in many classes of tree-like graphs. For example, this approach was used to compute the radius and a central vertex of a chordal graph in linear time [33]. In this case, the center of G is still close to the middle of all (y, z)-shortest paths and dG(y, z) is not the diameter but is still its good approximation: d(y, z) ≥ diam(G) − 2. Even better, the diameter of any chordal graph can be approximated in linear time with an additive error 1 [54]. But it turns out that the exact computation of diameters of chordal graphs is as difficult as the general diameter problem: it is even difficult to decide if the diameter of a split graph is 2 or 3. The experience with chordal graphs shows that one have to abandon the hope of having fast exact algorithms, even for very simple (from metric point of view) graph-classes, and to search for fast algorithms approximating diam(G), rad(G), C(G), eccG(v) with a small additive constant depending only of the coarse geometry of the graph. Gromov hyperbolicity or the negative curvature of a graph (and, more generally, of a metric space) is one such constant. A graph G = (V, E) is δ-hyperbolic [14,59,28,60] if for any four vertices w, v, x, y of G, the two largest of the three distance sums d(w, v) + d(x, y), d(w, x) + d(v, y), d(w, y) + d(v, x) differ by at most 2δ ≥ 0. The hyperbolicity δ(G) of a graph G is the smallest number δ such that G is δ-hyperbolic. The hyperbolicity can be viewed as a local measure of how close a graph is metrically to a tree: 1 O hides a polylog factor. 2 the smaller the hyperbolicity is, the closer its metric is to a tree-metric (trees are 0-hyperbolic and chordal graphs are 1-hyperbolic). Recent empirical studies showed that many real-world graphs (including Internet application networks, web networks, collaboration networks, social networks, biological networks, and others) are tree-like from a metric point of view [10,11,20] or have small hyperbolicity [67,77,85]. It has been suggested in [77], and recently formally proved in [39], that the property, observed in real-world networks, in which traffic between nodes tends to go through a relatively small core of the network, as if the shortest paths between them are curved inwards, is due to the hyperbolicity of the network. Bending property of the eccentricity function in hyperbolic graphs were used in [16,15] to identify core-periphery structures in biological networks. Small hyperbolicity in real-world graphs provides also many algorithmic advantages. Efficient approximate solutions are attainable for a number of optimization problems [35,36,37,39,40,44,57,92]. In [35] we initiated the investigation of diameter, center, and radius problems for δ-hyperbolic graphs and we showed that the existing approach for trees can be extended to this general framework. Namely, it is shown in [35] that if G is a δ-hyperbolic graph and {y, z} is the pair returned after two FP scans, then d(y, z) ≥ diam(G) − 2δ, diam(G) ≥ 2rad(G) − 4δ − 1, diam(C(G)) ≤ 4δ + 1, and C(G) is contained in a small ball centered at a middle vertex of any shortest (y, z)-path. Consequently, we obtained linear time algorithms for the diameter and radius problems with additive errors linearly depending on the input graph's hyperbolicity. In this paper, we advance this line of research and provide a linear time algorithm for approximate computation of the eccentricities (and thus of centrality indices) of all vertices of a δ-hyperbolic graph G, i.e., we compute the approximate values of all eccentricities within the same time bounds as one computes the approximation of the largest or the smallest eccentricity (diam(G) or rad(G)). Namely, the algorithm outputs for every vertex v of G an estimate e(v) of eccG(v) such that eccG(v) ≤ e(v) ≤ eccG(v) + cδ, where c > 0 is a small constant. In fact, we demonstrate that G has a shortest path tree, constructible in linear time, such that for every vertex v of G, eccG(v) ≤ eccT (v) ≤ eccG(v)+cδ (a so-called eccentricity cδ-approximating spanning tree). This is our first main result of this paper and the main ingredient in proving it is the following interesting dependency between the eccentricities of vertices of G and their distances to the center C(G): up to an additive error linearly depending on δ, eccG(v) is equal to d(v, C(G)) plus rad(G). To establish this new result, we have to revisit the results of [35] about diameters, radii, and centers, by simplifying their proofs and extending them to all eccentricities. Eccentricity k-approximating spanning trees were introduced by Prisner in [81]. A spanning tree T of a graph G is called an eccentricity k-approximating spanning tree if for every vertex v of G eccT (v) ≤ eccG(v)+k holds [81]. Prisner observed that any graph admitting an additive tree k-spanner (that is, a spanning tree T such that dT (v, u) ≤ dG(v, u) + k for every pair u, v) admits also an eccentricity k-approximating spanning tree. Therefore, eccentricity k-approximating spanning trees exist in interval graphs for k = 2 [70,75,80], in asteroidal-triple–free graph [70], strongly chordal graphs [26] and dually chordal graphs [26] for k = 3. On the other hand, although for every k there is a chordal graph without an additive tree k-spanner [70,80], yet as Prisner demonstrated in [81], every chordal graph has an eccentricity 2-approximating spanning tree. Later this result was extended in [51] to a larger family of graphs which includes all chordal graphs and all plane triangulations with inner vertices of degree at least 7. Both those classes belong to the class of 1-hyperbolic graphs. Thus, our result extends the result of [81] to all δ-hyperbolic graphs. As our second main result, we show that in every δ-hyperbolic graph G all distances with an addi- tive one-sided error of at most c′δ can be found in O(V 2 log2 V ) time, where c′ < c is a small con- stant. With a recent result in [32], this demonstrates an equivalence between approximating the hyperbol- icity and approximating the distances in graphs. Note that every δ-hyperbolic graph G admits a distance approximating tree T [35,36,37], that is, a tree T (which is not necessarily a spanning tree) such that dT (v, u) ≤ dG(v, u) + O(δ log n) for every pair u, v. Such a tree can be used to compute all distances in G with an additive one-sided error of at most O(δ log n) in O(V 2) time. Our new result removes the depen- dency of the additive error from log n and has a much smaller constant in front of δ. Note also that the tree T may use edges not present in G (not a spanning tree of G) and thus cannot serve as an eccentricity O(δ log n)-approximating spanning tree. Furthermore, as chordal graphs are 1-hyperbolic, for every k there is a 1-hyperbolic graph without an additive tree k-spanner [70,80]. 3 At the conclusion of this paper, we analyze the performance of our algorithms for approximating eccen- tricities and distances on a number of real-world networks. Our experimental results show that the estimates on eccentricities and distances obtained are even better than the theoretical bounds proved. 2 Preliminaries 2.1 Center, diameter, centrality All graphs G = (V, E) occurring in this paper are finite, undirected, connected, without loops or multiple edges. We use n and V interchangeably to denote the number of vertices and m and E to denote the number of edges in G. The length of a path from a vertex v to a vertex u is the number of edges in the path. The distance dG(u, v) between vertices u and v is the length of a shortest path connecting u and v in G. The eccentricity of a vertex v, denoted by eccG(v), is the largest distance from v to any other vertex, i.e., eccG(v) = maxu∈V dG(v, u). The centrality index of v is eccG(v) . The radius rad(G) of a graph G is the minimum eccentricity of a vertex in G, i.e., rad(G) = minv∈V eccG(v). The diameter diam(G) of a graph G is the the maximum eccentricity of a vertex in G, i.e., diam(G) = maxv∈V eccG(v). The center C(G) = {c ∈ V : eccG(c) = rad(G)} of a graph G is the set of vertices with minimum eccentricity. 1 2.2 Gromov hyperbolicity and thin geodesic triangles Let (X, d) be a metric space. The Gromov product of y, z ∈ X with respect to w is defined to be (yz)w = 1 2 (d(y, w) + d(z, w) − d(y, z)). A metric space (X, d) is said to be δ-hyperbolic [60] for δ ≥ 0 if (xy)w ≥ min{(xz)w, (yz)w} − δ for all w, x, y, z ∈ X. Equivalently, (X, d) is δ-hyperbolic if for any four points u, v, x, y of X, the two largest of the three distance sums d(u, v) + d(x, y), d(u, x) + d(v, y), d(u, y) + d(v, x) differ by at most 2δ ≥ 0. A connected graph G = (V, E) is δ-hyperbolic (or of hyperbolicity δ) if the metric space (V, dG) is δ-hyperbolic, where dG is the standard shortest path metric defined on G. δ-Hyperbolic graphs generalize k-chordal graphs and graphs of bounded tree-length: each k-chordal graph has the tree-length at most ⌊ k 2⌋ [47] and each tree-length λ graph has hyperbolicity at most λ [35,36]. Recall that a graph is k-chordal if its induced cycles are of length at most k, and it is of tree-length λ if it has a Robertson-Seymour tree-decomposition into bags of diameter at most λ [47]. For geodesic metric spaces and graphs there exist several equivalent definitions of δ-hyperbolicity involving different but comparable values of δ [14,28,59,60]. In this paper, we will use the definition via thin geodesic triangles. Let (X, d) be a metric space. A geodesic joining two points x and y from X is a (continuous) map f from the segment [a, b] of R1 of length a − b = d(x, y) to X such that f (a) = x, f (b) = y, and d(f (s), f (t)) = s − t for all s, t ∈ [a, b]. A metric space (X, d) is geodesic if every pair of points in X can be joined by a geodesic. Every unweighted graph G = (V, E) equipped with its standard distance dG can be transformed into a geodesic (network-like) space (X, d) by replacing every edge e = uv by a segment [u, v] of length 1; the segments may intersect only at common ends. Then (V, dG) is isometrically embedded in a natural way in (X, d). The restrictions of geodesics of X to the vertices V of G are the shortest paths of G. Let (X, d) be a geodesic metric space. A geodesic triangle ∆(x, y, z) with x, y, z ∈ X is the union [x, y] ∪ [x, z]∪[y, z] of three geodesic segments connecting these vertices. Let mx be the point of the geodesic segment [y, z] located at distance αy := (xz)y = (d(y, x) + d(y, z)− d(x, z))/2 from y. Then mx is located at distance αz := (yx)z = (d(z, y) + d(z, x) − d(y, x))/2 from z because αy + αz = d(y, z). Analogously, define the points my ∈ [x, z] and mz ∈ [x, y] both located at distance αx := (yz)x = (d(x, y) + d(x, z) − d(y, z))/2 from x; see Fig. 1 for an illustration. There exists a unique isometry ϕ which maps ∆(x, y, z) to a tripod T (x, y, z) consisting of three solid segments [x, m], [y, m], and [z, m] of lengths αx, αy, and αz, respectively. This isometry maps the vertices x, y, z of ∆(x, y, z) to the respective leaves of T (x, y, z) and the points 4 mx, my, and mz to the center m of this tripod. Any other point of T (x, y, z) is the image of exactly two points of ∆(x, y, z). A geodesic triangle ∆(x, y, z) is called δ-thin if for all points u, v ∈ ∆(x, y, z), ϕ(u) = ϕ(v) implies d(u, v) ≤ δ. A graph G = (V, E) whose all geodesic triangles ∆(u, v, w), u, v, w ∈ V , are δ-thin is called a graph with δ-thin triangles, and δ is called the thinness parameter of G. y ≤ δ mz mx ≤ δ ≤ δ my ϕ y m x z x z Fig. 1. A geodesic triangle ∆(x, y, z), the points mx, my, mz, and the tripod Υ (x, y, z) The following result shows that hyperbolicity of a geodesic space or a graph is equivalent to having thin geodesic triangles. Proposition 1 ([14,28,59,60]). Geodesic triangles of geodesic δ-hyperbolic spaces or graphs are 4δ-thin. Conversely, geodesic spaces or graphs with δ-thin triangles are δ-hyperbolic. In what follows, we will need few more notions and notations. Let G = (V, E) be a graph. By [x, y] we denote a shortest path connecting vertices x and y in G; we call [x, y] a geodesic between x and y. A ball B(s, r) of G centered at vertex s ∈ V and with radius r is the set of all vertices with distance no more than r from s (i.e., B(s, r) := {v ∈ V : dG(v, s) ≤ r}). The kth-power of a graph G = (V, E) is the graph Gk = (V, E′) such that xy ∈ E′ if and only if 0 < dG(x, y) ≤ k. Denote by F (x) := {y ∈ V : dG(x, y) = eccG(x)} the set of all vertices of G that are most distant from x. Vertices x and y of G are called mutually distant if x ∈ F (y) and y ∈ F (x), i.e., eccG(x) = eccG(y) = dG(x, y). 3 Fast approximation of eccentricities In this section, we give linear and almost linear time algorithms for sharp estimation of the diameters, the radii, the centers and the eccentricities of all vertices in graphs with δ-thin triangles. Before presenting those algorithms, we establish some conditional lower bounds on complexities of computing the diameters and the radii in those graphs. 3.1 Conditional lower bounds on complexities Recent work has revealed convincing evidence that solving the diameter problem in subquadratic time might not be possible, even in very special classes of graphs. Roditty and Vassilevska W. [83] showed that an algorithm that can distinguish between diameter 2 and 3 in a sparse graph in subquadratic time refutes the following widely believed conjecture. The Orthogonal Vectors Conjecture: There is no ǫ > 0 such that for all c ≥ 1, there is an algorithm that given two lists of n binary vectors A, B ⊆ {0, 1}d where d = c log n can determine if there is an orthogonal pair a ∈ A, b ∈ B, in O(n2−e) time. Williams [95] showed that the Orthogonal Vectors (OV) Conjecture is implied by the well-known Strong Exponential Time Hypothesis (SETH) of Impagliazzo, Paturi, and Zane [64,63]. Nowadays many papers base the hardness of problems on SETH and the OV conjecture (see, e.g., [8,21,91] and papers cited therein). Since all geodesic triangles of a graph constructed in the reduction in [83] are 2-thin, we can rephrase the result from [83] as follows. 5 Statement 1 If for some ǫ > 0, there is an algorithm that can determine if a given graph with 2-thin triangles, n vertices and m = O(n) edges has diameter 2 or 3 in O(n2−ǫ) time, then the Orthogonal Vector Conjecture is false. To prove a similar lower bound result for the radius problem, recently Abboud et al. [8] suggested to use the following natural and plausible variant of the OV conjecture. The Hitting Set Conjecture: There is no ǫ > 0 such that for all c ≥ 1, there is an algorithm that given two lists A, B of n subsets of a universe U of size c log n, can decide in O(n2−e) time if there is a set in the first list that intersects every set in the second list, i.e. a hitting set. Abboud et al. [8] showed that an algorithm that can distinguish between radius 2 and 3 in a sparse graph in subquadratic time refutes the Hitting Set Conjecture. Since all geodesic triangles of a graph constructed in the reduction in [8] are 2-thin, rephrasing that result from [8], we have. Statement 2 If for some ǫ > 0, there is an algorithm that can determine if a given graph with 2-thin triangles, n vertices, and m = O(n) edges has radius 2 or 3 in O(n2−ǫ) time, then the Hitting Set Conjecture is false. 3.2 Fast additive approximations In this subsection, we show that in a graph G with δ-thin triangles the eccentricities of all vertices can be computed in total linear time with an additive error depending on δ. We establish that the eccentricity of a vertex is determined (up-to a small error) by how far the vertex is from the center C(G) of G. Finally, we show how to construct a spanning tree T of G in which the eccentricity of any vertex is its eccentricity in G up to an additive error depending only on δ. For these purposes, we revisit and extend several results from our previous paper [35] concerning the linear time approximation of diameter, radius, and centers of δ-hyperbolic graphs. For these particular cases, we provide simplified proofs, leading to better additive errors due to the use of thinness of triangles instead of the four point condition and to the computation in O(δE) time of a pair of mutually distant vertices. Define the eccentricity layers of a graph G as follows: for k = 0, . . . , diam(G) − rad(G) set Ck(G) := {v ∈ V : eccG(v) = rad(G) + k}. With this notation, the center of a graph is C(G) = C0(G). In what follows, it will be convenient to define also the eccentricity of the middle point m of any edge xy of G; set eccG(m) = min{eccG(x), eccG(y)} + 1/2. We start with a proposition showing that, in a graph G with δ-thin triangles, a middle vertex of any geodesic between two mutually distant vertices has the eccentricity close to rad(G) and is not too far from the center C(G) of G. Proposition 2. Let G be a graph with δ-thin triangles, u, v be a pair of mutually distant vertices of G. (a) If c∗ is the middle point of any (u, v)-geodesic, then eccG(c∗) ≤ dG(u,v) (b) If c is a middle vertex of any (u, v)-geodesic, then eccG(c) ≤ ⌈ dG(u,v) (c) dG(u, v) ≥ 2rad(G) − 2δ − 1. In particular, diam(G) ≥ 2rad(G) − 2δ − 1. (d) If c is a middle vertex of any (u, v)-geodesic and x ∈ Ck(G), then k − δ ≤ dG(x, c) ≤ k + 2δ + 1. In 2 + δ ≤ rad(G) + δ. ⌉ + δ ≤ rad(G) + δ. 2 particular, C(G) ⊆ B(c, 2δ + 1). Proof. Let x be an arbitrary vertex of G and ∆(u, v, x) := [u, v] ∪ [v, x] ∪ [x, u] be a geodesic triangle, where [v, x], [x, u] are arbitrary geodesics connecting x with v and u. Let mx be a point on [u, v] which is at distance (xu)v = 1 2 (d(x, u)+d(v, u)−d(x, v)) from u. Since u and v are mutually distant, we can assume, without loss of generality, that c∗ is located on [u, v] between v and mx, i.e., d(v, c∗) ≤ d(v, mx) = (xu)v, and hence (xv)u ≤ (xu)v. Since dG(v, x) ≤ dG(v, u), we also get (uv)x ≤ (xv)u. 2 (d(x, v)+d(v, u)−d(x, u)) from v and hence at distance (xv)u = 1 6 (a) By the triangle inequality and since dG(u, v) ≤ diam(G) ≤ 2rad(G), we get dG(x, c∗) ≤ e(uv)x + δ + dG(u, c∗) − (xv)u ≤ dG(u, c∗) + δ = 2 + δ ≤ rad(G) + δ. dG(u, v) (b) Since c∗ = c when dG(u, v) is even and dG(c∗, c) = 1 eccG(c) ≤ eccG(c∗) + 1 is odd. We know that the middle point c∗ sees all vertices of G within distance at most dG(u,v) both ends of the edge of (u, v)-geodesic, containing the point c∗ in the middle, have eccentricities at most 2 when dG(u, v) is odd, we have 2 . Additionally to the proof of (a), one needs only to consider the case when dG(u, v) 2 + δ. Hence, dG(u, v) 2 + 1 2 + δ = ⌈ dG(u, v) 2 ⌉ + δ ≤ ⌈ 2rad(G) − 1 2 ⌉ + δ = rad(G) + δ. (c) Since a middle vertex c of any (u, v)-geodesic sees all vertices of G within distance at most ⌈ dG(u,v) 2 ⌉ + δ, if dG(u, v) ≤ 2rad(G) − 2δ − 2, then eccG(c) ≤ ⌈ dG(u, v) 2 ⌉ + δ ≤ ⌈ 2rad(G) − 2δ − 2 2 ⌉ + δ < rad(G), which is impossible. (d) In the proof of (a), instead of an arbitrary vertex x, consider any vertex x from Ck(G). By the triangle inequality and since dG(u, v) ≥ 2rad(G) − 2δ − 1 and both dG(u, x), dG(x, v) are at most rad(G) + k, we get dG(x, c∗) ≤ (uv)x + δ + (xu)v − dG(v, c∗) = dG(v, x) − dG(v, c∗) + δ ≤ rad(G) + k − 2 + δ ≤ k + 2δ + dG(u, v) 1 2 . Consequently, dG(x, c) ≤ dG(x, c∗) + 1 and eccG(c) ≤ rad(G) + δ, by statement (a), we get 2 ≤ k + 2δ + 1. On the other hand, since eccG(x) ≤ eccG(c) + dG(x, c) dG(x, c) ≥ eccG(x) − eccG(c) = k + rad(G) − eccG(c) ≥ (k + rad(G)) − (rad(G) + δ) = k − δ. ⊓⊔ As an easy consequence of Proposition 2(d), we get that the eccentricity eccG(x) of any vertex x is equal, up to an additive one-sided error of at most 4δ + 2, to dG(x, C(G)) plus rad(G). Corollary 1. For every vertex x of a graph G with δ-thin triangles, dG(x, C(G)) + rad(G) − 4δ − 2 ≤ eccG(x) ≤ dG(x, C(G)) + rad(G). Proof. Consider an arbitrary vertex x in G and assume that eccG(x) = rad(G) + k. Let cx be a vertex from C(G) closest to x. By Proposition 2(d), dG(c, cx) ≤ 2δ+1 and dG(x, c) ≤ k+2δ+1 = eccG(x)−rad(G)+2δ+1. Hence, dG(x, C(G)) = dG(x, cx) ≤ dG(x, c) + dG(c, cx) ≤ dG(x, c) + 2δ + 1 and Combining both inequalities, we get eccG(x) ≥ dG(x, c) + rad(G) − 2δ − 1. eccG(x) ≥ dG(x, C(G)) + rad(G) − 4δ − 2. Note also that, by the triangle inequality, eccG(x) ≤ dG(x, cx) + eccG(cx) = dG(x, C(G)) + rad(G) (that is, the right-hand inequality holds for all graphs). ⊓⊔ 7 It is interesting to note that the equality eccG(x) = dG(x, C(G)) + rad(G) holds for every vertex of a graph G if and only if the eccentricity function eccG(·) on G is unimodal (that is, every local minimum is a global minimum)[48]. A slightly weaker condition holds for all chordal graphs [51]: for every vertex x of a chordal graph G, eccG(x) ≥ dG(x, C(G)) + rad(G) − 1. Proposition 3. Let G be a graph with δ-thin triangles and u, v be a pair of vertices of G such that v ∈ F (u). (a) If w is a vertex of a (u, v)-geodesic at distance rad(G) from v, then eccG(w) ≤ rad(G) + δ. (b) For every pair of vertices x, y ∈ V , max{dG(v, x), dG(v, y)} ≥ dG(x, y) − 2δ. (c) eccG(v) ≥ diam(G) − 2δ ≥ 2rad(G) − 4δ − 1. (d) If t ∈ F (v), c is a vertex of a (v, t)-geodesic at distance ⌈ dG(v,t) ⌉ from t and x ∈ Ck(G), then eccG(c) ≤ rad(G) + 3δ and k − 3δ ≤ dG(x, c) ≤ k + 3δ + 1. In particular, C(G) ⊆ B(c, 3δ + 1). 2 Proof. (a) Let x be a vertex of G with dG(w, x) = eccG(w). Let ∆(u, v, x) := [u, v] ∪ [v, x] ∪ [x, u] be a geodesic triangle, where [v, x], [x, u] are arbitrary geodesics connecting x with v and u. Let mx be a point on [u, v] which is at distance (xu)v = 1 2 (d(x, v) + d(v, u) − d(x, u)) from v and hence at distance (xv)u = 1 2 (d(x, u) + d(v, u) − d(x, v)) from u. We distinguish between two cases: w is between u and mx or w is between v and mx in [u, v]. In the first case, by the triangle inequality and dG(u, x) ≤ dG(u, v) (and hence, (ux)v ≥ (uv)x), we get dG(w, x) ≤ rad(G) − (ux)v + δ + (uv)x ≤ rad(G) + δ. In the second case, by the triangle inequality and since dG(v, x) ≤ diam(G) ≤ 2rad(G), we get dG(w, x) ≤ (ux)v − rad(G) + δ + (uv)x ≤ dG(x, v) − rad(G) + δ ≤ 2rad(G) − rad(G) + δ = rad(G) + δ. (b) Consider an arbitrary (u, v)-geodesic [u, v]. Let ∆(u, v, x) := [u, v]∪[v, x]∪[x, u] be a geodesic triangle, where [v, x], [x, u] are arbitrary geodesics connecting x with v and u. Let ∆(u, v, y) := [u, v] ∪ [v, y] ∪ [y, u] be a geodesic triangle, where [v, y], [y, u] are arbitrary geodesics connecting y with v and u. 2 (d(x, v) + d(v, u) − d(x, u)) from v and hence 2 (d(x, u) + d(v, u) − d(x, v)) from u. Let my be a point on [u, v] which is at distance 2 (d(y, u) + d(v, u) − d(y, v)) at distance (xv)u = 1 2 (d(y, v) + d(v, u) − d(y, u)) from v and hence at distance (yv)u = 1 (yu)v = 1 from u. Without loss of generality, assume that mx is on [u, v] between v and my. Let mx be a point on [u, v] which is at distance (xu)v = 1 Since dG(u, v) ≥ dG(u, x) (as v ∈ F (u)), we have (uv)x ≤ (ux)v. By the triangle inequality, we get dG(x, y) ≤ (uv)x + δ + ((yu)v − (ux)v) + δ + (uv)y ≤ (ux)v − (ux)v + 2δ + (yu)v + (uv)y = dG(v, y) + 2δ. Consequently, max{dG(v, x), dG(v, y)} ≥ dG(v, y) ≥ dG(x, y) − 2δ. (c) Now, if x, y is a diametral pair, i.e., dG(x, y) = diam(G), then, by (b) and Proposition 2(c), eccG(v) ≥ max{dG(v, x), dG(v, y)} ≥ dG(x, y) − 2δ = diam(G) − 2δ ≥ 2rad(G) − 4δ − 1. (d) Consider any (v, t)-geodesic [v, t] and let c∗ be the middle point of it, w be a vertex of [v, t] at distance rad(G) from t, and c be a vertex of [v, t] at distance ⌈ dG(v,t) ⌉ from t. We know by (a) that eccG(w) ≤ rad(G) + δ. Furthermore, since 2rad(G) ≥ dG(v, t) ≥ 2rad(G) − 4δ − 1 (by (c)), rad(G) ≥ dG(t, c) = ⌈ dG(v,t) ⌉ ≥ rad(G) − 2δ. Hence, 2 2 dG(w, c) = dG(w, t) − dG(c, t) ≤ rad(G) − rad(G) + 2δ = 2δ, 8 implying eccG(c) ≤ dG(w, c) + eccG(w) ≤ rad(G) + 3δ. Let now x be an arbitrary vertex from Ck(G), i.e., eccG(x) ≤ rad(G)+k, for some integer k ≥ 0. Consider a geodesic triangle ∆(t, v, x) := [t, v] ∪ [v, x] ∪ [x, t], where [v, x], [x, t] are arbitrary geodesics connecting x with v and t. Let mx be a point on [t, v] which is at distance (xt)v = 1 2 (d(x, v) + d(v, t) − d(x, t)) from v and hence at distance (xv)t = 1 2 (d(x, t) + d(v, t) − d(x, v)) from t. Since, in what follows, we will use only the fact that dG(v, t) ≥ 2rad(G) − 4δ − 1, we can assume, without loss of generality, that c∗ is located on [t, v] between v and mx, i.e., d(v, c∗) ≤ d(v, mx) = (xt)v. By the triangle inequality and since dG(v, t) ≥ 2rad(G) − 4δ − 1 and both dG(t, x) and dG(x, v) are at most rad(G) + k, we get dG(x, c∗) ≤ (tv)x + δ + (xt)v − dG(v, c∗) = dG(v, x) − dG(v, c∗) + δ ≤ rad(G) + k − 2 + δ ≤ k + 3δ + dG(v, t) 1 2 . Hence, dG(x, c) ≤ dG(x, c∗) + 1 eccG(c) ≤ rad(G) + 3δ, we get 2 ≤ k + 3δ + 1. On the other hand, since eccG(x) ≤ eccG(c) + dG(x, c) and dG(x, c) ≥ eccG(x) − eccG(c) = k + rad(G) − eccG(c) ≥ (k + rad(G)) − (rad(G) + 3δ) = k − 3δ. ⊓⊔ Proposition 4. For every graph G with δ-thin triangles, diam(Ck(G)) ≤ 2k + 2δ + 1. In particular, diam(C(G)) ≤ 2δ + 1. Proof. Let x, y be two vertices of Ck(G) such that dG(x, y) = diam(Ck(G)). Pick any (x, y)-geodesic and consider the middle point m of it. Let z be a vertex of G such that dG(m, z) = eccG(m). Consider a geodesic triangle ∆(x, y, z) := [x, y] ∪ [y, z] ∪ [z, x], where [z, x], [y, z] are arbitrary geodesics connecting z with x and y. Let mz be a point on [x, y] which is at distance (xz)y = 1 2 (d(x, y) + d(z, y) − d(x, z)) from y and hence at distance (yz)x = 1 2 (d(x, y) + d(z, x) − d(y, z)) from x. Without loss of generality, we can assume that m is located on [x, y] between y and mz. Since eccG(y) ≤ rad(G) + k, we have dG(m, z) = eccG(m) ≥ rad(G) − 1 2 ≥ eccG(y) − k − 1 2 ≥ dG(y, z) − k − 1 2 . On the other hand, by the triangle inequality, we get dG(m, z) ≤ (xz)y − dG(y, m) + δ + (xy)z = dG(y, z) − dG(y, m) + δ ≤ dG(y, z) − Hence, dG(x, y) ≤ 2k + 2δ + 1. + δ. ⊓⊔ dG(x, y) 2 Diameter and radius. For an arbitrary connected graph G = (V, E) and a given vertex u ∈ V , a most distant from u vertex v ∈ F (u) can be found in linear (O(E)) time by a breadth-first-search BF S(u) started at u. A pair of mutually distant vertices of a connected graph G = (V, E) with δ-thin triangles can be computed in O(δE) total time as follows. By Proposition 3(c), if v is a most distant vertex from an arbitrary vertex u and t is a most distant vertex from v, then d(v, t) ≥ diam(G) − 2δ. Hence, using at most O(δ) breadth-first-searches, one can generate a sequence of vertices v := v1, t := v2, v3, . . . vk with k ≤ 2δ + 2 such that each vi is most distant from vi−1 (with, v0 = u) and vk, vk−1 are mutually distant vertices (the initial value d(v, t) ≥ diam(G) − 2δ can be improved at most 2δ times). and the diameter of a graph with δ-thin triangles. Thus, by Proposition 2 and Proposition 3, we get the following additive approximations for the radius 9 Corollary 2. Let G = (V, E) be a graph with δ-thin triangles. 1. There is a linear (O(E)) time algorithm which finds in G a vertex c with eccentricity at most rad(G)+3δ 2. There is an almost linear (O(δE)) time algorithm which finds in G a vertex c with eccentricity at most and a vertex v with eccentricity at least diam(G) − 2δ. Furthermore, C(G) ⊆ B(c, 3δ + 1) holds. rad(G) + δ. Furthermore, C(G) ⊆ B(c, 2δ + 1) holds. All eccentricities. In what follows, we will show that all vertex eccentricities of a graph with δ-thin triangles can be also additively approximated in (almost) linear time. Proposition 5. Let G be a graph with δ-thin triangles. (a) If c is a middle vertex of any (u, v)-geodesic between a pair u, v of mutually distant vertices of G and T is a BF S(c)-tree of G, then, for every vertex x of G, eccG(x) ≤ eccT (x) ≤ eccG(x) + 3δ + 1. of a (v, t)-geodesic at distance ⌈ dG(v,t) eccG(x) + 6δ + 1. (b) If v is a most distant vertex from an arbitrary vertex u, t is a most distant vertex from v, c is a vertex ⌉ from t and T is a BF S(c)-tree of G, then eccG(x) ≤ eccT (x) ≤ 2 Proof. (a) Let x be an arbitrary vertex of G and assume that eccG(x) = rad(G) + k for some integer k ≥ 0. We know from Proposition 2(b) that eccG(c) ≤ rad(G) + δ. Furthermore, by Proposition 2(d), dG(c, x) ≤ k + 2δ + 1. Since T is a BF S(c)-tree, dG(x, c) = dT (x, c) and eccG(c) = eccT (c). Consider a vertex y in G such that dT (x, y) = eccT (x). We have eccT (x) = dT (x, y) ≤ dT (x, c) + dT (c, y) ≤ dG(x, c) + eccT (c) = dG(x, c) + eccG(c) ≤ k + 2δ + 1 + rad(G) + δ = rad(G) + k + 3δ + 1 = eccG(x) + 3δ + 1. As T is a spanning tree of G, evidently, also eccG(x) ≤ eccT (x) holds. holds for every x ∈ Ck(G) (by Proposition 3(d)). (b) The proof is similar to the proof of (a); only, in this case, eccG(c) ≤ rad(G)+3δ and dG(c, x) ≤ k+3δ+1 ⊓⊔ A spanning tree T of a graph G is called an eccentricity k-approximating spanning tree if for every vertex v of G eccT (v) ≤ eccG(v) + k holds [51,81]. Thus, by Proposition 5, we get. Theorem 1. Every graph G = (V, E) with δ-thin triangles admits an eccentricity (3δ + 1)-approximating spanning tree constructible in O(δE) time and an eccentricity (6δ + 1)-approximating spanning tree con- structible in O(E) time. Theorem 1 generalizes recent results from [51,81] that chordal graphs and some of their generalizations admit eccentricity 2-approximating spanning trees. Note that the eccentricities of all vertices in any tree T = (V, U ) can be computed in O(V ) total time. As we noticed already, it is a folklore by now that for trees the following facts are true: (1) The center C(T ) of any tree T consists of one vertex or two adjacent vertices. (2) The center C(T ) and the radius rad(T ) of any tree T can be found in linear time. (3) For every vertex v ∈ V , eccT (v) = dT (v, C(T )) + rad(T ). Hence, using BF S(C(T )) on T one can compute dT (v, C(T )) for all v ∈ V in total O(V ) time. Adding now rad(T ) to dT (v, C(T )), one gets eccT (v) for all v ∈ V . Consequently, by Theorem 1, we get the following additive approximations for the vertex eccentricities in graphs with δ-thin triangles. Theorem 2. Let G = (V, E) be a graph with δ-thin triangles. (1) There is an algorithm which in total linear (O(E)) time outputs for every vertex v ∈ V an estimate (2) There is an algorithm which in total almost linear (O(δE)) time outputs for every vertex v ∈ V an e(v) of its eccentricity eccG(v) such that eccG(v) ≤ e(v) ≤ eccG(v) + 6δ + 1. estimate e(v) of its eccentricity eccG(v) such that eccG(v) ≤ e(v) ≤ eccG(v) + 3δ + 1. 10 4 Fast Additive Approximation of All Distances Here, we will show that if the δth power Gδ of a graph G with δ-thin triangles is known in advance, then the distances in G can be additively approximated (with an additive one-sided error of at most δ + 1) in O(V 2) time. If Gδ is not known, then the distances can be additively approximated (with an additive one-sided error of at most 2δ + 2) in almost quadratic time. Our method is a generalization of an unified approach used in [49] to estimate (or compute exactly) all pairs shortest paths in such special graph families as k-chordal graphs, chordal graphs, AT-free graphs and many others. For example: all distances in k-chordal graphs with an additive one-sided error of at most k− 1 can be found in O(V 2) time; all distances in chordal graphs with an additive one-sided error of at most 1 can be found in O(V 2) time and the all pairs shortest path problem on a chordal graph G can be solved in O(V 2) time if G2 is known. Note that in chordal graph all geodesic triangles are 2-thin. Let G = (V, E) be a graph with δ-thin triangles. Pick an arbitrary start vertex s ∈ V and construct a BF S(s)-tree T of G rooted at s. Denote by pT (x) the parent and by hT (x) = dT (x, s) = dG(x, s) the height of a vertex x in T . Since we will deal only with one tree T , we will often omit the subscript T . Let PT (x, s) := (xq, xq−1, . . . , x1, s) and PT (y, s) := (yp, yp−1, . . . , y1, s) be the paths of T connecting vertices x and y with the root s. By slT (x, y; λ) we denote the largest index k such that dG(xk, yk) ≤ λ (the λ separation level). Our method is based on the following simple fact. Proposition 6. For every vertices x and y of a graph G with δ-thin triangles and any BF S-tree T of G, hT (x) + hT (y) − 2k − 1 ≤ dG(x, y) ≤ hT (x) + hT (y) − 2k + dG(xk, yk), where k = slT (x, y; δ). 1 Proof. By the triangle inequality, dG(x, y) ≤ dG(x, xk) + dG(xk, yk) + dG(yk, y) = hT (x) + hT (y) − 2k + dG(xk, yk). Consider now an arbitrary (x, y)-geodesic [x, y] in G. Let ∆(x, y, s) := [x, y] ∪ [x, s] ∪ [y, s] be a geodesic triangle, where [x, s] = PT (x, s) and [y, s] = PT (y, s). Since ∆(x, y, s) is δ-thin, slT (x, y; δ) ≥ (xy)s− 2 . Hence, hT (x)− slT (x, y; δ) ≤ (sy)x + 1 2 . As dG(x, y) = (sy)x + (sx)y, we get dG(x, y) ≥ hT (x) − slT (x, y; δ) + hT (y) − slT (x, y; δ) − 1. ⊓⊔ Note that we may regard BF S(s) as having produced a numbering from n to 1 in decreasing order of the vertices in V where vertex s is numbered n. As a vertex is placed in the queue by BF S(s), it is given the next available number. The last vertex visited is given the number 1. Let σ := [v1, v2, . . . , vn = s] be a BF S(s)-ordering of the vertices of G and T be a BF S(s)-tree of G produced by a BF S(s). Let σ(x) be the number assigned to a vertex x in this BF S(s)-ordering. For two vertices x and y, we write x < y whenever σ(x) < σ(y). 2 and hT (y)− slT (x, y; δ) ≤ (sx)y + 1 First, we will show that if Gδ is known in advance (i.e., its adjacency matrix is given) for a graph G with δ-thin triangles, then the distances in G can be additively approximated (with an additive one-sided error of at most δ + 1) in O(V 2) time. We consider the vertices of G in the order σ from 1 to n. For each current vertex x we show that the values bd(x, y) := hT (x) + hT (y) − 2slT (x, y; δ) + δ for all vertices y with y > x can be computed in O(V ) total time. By Proposition 6, dG(x, y) ≤ bd(x, y) ≤ dG(x, y) + δ + 1. The values bd(x, y) for all y with y > x can be computed using the following simple procedure. We will omit the subscripts G and T if no ambiguities arise. Let also Li = {v ∈ V : d(v, s) = i}. In the procedure, Su represents vertices of a subtree of T rooted at u. (01) (02) (03) (04) (05) (06) set q := h(x) define a set Su := {u} for each vertex u ∈ Lq, u > x, and denote this family of sets by F for k = q downto 0 let xk be the vertex from Lk ∩ PT (x, s) for each vertex u ∈ Lk with u > x if dG(u, xk) ≤ δ (i.e., u = xk or u is adjacent to xk in Gδ) then 11 (07) (08) (09) (10) (11) (12) (13) (14) (15) (16) (17) (18) for every v ∈ Su endfor set bd(x, v) := h(x) + h(v) − 2k + δ and remove Su from F endfor /* update F for the next iteration */ if k > 0 then for each vertex u ∈ Lk−1 combine all sets Su1, . . . , Suℓ from F (ℓ ≥ 0), such that pT (u1) = . . . = pT (uℓ) = u, into one new set Su := {u} ∪ Su1 ∪ . . . ∪ Suℓ /* when ℓ = 0, Su := {u} */ endfor endfor set also bd(x, s) := h(x). Thus, we have the following result. Theorem 3. Let G = (V, E) be a graph with δ-thin triangles. Given Gδ, all distances in G with an additive one-sided error of at most δ + 1 can be found in O(V 2) time. To avoid the requirement that Gδ is given in advance, we can use any known fast constant-factor approx- imation algorithm that in total T (V )-time computes for every pair of vertices x, y of G a value ed(x, y) such that dG(x, y) ≤ ed(x, y) ≤ αdG(x, y) + β. We can show that, using such an algorithm as a preprocessing step, the distances in a graph G with δ-thin triangles can be additively approximated with an additive one-sided error of at most αδ + β + 1 in O(T (V ) + V 2) time. Although one can use any known fast constant-factor approximation algorithm in the preprocessing step, in what follows, we will demonstrate our idea using a fast approximation algorithm from [19]. It computes in O(V 2 log2 V ) total time for every pair x, y a value ed(x, y) such that dG(x, y) ≤ ed(x, y) ≤ 2dG(x, y) + 1. Assume that the values ed(x, y), x, y ∈ V , are precomputed. By eslT (x, y; λ) we denote now the largest index k such that edG(xk, yk) ≤ λ. We have Proposition 7. For every vertices x and y of a graph G with δ-thin triangles, any integer ρ ≥ δ, and any BF S-tree T of G, hT (x) + hT (y) − 2k − 1 ≤ dG(x, y) ≤ hT (x) + hT (y) − 2k + dG(xk, yk), where k = eslT (x, y; 2ρ + 1). Proof. The proof is identical to the proof of Proposition 7. One needs only to notice the following. In a geodesic triangle ∆(x, y, s) := [x, y] ∪ [x, s] ∪ [y, s] with [x, s] = PT (x, s) = (xq, xq−1, . . . , x1, s) and [y, s] = PT (y, s) = (yp, yp−1, . . . , y1, s), for each i ≤ (xy)s, dG(xi, yi) ≤ δ ≤ ρ and, hence, ed(xi, yi) ≤ 2ρ + 1 holds. Therefore, eslT (x, y; 2ρ + 1) ≥ (xy)s − 1 2 . ⊓⊔ Let ρ be any integer greater than or equal to δ. By replacing in our earlier procedure lines (06) and (08) with (06)′ (08)′ if ed(u, xk) ≤ 2ρ + 1 then set bd(x, v) := h(x) + h(v) − 2k + 2ρ + 1 and remove Su from F we will compute for each current vertex x all values bd(x, y) := hT (x) + hT (y) − 2eslT (x, y; 2ρ + 1) + 2ρ + 1, y > x, in O(V ) total time. By Proposition 7, dG(x, y) ≤ hT (x) + hT (y) − 2eslT (x, y; 2ρ + 1) + dG(xk, yk) ≤ hT (x) + hT (y) − 2eslT (x, y; 2ρ + 1) + ed(xk, yk) ≤ hT (x) + hT (y) − 2eslT (x, y; 2ρ + 1) + 2ρ + 1 = bd(x, y) 12 and bd(x, y) = hT (x) + hT (y) − 2eslT (x, y; 2ρ + 1) + 2ρ + 1 ≤ dG(x, y) + 2ρ + 2. Thus, we have the following result: Theorem 4. Let G = (V, E) be a graph with δ-thin triangles. (a) If the value of δ is known, then all distances in G with an additive one-sided error of at most 2δ + 2 can be found in O(V 2 log2 V ) time. (b) If an approximation ρ of δ such that δ ≤ ρ ≤ aδ + b is known (where a and b are constants), then all distances in G with an additive one-sided error of at most 2(aδ + b + 1) can be found in O(V 2 log2 V ) time. The second part of Theorem 4 says that if an approximation of the thinness parameter of a graph G is given then all distances in G can be additively approximated in O(V 2 log2 V ) time. Recently, it was shown in [32] that the following converse is true. From an estimate of all distances in G with an additive one-sided error of at most k, it is possible to compute in O(V 2) time an estimation ρ∗ of the thinness of G such that δ ≤ ρ∗ ≤ 8δ + 12k + 4, proving a O(V 2)-equivalence between approximating the thinness and approximating the distances in graphs. 5 Experimentation on Some Real-World Networks In this section, we analyze the performance of our algorithms for approximating eccentricities and distances on a number of real-world networks. Our experimental results show that the estimates on eccentricities and distances obtained are even better than the theoretical bounds described in Corollary 2 and Theorems 2,4. We apply our algorithms to six social networks, four email communication networks, four biological networks, six internet graphs, four peer-to-peer networks, three web networks, two product-co-purchasing networks, and four infrastructure networks. Most of the networks listed are part of the Stanford Large Network Dataset Collection (snap) and the Koblenz Network Collection (konect), and are available at [1] and [2]. Characteristics of these networks, such as the number of vertices and edges, the average degree, the radius and the diameter, are given in Table 1. The numbers listed in Table 1 are based on the largest connected component of each network, when the entire network is disconnected. We ignore the directions of the edges and remove all self-loops from each network. Additionally, in Table 1, for each network we report the size (as the number of vertices) of its center C(G). We also analyze the diameter and the connectivity of the center of each network. The diameter of the center diamG(C(G)) is defined as the maximum distance between any two central vertices in the graph. In the last column of Table 1, we report the Gromov hyperbolicity δ of majority of networks2. Computing the hyperbolicity of a graph is computationally expensive; therefore, we provide the exact δ values for the smaller networks (those with V ≤ 30K) in our dataset (in some cases, the algorithm proposed in [41] was used). For some larger networks, the approximated δ-hyperbolicity values listed in Table 1 are as reported in [67]3. Most networks that we included in our dataset are hyperbolic. However, for comparison reasons, we included also a few infrastructure networks that are known to lack the hyperbolicity property. 5.1 Estimation of Eccentricities Following Proposition 2, for each graph in our dataset, we found a pair u, v of mutually distant vertices. In column two of Table 2, we report on how many BF S sweeps of a graph were needed to locate u and v. Interestingly, for almost all graphs (28 out 33) only two sweeps were sufficient. For four other graphs (including road-pa network whose hyperbolicity is large) three sweeps were needed, and only for one graph (power-grid network) we needed four sweeps. 2 All δ-hyperbolicity values listed in Table 1 were computed using Gromov's four-point condition definition. As mentioned in [59,60], geodesic triangles of geodesic δ-hyperbolic spaces are 4δ-thin. 3 For web-stanford and web-berkstan, [67] gives 1.5 and 2, respectively, as estimates on the hyperbolicities. However, the sampling method they used seems to be not very accurate. According to [76], the hyperbolicities are at least 7 for both graphs. 13 Network Type Ref. V E C(G) deg rad(G) diam(G) diamG(C(G)) connected? δ(G) dutch-elite facebook eva slashdot loans twitter email-virgili email-enron email-eu wikitalk-china cs-metabolic sc-ppi yeast-ppi homo-pi as-graph-1 as-graph-2 as-graph-3 routeview as-caida itdk gnutella-06 gnutella-24 gnutella-30 gnutella-31 web-stanford web-notredam web-berkstan amazon-1 amazon-2 road-euro openflight power-grid road-pa social communi- cation biological internet peer-to-peer web product co-purchasing infrastructure 3621 4039 4475 1133 15 453 1458 2224 [17] [74] [17] [73] [71] [45] 465017 834797 [61] 5451 33696 180811 [73,68] [72] 224832 680720 [87] 1217365 3391055 [55] 4596 1948 [65] [29] 6609 16635 115364 [86] 5156 [3] 9276 [3] [3] 10328 21455 [7] [5] 53381 [4] 190914 607610 31525 8717 65359 26498 36646 88303 62561 295756 [73] 255265 2234572 [13] 325729 1497134 [73] 654782 7600595 [96] 334863 925872 [96] 400727 3200440 1305 [88] 19231 [6] [93] 6594 [73] 1087562 3083028 3 2.4 4310 1 43.7 88234 2.1 4664 77360 905468 1 13.1 89171 3394979 29350 74.69 755 3.59 215 9.6 248 10.7 1 ≈ 3 2.9 17 8.9 17 48 2.7 57 ≈ 6 135 13.87 3.4 32 3.8 531 3.9 10 2 4.1 2 4.03 6.4 7.2 4.9 4.8 4.7 1 15.2 6.8 1 20.1 5.5 194 11.7 2.5 21 11.3 1 2.7 2 2.83 3015 4885 5357 10515 26475 [82,72] [82,72] [82,72] [82,72] 155 338 1 602 55 1039 3397 4941 12 21 1 12 4 10 6 5 5 5 7 7 4 4 11 6 5 5 6 5 5 9 14 6 6 7 7 82 23 104 24 11 31 7 23 402 22 8 18 12 8 8 8 13 14 8 7 19 11 10 9 11 9 10 17 26 10 11 11 11 164 46 208 47 20 62 13 46 794 4 0 3 0 4 4 4 2 0 2 2 6 4 2 2 4 2 2 1 4 5 0 6 5 0 2 0 3 5 0 2 0 1 2 5 1.5 3.5 *1.5 1.5 3.5 2.5 2 2 3 2 2.5 2.5 no yes yes yes yes yes yes yes yes yes yes no no no yes no yes no yes yes no yes no no yes no yes no no 7.5 yes 2 yes yes 10 yes *195.5 3 3 *2.5 *2.5 *7 *2 *7 Table 1. Statistics of the analyzed networks: V is the number of vertices, E is the number of edges; C(G) is the number of central vertices; deg is the average degree; rad(G) is the graph's radius; diam(G) is the graph's diameter; diamG(C(G)) is the diameter of the graph's center; "connected?" indicates whether or not the center of the graph is connected; δ(G) is the graph's hyperbolicity. Hyperbolicity values marked with asterisks are approximate. In column four of Table 2, we report for each graph G the difference between 2rad(G) and dG(u, v). Proposition 2(c) says that the difference must be at most 2δ + 1, where δ is the thinness of geodesic triangles in G. Actually, for large number (27 out of 33) of graphs in our dataset, the difference is at most two. Five other graphs have the difference equal to 3, and only road-pa network has the difference equal to 10. We have dG(u, v) = diam(G) for 27 graphs in our dataset, including road-pa network whose geodesic triangles thinness is at least 196. For remaining six graphs dG(u, v) = diam(G) − 1 holds. We also analyzed the quality of a middle vertex c of a randomly picked shortest path between mutually distant vertices u and v. Proposition 2 states that eccG(c) is close to rad(G) and c is not too far from the graph's center C(G). Table 2 lists the properties of the selected middle vertex c. In almost all graphs, vertex c belongs to the center C(G) or is at distance one or two from C(G). Even in graphs with eccG(c)− rad(G) > 2 (power-grid and road-pa), the value eccG(c) − rad(G) is smaller than what is suggested by Proposition 2(b). It is also clear from Table 2 that c is not too far from any vertex in C(G) (look at the radius i of the ball B(c, i) required to include C(G)). In all graphs, i is much smaller than 2δ + 1 (indicated in Proposition 2(d)). Following Theorem 1, for each graph G = (V, E) in our dataset, we constructed an arbitrary BF S(c)-tree T1 = (V, E′), rooted at vertex c, and analyzed how well T1 preserves or approximates the eccentricities of vertices in G. By Theorem 1, eccG(v) ≤ eccT1 (v) ≤ eccG(v)+3δ+1 holds for every v ∈ V . In our experiments, for each graph G and the constructed for it BF S(c)-tree T1, we computed kmax := maxv∈V {eccT1(v) − n Pv∈V eccT1(v)−eccG(v) (average distortion). For most graphs eccG(v)} (maximum distortion) and kavg := 1 (see Table 2), the value of kmax is small: kmax = 0 for one graph, kmax = 2 for eight graphs, kmax = 3 for nine graphs, kmax = 4 for four graphs, kmax = 5 for two graphs, and kmax > 5 for nine graphs. Also, the average 14 Network No. of BFS iterations dG(u, v) 2rad(G) − dG(u, v) eccG(c) eccG(c) − rad(G) dG(c, C(G)) Prop.2(c) Prop.2(c) Prop.2(b) Prop.2(b) Prop.2(d) min i : B(c, i) ⊇ C(G) kmax kavg dutch-elite facebook eva slashdot loans twitter email-virgili email-enron email-eu wikitalk-china ce-metabolic sc-ppi yeast-ppi homo-pi as-graph-1 as-graph-2 as-graph-3 routeview as-caida itdk gnutella-06 gnutella-24 gnutella-30 gnutella-31 web-stanford web-notredam web-berkstan amazon-1 amazon-2 road-euro openflight power-grid road-pa 2 2 2 2 2 2 2 2 2 2 2 3 3 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 3 22 8 18 11 7 8 7 13 14 7 7 19 11 10 8 11 9 10 17 26 10 10 11 11 164 46 208 47 20 62 13 46 794 2 0 2 1 3 2 3 1 0 1 1 3 1 0 2 1 1 0 1 2 2 2 3 3 0 0 0 1 2 0 1 0 10 13 4 10 7 5 6 6 7 7 5 5 12 6 5 6 6 5 5 9 15 6 7 7 8 82 23 104 24 12 31 8 28 415 1 0 0 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 1 0 1 5 13 1 0 0 2 0 1 1 0 0 1 1 2 0 0 1 0 0 0 0 1 0 1 0 2 0 0 0 0 2 0 1 8 44 3 0 2 2 3 3 3 2 0 2 2 6 3 2 2 3 2 2 1 3 4 1 5 5 0 2 0 2 5 0 2 8 45 6 2 2 3 3 4 4 2 2 3 3 3 3 2 3 3 2 2 0 4 4 5 5 6 28 2 22 6 6 8 3 13 98 2.35 0.686 0.571 1.777 2.06 2.569 2.729 0.906 0.002 2.076 1.982 0.981 1.872 0.747 1.791 1.124 0.828 0.329 0 2.108 2.507 2.697 3.167 4.176 0.006 0.935 0.002 0.991 3.735 0.135 1.879 5.735 23.339 Table 2. Qualities of a pair of mutually distant vertices u and v, of a middle vertex c of a (u, v)-geodesic, and of a BF S(c)-tree T1 rooted at vertex c. "No. of BFS iterations" indicates how many breadth-first- search iterations were needed to obtain a pair of mutually distant vertices u and v. For each vertex x ∈ V , k(x) := eccT1(x) − eccG(x). Also, kmax := maxx∈V k(x) and kavg := 1 distortion kavg is much smaller than kmax for all graphs. In fact, kavg < 3 in all but five graphs (gnutella- 30, gnutella-31, amazon-2, power-grid, and road-pa). In graphs with high kmax, close inspection reveals that only small percent of vertices achieve this maximum. For example, in graph web-stanford, kmax = 28 was only achieved by 17 vertices. The distributions of the values of k(v) := eccT1(v) − eccG(v) of all graphs are listed in Table 6 (see Appendix). n Px∈V k(x). Similar experiments were performed following Proposition 3. For each graph G in our dataset, we picked a random vertex u ∈ V and a random vertex v ∈ F (u). Then, we identified in a randomly picked (u, v)- geodesic a vertex w at distance rad(G) from v. We did not consider a vertex c defined in Proposition 3(d) since, for majority of graphs in our dataset, c will be a middle vertex of a geodesic between two mutually distant vertices, and working with c we will duplicate previous experiments. Recall that for majority of our graphs (as found in our experiments) two BFS sweeps already identify a pair of mutually distant vertices. We know from Proposition 3 that eccG(v) ≥ diam(G) − 2δ ≥ 2rad(G) − 4δ − 1 and eccG(w) ≤ rad(G) + δ. Our experimental results are better than these theoretical bounds. In Table 3, we list eccentricities of v and w for each graph. In almost all graphs, the eccentricity of v is equal to the diameter diam(G). Only four graphs have eccG(v) = diam(G) − 1 and one graph (road-pa) has eccG(v) > diam(G) − 1. Vertex w is central for 21 graphs, has eccentricity equal to rad(G) + 1 for 10 graphs, has eccentricity equal to rad(G) + 2 for one graph, and only for one remaining graph (road-pa network, which has large hyperbolicity) its eccentricity is equal to rad(G) + 15. It turns out also (see columns five and six of Table 2) that vertex w either belongs to the center C(G) or is very close to the center. The only exception is again road-pa network where 2rad(G) − eccG(w) = 32 and d(w, C(G)) = 21. 15 Network eccG(v) 2rad(G) − eccG(v) eccG(w) dG(w, C(G)) min i : B(w, i) ⊇ C(G) kmax kavg Prop.3(c) Prop.3(a) dutch-elite facebook eva slashdot loans twitter email-virgili email-enron email-eu wikitalk-china ce-metabolic sc-ppi yeast-ppi homo-pi as-graph-1 as-graph-2 as-graph-3 routeview as-caida itdk gnutella-06 gnutella-24 gnutella-30 gnutella-31 web-stanford web-notredam web-berkstan amazon-1 amazon-2 road-euro openflight power-grid road-pa 22 8 18 11 7 8 7 13 14 8 7 19 11 9 9 11 9 10 17 26 10 11 11 11 164 46 208 47 20 62 13 46 772 2 0 2 1 3 2 3 1 0 0 1 3 1 1 1 1 1 0 1 2 2 1 3 3 0 0 0 1 2 0 1 0 32 12 5 11 7 5 5 5 7 7 5 4 12 7 5 5 6 5 5 9 15 7 8 8 8 82 23 104 24 11 31 7 23 417 0 3 1 2 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1 1 3 1 1 0 0 0 0 0 0 0 0 21 4 3 3 2 3 3 4 2 0 2 1 6 3 2 2 3 2 2 1 3 5 3 5 5 0 2 0 3 5 0 2 0 22 6 3 2 3 3 3 4 2 2 3 1 7 4 2 2 2 2 2 0 5 5 6 6 6 28 2 22 7 5 8 2 4 80 2.431 0.704 0.572 1.88 2.031 1.821 1.932 0.903 0.002 1.791 0.349 4.196 2.558 0.612 0.887 0.833 0.312 0.329 0 2.702 3.543 4.475 4.034 4.251 0.006 0.935 0.002 0.919 2.03 0.135 0.641 1.409 22.545 Table 3. Qualities of a vertex v most distant from a random vertex u, of a vertex w of a (u, v)-geodesic at distance rad(G) from v, and of a BF S(w)-tree T2 rooted at vertex w. For each vertex x ∈ V , k(x) := eccT2(x) − eccG(x). Also, kmax := maxx∈V k(x) and kavg := 1 n Px∈V k(x). For every graph G = (V, E) in our dataset, we constructed also an arbitrary BF S(w)-tree T2 = (V, E′), rooted at vertex w, and analyzed how well T2 preserves or approximates the eccentricities of vertices in G. The value of kmax is at most five for 23 graphs. The average distortion kavg is much smaller than kmax in all graphs. The distributions of the values of k(x) for all graphs are presented in Table 7 (see Appendix). In Table 4, we compare these two eccentricity approximating spanning trees T1 and T2 with each other and with a third BF S(c∗)-tree T3 which we have constructed starting from a randomly chosen central vertex c∗ ∈ C(G). max, kT2 max and kT3 avg and kT3 For each graph in the dataset, three values of kmax (kT1 avg, kT2 max) and three values of kavg (kT1 avg) are listed. We observe that the smallest kmax (out of three) is achieved by tree T3 in 28 graphs, by tree T2 in 20 graphs and by tree T1 in 20 graphs (in 14 graphs, the smallest kmax is achieved by all three trees). The difference between the largest and the smallest kmax of a graph is at most one for 26 graphs in the dataset. The largest difference is observed for road-pa network: the largest kmax (98) is given by tree T1, the smallest kmax (46) is given by tree T3. Two other graphs have the difference larger than three: for sc-ppi network, the largest kmax (7) is given by tree T2, the smallest kmax (3) is given by tree T1; for power-grid network, the largest kmax (13) is given by tree T1, the smallest kmax (4) is shared by remaining trees T2, T3. Overall, we conclude that kmax values for trees T1 and T2 are comparable and generally can be slightly worse than those for tree T3. Similar observations hold also for the average distortion kavg. Note, however, that for construction of trees T2 and T3 one needs to know rad(G) or a central vertex of G, which are unlikely to be computable in subquadratic time (see Statement 2). 16 Network dutch-elite facebook eva slashdot loans twitter email-virgili email-enron email-eu wikitalk-china ce-metabolic sc-ppi yeast-ppi homo-pi as-graph-1 as-graph-2 as-graph-3 routeview as-caida itdk gnutella-06 gnutella-24 gnutella-30 gnutella-31 web-stanford web-notredam web-berkstan amazon-1 amazon-2 road-euro openflight power-grid road-pa diam(G) diam(T1) kT1 max kT1 avg diam(T2) kT2 max kT2 6 2.35 6 3 0.686 2 2 0.571 2 3 1.777 3 3 2.06 3 3 2.569 4 4 2.729 4 2 0.906 2 2 0.002 2 3 2.076 3 3 1.982 1 7 0.981 3 4 1.872 3 2 0.747 2 2 1.791 3 3 1.124 2 2 0.828 2 2 2 0.329 0 0 5 4 5 4 5 6 6 5 6 6 28 28 2 2 22 22 7 6 5 6 8 8 2 3 4 13 98 80 24 9 19 14 10 10 10 14 14 9 8 23 13 10 10 11 10 10 17 29 13 16 16 16 164 46 208 48 22 62 14 46 830 24 8 19 14 10 11 11 13 14 9 9 20 12 10 11 11 10 10 17 29 12 14 14 16 164 46 208 47 23 62 15 51 814 22 8 18 12 8 8 8 13 14 8 7 19 11 10 9 11 9 10 17 26 10 11 11 11 164 46 208 47 20 62 13 46 794 2.108 2.507 2.697 3.167 4.176 0.006 0.935 0.002 0.991 3.735 0.135 1.879 5.735 23.339 0 0 2.431 0.704 0.572 1.88 2.031 1.821 1.932 0.903 0.002 1.791 0.349 4.196 2.558 0.612 0.887 0.833 0.312 0.329 avg 2.083 0.686 0.571 0.701 2.081 1.856 1.906 1.735 0.002 0.777 1.185 3.163 1.872 0.747 0.886 1.272 0.312 0.329 avg diam(T3) kT3 max kT3 6 2 2 2 3 4 4 2 2 2 2 6 3 2 2 3 2 2 0 3 4 3 5 5 28 2 22 7 4 8 2 4 46 24 8 19 12 10 10 10 14 14 8 8 22 12 10 10 12 10 10 17 28 12 12 14 14 164 46 208 47 22 62 14 46 803 1.385 2.507 0.863 3.295 2.669 0.006 0.017 0.002 1.205 1.274 0.135 0.704 1.409 10.64 2.702 3.543 4.475 4.034 4.251 0.006 0.935 0.002 0.919 2.03 0.135 0.641 1.409 22.545 0 Table 4. Comparison of three BFS-trees T1, T2 and T3. T3 is a BF S(c∗)-tree rooted at a randomly picked central vertex c∗ ∈ C(G). 5.2 Estimation of Distances 1 Following Theorem 3, we experimented also on how well our approach approximates the distances in graphs from our dataset. To analyze the quality of approximation provided by our method for a given graph G = (V, E), for every δ := 0, 1, 2, . . . , we computed an estimate bdδ(x, y) on dG(x, y) and the error ∆xy(δ) = bdδ(x, y) − dG(x, y) for all x, y ∈ V . In Table 5, we report ∆max(δ) = maxx,y∈V ∆xy(δ) and ∆avg(δ) = n2 Px,y∈V ∆xy(δ) for the smallest δ such that ∆max(δ) ≤ δ + 1. We omitted some very large graphs in this experiment. For some other large graphs, we did only sampling; we calculated ∆max(δ) and ∆avg(δ) based only on a set of sampled vertices. We sampled vertices that are most distant from the root. The number of sampled vertices ranged from 10 to 100 in each network. For all networks investigated, the average error ∆avg(δ) was very small, less that 1 even for infrastructure networks. That is, the maximum error ∆max(δ) was realized on a very small number of vertex pairs. The maximum error ∆max(δ) was 2 for three networks, was 3 for five networks, was 4 for ten networks (including infrastructure network openflight), and was at most 6 for all except one social network dutch-elite and two infrastructure networks: road-euro and power-grid. The largest ∆max(δ) value had expectedly power-grid network whose hyperbolicity is 10. Acknowledgements The research of V.C., M.H., and Y.V. was supported by ANR project DISTANCIA (ANR-17-CE40-0015). References 1. https://snap.stanford.edu/data/ 17 Network dutch-elite facebook eva slashdot* loans* twitter* email-virgili email-enron email-eu* ce-metabolic sc-ppi yeast-ppi homo-pi as-graph-1 as-graph-2 as-graph-3 routeview as-caida itdk* gnutella-06 gnutella-24 gnutella-30* gnutella-31* road-euro openflight power-grid diam(G) rad(G) δ ∆max(δ) ∆avg (δ) ecc(s) 22 8 18 12 8 8 8 13 14 7 19 11 10 9 11 9 10 17 26 9 11 11 11 62 13 46 12 4 10 6 5 5 5 7 7 4 11 6 5 5 6 5 5 9 14 6 6 7 7 31 7 23 8 2 6 4 3 3 3 4 3 2 6 4 3 3 4 4 4 3 5 5 6 6 6 21 3 17 8 2 6 2 3 3 4 4 2 3 6 4 3 4 4 3 4 4 4 4 6 5 5 11 4 17 0.177 0.169 0.044 0.028 0.213 0.156 0.39 0.06 0.005 0.125 0.19 0.239 0.02 0.061 0.034 0.035 0.038 0.022 0.15 0.331 0.128 0.439 0.386 0.927 0.029 0.518 16 6 12 8 6 6 6 9 10 4 13 8 7 8 8 9 6 14 19 8 9 8 9 39 10 38 Table 5. Distance approximations: for every x, y ∈ V , ∆xy(δ) = bdδ(x, y) − dG(x, y); ∆max(δ) = n2 Px,y∈V ∆xy(δ); δ is defined as the smallest δ (0 ≤ δ ≤ diam(G)) such maxx,y∈V ∆xy(δ); ∆avg(δ) = 1 that ∆max(δ) ≤ δ + 1. Due to large sizes of some networks, the values of ∆max(δ) and ∆avg(δ) for networks marked with * were computed only for some sampled vertices (we sampled vertices that are most distant from the root). The number of sampled vertices ranged from 10 to 100 in each network. 2. http://konect.uni-koblenz.de/networks/ 3. http://web.archive.org/web/20060506132945/ http://www.cosin.org. 4. Center for applied Internet data analysis. http://www.caida.org/data/internet-topology-data-kit. 5. Center for applied Internet data analysis. http://www.caida.org/data/as-relationships. 6. Openflights network dataset – KONECT, October 2016. 7. University of oregon route-views project. http://www.routeviews.org/. 8. A. Abboud, J. Wang, V. Vassilevska Williams, Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse Graphs, SODA 2016, pp. 377–391. 9. A. Abboud, F. Grandoni, V. Vassilevska Williams, Subcubic equivalences between graph centrality problems, APSP and diameter, SODA 2015, pp. 1681–1697. 10. M. Abu-Ata, F.F. Dragan, Metric tree-like structures in real-world networks: an empirical study, Networks 67 (2016), 49–68. 11. A. B. Adcock, B. D. Sullivan, and M. W. Mahoney, Tree-like structure in large social and information networks, ICDM 2013, pp. 1–10. 12. D. Aingworth, C. Chekuri, P. Indyk, and R. Motwani, Fast estimation of diameter and shortest paths (without matrix multiplication), SIAM J. Comput., 28 (1999), 1167-1181. 13. R. Albert, H. Jeong, and A-L. Barab´asi, Internet: Diameter of the world-wide web, Nature 401 (1999), 130-131. 14. J.M. Alonso, T. Brady, D. Cooper, V. Ferlini, M. Lustig, M. Mihalik, M. Shapiro, and H. Short, Notes on word hyperbolic groups, Group Theory from a Geometrical Viewpoint, ICTP Trieste 1990 (E. Ghys, A. Haefliger, and A. Verjovsky, eds.), World Scientific, 1991, pp. 3–63. 15. H. Al-Rasheed, Structural Properties in δ-Hyperbolic Networks: Algorithmic Analysis and Implications, Pro- ceedings of the 25th International Conference Companion on World Wide Web (WWW 2016 Companion), pp. 299-303. 16. H. Al-Rasheed and F.F. Dragan, Core-periphery models for graphs based on their d-hyperbolicity, CompleNet 2015, pp. 65-77, and Journal of Algorithms & Computational Technology 11 (2017), 40-57. 17. V. Batagelj and A. Mrvar, Pajek datasets, (2006). http://vlado.fmf.uni-lj.si/pub/networks/data/. 18 18. B. Ben-Moshe, B. K. Bhattacharya, Q. Shi, and A. Tamir, Efficient algorithms for center problems in cactus networks, Theor. Comput. Sci., 378 (2007), 237 - 252. 19. P. Berman and S.P. Kasiviswanathan, Faster approximation of distances in graphs, WADS 2007, pp. 541–552. 20. M. Borassi, D. Coudert, P. Crescenzi, and A. Marino, On computing the hyperbolicity of real-world graphs, ESA 2015, pp. 215–226. 21. M. Borassi, P. Crescenzi, and M. Habib, Into the square - on the complexity of quadratic-time solvable problems. Electr. Notes Theor. Comput. Sci. 322 (2016), 51–67. 22. Michele Borassi, Pierluigi Crescenzi, Michel Habib, Walter A. Kosters, Andrea Marino, Frank W. Takes: Fast diameter and radius BFS-based computation in (weakly connected) real-world graphs: With an application to the six degrees of separation games. Theor. Comput. Sci. 586 (2015), pp. 59-80. 23. Michele Borassi, Pierluigi Crescenzi, Luca Trevisan: An Axiomatic and an Average-Case Analysis of Algorithms and Heuristics for Metric Properties of Graphs. SODA 2017: 920-939. 24. Massimo Cairo, Roberto Grossi and Romeo Rizzi: New Bounds for Approximating Extremal Distances in Undi- rected Graphs. SODA 2016: pp. 363-376. 25. A. Brandstadt, V. Chepoi, F.F. Dragan, The algorithmic use of hypertree structure and maximum neighbourhood orderings, Discr. Appl. Math. 82 (1998), 43–77. 26. A. Brandstadt, V. Chepoi, F.F. Dragan, Distance approximating trees for chordal and dually chordal graphs, J. Algorithms 30 (1999) 166–184. 27. A. Brandstadt, F.F. Dragan, F. Nicolai, LexBFS-orderings and powers of chordal graphs, Discr. Math. 171 (1997), 27-42. 28. M. R. Bridson and A. Haefiger, Metric Spaces of Non–Positive Curvature, Grundlehren der Mathematischen Wissenschaften [Fundamental Principles of Mathematical Sciences], vol. 319, Springer-Verlag, Berlin, 1999. 29. D. Bu, Y. Zhao, L. Cai, et al. Topological structure analysis of the protein-protein interaction network in budding yeast, Nucleic Acids Research 31 (2003), 2443–2450. 30. S. Cabello, Subquadratic algorithms for the diameter and the sum of pairwise distances in planar graphs, SODA 2017, pp. 2143–2152. 31. S. Chechik, D. Larkin, L. Roditty, G. Schoenebeck, R. E. Tarjan, and V. Vassilevska Williams, Better approxi- mation algorithms for the graph diameter, SODA 2014, pp. 1041–1052. 32. J. Chalopin, V. Chepoi, F.F. Dragan, G. Ducoffe, A. Mohammed, and Y. Vax`es, Fast approximation and exact computation of negative curvature parameters of graphs, Manuscript 2017, to appear in SoCG 2018. 33. V. Chepoi and F. F. Dragan, A linear-time algorithm for finding a central vertex of a chordal graph, ESA 1994, pp. 159–170. 34. V.D. Chepoi and F.F. Dragan, Finding a central vertex in HHD-free graphs, Discr. Appl. Math. 131 (2003), 93–111. 35. V.D. Chepoi, F.F. Dragan, B. Estellon, M. Habib and Y. Vax`es, Diameters, centers, and approximating trees of δ-hyperbolic geodesic spaces and graphs, SoCG 2008, pp. 59–68. 36. V.D. Chepoi, F.F. Dragan, B. Estellon, M. Habib and Y. Vax`es, Notes on diameters, centers, and approximating trees of delta-hyperbolic geodesic spaces and graphs, Electronic Notes in Discrete Mathematics 31 (2008), 231-234. 37. V. Chepoi, F.F. Dragan, B. Estellon, M. Habib, Y. Vax`es, and Y. Xiang, Additive spanners and distance and routing labeling schemes for hyperbolic graphs, Algorithmica, 62 (2012), 713–732. 38. V. Chepoi, F.F. Dragan, and Y. Vax`es, Center and diameter problems in plane triangulations and quadrangula- tions, SODA 2002, pp. 346–355. 39. V. Chepoi, F. F. Dragan, Y. Vax`es, Core congestion is inherent in hyperbolic networks, SODA 2017, pp. 2264– 2279. 40. V. Chepoi and B. Estellon, Packing and covering δ-hyperbolic spaces by balls, APPROX-RANDOM 2007, pp. 59–73. 41. N. Cohen, D. Coudert, and A. Lancin, Exact and approximate algorithms for computing the hyperbolicity of large-scale graphs, RR-8074 (hal-00735481v3), INRIA, 2012. 42. D.G. Corneil, F.F. Dragan, M. Habib, and C. Paul, Diameter determination on restricted graph families, Discr. Appl. Math., 113 (2001), 143 - 166. 43. D.G. Corneil, F.F. Dragan, E. Kohler, On the power of BFS to determine a graph's diameter, Networks 42(2003), 209-222. 44. B. DasGupta, M. Karpinski, N. Mobasheri, and F. Yahyanejad, Node expansions and cuts in Gromov-hyperbolic graphs, CoRR, vol. abs/1510.08779, 2015. 45. M. De Choudhury, Y.-R. Lin, H. Sundaram, K. Sel¸cuk Candan, L. Xie, and A. Kelliher, How does the data sampling strategy impact the discovery of information diffusion in social media? ICWSM 2010, pp. 34–41. 46. D. Dor, S. Halperin, and U. Zwick, All-pairs almost shortest paths, SIAM J. Comput., 29 (2000), 1740-1759. 47. Y. Dourisboure and C. Gavoille, Tree-decompositions with bags of small diameter, Discr. Math. 307 (2007) 208–229. 19 48. F.F. Dragan, Centers of graphs and the Helly property (in Russian), Ph.D. Thesis, Moldova State University, (1989). 49. F.F. Dragan, Estimating All Pairs Shortest Paths in Restricted Graph Families: A Unified Approach J. Algorithms 57 (2005), 1–21. 50. F.F. Dragan, Almost diameter of a house-hole-free graph in linear time via LexBFS, Discr. Appl. Math. 95 (1999), 223–239. 51. F.F. Dragan, E. Kohler, H. Alrasheed, Eccentricity approximating trees, Discr. Appl. Math. 232 (2017), 142–156. 52. F.F. Dragan, M. Habib, L. Viennot, Revisiting Radius, Diameter, and all Eccentricity Computation in Graphs through Certificates, CoRR abs/1803.04660 (2018) 53. F.F. Dragan, F. Nicolai, LexBFS-orderings of distance-hereditary graphs with application to the diametral pair problem, Discr. Appl. Math. 98 (2000), 191–207. 54. F.F. Dragan, F. Nicolai, A. Brandstadt, LexBFS-orderings and powers of graphs, WG 1996, pp. 166-180. 55. J. Duch and A. Arenas, Community detection in complex networks using extremal optimization, Physical Review E72 (2005), 027104. 56. D. Dvir and G. Handler, The absolute center of a network, Networks, 43 (2004), 109 - 118. 57. K. Edwards, W. S. Kennedy, and I. Saniee, Fast approximation algorithms for p-centres in large delta-hyperbolic graphs, CoRR, vol. abs/1604.07359, 2016. 58. M. Elkin, Computing almost shortest paths, ACM Trans. Algorithms, 1 (2005), 283–323. 59. E. Ghys and P. de la Harpe eds., Les groupes hyperboliques d'apr`es M. Gromov, Progress in Mathematics Vol. 83 Birkhauser (1990). 60. M. Gromov, Hyperbolic groups, Essays in group theory, Math. Sci. Res. Inst. Publ., vol. 8, Springer, New York, 1987, pp. 75–263. 61. R. Guimera, L.Danon, A. Diaz-Guilera, F. Giralt, and A. Arenas, Self-similar community structure in a network of human interactions, Physical Review E 68 (2003), 065103. 62. S.L. Hakimi, Optimum location of switching centers and absolute centers and medians of a graph, Oper. Res., 12(1964), 450 - 459. 63. R. Impagliazzo and R. Paturi, On the complexity of k-SAT, J. Comput. Syst. Sci., 62 (2001), 367–375. 64. R. Impagliazzo, R. Paturi, and F. Zane, Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63 (2001), 512–530. 65. H. Jeong, S. P. Mason, A.-L Barabasi, and Z.N. Oltvai, Lethality and centrality in protein networks, Nature 411 (2001), 41-42. 66. C. Jordan, Sur les assemblages des lignes, J. fur reine und angewandte Math., 70 (1869) 185-190. 67. W.S. Kennedy, I. Saniee, and O. Narayan, On the hyperbolicity of large-scale networks and its estimation, Big Data 2016, pp. 3344–3351. 68. B. Klimmt and Y. Yang, Introducing the Enron corpus, CEAS conference, 2004. 69. D. Koschutzski, K. A. Lehmann, L. Peeters, S. Richter, D. Tenfelde-Podehl, O. Zlotowski, Centrality Indices, Network Analysis (U. Brandes and T. Erlebach eds.), Springer, Berlin, 2005, pp. 17–61. 70. D. Kratsch, H.-O. Le, H. Muller, E. Prisner and D. Wagner, Additive tree spanners, SIAM J. Discrete Math. 17 (2003), 332–340. 71. J. Kunegis, Prosper loans, KONECT, the Koblenz Network Collection, 2016. 72. J. Leskovec, J. Kleinberg, and C. Faloutsos, Graph evolution: densification and shrinking diameters, ACM TKDD 2007. 73. J. Leskovec, K. Lang, A. Dasgupta, and M. Mahoney, Community structure in large networks: natural cluster sizes and the absence of large well-defined clusters, Internet Math. 6 (2009), 29–123. 74. J. Leskovec and J. Mcauley, Learning to discover social circles in ego networks, NIPS 2012, pp. 548–556. 75. M.S. Madanlal, G. Vankatesan, C. Pandu Rangan, Tree 3-spanners on interval, permutation and regularbipartite graphs, Inform. Process. Lett. 59 (1996), 97–102. 76. A. Mohammed, Private communication, 2017. 77. O. Narayan and I. Saniee, Large–scale curvature of networks, Physical Review E 84 (2011), 066108. 78. L. N´egyessy, T. Nepusz, L. Kocsis, and F. Bazs´o, Prediction of the main cortical areas and connections involved in the tactile function of the visual cortex by network analysis, Europ. J. Neuroscience 23 (2006), 1919–1930. 79. S. Olariu, A simple linear-time algorithm for computing the center of an interval graph, Int. J. Comput. Math. 34 (1990) 121-128. 80. E. Prisner, Distance approximating spanning trees, Proceedings of the Symposium on Theoretical Aspects of Computer Science (STACS'97), Lecture Notes on Computer Science 1200, 1997, pp. 499–510. 81. E. Prisner, Eccentricity-approximating trees in chordal graphs, Discr. Math. 220 (2000), 263–269. 82. M. Ripeanu, I. Foster, and A. Iamnitchi, Mapping the gnutella network: Macroscopic properties of large-scale peer-to-peer systems, Int. Workshop on Peer-to-Peer Systems 2002, pp. 85–93. 20 83. L. Roditty and V. Vassilevska Williams, Fast approximation algorithms for the diameter and radius of sparse graphs, STOC 2013, pp. 515–524. 84. L. Roditty and U. Zwick, On dynamic shortest paths problems, Algorithmica, 61 (2011), 389-401. 85. Y. Shavitt and T. Tankel, Hyperbolic embedding of internet graph for distance estimation and overlay construc- tion, IEEE/ACM Trans. Netw., 16 (2008), 25–36. 86. C. Stark, B. Breitkreutz, T. Reguly, L. Boucher, A. Breitkreutz, and M. Tyers, Biogrid: a general repository for interaction datasets, Nucleic Acids Research, 2006. 87. J. Sun, J. Kunegis, and S. Staab, Predicting user roles in social networks using transfer learning with feature transformation, Proc. ICDM Workshop on Data Mining in Networks, 2016. 88. L. Subelj and M. Bajec, Robust network community detection using balanced propagation, Eur. Phys. J. B 81 (2011), 353–362. 89. M. Thorup, Compact oracles for reachability and approximate distances in planar digraphs, J. ACM 51 (2004), 993–1024. 90. V. Vassilevska Williams and R. Williams, Subcubic equivalences between path, matrix and triangle problems, FOCS 2010, pp. 645–654. 91. V. Vassilevska Williams, Hardness of easy problems: basing hardness on popular conjectures such as the strong exponential time hypothesis, IPEC 2015, pp. 17–29. 92. K. Verbeek and S. Suri, Metric embedding, hyperbolic space, and social networks, SoCG 2014, pp. 501–510. 93. D. Watts and S. Strogatz, Collective dynamics of small-world networks, Nature 393 (1998), 440–442. 94. O. Weimann and R. Yuster, Approximating the diameter of planar Graphs in near linear time, ACM Trans. Algorithms, 12 (2016), Article No. 12. 95. R. Williams, A new algorithm for optimal constraint satisfaction and its implications, ICALP 2004, pp. 1227– 1237. 96. J. Yang and J. Leskovec, Defining and Evaluating Network Communities based on Ground-truth, Knowledge and Information Systems 42 (2015), 181–213. 21 Appendix Network kmax kavg % of vertices with k(x) = 0 % of vertices with k(x) = 1 % of vertices with k(x) = 2 % of vertices with k(x) = 3 % of vertices with k(x) = 4 % of vertices with k(x) = 5 % of vertices with k(x) ≥ 6 dutch-elite facebook eva slashdot loans twitter email-virgili email-enron email-eu wikitalk-china ce-metabolic sc-ppi yeast-ppi homo-pi as-graph-1 as-graph-2 as-graph-3 routeview as-caida itdk gnutella-06 gnutella-24 gnutella-30 gnutella-31 web-stanford web-notredam web-berkstan amazon-1 amazon-2 road-euro openflight power-grid road-pa 6 2 2 3 3 4 4 2 2 3 3 3 3 2 3 3 2 2 0 4 4 5 5 6 28 2 22 6 6 8 3 13 98 2.35 0.686 0.571 1.777 2.06 2.569 2.729 0.906 0.002 2.076 1.982 0.981 1.872 0.747 1.791 1.124 0.828 0.329 0 2.108 2.507 2.697 3.167 4.176 0.006 0.935 0.002 0.991 3.735 0.135 1.879 5.735 23.339 14.9 51.9 47.6 2.3 0.1 0.1 0.1 23.4 99.8 ≈ 0 0.2 32.4 2 34.2 0.5 9.6 27.8 69.7 100 0.3 0.3 0.2 0.1 0.01 99.9 7.1 99.9 28.1 0.1 97.4 0.2 14.3 0.02 0 27.6 47.7 24.1 13.9 ≈ 1 2.3 62.6 0.1 0.01 7.5 41.6 25.4 56.9 24.9 68.5 61.6 27.6 12 5.7 1.5 1.8 0.2 ≈ 0 92.4 ≈ 0 48 0.3 0.3 23.9 13.1 1.5 54.3 20.5 4.7 67.1 66.3 44.4 32 14 0.1 92.4 86.1 21.5 55.8 8.9 69.7 21.7 10.6 2.7 64.5 41.1 37 13 1.4 ≈ 0 0.5 0 21.5 3.6 0.1 63.7 1.6 0.1 0 29.1 0 1.7 6.5 19.7 51.2 55.7 7.6 6.2 4.5 16.8 4.9 0.2 22.8 48.8 50.7 52.4 13.3 ≈ 0 ≈ 0 1.5 33.9 0.4 12.2 1.6 2.9 3.4 9.9 0.4 4.1 10.5 31.8 51.1 ≈ 0 0 0.5 46.5 0 3.9 0.2 0.1 0.9 33.4 ≈ 0 ≈ 0 0.3 15.3 0.8 8.7 0.2 0.5 ≈ 0 ≈ 0 0.1 0.3 ≈ 1 39.8 95 Table 6. Distribution of values k(x) = eccT1 (x) − eccG(x), x ∈ V . kmax := maxx∈V k(x). kavg := n Px∈V k(x). 1 22 Network kmax kavg % of vertices with k(x) = 0 % of vertices with k(x) = 1 % of vertices with k(x) = 2 % of vertices with k(x) = 3 % of vertices with k(x) = 4 % of vertices with k(x) = 5 % of vertices with k(x) ≥ 6 dutch-elite facebook eva slashdot loans twitter email-virgili email-enron email-eu wikitalk-china ce-metabolic sc-ppi yeast-ppi homo-pi as-graph-1 as-graph-2 as-graph-3 routeview as-caida itdk gnutella-06 gnutella-24 gnutella-30 gnutella-31 web-stanford web-notredam web-berkstan amazon-1 amazon-2 road-euro openflight power-grid road-pa 6 3 2 3 3 3 4 2 2 3 1 7 4 2 2 2 2 2 0 5 5 6 6 6 28 2 22 7 5 8 2 4 80 2.431 0.704 0.572 1.88 2.031 1.821 1.932 0.903 0.002 1.791 0.349 4.196 2.558 0.612 0.887 0.833 0.312 0.329 0 2.702 3.543 4.475 4.034 4.251 0.006 0.935 0.002 0.919 2.03 0.135 0.641 1.409 22.545 16.1 43.6 47.6 0.1 0.1 3.1 4.3 22.4 99.9 ≈ 0 65.1 1.3 0.7 41.6 19.6 25.7 70.4 69.7 100 0.3 0.01 0.02 0.02 0.01 99.9 7.1 99.97 49.7 1.2 97.4 36.1 46.3 0.7 0 42.5 47.6 17.7 14 ≈ 20 22.8 64.8 0.03 21 34.9 4.1 5.9 55.5 72.2 65.3 28 27.6 3.4 0.7 0.1 0.2 0.1 ≈ 0 92.3 ≈ 0 21.7 15.1 0.3 63.7 13.1 20.9 47.1 13.8 4.8 76.2 68.7 68.6 48.4 12.7 0.1 79 6.2 ≈ 36 2.9 8.2 ≈ 9 1.6 2.7 28.6 5.9 0.7 2.6 1.3 ≈ 0 0.6 0 18.6 65 0.1 0.2 12.6 0.3 0 0.1 ≈ 6 17.2 8.3 24.4 0.008 13.4 51.7 61.4 37.2 8.6 16.4 11.6 0.04 0.02 8.1 17.1 0.4 9.1 0.2 35.9 0 0.8 0.1 27.2 5.7 6.3 50.9 38.3 54.8 48.4 ≈ 0 0 1.1 1.6 0 18.8 0.4 35.9 11.8 ≈ 0 5.3 46.5 25.1 37.8 0.02 0.01 0.4 ≈ 0 0.8 5.7 0.5 0.9 ≈ 0 ≈ 0 0.3 ≈ 1 0.2 77.3 Table 7. Distribution of values k(x) = eccT2 (x) − eccG(x), x ∈ V . kmax := maxx∈V k(x). kavg := n Px∈V k(x). 1 23
1902.05134
1
1902
2019-02-13T21:14:10
Efficient Continuous Multi-Query Processing over Graph Streams
[ "cs.DS" ]
Graphs are ubiquitous and ever-present data structures that have a wide range of applications involving social networks, knowledge bases and biological interactions. The evolution of a graph in such scenarios can yield important insights about the nature and activities of the underlying network, which can then be utilized for applications such as news dissemination, network monitoring, and content curation. Capturing the continuous evolution of a graph can be achieved by long-standing sub-graph queries. Although, for many applications this can only be achieved by a set of queries, state-of-the-art approaches focus on a single query scenario. In this paper, we therefore introduce the notion of continuous multi-query processing over graph streams and discuss its application to a number of use cases. To this end, we designed and developed a novel algorithmic solution for efficient multi-query evaluation against a stream of graph updates and experimentally demonstrated its applicability. Our results against two baseline approaches using real-world, as well as synthetic datasets, confirm a two orders of magnitude improvement of the proposed solution.
cs.DS
cs
1 Efficient Continuous Multi-Query Processing over Graph Streams Lefteris Zervakis, Vinay Setty, Christos Tryfonopoulos, Katja Hose Abstract -- Graphs are ubiquitous and ever-present data structures that have a wide range of applications involving social networks, knowledge bases and biological interactions. The evolution of a graph in such scenarios can yield important insights about the nature and activities of the underlying network, which can then be utilized for applications such as news dissemination, network monitoring, and content curation. Capturing the continuous evolution of a graph can be achieved by long-standing sub-graph queries. Although, for many applications this can only be achieved by a set of queries, state-of-the-art approaches focus on a single query scenario. In this paper, we therefore introduce the notion of continuous multi-query processing over graph streams and discuss its application to a number of use cases. To this end, we designed and developed a novel algorithmic solution for efficient multi-query evaluation against a stream of graph updates and experimentally demonstrated its applicability. Our results against two baseline approaches using real-world, as well as synthetic datasets, confirm a two orders of magnitude improvement of the proposed solution. ! 1 INTRODUCTION I N recent years, graphs have emerged as prevalent data struc- tures to model information networks in several domains such as social networks, knowledge bases, communication networks, biological networks and the World Wide Web. These graphs are massive in scale and evolve constantly due to frequent updates. For example, Facebook has over 1.4 billion daily active users who generate over 500K posts/comments and four million likes every minute resulting in massive updates to the Facebook social graph1. To gain meaningful and up-to-date insights in such frequently updated graphs, it is essential to be able to monitor and detect continuous patterns of interest. There are several applications from a variety of domains that may benefit from such monitoring. In so- cial networks, such applications may involve targeted advertising, spam detection [1], [2], and fake news propagation monitoring based on specific patterns [3], [4]. Similarly, other applications like (i) protein interaction patterns in biological networks [5], [6], (ii) traffic monitoring in transportation networks, (iii) attack detection (e.g., distributed denial of service attacks in computer networks), (iv) question answering in knowledge graphs [7], and (v) reasoning over RDF graphs [8] may also benefit from such pattern detection. For the applications mentioned above it is necessary to express the required patterns as continuous sub-graph queries over (one or many) streams of graph updates and appropriately notify the subscribed users for any patterns that match their subscription. Detecting these query patterns is fundamentally a sub-graph isomorphism problem which is known to be NP-complete due to the exponential search space resulting from all possible sub- graphs [9], [10]. The typical solution to address this issue is to pre-materialize the necessary sub-graph views for the queries and • • L. Zervakis, V. Setty, and K. Hose are with the Department of Computer Science, Aalborg University, Aalborg, Denmark. E-mail: {lefteris,vinay,khose}@cs.aau.dk L. Zervakis and C. Tryfonopoulos are with the Department of Informatics and Telecommunications, University of the Peloponnese, Tripolis, Greece. E-mail: {zervakis,trifon}@uop.gr • V. Setty is also with the Department of Electrical Engineering and Computer Science, University of Stavanger, Stavanger, Norway. E-mail: [email protected] 1. Facebook quarterly update http://bit.ly/2BIM30d (a) (b) Fig. 1: Spam detection: Users sharing and liking content with links to flagged domains. (a) A clique of users who know each other, and (b) Users sharing the same IP address. perform exploratory joins [11]; an expensive operation even for a single query in a static setting. These applications deal with graph streams in such a setup that is often essential to be able to support hundreds or thou- sands of continuous queries simultaneously. This leads to several challenges that require: (i) quickly detecting the affected queries for each update, (ii) maintaining a large number of materialized views, and (iii) avoiding the expensive join and explore approach for large sets of queries. To better illustrate the remarks above, consider the application of spam detection in social networks. Fig. 1 shows an example of two graph patterns that may emerge from malicious user activities, i.e., users posting links to domains that have been flagged as fraudulent. Notice that malicious behavior could be caused either because a group of users that know each other share and like each other's posts containing content from a flagged domain (Fig. 1(a)), or because the group of users shared the same flagged post several times from the same IP. Even though these two queries are fundamentally different and produce differ- ent matching patterns, they share a common sub-graph pattern, i.e., "User1 shares−−−→Post1 links−−→Domain1". If these two queries are evaluated independently, all the computations for processing the common pattern have to be executed twice. However, by identify- ing common patterns in query sets, we can amortize the costs of processing and answering them. One simple approach to avoid processing all the (continuous) queries upon receiving a graph update is to index the query graphs using an inverted-index at the granularity of edges. While this approach may help us quickly detect all the affected queries for a given graph update, we still need to perform several exploratory joins to answer the affected queries. For example, in Fig. 1, we would need to join and explore the edges matching the pattern "User1 Shares−−−→Post1 and Post1 Links−−−→Domain1" upon each update to process the two queries. On the contrary, if we first identify the maximal sub-graph patterns shared among the queries instead, we can minimize the number of operations necessary to answer the queries. Therefore, a solution which groups queries based on their shared patterns would be expected to deliver significant performance gains. To the best of our knowledge, none of the existing works provide a solution that exploits common patterns for continuous multi-query answering. In this paper, we address this gap by proposing a novel algorithmic solution, coined TRIC (TRIe-based Clustering) to index and cluster continuous graph queries. In TRIC, we first decompose queries into a set of directed paths such that each vertex in the query graph pattern belongs to at least one path (path covering problem [12]). However, obtaining such paths leads to redundant query edges and vertices in the paths; this is undesirable since it affects the performance of the query processing. Therefore, we are interested in finding paths which are shared among different queries, with minimal duplication of vertices. The paths obtained are then indexed using 'tries' that allow us to minimize query answering time by (i) quickly identifying the affected queries, (ii) sharing materialized views between common patterns, and (iii) efficiently ordering the joins between materialized views affected from the update. Fig. 2 shows the potential for improvement in query answering time with our query clustering solution TRIC, for the LDBC graph benchmark [13]. We can observe that TRIC provides a speedup of two orders of magnitude in query answering time, compared to two advanced baselines using the "inverted indexing technique" (INV, INC) and the graph database Neo4j that do not exploit the common sub-graph patterns in the queries. In summary, our contributions are: •• We formalize the problem of continuous multi-query answer- ing over graph streams (Section 3). • We propose a novel query graph clustering algorithm that is able to efficiently handle large numbers of continuous graph queries by resorting on (i) the decomposition of continuous query graphs to minimum covering paths and (ii) the utiliza- tion of tries for capturing the common parts of those paths (Section 4). • Since no prior work in the literature has considered con- tinuous multi-query answering, we designed and developed two algorithmic solutions that utilize inverted indexes for the query answering. Additionally, we deploy and extend Neo4j [14], a well-established graph database solution, to support our proposed paradigm. To this end, the proposed solutions will serve as baselines approaches during the ex- perimental evaluation. (Section 5). • We experimentally evaluate the proposed solution using three different datasets from social networks, transportation, and biology domains, and compare the performance against the 2 ) e t a d p u / c e s m ( e m i t g n i r e w s n A 1000.00 100.00 10.00 TRIC Neo4j INC INV 1.00 0.10 0.01 0.00 1 10 100 Number of queries 1000 Fig. 2: Log-log plot comparing query answering time for the SN B dataset from the LDBC benchmark, when varying the number of queries exponentially. three baselines. In this context, we show that our solution can achieve up to two orders of magnitude improvement in query processing time (Section 6). 2 RELATED WORK Structural graph pattern search using graph isomorphism has been studied in the literature before [9], [10]. In [15], the authors propose a solution that aims at reducing the search space for a single query graph. The solution identifies candidate regions in the graph that can contain query embeddings, while it is coupled with a neighborhood equivalence locating strategy to generate the necessary enumerations. In the same spirit [16] aims at reducing the search space in the graph by exploiting the syn- tactic similarities present on vertex relationships. [17] considers the sub-graph isomorphism problem when multiple queries are answered simultaneously. However, these techniques are designed for static graphs and are not suitable for processing continuous graph queries on evolving graphs. Continuous sub-graph matching has been considered in [18] but the authors assume a static set of sub-graphs to be matched against update events, use approximate methods that yield false positives, and small (evolving) graphs. An extension to this work considers the problem of uncertain graph streams [19], over wireless sensor networks and PPIs. The work in [20] considers a setup of continuous graph pattern matching over knowledge graph streams. The proposed solution utilizes finite automatons to represent and answer the continuous queries. However, this approach can support a handful of queries, since, each query is evaluated separately, while, it generates false positives due to the adopted sliding window technique. These solutions are not suitable for answering large number of continuous queries on graphs with high update rates. There are a few publish/subscribe solutions on ontology graphs proposed in [21], [22], but they are limited to the RDF data model. Distributed pub/sub middleware for graphs has recently been proposed in [23], however, the main focus is on node constraints (attributes) while ignoring the graph structure. In graph streams research; [24], [25] propose algorithms to identify correlated graphs from a graph stream. This differs from 3 Update stream S u1 = (checksIn = (P1, plc)) u2 = (checksIn = (P2, plc)) u3 = (checksIn = (P3, plc )) (a) (b) Fig. 3: (a) An update stream S and (b) the evolution of graph G after inserting ui ∈ S. our setup since a sliding window that covers a number of batches of data is used, and the main focus is set on identifying subgraphs with high Pearson correlation coefficients. In [26], the authors pro- pose continuous pattern detection in graph streams with snapshot isolation. However, this solution considers only single queries at a time and the patterns detected are also approximate. The work in [27] provides an exact subgraph search algorithm that exploits the temporal characteristics of representative quer- ies for online news or social media monitoring. This algorithm exploits the structural and semantic characteristics of the graph through a specialized data structure. An extension of this work, considers continuous query answering with graph patterns over dynamic multi-relation graphs [28]. Finally, in [11] the authors perform subgraph matching over a billion node graph by proposing graph exploration methods based on cloud technologies. While the aforementioned works are similar to the query evaluation scenario, the emphasis is on efficient search mechanisms, rather than continuous answering over streaming graph data. 3 DATA MODEL AND PROBLEM DEFINITION In this section we outline the data (Section 3.1) and query model (Section 3.2) that our approach builds upon. 3.1 Graph Model In this paper, we use attribute graphs [29] (Definition 1), as our data model, as they are used natively in a wide variety of applications, such as social network graphs, traffic network graphs, and citation graphs. Datasets in other data models can be mapped to attribute graphs in a straightforward manner so that our approach can be applied to them as well. Definition 1. An attribute graph G is defined as a directed labeled multigraph: G = (V, E, lV , lE, ΣV , ΣE) where V is the set of vertices and E the set of edges. An edge e ∈ E is an ordered pair of vertices e : (s, t), where s, t ∈ V represent source and target vertices. lV : V → ΣV and lE : E → ΣE are labeling functions assigning labels to vertices and edges from the label sets ΣV and ΣE. For ease of presentation, we denote an edge e as e = (s, t), where e, s and t are the labels of the edge(lE(e)), source vertex (lV (s)) and target vertex (lV (t)) respectively. As our goal is to facilitate efficient continuous multi-query processing over graph streams, we also provide formal definitions for updates and graph streams (Definitions 2 and 3). Definition 2. An update ut on graph G is defined as an addition (e) of an edge e at time t. An addition leads to new edges between vertices and possibly the creation of new vertices. Fig. 4: Example query graph pattern. Definition 3. A graph stream S = (u1, u2, . . . , ut) of graph G is an ordered sequence of updates. Fig. 3(a) presents an update stream S consisting of three graph updates u1, u2, and u3 generated from social network events. While, Fig. 3 (b) shows the initial state of graph G and its evolution after inserting sequentially the three updates. 3.2 Query Model For our query model we assume that users (or services operating on their behalf) are interested to learn when certain patterns emerge in an evolving graph. Definition 4 provides a formal definition of such query graph patterns defining structural and attribute constraints. Definition 4. A query graph pattern Qi is defined as a directed labeled multigraph: Qi = (VQi, EQi, vars, lV , lE, ΣV , ΣE) where VQi is a set of vertices, EQi a set of edges, and vars a set of variables. lV : V → {ΣV ∪ vars} and lE : E → ΣE are labeling functions assigning labels (and variables) to vertices and edges. Let us consider an example where a user wants to be notified when his friends visit places nearby. Fig. 4 shows the correspond- ing query graph pattern that will result in a user notification when two people check in at the same place/location in Rio. Based on the above definitions, let us now define the problem of multi-query processing over graph streams. Problem Definition. Given a set of query graph patterns QDB = {Q1, Q2, . . . , Qk}, an initial attribute graph G, and a graph stream S with continuous updates ut ∈ S, the problem of multi-query processing over graph streams consists of contin- uously identifying all satisfied query graph patterns Qi ∈ QDB when applying incoming updates. Query Set and Graph Modifications. A set of query graph patterns QDB is subject to modifications (i.e., additions and deletions). In this work, we focus on streamlining the query indexing phase, while developing techniques that allow processing each incoming query graph pattern separately, thus supporting knowschecksInu1checksIn =(P1 , plc)u2checksIn =(P2, plc) u3checksIn =(P3, plc) GG'G''G'''knowsknowsP1P2P3knowsknowschecksInP1P2P3plcknowsknowschecksInchecksInP1P2P3plcknowschecksInchecksInP1P2P3plc 4 posted −−−−−→ "pst1"} −−−−−→ "pst2"} posted Query ID Q1 Q2 Q3 Q4 Set of Covering Paths −−−−−−→?var P1 = {?var hasM od −−−−−−→?var P2 = {?var hasM od reply−−−−→ "pst2"} P3 = {?var P1 = {?var hasM od −−−−−−→?var} P1 = {"com1" hasCreator −−−−−−−−−→?var} "pst1" containedIn P1 = {?var hasM od −−−−−−→?var −−−−−−−−−→?var} containedIn −−−−−−−−→?var posted −−−−−→ posted −−−−−→ "pst1" (a) (b) Fig. 5: (a) Four query graph patterns that capture events generated inside a social network and (b) their covering paths. continuous additions in QDB. In the same manner, a graph G is subject to edge additions and deletions, our main objective is to efficiently determine the queries satisfied by an edge addition. The proposed model does not require indexing the entire graph G and retains solely the necessary parts of G for the query answering. To this end, we do not further discuss deletions on QDB and G, as we focus on providing high performance query answering algorithms. 4 TRIE-BASED CLUSTERING To solve the problem defined in the previous section, we propose TRIC (TRIe-based Clustering). As motivated in Section 1, the key idea behind TRIC lies in the fact that query graph patterns overlap in their structural and attribute restrictions. After identifying and indexing these shared characteristics (Section 4.1), they can be exploited to batch-answer the indexed query set and in this way reduce query response time (Section 4.2). 4.1 Query Indexing Phase TRIC indexes each query graph pattern Qi by applying the following two steps: 1. Transforming the original query graph pattern Qi into a set of path conjuncts, that cover all vertices and edges of Qi, and when combined can effectively re-compose Qi. 2. Indexing all paths in a trie-based structure along with unique query identifiers, while clustering all paths of all indexed queries by exploiting commonalities among them. In the following, we present each step of the query indexing phase of Algorithm TRIC, give details about the data structures utilized and provide its pseudocode (Fig. 6). (cid:83)(cid:116)(cid:101)(cid:112) 1 : Extracting the Covering Paths. In the first step of the query indexing process, Algorithm TRIC decomposes a query graph pattern Qi and extracts a set of paths CP (Qi) (Fig. 6, line 1). This set of paths, covers all vertices V ∈ Qi and edges E ∈ Qi. At first, we give the definition of a path and subsequently define and discuss the covering path set problem. Definition 5. A path Pi ∈ Qi is defined as a list of vertices Pi = {v1 ek−→ vk+1} where vi ∈ Qi, such that two sequential vertices vi, vi+1 ∈ Pi have exactly one edge ei ∈ Qi connecting them, i.e., ek = (vk, vk+1). e2−→ . . . vk e1−→ v2 Definition 6. The covering paths [30] CP of a query graph Qi is defined as a set of paths CP (Qi) = {P1, P2, . . . , Pk} that cover all vertices and edges of Qi. In more detail, we are interested in the least number of paths while ensuring that for Input: Query Qi = (VQi , EQi , vars, lV , lE , ΣV , ΣE ) Output: QDB ← QDB ∪ Qi 1 P aths ← CP(Qi); // Obtain the set of covering paths 2 foreach Pi ∈ P aths do // For each covering path Pi of Qi 3 4 foreach trie Ti with root(Ti) = e1 : e1 ∈ Pi do depthFirstSearch(Ti); // Traverse trie in DFS // If there exists a trie that can store Pi if ∃{n0 → . . . ni → . . . nk} ⊆ Pi then // Store the trie path positions positions ← {n0 → . . . ni → . . . nk}; // If all edges ei ∈ Pi cannot be indexed, if positions ∩ Pi (cid:54)= Ø then create additional trie nodes to index them create nodes(Pi \ positions); last(positions) ← id(Qi); // Store the query id // Keep a reference to the last trie node pathP ositions → pathP ositions ∪ last(positions); // Store tries Ti under which, edge ei is indexed foreach ei ∈ Pi do edgeInd[ei] ← Ti; 1 (cid:112) (cid:101) (cid:116) (cid:83) 2 (cid:112) (cid:101) (cid:116) (cid:83) 5 6 7 8 9 10 11 12 // Store the nodes that Qi was indexed under 13 queryInd[id(Qi)] ← pathP ositions Fig. 6: Query indexing phase of Algorithm TRIC. every vertex vi ∈ Qi there is at least one path Pj that contains vi, i.e., ∀i∃j : vi ∈ Pj, vi ∈ Qi. In the same manner, for every edge ei ∈ Qi there is at least one path Pj that contains ei, i.e., ∀i∃j : ei ∈ Pj. Obtaining the Set of Covering Paths. The problem of obtaining a set of paths that covers all vertices and edges is a graph optimization problem that has been studied in literature [30], [31]. In our approach, we choose to solve the problem by applying a greedy algorithm, as follows: For all vertices vi in the query graph Qi execute a depth-first walk until a leaf vertex (no outgoing edge) of the graph is reached, or there is no new vertex to visit. Subsequently, repeat this step until all vertices and edges of the query graph Qi have been visited at least once and a list of paths has been obtained. Finally, for each path in the obtained list, check if it is a sub-path of an already discovered path, and remove it from the list of covering paths. The end result of this procedure yields the set of covering paths. Example 1. In Fig. 5(a) we present four query graph patterns. These query graph patterns capture activities of users inside a social network. By applying Definition 6 on the four query graph patterns presented, Algorithm TRIC extracts four sets of covering paths, presented in Fig. 5(b). Obtaining a set of paths serves two purposes: (a) it gives a less complex representation of the query graph that is easier to Q3Q4Q2Q1?f1hasModpostedpst1pst2?p1postedreply?com1?f2?f1?p1postedpst1containedInhasCreatorcom1hasMod?f1?p1?f1?p1postedpst1containedInhasMod 5 for trie roots that can index the first edge e1 ∈ Pi (Fig. 6, lines 3− 6). To access the trie roots, TRIC utilizes a hash table (namely rootInd) that indexes the values of the root-nodes (keys) and the references to the root nodes (values). If such trie Ti is located, Ti is traversed in a DFS manner to determine in which sub-trie path Pi can be indexed (Fig. 6, line 4). Thus, TRIC traverses the forest to locate an existing trie-path {n1 → . . . ni → . . . nk} that can index the ordered set of edges {e1, . . . , ek} ∈ Pi. If the discovered trie-path can index Pi partially (Fig. 6, line 7), TRIC proceeds into creating a set of new nodes under nk that can index the remaining edges (Fig. 6, line 8). Finally, the algorithm stores the identifier of Qi at the last node of the trie path (Fig. 6, line 9). Algorithm TRIC makes use of two additional data structures, namely edgeInd and queryInd. The former data structure is a hash table that stores each edge ei ∈ Pi (key) and a collection of trie roots Ti which index ei as the hash table's value (Fig. 6, lines 11 − 12). Finally, TRIC utilizes a matrix queryInd that indexes the query identifier along side the set of nodes under which its covering paths Pi ∈ CP (Qi) was indexed (Fig. 6, line 13). Example 3. Fig. 8 presents an example of rootInd, queryInd and edgeInd of Algorithm TRIC when indexing the set of covering paths of Fig. 5 (b). Notice, that TRIC indexes paths P1, P2 ∈ Q1, path P1 ∈ Q2 and path P1 ∈ Q4 under the same trie T1, thus, clustering together their common structural restrictions (all the aforementioned paths) and their attribute restrictions. Additionally, note that the queryInd data structure keeps references to the last node where each path Pi ∈ Qi is stored, e.g. for Q1 it keeps a set of node positions {&n2, &n4, &n5} that correspond to its original paths P1, P2 and P3 respectively. Finally, edgeInd stores all the unique edges present in the path set of Fig. 5 (b), with references to the trie roots under which they are indexed, e.g. edge posted = (?var, pst1) that is present in P1 ∈ Q1, P1 ∈ Q3 and P1 ∈ Q4, is indexed under both tries T1 and T3, thus this information is stored in set {&T1, &T3}. The time complexity of Algorithm TRIC when indexing a path Pi, where Pi = M edges and B the branching factor of the forest, is (cid:79)(M ∗ B), since TRIC uses a DFS strategy, with the maximum depth bound by the number of edges. Thus, for a new query graph pattern Qi with N covering paths, the total time complexity is (cid:79)(N ∗ M ∗ B). Finally, the space complexity of Algorithm TRIC when indexing a query Qi is (cid:79)(N ∗ M ), where M is the number of edges in a path and N the cardinality of Qi's covering paths. Variable Handling. A query graph pattern Qi contains vertices that can either be literals (specific entities in the graph) identified by their label, or variables denoted with the generic label "?var". This approach is applied in order to alleviate restrictions posed by naming conventions and thus leverage on the common structural constraints of paths. However, by substituting the variable vertices with the generic "?var" requires us to keep information about the joining order of each edge ei ∈ Pi, as well as, how each Pi ∈ CP (Qi) intersects with the rest of the paths in CP (Qi). In order to calculate the subgraphs that satisfy each covering path Pi ∈ CP (Qi), each matV [ei] : ei ∈ Pi must be joined. Each path Pi that is indexed under a trie path {n1 → . . . ni → . . . nk} maintains the original ordering of its edges and vertices, while the order under which each edge of a node ni is connected with its children nodes (chn(ni)), is determined as follows: the target vertex t ∈ ei Fig. 7: Materialized views of Q1. manage, index and cluster, as well as (b) it provides a streamlined approach on how to perform the materialization of the subgraphs that match a query graph pattern, i.e., the query answering during the evolution of the graph. Materialization. Each edge ei that is present in the query set has a materialized view that corresponds to its matV [ei]. The materialized view of ei stores all the updates ui that contain ei. In order to obtain the subgraphs that satisfy a query graph pattern Qi all edges ei ∈ Qi must have a non-empty materialized view (i.e., matV (cid:54)= Ø) and the materialized views should be joined as defined by the query graph pattern. e1−→ v2 In essence, the query graph pattern determines the execution plan of the query. However, given that a query pattern in itself is a graph there is a high number of possible execution plans available. A path Pi = {v1 e2−→ . . . vk} serves as a model that defines the order in which the materialization should be performed. Thus, starting from the source vertex v1 ∈ Pi and joining all the materialized views from v1 to the leaf vertex vk ∈ Pi : P = k yields all the subgraphs that satisfy the path Pi. After all paths Pi that belong in Qi have been satisfied, a final join operation must be performed between all the paths. This join operation will produce the subgraphs that satisfy the query graph Qi. To achieve this path joining set, additional information is kept about the intersection of the paths Pi ∈ Qi. The intersection of two paths Pi and Pj are their common vertices. Example 2. Fig. 7 presents some possible materialized views that correspond to the covering paths of query graph Q1 (Fig. 5 (b)). In order to locate all subgraphs that satisfy the structural and attribute restrictions posed by paths P1, P2 and P3 their materialized views should be calculated. More specif- ically, path P1 = {?var hasM od posted−−−−→ "pst1"}, is formulated by two edges, edges hasM od = (?var, ?var) and posted = (?var, pst1), thus, their materialized views matV [hasM od = (?var, ?var)] and matV [posted = (?var, pst1)] must be joined. These two views contains all updates ui that correspond to them, while the result of their join operation will be a new materialized view matV [hasM od = (?var, ?var), posted = (?var, pst1)] as shown in Fig. 7. In a similar manner, the subgraphs that satisfy path P2 are calculated, while P3 that is formulated by a single edge does not require any join operations. Finally, in order to calculate the subgraphs that match Q1 all materialized views that correspond to paths P1, P2 and P3 must be joined. −−−−−→?var (cid:83)(cid:116)(cid:101)(cid:112) 2 : Indexing the Paths. Algorithm TRIC proceeds into indexing all the paths, extracted in (cid:83)(cid:116)(cid:101)(cid:112) 1, into a trie-based data structure. For each path Pi ∈ CP (Qi), TRIC examines the forest Q1=matV[hasMod = (?var, ?var)]?var?varmatV[posted = (?var, pst1)]?varpst1f1p1f2p1p2pst1p1pst1matV[hasMod = (?var, ?var)]?var?varf1p1f2p1matV[posted = (?var, pst2)]?varpst2p1pst2=P1 :?var?varpst1matV[hasMod = (?var, ?var), posted = (?var, pst1)]f2p1pst1f1p1pst1P2 :matV[hasMod = (?var, ?var), posted = (?var, pst2)]?var?varpst2f2p1pst2f1p1pst2matV[reply = (?var, pst2)]?varpst2com1pst2P3 : 6 Fig. 8: Data structures utilized by Algorithm TRIC to cluster query graph patterns. Input: Update ui = (ei) : ei = (s, t) Output: Locate matched queries 1 af f ectedT ries ← edgeInd[ei]; // Get affected tries 2 foreach Ti ∈ af f ectedT ries do 3 4 5 6 foreach node ni ∈ Ti do // Traverse Ti in DFS f ndP os ← n ; // Store the position break ; if edge(nc) = ei then // If current node indexes ei // Terminate the traversal 1 (cid:112) (cid:101) (cid:116) (cid:83) // Update matV s of f ndP os and its children af f ectedQueries ← Trie Traversal & Materialization (f ndP os) 7 8 foreach query Qi ∈ af f ectedQueries do 9 10 11 results ← results 1 matV [Pi]; results ← Ø; foreach Pi ∈ Qi do // For the covering paths of Qi ; 12 13 if results (cid:54)= Ø then mark Matched(Qi); Fig. 9: Query answering phase ((cid:83)(cid:116)(cid:101)(cid:112) 1) of Algorithm TRIC. Fig. 10: Updating materialized views. (where ei is indexed under ni) is connected with the source node s ∈ ei+1 : ei+1 ∈ chn(ni) of the parent node ni. Finally, for each covering path Pi ∈ CP (Qi) TRIC maintains information about the vertices that intersected in the original query graph pattern Qi; this information is utilized during the query answering phase. 4.2 Query Answering Phase During the evolution of the graph, a constant stream of updates S = (u1, u2, . . . , uk) arrives at the system. For each update ui ∈ S Algorithm TRIC performs the following steps: 1. Determines which tries are affected by update ui and proceeds in examining them. 2. While traversing the affected tries, performs the materializa- tion and prunes sub-tries that are not affected by ui. In the following, we describe each step of the query answering phase of Algorithm TRIC. The pseudocode for each step is provided in Figs. 9 and 11. (cid:83)(cid:116)(cid:101)(cid:112) 1 : Locate and Traverse Affected Tries. When an up- date ui arrives at the system, Algorithm TRIC utilizes the edge ei ∈ ui to locate the tries that are affected by ui. To achieve this, TRIC uses the hash table edgeInd to obtain the list of tries that contain ei in their children set. Thus, Algorithm TRIC receives a list (af f ectedT ries) that contains all the tries that were affected by ui and must be examined (Fig. 9, line 1). Subsequently, Algorithm TRIC proceeds into examining each trie Ti ∈ af f ectedT ries by traversing each Ti in order to locate the node ni that indexes edge ei ∈ ui. When node ni is located, the algorithm proceeds in (cid:83)(cid:116)(cid:101)(cid:112)2 of the query answering process described below (Fig. 9, lines 3 − 7). Example 4. Let us consider the data structures presented in Fig. 8, the materialized views in Fig. 10, and an update u1 = (posted = (p2, pst1)) that arrives into the evolv- ing graph (Fig. 10(a)). Algorithm TRIC prompts hash table edgeInd and obtains list {&T1, &T3}. Subsequently, TRIC will traverse tries T1 and T3. When traversing trie T1 TRIC locates node n2 that matches update e1 ∈ u1 and proceeds in (cid:83)(cid:116)(cid:101)(cid:112)2 (described below). Finally, when traversing T3 TRIC will stop the traversal at root node n6 as its materialized view is empty matV [hasCreator = (pst1, ?var)] = Ø (Fig. 10 (b)), thus all sub-tries will yield empty materialized views. (cid:83)(cid:116)(cid:101)(cid:112) 2 : Trie Traversal and Materialization. Intuitively, a trie path {n0 → . . . ni → . . . nk} represents a series of joined materialized views matV s = {matV 1, matV 2 , . . . , matV k}. Each materialized view matV i ∈ matV s corresponds to a node ni that stores edge ei and the materialized view matV i. The materialized view contains the results of the join operation between the matV [ei] and the materialized view of the parent node ni (matV (prnt(ni)]), i.e., matV i = matV [prnt(ni)] 1 matV [ei]. Thus, when an update ui affects a node ni in this "chain" of joins, ni's and its children's (chn(ni)) materialized views must be updated with ui. Based on this TRIC searches for and locates node ni inside Ti that is affected by ui and updates ni's sub-trie. After locating node ni ∈ Ti that is affected by ui, Algo- rithm TRIC continues the traversal of ni's sub-trie and prunes the remaining sub-tries of Ti (Fig. 9, line 7). Subsequently, TRIC (a)(c)(b)pst1?varmatV[hasCreator = (pst1, ?var)]=matV[posted = (?var, pst1)]matV[n1]matV[n2]u1p2pst1p1pst1?varpst1?var?varpst1f2p2pst1f2p1pst1f1p1pst1?var?varf1p1f2p1f2p2=∅pst1?varmatV[containedIn = (pst1, ?var)]matV[n2]?var?varpst1f2p2pst1f2p1pst1f1p1pst1 Function: Trie Traversal & Materialization Input: Node ni Output: Locate matched queries // Update the current materialized view by joining the parent materialized view with the materialized view of the edge in node ni 1 result ← matV [prnt(ni)] 1 matV [edge(ni)]; 2 if result = Ø then 3 return; 2 (cid:112) (cid:101) (cid:116) (cid:83) // Store the query identifiers of node ni 4 af f ectedQueries ← af f ectedQueries ∪ qIDs(ni); 5 foreach nc ∈ chn(ni) do 6 Trie Traversal & Materialization (nc); // Recursively update the matV s of ni's children 7 return af f ectedQueries ; // Return the affected qIDs Fig. 11: Query answering phase ((cid:83)(cid:116)(cid:101)(cid:112) 2) of Algorithm TRIC. updates the materialized view of ni by performing a join operation between its parent's node materialized view matV [prnt(ni)] and the update ui, i.e., results = matV [prnt(ni)] 1 ui. Notice, that Algorithm TRIC calculates the subgraphs formulated by the current update solely based on the update u1 and does not perform a full join operation between matV [prnt(ni)] and the updated results are then stored in the matV [edge(ni)], corresponding matV [ni]. For each child node nj ∈ chn(ni), TRIC updates its corre- sponding materialized view by joining its view matV [nj] that corresponds to the edge that it stores (given by matV [edge(nj)]) with its parent node materialized view matV [ni] (Fig. 11, lines 1 − 7). If at any point the process of joining the material- ized views returns an empty result set the specific sub-trie is pruned, while, the traversal continues in a different sub-trie of Ti (Fig. 11, lines 5 − 6). Subsequently, for each trie node nj in the trie traversal when there is a successful join operation among matV [ej] : ej ∈ nj and matV [ni], the query identifiers indexed under nj are stored in af f ectedQueries list (Fig. 11, lines 4 and 7). Note that similarly to before, only the updated part of a materialized view is utilized as the parent's materialized view, an approach applied on database-management system [32]. Example 5. Let us consider the data structures presented in Fig. 8, Fig. 10, and an update u1 = (posted = (p2, pst1)) that arrives into the evolving graph. After locating the affected trie node n2 (described in Example 4) TRIC proceeds in updating the materialized view of n2, i.e., matV [n2], by calculating the join operation between its parents materialized view, i.e., matV [n1] and the update u1. Fig. 10, demonstrates the opera- tions of joining matV [n2] with update u1, the result of the op- eration is tuple (f 2, p2, pst1), which is added into matV [n2], presented in Fig. 10(a). While the query identifiers of n2 (i.e., Q1) are indexed in af f ectedQueries. Finally, TRIC proceeds in updating the sub-trie of n2, node n3, where the updated tuple (f 2, p2, pst1) is joined with matV [edge(n3)] (i.e., matV [containedIn = (pst1, ?var)]). This operation yields an empty result (Fig. 10(c)), thus terminating the traver- sal. Finally, to complete the filtering phase Algorithm TRIC it- erates through the affected list of queries and performs the join operations among the paths that form a query, thus, yielding the final answer (Fig. 9, lines 8 − 13). The time complexity, of Algorithm TRIC when filtering an update ui, is calculated as follows: The traversal complexity is (cid:79)(T ∗ (Pm ∗ B)), where T denotes the number of tries that 7 is (cid:79)(N ∗ M ). Finally, contain ei ∈ ui, Pm denotes the size of the longest trie path, and B the branching factor. The time complexity of joining two materialized views matV 1 and matV 2, where matV 1 = N and matV 2 = M, time the total complexity is calculated as (cid:79)((T ∗ (Pm ∗ B)) ∗ (N ∗ M )). Caching. During (cid:83)(cid:116)(cid:101)(cid:112) 2, two materialized views are joined using a typical hash join operation with a build and a probe phase. In the build phase, a hash table for the smallest (in the number of tuples) table is constructed, while in the probe phase the largest table is scanned and the hash table is probed to perform the join. Algorithm TRIC discards all the data structures and intermediate results after the join operation commences. In order to enhance this resource intensive operation, we cache and reuse the data structures generated during the build and probe phases as well as the intermediate results whenever possible. This approach consti- tutes an extension of our proposed solution (Algorithm TRIC) and it is coined TRIC+. 5 ADVANCED BASELINES Since no prior work in the literature considers the problem of continuous multi-query evaluation, we designed and implemented Algorithms INV and INC, two advanced baselines that utilize inverted index data structures. Finally, we provide a third baseline that was based on the well-established graph database Neo4j [14]. 5.1 Algorithm INV Algorithm INV (INVerted Index), utilizes inverted index data structures to index the query graph patterns. The inverted index data structure is able to capture and index common elements of the graph patterns at the edge level during indexing time. Subsequently, the inverted index is utilized during filtering time to determine which queries have been satisfied. In the following sections we describe the query indexing and answering phase of INV. The Query Indexing Phase of Algorithm INV, for each query graph pattern Qi, is performed in two steps: (1) Transforming the original query graph pattern Qi into a set of path conjuncts, that cover all vertices and edges of Qi, and when combined can effectively re-compose Qi, and finally, indexing those covering paths in a matrix along the unique query identifier, (2) Indexing all edges ei ∈ Qi into an inverted index structure. In the following, we present each step of the query indexing phase of INV and give details about the data structures utilized. (cid:83)(cid:116)(cid:101)(cid:112) 1 : Extracting the Covering Paths. In the first step of the query indexing phase, Algorithm INV decomposes a query graph Qi into a set of paths CP , a process described in detail in Section 4.1. Thus, given the query set presented in Fig. 5 (a), INV yields the same set of covering paths CP (Fig. 5 (b)). Finally, the covering path set CP is indexed into an array (queryInd) with the query identifier of Qi. (cid:83)(cid:116)(cid:101)(cid:112) 2 : Indexing the Query Graph. Algorithm INV builds three inverted indexes, where it stores the structural and attribute constrains of the query graph pattern Qi. Hash table edgeInd indexes all edges ei ∈ QDB (keys), and the respective query identifiers as values, hash table sourceInd indexes the source vertices of each edge (key), where the edges are indexed as values , and hash table targetInd that indexes the target vertices of each edge (key), where the edges are indexed as values. In Fig. 5(a) we present four query graph patterns, and in Fig. 12 the data structures 8 e1−→ v2 view that corresponds to it (i.e., matV [ec]) and updates the set of materialized views matV s = {matV 1, matV 2, . . . , matV k} that correspond to the current path. For example, given an already e2−→ v3} its materialized view visited path P = {v1 matV [P ] will be generated, by matV [P ] = matV [e1] 1 matV [e2]. When visiting the next edge en, a new path P (cid:48) is generated and its materialized view matV [P (cid:48)] = matV [P ] 1 matV [en] will be generated. If at any point, the process of joining the materialized views yields an empty result set the examination of the edge is terminated (pruning). This allows us to prune paths that are not going to satisfy any Qi ∈ af f ectedQueries. If a path Pi yields a successful series of join operations (i.e., matV [Pi] (cid:54)= Ø), it is marked as matched. subgraphs Algo- rithm INV iterates through the affected list of queries qIDs ∈ af f ectedQueries and performs the final join operation among all the paths that comprise the query. Caching. In the spirit of Algorithm TRIC+ (Section 4.2), we de- veloped an extension of Algorithm INV, namely Algorithm INV+, that caches and reuses the calculated data structures of the hash join phase. to produce the final answer Finally, 5.2 Algorithm INC Based on Algorithm INV we developed an algorithmic extension, namely Algorithm INC. Algorithm INC utilizes the same inverted index data structures to index the covering paths, edges, source and target vertices as Algorithm INV, while the examination of a path affected during query answering remains similar. The key difference lies in executing the joining operations between the materialized views that correspond to edges belonging to a path. More specifically, when Algorithm INV executes a series of joins between the materialized views (that formulate a path) to determine which subgraphs match a path; it utilizes all tuples of each materialized view that participate in the joining process. On the other hand, Algorithm INC makes use of only the update ui and thus reduces the number of tuples examined through out the joining process of the paths. Caching. In the spirit of Algorithm TRIC+ (Section 4.2), we de- veloped an extension of Algorithm INC, namely Algorithm INC+, that caches and reuses the calculated data structures of the hash join phase. 5.3 Neo4j To evaluate the efficiency of the proposed algorithm against a real- world approach, we implemented a solution based on the well- established graph database Neo4j [14]. In this approach, we ex- tend Neo4j's native functionality with auxiliary data structures to efficiently store the query set. They are used during the answering phase to located affected queries and execute them on Neo4j. The Query Indexing Phase. To address the continuous multi- query evaluation scenario, we designed main-memory data struc- tures to facilitate indexing of query graph patterns. To this end, each query graph pattern Qi is indexed in three steps: (1) Qi is converted into Neo4j's native query language Cypher2, (2) indexing each query in a matrix (queryInd), and (3) indexing all edges ei ∈ Qi by an inverted index structure (edgeInd), where ei is used as key and a collection of query identifiers as values (similarly to Algorithms INV/INC Fig. 12). Fig. 12: Data structures utilized by Algorithm INV to index query graph patterns. of INV when indexing those queries. Finally, INV applies the same techniques of handling variables as Algorithm TRIC (Section 4.1). The Query Answering Phase of Algorithm INV, when a constant stream of updates S = (u1, u2, . . . , uk) arrives at the system, is performed in three steps: (1) Determines which queries are affected by update ui, (2) Prompts the inverted index data structure and determines which paths have been affected by update ui, (3) Performs the materialization while querying the inverted index data structures. In the following, we describe each step of the query answering phase: (cid:83)(cid:116)(cid:101)(cid:112) 1 : Locate the Affected Queries. When a new update ui arrives at the system, Algorithm INV utilizes the edge ei ∈ ui to locate the queries that are affected, by querying the hash table edgeInd to obtain the query identifier qIDs that con- tain ei. Subsequently, the algorithm iterates through the list of af f ectedQueries and checks each query Qi ∈ qIDs. For each query Qi the algorithm checks ∀ei ∈ Qi if matV [ei] (cid:54)= Ø, i.e., each ei should have a non empty materialized view. The check is performed by iterating through the edge list that is provided by queryInd and a hash table that keeps all materialized views present in the system. Intuitively, a query Qi is candidate to match, as long as, all materialized views that correspond to its edges can be used in the query answering process. (cid:83)(cid:116)(cid:101)(cid:112) 2 : Locate the Affected Paths. Algorithm INV proceeds to examine the inverted index structures sourceInd and targetInd by making use of ei ∈ ui. INV queries sourceInd and targetInd to determine which edges are affected by the update, by utilizing the source and target vertices of update ui. INV examines each current edge ec of the affected edge set and recursively visits all edges connected to ec, which are determined by querying the sourceInd and targetInd. While examining the current edge ec, INV checks if ec is part of af f ectedQueries, if not, the examination of the specific path is pruned. For efficiency reasons, the examination is bound by the maximum length of a path present in af f ectedQueries which is calculated by utilizing the queryInd data structure. (cid:83)(cid:116)(cid:101)(cid:112) 3 : Path Examination and Materialization. While INV examines the paths affected by update ui ((cid:83)(cid:116)(cid:101)(cid:112) 2), it performs the materialization on the currently examined path. More specifically, while INV searches through the paths formulated by the visits of edge sets determined by targetInd and sourceInd, it maintains a path Pc = {v1 ek−→ vk+1} that corresponds to the edges already visited. e2−→ . . . vk e1−→ v2 While, visiting each edge ec, INV accesses the materialized 2. https://neo4j.com/developer/cypher/ The Query Answering Phase. Each update that is received as part of an incoming stream of updates S = (u1, u2, . . . , uk) is processed as follows: (1) an incoming update ui is applied to Neo4j (2) by querying the inverted index edgeInd with ei ∈ ui, it is determined which queries are affected, (3) all affected queries are retrieved from matrix queryInd and the appropriate parame- ters are set, (4) the affected queries are executed. To enhance performance, the following configurations are applied: (1) the graph database builds indexes on all labels of the schema allowing for faster look up times of nodes, (2) the execution of Cypher queries employs the parameters syntax3 as it enables the execution planner of Neo4j to cache the query plans for future use, (3) the number of writes per transaction4 in the database and the allocated memory were optimized based on the hardware configuration (see Section 6.1). 6 EXPERIMENTAL EVALUATION In this section we present the data and query sets, the algorithmic and technical configuration, the metrics employed and finally, present and extensively discuss the experimental evaluation re- sults. 6.1 Experimental Setup Data and Query Sets. For the experimental evaluation we used a synthetic and two real-world datasets. The SNB Dataset. The first dataset we utilized is the LDBC Social Network Benchmark (SN B) [13]. SN B is a synthetic benchmark designed to accurately simulate the evolution of a social network through time (i.e, vertex and edge sets labels, event distribution etc). This evolution is modeled using activities that occur inside a social network (i.e. user account creation, friendship linking, content creation, user interactions etc). Based on the SN B generator we simulated the evolution of a graph consisting of user activities over a time period of 2 years. From this dataset we derived 3 query loads and configurations: (i) a set with a graph size of GE = 100K edges and GV = 57K vertices, (ii) a set with a graph size of GE = 1M edges and GV = 463K vertices, and (iii) a set with a graph size of GE = 10M edges and GV = 3.5M. The NYC Dataset. The second dataset we utilized is a real world set of taxi rides performed in New York City (T AXI) in 2013 [33] utilized in DEBS 2015 Grand Challenge [34]. T AXI contains more that 160M entries of taxi rides with information about the license, pickup and drop-off location, the trip distance, the date and duration of the trip, and the fare. We utilized the available data to generate a stream of updates that result in a graph of GE = 1M edges and GV = 280K, accompanied by a set of 5K query graph patterns. The BioGRID Dataset. The third dataset we utilized is Bi- oGRID [35], a real world dataset that represents protein to protein interactions. This dataset is used as a stress test for our algorithms since it contains one type of edge (interacts) and vertex (protein), and thus every update affects the whole query database. We used BioGRID to generate a stream of updates that result in a graph size of GE = 1M edges and GV = 63K vertices, with a set of 5K query graph patterns. 3. https://neo4j.com/docs/cypher-manual/current/syntax/parameters/ 4. https://neo4j.com/docs/cypher-manual/current/introduction/transactions/ 9 Query Set Configuration. In order to construct the set of query graph patterns QDB we identified three distinct query classes that are typical in the relevant literature: chains, stars, and cycles [20], [36]. Each type of query graph pattern was chosen equiprobably during the generation of the query set. The baseline values for the query set are: (i) an average size (cid:108) of 5 edges/query graph pattern, a value derived from the query workloads presented in SN B [13], (ii) a query database QDB size of 5K graph patterns, (iii) a factor that denotes the percentage of the query set QDB that will ultimately be satisfied, denoted as selectivity σ = 25%, and (iv) a factor that denotes the percentage of overlap between the queries in the set, (cid:111) = 35%. Metrics. In our evaluation, we present and discuss the filtering and indexing time of each algorithm, along with the total memory requirements. Technical Configuration. All algorithms were implemented in Java 8 while for the materialization implementation the Stream API was employed. The Neo4j-based approach was implemented using the embedded version of Neo4j 3.4.7. Extensive experi- mentation evaluation concluded that a transaction5 can perform up to 20K writes in the database without degrading Neo4j's performance, while in order to ensure indexes are cached in main memory 55GB of main memory were allocated. A machine with Intel(R) Xeon(R) Processor E5-2650 at 2.00GHz, 64GB RAM, and Ubuntu Linux 14.04 was used. The time shown in the graphs is wall-clock time and the results of each experiment are averaged over 10 runs to eliminate fluctuations in measurements. 6.2 Results for the SNB Dataset In this section, we present the evaluation for the SN B benchmark and highlight the most significant findings. Query Answering Time. Fig. 13(a) presents the results regarding the query answering time, i.e., the average time in milliseconds needed to determine which queries are satisfied by an incoming update, against a query set of QDB = 5K. Please notice that the y-axis is split due to the high differences in the performance of TRIC/TRIC+and its competitors. We observe that the answering time increases for all algorithms as the graph size increases. Algorithms TRIC/TRIC+ achieve the lowest answering times, suggesting better performance. Contrary, the competitors are more sensitive in graph size changes, with Algorithm INV performing the worst (highest query answering time). When comparing Algo- rithm TRIC to INV, INC and Neo4j the query answering time is improved by 99.15%, 98.14% and 91.86% respectively, while the improvement between INC and INV is 54.33%. Finally, compar- ing Algorithm TRIC+ to INV+, INC+ and Neo4j demonstrates a performance improvement of 99.62%, 99.17% and 96.74% respectively, while the difference of INC+ and INV+ is 54.6%. The results (Fig. 13(a)) suggest that all solutions that im- plement caching are faster compared to the versions without it. In more detail, Algorithms TRIC+/INV+/INC+ are consis- tently faster than their non-caching counterparts, by 59.95%, 9.36% and 9.91% respectively. This is attributed to the fact that Algorithms TRIC/INV/INC, have to recalculate the probe and build structures required for the joining process, in contrast to Algorithms TRIC+/INV+/INC+ that store these structures and incrementally update them, thus providing better performance. 5. https://neo4j.com/docs/cypher-manual/current/introduction/transactions/ 3500 3000 2500 2000 1500 1000 500 15 6.0 5.0 4.0 3.0 2.0 1.0 0.0 ) e t a d p u / c e s m ( e m i t g n i r e w s n A Neo4j INV INV+ INC INC+ TRIC TRIC+ 3 5 7 9 Varying (cid:108) ) e t a d p u / c e s m ( e m i t g n i r e w s n A 250 200 150 100 50 20 3.0 2.5 2.0 1.5 1.0 0.5 0.0 25% INV INV+ INC INC+ Neo4j TRIC TRIC+ ) e t a d p u / c e s m ( e m i t g n i r e w s n A 35% 45% Varying (cid:111) 55% 65% 20 10 8 6 4 2 0 100 57 106 149 * ** 2000 1500 1000 500 INV INV+ INC INC+ Neo4j TRIC TRIC+ ) e t a d p u / c e s m ( e m i t g n i r e w s n A 200 180 160 140 120 100 80 60 40 20 2.0 1.5 1.0 0.5 0.0 10 16 22 INV INV+ INC INC+ Neo4j TRIC TRIC+ 10 20 30 Graph size (Vertices x1000) 28 43 33 38 50 40 70 Graph size (Edges x1000) 60 48 52 57 80 90 100 ) e t a d p u / c e s m ( e m i t g n i r e w s n A INV INV+ INC INC+ Neo4j TRIC TRIC+ 350 300 250 200 150 100 50 20 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 10% 10 ) e t a d p u / c e s m ( e m i t g n i r e w s n A TRIC+ TRIC Neo4j INC+ INC INV+ INV 1000 100 10 1 0 1000 3000 Varying QDB 5000 15% 20% Varying σ 25% 30% (a) Query answering time for QDB = 5K, (cid:108) = 5, σ = 25%, (cid:111) = 35% and GE = 10K to GE = 100K. (b) Query answering time for QDB = 5K, (cid:108) = 5, (cid:111) = 35%, GE = 100K and σ = 10% to σ = 30%. (c) Query answering time for GE = 100K, (cid:108) = 5, (cid:111) = 35%, σ = 25%, and QDB = 1K to QDB = 5K. Graph size (Vertices x1000) 188 318 270 226 367 415 463 200 300 400 500 600 700 800 900 1000 Graph size (Edges x1000) (d) Query answering time for QDB = 5K, (cid:111) = 35%, σ = 25%, GE = 100K, and (cid:108) = 3 to (cid:108) = 9. (e) Query answering time for QDB = 5K, (cid:108) = 5, σ = 25%, GE = 100K, and (cid:111) = 25% to (cid:111) = 65%. Fig. 13: Results for the SN B dataset. (f) Query answering time for QDB = 5K, (cid:108) = 5, σ = 25%, (cid:111) = 35% and GE = 100K to GE = 1M. In Fig. 13(b) we present the results when varying the parameter σ, for 10%, 15%, 20%, 25% and 30% of a query set for QDB = 5K and GE = 100K. In this setup the algorithms are evaluated for a varying percentage of queries that match. A higher number of queries satisfied, increases the number of calculations performed by each algorithm. The results show that all algorithms behave in a similar manner as previously described. In more detail, Algorithm TRIC+ is the most efficient of all, and thus the fastest among the extensions that utilize caching, while TRIC is the most efficient solution among the solutions that do not employ a caching strategy. Finally, the percentage differences, between the algorithmic solutions remain the same as before in most cases. In Fig. 13(c) we give the results of the experimental eval- uation when varying the size of the query database QDB. More specifically, we present the answering time per triple when QDB = 1K, 3K and 5K, and GE = 100K. Please notice the y-axis is in logarithmic scale. The results demonstrate that all algorithm's behavior is aligned with our previous observa- tions. More specifically, Algorithms TRIC+ and TRIC exhibit the highest performance (i.e., lowest answering time), throughout the increase of QDBs, and thus determine faster which queries of QDB have matched given an update ui. Similarly to the previous setups, the competitors have the lowest performance, while Algorithms INC and INC+ perform better compared to INV and INV+. In Fig. 13(d) we give the results of the experimental evaluation when varying the average query size (cid:108). More specifically, we present the answering time per triple when (cid:108) = 3, 5, 7 and 9 of a query set for QDB = 5K and GE = 100K. We observe that the answering time increases for all algorithms as the average query length increases. More specifically, Algorithms TRIC+ and TRIC exhibit the highest performance (i.e., lowest answering time), throughout the increase of (cid:108)s, and thus determine faster which queries have been satisfied. Similarly to the previous eval- uation setups, the Algorithms INV/INV+/INC/INC+/Neo4j have the lowest performance, and increase significantly their answering time when (cid:108) increases, while Algorithms INC and INC+ perform better compared to INV, INV+ and Neo4j when (cid:108) = 9. In Fig. 13(e) we give the results of the experimental evaluation when varying the parameter (cid:111), for 25%, 35%, 45%, 55% and 65% of a query set for QDB = 5K and GE = 100K. In this setup the algorithms are evaluated for varying percentage of query overlap. A higher number of query overlap, should decrease the number of calculations performed by algorithms designed to exploit commonalities among the query set. The results show that all algorithm behave in a similar manner as previously described, while AlgorithmsINV/INV+/INC/INC+ observe higher performance gains. Algorithm TRIC+ is the most efficient of all, and thus the fastest among the extensions that utilize caching techniques, while TRIC is the most efficient solution among the solutions that do not employ caching. Fig. 13(f) presents the results regarding the query answer- ing time, for all algorithms when indexing a query set of QDB = 5K and a final graph size of GE = 1M and GV = 463K. Given the extremely slow performance of some algorithms we have set a execution time threshold of 24 hours, for all algorithms under evaluation, thus, when the threshold was crossed the evaluation was terminated. We again observe that the answering time increases for all algorithms as the graph size increases. Algorithms TRIC/TRIC+ achieve the lowest an- 463 829 1128 ) e t a d p u / c e s m ( e m i t g n i r e w s n A 30 25 20 15 10 5 0 1 2 3 Graph size (Vertices x1000) 1444 1878 2159 2465 * * TRIC Neo4j TRIC+ 5 4 7 Graph size (Edges x106) 6 2820 3146 3531 8 9 10 ) y r e u q / c e s m ( e m i t g n i x e d n I 1.00 0.10 0.01 0.00 1 11 INC+ INC TRIC+ TRIC INV+ INV Neo4j 2 3 4 5 Varying QDB (x1000) Fig. 14: Query answering time for QDB = 5K, (cid:108) = 5, σ = 25%, (cid:111) = 35% and GE = 1M to GE = 10M. Fig. 15: Query insertion time for (cid:108) = 5, σ = 25%, (cid:111) = 35% and QDB = 1K to QDB = 5K. swering times, suggesting better performance. Contrary, the Al- gorithms INV/INV+/INC/INC+ are more sensitive in graph size changes and thus fail to terminate within the time threshold. More specifically, Algorithms INV/INV+ time out at GE = 210K, while Algorithms INC/INC+ time out at GE = 310K as denoted by the asterisks in the plot. When comparing Algorithms TRIC and TRIC+ to Neo4j the query answering is improved by 77.01% and 92.86% respectively. Fig. 14 presents the results regarding the query answering time, for Algorithms TRIC, TRIC+ and Neo4j when indexing a query set of QDB = 5K and a final graph size of GE = 10M and GV = 3.5M. Again, we have set an execution time thresh- old of 24 hours, for all the algorithms under evaluation. In this experimental setup, we observe that the answering time increases for all algorithms as the graph size increases. Algorithm TRIC+ achieves the lowest answering times, suggesting better perfor- mance, while Algorithms TRIC and Neo4j fail to terminate within the given time threshold. More specifically, Algorithm TRIC times out at GE = 5.47M, while Algorithm Neo4j times out at GE = 4.3M as denoted by the asterisks in the plot. Overall, Algorithms TRIC+ and TRIC, the two solutions that utilize trie structures to capture and index the common structural and attribute restrictions of query graphs achieve the lowest query answering times, compared to Algorithms INV/INV+/INC/INC+ that employ no clustering techniques, as well as when com- pared with commercial solutions such as Neo4j. Additionally, adopting the incremental joining techniques (found in Algo- rithm TRIC) into Algorithm INC does not seem to significantly improve its performance when compared to Algorithm INV. In the same manner, adopting caching techniques that store the data structures generated during the join operations, change sig- nificantly the performance of the algorithms applied on, i.e., Algorithms TRIC+/INV+/INC+. Taking all the above into con- sideration, we conclude that the algorithms that utilize trie-based indexing are able to achieve low query answering times compared to their competitors. Indexing Time. Fig. 15 presents the indexing time in milliseconds required to insert 1, 000 query graph patterns when the query database size increases. We observe that the time required to go from an empty query database to a query database of size 1, 000 is higher compared to the time required for the next iterations of the query database. Please notice the y-axis is in logarithmic scale. This can be explained as follows, all algorithms utilize data structures that need to be initialized during the initial stages of query indexing phase, i.e. when inserting queries in an empty database, additionally as the queries share common restrictions less time is required for creating new entries in the data structures of algorithms. Additionally, the time required to index a query graph pattern in the database does not vary significantly for all algorithms. Notice that query indexing time is not a critical performance parameter in the proposed paradigm, since the most important dimension is query answering time. 6.3 Results for the NYC and BioGRID Dataset In this section, we present the evaluation for the N Y C and BioGRID dataset and highlight the most significant findings. The N Y C Dataset. Fig. 16(a) presents the results from the eval- uation of the algorithms for the N Y C dataset. More specifically, we present the results regarding the query answering performance of all algorithms when QDB = 5K, (cid:108) = 5, (cid:111) = 35%, σ = 25% and an execution time threshold of 24 hours. Please notice that the y-axis is split due to high differences in the performance of the algorithms. Algorithms INV and INV+ fail to terminate within the time threshold and time out at GE = 210K and GE = 300K respectively. Similarly, Algorithms INC and INC+ time out at GE = 220K and 360K respectively. When comparing Algorithms TRIC and TRIC+ to Neo4j the query an- swering is improved by 59.68% and 81.76% respectively. These results indicate that again an algorithmic solution that exploits and indexes together the common parts of query graphs (i.e., Algo- rithms TRIC/TRIC+) achieves significantly lower query answer- ing time compared to approaches that do not apply any clustering techniques (i.e., AlgorithmsINV/INV+INC/INC+/Neo4j). The BioGRID Dataset. Figs. 16(b) and 16(c) present the results from the evaluation of the algorithms for the BioGRID dataset. In Fig. 16(b) we present the results regarding the query answering performance of the algorithms, when QDB = 5K, σ = 25% for a final graph size of GE = 100K and GV = 17.2K. Additionally, we set an execution time threshold of 24 hours due to the high differences in the performance of the algorithms. The BioGRID dataset serves as a stress test for our algorithms, since it contains only one type of edge and vertex, thus each incoming update will affect (but not necessarily satisfy) the entire query database. To this end, Algorithms INV/INV+/INC exceed the time threshold and time out at GE = 50K, while INC+ times out at GE = 60K as denoted by the asterisks in the plot. Finally, Fig. 16(c) presents the results for the BioGRID dataset for a final graph size of GE = 1M and GV = 63K. We again observe that Algorithms TRIC and TRIC+ achieve the lowest answering 70 96 ** * * TRIC+ TRIC 44 800 700 600 500 400 300 200 100 25 12 10 8 6 4 2 0 100 ) e t a d p u / c e s m ( e m i t g n i r e w s n A Graph size (Vertices x1000) 121 147 174 202 228 254 280 6.4 7.6 11.9 Graph size (Vertices x1000) 15.0 15.7 16.2 16.5 * * * * INV INV+ INC INC+ Neo4j INV INV+ INC INC+ Neo4j ) e t a d p u / c e s m ( e m i t g n i r e w s n A 5000 4000 3000 2000 1000 100 14 12 10 8 6 4 2 0 TRIC TRIC+ 200 300 400 500 600 700 800 900 1000 10 20 30 Graph size (Edges x1000) 50 40 70 Graph size (Edges x1000) 60 16.8 17.1 17.2 17 27 29 180 160 140 120 100 80 60 40 20 ) e t a d p u / c e s m ( e m i t g n i r e w s n A 80 90 100 0 100 200 300 12 58 61 63 800 900 1000 Graph size (Vertices x1000) 35 54 44 48 * Neo4j TRIC TRIC+ 500 400 700 Graph size (Edges x1000) 600 (a) Query answering time for QDB = 5K, σ = 25% and GE = 100K to 1M. (b) Query answering time for QDB = 5K, σ = 25% and GE = 10K to 100K. (c) Query answering time for QDB = 5K, σ = 25% and GE = 100K to 1M. Fig. 16: Results for (a) the T AXI dataset, (b) & (c) the BioGRID dataset. TABLE 1: Memory usage for QDB = 5K, (cid:108) = 5, σ = 25%, (cid:111) = 35% and GE = 100K. Algorithm TRIC TRIC+ INV INV+ INC INC+ Neo4j SN B 201MB 248MB 205MB 228MB 206MB 228MB 443MB Dataset N Y C 257MB 273MB 273MB 381MB 273MB 378MB 590MB BioGRID 233MB 262MB 271MB50K 301MB50K 270MB50K 310MB60K 314MB time, while Neo4j exceeds the time threshold and times out at GE = 550K. As it is demonstrated from the results yielded by the evaluation, Algorithms TRIC and TRIC+ are the most efficient of all; this is attributed to the fact that both algorithms create a combined representation of the query graph patterns that can efficiently be utilized during query answering time. Comparing Memory Requirements. Table 1 presents the mem- ory requirements of each algorithm, for the SN B, N Y C and BioGRID datasets when indexing QDB = 5K and a graph of GE = 100K. We observe, that across all datasets, Al- gorithms TRIC, INV and INC have the lowest main memory requirements, while, Algorithms TRIC+, INV+, INC+ and Neo4j exhibit higher memory requirements. The higher memory re- quirements of algorithms that employ a caching strategy, (i.e., Algorithms TRIC+/INV+/INC+) is attributed to the fact that all structures calculated during the materialization phase are kept in memory for future usage; this results in higher memory re- quirements compared to algorithms that do not apply this caching technique (i.e., Algorithms TRIC/INV/INC). Finally, Neo4j is a full fledged database management system, thus it occupies more memory to support the required specifications. 7 APPLICATIONS In this section, we briefly discuss additional application scenarios for continuous query evaluation over graph streams. Social Networks. Social network graphs emerge naturally from the evolving social interactions and activities of the users. Many applications such as advertising, recommendation systems, and in- formation discovery can benefit from continuous pattern matching. Prompt identification of influential users and active monitoring of content propagation inside the network could increase the effec- tiveness in those applications. In such scenarios, applications may leverage on sub-graph matching where patterns already observed in social networks can be utilized [37], [38], [39]. Finally, real- time reporting of influential users could be achieved through monitoring of the dissemination of posts inside the network [40], [28]. Protein Interaction Graphs. Protein-protein interaction (PPI) graphs are important data repositories in which proteins are represented as vertices and identified interactions between them as edges. PPI graphs are typically stored in central repositories [35], [6], where they are constantly updated due to new protein interaction additions and invalidation of existing interactions. Scientists are typically forced to manually query these repositories on a regular basis to discover new patterns they are interested in, since the existing tools are unable to capture new patterns in the evolving graphs. Therefore, there is a clear need for an efficient solution that provides the continuous subgraph matching functionality over PPI graphs. Other Domains. The techniques proposed in this paper can also be applied in a wide range of domains such as cybersecurity, knowledge graphs, road network monitoring, and co-authorship graphs. In cybersecurity, subgraph pattern matching could be applied to monitor the network traffic and capture denial of service and exfiltration attacks [41]. In road network monitoring, subgraph pattern matching could be applied to capture traffic congestion events, and taxi route pricing [33]. In the domain of co-authorship graphs, users may utilize the continuous query evaluation algorithms in services similar to Google Scholar Alerts, when requesting to be notified about newly published content, by making use of appropriate graphical user interface tools. 8 CONCLUSIONS AND OUTLOOK In this work, we proposed a new paradigm to efficiently capture the evolving nature of graphs through query graph patterns. We proposed a novel method that indexes and continuously eval- uates queries over graph streams, by leveraging on the shared restrictions present in query sets. We evaluated our solution using three different datasets from social networks, transportation and biological interactions domains, and demonstrated that our approach is up to two orders of magnitude faster when compared to typical join-and-explore inverted index solutions, and the well- established graph database Neo4j. We plan on extending our 13 [32] A. Gupta, I. S. Mumick, and V. S. Subrahmanian, "Maintaining Views Incrementally," in ACM SIGMOD, 1993. [33] C. Whong, "FOILing NYC's Taxi Trip Data," 2014. [Online]. Available: https://chriswhong.com/open-data/foil nyc taxi/ [34] Z. Jerzak and H. Ziekow, "The DEBS 2015 grand challenge," in ACM DEBS, 2015. [35] C. Stark, B.-J. Breitkreutz, T. Reguly, L. Boucher, A. Breitkreutz, and M. Tyers, "BioGRID: a general repository for interaction datasets," Oxford Academic NAR, 2006. [36] J. Mondal and A. Deshpande, "CASQD: continuous detection of activity- based subgraph pattern queries on dynamic graphs," in ACM DEBS, 2016. [37] J. Leskovec, A. Singh, and J. M. Kleinberg, "Patterns of Influence in a Recommendation Network," in PAKDD, 2006. [38] J. Leskovec, L. A. Adamic, and B. A. Huberman, "The dynamics of viral marketing," ACM TWEB, 2007. [39] C. Zang, P. Cui, C. Song, C. Faloutsos, and W. Zhu, "Structural pat- terns of information cascades and their implications for dynamics and semantics," CoRR, 2017. [40] M. Cha, H. Haddadi, F. Benevenuto, and P. K. Gummadi, "Measuring User Influence in Twitter: The Million Follower Fallacy," in ICWSM, 2010. [41] C. Joslyn, S. Choudhury, D. Haglin, B. Howe, B. Nickless, and B. Olsen, "Massive scale cyber traffic analysis: a driver for graph database re- search," in GRADES SIGMOD/PODS, 2013. methods to support graph deletions and increase expressiveness through query classes that aim at clustering coefficient, shortest path, and betweenness centrality. ACKNOWLEDGMENTS This research was partially funded by the Danish Council for Independent Research (DFF) under grant agreement No. DFF- 4093-00301. REFERENCES [1] Y. Boshmaf, I. Muslukhov, K. Beznosov, and M. Ripeanu, "The socialbot network: when bots socialize for fame and money," in ACSAC, 2011. [2] A. H. Wang, "Don't follow me - spam detection in twitter," in SECRYPT, 2010. [3] C. Song, T. Ge, C. X. Chen, and J. Wang, "Event pattern matching over graph streams," PVLDB, 2014. [5] [4] D. Williams, "Detecting Fake News with Neo4j & KeyLines," 2017. [Online]. Available: https://bit.ly/2HSbhgM I. Xenarios, L. Salwnski, X. Duan, P. Higney, S. Kim, and D. Eisenberg, "DIP, the Database of Interacting Proteins: a research tool for studying cellular networks of protein interactions," NAR, 2002. [6] The UniProt Consortium, "UniProt: the universal protein knowledge- base," NAR, 2017. [7] D. Barbieri, D. Braga, S. Ceri, E. Valle, and M. Grossniklaus, "C- SPARQL: A Continuous Query Language for RDF Data Streams," IJSC, 2010. "Reasoning on RDF streams," 2013. //streamreasoning.org/publications [Online]. Available: http: [9] D. Shasha, J. Wang, and R. Giugno, "Algorithmics and Applications of [8] Tree and Graph Searching," in PODS, 2002. [10] H. He and A. Singh, "Closure-Tree: An Index Structure for Graph Queries," in ICDE, 2006. [11] Z. Sun, H. Wang, H. Wang, B. Shao, and J. Li, "Efficient Subgraph Matching on Billion Node Graphs," PVLDB, 2012. [12] R. Diestel, "Graph Theory," GTM, 2005. [13] O. Erling, A. Averbuch, J. Larriba-Pey, H. Chafi, A. Gubichev, A. Prat- P´erez, M. Pham, and P. A. Boncz, "The LDBC Social Network Bench- mark: Interactive Workload," in ACM SIGMOD, 2015. [14] J. Webber, "A programmatic introduction to Neo4j," in SPLASH, 2012. [15] W. Han, J. Lee, and J. Lee, "Turboiso: towards ultrafast and robust sub- graph isomorphism search in large graph databases," in ACM SIGMOD, 2013. [16] X. Ren and J. Wang, "Exploiting vertex relationships in speeding up subgraph isomorphism over large graphs," VLDB, 2015. [17] -- -- , "Multi-query optimization for subgraph isomorphism search," [18] C. Wang and L. Chen, "Continuous Subgraph Pattern Search over Graph PVLDB, 2016. Streams," in ICDE, 2009. [19] L. Chen and C. Wang, "Continuous Subgraph Pattern Search over Certain and Uncertain Graph Streams," IEEE TKDE, 2010. [20] S. Gillani, G. Picard, and F. Laforest, "Continuous graph pattern match- ing over knowledge graph streams," in ACM DEBS, 2016. [21] M. Petrovic, H. Liu, and H.-A. Jacobsen, "G-ToPSS - fast filtering of graph-based metadata," in WWW, 2005. [22] J. Wang, B. Jin, and J. Li, "An Ontology-Based Publish/Subscribe System," in Middleware, 2004. [23] C. Canas, E. Pacheco, B. Kemme, J. Kienzle, and H.-A. Jacobsen, "GraPS: A Graph Publish/Subscribe Middleware," in Middleware, 2015. [24] S. Pan and X. Zhu, "CGStream: continuous correlated graph query for data streams," in CIKM, 2012. [25] -- -- , "Continuous top-k Query for Graph Streams," in CIKM, 2012. [26] J. Gao, C. Zhou, and J. X. Yu, "Toward continuous pattern detection over evolving large graph with snapshot isolation," VLDB Journal, 2016. [27] S. Choudhury, L. Holder, A. Ray, G. C. Jr., and J. Feo, "Continuous Queries for Multi-Relational Graphs," CoRR, 2012. [28] S. Choudhury, L. B. Holder, G. C. Jr., K. Agarwal, and J. Feo, "A Selectivity based approach to Continuous Pattern Detection in Streaming Graphs," in EDBT, 2015. [29] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, Introduction to Algorithms. MIT Press, 2009. [30] P. Ammann and J. Offutt, Introduction to software testing. Cambridge University Press, 2008. [31] S. C. Ntafos and S. L. Hakimi, "On Path Cover Problems in Digraphs and Applications to Program Testing," IEEE TSE, 1979.
1301.5842
3
1301
2013-11-07T09:42:13
Approximation of grammar-based compression via recompression
[ "cs.DS", "cs.FL" ]
In this paper we present a simple linear-time algorithm constructing a context-free grammar of size O(g log(N/g)) for the input string, where N is the size of the input string and g the size of the optimal grammar generating this string. The algorithm works for arbitrary size alphabets, but the running time is linear assuming that the alphabet \Sigma of the input string can be identified with numbers from {1, ..., N^c} for some constant c. Otherwise, additional cost of O(n log|\Sigma|) is needed. Algorithms with such approximation guarantees and running time are known, the novelty of this paper is a particular simplicity of the algorithm as well as the analysis of the algorithm, which uses a general technique of recompression recently introduced by the author. Furthermore, contrary to the previous results, this work does not use the LZ representation of the input string in the construction, nor in the analysis.
cs.DS
cs
APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION ARTUR JEŻ Abstract. In this paper we present a simple linear-time algorithm constructing a context-free grammar of size O(g log(N/g)) for the input string, where N is the size of the input string and g the size of the optimal grammar generating this string. The algorithm works for arbitrary size alphabets, but the running time is linear assuming that the alphabet Σ of the input string can be identified with numbers from {1, . . . , N c} for some constant c. Otherwise, additional cost of O(n log Σ) is needed. Algorithms with such an approximation guarantee and running time are known, the novelty of this paper is a particular simplicity of the algorithm as well as the analysis of the algorithm, which uses a general technique of recompression recently introduced by the author. Furthermore, contrary to the previous results, this work does not use the LZ representation of the input string in the construction, nor in the analysis. 1. Introduction 1.1. Grammar based compression. In the grammar-based compression text is represented by a context-free grammar (CFG) generating exactly one string. The idea behind this approach is that a CFG can compactly represent the structure of the text, even if this structure is not ap- parent. Furthermore, the natural hierarchical definition of the context-free grammars make such a representation suitable for algorithms, in which case the string operations can be performed on the compressed representation, without the need of the explicit decompression [2, 4, 9, 15, 3, 1]. Lastly, there is a close connection between block-based compression methods and the grammar it is fairly easy to rewrite the LZW definition as a O(1) larger CFG, LZ77 can compression: also be presented in this way, introducing a polynomial blow-up in size (reducing the blow up to log(N/ℓ), where ℓ is the size of the LZ77 representation, is non-trivial [16, 1]). While grammar-based compression was introduced with practical purposes in mind and the paradigm was used in several implementations [11, 10, 14], it also turned out to be very useful in more theoretical considerations. Intuitively, in many cases large data have relatively simple inductive definition, which results in a grammar representation of small size. On the other hand, it was already mentioned that the hierarchical structure of the CFGs allows operations directly on the compressed representation. A recent survey by Lohrey[12] gives a comprehensive description of several areas of theoretical computer science in which grammar-based compression was successfully applied. The main drawback of the grammar-based compression is that producing the smallest CFG for a text is intractable: given a string w and number k it is NP-hard to decide whether there exist a CFG of size k that generates w [18]. Furthermore, the size of the grammar cannot be approximated within some small constant factor [1]. Lastly, it is worth noting that in an extremely simple cases of texts of the form aℓ1baℓ2b··· baℓk construction of the grammar generating this string is equivalent (up to a small constant factor) to a construction of an addition chain for the sequence ℓ1 < ℓ2 < . . . < ℓk and for the latter 3 1 0 2 v o N 7 ] S D . s c [ 3 v 2 4 8 5 . 1 0 3 1 : v i X r a problem the best algorithm returns an addition chain of size log ℓk +O(cid:16)Pk in particular yields an O(cid:16) log n log log ℓi(cid:17) [19], which log log n(cid:17) approximation of the size of the smallest addition chain. Since the addition chains are well studied, showing a construction of an addition chains shorter than log ℓi i=1 Key words and phrases. Grammar-based compression; Construction of the smallest grammar; SLP; compression. Supported by NCN grant number 2011/01/D/ST6/07164, 2011 -- 2014. 1 2 A. JEŻ log ℓi i=1 log ℓk +O(cid:16)Pk the shortest addition chain, it is still possible that O( log n log log ℓi(cid:17) seems unlikely. Still, this construction was not aimed at approximating log log n ) approximation can be improved. In any case, any new result for addition chains would be interesting on its own. 1.2. Approximation. The hardness of the smallest grammar problem naturally leads to two directions of research: on one hand, several heuristics are considered [11, 10, 14], on the other, approximation algorithms, with a guaranteed approximation ratio, are proposed; in this paper we consider only the latter. The first two algorithms with an approximation ratio O(log(N/g)) were developed simultane- ously by Rytter [16] and Charikar et al. [1]. They followed a similar approach, we first present Rytter's approach as it is a bit easier to explain. Rytter's algorithm [16] applies the LZ77 compression to the input string and then transforms the obtained LZ77 representation to a O(ℓ log(N/ℓ)) size grammar, where ℓ is the size of the LZ77 representation. It is easy to show that ℓ ≤ g and as f (x) = x log(N/x) is increasing, the bound O(g log(N/g)) on the size of the grammar follows (and so a bound O(log(N/g)) on approximation ratio). The crucial part of the construction is the requirement that the intermediate constructed grammar defines a derivation tree satisfying the AVL condition. The bound on the running time and the approximation guarantee are all consequences of the balanced form of the derivation tree and of the known algorithms for merging, splitting, etc. of AVL trees (in fact these procedures are much simpler in this case, as we do not store any information in the internal nodes [16]). Note that also the final grammar for the input text is balanced, which makes is suitable for later processing. Since the construction of LZ77 representation can be performed in linear time (assuming that the letters of the input word can be sorted in linear time), also the running time of the whole algorithm can be easily bounded by a linear function. Charikar et al. [1] followed more or less the same path, with a different condition imposed on the grammar: it was required that its derivation tree is length-balanced, i.e. for a rule X → Y Z the lengths of words generated by Y and Z are within a certain multiplicative constant factor from each other. For such trees efficient implementation of merging, splitting etc. operations were given (i.e. constructed from scratch) by the authors and so the same running time as in the case of the AVL trees was obtained. Lastly, Sakamoto [17] proposed a different algorithm, based on RePair [11], which is one of the practically implemented and used algorithms for grammar-based compression. His algorithm iteratively replaced pairs of different letters and maximal blocks of letters (aℓ is a maximal block if that cannot be extended by a to either side). A special pairing of the letters was devised, so that it is 'synchronising': if w has 2 disjoint occurrences in text, then those two occurrences can be represented as w1w′w2, where w1, w2 = O(1), such that both occurrences of w′ in text are paired and compressed in the same way. The analysis was based on considering the LZ77 representation of the text and proving that due to 'synchronisation' the factors of LZ77 are compressed very similarly as the text to which they refer. However, to the author's best knowledge and understanding, the presented analysis [17] is incomplete, as the cost of nonterminals introduced when maximal blocks are replaced is not bounded at all in the paper, see the appendix; the bound that the author was able to obtain using there presented approach is O(log(N/g)2), so worse than claimed. 1.3. Proposed approach: recompression. In this paper another algorithm is proposed, it is constructed using the general approach of recompression, developed by the author. In essence, we iteratively apply two replacement schemes to the text T : pair compression of ab: For two different symbols (i.e. letters or nonterminals) a, b such that substring ab occurs in T replace each of ab in T by a fresh nonterminal c. a's block compression: For each maximal block aℓ, where a is a letter or a nonterminal and ℓ > 1, that occurs in T , replace all aℓs in T by a fresh nonterminal aℓ. APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 3 Then the returned grammar is obtained by backtracking the compression operations performed by the algorithm: observe that replacing ab with c corresponds to a grammar production (1a) c → ab and similarly replacing aℓ with aℓ corresponds to a grammar production (1b) aℓ → aℓ . The algorithm is divided into phases: in the beginning of a phase, all pairs occurring in the current text are listed and stored in a list P , similarly, L contains all letters occurring in the current text. Then pair compression is applied to an appropriately chosen subset of P and all blocks of symbols from L are compressed, then the phase ends. In everything works perfectly, each symbol of T is replaced and so T 's length drops by half; in reality the text length drops by some smaller, but constant, factor per phase. For the sake of simplicity, we treat all nonterminals introduced by the algorithm as letters. In author's previous work it was shown that such an approach can be efficiently applied to text represented in a grammar compressed form. In this way new results for compressed membership problem [5], fully compressed pattern matching [4] and word equations [7, 6] were obtained. In this paper a somehow opposite direction is followed: the recompression method is employed to the input string. This yields a simple linear-time algorithm: Performing one phase in O(T) running time is relatively easy, since the length of T drops by a constant factor in each phase, the O(N ) running time is obtained. However, the more interesting is the analysis, and not the algorithm itself: it is performed by applying (as a mental experiment) the recompression to the optimal grammar G for the input text. In this way, the current G always generates the current string kept by the algorithm and the number of nonterminals introduced during the construction can be calculated in terms of G ≤ g. A relatively straightforward analysis yields that the generated grammar is of size O(g log N ), a slightly more involved algorithm that combines the recompression technique with a naive approach that generates a grammar of size O(N ) yields a grammar of size O(g log(N/g) + g). 1.4. Advantages and disadvantages of the proposed technique. We believe that the proposed algorithm is interesting, as it is very simple and its analysis for the first time does not rely on LZ77 representation of the string. Potentially this can help in both design of an algorithm with a better approximation ratio and in showing a logarithmic lower bound: Observe that LZ77 representation is known to be at most as large as the smallest grammar, so it might be that some algorithm produces a grammar of size o(g log(N/g)), even though this is of size Ω(ℓ log(N/ℓ)), where ℓ is the size of the LZ77 representation of the string. Secondly, as the analysis 'considers' the optimal grammar, it may be much easier to observe, where any approximation algorithm performs badly, and so try to approach a logarithmic lower bound. This is much harder to imagine, when the approximation analysis is done in terms of the LZ77. Unfortunately, the obtained grammar is not balanced in any sense, in fact it is easy to give examples on which it returns grammar of height Ω(√N ) (note though that the same applies also to grammar returned by Sakamoto's algorithm). This makes the obtained grammar less suitable for later processing; on the other hand, the practically used grammar-based compressors [11, 10, 14] also do not produce a balanced grammar, nor do they give a guarantee on its height. On the good side, there is no reason why the optimal grammar should be balanced, neither can we expect that for an unbalanced grammar a small balanced one exists. Thus it is possible that while o(log(N/g)) approximation algorithm exists, there is no such algorithm that always returns a balanced grammar. We note that the reason why the grammar returned by proposed algorithm can have large height is only due to block compression: if we assume that the nonterminal generating aℓ has height one, the whole grammar has height O(log N ). It looks reasonable to assume that many data structures for grammar representation of text as well as later processing of it can indeed process a production aℓ → aℓ in constant time. 4 A. JEŻ Lastly, the proposed method seems to much easier to generalise then the LZ77-based ones: generalisations of SLPs to grammars generating other objects (mostly: trees) are known but it seems that LZ77-based approach does not generalise to such setting, as LZ77 ignores any additional structure (like: tree-structure) of the data. In recent work of Lohrey and the author the algorithm presented in this paper is generalised to the case of tree-grammars, yielding a first provable approximation for the smallest tree grammar problem [8]. Comparison with Sakamoto's algorithm. The general approach is similar to Sakamoto's method, however, the pairing of letters seems more natural in here presented paper. Also, the construction of nonterminals for blocks of letters is different, the author failed to show that the bound actually holds for the variant proposed by Sakamoto. It should be noted that the analysis presented in this paper for the calculation of nonterminals used due to pair compression is fairly easy, while estimating the number used for block compression is much more involved. Also, the connection to the addition chains suggests that the compression of blocks is the difficult part of the smallest grammar problem. Note on computational model. The presented algorithm runs in linear time, assuming that the Σ can be identified with a continues subset of natural numbers of size O(N c) for some constant c and the RadixSort can be performed on it. Should this not be the case for the input, we can replace the original letters with such a subset, in O(n log Σ) time (by creating a balanced tree for letters occurring in the input string). Note that the same comment applies to previous algorithms: there are many different algorithms for constructing the LZ77 representation of the text, but all of them first compute a suffix array (or a suffix tree) of the text, and linear-time algorithms for that are based on linear-time sorting of letters (treated as integers); although Sakamoto's method was designed to work with constant-size alphabet, it can be easily extended to the case when Σ can be identified with a sequence of O(N c) numbers, retaining the linear running-time. 2. The algorithm The input sequence to be represented by a context-free grammar is T ∈ Σ∗ and N denotes its initial length. The algorithm TtoG introduces new symbols to the instance, which are the nonterminals of the constructed grammar. However, these are later treated exactly as the original letters, so we insist on calling them letters as well and use common set Σ for both letters and nonterminals. We assume that T is represented as a doubly-linked list, so that removal and replacement of its elements can be performed in constant time (assuming that we have a link to such an occurrence). Note though that if we were to store T in a table, the running time would be the same. The smallest grammar generating T is denoted by G and its size G, measured as the length of the productions, is g. The crucial part of the analysis is the modification of G according to the compression performed on T . The terms nonterminal, rules, etc. always address the optimal grammar G (or its transformed version). To avoid confusion, we do not use terms 'production' and 'nonterminal' for a that replaced some substring in T (even though this is formally a nonterminal of the constructed grammar). Still, when a new 'letter' a is introduced to T we need to estimate the length of the 'productions' in the constructed grammar that are needed for a (note that we can of course use all letters previously used in T ). We refer to this length of productions as cost of representation of a letter a. For example, in production (1a) then the representation cost is 2 (as we have only one rule c → ab, this rule is called a representation of c) and in a rule (1b) we have a cost ℓ; the latter cost can be significantly reduced, for instance for a12 we can have a representation cost of 8 instead of 12, when we use a subgrammar a2 → aa, a3 → a2a, a6 → a3a3 and a12 → a6a6. Note that when c replaces a pair (as in (1a)), its representation cost is always 2, but when a replaces a block of letters, say aℓ, the cost might be larger than constant. In the latter case our algorithm constructs a special subgrammar for aℓ that generates aℓ. Details are explained later on. APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 5 Algorithm 1 TtoG: outline 1: while T > 1 do 2: 3: 4: L ← list of letters in T for each a ∈ L do compress maximal blocks of a P ← list of pairs find partition of Σ into Σℓ and Σr ⊲ Covering at least 1/2 of occurrences of letters in T ⊲ O(T), see Lemma 4 ⊲ These pairs do not overlap ⊲ Pair compression 5: 6: 7: 8: 9: 10: return the constructed grammar for ab ∈ P ∩ ΣℓΣr do compress pair ab ⊲ Blocks compression ⊲ O(T) We call one iteration of the main loop of TtoG a phase. Before we make any analysis, we note that at the beginning of each phase we can make a linear-time preprocessing that guarantees that the letters in T form an interval of numbers (which makes them more suitable for sorting using RadixSort). Lemma 1. At the beginning of the phase, in time O(T) we can rename the letters used in T so that they form an interval of numbers. Proof. Observe that we assumed that the input alphabet consists of letters that can be identified with subset of {1, . . . , N c}, see the discussion in the introduction. Treating them as vectors of length c over {0, . . . , N − 1} we can sort them using RadixSort in O(cN ) time, i.e. linear one. Then we can re-number those letters to 1, 2, . . . , n for some n ≤ N . Suppose that at the beginning of the phase the letters form an interval [m, . . , m+k]. Each new letter, introduced in place of a compressed subpattern (i.e. a block aℓ or a pair ab), is assigned a consecutive value, and so after the phase the letters appearing in T are within an interval [m . . m+k′] for some k′ > k. It is now left to re-number the letters from [m . . m+k′], so that the ones appearing in T indeed form an interval. For each symbol a in the interval [m . . m+k′] we set a flag to flag[a] = 0. Moreover, we set a variable next to m + k′ + 1. Then we read T . Whenever we spot a letter a ∈ [m . . m + k′] with flag[a] = 0, we set flag[a] := 1; new[a] := next, and next := next+1. Moreover, we replace this a by new[a]. When we spot a symbol a ∈ [m . . m+k′] with flag[a] = 1, then we replace this a by new[a]. Clearly the running time is O(T) and after the algorithm the symbols form a subinterval of [m + k′ + 1 . . m + 2k′ + 1]. (cid:3) 2.1. Blocks compression. The blocks compression is very simple to implement: We read T , for a maximal block of as of length greater than 1 we create a record (a, ℓ, p), where ℓ is a length of the block, and p is the pointer to the first letter in this block. We then sort these records lexicographically using RadixSort (ignoring the last component). There are only O(T) records and we assume that Σ can be identified with an interval, see Lemma 1, this is all done in O(T). Now, for a fixed letter a, the consecutive tuples with the first coordinate a correspond to all blocks of a, ordered by the size. It is easy to replace them in O(T) time with new letters. Note that so far we did not care with the cost of representation of new letters that replaced a-blocks. We use a particular schema to represent aℓ1, aℓ2, . . . , aℓk , which shall have a represen- i=1[1 + log(ℓi − ℓi−1)]) (take ℓ0 = 0 for convenience). tation cost O(Pk Lemma 2. Given a list 1 < ℓ1 < ℓ2 < ··· < ℓk we can represent letters aℓ1, aℓ2, . . . , aℓk that replace blocks aℓ1, aℓ2, . . . , aℓk with a cost O(Pk Proof. Firstly observe that without loss of generality we may assume that the list ℓ1, ℓ2, . . . , ℓk is given to us in a sorted way, as it can be easily obtained from the sorted list of occurrences of blocks. For simplicity define ℓ0 = 0 and let ℓ = maxk i=1[1 + log(ℓi − ℓi−1)]), where ℓ0 = 0. In the following, we shall define rules for certain new letters am, each of them 'derives' am (in other words, am represents am). For each 1 ≤ i ≤ log ℓ introduce a new letter a2i, defined as a2i → a2i−1 a2i−1, where a1 simply denotes a. Clearly a2i represents a2i and the representation cost summed over all i ≤ ℓ is O(log ℓ). i=1(ℓi − ℓi−1). 6 A. JEŻ Now introduce new letters aℓi−ℓi−1 for each i > 0, which shall represent aℓi−ℓi−1. They are represented using the binary expansion, i.e. by concatenation of at most 1 + log(ℓi − ℓi−1) from among the letters a1, a2, a4, . . . , 2⌊log(ℓi−ℓi−1)⌋. This has a representation cost O(Pk i=1[1+log(ℓi− ℓi−1)]). Lastly, each aℓi is represented as aℓi → aℓi−ℓi−1aℓi−1, which has a total representation cost O(k). Summing up O(log ℓ), O(Pk i=1[1 + log(ℓi − ℓi−1)]), as claimed. i=1[1 + log(ℓi − ℓi−1)]) and O(k) we obtain O(Pk (cid:3) In the following we shall also use a simple property of the block compression: since no two maximal blocks of the same letter can be next to each other, after the block compression there are no blocks of length greater than 1 in T . Lemma 3. In line 5 there are no two consecutive letters aa in T . Proof. Suppose for the sake of contradiction that there are such two letters. There are two cases: a was present in T in line 2: But then a was listed in L in line 2 and aa was replaced by another letter in line 4. a was introduced in line 4: Both a replaced some maximal blocks bℓ thus aa replaced (cid:3) b2ℓ, and so each of those two bℓs was not a maximal block. 2.2. Pair compression. The pair compression is performed similarly as the block compression. However, since the pairs can overlap, compressing all pairs at the same time is not possible. Still, we can find a subset of non-overlapping pairs in T such that a constant fraction of letters T is covered by occurrences of these pairs. This subset is defined by a partition of Σ into Σℓ and Σr and choosing the pairs with the first letter in Σℓ and the second in Σr. Lemma 4. For T in O(T) time we can find in line 6 a partition of Σ into Σℓ, Σr such that number of occurrences of pairs ab ∈ ΣℓΣr in T is at least (T − 1)/4. In the same running time we can provide, for each ab ∈ P ∩ ΣℓΣr, a lists of pointers to occurrences of ab in T . Proof. For a choice of ΣℓΣr we say that occurrences of ab ∈ P ∩ ΣℓΣr are covered by ΣℓΣr. The existence of partition covering at least one fourth of the occurrences can be shown by a simple probabilistic argument: divide Σ into Σℓ and Σr randomly, where each letter goes to each of the parts with probability 1/2. Consider two consecutive letters ab in T , note that they are different by Lemma 3. Then a ∈ Σℓ and b ∈ Σr with probability 1/4. There are T − 1 such pairs in T , so the expected number of pairs in T from ΣℓΣr is (T − 1)/4. Observe, that if we were to count the number of pairs that are covered either by ΣℓΣr or by ΣrΣℓ then the expected number of pairs covered by ΣℓΣr ∪ ΣrΣℓ is (T − 1)/2. The deterministic construction of such a partition follows by a simple derandomisation, using an expected value approach. It is easier to first find a partition such that at least (T − 1)/2 pairs' occurrences in T are covered by ΣℓΣr ∪ ΣrΣℓ, we then choose ΣℓΣr or ΣrΣℓ, depending on which of them covers more occurrences. Suppose that we have already assigned some letters to Σℓ and Σr and we are to decide, where the next letter a is assigned. If it is assigned to Σℓ, then all occurrences of pairs from aΣℓ ∪ Σℓa are not going to be covered, while occurrences of pairs from aΣr ∪ Σra are; similarly observation holds for a being assigned to Σr. The algorithm makes a greedy choice, maximising the number of covered pairs in each step. As there are only two options, the choice brings in at least half of occurrences considered. Lastly, as each occurrence of a pair ab from T is considered exactly once (i.e. when the second of a, b is considered in the main loop), this procedure guarantees that at least half of occurrences of pairs in T is covered. In order to make the selection effective, the algorithm GreedyPairs keeps an up to date counters countℓ[a] and countr[a], denoting, respectively, the number of occurrences of pairs from aΣℓ∪Σℓa and aΣr ∪ Σra in T . Those counters are updated as soon as a letter is assigned to Σℓ or Σr. APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 7 ⊲ Organised as a bit vector ⊲ Initialisation ⊲ Choose the one that guarantees larger cover countℓ[a] ← countr[a] ← 0 Algorithm 2 GreedyPairs 1: L ← set of letters used in P 2: Σℓ ← Σr ← ∅ 3: for a ∈ L do 4: 5: for a ∈ L do 6: 7: 8: 9: 10: 11: 12: 13: if # occurrences of pairs from ΣrΣℓ in T > # occurrences of pairs from ΣℓΣr in T then 14: 15: return (Σℓ, Σr) Σchoice ← Σchoice ∪ {a} for each ab or ba occurrence in T do countchoice[b] ← countchoice[b] + 1 if countr[a] ≥ countℓ[a] then else choice ← ℓ choice ← r switch Σr and Σℓ By the argument given above, when Σ is partitioned into Σℓ and Σr by GreedyPairs, at least half of the occurrences of pairs from T are covered by ΣℓΣr ∪ ΣrΣℓ. Then one of the choices ΣℓΣr or ΣrΣℓ covers at least one fourth of the occurrences. It is left to give an efficient variant of GreedyPairs, the non-obvious operations are the choice of the actual partition in lines 13 -- 14 and the updating of countℓ[b] or countr[b] in line 12. All other operation clearly take at most O(T) time. The former is simple: since we organise Σℓ and Σr as bit vectors, we can read T from left to right and calculate the number of pairs from ΣℓΣr and those from ΣrΣℓ in O(T) time (when we read a pair ab we check in O(1) time whether ab ∈ ΣℓΣr or ab ∈ ΣrΣℓ). Afterwards we choose the partition that covers more occurrences of pairs in T . To implement the count, for each letter a in T we have a right list right(a) = {bab occurs in T}, represented as a list. Furthermore, the element b on right list stores a list of all occurrences of the pair ab in T . There is a similar left list left(a) = {b ba occurs in T}. We comment, how to create left lists and right lists later. Given right and left, performing the update in line 12 is easy: we go through right(a) (left(a)) and increase the countchoice[b] for each occurrence of ab (ba, respectively). Note that in this way each of the list right(a) (left(a)) is read once during GreedyPairs, and so this time can be charged to their creation. It remains to show how to initially create right(a) (left(a) is created similarly). We read T , when reading a pair ab we create a record (a, b, p), where p is a pointer to this occurrence. We then sort these record lexicographically using RadixSort. There are only O(T) records and we assume that Σ can be identified with an interval, see Lemma 1, this is all done in O(T). Now, for a fixed letters a, the consecutive tuples with the first coordinate a can be turned into right(a): for b ∈ right(a) we want to store a list I of pointers to occurrences of ab, and on a sorted list of tuples the {(a, b, p)}p∈I are consecutive elements. Lastly, in order to get for each ab ∈ P ∩ ΣℓΣr, the lists of pointers to occurrences of ab in T it is enough to read right and filter the pairs such that a ∈ Σℓ and b ∈ Σr; the filtering can be done in O(1) as Σℓ and Σr are represented as bitvectors. The needed time is O(T). The total running time is also O(T), as each subprocedure has time constant per pair processed or O(T) in total. (cid:3) When for each pair ab ∈ ΣℓΣr the list of its occurrences in T is provided, the replacement of pairs is done by going through the list and replacing each of the pair, which is done in linear time. Note, that as Σℓ, Σr are disjoint, the considered pairs cannot overlap. 8 A. JEŻ 2.3. Size and running time. It remains to estimate the total running time, summed over all phases. Clearly each subprocedure in a phase has a running time O(T) so it is enough to show that T is reduced by a constant factor per phase. Lemma 5. In each phase T is reduced by a constant factor. Proof. Let m = T at the beginning of the phase. Let m′ ≤ m be the length of T after the compression of blocks. First observe that if m < 5 then we satisfy the lemma when we make at least one compression, which can be always done, so in the following we assume that m ≥ 5. after this phase T ′ ≤ m′ − (m′ − 1)/4 ≤ 3 Theorem 1. TtoG runs in linear time. Proof. Each phase clearly takes O(T) time and by Lemma 5 the T drops by a constant factor in each phase. As the initial length of T is N , the total running time is O(N ). By Lemma 4 at least (m′ − 1)/4 pairs are compressed during the pair compression, hence 4 m + 1 4 . (cid:3) (cid:3) 3. Size of the grammar: SLPs and recompression To bound cost of representing the letters introduced during the construction of the grammar, we start with the smallest grammar G generating (the input) T and then modify it so that it generates T (i.e. the current string kept by TtoG) after each of the compression steps. Then the cost of representing the introduced letters is paid by various credits assigned to G. Hence, instead of the actual representation cost, which is difficult to estimate, we calculate the total value of issued credit. Note that this is entirely a mental experiment for the purpose of the analysis, as G is not stored or even known to the algorithm. We just perform some changes on it depending on the TtoG actions. We assume that grammar G is a Straight Line Programme (SLP), however, we relax the notion a bit (and call it an SLP with explicit letters, when an explicit reference is needed): i.e. its nonterminals are numbered X1, . . . , Xm and each rule has at most two nonterminals (with smaller indices) in its body, (i.e. there are two, one or none nonterminals and arbitrary number of letters in the rule's body). Note that every CFG generating a unique string can be transformed into an SLP with explicit letters, with the size increased only by a constant factor. We call the letters (strings) occurring in the productions the explicit letters (strings, respectively). The unique string derived by Xi is denoted by val(Xi); the grammar G shall satisfy the condition val(Xm) = T . We do not assume that val(Xi) 6= ǫ, however, if val(Xi) = ǫ then Xi is not used in the productions of G (as this is a mental experiment, such Xi can be removed from the rules and in fact from the SLP). With each explicit letter we associate two units of credit and pay most of the cost of represent- ing the letters introduced during TtoG with these credits. More formally: when the algorithm modifies G and in the process it creates an occurrence of a letter, we issue (or pay) 2 new credits. On the other hand, if we do a compression step in G, then we remove some occurrences of letters. The credit associated with these occurrences is then released and can be used to pay for the representation cost of the new letters introduced by the compression step (so that the algorithm does not issue new credit). For pair compression the released credit indeed suffices to pay both the credit of the new letters occurrences and their representation cost, but for chain compression the released credit does not suffice, as it is not enough to pay the representation cost. Here we need some extra amount that will be estimate separately later on in Section 3.4. In the end, the total cost is the sum of credit that was issued during the modifications of G plus the value that we estimate separately in Section 3.4. Recall that whenever we say nonterminal, rule, production etc., we mean one of G. 3.1. Intuition. When we replace each occurrence of the pair ab in T , we should also do this in G. However, this may be not possible, as some ab generated by G do not come from explicit pairs in G but rather are 'between' a nonterminal and a letter, for instance in a simple grammar X1 → a, X2 → X1b the pair ab has such a problematic occurrence. If there are no such occurrences, it is enough to replace each explicit ab in G and we are done. To deal with the APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 9 problematic ones, we need to somehow change the grammar, in the example above we replace X1 with a, leaving only X2 → ab, for which the previous procedure can be applied. It turns out that a systematic procedure that deals with all such problems at once can be given, it is the main ingredient of this section and it is given in Section 3.2. Similar problems occur also when we want to replace maximal blocks of a and the solution to this problem is similar and it is given in Section 3.3. Note that in the example above, when X1 is replaced with a, 2 credit for the occurrence of a in X1 → a is released and wasted. Then we issue 2 credit for the new occurrence of a in the rule X2. When ab is replaced with c, 4 credit is released when ab is removed from the rule, 2 of this credit is used for the credit of c and the remaining 2 can be used to pay the representation cost for c → ab. 3.2. Pair compression. A pair of letters ab has a crossing occurrence in a nonterminal Xi (with a rule Xi → αi) if ab is in val(Xi) but this occurrence does not come from an explicit occurrence of ab in αi nor it is generated by any of the nonterminals in αi. A pair is non-crossing if it has no crossing occurrence. Unless explicitly written, we use this notion only to pairs of different letters. By P Cab→c(w) we denote the text obtained from w by replacing each ab by a letter c (we assume that a 6= b). We say that a procedure (that changes a grammar G with nonterminals X1, . . . , Xm to G′ with nonterminals X ′ m) properly implements the pair compression of m) = P C ab→c(val(Xm)) and G′ is an SLP with explicit letters. When a pair ab ab to c, if val(X ′ is noncrossing the procedure that implements the pair compression is easy to give: it is enough to replace each explicit ab with c. 1, . . . , X′ Algorithm 3 PairCompNCr(ab, c): compressing a non-crossing pair ab. 1: replace each explicit ab in G by c In order to distinguish between the nonterminals, grammar, etc. before and after the appli- i, G′, cation of compression of ab (or, in general, any procedure) we use 'primed' letters, i.e. X ′ T ′ for the nonterminals, grammar and text after this compression and 'unprimed', i.e. Xi, G, T for the ones before. Lemma 6. If ab is a noncrossing pair, then PairCompNCr(ab, c) properly implements the com- pression of ab. The credit of new letters in G′ and cost of representing the new letter c is paid by the released credit; no new credit is issued. If a pair de, where d 6= c 6= e is noncrossing in G, it is in G′. Proof. By induction on i we show that val(X ′ i) = P Cab→c(val(Xi)). Consider any occur- rence of ab in the string generated by Xi. If it is an explicit string then it is replaced by PairCompNCr(ab, c). If it is contained within substring generated by some Xj, this occurrence was compressed by the inductive assumption. The remaining case is the crossing occurrence of ab: since the only modifications to the rules made by PairCompNCr(ab, c) is the replacement of ab by c, such a crossing pair existed already before PairCompNCr(ab, c), but this is not possible by the lemma assumption that ab is non-crossing. Each occurrence of ab had two units of credit while c has only 2, so the replacement released 4 units of credit, 2 of which are used to pay for the credit of c and the other 2 to pay the cost of representation of c (if we replace more than one occurrence of ab, some credit is wasted). Lastly, replacing ab in G by a new letter c cannot make de (where d 6= c 6= e) a crossing pair in G, as no new occurrence of d, e was introduced on the way. (cid:3) If all pairs in ΣℓΣr are non-crossing, iteration of PairCompNCr(ab, c) for each pair ab in ΣℓΣr properly implements the pair compression for all pairs in ΣℓΣr (note that as Σℓ and Σr are disjoint, occurrences of different pairs from ΣℓΣr cannot overlap and so the order of replacement does not matter). So it is left to assure that indeed the pairs from ΣℓΣr are all noncrossing. It is easy to see that ab ∈ ΣℓΣr is a crossing pair if and only if one of the following three 'bad' situations occurs: 10 A. JEŻ CP1 there is a nonterminal Xi, where i < m, such that val(Xi) begins with b and aXi occurs in one of the rules; CP2 there is a nonterminal Xi, where i < m, such that val(Xi) ends with a and Xib occurs in one of the rules; CP3 there are nonterminals Xi, Xj, where i, j < m, such that val(Xi) ends with a and val(Xj) begins with b and XiXj occurs in one of the rules. Consider (CP1), let bw = val(Xi). Then it is enough to modify the rule for Xi so that val(Xi) = w and replace each Xi in the rules by bXi, we call this action the left-popping b from Xi. Similar operation of right-popping a letter a from Xi is symmetrically defined. It is shown in the Lemma 7 below that they indeed take care of all crossing occurrences of ab. Furthermore, left-popping and right-popping can be performed for many letters in parallel: the below procedure Pop(Σℓ, Σr) 'uncrosses' all pairs from the set ΣℓΣr, assuming that Σℓ and Σr are disjoint subsets of Σ (and we apply it only in the cases in which they are). let the production for Xi be Xi → αi if the first symbol of αi is b ∈ Σr then remove this b from αi replace Xi in G's productions by bXi if val(Xi) = ǫ then Algorithm 4 Pop(Σℓ, Σr): Popping letters from Σℓ and Σr 1: for i ← 1 . . m − 1 do 2: 3: 4: 5: 6: 7: 8: for i ← 1 . . m − 1 do 9: 10: 11: 12: 13: 14: let the production of Xi be Xi → αi if the last symbol of αi is a ∈ Σℓ then remove this a from αi replace Xi in G's productions by Xia if val(Xi) = ǫ then remove Xi from G's productions remove Xi from G's productions ⊲ Left-popping b ⊲ Right-popping a Lemma 7. After application of Pop(Σℓ, Σr), where Σℓ ∩ Σr = ∅, none of the pairs ab ∈ ΣℓΣr is crossing. Furthermore, val(X ′ m) = val(Xm). At most O(m) credit is issued during Pop(Σℓ, Σr). Proof. Observe first that whenever we remove b from the front of some αi we replace each of Xi occurrence with bXi and if afterwards val(Xi) = ǫ then we remove Xi from the rules, hence the words derived by each other nonterminal (in particular Xm) do not change, the same applies to replacement of Xi with Xia. Hence, in the end val(X ′ m) = val(Xm) = T (note that we do not pop letters from Xm). Secondly, we show that if val(X ′ i) begins with a letter b′ ∈ Σr then we left-popped a letter from Xi (which by the code is some b ∈ Σr), a similar claim (by symmetry) of course holds for the last letter of val(Xi) and Σr. So suppose that the claim is not true and consider the nonterminal Xi with the smallest i such that val(X ′ i) begins with b′ ∈ Σr but we did not left-pop a letter from Xi. Consider what was the first symbol in αi when Pop considered Xi in line 3. As Pop did not left-pop a letter from Xi, the first letter of val(Xi) and val(X ′ i) is the same and hence it is b′ ∈ Σr. So αi cannot begin with a letter as then it is b′ ∈ Σr, which should have been j) begins with b′ ∈ Σr left-popped. Hence it is some nonterminal Xj for j < i. But then val(X ′ and so by the induction assumption Pop left-popped a letter from Xj. But there was no way to remove this letter from αi, so αi should begin with a letter, contradiction. Suppose that after Pop there is a crossing pair ab ∈ ΣℓΣr. There are three already mentioned cases (CP1) -- (CP3): consider only (CP1), in which aXi occurs in the rule and val(Xi) begins with b. Note that as a /∈ Σr is the letter to the left of X ′ i did not left-pop a letter. But it begins with b ∈ Σr, so it should have. Contradiction. The other cases are dealt with in a similar manner. i, X ′ APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 11 Note that at most 4 new letters are introduced to each rule, thus at most 8m credit is (cid:3) issued. In order to compress pairs from ΣℓΣr it is enough to first uncross them all using Pop(Σℓ, Σr) and then compress them all by PairCompNCr(ab, c) for each ab ∈ ΣℓΣr. Algorithm 5 PairComp(Σℓ, Σr): compresses pairs from ΣℓΣr 1: run Pop(Σℓ, Σr) 2: for ab ∈ ΣℓΣr do 3: run PairCompNCr(ab, c) ⊲ c is a fresh letter Lemma 8. PairComp implements pair compression for each ab ∈ ΣℓΣr. It issues O(m) new credit to G, where m is the number of nonterminals of G. The credit of the new letters introduced to G and their representation costs are covered by the credit issued or released by PairComp. Proof. By Lemma 7 after Pop(Σℓ, Σr) each pair in ΣℓΣr is non-crossing and O(m) credit is issued in the process, furthermore val(Xm) does not change. By Lemma 6 for a non-crossing pair ab the PairCompNCr(ab, c) implements the pair com- pression, furthermore, any other non-crossing pair a′b′ ∈ ΣℓΣr remains non-crossing. Lastly, all occurrences of different pairs from ΣℓΣr are disjoint (as Σℓ and Σr are disjoint subsets of Σ) as so the order of replacing them does not matter and so we implemented the pair compression for all pairs in ΣℓΣr. The cost of representation and credit of new letters is covered by the released credit, see Lemma 6. (cid:3) Corollary 1. The compression of pairs issues in total O(m log N ) credit during the run of TtoG; the credit of the new letters introduced to G and their representation costs are covered by the credit issued or released during PairComp. 3.3. Blocks compression. Similar notions and analysis as the ones for pairs are applied for blocks. Consider occurrences of maximal a-blocks in T and their derivation by G. Then a block aℓ has a crossing occurrence in Xi with a rule Xi → αi, if it is contained in val(Xi) but this occurrence is not generated by the explicit as in the rule nor in the substrings generated by the nonterminals in αi. If as blocks have no crossing occurrences, then a has no crossing blocks. As for noncrossing pairs, the compression of a blocks, when it has no crossing blocks, is easy: it is enough to replace each explicit maximal a-block in the rules of G. We use similar terminology as in the case of pairs: we say that a subprocedure properly implements a block compression for a. Algorithm 6 BlockCompNCr(a), which compresses a blocks when a has no crossing blocks 1: for each aℓm do 2: replace every explicit maximal block aℓm in G by aℓm Lemma 9. If a has no crossing blocks then BlockCompNCr(a) properly implements the a's blocks compression. Furthermore, if a letter b from T had no crossing blocks in G, it does not have them in G′. The proof is similar to the proof of Lemma 6 and so it is omitted. Note that we do not yet discuss the issued credit, nor the cost of the representation of letters representing blocks (the latter is done in Section 3.4). It is left to ensure that no letter has a crossing block. The solution is similar to Pop, this time though we need to remove the whole prefix and suffix from val(Xi) instead of a single letter. The idea is as follows: suppose that a has a crossing block because aXi occurs in the rule and val(Xi) begins with a. Left-popping a does not solve the problem, as it might be that val(Xi) still begins with a. Thus, we keep on left-popping until the first letter of val(Xi) is not a, i.e. we remove the a-prefix of val(Xi). The same works for suffixes. 12 A. JEŻ let a, b be the first and last letter of val(Xi) let ℓi, ri be the length of the a-prefix and b-suffix of val(Xi) ⊲ If val(Xi) ∈ a∗ then ri = 0 and ℓi = val(Xi) Algorithm 7 RemCrBlocks: removing crossing blocks. 1: for i ← 1 . . m − 1 do 2: 3: 4: 5: 6: 7: 8: remove aℓi from the beginning and bri from the end of αi replace Xi by aℓiXibri in the rules if val(Xi) = ǫ then remove Xi from the rules Lemma 10. After RemCrBlocks no letter has a crossing block and val(Xm) = val(X ′ Proof. Firstly, val(X ′ m) = val(Xm): observe that when we remove a-prefix aℓi from αi we replace each Xi with aℓiXi (ans similarly for the b-suffix), also when we remove Xi from the rules then val(Xi) = ǫ. Hence when processing Xi, the strings generated by all other nonterminals are not affected. In particular, as we do not remove the prefix and suffix of Xm, the string generated by Xm remains the same after RemCrBlocks. m). By above observation, the value of val(Xi) does not change until RemCrBlocks considers Xi. We show that when RemCrBlocks considers Xi such that val(Xi) has a-prefix aℓi and b-suffix bri, then αi begins with aℓi and ends with bri (the trivial case, when val(Xi) = aℓi is shown in the same way). Suppose that this is not the case and consider Xi with smallest i for which this is not true. Clearly it is not X1, as there are no nonterminals in α1 and so val(X1) = α1. So let Xi have a rule Xi → αi, we deal only with the a-prefix, the proof of b-suffix is symmetrical. Since the a-prefix of val(Xi) and αi are different, this means that the a-prefix of val(Xi) is partially generated by the first nonterminal in αi, let it be Xj. By the choice of i we know that Xj popped its prefix (of some letter, say a′) and so it was replaced with a′ℓj X ′ j. Furthermore, j) begins with a′′ 6= a′. Since there is no way to remove this a′ prefix from αi, this a′ℓj is val(X ′ j ) begins with a′′ 6= a, so part of the a-prefix of val(Xi), in particular a′ = a. However, val(X ′ the a-prefix of αi and val(Xi) is the same, contradiction. As a consequence, if aXi occurs in any rule, then a is not the first letter of val(Xi), as prefix of letters a was removed from Xi. Other cases are handled similarly. So there are no crossing blocks after RemCrBlocks. (cid:3) So the compression of all blocks of letters is done by first running RemCrBlocks and then compressing each of the block by BlockCompNCr. Note that we do not compress blocks of letters that are introduced in this way. Concerning the number of credit, the arbitrary long blocks popped by RemCrBlocks are compressed (each into a single letter) and so at most 8 credit per rule is issued. Algorithm 8 BlockComp: compresses blocks of letters 1: run RemCrBlocks 2: L ← list of letters in T 3: for each a ∈ L do 4: run BlockCompNCr(a) Lemma 11. BlockComp properly implements the blocks compression for each letter a occurring in T before its application and issues O(m) credit. The issued credit covers the cost of credit of letters introduced during the BlockComp (but not their representation cost). The proof is similar as the proof of Lemma 8 so it is omitted. Corollary 2. During the whole TtoG the BlockComp issues in total at most O(m log N ) credit. The credit of the new letters introduced to G is covered by the issued credit. Note that the cost of representation of letters replacing blocks is not covered by the credit, this cost is separately estimated in the next subsection. APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 13 3.4. Calculating the cost of representing letters in block compression. The issued credit is enough to pay the 2 credit for occurrences of letters introduced during TtoG and the released credit is enough to pay the credit of the letters introduced during the pair compression and their representation cost. However, credit alone cannot cover the representation cost of letters replacing blocks. The appropriate analysis is presented in this section. The overall plan is as follows: firstly, we define a scheme of representing the letters based on the grammar G and the way G is changed by BlockComp (the G-based representation). Then for such a representation schema, we show that the cost of representation is O(g log N ). Lastly, it is proved that the actual cost of representing the letters by TtoG (the TtoG-based representation) is smaller than the G-based one, hence it is also O(g log N ). 3.4.1. G-based representation. The intuition is as follows: while the a blocks can have expo- nential length, most of them do not differ much, as in most cases the new blocks are obtained by concatenating letters a that occur explicitly in the grammar and in such a case the re- leased credit can be used to pay for the representation cost. This does not apply when the new block is obtained by concatenating two different blocks of a (popped from nonterminals) . . . , inside a rule. However, this cannot happen too often: when blocks of length p1, p2, i=1 pi)), as each pi ≥ 2), i=1 pi, which is at most N . Thus pℓ are compressed (at the cost of O(cid:16)Pℓ the length of the corresponding text in the input text is Qℓ O(cid:16)Pℓ i=1(1 + log pi)(cid:17) = O(logQℓ We create a new letter for each a block in the rule Xi → αi after RemCrBlocks popped prefixes and suffixes from X1, . . . , Xi−1 but before it popped letters from Xi. (We add the artificial empty block ǫ to streamline the later description and analysis.) Such a block is a power if it is obtained by concatenation of two a-blocks popped from nonterminals inside a rule (and perhaps some other explicit letters a), note that this power may be then popped from a rule (since it is a prefix or suffix in this rule). This implies that in the rule Xi → uXjvXkw the popped suffix of Xj and popped prefix of Xk are blocks of the same letter, say a, and furthermore v ∈ a∗. Note that it might be that one (or both) of Xj and Xk were removed in the process (in this case the power can be popped from a rule as well). For each block aℓ that is not a power we may uniquely identify another block ak (perhaps ǫ, not necessarily a power) such that aℓ was obtained by concatenating ℓ − k explicit letters to ak in some rule. Lemma 12. For each block aℓ represented in the G-based representation that is not a power there is block ak (perhaps k = 0) such that ak is also represented in G-based representation and aℓ was obtained in a rule by concatenating ℓ − k explicit letters that existed in the rule to ak. i=1 (1 + log pi)(cid:17) = O(log(Qℓ i=1 pi) = O(log N ) cost per nonterminal is scored. Note that the block ak is not necessarily unique: it might be that there are several aℓ blocks in G which are obtained as different concatenations of ak and ℓ − k explicit letters. Proof. Let aℓ be created in the rule for Xi, after popping prefixes and suffixes from X1, . . . , Xi−1. Consider, how many popped prefixes and suffixes take part in this aℓ. If two, then it is a power, contradiction. If one, then let the popped prefix (or suffix) be ak. Since it was popped, say from Xj, then ak was a maximal block in Xj before popping, so it is represented as well. Then in the rule for Xi the aℓ is obtained by concatenating ℓ − k letters a to ak. None of those letters come from popped prefixes and suffixes, so they are all explicit letters that were present in this rule. If there are none popped prefixes and suffixes that are part of this aℓ, then all its letters are explicit letters from the rule for Xi, and we treat it as a concatenation of k explicit letters to ǫ. (cid:3) We represent the blocks as follows: (1) for a block aℓ that is a power we represent aℓ using the binary expansion, which costs O(1 + log ℓ); (2) for a block aℓ that is obtained by concatenating ℓ − k explicit letters to a block ak (see Lemma 12) we represent aℓ as aka . . . a which has a representation cost of ℓ − k + 1, this 14 A. JEŻ cost is covered by the 2(ℓ − k) ≥ ℓ − k + 1 credit released by the ℓ − k explicit letters a. Note that the credit released by those letters was not used for any other purpose. (Furthermore recall that the 2 units of credit per occurrence of aℓ in the rules of grammar are already covered by the credit issued by BlockComp, see Lemma 11.) We refer to cost in 1 as the cost of representing powers and redirect this cost to the nonterminal in whose rule this power is created. The cost in 2, as marked there, is covered by released credit. i=1 log pi) = O(log(Qℓ 3.4.2. Cost of G-based representation. We now estimate the cost of representing powers. The idea is that if nonterminal Xi is charged the cost of representing powers of length p1, p2, . . . , pℓ, which have representation cost O(Pℓ i=1 pi)), then in the input this nonterminal generated a text of length at least p1 · p2 ··· pℓ ≤ N and so the total cost of representing powers is O(log N ) (per nonterminal). This is formalised in the lemma below. Lemma 13. The total cost of representing powers by G-based representation charged towards a single rule is O(log N ). Proof. There are two cases: first, after the creation of the power in a rule Xi → uXjvXkw one of the nonterminals Xj, Xk is removed. But this happens at most once for the rule and the cost of O(log N ) of representing the power can be charged to a rule. The second and crucial case is when after the creation of power both nonterminals remained in a rule Xi → uXjvXkw. Note that creation of the a power here means that val(Xj) has a-suffix, val(Xk) an a-prefix and v ∈ a∗. Fix this rule and consider all such creations of powers performed on this rule. Let the consec- utive letters, whose blocks are compressed, be a(1), a(2), . . . , a(ℓ) and their lengths p1, p2, . . . , pℓ. Lastly, the pℓ repetitions of a(ℓ) are replaced by a(ℓ+1). (Observe, that a(i+1) does not need to be the letter that replaced the a(i)'s block, as there might have been some other compression performed on that letter.) Then the cost of the representing powers is constant time more than ℓ ℓ (2) Xi=1 (1 + log pi) ≤ 2 log pi . Xi=1 Define weight: for a letter it is the length of the substring of the original input string that it 'derives'. Note that the maximal weight of any letter is N , the length of the input word. Consider the weight of the strings between Xj and Xk. Clearly, after the i-th blocks com- pression it is exactly pi · w(a(i)), as the block of pi letters a(i) was replaced by one letter. We claim that w(a(i+1)) ≥ pi w(a(i)): right after the i-th blocks compression the string between Xj (i) pi , which replaced the pi block of a(i). After some operations, this and Xk is simply a letter a (i) string consists of pi+1 letters a(i+1). Observe that (a(i+1))pi+1 'derives' a pi : indeed all operations performed by TtoG do not remove the letters from string between Xj and Xk in a rule, only replace strings with single letters and perhaps add letters at the ends of this string. But if (a(i+1))pi+1 'derives' a (i) pi , i.e. a single letter, then also a(i+1) 'derives' a (i) pi , hence pi ) = pi w(a(i)) . w(a(i+1)) ≥ w(a(i) i=1 pi. As w(a(ℓ+1)) ≤ N we have Since w(a(1)) ≥ 1 it follows that w(a(ℓ+1)) ≥ Qℓ Yi=1 N ≥ pi ℓ and so it can be concluded that log(N ) ≥ log ℓ Yi=1 ℓ pi! log pi . = Xi=1 Therefore, the whole cost Pℓ i=1 log pi, as estimated in (2), is O(log N ), as claimed. (cid:3) APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 15 Corollary 3. The cost of G-based representation is O(g + g log N ). Proof. Concerning the cost of representing powers, by Lemma 13 we redirect at most O(log N ) against each of the m ≤ g rules of G. The cost of representing non-powers is covered by the released credit; the initial value of credit is at most 2g and by Corollary 1 and Corollary 2 at most O(g log N ) credit is issued during the whole run of TtoG, which ends the proof. (cid:3) 3.4.3. Comparing the G-based representation cost and TtoG-based representation cost. We now show that the cost of TtoG-based representation is at most as high as G-based one. We first represent G-based representation cost using a weighted graph GG, such that the G-based repre- sentation is (up to a constant factor) w(GG), i.e. the sum of weights of edges of GG. Lemma 14. The cost of G-based representation of all blocks is Θ(w(GG)), where nodes of GG are labelled with blocks represented in the G-based representation and edge from aℓ to ak, where ℓ > k, has weight ℓ − k or 1 + log(ℓ − k) (in this case additionally k = 0). Each node has at least one outgoing edge. The former corresponds to the representation cost covered by the released credit while the latter to the cost of representing powers. Proof. We give a construction of the graph GG. Fix the letter a and consider any of the blocks aℓ that is represented by G, we put a node aℓ in GG. Note that a single aℓ may be represented in many ways: different occurrences of aℓ are replaced with aℓ and may be represented in different ways (or even twice in the same way), this means that GG may have more than one outgoing edge per node. 1 + log ℓ (recall that this is the cost of representing this power); • when aℓ is a power, we create an edge from the node labelled with aℓ to ǫ, the weight is • when aℓ is represented as a concatenation of ℓ− k letters to ak, we create and edge from the node aℓ to ak, the weight is ℓ − k (this is the cost of representing this block; it was paid by the credit on the ℓ − k explicit letters a). Then the sum of the weight of the created graph is a cost of representing the blocks using the G-based representation (up to a constant factor). (cid:3) Similarly, the cost of TtoG-based representation has a graph representation GTtoG. Lemma 15. The cost of TtoG-representation for blocks of a letter a is Θ(w(GTtoG)), where the nodes of GTtoG are labelled with blocks represented by TtoG-representation and it has an edge from aℓ to ak if and only if ℓ and k are two consecutive lengths of a-blocks. Such an edge has weight 1 + log(ℓ − k). Proof. Observe that this is a straightforward consequence of the way the blocks are represented: Lemma 2 guarantees that when blocks aℓ1, aℓ2, . . . , aℓk (where 1 < ℓ1 < ℓ2 < ··· < ℓk) are represented the TtoG-representation cost is O(Pk i=1[1 + log(ℓi − ℓi−1)]), so we can assign cost 1 + log(ℓi − ℓi−1) to aℓi (and make it the weight on the edge to the previous block). We now show that GG can be transformed to GTtoG without increasing the sum of weights of the edges. Lemma 16. GG can be transformed to GTtoG without increasing the sum of weights of the edges. Proof. Fix a letter a, we show how to transform the subgraph of GG induced by nodes labelled with blocks of a to the corresponding subgraph of GTtoG, without increasing the sum of weights. Firstly, let us sort the nodes according to the increasing length of the blocks. For each node aℓ, if it has many edges, we delete all except one and then we redirect this edge to aℓ's direct predecessor (say ak) and label it with a cost 1 + log(ℓ − k). This cannot increase the sum of weights of edges: (cid:3) • deleting does not increase the sum of weights; • if aℓ has an edge to ǫ with weight 1 + log ℓ then 1 + log ℓ ≥ 1 + log(ℓ − k); • otherwise it had an edge to some k′ ≤ k with a weight ℓ − k′. Then 1 + log(ℓ − k) ≤ ℓ − k ≤ ℓ − k′, as claimed (note that 1 + log x ≤ x for x ≥ 1). 16 A. JEŻ Some blocks labelling nodes in GG perhaps do not label the nodes in GTtoG. For such a block aℓ we remove its node aℓ and redirect its unique incoming edge to its predecessor, say aℓ′, changing the weight appropriately. Since 1 + log(x) + 1 + log(y) > 1 + log(x + y) when x, y ≥ 1, we do not increase the total weight. It is left to observe that if a node labelled with aℓ exists in GTtoG then it also exists in GG, i.e. all blocks represented in TtoG occur in T . After RemCrBlocks there are no crossing blocks, see Lemma 10. So any maximal block in T (i.e. one represented by TtoG-based representation) is also a maximal block aℓ in some rule (after RemCrBlocks), say in Xi. But then this block is present in Xi also just before action of RemCrBlocks on Xi and so it is represented by G-based representation. In this way we obtained a graph corresponding to the TtoG-based representation. (cid:3) Corollary 4. The total cost of TtoG-representation is O(g log N ). Proof. By Lemma 16 it is enough to show this for the G-based representation, which holds by Corollary 3 (cid:3) 4. Improved algorithm and its analysis The naive algorithm, which simply represents the input word w as X1 → w results in a grammar of size N . In some extreme cases this might be better than O(g log N ) guaranteed by TtoG. We merge the naive approach with the recompression-based algorithm: if at the beginning of a phase i TtoG already paid ki for representation of the letters and the remaining text is Ti then we can construct a grammar for the input string of the total size ki + Ti by giving a rule X → Ti. Of course we can then choose the minimum over all possible i (observe that for i = 0 this is simply the naive representation X → w and for the last i this is the grammar returned by TtoG). We call the corresponding algorithm TtoGImp. Additionally, we show that when Ti ≈ g then the so-far cost of representing letters is O(g log(N/g)) and so the corresponding grammar considered by TtoGImp is of size O(g + g log(N/g)), consequently, the grammar returned by TtoGImp is also of this size. This matches the best known results for the smallest grammar problem [16, 1, 17]. Algorithm 9 TtoGImp: improved version outline 1: i ← 0 2: while T > 1 do 3: 4: 5: 6: 7: size[i] ← T+ so-far cost of representing letters i ← i + 1 L ← list of letters in T for each a ∈ L do P ← list of pairs find partition of Σ into Σℓ and Σr for ab ∈ P ∩ ΣℓΣr do compress pair ab 8: 9: 10: 11: 12: output grammar Gi for which size[i] is smallest compress maximal blocks of a ⊲ Cost of grammar in phase i ⊲ Number of the phase ⊲ The compression is done as in TtoG The properties of TtoGImp are summarised in the following theorem. Theorem 2. The TtoG runs in linear time and returns a grammar of size O(cid:16)g + g log(cid:16) N where g is the size of the optimal grammar for the input text. g (cid:17)(cid:17), The time analysis follows in the same way as in the case of TtoG (the only additional com- putation is storing the sizes and choosing the minimum of them), so it is omitted. In the rest of this section we show the bound on the size of the returned grammar. In the following analysis we focus on the phase i such that Ti ≥ g > Ti+1 (for input text with more than one symbol such an i exists, as for the 'last' i we have Ti = 1). Then we separately APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 17 estimate the cost of representation (i.e. issued credit and the cost of TtoG-based representation) up to phase i and in the phase i + 1. We show that both of those are O(g + g log(N/g)), which shows the main claim of Theorem 2. Lemma 17. If at the beginning of the phase T ≥ g then so far the cost of representing letters by TtoGImp as well as the credit on G is O(g + g log(N/g)). Proof. We estimate separately the amount of issued credit and the cost of representation of letters replacing blocks. This covers the whole cost of representing letters (see Corollary 1, Corollary 2) as well as the credit on the letters in the grammar. Credit. Observe first that initial grammar G has at most g credit. The input text is of length N and the current one is of t = T and so there were O(log(N/t)) phases, as in each phase the length of T drops by a constant factor, see Lemma 5. As t ≥ g, we obtain a bound O(log(N/g)) on the number of phases. Due to Lemmata 8, 11, at most O(m) credit per phase is issued during the pair compression and block compression, so in total O(g + g log(N/g)) credit was issued. From Corollary 1 and Corollary 2 we conclude that this credit is enough to cover the credit of all letters as well as the representation cost of letters introduced during the pair compression. So it is left to calculate the cost of representing blocks. Representing blocks. The representation of blocks used by TtoGImp is the same as the one of TtoG. So we can define the G-based representation in the same way as previously. For both the G-based representation and the TtoGImp-based representation we can define graphs GG and GTtoGImp and by Lemma 14 the cost of G-based representation is Θ(w(GG)) and by Lemma 15 the cost of TtoGImp-based representation is Θ(w(GTtoGImp)). Then Lemma 16 shows that we can transform GG to GTtoGImp without increasing the sum of weights. Hence it is enough to show that the G-based representation cost is at most O(g + log(N/g)). The G-based representation cost consists of some released credit and the cost of representing powers, see Lemma 14. The former was already addressed (the whole issued credit is O(g + g log(N/g))) and so it is enough to estimate the latter, i.e. the cost of representing powers. The outline of the analysis is as follows: when a new power aℓ is represented, we mark some letters of the input text (and perhaps modify some other markings) those markings are associated with nonterminals and are named Xi-pre-power marking and Xi-in marking (which are defined in more detail later on). The markings satisfy the following conditions: (M1) each marking marks at least 2 letters, no two markings mark the same letter; (M2) for each Xi there is most one Xi-pre-power marking and at most one Xi-in marking; (M3) when the substrings of length p1, p2, . . . , pk are marked, then the so-far cost of representing i=1(1 + log pi) (for some fixed constant c). the powers by G-based representation is cPk upper-bounded by (a constant times): Using (M1) -- (M3) the total cost of representing powers (in G-based representation) can be k k (3a) k + Xi=1 log pi, where k ≤ 2m and Xi=1 i=1 pi = N . Then for a fixed k and Pk It is easy to show that (3a) is maximised for k = 2m and each pi equal to N/2m: clearly, the sum is maximised for Pk i=1 log pi is maximised when all pi are equal, which follows from the fact that log(x) is concave, hence we can set pi = N k . Lastly, the k + k log(N/k) has a non-negative derivative (for k) and so (weakly) increases with k. Since k ≤ 2m ≤ 2g, this is maximised for k = 2g. In this way the value of (3a) is at most i=1 pi = N the sum Pk pi ≤ N . (3b) 2g + 2g log(cid:18) N 2g(cid:19) = O(cid:18)g + g log(cid:18) N g (cid:19)(cid:19) . The idea of preserving (M1) -- (M3) is as follows: if a new power of length ℓ is represented, this yields a cost O(1 + log ℓ) = O(log ℓ), see Lemma 14; we can choose c in (M3) so that this is at most c log ℓ (as ℓ ≥ 2). Then either we mark new ℓ letters or we remove some marking of length 18 A. JEŻ ℓ′ and mark ℓ · ℓ′ letters, it is easy to see that in this way (M1) -- (M3) is preserved (still, those details are repeated later in the proof). Whenever we are to represent powers aℓ1, aℓ2, . . . , for each power aℓ, where ℓ > 1, we find the right-most maximal block aℓ in T . It is possible that this particular aℓ was obtained as a concatenation of ℓ − k explicit letters to ak (so, not as a power). In such a case we are lucky, as the representation of this aℓ is paid by the credit and we do not need to separately consider the cost of representing power aℓ. Otherwise the aℓ in this rule is obtained as a power and we mark some of the letters in the input that are 'derived' by this aℓ. The type of marking depends on the way this particular aℓ is 'derived': Let Xi be the smallest nonterminal that derives (before RemCrBlocks) this right-most occurrence of maximal aℓ (clearly there is such non-terminal, as Xm derives it). If one of the nonterminals in Xi's production was removed during RemCrBlocks, this marking is an Xi-pre-power marking. Otherwise, this marking is an Xi-in marking. Claim 1. There is at most one Xi-pre-power marking. When Xi-in marking is created for aℓ, after the block compression Xi has two nonterminals inside its rule and between them there is exactly aℓ. Proof. Concerning the Xi-pre-power marking, let aℓ be the first power that gets this marking. Then be definition of the marking, afterwards in the rule for Xi there is only one nonterminal. But this means that no power can be created in this rule later on, in particular, no new marking associated with Xi (pre-power marking or in marking) can be created. Suppose that aℓ was assigned an Xi-in marking, which as in the previous case means that the right-most occurrence of maximal block aℓ is generated by Xi but not by the nonterminals in the rule for Xi. Since aℓ is a power it is obtained in the rule as a concatenation of the a-prefix and the a-suffix popped from nonterminals in the rule for Xi. In particular this means that each nonterminal in the rule for Xi generate a part of this right-most occurrence of aℓ. If any of those nonterminals were removed during the block compression aℓ would be assigned an Xi-pre-power marking, which is not the case. So both those nonterminals remained in the rule. Hence after popping prefixes and suffixes, between those two nonterminals there is exactly a block aℓ, which is then replaced by aℓ, as promised, which ends the proof. (cid:3) Consider the aℓ and the 'derived' substring wℓ of the input text. We show that if there are markings inside wℓ, they are all inside the last among those ws. Claim 2. Let aℓ be an occurrence of a maximal block to be replaced with aℓ which 'generates' wℓ in the input text. If there is any marking within this wℓ then it is within the last among those ws. Proof. Consider any pre-existing marking within wℓ, say it was done when some bk was replaced by bk. As bk is a single letter and aℓ derives it, each a derives at least one bk. The marking was done inside the string generated by the right-most bk (as we always put the marking within the rightmost occurrence of the string to be replaced). Clearly the right-most bk is 'derived' by the right-most a within aℓ, sin in particular it is inside the right-most w in this wℓ. So all markings within wℓ are in fact within the right-most w. (cid:3) We now demonstrate how to mark letters in the input text. Suppose that we replace a power aℓ, let us consider the right-most occurrence of this aℓ in T and the smallest Xi that generates this occurrence. This aℓ generates some wℓ in the input text. If there are no markings inside wℓ then we simply mark any ℓ letters within wℓ. In the other case, by Claim 2 we know that all those markings are in fact in the last w. If any of them is the (unique) Xi-in marking, let us choose it. Otherwise choose any other marking. Let ℓ′ denote the length of the chosen marking. Consider, whether this marking in w is unique or not unique marking: Then we remove it and mark arbitrary ℓ·ℓ′ letters in wℓ; this is possible, as w ≥ ℓ′ and so wℓ ≥ ℓ · ℓ′. Since log(ℓ · ℓ′) = log ℓ + log ℓ′, the (M3) is preserved, as it is enough to account for the 1 + log ℓ ≤ c log ℓ representation cost of aℓ as well as the c log ℓ′ cost associated with the previous marking of length ℓ′. APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 19 not unique: Then w ≥ ℓ′ + 2 (the 2 for the other markings, see (M1)). We remove the marking of length ℓ′, let us calculate how many unmarked letters are in wℓ afterwards: in wℓ−1 there are at least (ℓ− 1)· (ℓ′ + 2) letters (by the Claim 2: none of them marked) and in the last w there are at least ℓ′ unmarked letters (from the marking that we removed): (ℓ − 1) · (ℓ′ + 2) + ℓ′ = (ℓℓ′ + 2ℓ − ℓ′ − 2) + ℓ′ = ℓℓ′ + 2ℓ − 2 > ℓℓ′ . We mark those ℓ · ℓ′ letters, as in the previous case, the associated c log(ℓℓ′) is enough to pay for the cost. There is one issue: it might be that we created an Xi-in marking while there already was one, violating (M2). However, we show that if there were such a marking, it was within wℓ (and so within the last w, by Claim 2) and so we could choose it as the marking that was deleted when the new one was created. Consider the previous Xi-in marking. It was introduced for some power bk, replaced by bk that was a unique letter between the nonterminals in the rule for Xi, by Claim 1. Consider the rightmost substring of the input text that is generated by the explicit letters between nonterminals in the rule for Xi. The operations performed on G cannot shorten this substring, in fact they often expand it. When bk is created, this substring is generated by bk, by Claim 1. When aℓ is created, it is generated by aℓ, by Claim 1, i.e. this is exactly wℓ. So in particular wℓ includes the marking for bk. This shows that (M1) -- (M3) holds and so also the calculations in (3) hold, in particular, the (cid:3) representation cos of powers is O(g log(N/g)). Let t1 and t2 be the lengths of T at the beginning of two consecutive phases, such that t1 ≥ g > t2. By Lemma 17 the cost of representing letters and the credit before the T was reduced to t2 letters (as well as the credit remaining on the letters of grammar) is O(g + g log(N/g)). So it is left to estimate what is the cost of representation in this phase. Lemma 18. Consider a phase, such that at its beginning T has length t1 and after it it has length t2, where t1 ≥ g > t2. Then the cost of representing letters introduced during this phase is at most O(g + g log(N/g)). Proof. The cost of representing letters introduced during the pair compression is covered by the released credit, see Lemma 8. There was at most O(g + g log(N/g)) credit in the grammar at the beginning of the phase, see Lemma 17, and during this phase at most O(g) credit was issued, see Lemma 8 and Lemma 11. Consider the cost of representing blocks. Note that since T at the end of the phase has t2 letters, at most 2t2 letters representing blocks could be introduced in this phase (since at most two blocks can be merged into one letter by pair compression afterwards). Let p1, . . . , pk be the lengths of those powers. Then the cost of representing them is proportional to (see Lemma 2) k + k Xi=1 log pi, where k ≤ 2t2 and k Xi=1 pi ≤ t1 . Since k ≤ 2t2 < 2g we only estimate the sum. Using the same analysis as in the case of (3) it can be concluded that this is at most 2t2 log(cid:18) t1 2t2(cid:19) ≤ 2t2 log(cid:18) N g (cid:19)(cid:19) , 2t2(cid:19) < 2g log(cid:18) N 2g(cid:19) = O(cid:18)g log(cid:18) N with the first equality following from t1 ≤ N and the second from g > t2 and monotonicity of f (x) = x log(N/x). (cid:3) Now the estimations from Lemma 17 and Lemma 18 allow the proof of Theorem 2. of Theorem 2. The estimation of the running time is the same as in the case of TtoG, so it is omitted. 20 A. JEŻ Concerning the size of the returned grammar, consider the phase, such that before it the T had length t1 and right after it t2, where t1 ≥ g > t2, there is such a phase as in the end the T has length 1. Then by Lemma 17 the cost of representing letters introduced before this phase is O(cid:16)g + g log(cid:16) N g (cid:17)(cid:17) while by Lemma 18 the cost of representing letters introduced in this phase is at most O(cid:16)g + g log(cid:16) N g (cid:17)(cid:17). Hence the size of the grammar that is calculated by TtoGImp after g (cid:17)(cid:17). So also the minimum found during the computation is this phase is at most O(cid:16)g + g log(cid:16) N of at most this size. (cid:3) Acknowledgements. I would like to thank Paweł Gawrychowski for introducing me to the topic, for pointing out the relevant literature [13] and discussions; Markus Lohrey for suggesting the topic of this paper and bringing the idea of applying the recompression to the smallest grammar. References [1] Moses Charikar, Eric Lehman, Ding Liu, Rina Panigrahy, Manoj Prabhakaran, Amit Sahai, and Abhi Shelat. The smallest grammar problem. IEEE Transactions on Information Theory, 51(7):2554 -- 2576, 2005. [2] Paweł Gawrychowski. Pattern matching in Lempel-Ziv compressed strings: fast, simple, and deterministic. In Camil Demetrescu and Magnús M. Halldórsson, editors, ESA, volume 6942 of LNCS, pages 421 -- 432. Springer, 2011. [3] Leszek Gąsieniec, Marek Karpiński, Wojciech Plandowski, and Wojciech Rytter. Efficient algorithms for Lempel-Ziv encoding. In Rolf G. Karlsson and Andrzej Lingas, editors, SWAT, volume 1097 of LNCS, pages 392 -- 403. Springer, 1996. [4] Artur Jeż. Faster fully compressed pattern matching by recompression. In Artur Czumaj, Kurt Mehlhorn, Andrew Pitts, and Roger Wattenhofer, editors, ICALP (1), volume 7391 of LNCS, pages 533 -- 544. Springer, 2012. [5] Artur Jeż. The complexity of compressed membership problems for finite automata. Theory of Computing Systems, pages 1 -- 34, 2013. [6] Artur Jeż. One-variable word equations in linear time. In Fedor V. Fomin, Rusins Freivalds, Marta Kwiatkowska, and David Peleg, editors, ICALP (2), volume 7966, pages 324 -- 335, 2013. full version at http://arxiv.org/abs/1302.3481. [7] Artur Jeż. Recompression: a simple and powerful technique for word equations. In Natacha Portier and Thomas Wilke, editors, STACS, volume 20 of LIPIcs, pages 233 -- 244, Dagstuhl, Germany, 2013. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik. [8] Artur Jeż and Markus Lohrey. Approximation of smallest linear tree grammar. CoRR, 1309.4958, 2013. submitted. [9] Marek Karpiński, Wojciech Rytter, and Ayumi Shinohara. Pattern-matching for strings with short descrip- tions. In CPM, pages 205 -- 214, 1995. [10] John C. Kieffer and En-Hui Yang. Sequential codes, lossless compression of individual sequences, and kol- mogorov complexity. IEEE Transactions on Information Theory, 42(1):29 -- 39, 1996. [11] N. Jesper Larsson and Alistair Moffat. Offline dictionary-based compression. In Data Compression Confer- ence, pages 296 -- 305. IEEE Computer Society, 1999. [12] Markus Lohrey. Algorithmics on SLP-compressed strings: A survey. Groups Complexity Cryptology, 4(2):241 -- 299, 2012. [13] Kurt Mehlhorn, R. Sundar, and Christian Uhrig. Maintaining dynamic sequences under equality tests in polylogarithmic time. Algorithmica, 17(2):183 -- 198, 1997. [14] Craig G. Nevill-Manning and Ian H. Witten. Identifying hierarchical strcture in sequences: A linear-time algorithm. J. Artif. Intell. Res. (JAIR), 7:67 -- 82, 1997. [15] Wojciech Plandowski. Testing equivalence of morphisms on context-free languages. In Jan van Leeuwen, editor, ESA, volume 855 of LNCS, pages 460 -- 470. Springer, 1994. [16] Wojciech Rytter. Application of Lempel-Ziv factorization to the approximation of grammar-based compres- sion. Theor. Comput. Sci., 302(1-3):211 -- 222, 2003. [17] Hiroshi Sakamoto. A fully linear-time approximation algorithm for grammar-based compression. J. Discrete Algorithms, 3(2-4):416 -- 430, 2005. [18] James A. Storer and Thomas G. Szymanski. The macro model for data compression. In Richard J. Lipton, Walter A. Burkhard, Walter J. Savitch, Emily P. Friedman, and Alfred V. Aho, editors, STOC, pages 30 -- 39. ACM, 1978. [19] Andrew Chi-Chih Yao. On the evaluation of powers. SIAM J. Comput., 5(1):100 -- 103, 1976. APPROXIMATION OF GRAMMAR-BASED COMPRESSION VIA RECOMPRESSION 21 Appendix A. Sakamoto's algorithm [17] In proof that bounds the number of introduced nonterminals [17, Theorem 2], it is first estimated that in one execution of the while loop for a factor fi the introduced nonterminals occur in f1f2 ··· fi−1, except perhaps a constant number of them. This argument follows from observation that fi is compressed to αβγ, where α and γ are bounded by a constant and the earlier occurrence of the same string as fi is compressed to α′βγ′ (where also α′ and γ′ are bounded by a constant). This is true, however, when α and γ represent nonterminals introduced by repetition procedure (i.e. they are blocks in the terminology used here) we need to take into the account also the additional nonterminals that are introduced for representation of those blocks. The estimation of O(1) is not enough, as in the worst case Ω(log N ) are needed to represent a single block of as. We do not see any easy patch to repair this flaw. The improved analysis [17, Theorem 2], in which the number of nonterminals is bounded by O(cid:16)g + log(cid:16) N g (cid:17)(cid:17), has the same shortcoming. Max Planck Institute für Informatik,, Campus E1 4, DE-66123 Saarbrücken, Germany, and Insti- tute of Computer Science, University of Wrocław, ul. Joliot-Curie 15, 50-383 Wrocław, Poland, [email protected]
1307.7454
2
1307
2013-08-21T21:45:01
Relative Errors for Deterministic Low-Rank Matrix Approximations
[ "cs.DS", "math.NA" ]
We consider processing an n x d matrix A in a stream with row-wise updates according to a recent algorithm called Frequent Directions (Liberty, KDD 2013). This algorithm maintains an l x d matrix Q deterministically, processing each row in O(d l^2) time; the processing time can be decreased to O(d l) with a slight modification in the algorithm and a constant increase in space. We show that if one sets l = k+ k/eps and returns Q_k, a k x d matrix that is the best rank k approximation to Q, then we achieve the following properties: ||A - A_k||_F^2 <= ||A||_F^2 - ||Q_k||_F^2 <= (1+eps) ||A - A_k||_F^2 and where pi_{Q_k}(A) is the projection of A onto the rowspace of Q_k then ||A - pi_{Q_k}(A)||_F^2 <= (1+eps) ||A - A_k||_F^2. We also show that Frequent Directions cannot be adapted to a sparse version in an obvious way that retains the l original rows of the matrix, as opposed to a linear combination or sketch of the rows.
cs.DS
cs
Relative Errors for Deterministic Low-Rank Matrix Approximations Mina Ghashami University of Utah Jeff M. Phillips University of Utah [email protected] [email protected] May 17, 2018 Abstract We consider processing an n × d matrix A in a stream with row-wise updates according to a recent algorithm called Frequent Directions (Liberty, KDD 2013). This algorithm maintains an ℓ × d matrix Q deterministically, processing each row in O(dℓ2) time; the processing time can be decreased to O(dℓ) with a slight modification in the algorithm and a constant increase in space. Then for any unit vector x, the matrix Q satisfies We show that if one sets ℓ = ⌈k + k/ε⌉ and returns Qk, a k × d matrix that is simply the top k rows of Q, then we achieve the following properties: 0 ≤ kAxk2 − kQxk2 ≤ kAk2 F /ℓ. kA − Akk2 F ≤ kAk2 F − kQkk2 F ≤ (1 + ε)kA − Akk2 F and where πQk (A) is the projection of A onto the rowspace of Qk then kA − πQk (A)k2 F ≤ (1 + ε)kA − Akk2 F . We also show that Frequent Directions cannot be adapted to a sparse version in an obvious way that retains ℓ original rows of the matrix, as opposed to a linear combination or sketch of the rows. 1 1 Introduction The data streaming paradigm [27] considers computation on a large data set A where one data item arrives at a time, is processed, and then is not read again. It enforces that only a small amount of memory is available at any given time. This small space constraint is critical when the full data set cannot fit in memory or disk. Typically, the amount of space required is traded off with the accuracy of the computation on A. Usually the computation results in some summary S(A) of A, and this trade-off determines how accurate one can be with the available space resources. Although computational runtime is important, in this paper we mainly focus on space constraints and the types of approximation guarantees that can be made. In truly large datasets, one processor (and memory) is often incapable of handling all of the dataset A in a feasible amount of time. Even reading a terabyte of data on a single processor can take many hours. Thus this computation is often spread among some set of processors, and then the summary of A is combined after (or sometimes during [8]) its processing on each processor. Again often each item is read once, whether it comes from a single large source or is being generated on the fly. The key computational problem shifts from updating a summary S(A) when witnessing a single new data item (the streaming model), to taking two summaries S(A1) and S(A2) and constructing a single new summary S(A1 ∪ A2). In this new paradigm the goal is to have the same space-approximation trade-offs in S(A1∪A2) as possible for a streaming algorithm. When such a process is possible, the summary is known as a mergeable summary [2]. Linear sketches are trivially mergeable, so this allows many streaming algorithms to directly translate to this newer paradigm. Again, space is a critical resource since it directly corresponds with the amount of data needed to transmit across the network, and emerging cost bottleneck in big data systems. In this paper we focus on deterministic mergeable summaries for low-rank matrix approximation, based on recent work by Liberty [23], that is already known to be mergeable [23]. Thus our focus is a more careful analysis of the space-error trade off for the algorithm, and we describe them under the streaming setting for simplicity; all bounds directly carry over into mergeable summary results. In particular we re-analyze the Frequent Directions algorithm of Liberty to show it provides relative error bounds for matrix sketching, and conjecture it achieves the optimal space, up to log factors, for any row-update based summary. This supports the strong empirical results of Liberty [23]. His analysis only provided additive error bounds which are hard to compare to more conventional ways of measuring accuracy of matrix approximation algorithms. 1.1 Problem Statement and Related Work In this problem A is an n × d matrix and the stream processes each row ai (of length d) at a time. Typically the matrix is assumed to be tall so n ≫ d, and sometimes the matrix will be assumed to be sparse so the number of non-zero entries nnz(A) of A will be small, nnz(A) ≪ nd (e.g. nnz(A) = O((n + d) log(nd))). The best rank-k approximation to A (under Frobenius or 2 norm) is denoted as Ak and can be computed in O(nd2) time on a tall matrix using the singular value decomposition. The svd(A) produces three matrices U, S, and V where U and V are orthonormal, of size n × n and d × d, respectively, and S is n × d but only has non-zero elements on its diagonal {σ1, . . . , σd}. Let Uk, Sk, and Vk be the first k columns of each matrix, then A = U SV T and Ak = UkSkV T k . Note that although Ak requires O(nd) space, the set of matrices {Uk, Sk, Vk} require only a total of O((n + d)k) space (or O(nk) if the matrix is tall). Moreover, even the set {U, S, V } really only takes O(nd + d2) space since we can drop the last n − d columns of U, and the last n − d rows of S without changing the result. In the streaming version, the goal is to compute something that replicates the effect of Ak using less space and only seeing each row once. Construction bounds. The strongest version, (providing construction bounds) for some parameter ε ∈ (0, 1), is some representation of a rank k matrix A such that kA − Akξ ≤ (1 + ε)kA − Akkξ for ξ = {2, F}. Unless A is sparse, then storing A explicitly may require Ω(nd) space, so that is why various 1 representations of A are used in its place. This can include decompositions similar to the SVD, e.g. a CUR decomposition [11, 15, 24] where A = CU R and where U is small and dense, and C and R are sparse and skinny, or others [7] where the middle matrix is still diagonal. The sparsity is often preserved by constructing the wrapper matrices (e.g. C and R) from the original columns or rows of A. There is an obvious Ω(n + d) space bound for any construction result in order to preserve the column and the row space. Projection bounds. Alternatively, a weaker version (providing projection bounds) just finds a rank k subspace Bk where the projection of A onto this subspace πBk (A) represents A. This bound is weaker since this cannot actually represent A without making another pass over A to do the projection. An even weaker version finds a rank r > k subspace B, where A is represented by the best rank k approximation of πB(A); note that πB(A) is then also rank r, not k. However, when B or Bk is composed of a set of ℓ rows (and perhaps Bk is only k rows) then the total size is only O(dℓ) (allotting constant space for each entry); so it does not depend on n. This is a significant advantage in tall matrices where n ≫ d. Sometimes this subspace approximation is sufficient for downstream analysis, since the rowspace is still (approximately) preserved. For instance, in PCA the goal is to compute the most important directions in the row space. Streaming algorithms. Many of these algorithms are not streaming algorithms. To the best of our under- standing, the best streaming algorithm [6] is due to Clarkson and Woodruff. All bounds assume each matrix entry requires O(log nd) bits. It is randomized and it constructs a decomposition of a rank k matrix A that satisfies kA − AkF ≤ (1 + ε)kA − AkkF , with probability at least 1 − δ. This provides a relative error construction bound of size O((k/ε)(n + d) log(nd)) bits. They also show an Ω((k/ε)(n + d)) bits lower bound. Although not explicitly described in their paper, one can directly use their techniques and analysis to achieve a weak form of a projection bound. One maintains a matrix B = AS with m = O((k/ε) log(1/δ)) columns where S is a d × m matrix where each entry is chosen from {−1, +1} at random. Then setting A = πB(A), achieves a (1 + ε) projection bound, however B is rank O((k/ε) log(1/δ)) and hence that is the only bound on A as well. The construction lower bound suggests that there is an Ω(dk/ε) bits lower bound for projection, but this is not directly proven. They also study this problem in the turnstile model where each element of the matrix can be updated at each step (including subtractions). In this model they require O((k/ε2)(n + d/ε2) log(nd)) bits, and show an Ω((k/ε)(n + d) log(nd)) bits lower bound. F ≤ (1 + ε)kA − Akk2 F . Another more general "coreset" result is provided by Feldman et al. [16]. In the streaming setting it requires O((k/ε) log n) space and can be shown to provide a rank O(k/ε) matrix B that satisfies a relative error bound of the form kA − πB(A)k2 Column sampling. Another line of work [1, 4, 10–15, 24, 30] considers selecting a set of rows from A directly (not maintaining rows that for instance may be linear combinations of rows of A). This maintains sparsity of A implicitly and the resulting summary may be more easily interpretable. Note, they typically consider the transpose of our problem and select columns instead of rows, and sometimes both. An algo- rithm [4] can construct a set of ℓ = (2k/ε)(1+o(1)) columns R so that kA−πR(A)k2 F ≤ (1+ε)kA−Akk2 F . There is an Ω(k/ε) lower bound [10], but this enforces that only rows of the original matrix are retained and does not directly apply to our problem. And these are not streaming algorithms. Although not typically described as streaming algorithms (perhaps because the focus was on sampling columns which already have length n) when a matrix is processed row wise there exists algorithms that can use reservoir sampling to become streaming. The best streaming algorithm [13] samples O(k/ε2) rows (proportional to their squared norm) to obtain a matrix R so that kA − πR(A)k2 F + εkAk2 F , a weaker additive error bound. These techniques can also build approximate decompositions of A instead F ≤ kA − Akk2 2 of using πR(A), but again these decompositions are only known to work with at least 2 passes, and are thus not streaming. Other. There is a wealth of literature on this problem; most recently two algorithms [7, 28] showed how to construct a decomposition of A that has rank k with error bound kA − Ak2 F with constant probability in approximately O(nnz(A)) time. We refer to these papers for a more thorough survey of the history of the area, many other results, and other similar approximate linear algebra applications. But we attempt to report many of the most important related results in Appendix A. F ≤ (1 + ε)kA − Akk2 Finally we mention a recent algorithm by Liberty [23] which runs in O(nd/ε) time, maintains a matrix with 2/ε rows in a row-wise streaming algorithm, and produces a matrix A of rank at most 2/ε so that for any unit vector x of length d satisfies 0 ≤ kAxk2 − k Axk2 ≤ εkAk2 F . We examine a slight variation of this algorithm and describe bounds that it achieves in more familiar terms. Incremental PCA. We mention one additional line of work on incremental PCA [5, 19, 20, 22, 29]. These approaches attempt to maintain the PCA of a dataset A (using SVD and a constant amount of additional bookkeeping space) as each row of A arrives in a stream. In particular, after i − 1 rows they consider maintaining Ai k; ai]) = U iSi(V i)T and, then only retain its top rank k approximation as Ai+1 k )T . This is remarkably similar to Liberty's algorithm [23], but is missing the Misra-Gries [26] step (we describe Liberty's algorithm in more detail in Section 2.2). As a result, incremental PCA can have arbitrarily bad error on adversarial data. k, and on a new row ai compute svd([Ai k = U i k(V i kSi Consider an example where the first k rows generate a matrix Ak with kth singular value σk = 10. Then each row thereafter ai for i > k is orthogonal to the first k rows of A, and has norm 5. This will cause the (k + 1)th right singular vector and value σk+1 of svd([Ai k; ai]) to exactly describe the subspace of ai with σk+1 = 5. Thus this row ai will always be removed on the processing step and Ai+1 k will be unchanged from Ai k. If all rows ai for i > k are pointing in the same direction, this can cause arbitrarily bad errors of all forms of measuring approximation error considered above. 1.2 Our Results Our main result is a deterministic relative error bound for low-rank matrix approximation. A major highlight is that all proofs are, we believe, quite easy to follow. Low-rank matrix approximation. We slightly adapt the streaming algorithm of Liberty [23], called Fre- quent Directions to maintain ℓ = ⌈k + k/ε⌉ rows, which outputs an ℓ × d matrix Q. Then we consider Qk a k × d matrix, the best rank k approximation to Q (which turns out to be its top k rows). We show that and that kA − πQk(A)k2 F ≤ (1 + ε)kA − Akk2 F kA − Akk2 F ≤ kAk2 F − kQkk2 F ≤ (1 + ε)kA − Akk2 F . This algorithm runs in O(ndk2/ε2) time. If we allow ℓ = c⌈k + k/ε⌉ for any constant c > 1, then it can be made to run in O(ndk/ε) time with the same guarantees on Qk. This is the smallest space streaming algorithm known for these bounds. Also, it is deterministic, whereas previous algorithms were randomized. We note that it is common for the bounds to be written without squared norms, for instance as kA − πQk (Q)kF ≤ (1 + ε)kA − AkkF . For ε > 0, if we take the square root of both sides of the bound above kA − πQk(A)k2 F , then we still get a p(1 + ε) ≤ (1 + ε) approximation. F ≤ (1 + ε)kA − Akk2 3 No sparse Frequent Directions. We also consider trying to adapt the Frequent Directions algorithm to column sampling (or rather row sampling), in a way that the ℓ rows it maintains are rows from the original matrix A (possibly re-weighted). This would implicitly preserve the sparsity of A in Q. We show that this is, unfortunately, not possible. 1.3 Matrix Notation Here we quickly review some notation. An n×d matrix A can be written as a set of n rows as [a1; a2; . . . , an] where each ai is a row of length d. Alternatively a matrix V can be written as a set of columns [v1, v2, . . . , vd]. The Frobenius norm of a matrix A is defined kAkF = pPi=1 kaik2 where kaik is Euclidean norm of ai. Let Ak be the best rank k approximation of the matrix A, specifically Ak = arg maxC:rank(C)≤kkA − CkF . Given a row r and a matrix X let πX (r) be a projection operation of r onto the subspace spanned by X. In particular, we will project onto the row space of X, and this can be written as πX(r) = rX T (XX T )+X where Y + indicates taking the Moore-Penrose psuedoinverse of Y . But whether it projects to the row space or the column space will not matter since we will always use the operator inside of a Frobenius norm. This operator can be defined to project matrices R as well, denoted as πX(R), where this can be thought of as projecting each row of the matrix R individually. 2 Review of Related Algorithms We begin by reviewing two streaming algorithms that our results can be seen as an extension. The first is an algorithm for heavy-hitters from Misra-Gries [26] and its improved analysis by Berinde et al. [3]. We re-prove the relevant part of these results in perhaps a simpler way. Next we describe the algorithm of Liberty [23] for low-rank matrix approximation that our analysis is based on. We again re-prove his result, with a few additional intermediate results we will need for our extended analysis. One familiar with the work of Misra-Gries [26], Berinde et al. [3], and Liberty [23] can skip this section, although we will refer to some lemmas re-proven below. 2.1 Relative Error Heavy-Hitters Let A = {a1, . . . , an} be a set of n elements where each ai ∈ [u]. Let fj = {ai ∈ A ai = j} for j ∈ [u]. Assume without loss of generality that fj ≥ fj+1 for all j, and define Fk = Pk j=1 fj. This is just for notation, and not known ahead of time by algorithms. The Misra-Gries algorithm [26] finds counts fj so that for all j ∈ [u] we have 0 ≤ fj − fj ≤ n/ℓ. It only uses ℓ counters and ℓ associated labels and works in a streaming manner as follows, starting with all counters empty (i.e. a count of 0). It processes each ai in (arbitrary) order. To return fj, if there is a label with j, then return the associated counter; otherwise return 0. • If ai matches a label, increment the associated counter. • If not, and there is an empty counter, change the label of the counter to ai and set its counter to 1. • Otherwise, if there are no empty counters, then decrement all counters by 1. Let r be the total number of times that all counters are decremented. We can see that r < n/ℓ since each time one counter is decremented then all ℓ counters (plus the new element) are decremented and must have been non-empty before hand. Thus this can occur at most n/ℓ times otherwise we would have decremented more counts than elements. This also implies that fj − fj ≤ r < n/ℓ since we only do not count an element if it is removed by one of r decrements. This simple, clever algorithm, and its variants, have been rediscovered several times [9, 18, 21, 25]. fj and let Rk = Pu Define Fk = Pk j=k+1 fj = n − Fk. The value Rk represents the total counts that cannot be described (even optimally) if we only use k counters. A bound on Fk − Fk in terms of Rk is more j=1 4 interesting than one in terms of n, since this algorithm is only useful when there are only really k items that matter and the rest can be ignored. We next reprove a result of Berinde et al. [3] (in their Appendix A). Lemma 2.1 (Berinde et al. [3]). The number of decrements is at most r ≤ Rk/(ℓ − k). Proof. On each of r decrements at least ℓ − k counters not in the top k are decremented. These decrements must come from Rk, so each can be charged to at least one count in Rk; the inequality follows. Theorem 2.1. When using ℓ = ⌈k + k/ε⌉ in the Misra-Gries algorithm Fk− Fk ≤ εRk and fj − fj ≤ ε If we use ℓ = ⌈k + 1/ε⌉, then fj − fj ≤ εRk. Proof. Using Lemma 2.1 we have r ≤ Rk/(ℓ − k). Since for all j we have fj − fj ≤ r, then Fk − Fk ≤ rk ≤ Rk ℓ−k . Finally, setting ℓ = k + k/ε results in Fk − Fk ≤ εRk and r ≤ Rk Setting ℓ = k + 1/ε results in fj − fj ≤ r ≤ Rk This result can be viewed as a warm up for the rank k matrix approximation to come, as those techniques ℓ−k = εRk for any j. ℓ−k = ε k Rk. k k Rk. will follow a very similar strategy. 2.2 Additive Error Frequent Directions Recently Liberty [23] discovered how to apply this technique towards sketching matrices. Next we review his approach, and for perspective and completeness re-prove his main results. Algorithm. The input to the problem is an n × d matrix A that has n rows and d columns. It is sometimes d. We now process A one row at a time in a streaming convenient to think of each row ai as a point in R ¯ fashion always maintaining an ℓ × d matrix such that for any unit vector x ∈ R ¯ d kAxk2 − kQxk2 ≤ kAk2 F /ℓ, (1) This invariant (1) guarantees that in any "direction" x (since x is a unit vector in R ¯ where close is defined by the Frobenius norm of kAk2 Liberty's algorithm is described in Algorithm 2.1. At the start of each round, the last row of Q will be all zeros. To process each row ai, we replace the last row (the ℓth row) of Q with ai to create a matrix Qi. We take the SVD of Qi as [U, S, V ] = svd(Qi). Let δ = s2 ℓ , the last (and smallest) diagonal value of S, and in general let sj be the jth diagonal value so S = diag(s1, s2, . . . , sℓ). Now set s′ j − δ for j ∈ [ℓ], and 2, . . . , s′ notice that all values are non-negative and s′ j = qs2 ℓ). Finally set Q = S′V T . ℓ = 0. Set S′ = diag(s′ d), that A and Q are close, F over ℓ. 1, s′ Algorithm 2.1 Frequent Directions (Liberty [23]) Initialize Q0 as an all zeros ℓ × d matrix. for each row ai ∈ A do Set Q+ ← Qi−1 with last row replaced by ai [Z, S, Y ] = svd(Q+) C i = SY T Set δi = s2 ℓ Set S′ = diag(cid:16)ps2 Set Qi = S′Y T [only for notation] [the ℓth entry of S, squared] 2 − δi, . . . ,qs2 1 − δi,ps2 ℓ−1 − δi, 0(cid:17). return Q = Qn It is useful to interpret each row of Y T as a "direction," where the first row is along the direction with the most variance, all rows are orthogonal, and all rows are sorted in order of variance given that they are 5 orthogonal to previous rows. Then multiplying by S′ scales the jth row yj of Y T by s′ the last row of Qi must be zero. j. Since s′ ℓ = 0, then i=1 δi. Analysis. Let ∆ = Pn Lemma 2.2. For any unit vector x ∈ R ¯ Proof. Let Yj be the jth column of Y , then d we have kC ixk2 − kQixk2 ≤ δi. kC ixk2 = ℓ X j=1 s2 jhyj, xi2 = ℓ ℓ ℓ X j=1 ((s′ j)2 + δi)hyj, xi2 = X j=1 (s′ j)2hyj, xi2 + δi X j=1 hyj, xi2 ≤ kQixk2 + δi. Subtracting kQixk2 from both sides completes the proof. Lemma 2.3. For any unit vector x ∈ R ¯ Proof. Notice that kC ixk2 = kQi−1xk2 + kaixk2 for all 2 ≤ i ≤ n and that kQ1xk2 = ka1xk2. By substituting this into inequality from Lemma 2.2, we get d we have 0 ≤ kAxk2 − kQxk2 ≤ ∆. kQi−1xk2 + kaixk2 ≤ kQixk2 + δi Subtracting kQi−1xk2 from both sides and summing over i reveals kAxk2 = n X i=1 kaixk2 ≤ n X i=1 (kQixk2 − kQi−1xk2 + δi) = kQnxk2 − kQ0xk2 + n X i=1 δi = kQnxk2 + ∆. Subtracting kQnxk2 = kQxk2 from both sides proves the second inequality of the lemma. can expand To see the first inequality observe kQi−1xk2 + kaixk2 = kC ixk2 ≤ kQixk2 for all 1 ≤ i ≤ n. Then we kAxk2 = n X i=1 kaixk2 = n X i=1 kC ixk2 − kQi−1xk2 ≥ n X i=1 kQixk2 − kQi−1xk2 = kQxk2. Lemma 2.4 (Liberty [23]). Algorithm 2.1 maintains for any unit vector x that and 0 ≤ kAxk2 − kQxk2 ≤ kAk2 F /ℓ Proof. In the ith round of the algorithm kC ik2 for kaik2 and summing over i we get T = ∆ℓ = kAk2 F = kQik2 F − kQk2 F . F + ℓδi and kC ik2 F = kQi−1k2 F +kaik2. By solving kAk2 F = n X i=1 kaik2 = n X i=1 kQik2 F − kQi−1k2 F + ℓδi = kQk2 F + ℓ∆. This proves the second part of the lemma. Using that kQk2 into Lemma 2.3 yields 0 ≤ kAxk2 − kQxk2 ≤ kAk2 F /ℓ. F ≥ 0 we obtain ∆ ≤ kAk2 F /ℓ. Substituting this 6 3 New Relative Error Bounds for Frequent Directions We now generalize the relative error type bounds for Misra-Gries (in Section 2.1) to the Frequent Directions algorithm (in Section 2.2). Before we proceed with the analysis of the algorithm, we specify some parameters and slightly modify Algorithm 2.1. We always set ℓ = ⌈k + k/ε⌉. Also, instead of returning Q in Algorithm 2.1, as described kY T by Liberty, we return Qk. Here Qk is the best rank k approximation of Q and can be written Qk = S′ k where S′ k and Yk are the first k rows of S′ and Y , respectively. Note that Y = [y1, . . . , yℓ] are the right singular vectors of Q. This way Qk is also rank k (and size k × d), and will have nice approximation properties to Ak. Recall k where [U, Σ, V ] = svd(A) and Uk, Σk, Vk are the first k columns of these matrices, that Ak = UkΣkV T representing the first k principal directions. Let V = [v1, . . . , vd] be the right singular vectors of A. Lemma 3.1. ∆ ≤ kA − Akk2 F /(ℓ − k). Proof. Recall that T = ∆ℓ = kAk2 orthogonal directions throughout the algorithm. Now if r = rank(A) we have: F − kQk2 F is the total squared norm subtracted from all of any set of T = kAk2 X F − kQk2 kAvik2 + = k F i=1 r X i=k+1 kAvik2 − kQk2 F By Lemma 2.4 k X i=1 k X i=1 = ≤ kAvik2 + kA − Akk2 F − kQk2 F kAvik2 + kA − Akk2 F − k X i=1 kQvik2 k k X i=1 kQvik2 < kQk2 F = kA − Akk2 ≤ kA − Akk2 F + X i=1 F + k∆ (cid:0)kAvik2 − kQvik2(cid:1) By Lemma 2.3 kAvik2 − kQvik2 ≤ ∆ Now we solve for T = ∆ℓ ≤ kA − Akk2 F + k∆ to get ∆ ≤ kA − Akk2 F /(ℓ − k). Now we can show that projecting A onto Qk provides a relative error approximation. Lemma 3.2. kA − πQk (A)k2 F ≤ (1 + ε)kA − Akk2 F . 7 Proof. Using the vectors vi as right singular vectors of A, and letting r = rank(A), then we have kA − πQk(A)k2 F = kAk2 F − kπQk (A)k2 F = kAk2 F − ≤ kAk2 F − ≤ kAk2 F − kQyik2 F kQvik2 k X i=1 k X i=1 k k X i=1 kAyik2 Pythagorean theorem By Lemma 2.3 Since j X i=1 kQyik2 ≥ j X i=1 kQvik2 (kAvik2 − ∆) F + k∆ i=1 X ≤ kAk2 = kAk2 ≤ kA − Akk2 F − F − kAkk2 F + Finally, setting ℓ = ⌈k + k/ε⌉ results in kA − πQk(A)k2 k ℓ − kkA − Akk2 F = ℓ ℓ − kkA − Akk2 F ≤ (1 + ε)kA − Akk2 F . F By Lemma 2.3 By Lemma 3.1 We would also like to relate the Frobenius norm of Qk directly to that of Ak, instead of projecting A onto it (which cannot be done in a streaming setting, at least not in ω(n) space). However kA − QkkF does not make sense since Qk has a different number of rows than A. However, we can decompose kA − Akk2 F since Ak is a projection of A onto a (the best rank k) subspace, and we can use the Pythagorean Theorem. Now we can compare kAk2 Lemma 3.3. kAk2 Proof. The first inequality can be seen since F − kAkk2 F ≤ (1 + ε)(kAk2 F to kAk2 F − kAkk2 F ). F − kQkk2 F . F − kAkk2 F − kQkk2 F − kAkk2 F = kAk2 F ≤ kAk2 k kAkk2 F = X kAvik2 ≥ i=1 And the second inequality follows by k X i=1 kAyik2 ≥ k X i=1 kQyik2 = kQkk2 F . kAk2 F − kQkk2 F = kAk2 F − ≤ kAk2 F − ≤ kAk2 F − kQyik2 kQvik2 k X i=1 k X i=1 k ≤ kA − Akk2 F + X i=1 k F + k∆ (kAvik2 − ∆) = kAk2 ℓ − kkA − Akk2 F ≤ (1+ ε)kA− Akk2 F − kAkk2 ℓ − kkA − Akk2 F = (1+ ε)(kAk2 F = ℓ F F −kQkk2 Finally, setting ℓ = k + k/ε results in kAk2 F −kAkk2 F ). One may ask why not compare kAkkF to kQkkF directly, instead of subtracting from kAk2 F . First note that the above bound does guarantee that kAkkF ≥ kQkkF . Second, in situations where a rank k approximation is interesting, then most of the mass from A should be in its top k components. Then kAkkF > kA− AkkF so the above bound is actually tighter. To demonstrate this we can state the following conditional statement comparing kAkkF and kQkkF . 8 Lemma 3.4. If kA − AkkF ≤ kAkkF , then (1 − ε)kAkk2 F ≤ kQkk2 F ≤ kAkk2 F . Proof. The second inequality follows from Lemma 3.3, by subtracting kAk2 Lemma 2.3. F . The first inequality uses kAkk2 F = k X i=1 kAvik2 ≤ k k X i=1 (kQvik2 + ∆) ≤ kQkk2 F + k∆ Finally, we summarize all of our bounds about Algorithm 2.1. ≤ kQkk2 F + ℓ − kkA − Akk2 F ≤ kQkk2 F + εkAkk2 F . Theorem 3.1. Given an input n × d matrix A, by setting ℓ = ⌈k + k/ε⌉ Algorithm 2.1 runs in time O(ndℓ2) = O(ndk2/ε2) time and produces an ℓ × d matrix Q that for any unit vector x ∈ R ¯ d satisfies and the projection of Q along its top k right singular values is a k × d matrix Qk which satisfies 0 ≤ kAxk2 − kQxk2 ≤ kAk2 F /ℓ kA − πQk(A)k2 F ≤ (1 + ε)kA − Akk2 F and kAk2 F − kAkk2 F ≤ kAk2 F − kQkk2 F ≤ (1 + ε)(kAk2 F − kAkk2 F ). Liberty [23] also observes that by increasing ℓ by a constant c > 1 and then processing every ℓ(c − 1) elements in a batch setting (each round results in a cℓ row matrix Q) then the runtime can be reduced to O( c2 c−1 ndℓ) = O(ndk/ε) at the expense of more space. The same trick can be applied here to use ℓ = c⌈k + 2k/ε⌉ rows in total O(ndk/ε) time. 4 No Sparse Frequent Directions In this section we consider extending the frequent directions algorithm described in the previous section to a sparse version. The specific goal is to retain a (re-weighted) set of ℓ rows Q of an input matrix A so that F /ℓ, and also to hopefully extend this so for any unit vector x ∈ R ¯ that kA − πQk(A)k2 F as above. This is an open problem left by Liberty [23]. It is also a useful goal in many scenarios when returning a set of k singular vectors of a matrix that are linear combinations of inputs are hard to interpret; in this case returning a weighted set of actual rows is much more informative. d that 0 ≤ kAxk2 − kQxk2 ≤ kAk2 F ≤ (1 + ε)kA − Akk2 In this section we show that this is not possible by extending the frequent directions algorithm. In particular we consider processing one row in the above framework. The input to the problem is an ℓ × d matrix Q = [w1¯r1; . . . ; wℓ¯rℓ] where each wj is a scalar (initially set to wj = krjk). The output of one round should be an ℓ − 1 × d matrix Q = [ w1¯r1; . . . ; wj−1¯rj−1; wj+1¯rj+1; . . . ; wℓ¯rℓ] where one of the rows, namely rj, is removed and the rest of the rows are re-weighted. Requirements. To make this process work we need the following requirements. Let δi = minj k⊥Q−j (Q)k2 represent the smallest amount of squared norm resulting from removing one row from Q by the procedure above. 1 Assume we remove this row, although removing any row is just as difficult but would create even more error. 1Define ⊥X (Y ) as the orthogonal projection of Y onto X. It projects each row of Y onto the subspace orthogonal to the basis of X. It can be interpreted as ⊥X (Y ) = Y − πX (Y ). Also, we let Q−j be the matrix Q after removing the jth row. 9 The larger the constant (ideally c = 1) the smaller the bound on ℓ. (P1) The Frobenius norm k Qk2 (P2) For any unit vector (direction) x ∈ R ¯ F must be reduced so k Qk2 F ≤ kQk2 F − cℓδi for some absolute constant c. d the difference in norms between Q and Q must be bounded as kQxk2 ≤ k Qxk2 + δi. In the direction v which defines the norm δi = k⊥Q−j (Q)k2 = kQvk2 we have 0 = k Qvk2 and the inequality is tight. And for instance a vector u in the span of Q−j we have that kQuk2 = k Quk2, which makes the right hand side larger. If both (P1) and (P2) hold, then we can run this procedure for all rows of A and obtain a final matrix Q. Using similar analysis as in Section 2.2, for any unit vector x ∈ R ¯ δi ≤ kAk2 kAxk2 − kQxk2 ≤ X F /(cℓ). d we can show i Hard construction. Consider a ℓ × d matrix Q with d > ℓ. Let each row of Q be of the form rj = [1, 0, 0, . . . , 0, 1, 0, . . . , 0] where there is always a 1 in the first column, and another in the (j + 1)th column for row j; the remaining entries are 0. Let x = [1, 0, 0, . . . , 0] be the direction strictly along the dimension represented by the first column. Now δi = minj k⊥Q−j (Q)k2 = 1, since for any jth row rj, when doing an orthogonal projection to Q−j the remaining vector is always exactly in the jth column where that row has a squared norm of 1. For notational simplicity, lets assume we choose to remove row ℓ. We now must re-weight rows r1 though rℓ−1; let the new weights be w2 In order to satisfy (P1) we must have j = w2 j − αj. kQk2 F − k Qk2 F = ℓ X j=1 w2 j − ℓ−1 X j=1 w2 j = w2 ℓ + ℓ−1 X j=1 αj ≥ cℓδi. Since w2 ℓ = 2 and δi = 1 we must have Pℓ−1 j=1 αj ≥ cℓ − 2. In order to satisfy (P2) we consider the vector x as defined above. We can observe kQxk2 = ℓ X j=1 jh¯rj, xi2 = w2 ℓ X j=1 w2 j (1/2). and k Qxk2 = ℓ−1 X j=1 w2 jh¯rj, xi2 = (1/2) ℓ−1 X j=1 (w2 j − αj) = (kQxk2 − 1) − (1/2) ℓ−1 X j=1 αj. Thus we require that Pℓ−1 Combining these requirements yields that j=1 αj ≤ 2δi − 2 = 0, since recall δi = 1. ℓ−1 X j=1 0 ≥ αj ≥ cℓ − 2 Applying the same proof technique as in Section 2.2 to this process reveals, at best, a bound so that for which is only valid when c ≤ 2/ℓ. any direction x ∈ R ¯ d we have kAxk2 − kQxk2 ≤ kAk2 F /2. 10 Acknowledgements We thank Edo Liberty for encouragement and helpful comments, including pointing out several mistakes in an earlier version of this paper. And thank David P. Woodruff, Christos Boutsidis, Dan Feldman, and Christian Sohler for helping interpret some results. References [1] Dimitris Achlioptas and Frank McSherry. Fast computation of low rank matrix approximations. In Proceedings of the 33rd Annual ACM Symposium on Theory of Computing. ACM, 2001. [2] Pankaj K. Agarwal, Graham Cormode, Zengfeng Huang, Jeff M. Phillips, Zhewei Wei, and Ke Yi. In Proceedings 31st ACM Symposium on Principals of Database Systems, Mergeable summaries. pages 23–34, 2012. [3] Radu Berinde, Graham Cormode, Piotr Indyk, and Martin J. Strauss. Space-optimal heavy hitters with strong error bounds. In Proceedings ACM Symposium on Principals of Database Systems, 2009. [4] Christos Boutsidis, Petros Drineas, and Malik Magdon-Ismail. Near optimal column-based matrix reconstruction. In Foundations of Computer Science, 2011 IEEE 52nd Annual Symposium on, pages 305–314. IEEE, 2011. [5] Matthew Brand. Incremental singular value decomposition of uncertain data with missing values. In Computer Vision-ECCV 2002, pages 707–720. Springer, 2002. [6] Kenneth L. Clarkson and David P. Woodruff. Numerical linear algebra in the streaming model. In Proceedings of the 41st Annual ACM Symposium on Theory of Computing, pages 205–214. ACM, 2009. [7] 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. [8] Graham Cormode. The continuous distributed monitoring model. SIGMOD Record, 42, 2013. [9] Erik D Demaine, Alejandro L´opez-Ortiz, and J. Ian Munro. Frequency estimation of internet packet streams with limited space. In Algorithms-ESA 2002, pages 348–360. Springer, 2002. [10] Amit Deshpande and Santosh Vempala. Adaptive sampling and fast low-rank matrix approximation. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, pages 292–303. Springer, 2006. [11] Petros Drineas and Ravi Kannan. Pass efficient algorithms for approximating large matrices. In Pro- ceedings of the 14th Annual ACM-SIAM Symposium on Discrete algorithms. Society for Industrial and Applied Mathematics, 2003. [12] Petros Drineas, Ravi Kannan, and Michael W. Mahoney. Fast monte carlo algorithms for matrices i: Approximating matrix multiplication. SIAM Journal on Computing, 36(1):132–157, 2006. [13] Petros Drineas, Ravi Kannan, and Michael W. Mahoney. Fast monte carlo algorithms for matrices ii: Computing a low-rank approximation to a matrix. SIAM Journal on Computing, 36(1):158–183, 2006. 11 [14] Petros Drineas, Ravi Kannan, and Michael W. Mahoney. Fast monte carlo algorithms for matri- ces iii: Computing a compressed approximate matrix decomposition. SIAM Journal on Computing, 36(1):184–206, 2006. [15] Petros Drineas, Michael W. Mahoney, and S. Muthukrishnan. Relative-error cur matrix decomposi- tions. SIAM Journal on Matrix Analysis and Applications, 30(2):844–881, 2008. [16] Dan Feldman, Melanie Schmidt, and Christian Sohler. Turning big data into tiny data: Constant- size coresets for k-means, PCA and projective clustering. In Proceedings ACM-SIAM Symposium on Discrete Algorithms, 2013. [17] Alan Frieze, Ravi Kannan, and Santosh Vempala. Fast monte-carlo algorithms for finding low-rank approximations. Journal of the ACM (JACM), 51(6):1025–1041, 2004. [18] Lukasz Golab, David DeHaan, Erik D. Demaine, Alejandro Lopez-Ortiz, and J. Ian Munro. Identi- fying frequent items in sliding windows over on-line packet streams. In Proceedings of the 3rd ACM SIGCOMM Conference on Internet Measurement. ACM, 2003. [19] Gene H Golub and Charles F Van Loan. Matrix computations, volume 3. JHUP, 2012. [20] Peter Hall, David Marshall, and Ralph Martin. Incremental eigenanalysis for classification. In British Machine Vision Conference, volume 1. Citeseer, 1998. [21] Richard M. Karp, Scott Shenker, and Christos H. Papadimitriou. A simple algorithm for finding frequent elements in streams and bags. ACM Transactions on Database Systems, 28(1):51–55, 2003. [22] A Levey and Michael Lindenbaum. Sequential karhunen-loeve basis extraction and its application to images. Image Processing, IEEE Transactions on, 9(8):1371–1374, 2000. [23] Edo Liberty. Simple and deterministic matrix sketching. In Proceedings 19th ACM Conference on Knowledge Discovery and Data Mining, (arXiv:1206.0594 in June 2012), 2013. [24] Michael W. Mahoney and Petros Drineas. Cur matrix decompositions for improved data analysis. Proceedings of the National Academy of Sciences, 106(3):697–702, 2009. [25] Ahmed Metwally, Divyakant Agrawal, and Amr El. Abbadi. An integrated efficient solution for computing frequent and top-k elements in data streams. ACM Transactions on Database Systems, 31(3):1095–1133, 2006. [26] J. Misra and D. Gries. Finding repeated elements. Sc. Comp. Prog., 2:143–152, 1982. [27] S. Muthukrishnan. Data Streams: Algorithms and Applications. Foundations and Trends in Theoretical Computer Science. Now publishers, 2005. [28] Jelani Nelson and Huy L. Nguyen. OSNAP: Faster numerical linear algebra algorithms via sparser In Proceedings 54th IEEE Syposium on Foundations of Computer Science, subspace embeddings. 2013. [29] David A Ross, Jongwoo Lim, Ruei-Sung Lin, and Ming-Hsuan Yang. Incremental learning for robust visual tracking. International Journal of Computer Vision, 77(1-3):125–141, 2008. [30] Mark Rudelson and Roman Vershynin. Sampling from large matrices: An approach through geometric functional analysis. Journal of the ACM, 54(4):21, 2007. 12 [31] Tamas Sarlos. Improved approximation algorithms for large matrices via random projections. In Foundations of Computer Science, 2006. FOCS'06. 47th Annual IEEE Symposium on. IEEE, 2006. 13 A Tables of Previous Bounds In this appendix we try to survey the landscape of work in low-rank matrix approximation. There are many types of bounds, models of construction, and algorithms. We tried to group them into three main categories: Streaming, Fast Runtime, and Column Sampling. We also tried to write bounds in a consistent compatible format. To do so, some parts needed to be slightly simplified – hopefully we got everything correct. The authors will be glad to know if we missed or misrepresented any results. The space and time bounds are given in terms of n (the number of rows), d (the number of columns), k (the specified rank to approximate), r (the rank of input matrix A), ε (an error parameter), and δ (the probability of failure of a randomized algorithm). An expresion O(x) hides poly log(x) terms. The size is sometimes measured in terms of the number of columns (#C) and/or the number of rows (#R). Otherwise, if #R or #C is not specified the space refers the number of words in the RAM model where it is assumed O(log nd) bits fit in a single word. The error is of one of several forms. • A projection result builds a subspace G so that A = πG(A), but does not actually construct πG(A). This is denoted by P. Ideally rank(G) = k. When that is not the case, then it is denoted Pr where r is replaced by the rank of G. • A construction result builds a series of (usually 3) matrices (say C, U, and R) where A = CU R. Note again, it does not construct A since it may be of larger size than all of C, U, and R together, but the three matrices can be used in place of A. This is denoted C. mation to A. This is denoted εR. • ε-relative error is of the form kA − AkF ≤ (1 + ε)kA − AkkF where Ak is the best rank-k approxi- • ε-additive error is of the form kA − Ak2 F . This is denoted εA. F ≤ kA − Akk2 F + εkAk2 This can sometimes also be expressed as a spectral norm of the form kA− Ak2 F still has a Frobenius norm). This is denoted εL2. (note the error term εkAk2 • In a few cases the error does not follow these patterns and we specially denote it. • Algorithms are randomized unless it is specified. In all tables we state bounds for a constant probabil- ity of failure. If we want to decrease the probability of failure to some parameter δ, we can generally increase the size and runtime by O(log(1/δ)). 2 ≤ kA−Akk2 2 +εkAk2 F 14 Paper DKM06 [13] LinearTimeSVD Sar06 [31] turnstile CW09 [6] CW09 [6] CW09 [6] turnstile FSS13 [16] deterministic Lib13 [23] deterministic, rank(Q) ≤ 2/ε Lib13 [23] deterministic, ρ = kAk2 This paper deterministic F /kAk2 2 Streaming algorithms Space #R = O(1/ε2) O((d + 1/ε2)/ε4) #R = O(k/ε2) O((k/ε2)2(d + k/ε2)) #R = O(k/ε + k log k) O(d(k/ε + k log k)) #R = O(k/ε) O((n + d)(k/ε)) O((k/ε2)(n + d/ε2)) O((dk/ε) log n) Time Bound O((d + 1/ε2)/ε4 + nnz(A)) P, εL2 O((k/ε2)2(d + k/ε2) + nnz(A)) O(nnz(A)(k/ε + k log k) + d(k/ε + k log k)2)) O(nd2 + (ndk/ε)) O(nd2 + (ndk/ε)) O(n(k/ε2)2 + nd(k/ε2) + nd2) n((dk/ε) log n)O(1) P, εA PO(k/ε+k log k), εR PO(k/ε), εR C, εR C, εR P2⌈k/ε⌉, εR #R = 2/ε O(d/ε) #R = O(ρ/ε) O(dρ/ε) O(nd/ε) O(ndρ/ε) Any unit vector x 0 ≤ kAxk2 − kQxk2 ≤ εkAk2 PO(ρ/ε), εL2 F #R = ⌈k/ε + k⌉ O(dk/ε) #R = c⌈k/ε + k⌉, c > 1 O(dk/ε) O(ndk2/ε2) O( c2 c−1ndk/ε) P, εR P, εR Paper AM01 [1] Space O(nd) Time O(nd) Algorithms with Fast Runtime Bound kA − Akk2 ≤ + Akk2 kA 10(maxi,j Aij)√n + d C, εR − CW13 [7] NN13 [28] O((k2/ε6) log4(k/ε) (nk/ε3) log2(k/ε) (nk/ε) log(k/ε)) ? ? + + O(nnz(A)) + O(nk2/ε4 + k3/ε5) O(nnz(A)) + O(nk2 + nk1.37ε−3.37 + k2.37ε−4.37) O(nnz(A) logO(1) k) + O(nk1.37ε−3.37 + k2.37ε−4.37) C, εR C, εR 15 Paper FKV04 [17] DV06 [10] Column Sampling algorithms Time Space O(k4/ε6 max(k4, ε−2)) O(k5/ε6 max(k4, ε−2)) #C = O(k/ε + k2 log k) O(n(k/ε + k2 log k)) DKM06 [13] "LinearTimeSVD" DKM06 [13] "ConstantTimeSVD" DMM08 [15] "CUR" MD09 [24] "ColumnSelect" BDM11 [4] #C = O(1/ε2) O((n + 1/ε2)/ε4) #C = O(k/ε2) O((k/ε2)(n + k/ε2)) #C+R = O(1/ε4) O(1/ε12 + nk/ε4) #C+R = O(k2/ε4) O(k6/ε12 + nk3/ε4) #C =O(k2/ε2) #R = O(k4/ε6) #C = O(k log k/ε2) O(nk log k/ε2) #C = 2k/ε(1 + o(1)) O(nnz(A)(k/ε + k2 log k)+ (n + d)(k2/ε2 + k3 log(k/ε) + k4 log2 k)) O((n + 1/ε2)/ε4 + nnz(A)) Bound P, εA P, εR P, εL2 O((k/ε2)2(n + k/ε2) + nnz(A)) P, εA O((1/ε12 + nk/ε4 + nnz(A)) O(k6/ε12 + nk3/ε4 + nnz(A)) O(nd2) O(nd2) O((ndk + dk3)ε−2/3) P, εL2 P, εA C, εR PO(k log k/ε2), εR P2k/ε(1+o(1)), εR 16
1807.03721
1
1807
2018-07-10T15:46:41
On the complexity of the (approximate) nearest colored node problem
[ "cs.DS" ]
Given a graph $G=(V,E)$ where each vertex is assigned a color from the set $C=\{c_1, c_2, .., c_\sigma\}$. In the (approximate) nearest colored node problem, we want to query, given $v \in V$ and $c \in C$, for the (approximate) distance $\widehat{\mathbf{dist}}(v, c)$ from $v$ to the nearest node of color $c$. For any integer $1 \leq k \leq \log n$, we present a Color Distance Oracle (also often referred to as Vertex-label Distance Oracle) of stretch $4k-5$ using space $O(kn\sigma^{1/k})$ and query time $O(\log{k})$. This improves the query time from $O(k)$ to $O(\log{k})$ over the best known Color Distance Oracle by Chechik \cite{DBLP:journals/corr/abs-1109-3114}. We then prove a lower bound in the cell probe model showing that our query time is optimal in regard to space up to constant factors. We also investigate dynamic settings of the problem and find new upper and lower bounds.
cs.DS
cs
On the complexity of the (approximate) nearest colored node problem Maximilian Probst ∗ July 11, 2018 Abstract Given a graph G = (V, E) where each vertex is assigned a color from the set C = {c1, c2, .., cσ}. In the (approximate) nearest colored node problem, we want to query, given v ∈ V and c ∈ C, for the (approximate) distance ddist(v, c) from v to the nearest node of color c. For any integer 1 ≤ k ≤ log n, we present a Color Distance Oracle (also often referred to as Vertex-label Distance Oracle) of stretch 4k − 5 using space O(knσ1/k) and query time O(log k). This improves the query time from O(k) to O(log k) over the best known Color Distance Oracle by Chechik [6]. We then prove a lower bound in the cell probe model showing that even for unweighted undirected paths any static data structure that uses space S requires at least Ω(cid:16)log log(S/n)+log log n(cid:17) query time to give a distance log σ estimate of stretch O(polylog(n)). This implies for the important case when σ = Θ(nǫ) for some constant 0 < ǫ < 1, that our Color Distance Oracle has asymptotically optimal query time in regard to k, and that recent Color Distance Oracles for trees [23] and planar graphs [16] achieve asymptotically optimal query time in regard to n. We also investigate the setting where the data structure additionally has to support color-reassignments. We present the first Color Distance Oracle that achieves query times matching our lower bound from the static setting for large stretch yielding an exponential improvement over the best known query time [7]. Finally, we give new conditional lower bounds proving the hardness of answering queries if edge insertions and deletion are allowed that strictly improve over recent bounds in time and generality. 1 Introduction In the static nearest colored node problem, we are given a graph G = (V, E) and a color set C = {c1, c2, .., cσ} with a function c : V −→ C mapping each vertex to a color in C and we want to compute and store the distance distG(u, c) denoting the distance from each vertex u ∈ V to the nearest vertex v of color c ∈ C or more formally distG(u, c) = minv∈Vcdist(u, v) where Vc denote the set of c- colored vertices. Clearly, if the color set C is of small cardinality, computing ∗BARC, University of Copenhagen, Universitetsparken 5, Copenhagen 2100, Denmark, The author is supported by Basic Algorithms Research Copenhagen (BARC), supported by Thorup's Investigator Grant from the Villum Foundation under Grant No. 16582. 1 Graph Family Approximation Unweighted undirected path O(polylog(n)) Tree Planar graphs Planar digraphs General graphs Exact 1 + ǫ 1 + ǫ 4k − 5 General graphs 8(1 + ǫ)k Space Query Time Ref log σ log(S/n)+log log n(cid:17) New Ω(cid:16)log log w(cid:17) O(cid:16)log log σ [23] [16] [16] New New S O(n) O(n log n) O(n log n) O(log log n) O(log log n log log(nN )) O(log k) O(knσ1/k) log w(cid:17) O(kn1+1/k log n) O(cid:16)log log σ Table 1: Best upper and lower bounds for static Color Distance Oracles. N denotes the weight of the heaviest edge in the graph. The w in the second column refers to the word size and we assume in this article that w = Θ(log n). N refers to the heaviest edge weight in the graph. distances and storing a distance matrix is an efficient measure but for large σ, i.e. σ = Ω(nǫ) for some ǫ > 0, this solution becomes impractical for many important applications. The problem has various applications in navigation, routing and document processing, often in connection to locating resources or facilities, e.g. the nearest gas station, quickly. In this article, we present a new data structure that reports for any given v ∈ V, c ∈ C a distance estimate ddist(v, c) in O(log k) time such that dist(v, c) ≤ ddist(v, c) ≤ (4k − 5)dist(v, c) using O(knσ1/k) space for every positive integer k, improving on O(k) query time of the previous data structure with same space consumption and stretch factor [6]. We refer to the data structure as Color Distance Oracle. In other literature, the problem is also studied as the vertex-to-label problem and the data structure is referred to as Vertex-label Distance Oracle [13][6]. The term Distance Oracle originates from the classic Thorup-Zwick Distance Oracle [22] that reports distance estimates for each pair of vertices. Thorup, Zwick and Roddity [20] also generalized Distance Oracles by introducing source-restricted Distance Oracles where only distances in S × V can be queried for some subset S ⊆ V and that uses space O(nS1/k) for stretch 2k − 1. It is tempting to approach the nearest colored node problem by using an auxiliary vertex for each color c ∈ C linking it to all c-colored vertices with a zero-weight edge and let the auxiliary vertices define the set S. Unfortunately, this might decrease some vertex-to-color distances by creating "portals" through the auxiliary vertices. Instead the underlying sampling techniques can, together with a more advanced analysis stemming from Compact Routing Schemes [21], be used to construct efficient and correct Color Distance Oracles. Color Distance Oracles can also be seen as a generalization of (source-restricted) Distance Ora- cles as we can choose a color set of size S and assign each vertex in S a unique color. We first present a Color Distance Oracle of space O(knσ1/k) that reports in O(log k) time distance estimate of stretch at most (4k − 5). Our Color Distance Oracle matches space and stretch of the best data structure by Chechik [6] and improves the query time from O(k) to O(log k). This is in fact achieved by combining Chechiks result with a well-known technique by Wulff-Nilsen [25] for general distance oracles. Our contribution is to simplify the technique of Wulff- Nilsen by observing that a Range Minimum Query (RMQ) data structure can be used to replace his tailor-made data structure even more efficiently resulting in a concise and simple algorithm; and to generalize the proof technique of 2 Wulff-Nilsen. Recently, Chechik has also shown that classic Distance Oracles can be implemented with constant query time [8][7] and it is natural to ask whether this improvement carries over to Color Distance Oracles. Our new lower bound rules out such an improvement and shows that our Color Distance Oracle has essentially tight query time when σ = Θ(nǫ) for constant 0 < ǫ < 1, as the lower bound then simplifies to Ω(log(ǫk)) for S = n1+1/k for all values of k = O(polylog(n)). Our result extends to prove asymptotic optimality in query time in regard to n for the best known Color Distance Oracles for trees [11][23] and planar graphs [16] even for data structures with higher stretch k = O(polylog(n)). This lower bound, that is our main contribution, is thus a significant step in understanding Color Distance Oracles and their limitations. An overview over the best upper bounds for different graph families and our lower bound is given in table 1. We also present a new Color Distance Oracle for the setting where the data structure needs to handle color-reassignments, i.e. updates in which a vertex v ∈ V is assigned a new color c ∈ C such that afterwards c(v) = c. Our Color Distance Oracle is conceptually simple, building on some recent results in Ramsey theory[2] and can be constructed deterministically. It strictly improves on query and update time for any approximation factor k = Ω( log n log log n ) and dominates existing data structures in query time for k = Ω(log log n). We are also able to show an elegant trade-off between query and update time that log log n ) our data structure requires O(n) was unknown before. For k = Ω( log n space and updates only take polylogarithmic time. Therefore our static lower bound extends to this setting as we can start with an uncolored graph and color vertices in n updates. This implies that our query time is tight with regard to n. Achieving query time O(log log n) is rather surprising given that queries for exact distances take Ω( log n log log n ) time even on unweighted balanced trees and that for the static setting approximation doesn't admit any query time improvements. An overview over upper bounds and lower bounds for the color-reassignment setting is given in table 2. Finally, we prove that the dynamic version of the problem, allowing edge insertions and deletions, cannot process updates in time o(σ)1 and queries in time o(n/σ) even on unweighted path graphs for queries that ask to report given a fixed source s ∈ V whether there is a vertex of color c in the same component, unless Online Matrix Multiplication(OMv) has a truly subcubic time algorithm. We then show that even update time o(σ) and query time o(n) is not possible if we have directed general graph or ask for distance queries of approximation factor < 5/3. Combined they strictly improve in generality and query time over a recent lower bound by Gawrychowski et al. [11] showing that for weighted trees, query and update time o(√n) where σ = Θ(√n) would imply a truly subcubic solution to tripartite APSP. Our reduction implies an interesting connection to Pagh's problem and the lower bound is in fact obtained by adapting the reduction from Pagh's problem in [12]. 1We use the o(f (n))-notation as introduced by Henzinger et al. [12] to denote that the running time is in O(f (n)1−ǫ) for some ǫ > 0. For multiple parameters we let o(n1n2n3) be equivalent to O(n1−ǫ ) for some ǫ > 0. 1 n2n3 + n1n1−ǫ 2 n3 + n1n2n1−ǫ 3 3 Approx- imation Update Time Query Time Ref O(polylog(n)) O(polylog(n)) log σ log(S/n)+log log n(cid:17) New Graph Family Unweighted undirected path Unweighted tree Tree Planar graphs Planar digraphs General graphs exact exact exact 1 + ǫ 1 + ǫ 1 + ǫ < 3 4k − 5 8(1 + ǫ)k 8(1 + ǫ)k O(polylog(n)) O(log n) O(log1+ǫ n) O(ǫ−1 log(n) log log(n)) log log(n) (cid:19) O(cid:18)ǫ−1 log2(ǫ−1 n) O(ǫ−1 log(n) log log(nN )) Ω(n1−ǫ) O(kn1/k log1−1/k n log log n) Ω(cid:16)log Ω(cid:16) log(n) O(cid:16) log(n) O(ǫ−1 log(n) log(nN ) log log(n)) log log(n)(cid:17) log log(n)(cid:17) O (log n) O(ǫ−1 log1.51(ǫ−1n)) O(ǫ−1 log3(n) log(nN )) Ω(n2−ǫ) O(k) O(cid:16)ǫ−1kn1/k log log n(cid:17) O (log log n) O (log log n) O(cid:16)ǫ−1kn1/k log log n(cid:17) [11] [11] [11] [14] [14] [14] [12] [6] New New Table 2: Best upper and lower bounds for Color Distance Oracles supporting color-reassignments. Here N denote the heaviest edge weight in the graph. The lower bound from [12] applies to update or query time for every ǫ > 0. More precisely, any algorithm with update timeo(n1−ǫ) and o(n2−ǫ) would refute the OMv-conjecture. 2 Preliminaries We denote by dist(u, v) for u, v ∈ V the shortest-path distance from u to v and by dist(u, c) with u ∈ V, c ∈ C the shortest-path distance between u and the nearest vertex of color c. When the context is clear, we often only refer to the nearest colored vertex instead of the nearest vertex of color c and let c denote the color under consideration. We let v = Nearest(u, c) denote the nearest vertex of color c to u, i.e. dist(u, c) = dist(u, Nearest(u, c)). We also make use of the following data structures. Predecessor Search Problem. In the predecessor search problem, we are given a universe U = {0, .., m − 1} = [m] and a subset S ⊆ U of size n = S. Given an element x ∈ U , we ask for the largest element in S that is smaller than x or more formally, we ask for the predecessor of x, Pred(x) = max{y ∈ Sy < x}. We let the successor of x be Succ(x) = min{y ∈ Sy > x}. Patra¸scu and Thorup present in [18] a predecessor search data structures that solves queries and updates (insertions and deletions into/from S) in O(log log n) time and linear space and give a lower bound of Ω(log log n/ log log log n) if m ≤ poly(n) and only almost linear-space is given. Range Minimum Query (RMQ). A RMQ is a structure augmenting an array A[1..n] answering queries of the form Rmq(i, j) = mink∈[i,j] A[k] by returning the index of field with the minimal value, for any 1 ≤ i ≤ j ≤ n. RMQ can be solved with O(n) preprocessing time, taking O(n) space and O(1) query time [5][10]. Least Common Ancestor (LCA). The LCA problem is the problem of finding the least common ancestor in T , which we denote Lca(x, y) T , of any two nodes x, y ∈ V(T ). The LCA problem can be reduced to RMQ and can therefore be implemented within the same bounds. 4 Hash table. Given a universe U = [m] and a (dynamic) subset S ∈ U , with n = S, we can query for any x ∈ U whether x is in S. In [9], a data structure is presented that can run deterministic queries in constant time and updates of the set S, i.e. insertions and deletions, in constant amortized time. 3 Static Color Distance Oracle We construct our Color Distance Oracle as in [6] with the classic techniques by Thorup and Zwick [22]: For a given positive integer k, we construct the vertex sets V = A0 ⊇ A1 ⊇ A2 ⊇ ··· ⊇ Ak−1, where Ai is obtained by sampling each vertex in Ai−1 with probability σ−1/k, for 1 ≤ i ≤ k − 1, and define the set Ak = ∅. For each vertex v in V , we store for each set Ai with 0 ≤ i ≤ k − 1 the closest neighbour in Ai denoted by pi(v), where we break ties arbitrarily. For every v ∈ V , we define ∆i(v) = dist(v, pi+1(v))−dist(v, pi), for 0 ≤ i < k−1. We then store all such distances in a consecutive array Pv[0..k−2] with Pv[i] = ∆i(v) for all i and augment Pv by a RMQ-structure that returns the maximum value in a subarray. We denote a query on the RMQ structure over Pv in the range a to b by Rmqv(a, b) for any 0 ≤ a ≤ b < k − 1. We define a bunch B(v) for every vertex v in V as follows B(v) = {u ∈ Ai \ Ai+1dist(v, u) < dist(v, pi+1(v))} k−1[i=0 and construct for every color c ∈ C a bunch B(c) = Sv∈Vc B(v). With each B(c), we store in a hash table the vertices v ∈ B(c) and associate with their key the distance dist(v, c). This completes our construction. The following lemma bounds space and construction time, but we defer the proof to the appendix since it only differs by bounding the space of the RMQ data structures from the proof in [6]. Lemma 1. We use at most space O(knσ1/k) to represent the Color Distance Oracle and construction time O(mσ). Note that the construction cost can be slightly improved for σ > nk/(2k−1) using the construction of Hermelin et al. [13] but our query time improvement doesn't carry over to their construction. We give the following query algorithm for color c ∈ C and vertex v ∈ V : Listing 1: Query(v,c) lower bound ← 0 upper bound ← k − 1 While upper bound 6= lower bound Do i ← ⌈(lower bound + upper bound)/2⌉ // Compute i n d e x j s . j ← Rmqv(lower bound, i − 1) I f pj(v) 6∈ B(c) Then t . ∆j(v) = maxa∈{lower bound,..,i−1} ∆a(v) E l s e lower bound ← i upper bound ← j 5 End End Return plower bound(v) We claim that the query procedure returns a colored vertex wc for wc = plower bound(v) whose distance to v is dist(v, c) ≤ dist(v, wc) ≤ (4k−5)dist(v, c). For the rest of the section, we let wbest = Nearest(v, c). As in [25], we let I be the sequence 0, .., k − 1. We call an index j ∈ I, (v, c)-terminal if pj(v) ∈ B(c). We say that a subsequence i1, .., i2 of I is (v, c)- feasible if (1) dist(v, pi1 (v)) ≤ 2i1dist(v, c), and (2) i2 is (v, c)-terminal. Using these definitions we are ready to prove our claim in the ensuing two lemmas. Lemma 2. Let i1, .., i2 ⊆ I, with I > 1, be (v, c)-feasible and let i = ⌈(i1 + i2)/2⌉. Let I ′ be the sequence i1, .., i−1. Let j be the index in I ′, that maximizes ∆j(v). Then if j 6∈ B(c) the subsequence i, .., i2 is (v, c)-feasible. Otherwise, the subsequence i1, .., j is (v, c)-feasible. The obtained subsequence is of size at most 2 3I. Proof. If pj(v) ∈ B(c), then j is (v, c)-terminal. Hence i1, ..j is (v, c)-feasible. As j ≤ ⌈(i1 + i2)/2⌉ − 1 < (i1 + i2)/2 and I > 1 the subsequence is of size at most 1 2I. Now, consider the case where pj(v) 6∈ B(c). Then dist(wbest, pj+1(wbest)) < dist(wbest, pj(v)). We can now employ the analysis from [21]: dist(v, pj+1(v)) ≤ dist(v, pj+1(wbest)) ≤ dist(wbest, v) + dist(wbest, pj+1(wbest)) < dist(wbest, v) + dist(wbest, pj(v)) ≤ 2dist(wbest, v) + dist(v, pj (v)) (1) Therefore ∆j(v) = dist(v, pj+1(v)) − dist(v, pj(v)) ≤ 2dist(wbest, v). Since i1, .., i2 is (v, c)-feasible, we have dist(v, pi1 (v)) ≤ 2i1dist(v, c). By choice of j, dist(v, pi(v)) = 2i1dist(v, wbest) + Xj ′∈I ′ ≤ 2i1dist(v, wbest) + I ′ max = 2i1dist(v, wbest) + (i − i1)∆j(v) = 2idist(v, wbest) ∆j ′ (v) j ′∈I ′ ∆j ′ (v) (2) 2 As i2 is (v, c)-terminal, we therefore get that i, .., i2 is (v, c)-feasible. It is now easy to see that by choice of i and as I > 1 the derived sequence is smaller 3I. Lemma 3. The algorithm given in procedure Query(v, c) reports a distance estimate with stretch at most (4k − 5) in time O(log k). Proof. By lemma 2 the number of potential indices reduces by factor 2 3 by every iteration of the loop. Therefore, we have at most log 3 k iterations. As querying the RMQ data structure takes constant time the overall running time is O(log k). 2 6 To show stretch of at most 4k − 5, we observe that the final sequence has only a single index j ≤ k − 1, and as the sequence is still (v, c)-feasible, we get by property (1) that dist(v, pj(v)) ≤ 2jdist(v, wbest) ≤ 2(k − 1)dist(v, wbest). By property (2), we get that pj(v) ∈ B(c) and we can bound dist(pj(v), c) = dist(pj(v), wbest) ≤ dist(v, wbest) + dist(v, pj(v)) ≤ dist(v, wbest) + 2(k − 1)dist(v, wbest) (3) giving an overall distance of dist(v, pj(v))+dist(pj(v), c) ≤ (4k−3)dist(v, wbest). This can be slightly improved to stretch 4k − 5 by using the technique from [21](Lemma A.2) even without changing the overall approach. We only have to adapt property (1) in the definition of (v, c)-feasible sequences i1, .., i2 to dist(v, pi1 (v)) ≤ (2i1 − 1)dist(v, c), and adapt lemma 2 to directly get the improvement. We point out that the technique presented to query the Color Distance Oracle extends to Compact Routing Schemes as described by Thorup and Zwick [21] such that paths can be computed in O(log k) time. By using a recently devised succinct RMQ structure that is only allowed to query intervals where both indices are multiples of log k by Tsur [23], we can adapt our approach to reduce the intervals as described in lemma 2 down to size O(log k) and then test each remaining index in O(log k) overall time. The data structure only requires O(cid:16) k log log k log k (cid:17) = o(k) additional bits compared to O(k log n) bits required for our preceding structure. This is an important improvement for routing schemes as the RMQ structure needs to be appended to each label in order to achieve the query time improvement. 4 Supporting color-reassignments In this section, we let (V, dist) denote a n-point metric space and let the met- ric be denoted by ρ. We say that ρ is an ultrametric for V if it is a metric that ensures the strong triangle inequality ρ(x, z) ≤ max{ρ(x, y), ρ(y, z)} for all x, y, z ∈ V . It is well-known, that a finite ultrametric can be represented by a rooted hierarchically well-separated tree (HST)2 T = (VT , ET ) with a value assigned to each vertex in VT by the function ∆ : VT → (0,∞) whose leaf set is V and where ∆(v) < ∆(Parent(v)) for any v ∈ VT . Then given x, y ∈ V , ρ(x, y) = ∆(lcaT (x, y)). Thus, working with ultrametrics is very convenient as they allow to reduce problems to problems on trees which are normally well- understood. In 2005, Mendel and Naor [15] showed a Las Vegas algorithm that given a metric space (V, dist) finds a ultrametric ρ such that for a subset U ⊆ V of size U ≥ V 1−1/k the distortion of the ultrametric would be low, i.e. that for each u ∈ U, v ∈ V, dist(u, v) ≤ ρ(u, v) ≤ 128kdist(u, v). They then showed that given this algorithm, a collection of ultrametrics R = {φ1, φ2, .., φs} with E[s] = O(kn1/k) can be found together with a function home : V → [1, s] such that for each u, v ∈ V with i = home(v) dist(u, v) ≤ ρi(u, v) ≤ 128kdist(u, v) 2A good introduction to HSTs and metric representations can be found in [3]. 7 Recently, Abraham et al. [2] gave a deterministic algorithm that improves this result to stretch 8(1 + ǫ)k by increasing the size of the collection R by factor O(ǫ−1). Thus, for fixed ǫ the space only differs by a constant factor. For our Color Distance Oracle, we find a collection of ultrametrics R and build for each ultrametric ρi ∈ R an HST Ti. Additionally, we store with each v ∈ V a pointer to Thome(v). We observe that taking minu∈Vc ∆(LcaThome(v) (u, v)) always gives a 8(1 + ǫ)k approximation on dist(v, c) as we take the smallest distance estimate among all estimates to colored vertices and each of them is at least 8(1 + ǫ)k approximate in the represented metric ρhome(v). Let a be the least common ancestor of v and the nearest colored node in Thome(v), i.e. a = LcaThome(v) (v, Nearest(v, c)). Then, there cannot be any vertex a′ on the path from v to a in Thome(v) with a colored vertex in its subtree as otherwise a′ would be the least common ancestor of v and the colored node and by the property of HSTs that ∆(x) < ∆(Parent(x)) for all x ∈ V , we would thus derive a contradiction on the minimality of ∆(a). We conclude that to derive a distance estimate on dist(v, c), we only need to find the nearest ancestor of v that has a colored node in its subtree. We therefore construct the data structure described in the following lemma 4 over each HST, whose proof is deferred to the appendix. Lemma 4. We can maintain a data structure over a tree T = (V, E) with function c : V → C as defined before, that given v ∈ V, c ∈ C finds the nearest ancestor of v in T that has a c-colored vertex in its subtree and that is able to process color-reassignments. Both operations take O(log log n) worst-case time and the data structure requires O(n) space. As every HST requires at most O(n) space and s = O(ǫ−1kn1/k), our data structure requires space O(ǫ−1kn1+1/k). To achieve the data structure with fast query time, we answer a query for ddist(v, c) by querying the data structure described in lemma 4 on tree Thome(v) returning the nearest colored ancestor a and we return ∆(a). Thus only a single invocation of the tree structure is required which can be implemented in time O(log log n). For updates, we iterate over all s tree data structures and invoke the color-reassignment on the same parameters. This takes O(log log n) time per tree and as we have s trees, the running time is bound by O(ǫ−1 log log nkn1/k). For fast update times, we can process a color-reassignment v ∈ V, c ∈ C by changing the color in Thome(v) only leaving v without a color in all other trees. If we run our query for v ∈ V, c ∈ C on every of the s HSTs, we also know that our distance estimate is a 8(1 + ǫ)k approximation as we check every ultrametric and we are sure that for each vertex u ∈ V, c(u) = c we once queried the HST Thome(u) where u is colored and ∆(Lca(v, u)) is a 8(1 + ǫ)k approxi- mation. By standard techniques [15], we can also reduce the space consumption to O(ǫ−1n1+1/k) for the data structure with fast updates. The data structure from lemma 4 can easily be adapted to give a c-colored witness u such that dist(v, u) ≤ 8(1 + ǫ)kdist(v, c). Finally, if we are only interested in queries, we can for each vertex v of color c in a tree color all its ancestors with c where we allow multiple colors. As HSTs can be balanced, we get an additional factor of O(log n) in our data structures. We can then for each color use a succinct 8 nearest marked ancestor structure as presented by Tsur [23] with O(log log σ log w ) query time. 5 Lower bound for static Color Distance Oracles In this section we prove the following lower bound. Theorem 1. Consider an unweighted path G = (V, E) with coloring c : V → C and σ ≤ O(n1−ǫ) for any ǫ > 0. Then, any data structure, using space S on a machine with word size w = Θ(lg n), reporting nearest colored node distance estimates of approximation k = O(polylog(n)) has query time Ω log log σ n + log log n! log S The theorem applies to deterministic and randomized queries, admitting a con- stant error probability. Our proof extends recent results by Gawrychowski et al. [11] who proved a similar statement for the exact version of the problem. Before we prove our result, we review their lower bound and then show how to extend it. The lower bound for the exact version of the problem is based on a reduction from the colored predecessor problem which was used to establish hardness of the predecessor problem [18, 19] in the cell-probe model. Belazzougui and Navarro showed in [4] that colored predecessor search can be reduced to the rank query problem using partial sum data structures and clever mapping. In the rank query problem, a sequence S[1, n] and an alphabet [1, σ] is given with each S[i] ∈ [1, σ] and after the preprocessing, given an index i ∈ [1, n] and a symbol c ∈ [1, σ] the data structure has to report the number of occurrences of c in the subsequence S[1, i). Finally, Gawrychowski et al. [11] observed that the rank query problem can be reduced to the nearest colored node problem as follows: Given the sequence S, we build a path P = (v1, .., vn) where c(vi) = S[i] for every i ∈ [1, n]. With each vertex v ∈ P , we store its rank. Consider a rank query of form i ∈ [1, n], c ∈ [1, σ]. Using a Color Distance Oracle, we query for the nearest colored vertex vj and if j < i, we return the rank stored at vj. Otherwise, j ≥ i and we can return the rank stored with vj decreased by 1. Let us now take the proof for theorem 1. Proof. We first consider the (approximate) nearest colored node problem on a weighted path and extend our proof later to the unweighted setting. We assume w.l.o.g. that the approximation factor is k ≥ log n and that n is an exact power of k. We use the simple construction of the path P = (v1, .., vn) from the sequence S as before. We assume that the nearest colored vertex vj = Nearest(vi, c) to vi has j ≥ i. This is sufficient as we can reverse the path and run a second query giving the nearest colored vertex vj ′ with j′ ≤ i and then take the closer one (in fact one procedure might not find a colored node but we always ensure that the nearest colored node is found in one of those two queries). We let P [vi, vj] denote the subpath of P between the vertices vi and vj and sometimes refer to it as interval [i, j] of the path. The intuition behind our proof is that we can choose the edge weights so that we can find the nearest colored node vj = Nearest(vi, c) to vi even if we are 9 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24 v25 v26 v27 v28 v29 v30 v31 v32 v33 v34 Figure 1: The weight of the edges on our constructed path P where we chose k = 4. We illustrate heavy edge weight by increased boldness of the edge. For example the edge between vertices v16 and v17 has weight k2 because 16 k2 but 16 ∤ k3. only given a distance estimate ddist(vi, c) of approximation factor k. Therefore, we partition the path into intervals of size kl for every 0 ≤ l ≤ logk n and refer to them as level-l intervals. We assign edge weights to delimit intervals. By construction, if an edge delimits two level-l intervals then it also delimits two level-l′ intervals for all l′ ≤ l. Let an edge (vx, vx+1) be assigned weight kl if it delimits two level-l intervals but doesn't delimit two level-l + 1 intervals. More formally, an edge (vx, vx+1) is assigned the weight kl for the largest kl such that kl x. This is depicted in figure 1. Let us now observe that the heavy edges on the path dominate the path weight. A level-l interval contains kl−l′ level-l′ intervals for l′ < l and therefore there are kl−l′ − kl−l′−1 edges of weight kl′ . Thus the path from the first node to the last node in the level-l interval has weight (kl−l′ l−1Xl′=0 − kl−l′−1)kl′ < ′ kl−l′ k = l−1Xl′=0 l−1Xl′=0 kl = lkl ≤ logk nkl ≤ kl+1 It follows that if we have l = ⌊logk(dist(vi, vj))⌋ for i 6= j, then the path P [vi, vj] contains an edge delimiting two level-(l − 1), i.e. of weight at least kl−1, as otherwise the path costs would be strictly less than kl ≤ dist(vi, vj). Our second idea is that given two vertices vi, vj with i < j and path interval [i, j] containing no node of color c, then the nearest colored vertex to vj is also the nearest colored vertex to vi, i.e. Nearest(vi, c) = Nearest(vj, c). We want to provide some special vertices that can return the nearest colored vertex but we need to do so carefully in order to retain near-linear space as our lower bound otherwise becomes meaningless. We therefore only cover intervals starting at special points. To simplify the presentation, we let ι(x, l) be the function that for any integer x gives the next larger integer divisible by kl. We store with each vertex vj where jkl a data structure that can return Nearest(vj , c) for all colors c that are on the path interval [j, ι(j, l + 1)]. We then say that vj covers [j, ι(j, l + 1)] and observe that if j is divisible by kl, we cover all level-l intervals starting at vj up to the end of the current level-(l + 1) interval. This is also depicted in figure 2. In order to have fast look-ups, we store with each such vertex vj a hash map with an entry for each color c ∈ C that occurs on the path and the corresponding vertex that is closest to vj. It is straight-forward to see that given a vertex vj, we can use the function ι to find logk n special vertices vι(j,l) for 0 ≤ l ≤ logk n such that the union of all because ι(j, l) is divisible by kl by definition hence the hash map at vertex vι(j,l) covers the interval [ι(j, l), ι(j, l + 1)]. Thus, we could already query the hash maps at these special vertices to extract the nearest colored node even without any distance estimate but it would incur logk n look-ups. covered intervals by those special vertices isS0≤l≤logk n[ι(j, l), ι(j, l + 1)] = [j, n] 10 ((k − 1)kl, ι((k − 4)kl, l + 1)] ((k − 2)kl, ι((k − 4)kl, l + 1)] ((k − 3)kl, ι((k − 4)kl, l + 1)] ((k − 4)kl, ι((k − 4)kl, l + 1)] (k − 4)kl (k − 3)kl (k − 2)kl (k − 1)kl kl+1 Figure 2: The drawing shows a subinterval of [1, n]. We see that for every number x that is divisible by kl, we take the interval from x to the closest number that is divisible by kl+1 which is illustrated by the red interval. Let us now combine both ideas to achieve that only a constant number of the associated hash maps at those special vertices need to be queried. Given a distance estimate ddist(vi, c) with l = ⌊logk ddist(vi, c)⌋, vj = Nearest(vi, c). By our approximation guarantee dist(vi, vj) ≤ ddist(vi, c) ≤ kdist(vi, vj) we get that kl−1 ≤ dist(vi, vj) ≤ kl+1. We conclude that it suffices to check the hash maps at the special vertices vι(i,l′) from l′ ∈ {l − 1, l, l + 1} because j ∈ [ι(i, l− 1), ι(i, l + 2)]. Consider that this would not be the case, we know that the path from the interval [i, ι(i, l − 1)] has path weight strictly less than kl−1. If j would be in interval (ι(i, l + 2), n] then as the edge (vι(i,l+2), vι(i,l+2)+1) has weight kl+2 and every path to from vi to a vertex with index in that interval has to include this edge. In both cases, we derive a contradiction. It remains to prove that the space taken by the hash maps is near-linear. We therefore observe that the number of entries in each hash map is bounded by the size of the interval is has to cover as every node in the path interval has only one color. It is easy to see that we have klogk n−j vertices with indices divisible by kj and each covers an interval of size kj+1. Thus the number of total entries in all hash maps can be bounded by klogk n−jkj+1 = logk nXl=0 logk nXl=0 klogk n+1 = kn logk n As hash maps take space linear in the number of entries and k = O(polylog(n)), we can bound the space by O(n) incurring only a log log n term in the lower bound as required. Thus, if the space is not dominated by the data structure for distance estimates, we still ensure the stated bounds. Finally, we observe that the path P [v1, vn] has total weight at most logk nklogk n = n logk n as it is a level-logk n interval. We can thus replace edges of weight x with a path of x − 1 dummy vertices and unit weight edges. 11 6 Lower bounds for the dynamic setting During the last years, several techniques were presented to prove conditional lower bounds for dynamic problems by reducing to problems that are conjec- tured to be hard [17, 24, 1, 12]. We use the framework given by Henzinger et al. [12] who reduce their problems from a contrived version of Online-Vector- Multiplication defined as follows. Definition 1 (γ-OuMv problem (c.f. Definition 2.6 [12])). Let γ > 0 be a fixed constant. An algorithm for the γ-OuMv problem is given parameters n1, n2, n3 as its input with the promise that n1 = ⌊nγ 2⌋. Next, it is given a matrix M of size n1 × n2 that can be preprocessed. Let p(n1, n2) denote the preprocessing time. After the preprocessing, a sequence of vector pairs (u1, v1), .., (un3 , vn3 ) is presented one vector pair after another and the task is to compute (ut)⊺M vt, before the pair (ut+1, vt+1) arrives. Let c(n1, n2, n3) denote the computation time over the whole sequence. The special case where n3 = 1 is called the γ-uMv problem. They then show that any algorithm solving the γ-OuMv problem in o(n1n2n3) time would give a truly subcubic algorithm to solve Online Vector Multiplica- tion(c.f. Theorem 2.2 [12]). As stated in the introduction, we consider in this section the existential version of nearest colored node that is we only ask whether there exists a colored vertex in the same component as a vertex v. As shown by Abboud and Williams [1] it suffices to prove lower bounds on the worst-case update and query time for a partially-dynamic version of a problem to establish amortized lower bounds for the fully-dynamic version. We thus only prove hardness of the partially- dynamic settings where we reduce from the γ-uMv problem where we are given a n1× n2 matrix M to preprocess and only a single pair of vectors (u, v) arrives. Lemma 5. Given any algorithm A that is able to process updates in u(n, σ) = o(σ) and queries in q(n, σ) = o(n/σ) amortized time, we can solve γ-OuMv in time o(n1, n2, n3). The same lower bounds extend to the worst-case update and query times of the partially-dynamic version of the problem. Proof. We first focus on the decremental setting and extend the proof for the fully-dynamic and incremental version. Recall that we are given a n1 × n2 matrix M. We treat the ith row of M as a subset of [1, n2], i.e. M[i, j] = 1 iff j ∈ M[i]. We create a graph G with a coloring function c : V → C, with color set C = {c1, .., cn2}, as follows: We first create a special vertex s. For every row i, we create for each j ∈ M[i] a vertex with c cj ∈ C and connect the vertices by linking every two consecutive vertices created. The created component for the ith row forms a simple path and is denoted from hereon by Pi. We also include an edge from s to the first vertex on the path Pi for every i. This completes the preprocessing phase. Clearly, the graph G has at most O(n1n2) vertices and as the construction forms a tree, we also have at most O(n1n2) edges. The complete set-up is depicted in figure 3. Consider that a vector pair (u, v) arrives. For each i where u[i] = 0, we remove the edge from the first vertex in Ri to vertex s. This incurs at most n1 updates. We have u⊺Mv = 1 if and only if there exists a j with v[j] = 1 where s is still connected to the color cj. To check these connections, we need at most n2 queries. 12 c6 c2 c4 c4 c5 c5 c3 c3 s c1 c1 c1 c2 c3 c4 c5 c6 Figure 3: Depiction of the set-up of a graph from a 5 × 6 matrix. The point s is used as query point and in the decremental case all dashed red edges are initially in the graph and can be deleted depending on u. As shown by Abboud and Williams [1], we can run our algorithm on a machine that records all changes and reverts them after a single pair (u, v) is processed to the original state in time proportional to the running time since the original state was left. Our graph has at most σ = n2 different colors. It is now straight-forward to see that we can solve γ-OuMv in time O(n3(n1u(n1σ, σ) + σq(n1σ, σ)) thus the stated bound follows. In the incremental setting, we omit the edges adjacent to s initially. Then, when (u, v) arrives, let u have the indices u1, u2, .. set to 1. Then, we join the first vertices in Ri and Ri+1 for even i and the last vertices of Ri and Ri+1 for odd i. Thus, we only construct a path. Connecting s to the end of the path, allows us to run queries as in the decremental setting. For the fully-dynamic setting, we can use the same set-up as in the incremental setting but instead of rolling the edge insertions back in each phase, we can simply run edge deletions to recover the original state implying that we get an amortized bound. We underline the generality of our lower bound which establishes that even on path graphs the amortized fully-dynamic problem remains hard. To strengthen our lower bound, we observe that we can decrease the graph size to O(n1) for directed graphs or if we are given distance estimates of approximation < 5/3 implying that the query bound in the theorem can be replaced by o(n). We therefore create σ = n2 vertices Vc, one of each color. Instead of constructing an entire row Ri for the i'th set, we construct a single vertex vi and connect it with edges to vertices in Vc that match elements in vi. We can then run the algorithm as before. If we direct the edge from s to each vi and from each vi towards the vertices in Vc our algorithm works as before. For undirected graphs, we have that dist(vi, cj) = 3 iff u⊺Mv = 1 and otherwise dist(vi, cj) ≥ 5. Thus any approximation of factor smaller 5/3 is still sufficient to distinguish the two cases. Clearly the graph has O(n1 + n2) = O(n1) vertices as σ ≤ n. We point out that the underlying OM v-conjecture even applies in case of error probability 1/3 thus our lower bound applies even to Monte-Carlo algo- rithms. Interestingly, the directed incremental version of our problem can be 13 seen as a graph version of Pagh's problem (we follow the definition from [17]). In Pagh's problem, we are given a collection C of k sets C1, C2, .., Ck ⊆ [n]. We are then allowed to update by providing two indices i, j ∈ {1, .., k} adding the set Ci ∩ Cj to C. We then want to be able to query given x ∈ [n], i ∈ {1, .., k} if x ∈ Ci. Similarly to the proof let us assume that each set Ci is represented by a path Pi containing a vertex of color c for each c ∈ Ci. Then updates for i, j ∈ {1, .., k} can be implemented by adding a new vertex and an edge from it to the beginning of Pi and one to the first vertex in Pj . Queries can be imple- mented by asking whether a node of color x ∈ [n] can be reached from the first node of Pi and by returning the negated answer. Acknowledgements. I want to thank Christian Wulff-Nilsen for inspiring the research on this problem and the guidance during the project. References [1] Amir Abboud and Virginia Vassilevska Williams. Popular conjectures im- ply strong lower bounds for dynamic problems. In Foundations of Computer Science (FOCS), 2014 IEEE 55th Annual Symposium on, pages 434–443. IEEE, 2014. [2] Ittai Abraham, Shiri Chechik, Michael Elkin, Arnold Filtser, and Ofer Neiman. Ramsey spanning trees and their applications. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1650–1664. SIAM, 2018. ramsey-type phenomena. [3] Yair Bartal, Nathan Linial, Manor Mendel, On metric Thirty-fifth Annual ACM Symposium on Theory ing, ACM. doi:10.1145/780542.780610. and Assaf Naor. the of Comput- 2003. http://doi.acm.org/10.1145/780542.780610, pages 463–472, New York, NY, USA, In Proceedings of STOC '03, URL: [4] Djamal Belazzougui and Gonzalo Navarro. Optimal lower and upper bounds for representing sequences. ACM Trans. Algorithms, 11(4):31:1– 31:21, April 2015. URL: http://doi.acm.org/10.1145/2629339, doi:10.1145/2629339. [5] Michael A. Bender and Martin Farach-Colton. The lca problem revisited. In Proceedings of the 4th Latin American Symposium on Theoretical Infor- matics, LATIN '00, pages 88–94, London, UK, UK, 2000. Springer-Verlag. URL: http://dl.acm.org/citation.cfm?id=646388.690192. [6] Shiri Chechik. Improved distance oracles and spanners for vertex-labeled graphs. In Proceedings of the 20th Annual European Conference on Algorithms, ESA'12, pages 325–336, Berlin, Heidelberg, 2012. Springer- Verlag. URL: http://dx.doi.org/10.1007/978-3-642-33090-2_29, doi:10.1007/978-3-642-33090-2\_29. [7] Shiri Chechik. Approximate distance oracles with constant query time. In Proceedings of the forty-sixth annual ACM symposium on Theory of computing, pages 654–663. ACM, 2014. 14 [8] Shiri Chechik. Approximate distance oracles with improved bounds. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, pages 1–10. ACM, 2015. [9] Martin Dietzfelbinger, Anna Karlin, Kurt Mehlhorn, Friedhelm Meyer auF der Heide, Hans Rohnert, and Robert E Tarjan. Dynamic perfect hash- ing: Upper and lower bounds. SIAM Journal on Computing, 23(4):738–761, 1994. [10] Johannes Fischer and Volker Heun. Theoretical and Practical Improve- ments on the RMQ-Problem, with Applications to LCA and LCE, pages 36–48. Springer Berlin Heidelberg, Berlin, Heidelberg, 2006. URL: http://dx.doi.org/10.1007/11780441_5, doi:10.1007/11780441\_5. [11] Pawel Gawrychowski, Gad M Landau, Shay Mozes, and Oren Weimann. The nearest colored node in a tree. In LIPIcs-Leibniz International Pro- ceedings in Informatics, volume 54. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2016. [12] Monika Henzinger, Sebastian Krinninger, Danupon Nanongkai, and Thatchaphol Saranurak. Unifying and strengthening hardness for dynamic problems via the online matrix-vector multiplication conjecture. In Proceed- ings of the forty-seventh annual ACM symposium on Theory of computing, pages 21–30. ACM, 2015. [13] Danny Hermelin, Avivit Levy, Oren Weimann, for Vertex-Labeled Graphs, Distance Oracles Springer Berlin Heidelberg, Berlin, Heidelberg, and Raphael pages 2011. http://dx.doi.org/10.1007/978-3-642-22012-8_39, Yuster. 490–501. URL: doi:10.1007/978-3-642-22012-8\_39. [14] Itay Laish and Shay Mozes. Efficient approximate distance oracles for vertex-labeled planar graphs. arXiv preprint arXiv:1707.02414, 2017. [15] Manor Mendel and Assaf Naor. Ramsey partitions and proximity data In Foundations of Computer Science, 2006. FOCS'06. 47th structures. Annual IEEE Symposium on, pages 109–118. IEEE, 2006. [16] Shay Mozes and Eyal E Skop. Efficient vertex-label distance oracles for planar graphs. Theory of Computing Systems, 62(2):419–440, 2018. [17] Mihai Patra¸scu. Towards polynomial lower bounds for dynamic problems. In Proc. 42nd ACM Symposium on Theory of Computing (STOC), pages 603–610, 2010. [18] Mihai Patra¸scu and Mikkel Thorup. Time-space trade-offs for predecessor In Proceedings of the thirty-eighth annual ACM symposium on search. Theory of computing, pages 232–240. ACM, 2006. [19] Mihai Ptra¸scu and Mikkel Thorup. Randomization does not help searching predecessors. In Proceedings of the eighteenth annual ACM-SIAM sym- posium on Discrete algorithms, pages 555–564. Society for Industrial and Applied Mathematics, 2007. 15 [20] Liam Roditty, Mikkel Thorup, and Uri Zwick. Deterministic constructions of approximate distance oracles and spanners. In International Colloquium on Automata, Languages, and Programming, pages 261–272. Springer, 2005. [21] Mikkel Thorup and Uri Zwick. Compact routing schemes. In Pro- ceedings of the Thirteenth Annual ACM Symposium on Parallel Al- gorithms and Architectures, SPAA '01, pages 1–10, New York, NY, USA, 2001. ACM. URL: http://doi.acm.org/10.1145/378580.378581, doi:10.1145/378580.378581. [22] Mikkel Thorup and Uri oracles. tance URL: doi:10.1145/1044731.1044732. J. Zwick. dis- 2005. http://doi.acm.org/10.1145/1044731.1044732, Approximate 52(1):1–24, January ACM, [23] Dekel Tsur. Succinct data structures for nearest colored node in a tree. Information Processing Letters, 132:6–10, 2018. [24] Virginia Vassilevska Williams and Ryan Williams. Subcubic equivalences between path, matrix and triangle problems. In Foundations of Computer Science (FOCS), 2010 51st Annual IEEE Symposium on, pages 645–654. IEEE, 2010. [25] Christian Wulff-Nilsen. Approximate distance oracles with improved query time. In Proceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms, pages 539–549. SIAM, 2013. A Proof of Lemma 1 Lemma 6. We use at most space O(knσ1/k) to represent the Color Distance Oracle and construction time O(mσ). Proof. We first want to prove that Pc∈C B(c) = O(knσ1/k). We follow the E[Ak−1] = nσ(k−1)/k. By linearity of expectation, we derive E[Si<k−1 B(v)∩ analysis by Thorup and Zwick to bound the bunch sizes for a vertex v ∈ V but omit the last layer that we account for in a later step. They show that the expected size E[B(v) ∩ (Ai \ Ai+1)] = σ1/k, for 1 ≤ i ≤ k − 2 and that (Ai \ Ai+1)] = E[B(v) \ Ak−1] = (k − 1)σ1/k. Now, observe that Ak−1 \ Ak = Ak−1, therefore Ak−1 ⊆ B(v) for every bunch B(v). But we only need to account for the set Ak−1 once per bunch B(c). We obtain E[B(c)] ≤Xc∈C Xv∈Vc Xc∈C E[B(v) \ Ak−1] + E[Ak−1]! E[B(v) \ Ak−1] +Xc∈C =Xv∈V = (k − 1)nσ1/k + nσ1/k = knσ1/k E[Ak−1] As a hash map only takes linear space in the number of entries, the hash tables take space proportional to the number of elements in the bunches. We also have to account for storing the RMQ structures but as they take linear space in the 16 size of the arrays this uses at most O(kn) space overall which is subsumed in O(knσ1/k). All distances can be precomputed by computing a look-up table in O(mσ) time which dominates the construction costs for large σ. B Proof of Lemma 4 Lemma 7. We can maintain a data structure over a tree T = (V, E) with function c : V → C as defined before, that given v ∈ V, c ∈ C finds the nearest ancestor of v in T that has a c-colored vertex in its subtree and that is able to process color-reassignments. Both operations take O(log log n) worst-case time and the data structure requires O(n) space. Proof. We initialize the data structure by augmenting the tree T with a LCA data structure. We then number the vertices in the order they occur in a BFS and denote the assigned number by λ(v) for v ∈ V . Finally, we construct for each color a predecessor data structure and insert the numbers of all vertices of color c ∈ C for the corresponding data structure. As a predecessor structure takes only space linear in the number of elements the size of all predecessor structures sums to O(n). Given a query from a vertex v ∈ V for color c, we use the predecessor structure for color c and search for the predecessor p and successor s of λ(v). It is straight-forward to see that the ancestor a ∈ {Lca(v, p), Lca(v, s)} at lower depth gives the desired ancestor. For updating the color c to c′ for vertex v, we remove λ(v) from the predecessor structure for color c and insert it into the structure for color c′. 17
1511.08647
3
1511
2017-12-05T10:46:36
Tight Bounds for Gomory-Hu-like Cut Counting
[ "cs.DS", "math.CO" ]
By a classical result of Gomory and Hu (1961), in every edge-weighted graph $G=(V,E,w)$, the minimum $st$-cut values, when ranging over all $s,t\in V$, take at most $|V|-1$ distinct values. That is, these $\binom{|V|}{2}$ instances exhibit redundancy factor $\Omega(|V|)$. They further showed how to construct from $G$ a tree $(V,E',w')$ that stores all minimum $st$-cut values. Motivated by this result, we obtain tight bounds for the redundancy factor of several generalizations of the minimum $st$-cut problem. 1. Group-Cut: Consider the minimum $(A,B)$-cut, ranging over all subsets $A,B\subseteq V$ of given sizes $|A|=\alpha$ and $|B|=\beta$. The redundancy factor is $\Omega_{\alpha,\beta}(|V|)$. 2. Multiway-Cut: Consider the minimum cut separating every two vertices of $S\subseteq V$, ranging over all subsets of a given size $|S|=k$. The redundancy factor is $\Omega_{k}(|V|)$. 3. Multicut: Consider the minimum cut separating every demand-pair in $D\subseteq V\times V$, ranging over collections of $|D|=k$ demand pairs. The redundancy factor is $\Omega_{k}(|V|^k)$. This result is a bit surprising, as the redundancy factor is much larger than in the first two problems. A natural application of these bounds is to construct small data structures that stores all relevant cut values, like the Gomory-Hu tree. We initiate this direction by giving some upper and lower bounds.
cs.DS
cs
Tight Bounds for Gomory-Hu-like Cut Counting∗ Rajesh Chitnis† Lior Kamma‡ Robert Krauthgamer‡ {rajesh.chitnis,lior.kamma,robert.krauthgamer}@weizmann.ac.il Weizmann Institute of Science December 6, 2017 Abstract distinct values. That is, these (cid:0)V 2 By a classical result of Gomory and Hu (1961), in every edge-weighted graph G = (V, E, w), the minimum st-cut values, when ranging over all s, t ∈ V , take at most V − 1 further showed how to construct from G a tree (V, E(cid:48), w(cid:48)) that stores all minimum st-cut values. Motivated by this result, we obtain tight bounds for the redundancy factor of several generalizations of the minimum st-cut problem. (cid:1) instances exhibit redundancy factor Ω(V ). They 1. Group-Cut: Consider the minimum (A, B)-cut, ranging over all subsets A, B ⊆ V of given sizes A = α and B = β. The redundancy factor is Ωα,β(V ). 2. Multiway-Cut: Consider the minimum cut separating every two vertices of S ⊆ V , ranging over all subsets of a given size S = k. The redundancy factor is Ωk(V ). 3. Multicut: Consider the minimum cut separating every demand-pair in D ⊆ V ×V , ranging over collections of D = k demand pairs. The redundancy factor is Ωk(V k). This result is a bit surprising, as the redundancy factor is much larger than in the first two problems. A natural application of these bounds is to construct small data structures that stores all relevant cut values, `a la the Gomory-Hu tree. We initiate this direction by giving some upper and lower bounds. 1 Introduction One of the most fundamental combinatorial optimization problems is minimum st-cut, where given an edge-weighted graph G = (V, E, w) and two vertices s, t ∈ V , the goal is to find a set of edges of minimum total weight that separates s, t (meaning that removing these edges from G ensures there is no s - t path). This problem was studied extensively, see e.g. the fa- mous minimum-cut/maximum-flow duality [FF56], and can be solved in polynomial time. It has numerous theoretical applications, such as bipartite matching and edge-disjoint paths, in addition to being extremely useful in many practical settings, including network connectivity, ∗This version contains additional references to previous work (which have some overlap with our results), see Bibliographic Update 1.1. †Supported by the I-CORE Program of the Planning and Budgeting Committee and The Israel Science Foundation (grant No. 4/11). ‡This work was supported in part by the Israel Science Foundation (grant #897/13). 1 In every graph G = (V, E, w), there are in total (cid:0)V network reliability, and image segmentation, see e.g. [AMO93] for details. Several generaliza- tions of the problem, such as multiway cut, multicut, and k-cut, have been well-studied in operations research and theoretical computer science. problem, given by all pairs s, t ∈ V . Potentially, each of these instances could have a different value for the minimum cut. However, the seminal work of Gomory and Hu [GH61] discovered that undirected graphs admit a significantly stronger bound (see also [AMO93, Lemma 8.15] or [CCPS98, Section 3.5.2]). (cid:1) instances of the minimum st-cut 2 number of distinct values over all possible (cid:0)V Theorem 1.1 ([GH61]). Let G = (V, E, w) be an edge-weighted undirected graph. Then the at most V − 1. (cid:1) instances of the minimum st-cut problem is 2 The beautiful argument of Gomory and Hu shows the existence of a tree T = (V, E(cid:48), w(cid:48)), usually called a flow-equivalent tree, such that for every s, t ∈ V the minimum st-cut value in T is exactly the same as in G. (They further show how to construct a so-called cut-equivalent tree, which has the stronger property that every vertex-partitioning that attains a minimum st-cut in T , also attains a minimum st-cut in G; see Section 1.3 for more details on this and related work.) Every G which is a tree (e.g., a path) with distinct edge weights has exactly V − 1 distinct values, and hence the Gomory-Hu bound is existentially tight. (cid:1) minimum st-cut instances in a graph. More precisely, the "redundancy factor", Another way to state Theorem 1.1 is that there is always a huge redundancy between the (cid:0)V 2 measured as the ratio between the number of instances and the number of distinct optimal values attained by them, is always Ω(V ). We study this question of redundancy factor for the following generalizations of minimum st-cut. Let G = (V, E, w) be an undirected edge-weighted graph. • Group-Cut: Given two disjoint sets A, B ⊆ V find a minimum (A, B)-cut, i.e., a set of edges of minimum weight that separates every vertex in A from every vertex in B. • Multiway-Cut: Given S ⊆ V find a minimum-weight set of edges, whose removal ensures that for every s (cid:54)= s(cid:48) ∈ S there is no s - s(cid:48) path. • Multicut: Given Q ⊆ V × V find a minimum-weight set of edges, whose removal ensures that for every (q, q(cid:48)) ∈ Q there is no q - q(cid:48) path. In order to present our results about the redundancy in these cut problems in a streamlined way, we introduce next the terminology of vertex partitions and demand graphs. Cut Problems via Demand Graphs. Denote by Par(V ) the set of all partitions of V , where a partition of V is, as usual, a collection of pairwise disjoint subsets of V whose union is V . Given a partition Π ∈ Par(V ) and a vertex v ∈ V , denote by Π(v) the unique S ∈ Π satisfying v ∈ S. Given a graph G = (V, E, w), define the function CutG : Par(V ) → R≥0 uv∈E : Π(u)(cid:54)=Π(v) w(uv). We shall usually omit the subscript G, since the to be CutG(Π) =(cid:80) graph will be fixed and clear from the context. Cut problems as above can be defined by specifying the graph G and a collection D of demands, which are the vertex pairs that need to be separated. We can view (V, D) as an (undirected and unweighted) demand graph, and by slight abuse of notation, D will denote both this graph and its edges. For example, an instance of Group-Cut is defined by G and demands that form a complete bipartite graph KA,B (to formally view it as a graph on V , let 2 us add that vertices outside of A ∪ B are isolated). We say that partition Π ∈ Par(V ) agrees with D if every uv ∈ D satisfies Π(u) (cid:54)= Π(v). The optimal cut-value for the instance defined by G and D is given by mincutG(D) := min{CutG(Π) : Π ∈ Par(V ) agrees with D}. Redundancy among Multiple Instances. We study multiple instances on the same graph G = (V, E, w) by considering a family D of demand graphs. For example, all minimum st-cut instances in a single G corresponds to the family D of all demands of the form D = {(s, t)} (i.e., demand graph with one edge). The collection of optimal cut-values over the entire family D of instances in a single graph G, is simply {mincut(D) : D ∈ D}. We are interested in the ratio between the size of this collection as a multiset and its size as a set, i.e., with and without counting multiplicities. Equivalently, we define the redundancy factor of a family D of demand graphs to be redundancy(D) := D {mincut(D) : D ∈ D} , where throughout, A denotes the size of A as a set, i.e., ignoring multiplicities. Motivation and Potential Applications. A natural application of the redundancy factor is to construct small data structures that stores all relevant cut values. For the minimum st-cut problem, Gomory and Hu were able to collect all the cut values into a tree on the same vertex set V . This tree can easily support fast query time, or a distributed implementation (labeling scheme) [KKKP05]. In addition, large redundancy implies that there is a small collection of cuts that contains a minimum cut for each demand graph. Indeed, first make sure all cut values in G are distinct (e.g., break ties consistently by perturbing edge weights), and then pick for each cut-value in {mincut(D) : D ∈ D} just one cut that realizes it. This yields a data structure that reports, given demands D ∈ D, a vertex partition that forms a minimum cut (see more in Section 1.2). 1.1 Main Results Throughout, we denote n = V . We use the notation Oγ(·) to suppress factors that depend only on γ, and similarly for Ω and Θ. The Group-Cut problem. In this problem, the demand graph is a complete bipartite graph KA,B for some subsets A, B ⊂ V . We give a tight bound on the redundancy factor of the family of all instances where A and B are of given sizes α and β, respectively. The special case α = β = 1 is just all minimum st-cuts in G, and thus recovers the Gomory-Hu bound (Theorem 1.1). Theorem 1.2. For every graph G = (V, E, w) and α, β ∈ N, we have {mincut(KA,B) : A = α,B = β} = Oα,β(nα+β−1), hence the family of (α, β)-group-cuts has redundancy factor Ωα,β(n). Furthermore, this bound is existentially tight (attained by some graph G) for all α, β and n. 3 The Multiway-Cut problem. In this problem, the demand graph is a complete graph KS for some subset S ⊆ V . We give a tight bound on the redundancy factor of the family of all instances where S is of a given size k ≥ 2. Again, the Gomory-Hu bound is recovered by the special case k = 2. Theorem 1.3. For every graph G = (V, E, w) and for every integer k ∈ N, we have {mincut(KS) : S = k} = Ok(nk−1), hence the family of k-multiway-cuts has redundancy factor Ωk(n). Furthermore, this bound is existentially tight for all n and k. The Multicut problem. In this problem, the demand graph is a collection D of demand pairs. We give a tight bound on the redundancy factor of the family of all instances where D is of a given size k ∈ N. Again, the Gomory-Hu bound is recovered by the special case k = 1. Theorem 1.4. For every graph G = (V, E, w) and k ∈ N, we have {mincut(D) : D ⊆ V × V, D = k} = Ok(nk), and hence the family of k-multicuts has redundancy factor Ωk(nk). Furthermore, this bound is existentially tight for all n and k. Theorem 1.4 is a bit surprising, since it shows a redundancy factor that is polynomial, rather than linear, in n (for fixed α, β and k), so in general Multicut has significantly larger redundancy than Group-Cut and Multiway-Cut. Bibliographic Update 1.1. Refael Hassin brought to our attention [Private communication, November 2017] prior work that has overlap with some of our results. Hassin [Has88] had previously obtained our upper bounds for Multiway-Cut (Theorem 1.3) and Multicut (Theorem 1.4), using the same "matrix" proof technique that we use in Section 2.2). In another paper, Hassin [Has90] showed how to efficiently compute all the distinct values for various problems such as Multiway-Cut and Multicut. More precisely, if a problem can have at most X distinct values (in worst-case), then his algorithm computes them by solving only O(X) many instances of that problem. For the Multiway-Cut and Multicut problems, Hartvigsen [Har01] showed how to compute a matrix of size O(X) (again X is the maximum number of distinct values in worst-case) such that the solution for any given instance can be obtained in X O(1) time. Additionally, non-trivial redundacy has been shown for other problems such as xcut (which asks for a minimum cut such that given vertices s, t ∈ V are on the same side) [Has91], as well as other problems related to graph coloring, SAT, etc. [EH05]. In fact, Einstein and Hassin [EH05] also obtain the upper bounds for Multiway-Cut and Multicut, and use both the "matrix" (see Section 3.1) and the "polynomial" (see Section 4.1) proof techniques. 1.2 Extensions and Applications Our main results above actually apply more generally and have algorithmic consequences, as discussed below briefly. Terminals Version. In this version, the vertices to be separated are limited to a subset T ⊆ V called terminals, i.e., we consider only demands inside T × T . All our results above (Theorems 1.2, 1.3, and 1.4) immediately extend to this version of the problem - we simply need to replace V by T in all the bounds. As an illustration, the terminals version of (cid:1) minimum st-cuts (taken over all s, t ∈ T ) attain at most Theorem 1.1 states that the (cid:0)T 2 4 T − 1 distinct values. (See also [CCPS98, Section 3.5.2] for this same version.) Extending our proofs to the terminals version is straightforward; for example, in Section 2.1 we need to consider polynomials in T variables instead of V variables. Data Structures. Flow-equivalent or cut-equivalent trees, such as those constructed by Gomory and Hu [GH61], may be viewed more generally as succinct data structures that support certain queries, either for the value of an optimal cut, or for its vertex-partition, respectively. Motivated by this view, we define data structures, which we call as evaluation schemes, that preprocess an input graph G, a set of terminals T , and a collection of demand graphs D, so as to answer a cut query given by a demand graph D ∈ D. The scheme has two flavors, one reports the minimum cut-value, the second reports a corresponding vertex- partition. In Section 5 we initiate the study of such schemes, and provide constructions and lower bounds for some special cases. Functions Different From Cuts. Recall that the value of the minimum st-cut equals min{CutG(X, V \ X) : X ⊆ V, s ∈ X, t /∈ X}. Cheng and Hu [CH91] extended the Gomory- Hu bound (Theorem 1.1) to a wider class of problems as follows. Instead of a graph G, fix a ground set V and a function f : 2V → R. Now for every s, t ∈ V , consider the optimal value min{f (X) : X ⊆ V, X ∩{s, t} = 1}. They showed that ranging over all s, t ∈ V , the number of distinct optimal values is also at most V − 1. All our results above (Theorems 1.2, 1.3, and 1.4) actually extend to every function f : Par(V ) → R. However, to keep the notation simple, we opted to present all our results only for the function Cut. Directed Graphs. What happens if we ask the same questions for the directed variants of the three problems considered previously? Here, an s → t cut means a set of edges whose removal ensures that no s → t path exists. Under this definition, we can construct explicit examples for the directed variants of our three problems above where there is no non-trivial redundancy, i.e., the number of distinct cut values is asymptotically equal to the total number of instances. See Appendix A for more details. 1.3 Related Work Gomory and Hu [GH61] showed how to compute a cut-equivalent tree, and in particular a flow-equivalent tree, using V − 1 minimum st-cut computations on graphs no larger than G. Gusfield [Gus90] has shown a version where all the cut computations are performed on G itself (avoiding contractions). For unweighted graphs, a faster (randomized) algorithm for computing a Gomory-Hu tree which runs in O(E · V ) time was recently given by Bhalgat et al. [BHKP07]. We already mentioned that Cheng and Hu [CH91] extended Theorem 1.1 from cuts to an arbitrary function f : 2V → R. They further showed how to construct a flow-equivalent tree for this case (but not a cut-equivalent tree). Bencz´ur [Ben95] showed a function f for which there is no cut-equivalent tree. In addition, he showed that for directed graphs, even flow-equivalent trees do not exist in general. Another relevant notion here is that of mimicking networks, introduced by Hagerup, Kata- jainen, Nishimura, and Ragde [HKNR98]. A mimicking network for G = (V, E, w) and a terminals set T ⊆ V is a graph G(cid:48) = (V (cid:48), E(cid:48), w(cid:48)) where T ⊂ V (cid:48) and for every X, Y ∈ T , 5 the minimum (X, Y )-cut in G and in G(cid:48) have the exact same value. They showed that ev- ery graph has a mimicking network with at most 22T vertices. Some improved bounds are known, e.g., for graphs that are planar or have bounded treewidth, as well as some lower bounds [CSWZ00, KR13, KR14]. Mimicking networks deal with the Group-Cut problem for all A, B ⊂ V ; we consider A, B of bounded size, and thus typically achieve much smaller bounds. 2 Group-Cut: The Case of Complete Bipartite Demands This section is devoted to proving Theorem 1.2. First we give two proofs, one in Section 2.1 via polynomials and the second in Section 2.2 via matrices, for the bound {mincut(KA,B) : A = α,B = β} = Oα,β(nα+β−1). Then in Section 2.3 we construct examples of graphs for which this bound is tight. Since {KA,B : A = α,B = β} =(cid:0)n (cid:1) = Θα,β(nα+β), it (cid:1) ·(cid:0)n−α α β follows that the redundancy factor is Ωα,β(n). β α (cid:1)(cid:0)n−α polynomials. Let r = (cid:0)n (cid:1) and let {KA1,B1, KA2,B2, . . . , KAr,Br} be the set of demand 2.1 Proof via Polynomials In this section we show the bound {mincut(KA,B) : A = α,B = β} = Oα,β(nα+β−1) using graphs for (α, β)-Group-Cut. For every vertex v ∈ V we assign a boolean variable denoted by φv. Given an instance A, B we can assume that the optimal partition only contains two parts, one which contains A and other which contains B, since we can merge other parts into either of these parts. Fix some j ∈ [r]. Recall that Π = {U, V \ U} ∈ Par(V ) agrees with, i.e., is a feasible if and only if the following holds: Π(u) (cid:54)= Π(v) Fix arbitrary aj ∈ Aj and bj ∈ Bj. We associate with the demand graph KAj ,Bj the solution for, the demand graph KAj ,Bj whenever u ∈ Aj and v ∈ Bj or vice versa. formal polynomial Pj over the variables {φv : v ∈ V } (cid:16) (cid:17) · Πa∈Aj\{aj} (cid:16) Pj = Πb∈Bj φaj − φb (cid:17) φa − φbj . Note that Pj is a polynomial of degree α+β−1. Given U ⊆ V , we may think of Π = {U, V \U} as a vector in {0, 1}n. We denote by Pj(Π) the value of the polynomial Pj (over F2) when instantiated on Π. Lemma 2.1. A partition Π is feasible for the demand graph KAj ,Bj if and only if Pj(Π) (cid:54)= 0 Proof. Suppose Π is feasible for the demand graph KAj ,Bj . So Π(u) (cid:54)= Π(v) if u ∈ Aj, v ∈ Bj or vice versa. Since every term of Pj contains one variable from each of Aj and Bj, it follows that Pj(Π) (cid:54)= 0. Conversely, assume Pj(Π) (cid:54)= 0. Let u ∈ Aj. Since Π(u) (cid:54)= Π(bj) and Π(bj) (cid:54)= Π(aj) it follows that Π(u) = Π(aj). Similarly for every v ∈ Bj, Π(v) = Π(bj). Therefore, it follows that Π(u) (cid:54)= Π(v) whenever u ∈ Aj and v ∈ Bj or vice versa, i.e., Π is feasible for KAj ,Bj . Next we show that the polynomials corresponding to demand graphs with distinct values under mincut are linearly independent. 6 Lemma 2.2. Reorder the demand graphs such that mincut(KA1,B1) < . . . < mincut(KAq,Bq ). Then the polynomials P1, . . . , Pq are linearly independent. Proof. Let Π1, . . . , Πq be the optimal partitions for the instances corresponding to the demand graphs KA1,B1, . . . , KAq,Bq respectively, i.e., for each i ∈ [q] we have that mincut(KAi,Bi) = Cut(Πi). Since mincut(KAi,Bi) < mincut(KAj ,Bj ) whenever i < j, it follows that Πi is not feasible for the demand graph KAj ,Bj for all i < j. exist constants λ1, . . . , λq ∈ R which are not all zero such that P =(cid:80) Lemma 2.1 we get that P1(Π1) (cid:54)= 0. This implies λ1 = 0. Hence, we have P =(cid:80) Suppose that the polynomials P1, P2, . . . , Pq are not linearly independent. Then there j∈[q] λjPj is the zero polynomial. We will now show that each of the constants λ1, λ2, . . . , λq is zero, leading to a contradiction. Instantiate P on Π1. Recall that Π1 is not feasible for any KAi,Bi with i ≥ 2. Therefore, by Lemma 2.1, we have that Pi(Π1) = 0 for all i ≥ 2. Therefore λ1P1(Π1) = 0. Since Π1 is an (optimal) feasible partition for instance corresponding to KA1,B1, applying 2≤j≤q λjPj is the zero polynomial. Now instantiate P on Π2 to obtain λ2 = 0 via a similar argument as above. In the last step, we will get that λq−1 = 0 and hence P = λqPq is the zero polynomial. Instantiating on Πq gives 0 = P (Πq) = λqPq(Πq). Since Πq is (optimal) feasible partition for the demand graph KAq,Bq it follows that Pq(Πq) (cid:54)= 0, and hence λq = 0. {(cid:81) v : (cid:80) Note that each of the polynomials P1, P2, . . . , Pq is contained in the vector space of polynomials with n variables and degree ≤ α + β − 1. This vector space is spanned by v∈V rv ≤ α+β−1} and therefore is of dimension(cid:0)n+(α+β−1) (cid:1) = Oα,β(nα+β−1). (cid:12)(cid:12)(cid:12){mincut(KA,B) : A = α,B = β}(cid:12)(cid:12)(cid:12) = Oα,β(nα+β−1). From Lemma 2.2 and the fact that size of any set of linearly independent elements is at most the size of a basis, it follows that v∈V φrv α+β−1 2.2 Proof via Matrices In this section we show the (slightly stronger) bound that {mincut(KA,B) : A ≤ α,B ≤ β} = Oα,β(nα+β−1) using matrices. Let Par2(V ) ⊆ Par(V ) be the set of partitions of V into exactly two parts. Let Q := {(A, B) : A ≤ α, B ≤ β}. Consider the matrix M over F2 with Q rows (one for each element from Q) and Par2(V ) = 2n columns (one for each partition Π of V into two parts). We now define the entries of M. Given (A, B) ∈ Q and Π ∈ Par2(V ), we set M(A,B),Π = 1 if and only if the partition Π ∈ Par2(V ) agrees with the demand graph KA,B, which is equivalent to saying that Π(u) (cid:54)= Π(v) whenever u ∈ A and v ∈ B or vice versa. Fix a vertex v0 ∈ V , and consider the set R := {(A, B) ∈ Q : v0 ∈ A ∪ B} . Claim 2.3. Over F2, the row space of M is spanned by the rows corresponding to elements from R Proof. Consider (A, B) ∈ Q and Π ∈ Par2(V ). If v0 ∈ A ∪ B then (A, B) ∈ R. Henceforth we assume that v0 /∈ A ∪ B. Let L(Π) := M(A,B),Π + M(v0∪A(cid:48),B),Π + M(A,B(cid:48)∪v0),Π , (cid:88) A(cid:48)⊂A (cid:88) B(cid:48)⊂B where addition is over F2. Note that (v0 ∪ A(cid:48), B), (A, B(cid:48) ∪ v0) ∈ R for every A(cid:48) ⊂ A and B(cid:48) ⊂ B, and therefore it is enough to show that L(Π) ≡ 0 (mod 2). 7 Assume first that M(A,B),Π = 1, i.e. Π agrees with the demand graph KA,B. Without loss of generality assume that Π(v0) = Π(a) for some a ∈ A. Then we have M(v0∪A(cid:48),B),Π = 1 for all A(cid:48) ⊂ A, and M(A,v0∪B(cid:48)),Π = 0 for all B(cid:48) ⊂ B. So, L(Π) = 1 + (2A − 1) ≡ 0 (mod 2). Otherwise, we have M(A,B),Π = 0. If for every v ∈ A ∪ B it holds that Π(v) (cid:54)= Π(v0) then L(Π) = 0 + M(v0,B),Π + M(A,v0),Π = 1 + 1 ≡ 0 (mod 2) . Hence suppose that there exists v ∈ A∪B such that Π(v) = Π(v0). Without loss of generality, assume v ∈ A. Then M(A,B(cid:48)+v0),Π = 0 for all B(cid:48) ⊂ B. Note that if A1, A2 ⊂ A satisfy M(v0∪A1,B),Π = 1 = M(v0∪A2,B),Π, then M(v0∪A1∪A2,B),Π = 1. Hence there is an inclusion- wise maximal set A∗ ⊂ A such that M(v0∪A∗,B),Π = 1. Since M(A,B),Π = 0, we conclude that A∗ ⊂ A. Moreover A∗ ≥ 1 since v ∈ A. Therefore L(Π) = M(A,B),Π + M(v0∪A(cid:48),B),Π = M(v0∪A(cid:48),B),Π = 2 A∗ ≡ 0 mod(2) (cid:88) A(cid:48)⊆A∗ distinct values under mincut are linearly independent. Hence, we have An argument similar to Lemma 2.2 shows that rows corresponding to demand graphs with (cid:12)(cid:12)(cid:12){mincut(KA,B) : A ≤ α,B ≤ β}(cid:12)(cid:12)(cid:12) ≤ rank(M) ≤ R, where the last inequality follows from Claim 2.3. We (cid:1) ·(cid:0)n−j−1 (cid:0)n−1 (cid:1) (cid:0)n−1 (cid:1) ·(cid:0)n−i−1 now obtain the final bound (cid:88) R = i j j i (cid:1) + (cid:88) j≤β−1,i≤α i≤α−1,j≤β = i≤α−1,j≤β = Oα,β(nα+β−1) Oi,j(ni+j) + Oi,j(ni+j) j≤β−1,i≤α (cid:88) A(cid:48)⊂A (cid:88) (cid:88) 2.3 Lower Bound on Number of Distinct Cuts for (α, β)-Group-Cut We now turn to prove that the bound given in Theorem 1.2 is existentially tight. To this end, of graphs satisfying {mincut(KA,B) : A = α,B = we construct an infinite family Gα,β β} ≥ Ωα,β(nα+β−1). Let n, α, β ∈ N be such that n is odd, and both α and β − 1 divide (n − 3)/2. We define is composed of two graphs that share a common on n vertices as follows. Gα,β n n n a graph Gα,β vertex H α • H α n and J β n defined below. • J β n has (n + 1)/2 vertices, and is given by α parallel paths P1, . . . , Pα between two designated vertices s, t, each path having (n− 3)/2α internal vertices. The edge weights are given by distinct powers of 2, monotonically decreasing from s to t. All edges in H α n incident on t have ∞ weight (see Figure 1). n has (n + 1)/2 vertices, and is given by (β − 1) parallel paths Q1, . . . , Qβ−1, between t and a designated vertex u, each having (n − 3)/2(β − 1) internal vertices. As in H α n , edge weights are given by distinct powers of 2, monotonically decreasing from t to u, and all of which are strictly smaller than the weights of H α n incident on u have ∞ weight. n . All edges in J β 8 n , consisting of α parallel s - t paths. The right part of the graph is J β Figure 1: The graph Gα,β n used in the lower bound of Section 2.3. The left part of the graph is H α n , consisting of (β − 1) parallel t - u paths. The gray vertices are in A, and the black ones are in B. The red edges represent the minimum cut for this choice of A and B. The following claim implies the desired lower bound. Claim 2.4. {mincut(KA,B) : A = α,B = β} ≥ Ωα,β(nα+β−1). Proof. Pick one internal vertex from each Pi for i ∈ [α] to form A. Similarly for β − 1 elements in B, we pick one internal vertex from each Qj for j ∈ [β]. In addition, s ∈ B (as demonstrated in Figure 1). We claim that every such choice of A, B gives a distinct value for the minimum (A, B)-cut. Indeed, for i ∈ [α] let ai be the unique element in A ∩ Pi. In order to separate A from B, we need to separate ai from s. This implies that at least one edge on the segment of Pi between s and ai has to be in the cut. By monotonicity of weights and minimality of the cut, this must be the edge incident to ai. Similarly, for every b ∈ B \ {s}, the left edge incident to b must be cut. It can be easily seen (as demonstrated in Figure 1) that this set of edges is also enough to separate A and B. By the choice of weights, each such cut has a unique value, and therefore {mincut(KA,B) : A = α,B = β} ≥ ((n − 3)/2α)α((n − 3)/2(β − 1))β−1 = Ωα,β(nα+β−1). 3 Multiway-Cut: The Case of Clique Demands This section is devoted to proving Theorem 1.3. In Section 3.1 we show that for every graph G = (V, E, w) we have {mincut(KS) : S = k} = Ok(nk−1). The proof follows the lines of the proof from Section 2.2. In Section 3.2 we construct an infinite family of graphs for which this bound is tight. Since {KS : S = k} =(cid:0)n factor is Ωk(n). (cid:1) = Θk(nk), it follows that the redundancy k 3.1 Upper Bound on Number of Distinct Cuts for k-Multiway-Cut In this section we show that {mincut(KS) : S = k} = Ok(nk−1). Let Park(V ) ⊆ Par(V ) be the set of partitions of V into exactly k parts. Let Q := {A ⊆ V : A = k}. Consider the matrix M over F2 with Q rows (one for each element from Q) and Park(V ) columns (one for each partition Π of V into k parts). We now define the entries of M. Given A ∈ Q and Π ∈ Park(V ), we set MA,Π = 1 if and only if the partition Π ∈ Park(V ) agrees with the 9 𝑃1 t u 𝑃𝛼 𝑄1 𝑄𝛽−1 s ∞ ∞ ∞ ∞ ∞ ∞ ∞ demand graph KA. That is if and only if we have Π(u) (cid:54)= Π(v) for every u, v ∈ A such that u (cid:54)= v Fix a vertex v0 ∈ V , and consider the set R := {A ∈ Q : v0 ∈ A} . Claim 3.1. Over F2, the row space of M is spanned by the rows corresponding to elements from R Proof. Consider A ∈ Q and Π ∈ Park(V ). If v0 ∈ A then A ∈ R. Henceforth we assume that v0 /∈ A. Let L(Π) := MA,Π + M{v0}∪A\{a},Π (cid:88) a∈A where addition is over F2. Note that ({v0} ∪ A \ {a}) ∈ R for every a ∈ A, and hence it is enough to show that L(Π) ≡ 0 (mod 2). Assume first that MA,Π = 1. Since Π ∈ Park(V ), there is a unique element a∗ ∈ A such that Π(v0) = Π(a∗). Then M{v0}∪A\{a},Π = 0 for all a ∈ A \ {a∗} and M{v0}∪A\{a∗},Π = 1. Therefore L(Π) := MA,Π + M{v0}∪A\{a},Π = 1 + 1 ≡ 0 (mod 2) . Next, assume MA,Π = 0. If M{v0}∪A\{a},Π = 0 for all a ∈ A, then clearly L(Π) ≡ 0 (mod 2). Otherwise, there exists a(cid:48) ∈ A such that M{v0}∪A\{a(cid:48)},Π = 1. Since MA,Π = 0, it follows that Π(a(cid:48)) (cid:54)= Π(v0). Therefore there is some a(cid:48)(cid:48) ∈ A such that Π(a(cid:48)) = Π(a(cid:48)(cid:48)). Since M{v0}∪A\{a(cid:48)},Π = 1, it follows that M{v0}∪A\{a(cid:48)(cid:48)},Π = 1 and M{v0}∪A\{a},Π = 0 for any a ∈ A \ {a(cid:48), a(cid:48)(cid:48)}. Therefore L(Π) := MA,Π + M{v0}∪A\{a},Π = 0 + 1 + 1 ≡ 0 (mod 2) . (cid:88) a∈A (cid:88) a∈A distinct values under mincut are linearly independent. Hence, we have An argument similar to Lemma 2.2 shows that rows corresponding to demand graphs with (cid:12)(cid:12)(cid:12){mincut(KS) : S = k}(cid:12)(cid:12)(cid:12) ≤ rank(M) ≤ R, where the last inequality follows from Claim 3.1. We now obtain the final bound since R =(cid:0)n−1 (cid:1) = Ok(nk−1) k−1 3.2 Lower Bound on Number of Distinct Cuts for k-Multiway-Cut We now turn to prove that the bound given in Theorem 1.3 is existentially tight. To this end, we construct an infinite family Pn of graphs satisfying {mincut(KS) : S = k} ≥ Ωk(nk−1). For n ∈ N consider the path graph Pn = (Vn, En, w) where Vn = {1, 2, . . . , n} and En = {{i, i + 1} : 1 ≤ i ≤ n − 1}. For each i ∈ [n − 1] we denote the edge {i, i + 1} by ei and set w(ei) = 2i. By choice of the weights, it follows that any set of k − 1 edges from En has different weight. Now consider a set E∗ ⊆ En of exactly k − 1 edges. We will show that there is an set S∗ ⊆ Vn of size k such that E∗ is the minimum solution for the k-Multiway- Cut instance with S∗ as the input. Let E∗ = {i1, i2, . . . , ik−1}. Then it is easy to see (by choice of weights) that E∗ is the minimum weight solution for the instance with input S∗ = {i1, i2 . . . , ik−1, ik−1 + 1}. Note that eik−1 is an edge implies ik−1 ≤ n− 1 and so ik−1 + 1 is well-defined. This implies that for the path graph Pn (with the weight function specified above) we have (cid:12)(cid:12)(cid:12){mincut(KS) : S = k}(cid:12)(cid:12)(cid:12) ≥(cid:0)n−1 k−1 (cid:1), and hence we have (cid:12)(cid:12)(cid:12){mincut(KS) : S = k}(cid:12)(cid:12)(cid:12) = Ωk(nk−1). 10 4 Multicut: The Case of Demands with Fixed Number of Edges redundancy factor is Ωk(nk). This section is devoted to proving Theorem 1.4. In Section 4.1 we show that for every graph G, {mincut(D) : D ⊆ V × V,D = k} = Ok(nk). This proof follows the lines of the proof from Section 2.1. Then in Section 4.2 we construct an infinite family of graphs for which this (cid:1) = Θk(n2k), it follows that the bound is tight. Since {D : D ⊆ V × V,D = k} = (cid:0)(n In this section we show that {mincut(D) : D ⊆ V × V,D = k} = Ok(nk). Let r =(cid:0)(n (cid:1) 2) and the set of demand graphs for k-Multicut be {D1, . . . , Dr}. For every vertex v ∈ V we k assign a variable denoted by φv which can take values from [n]. Fix some j ∈ [r]. Recall that Π ∈ Par(V ) agrees with (or equivalently, is feasible for) the demand graph Dj if and only if u − v ∈ Dj implies Π(u) (cid:54)= Π(v). 4.1 Upper Bound on Number of Distinct Cuts for k-Multicut 2) k We associate with the demand graph Dj the formal polynomial (cid:16) (cid:17) Pj = Πu−v∈Dj φu − φv Note that Pj is a polynomial of degree k. We denote by Pj(Π) the value of the polynomial Pj (over F2) when instantiated on Π. The proof of the next lemma is straightforward. Lemma 4.1. A partition Π is feasible for the instance corresponding to the demand graph Dj if and only if Pj(Π) (cid:54)= 0 Proof. Suppose Π is feasible for the instance corresponding to the demand graph Dj. So for every edge u − v ∈ Dj we have Π(u) (cid:54)= Π(v) and hence Pj(Π) (cid:54)= 0. Conversely, assume Pj(Π) (cid:54)= 0. Hence, for each edge u − v ∈ Dj we have Π(u) (cid:54)= Π(v) which is exactly the condition for Π being feasible for the demand graph Dj. The proof of the following lemma is very similar to that of Lemma 2.2, and hence we omit the details. Lemma 4.2. Reorder the demand graphs such that mincut(D1) < mincut(D2) < . . . < mincut(Dq). Then the polynomials P1, P2, . . . , Pq are linearly independent. Note that each of the polynomials P1, P2, . . . , Pq is contained in the vector space of It is well known that the size of a ba- (cid:1) = Ok(nk). From Lemma 4.2 and the fact that size of polynomials with n variables and degree ≤ k. sis of this vector space is (cid:0)n+k (cid:12)(cid:12)(cid:12){mincut(D) : D ⊆ V × V,D = k}(cid:12)(cid:12)(cid:12) = Ok(nk). any set of linearly independent elements is at most the size of a basis, it follows that k 4.2 Lower Bound on Number of Distinct Cuts for k-Multicut We now turn to prove that the bound given in Theorem 1.4 is existentially tight. To this end, we construct an infinite family P Mn of graphs satisfying {mincut(D) : D ⊆ V × V,D = k} ≥ Ωk(nk). 11 For even n ∈ N consider the graph P Mn = (Vn, Dn, w) which is a perfect matching on n vertices. Let Vn = {1, 2, . . . , n} and Dn = {{2i − 1, 2i} : 1 ≤ i ≤ n/2}. For each i ∈ [n] we denote the edge {2i − 1, 2i} by di and set w(di) = 2i. By choice of the weights, it follows that any set of k edges from Dn has different total weight. Now consider a set D∗ ⊆ Dn of exactly k edges. We will now show that there is an set D∗∗ ⊆ Dn of size k such that D∗ is the minimum solution for the k-Multicut instance whose demand graph is D∗∗. It is easy to see that D∗ is the only solution (and hence of minimum weight too) for the instance whose demand graph is D∗. Hence taking D∗∗ = D∗ suffices. tion specified above) we have {mincut(D) : D ⊆ Vn × Vn,D = k} ≥(cid:0)n/2 This implies that for the perfect matching graph P Mn = (Vn, Dn) (with the weight func- (cid:1) = Ωk(nk). k 5 Evaluation Schemes: Constructing Succinct Data Structures Gomory and Hu [GH61] showed that for every undirected edge-weighted graph G = (V, E, w) there is a tree T = (V, E(cid:48), w(cid:48)) that represents the minimum st-cuts exactly both in terms of the cut-values and in terms of their vertex-partitions. The common terminology for the first property, probably due to Bencz´ur [Ben95], is to say that T is flow-equivalent to G. The second property, which is actually stronger, says that T is cut-equivalent to G. 1 These (flow-equivalent and cut-equivalent) trees can be viewed more generally as succinct data structures that support certain queries, either for the value of an optimal cut, or for its vertex-partition. Motivated by this view, we define two types of data structures, which we call a flow- evaluation scheme and a cut-evaluation scheme (analogously to the common terminology in the literature). These schemes are arbitrary data structures (e.g., need not form a tree), and address the terminals version (of some cut problem). Both of these schemes, first preprocess an input that consists of a graph G = (V, E, w), a terminals set T ⊂ V , and a collection of demand graphs D. The preprocessed data can then be used (without further access to G) to answer a cut query given by a demand graph D ∈ D. The answer of a flow-evaluation scheme is the corresponding minimum cut-value mincut(D). The answer of a cut-evaluation scheme is a vertex-partition that attains this cut-value mincut(D). Formally, we define the following. Definition 5.1. A flow-evaluation scheme is a data structure that supports the following two operations. 1. Preprocessing P , which gets as input a graph G = (V, E, w), a set of terminals T ⊆ V and a family D of demand graphs on T and constructs a data structure P (G, T,D). 2. Query Q, which gets as input D ∈ D and uses P (G, T,D) to output mincut(D). Note that Q has no access to G itself. A cut-evaluation scheme also supports a third operation. 3. Query Q(cid:48), which gets as input D ∈ D and uses P (G, T,D) to output a partition Π ∈ Par(T ) which attains mincut(D). 1 We say that T is flow-equivalent to G when for every s, t ∈ V the minimum st-cut value in T is exactly the same as in G. We say it is cut-equivalent to G when every vertex-partitioning that attains a minimum st-cut in T , also attains a minimum st-cut in G. 12 We provide below some constructions and lower bounds for flow-evaluation schemes and cut-equivalent schemes, for the three cut problems studied in this paper, viz. Group-Cut, Multiway-Cut and Multicut. Note that all our upper bounds are for the stronger version of cut-evaluation schemes, and our lower bound is for the weaker version of flow-evaluation schemes for the (2, 1)-Group-Cut problem. In order to measure bit complexity for the bounds, we assume hereafter that all weights are integers. 5.1 Upper Bounds for Cut-Evaluation Schemes The next theorem follows from the terminal version of Theorem 1.2. Similar results also hold for the Multiway-Cut and Multicut problems; the proofs follow in the same manner from Theorem 1.3 and Theorem 1.4 respectively. Theorem 5.1. There exists a cut-evaluations scheme such that for every graph G = (V, E, w), a set of terminals T ⊆ V and α, β ∈ N, for the family D = {KA,B : A, B ⊆ T, A = α, B = β} of demand graphs at most Oα,β(Tα+β−1 · (T + log W )) bits are stored, where e∈E w(e), and such that the query time is Oα,β(Tα+β−1). W =(cid:80) Proof. Let q be the number of distinct values attained by demand graphs on T . Apply- ing the upper bound of Theorem 1.2 adjusted for the terminals version, we get that q ≤ Oα,β(Tα+β−1). Order the demand graphs {KA1,B1, . . . , KAq,Bq} such that mincut(KAi,Bi) < mincut(KAj ,Bj ) for all i < j. For every j ∈ [q] we associate with KAj ,Bj a partition Πj ∈ Par2(T ) which attains mincut(KAj ,Bj ). Representing Πj as a bit vector of length T, we list all values in an increasing order. Each entry of this structure is of size O(T + log W ). Therefore the size of the evaluation scheme is at most Oα,β(Tα+β−1 · (T + log W )) bits. To see the bound of the query time, note that given A, B ⊆ T such that A = α and B = β, the evaluation scheme holds mincut(KA,B) and a partition Π that attains it. Moreover, going over the list, mincut(KA,B) is the first value in the list for which Π agrees with the associated partition. 5.2 Lower Bound on Flow-Evaluation Schemes for (2, 1)-Group-Cut Next we use an information-theoretic argument which shows a lower bound on the storage required by any flow-evaluation scheme for (2, 1)-Group-Cut. Since a cut-evaluation scheme is stronger than a flow-evaluation scheme, this lower bound immediately extends also to cut- evaluation schemes. Theorem 5.2. For every n ≥ 3, a flow-evaluation scheme for (2, 1)-Group-Cut on graphs with n terminals (in which T = V ) and with edge-weights bounded by a polynomial in n requires storage of Ω(n2 log n) bits. Let 3 ≤ n ∈ N, let D = {KA,B : A, B ⊂ [n], A = 2, B = 1} and let G = (V, E) be the complete graph on V = T = [n]. For every j ∈ [n − 1], (j, j + 1) ∈ E are referred to as path edges, and the rest of the edges are referred to as fork edges as demonstrated in Figure 2. To prove Theorem 5.2 we assign random edge weights to the graph in the range {1, . . . , 2n5}. We then show that given query access to {mincut(D) : D ∈ D} we can recover all edge weights. This, in turn, implies that we can recover at least Ω(n2 log n) bits, and thus implies Theorem 5.2. We assign edge weights to the edges of G as follows: 13 Figure 2: Edge types in G. Black edges correspond to path edges, while red edges correspond to fork edges (we illustrate only a few fork edges for simplicity). (P1) For every j ∈ [n], w(j, j+1) is chosen uniformly at random in [2(n−j)n4, (2(n−j)+1)n4]. This ensures that the weights of the path edges are non-increasing as we go from left to right. Moreover, whenever j > i, w(j, j + 1) ≤ (2(n − j) + 1)n4 = (2n − 2j + 1)n4 < (2n − 2i)n4 − n4 ≤ w(i, i + 1) − n4 . (P2) The weights of all fork edges are chosen uniformly at random from {0, 1, 2, . . . , n − 1}. Thus the total weight to all fork edges is at most n3. Note that this is strictly smaller than the difference between weights of any two path edges (which is at least n4). Claim 5.3. Let 1 ≤ i < j ≤ n, then mincut(K{1,j},{i}) = (cid:80) e∈E:e∩{i,...,j−1}=1 we. Proof. By Property (P2) the total weigtht of all the fork edges is at most n3, which is less than the difference between weights of any two path edges (which is at least n4). Hence, the value mincut(K{1,j},{i}) is determined only by which path edges we choose. Note that the minimum cut separating {1, j} from {i} needs to pick at least one edge each from the paths 1 − i and i − j. By Property (P1) the path edges have non-increasing weights going from left to right, and hence the two cheapest edges on the paths 1− 2− . . .− i and i − (i + 1) − . . . − j are (i − 1, i) and (j − 1, j) respectively. Therefore, it follows that mincut(K{1,j},{i}) = Cut(C, C), where C = {i, i + 1, . . . , j − 1}. By definition of Cut(C, C) it follows that (cid:88) mincut(K{1,j},{i}) = e∈E:e∩{i,...,j−1}=1 we Lemma 5.4. Given access to queries Q as in Definition 5.1, we can recover w. Lemma 5.4 implies that we can recover Ω(n2 log n) random bits given access to queries Q as in Definition 5.1, and thus implies Theorem 5.2. Proof. For every 1 ≤ i < j ≤ n, we show that we can recover wij. The proof contin- ues by induction on j − i, starting with the case j = i + 1. By Claim 5.3, we get that e∈E:i+1∈e we. Therefore e∈E:i∈e we and mincut(K{1,i+2},{i+1}) =(cid:80) mincut(K{1,i+1},{i}) =(cid:80) (cid:88) e∈E:e∩{i,i+1}=1 we (1) mincut(K{1,i+1},{i}) + mincut(K{1,i+2},{i+1}) = 2wi,i+1 + 14 APathEdgeAForkEdge In addition we have mincut(K{1,i+2},{i}) = (cid:80) get that wi,i+1 = 1 2 (cid:0)mincut(K{1,i+1},{i}) + mincut(K{1,i+2},{i+1}) − mincut(K{1,i+2},{i})(cid:1) , e∈E:e∩{i,i+1}=1 we. Plugging this into (1) we and therefore we can recover wi,i+1. Next, let 1 ≤ i < j ≤ n, and assume that we can recover wpq for all 1 ≤ p < q ≤ n such that q − p < j − i. In addition, we assume that j < n. The proof is similar for the case j = n. From Claim 5.3 we get that mincut(K{1,j+1},{i}) = Let i < k < j, then by Claim 5.3 (cid:88) (cid:88) we − (cid:88) wmk = e∈E:e∩{i,...,j}=1 we = (cid:88) j(cid:88) (cid:88) wmk = mincut(K{1,k+1},{k}) − (cid:88) m /∈{i,...,j} wmk k=i (2) wmk . m∈{i,...,j} m /∈{i,...,j} e∈E:k∈e m∈{i,...,j} For every m ∈ {i, . . . , j}, k − m < j − i, and therefore we can recover wmk. It follows that m /∈{i,...,j} wmk. Plugging this into (2), and rearranging we get that mincut(K{1,j+1},{i}) − (cid:88) we can recover(cid:80) (cid:88) It remains to show that we can recover wij assuming we can recover (cid:80) (cid:80) wim = mincut(K{1,i+1},{i}) − wij − (cid:88) (cid:88) m /∈{i,...,j} wjm. Applying Claim 5.3 once more, we get that m /∈{i,...,j} wim + (cid:88) (cid:88) (cid:88) m /∈{i,...,j} i<k<j m /∈{i,...,j} wjm (3) m /∈{i,...,j} wmk = wim = wim + wim , m∈{i,...,j−1} we − (cid:88) wjm = mincut(K{1,j+1},{j}) − wij − (cid:88) m∈{i,...,j} wim . m∈{i+1,...,j} m /∈{i,...,j} e∈E:i∈e and similarly (cid:88) m /∈{i,...,j} By the induction hypothesis, we can recover wim for all m ∈ {i, . . . , j − 1} and wjm for all m ∈ {i + 1, . . . , j}, and therefore we can recover wij. This completes the proof of Theorem 5.2. We note that similar arguments give a lower bound of Ω(n3 log n) by allowing weights which are exponential in n3. Details omitted. 6 Future Directions A natural direction for future work is to construct better data structures for the problems discussed in this paper. Our tight bounds on the number of distinct cut values (redundancy factor) yield straightforward schemes with improved storage requirement, as described in Section 5. But one may potentially improve these schemes in several respects. First, our storage requirement exceeds by a factor of T the number of distinct cut values. The latter (number of distinct cut values) may be the "right bound" for storage requirement, and it is 15 thus important to prove storage lower bounds; we only proved this for (2, 1)-Group-Cut. Second, it would be desirable to achieve fast query time, say sublinear in T or perhaps even constant. Third, one may ask for a distributed version of the data structure (i.e., a labeling scheme) that can report the same cut values; this would extend the known results [KKKP05] for minimum st-cuts. All these improvements require better understanding of the structure of the optimal vertex partitions (those that attain minimum cut values). Such structure is known for minimum st-cuts, where the Gomory-Hu tree essentially shows the existence of a family of minimum st-cuts, one for each s, t ∈ V , which is laminar. Another very interesting question is to explore approximation to the minimum cut, i.e., versions of the above problems where we only seek for each instance a cut within a small factor of the optimal. For instance, the cut values of (α, β)-Group-Cut can be easily approximated within factor α · β using Gomory-Hu trees, which requires storage that is linear in T, much below the aforementioned "right bound" Tα+β−1. Can a better approximation be achieved using similar storage? References [AMO93] R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Network flows - theory, algorithms and applications. Prentice Hall, 1993. [Ben95] A. A. Bencz´ur. Counterexamples for directed and node capacitated cut-trees. SIAM J. Comput., 24(3):505–510, 1995. doi:10.1137/S0097539792236730. [BHKP07] A. Bhalgat, R. Hariharan, T. Kavitha, and D. Panigrahi. An O(mn) Gomory- In 39th Annual ACM Hu tree construction algorithm for unweighted graphs. Symposium on Theory of Computing, STOC'07, pages 605–614. ACM, 2007. doi: 10.1145/1250790.1250879. [CCPS98] W. J. Cook, W. H. Cunningham, W. R. Pulleyblank, and A. Schrijver. Combi- natorial optimization. John Wiley & Sons Inc., New York, 1998. [CH91] C. Cheng and T. Hu. Ancestor tree for arbitrary multi-terminal cut functions. Annals of Operations Research, 33(3):199–213, 1991. [CSWZ00] S. Chaudhuri, K. V. Subrahmanyam, F. Wagner, and C. D. Zaroliagis. Com- doi:10.1007/ puting mimicking networks. Algorithmica, 26:31–49, 2000. s004539910003. [EH05] [FF56] [GH61] O. Einstein and R. Hassin. The number of solutions sufficient for solving a family of problems. Math. Oper. Res., 30(4):880–896, 2005. doi:10.1287/moor.1050. 0161. L. R. Ford and D. R. Fulkerson. Maximal flow through a network. Canadian journal of Mathematics, 8(3):399–404, 1956. R. E. Gomory and T. C. Hu. Multi-terminal network flows. Journal of the Society for Industrial and Applied Mathematics, 9:551–570, 1961. Available from: http://www.jstor.org/stable/2098881. 16 [Gus90] D. Gusfield. Very simple methods for all pairs network flow analysis. SIAM J. Comput., 19(1):143–155, 1990. doi:10.1137/0219009. [Har01] [Has88] [Has90] [Has91] D. Hartvigsen. Compact representations of cuts. SIAM J. Discrete Math., 14(1):49–66, 2001. doi:10.1137/S0895480196312334. R. Hassin. Solution bases of multiterminal cut problems. Math. Oper. Res., 13(4):535–542, 1988. doi:10.1287/moor.13.4.535. R. Hassin. An algorithm for computing maximum solution bases. Operations research letters, 9(5):315–318, 1990. doi:10.1016/0167-6377(90)90025-Z. R. Hassin. Multiterminal xcut problems. Annals of Operations Research, 33(3):215–225, 1991. doi:10.1007/BF02115756. [HKNR98] T. Hagerup, J. Katajainen, N. Nishimura, and P. Ragde. Characterizing multi- terminal flow networks and computing flows in networks of small treewidth. J. Comput. Syst. Sci., 57(3):366–375, 1998. doi:10.1006/jcss.1998.1592. [KKKP05] M. Katz, N. A. Katz, A. Korman, and D. Peleg. Labeling schemes for flow and connectivity. SIAM J. Comput., 34(1):23–40, 2005. doi:10.1137/ S0097539703433912. [KR13] [KR14] R. Krauthgamer and I. Rika. Mimicking networks and succinct representations of terminal cuts. In 24th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1789–1799. SIAM, 2013. doi:10.1137/1.9781611973105.128. A. Khan and P. Raghavendra. On mimicking networks representing minimum terminal cuts. Inf. Process. Lett., 114(7):365–371, 2014. doi:10.1016/j.ipl. 2014.02.011. [LNSW12] J. Lacki, Y. Nussbaum, P. Sankowski, and C. Wulff-Nilsen. Single source - all sinks max flows in planar digraphs. In 53rd Annual IEEE Symposium on Foundations of Computer Science, FOCS, pages 599–608, 2012. doi:10.1109/FOCS.2012.66. A No Non-trivial Redundancy for Directed Graphs In this section, we consider the directed versions of the three cut problems considered in this paper, viz. the Group-Cut, Multiway-Cut, Multicut. Note that in directed graphs, an s → t cut is a set of edges whose removal ensures there is no s → t path. We construct an infinite family of graphs which have no non-trivial redundancy for any of these problems, i.e., the number of distinct cut values is asymptotically equal to the total number of instances. Let n ∈ N, and let X, Y be two disjoint n-element sets. Consider the graph Gn := KX→Y , which is the orientation of the complete bipartite graph KX,Y obtained by orienting each edge from a vertex of X towards a vertex of Y . We assign edge weights in Gn in such a manner that every set of edges has distinct weight (for example, we may assign each edge a distinct power of 2). 17 Group-Cut in Directed Graphs. In the directed version of the (α, β)-Group-Cut prob- lem, given sets A, B ⊆ V such that A = α and B = β, we want to find a set of edges of minimum weight whose removal ensures there is no path from any vertex of A to any vertex of B. The total number of demand graphs for Gn is therefore {KA→B : A = α,B = β} = (cid:1) ·(cid:0)2n−α (cid:0)2n have {mincut(KA→B) : A = α,B = β} ≥(cid:0)n (cid:1) = Θα,β(nα+β). Let A ⊆ X, B ⊆ Y be such that A = α,B = β. A minimum (cid:1) = Ωα,β(nα+β) , and hence there is no (A, B)-cut must include all the edges of KA→B, and furthermore these edges are enough. By choice of weights, the value of the minimum (A, B)-cut is unique. This implies that in Gn we (cid:1) ·(cid:0)n α β α β non-trivial redundancy. We note that for the special case of st-cuts in directed graphs (i.e. (α, β)-Group-Cut with α = β = 1), Lacki et al. [LNSW12] show that there exists an infinite family of planar graphs, which have no non-trivial redundancy. That is, for every graph in the family there are Θ(V 2) distinct st-cuts. Multiway-Cut in Directed Graphs. In the directed version of the k-Multiway-Cut problem, given a k-element set S ⊆ V we want to find a set of edges of minimum weight whose removal ensures there is no s → s(cid:48) path for any distinct s, s(cid:48) ∈ S. Let k ≤ n be A = B = k/2, and let S = A ∪ B. Then S = k, and therefore constitutes an instance for the directed k-Multiway-Cut problem. For this instance any multiway cut must include all the edges of KA→B, and furthermore these edges are enough. Therefore the number of distinct cut values for the directed Multiway-Cut problem is at least {mincut(KA→B) : even. The number of instances S in Gn is(cid:0)2n (cid:1) ·(cid:0) n A ⊆ X, B ⊆ Y,A = B = k/2} =(cid:0) n (cid:1) = Θk(nk). Let A ⊆ X, B ⊆ Y be such that (cid:1) = Ωk(nk). k k/2 k/2 Multicut in Directed Graphs. In the directed version of the k-Multicut problem, given a set of demands D ⊆ V × V such that D = k, we want to find a set of edges of minimum weight whose removal ensures there is no s → s(cid:48) path for any (s, s(cid:48)) ∈ D. The total Let D be a set of edges of Gn such that D = k. It is evident that the minimum set of edges satisfying D is, in fact, D itself. By the choice of weights, the number of distinct values is at number of such demand graphs for Gn is {D ⊆ V × V : D = k} =(cid:0)2n(2n−1) least {mincut(D) : D ⊆ V × V,D = k} ≥(cid:0)n2 (cid:1) = Θk(n2k). (cid:1) = Ωk(n2k). k k 18
1305.0526
2
1305
2016-08-22T17:38:03
Matrix Inversion Is As Easy As Exponentiation
[ "cs.DS", "math.NA" ]
We prove that the inverse of a positive-definite matrix can be approximated by a weighted-sum of a small number of matrix exponentials. Combining this with a previous result [OSV12], we establish an equivalence between matrix inversion and exponentiation up to polylogarithmic factors. In particular, this connection justifies the use of Laplacian solvers for designing fast semi-definite programming based algorithms for certain graph problems. The proof relies on the Euler-Maclaurin formula and certain bounds derived from the Riemann zeta function.
cs.DS
cs
MATRIX INVERSION IS AS EASY AS EXPONENTIATION SUSHANT SACHDEVA AND NISHEETH K. VISHNOI Abstract. We prove that the inverse of a positive-definite matrix can be approximated by a weighted-sum of a small number of matrix exponentials. Combining this with a previous result [6], we establish an equivalence between matrix inversion and exponentiation up to polylogarithmic factors. In particular, this connection justifies the use of Laplacian solvers for designing fast semi-definite programming based algorithms for certain graph problems. The proof relies on the Euler-Maclaurin formula and certain bounds derived from the Riemann zeta function. 1. Matrix Inversion vs. Exponentiation Given a symmetric n × n matrix A, its matrix exponential is defined to be eA def= Pi≥0 Ai i! . This operator is of fundamental interest in several areas of mathematics, physics, and engineering, and has recently found important applications in algorithms, optimization and quantum complexity. Roughly, these latter applications are manifestations of the matrix-multiplicative weight update method and its deployment to solve semi-definite programs efficiently (see [1, 6, 5]). For fast graph algorithms, the quantity of interest is e−Lv, where L is the combinatorial Laplacian of a graph, and v is a vector. The vector e−Lv can also be interpreted as the resulting distribution of a certain continuous- time random walk on the graph with starting distribution v. In [6], appealing to techniques from approximation theory, the computation of e−Lv was reduced to a small number of computations of the form L−1u. Thus, using the near-linear-time Laplacian solver1 due to Spielman and Teng [7], this gives an O(m)-time algorithm for approximating e−Lv for graphs with m edges. The question of whether the Spielman-Teng result is necessary in order to compute e−Lv in near-linear time remained open, see [9, Chapter 9]. We answer this question in the affirmative by presenting a reduction in the other direction, again relying on analytical techniques. The following is our main result. Theorem 1.1. Given ε, δ ∈ (0, 1], there exist poly(log 1/δε) numbers 0 < wj, tj = O(poly(1/δε)), such that for all symmetric matrices A satisfying δI (cid:22) A (cid:22) I, (1 − ε)A−1 (cid:22) Pj wje−tj A (cid:22) (1 + ε)A−1. This proves that the problems of matrix exponentiation and matrix inversion are equivalent up to polylogarithmic factors. This result justifies the somewhat surprising use of Laplacian solvers for matrix-exponential based methods for designing fast semi-definite programming based algorithms for certain graph problems. Note that this equivalence does not require the matrix A to be a Laplacian, but only that it be a symmetric positive-definite matrix. It would be interesting to investigate if this result can be used to construct fast solvers for linear systems more general than those arising from graph Laplacians. Finally, note that the numbers wj, tj in the above theorem are independent of the matrix A, and are given explicitly in the proof. The proof of Theorem 1.1 follows from the lemma below, which gives such an approximation in the scalar world. Lemma 1.2. Given ε, δ ∈ (0, 1], there exist poly(log 1/δε) numbers 0 < wj, tj = O(poly(1/δε)), such that for all x ∈ [δ, 1], (1 − ε)x−1 ≤ Pj wje−tj x ≤ (1 + ε)x−1. Note that as x approaches 0 from the right, x−1 is unbounded, where as e−tx is bounded by 1 for any t > 0. This justifies the assumption that x ∈ [δ, 1]. Versions of this lemma were proved in [2, 3]. Our Sushant Sachdeva. Department of Computer Science, Princeton University, USA. [email protected]. Nisheeth K. Vishnoi. Microsoft Research, Bangalore, India. [email protected]. 1A Laplacian solver is an algorithm that (approximately) solves a given system of linear equations Lx = b, where L is a graph Laplacian and b ∈ Im(L), i.e., it (approximately) computes L−1b, see [9]. 1 proof is simple and self-contained. We attempt to make the analytical techniques used in the proofs accessible to a wider theory audience. We begin by showing how Lemma 1.2 implies Theorem 1.1. Proof of Theorem 1.1. Let {λi}i be the eigenvalues of A with corresponding eigenvectors {ui}i. Since A is symmetric and δI (cid:22) A (cid:22) I, we have λi ∈ [δ, 1], for all i. Let wj, tj > 0 denote the numbers given by Lemma 1.2 for parameters ε and δ. Thus, Lemma 1.2 implies that all i, (1 − ε)λ−1 i ≤ is the corresponding eigenvalue of A−1 and e−tj λi is that of e−tj A with the same eigenvector. Thus, multiplying the scalar inequalities by uiu⊤ i (cid:22) Pj wje−tj λi ≤ (1 + ε)λ−1 . Note that if λi is an eigenvalue of A, then λ−1 i uiu⊤ i i i uiu⊤ i (cid:22) (1 + ε)Pi λ−1 i and summing up, we obtain the matrix inequality (1 − ε)Pi λ−1 i . Hence, (1 − ε)A−1 (cid:22) Pj wje−tj A (cid:22) (1 + ε)A−1. Pj wj Pi e−tj λiuiu⊤ of Lemma 1.2 is the easy integral identity x−1 = R ∞ 1.1. Integral Representation, Discretization and Smoothness. The starting point of the proof 0 e−xtdt. Thus, by discretizing this integral to a sum, the fact that one can approximate x−1 as a weighted sum of exponentials as claimed Lemma 1.2 is not surprising. The crux is to prove that this can be achieved using a sparse sum of exponentials. One way to discretize an integral to a sum is the so called trapezoidal rule. If g is the integrand, and a g(t)dt by covering the area [a, b] is the interval of integration, this rule approximates the integral R b under g in the interval [a, b] using trapezoids of small width, say h, as follows: Z b a g(t)dt ≈ T [a,b],h g def = h 2 · K−1 (g(a + jh) + g(a + (j + 1)h)) , Xj=0 where K def= b−a h is an integer. The choice of h determines the discretization of the interval [a, b], and hence K, which is essentially the sparsity of the approximating sum. To apply this to the integral representation for x−1, we have to first truncate the infinite integral R ∞ 0 e−xtdt to a large enough interval [0, b], and then bound the error in the trapezoidal rule. Recall that the error needs to be of the form (cid:12)(cid:12)(cid:12) x−1 − h 2 Pj (cid:0)e−xjh + e−x(j+1)h(cid:1)(cid:12)(cid:12)(cid:12) ≤ εx−1. For such an error guarantee to hold, we must have xh ≤ Oε(1). Thus, if we want the approximation to hold for all 0 < x ≤ 1, we require h ≤ Oε(1), which in turn implies that K ≥ Ωε(b). Also, if we b e−xtdt = x−1e−bx, forcing b ≥ δ−1 log 1/ε for this error to be at most ε/x for all x ∈ [δ, 1]. Thus, this way of discretizing can only give us a sum which uses poly(1/δ) exponentials, which does not suffice for our application. restrict the interval to [0, b], the truncation error is R ∞ This suggests that we should pick a discretization such that t, instead of increasing linearly with h, increases much more rapidly. Thus, a natural idea is to allow t to grow geometrically. This can −∞ e−xes+sds. be achieved by substituting t = es in the above integral to obtain the identity x−1 = R ∞ We show that discretizing this integral using the trapezoidal rule does indeed give us the lemma. For convenience, we define fx(s) def = e−xes+s. First, observe that fx(s) = x−1 · f1(s + ln x). Since we also allow the error to scale as x−1, as x varies over [δ, 1], s needs to change only by an additive log 1/δ to compensate for x. Roughly, this suggests that when approximating this integral by the trapezoidal rule, the dependence on 1/δ is likely logarithmic, instead of polynomial. The proof formalizes this intuition and uses the fact that the error in the approximation by the trapezoidal rule can be expressed using the Euler-Maclaurin formula (see Section 2.1) which involves higher order derivatives of fx. We establish the following properties about the derivatives of fx which, when combined with known estimates on Bernoulli numbers obtained from the Riemann zeta function, allow us to bound this error with relative ease (see Section 2.2): (1) All the derivatives of fx up to any fixed order, vanish at the end points of the integration interval (in the limit). (2) The derivatives of fx are reasonably smooth; the L1 norm of the k-th derivative is bounded roughly by x−1kk (see Lemma 1.4). In summary, this allows us to approximate x−1 as an infinite sum of exponentials. In this sum, the contribution beyond about poly(log 1/εδ) terms turns out to be negligible, and hence we can truncate the infinite sum to obtain our final approximation (see Section 2.3). 2 We now present simple properties of the derivatives of fx, alluded to above, which underlie the technical intuition as to why an approximation of the kind claimed in Lemma 1.2 should exist. Let x (s) denote the kth derivative of the function fx with respect to s. The first fact relates f (k) f (k) x (s) to fx(s). Fact 1.3. For any non-negative integer k, f (k) non-negative integers satisfying Pk Proof. We prove this lemma by induction on k. For k = 0, we have f (0) of the required form, with c0,0 = 1, and P0 the claim holds for k. Hence, f (k) satisfying Pk is j=0 c0,j = 1. Hence, the claim holds for k = 0. Suppose j=0 ck,j(−xes)j, where ck,j are non-negative integers j=0 ck,j ≤ (k + 1)k+1. We can compute f (k+1) j=0 ck,j(−xes)j, where ck,j are some x (s) = fx(s)Pk x (s) = fx(s). Hence, f (0) j=0 ck,j ≤ (k + 1)k+1. (s) as follows, x x f (k+1) x (s) = ck,j(j − xes + 1)(−xes)jfx(s) Xj=0 x (s) = fx(s)Pk ck,j(−xes)jfx(s)  = k Xj=0 k+1 d ds   k = fx(s) Xj=0 ((j + 1)ck,j + ck,j−1)(−xes)j, x def = 0, and ck,−1 def = 0. Thus, if we define ck+1,j is of the required form. Moreover, we get, Pk+1 def = (j + 1)ck,j + ck,j−1, we where we define ck,k+1 get that ck+1,j ≥ 0, and that f (k+1) j=0 ck+1,j ≤ (k + 2)(k + 1)k+1 + (k + 1)k+1 = (k + 3)(k + 1)(k + 1)k ≤ (k + 2)2(k + 1)k ≤ (k + 2)k+2. This proves the claim for k + 1 and, hence, the fact follows by induction. The next lemma uses the fact above to bound the L1 norm of f (k) x . −∞(cid:12)(cid:12)(cid:12) Lemma 1.4. For every non-negative integer k, R ∞ −∞(cid:12)(cid:12)(cid:12) f (k) Proof. By Fact 1.3, R ∞ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ck,j(−xes)j  Z ∞ x Z ∞ Xj=0   tke−tdt(cid:19) ≤ x (s)(cid:12)(cid:12)(cid:12) ck,j(−t)j  x (s)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (k + 1)k+1(cid:18)Z 1 e−tdt +Z ∞ · (k + 1)k+1 · (1 + k!) ≤  Xj=0  e−xes+sds t=xes = ds ≤ 2 x · ek(k + 1)2k. · ek(k + 1)2k, ds is at most Fact 1.3 ≤ e−tdt f (k) 1 0 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) −∞ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 2 x 1 x n 1 x k 0 1 where the last inequality uses k + 1 ≤ ek, and 1 + k! ≤ 2(k + 1)k. We conclude this section by giving a brief comparison of our proof to that from [2]. While the authors in [2] employ both the trapezoidal rule and the Euler-Maclaurin formula, our proof strategy is different and leads to a shorter and simpler proof. In contrast to the previous proof, we use the Euler-Maclaurin formula in the limit over [−∞, ∞], and since the derivatives of fx vanish in the limit, we save considerable effort in bounding the derivatives at the end points of the integral, which is required when using the Euler-Maclaurin formula to bound the error. We manage to use simpler bounds, at the cost of slightly worse parameters. On the way, we obtain an approximation of x−1 as an infinite sum of exponentials that holds for all x > 0, which we believe is interesting in itself. 2. Proof of Lemma 1.2 Before we introduce the Euler-Maclaurin formula which captures the error in the approximation of an integral by the trapezoidal rule, we introduce the Bernoulli numbers and polynomials, bounds on which are derived using a connection to the Riemann zeta function. 3 attempt to compute sums of the form Pn equation which is satisfied for all positive integers k ≥ 2, Pk−1 j=0 (cid:0)k 1)P∞ 2.1. Bernoulli Polynomials and Euler-Maclaurin Formula. The Bernoulli numbers, denoted by bk for any integer k ≥ 0, are a sequence of rational numbers which, while discovered in an i≥0 ik, have deep connections to several areas of mathematics, including number theory and analysis.2 They can be defined recursively as: b0 = 1, and the following j(cid:1)bj = 0. This implies that (et − et−1 is an even function, thus implying that bk = 0 for odd k ≥ 2. Given the Bernoulli numbers, the Bernoulli polynomials are defined as (j) k (s) k! = Bk−j(s) Bk(s) (k−j)! . We also get B0(s) ≡ 1, B1(s) ≡ s − 1 2 . Moreover, using the definition of Bernoulli numbers, we get that Bk(0) = Bk(1) = bk for all k ≥ 2. We also need the following bounds on the Bernoulli polynomials and the Bernoulli numbers. j(cid:1)bjsk−j. It follows from the definition that, for all k, and j ≤ k, tk k! = t. Further, it can be checked that t = Pk j=0(cid:0)k 2 + t k=0 bk def B Lemma 2.1. For any non-negative integer k, and for all s ∈ [0, 1], B2k(s) (2k)! ≤ b2k (2k)! ≤ 4 (2π)2k . Proof. The first inequality follows from a well-known fact that B2k(s) ≤ b2k for all s ∈ [0, 1] (see [4]). For the second inequality, we recall the following connection between Bernoulli numbers and the Riemann zeta function for any even positive integer, proved by Euler (see [4]), ζ(2k) def= Pj≥1 j−2k = (−1)k+1 b2k(2π)2k 2·(2k)! (2k)! = 2 . Thus, b2k (2π)2k Pj≥1 j−2k ≤ 4(2π)−2k. One of the most significant connections in analysis involving the Bernoulli numbers is the Euler- Maclaurin formula which describes the error in approximating an integral by the trapezoidal rule. Lemma 2.2 (Euler-Maclaurin Formula). Given a function g : R → R, for any a < b, any positive h, and any positive integer N ∈ N, we have, (1) Z b a g(s)ds − T [a,b],h g = h2N +1Z K 0 B2N (s − [s]) (2N )! g(2N )(a + sh)ds − N Xj=1 b2j (2j)! h2j (cid:16)g(2j−1)(b) − g(2j−1)(a)(cid:17) , where K def = b−a h is an integer, and [·] denotes the integer part. Note that the Euler-Maclaurin formula is really a family of formulae, one each for the choice of N, which we call the order of the formula. Also note that this formula captures the error exactly. This error can be much less than the naive bound obtained by summing up the absolute value of the error due to each trapezoid. The first term in (1), after removing the contribution due to the Bernoulli polynomials via Lemma 2.1, can be bounded by the L1 norm of g(2N ). The second term in (1) depends only on g(2N −1) evaluated at the ends of the interval. The choice of N is influenced by how well behaved the higher order derivatives of the function are. For example, if g(s) is a polynomial, when a g(s)ds in terms of the values of the derivatives of 2N > degree(g), we get an exact expression for R b integral R fx(s)ds using the trapezoidal rule. For our application, we pick a and b such that the derivatives up to order 2N − 1 at a and b are negligible. Since the sparsity of the approximation is Ω(1/h), for the sparsity to depend logarithmically on the error parameter ε, we need to pick N to be roughly Ω(log 1/ε), so that the first error term in (1) is comparable to ε. In the next section, we use the Euler-Maclaurin formula to bound the error in approximating the g at a and b. We end this section by giving a proof sketch for the Euler-Maclaurin formula (see also [8]). By a change of variables, it suffices to prove the formula for h = 1 and for the interval [0, 1]. Consider the 2The story goes that when Charles Babbage designed the Analytical Engine in the 19th century, one of the most important tasks he hoped the Engine would perform was the calculation of Bernoulli numbers. 4 0 integral R 1 Z 1 0 B (2N) 2N (s) (2N )! g(s)ds, and apply integration by parts3 to it repeatedly to obtain B(2N ) 2N (s) (2N )! g(s)ds = B(2N −1) 2N (2N )! (s) 1 0 − B(2N −2) 2N (2N )! g(s)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) g(2N −1)(s)(cid:12)(cid:12)(cid:12)(cid:12) 1 0 B2N (s) (2N )! (s) g(1)(s)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) +Z 1 B2N (s) (2N )! 0 + B(2N −3) 2N (2N )! (s) 1 0 g(2N )(s)ds. 1 0 g(2)(s)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) − · · · − Using the fact that for all k ≤ 2N, B (k) 2N (s) (2N )! = B2N −k (s) (2N −k)! , and rearranging, we get, Z 1 0 B0(s)g(s)ds − B1(s)g(s)(cid:12)(cid:12)(cid:12)(cid:12) 1 0 = 2N Xk=2 (−1)k−1 Bk(s) k! B2N (s) (2N )! g(2N )(s)ds. 1 0 +Z 1 g(k−1)(s)(cid:12)(cid:12)(cid:12)(cid:12) is R 1 0 0 g(s)ds. Also, since B1(1) = Now, using B0(s) ≡ 1, we get that the first term on the l.h.s. 1/2, B1(0) = −1/2, we see that the second term on the l.h.s. . Finally, using Bk(0) = Bk(1) = bk for k ≥ 2, and that bk = 0 when k ≥ 2 is odd, we get the desired formula. is 1/2 · (g(0) + g(1)) = T [0,1],1 g integral R ∞ 2.2. Approximation Using an Infinite Sum. As mentioned in Section 1.1, we approximate the −∞ fx(s)ds using the trapezoidal rule. We bound the error in this approximation using the Euler-Maclaurin formula. Since the Euler-Maclaurin formula applies to finite intervals, we first fix the step size h, use the Euler-Maclaurin formula to bound the error in the approximation over the interval [−bh, bh] (where b is some positive integer), and then let b go to ∞. This allows us to approximate the integral over [−∞, ∞] by an infinite sum of exponentials. In the next section, we truncate this sum to obtain our final approximation. We are given ε, δ ∈ (0, 1]. Fix an x ∈ [δ, 1], the step size h = Θ(cid:0)(log 1/ε)−2(cid:1) , and the order of the Euler-Maclaurin formula, N = Θ (log 1/ε) (exact parameters to be specified later). For any positive integer b, applying the order N Euler-Maclaurin formula to the integral R bh −bh fx(s)ds, and using bounds from Lemma 2.1, we get, (2) fx(s)ds − T [−bh,bh],h fx Z bh (cid:12)(cid:12)(cid:12)(cid:12) −bh (cid:12)(cid:12)(cid:12)(cid:12) ≤4(cid:18) h f (2N ) x 2π(cid:19)2N Z bh −bh(cid:12)(cid:12)(cid:12) 2π(cid:19)2j 4(cid:18) h + N ds (s)(cid:12)(cid:12)(cid:12) (cid:16)(cid:12)(cid:12)(cid:12) Xj=1 f (2j−1) x Now, we can use Fact 1.3 to bound the derivatives in the last term of (2). Fact 1.3 implies that for any x , we (bh)(cid:12)(cid:12)(cid:12)(cid:17) . s and any positive integer k, (cid:12)(cid:12)f (k)(s)(cid:12)(cid:12) ≤ fx(s)(k + 1)k+1 max{1, (xes)k}. Thus, for b ≥ − 1 have xe−bh ≤ 1 and (cid:12)(cid:12)f (k)(−bh)(cid:12)(cid:12) ≤ e−bh(k + 1)k+1, and hence f (k)(−bh) vanishes for any fixed k and x , we get, (cid:12)(cid:12)f (k)(bh)(cid:12)(cid:12) ≤ xke(k+1)bh−xebh h, as b goes to ∞. Also, for any x > 0, and b > 1 (k + 1)k+1, which again vanishes for any fixed k and h, as b goes to ∞. Thus, letting b go to ∞ and observing that T [−bh,bh],h (−bh)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12) f (2j−1) x h log 1 h log 1 fx (3) converges to hPj∈Z fx(jh), (2) implies, ≤ 4(cid:18) h fx(s)ds − hXj∈Z Z ∞ −∞ fx(jh)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 2π(cid:19)2N Z ∞ −∞(cid:12)(cid:12)(cid:12) f (2N ) x ds. (s)(cid:12)(cid:12)(cid:12) Hence, since the derivatives of the function fx(s) vanish as s goes to ±∞, the error in approximating the integral over [−∞, ∞] is just controlled by its smoothness. Since we already know fx is a very 3R du ds vds = uv − R u dv ds ds. 5 smooth function, we are in good shape. Using Lemma 1.4, we get, (cid:0) h x (cid:16) (2N +1)2eh e2(2N +1)2 , and N . Thus, if we let h 2 log 24 def = def 2π 2π 2 (cid:17)2N x−1 − hXj∈Z (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ejh · e−xejh(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Z ∞ −∞ = (cid:6) 1 fx(s)ds − hXj∈Z fx(jh)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (4) f (2N ) x ds ≤ (s)(cid:12)(cid:12)(cid:12) −∞(cid:12)(cid:12)(cid:12) 2π(cid:1)2N R ∞ ε (cid:7) , (3) implies that, ≤ 8e−2N · ≤ . ε 3 1 x 1 x Also note that the above approximation holds for all x > 0. Thus, in particular, we can approximate the function x−1 over [δ, 1] as an (infinite) sum of exponentials. 2.3. Truncating the Infinite Sum and Proof of Lemma 1.2. Now, we want to truncate the infinite sum of exponentials approximating x−1 given by (4). Since the function fx(s) = es · e−xes is ε (cid:5) < 0 ≤ non-decreasing for s < log 1/x, we majorize the lower tail by an integral. For A def= (cid:4) − 1 h log 1 1 x (since x ≤ 1), h log 3 (5) ejh · e−xejh hXj<A ≤ hZ A −∞ ejh · e−xejh dj = Z eAh 0 e−xtdt = x−1(cid:16)1 − e−xeAh(cid:17) ≤ ε 3 1 x . Again, for the upper tail, since the function fx(s) = es · e−xes majorize by an integral. For B def is non-increasing for s ≥ log 1 x , we = (cid:6) 1 ≤ hZ ∞ B h log(cid:0) 1 δ log 3 ejh · e−xejh ε(cid:1)(cid:7) ≥ 1 h log 1 dj = Z ∞ eBh x (since x ≥ δ and ε ≤ 1), ε 1 3 x e−xtdt = x−1 · e−xeBh ≤ . (6) ejh · e−xejh hXj>B Before we complete the proof, we list here the setting of all parameters for completeness: N = (cid:24) 1 2 log 24 ε (cid:25) , h = 2π e2(2N + 1)2 , A = (cid:22) − 1 h log Thus, combining (4), (5) and (6), the final error is given by, 3 ε (cid:23) , B = (cid:24) 1 h log(cid:18)1 δ log 3 ε(cid:19)(cid:25) . 1 x − h B Xj≥A (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ejh · e−xejh(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) − hXj∈Z j≥A hejh · e−xejh 1 x ejh · e−xejh(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Hence, (1 − ε)x−1 ≤ PB References ejh · e−xejh + hXj<A + hXj>B ejh · e−xejh ≤ ε x . ≤ (1 + ε)x−1, implying the claim of Lemma 1.2. [1] Sanjeev Arora and Satyen Kale. A combinatorial, primal-dual approach to semidefinite programs. In STOC '07: Proc. 39th Ann. ACM Symp. Theory of Computing, pages 227 -- 236, 2007. [2] Gregory Beylkin and Lucas Monz´on. On approximation of functions by exponential sums. Applied and Computa- tional Harmonic Analysis, 19(1):17 -- 48, 2005. [3] Gregory Beylkin and Lucas Monz´on. Approximation by exponential sums revisited. Applied and Computational Harmonic Analysis, 28(2):131 -- 149, 2010. Special Issue on Continuous Wavelet Transform in Memory of Jean Morlet, Part I. [4] Ronald L. Graham, Donald E. Knuth, and Oren Patashnik. Concrete Mathematics: A Foundation for Computer Science. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2nd edition, 1994. [5] Rahul Jain, Zhengfeng Ji, Sarvagya Upadhyay, and John Watrous. QIP = PSPACE. J. ACM, 58(6):30:1 -- 30:27, December 2011. [6] Lorenzo Orecchia, Sushant Sachdeva, and Nisheeth K. Vishnoi. Approximating the exponential, the Lanczos method and an O(m)-time spectral algorithm for balanced separator. STOC '12, pages 1141 -- 1160, 2012. [7] Daniel A. Spielman and Shang-Hua Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In STOC, pages 81 -- 90, New York, NY, USA, 2004. ACM. [8] Terence Tao. The Euler-Maclaurin formula, Bernoulli numbers, the zeta function, and real-variable analytic con- tinuation. Available from What's New. [9] Nisheeth K. Vishnoi. Lx = b. Foundations and Trends in Theoretical Computer Science, 2012. 6
1410.7923
2
1410
2015-02-12T08:20:06
Optimal Online Edge Coloring of Planar Graphs with Advice
[ "cs.DS" ]
Using the framework of advice complexity, we study the amount of knowledge about the future that an online algorithm needs to color the edges of a graph optimally, i.e., using as few colors as possible. For graphs of maximum degree $\Delta$, it follows from Vizing's Theorem that $O(m\log \Delta)$ bits of advice suffice to achieve optimality, where $m$ is the number of edges. We show that for graphs of bounded degeneracy (a class of graphs including e.g. trees and planar graphs), only $O(m)$ bits of advice are needed to compute an optimal solution online, independently of how large $\Delta$ is. On the other hand, we show that $\Omega (m)$ bits of advice are necessary just to achieve a competitive ratio better than that of the best deterministic online algorithm without advice. Furthermore, we consider algorithms which use a fixed number of advice bits per edge (our algorithm for graphs of bounded degeneracy belongs to this class of algorithms). We show that for bipartite graphs, any such algorithm must use at least $\Omega(m\log \Delta)$ bits of advice to achieve optimality.
cs.DS
cs
Optimal Online Edge Coloring of Planar Graphs with Advice Jesper W. Mikkelsen⋆ [email protected] Department of Mathematics and Computer Science University of Southern Denmark Abstract. Using the framework of advice complexity, we study the amount of knowledge about the future that an online algorithm needs to color the edges of a graph optimally, i.e., using as few colors as possible. For graphs of maximum degree ∆, it follows from Vizing's Theorem that O(m log ∆) bits of advice suffice to achieve optimality, where m is the number of edges. We show that for graphs of bounded degeneracy (a class of graphs including e.g. trees and planar graphs), only O(m) bits of advice are needed to compute an optimal solution online, independently of how large ∆ is. On the other hand, we show that Ω(m) bits of ad- vice are necessary just to achieve a competitive ratio better than that of the best deterministic online algorithm without advice. Furthermore, we consider algorithms which use a fixed number of advice bits per edge (our algorithm for graphs of bounded degeneracy belongs to this class of algorithms). We show that for bipartite graphs, any such algorithm must use at least Ω(m log ∆) bits of advice to achieve optimality. 1 Introduction An edge coloring of a graph is an assignment of colors to the edges of the graph such that no two adjacent edges share the same color. Many scheduling and assignment problems can be modeled as edge coloring problems. The online edge coloring problem, which we refer to simply as edge-coloring, was introduced by Bar-Noy et al. [3]. In this problem, the edges of a graph arrive one by one. The edges are specified by their endpoints, but the vertices of the graph are not known in advance. Each edge must be assigned a color before the next edge arrives, under the constraint that no two adjacent edges are assigned the same color. The color assigned to an edge cannot be changed later on. The goal is to use as few colors as possible. Traditionally, worst-case competitive analysis [24, 31] is used to measure the performance of an online algorithm. The solution produced by the online algo- rithm, ALG, is compared to that of an optimal offline algorithm, OPT, which knows the entire input in advance. More precisely, let ALG(σ) (OPT(σ)) denote the num- ber of colors used by ALG (OPT) when coloring a sequence, σ, of edges. We say that ⋆ Supported in part by the Villum Foundation and the Danish Council for Independent Research, Natural Sciences. ALG is c-competitive if there exists a constant c0 such that ALG(σ) ≤ c·OPT(σ)+c0 for any input sequence σ. If the inequality holds with c0 = 0, then ALG is said to be strictly c-competitive. In [3] it is shown that any edge-coloring algorithm, which never introduces a new color unless forced to do so, is strictly 2-competitive and that no online algorithm, even if we allow randomization and restrict the input graph to being a forest, can achieve a better competitive ratio. The underlying assumption of competitive analysis, that nothing is known about future parts of the input, is sometimes unrealistic. Therefore, for many online problems, various relaxations of this assumption have been suggested, including look-ahead [5], locality of reference [10] and several models where the input is generated from some known probability distribution [25, 27, 28]. In this paper, we consider the recent idea of advice complexity introduced in [18] and further developed in [8, 19, 22]. Advice complexity provides a quantitative and problem-independent approach for relaxing the online constraint by providing the algorithm partial knowledge of the future. Our main goal in applying the framework of advice complexity to edge-coloring is to better understand the online hardness of the problem. How much (and which kind of) information about the future are we lacking in order to produce an optimal edge coloring in the online setting? Advice complexity models. In this paper, we consider the two most widely used models of advice complexity. In both models, an oracle, which has unlimited computational power and knows the entire input, provides the online algorithm ALG with some advice bits. For edge-coloring, the input is a sequence of m edges he1, . . . , emi. The two models are defined as follows: Advice-with-request [19]. In this model, ALG receives some fixed number, b, of advice bits along with each request. That is, when the edge ei arrives, the algorithm receives some advice bi ∈ {0, 1}b from the oracle. The algorithm then decides which color to assign to ei based on the edges e1, . . . , ei that have been revealed up until now and the advice b1, . . . , bi received thus far. Advice-on-tape [8, 22]. In this model, the online algorithm ALG is provided access to an infinite advice tape prepared by the oracle. The algorithm may, at any point in time, read some number of advice bits from the tape. When the edge ei arrives, the algorithm must decide which color to assign to ei based on the edges e1, . . . , ei that have been revealed up until now and the advice read so far from the tape. The advice complexity, b(m), of ALG is the largest number of advice bits read by ALG, over all possible input graphs with at most m edges. Note that an algorithm in the advice-with-request model receives exactly bm bits of advice in total. Thus, it can be converted into an algorithm with advice complexity bm+O(log b) in the advice-on-tape model (the O(log b) bits of advice are used to encode b). Converting in the opposite direction is not always possible in a meaningful way. In particular, an algorithm in the advice-on-tape model is allowed to read only a sublinear number of advice bits. This is not possible in the advice-with-request model. 2 Preliminaries. All graphs considered are simple. We denote the number of edges in a graph by m, the number of vertices by n and the maximum degree by ∆. A graph G is k-edge-colorable if there exists an edge coloring of G with at most k different colors. The chromatic index χ′(G) of G is the smallest integer k such that G is k-edge-colorable. We assume that colors are represented by consecutive positive integers. For a bipartite graph G, we write G = (L, R) if L and R form a bipartition of the vertices of G. We let Ka,b denote the complete bipartite graph G = (L, R) where L = a and R = b. In addition to bipartite graphs, we consider trees, planar graphs and, more generally, d-degenerate graphs. A graph is d-degenerate if there is an ordering v1, v2, . . . , vn of its vertices such that, for 1 ≤ i ≤ n, the vertex vi is adjacent to at most d vertices in {v1, . . . , vi−1}. The degeneracy of a graph G is the least integer d such that G is d-degenerate. An edge e = (vi, vk) where i < k is said to be a front-edge at vi and a back-edge at vk. Furthermore, df (vi) is the number of front-edges at vi. The notion of degeneracy has appeared under other names and many equiv- alent definitions exist (see e.g. [23]). Note that the degeneracy of a graph is at most ∆. A graph is 1-degenerate if and only if it is a forest. Planar graphs are 5-degenerate. Other graph classes of bounded degeneracy include graphs of bounded genus, bounded tree-width, and graphs excluding a fixed minor. It is clear that ∆ ≤ χ′(G) for any graph G. The celebrated Vizing's Theorem [33] states that χ′(G) ∈ {∆, ∆ + 1}. The following relationship between edge coloring and degeneracy, which is also due to Vizing, will be used extensively in the design of our algorithm. Theorem 1 (Vizing [32, 34]). Let G be a d-degenerate graph of maximum degree ∆. If ∆ ≥ 2d, then ∆ colors suffice for edge coloring G. Our contribution. By Vizing's theorem, there is a trivial upper bound on the advice complexity of edge-coloring of O(m log ∆) bits. We improve on this upper bound for d-degenerate graphs by showing that O(m log d) bits of advice suffice to achieve optimality. In particular, only O(m) bits of advice are needed for graphs of bounded degeneracy. The algorithm that we present works in both the advice-on-tape and the advice-with-request model. On the hardness side, we show that Ω(m) bits of advice are required in order to achieve a competitive ratio better than 2. This lower bound holds even for forests. Finally, we show that in the advice-with-request model, Ω(m log ∆) bits of advice are necessary to achieve optimality for bipartite graphs. Related work. While edge-coloring has not previously been studied in the framework of advice complexity, many other online problems have, see e.g. [1, 2, 4,6 -- 9,11,12,16 -- 20,22,29,30]. We remark that, contrary to edge-coloring, for several of the problems studied in the literature, sublinear advice (in the number of requests) suffice to achieve a competitive ratio better than that of the best deterministic algorithm without advice. This is the case for online problems such 3 as bin-packing [13], list accessing [12], knapsack [9], makespan minimization [2], paging [8] and ski-rental [18]. The computational complexity of (offline) edge coloring is well-studied. In general, deciding if χ′(G) = ∆ is NP-complete [21], but a (∆ + 1)-edge-coloring can always be found in polynomial time. For planar graphs, fast algorithms exist for most values of ∆ (see e.g. [14,15]). Also, the edge coloring guaranteed to exist by Theorem 1 can be computed efficiently [35]. 2 An algorithm for d-degenerate graphs In this section, we present the algorithm for d-degenerate graphs in the advice- with-request model. As mentioned in the introduction, converting the algorithm to the advice-on-tape model is straightforward. Theorem 2. Let d ∈ N. For the class of d-degenerate graphs, there exists an edge-coloring algorithm which always produces an optimal coloring and uses 1 + ⌈log(2d)⌉ + ⌈log(d + 1)⌉ = O(log d) bits of advice per edge and, hence, O(m log d) bits of advice in total. Theorem 2 assumes that the degeneracy of the input graph is at most d, where d is a constant hard-wired into both the algorithm and the oracle. In Theorem 3, we show how the assumption that d is constant can be removed by communicating d as part of the advice. Exactly how to do this depends on the model of advice complexity. In order to prove Theorem 2, we start by assuming that 2d divides the max- imum degree, ∆, of the input graph. Later on, we will show how to reduce the general case to this special case. Let G = (V, E) be a d-degenerate input graph of maximum degree ∆ and let a = ∆ 2d ∈ N. We will first give a high-level description of the oracle and the corresponding algorithm. The main idea is to partition the edges E into a disjoint subsets, E1, . . . , Ea, such that the maximum degree of the graph (V, Ej ) is 2d for 1 ≤ j ≤ a (this is possible since we are assuming ∆ = 2d · a). By Theorem 1, (E, Vj ) is 2d-edge-colorable. Thus, if the algorithm knew how to make such a partition, then, using O(log d) bits of advice per edge, the algorithm could make an optimal edge coloring of each Ej, and hence all of G. However, the oracle cannot afford to compute such a partition and then simply encode the index j such that e ∈ Ej for each edge, since this would require too much advice per edge if a is large. Instead, the oracle finds a specific partition which is based on the arrival time of the edges and the fact that G is d-degenerate. This partition is such that when an edge e is revealed, the algorithm itself can (without advice) compute a sufficiently small set of indices which always contains the correct index j. This makes it possible to reduce the number of advice bits needed for the algorithm to learn the index j. In order to produce this partition, the oracle orders the vertices of the d- degenerate input graph such that no vertex has more than d back-edges. Starting 4 with the first vertex in this ordering, the oracle processes the front-edges of each vertex ordered by (increasing) time of arrival. For each edge, the oracle determines the lowest index j ′ such that the edge can be assigned to Ej ′ while maintaining that (V, Ej ′ ) has maximum degree at most 2d. Note that whenever a front-edge, e, at v is being processed, the oracle has already assigned all back- edges of v to some sets in the partition. Since these back-edges may arrive later than e, they may be unknown to the algorithm at the time when e is revealed. Therefore, the advice for the front-edge e will warn the algorithm not to assign e to Ej if this would later on prevent the intended assignment of some back-edge at v to Ej. The oracle for the case where 2d divides ∆. We now give a formal descrip- tion of the oracle and the algorithm. To each edge e ∈ E, the oracle associates a bit string, B(e), of length ⌈log(2d)⌉ + ⌈log(d + 1)⌉ by following Procedure 1. Procedure 1 Constructing the advice in the case where 2d divides ∆. Input: A d-degenerate graph G = (V, E) of maximum degree ∆ where a · 2d = ∆ for some a ∈ N, together with arrival times of the edges. Output: A bit string B(e) of length ⌈log 2d⌉ + ⌈log(d + 1)⌉ for each edge e ∈ E. 1: Ej ← ∅ for 1 ≤ j ≤ a 2: Compute an ordering {v1, . . . , vn} of the vertices of G such that, for 1 ≤ i ≤ n, the vertex vi is adjacent to at most d vertices in {v1, . . . , vi−1}. Let {e1, . . . , edf (vi)} be the front-edges at vi ordered by time of arrival. for s = 1 to df (vi) do 3: Let E(vi) denote the edges incident to vi ∈ V . 4: Prev(e, vi) ← {f ∈ E(vi) : f arrives before e} for e ∈ E, vi ∈ V . 5: for i = 1 to n do 6: 7: 8: 9: 10: 11: 12: 13: Compute 2d-edge-colorings Cj of (V, Ej ) for all 1 ≤ j ≤ a. 14: For each edge e ∈ E, use the first ⌈log(2d)⌉ bits of B(e) to encode the color Let j ′ be the lowest index such that Ej ′ ∩ E(vi) ≤ 2d − 1. Ej ′ ← Ej ′ ∪ {e} Use the last ⌈log(d + 1)⌉ bits of B(e) to encode {j ∈ J(e) : j < j ′}. e ← es J(e) ← (cid:8)j : Ej ∩ Prev(e, vi) ≤ 2d − 1(cid:9) assigned to e in Cj, where j is such that e ∈ Ej. In order to prove the correctness of Procedure 1, we introduce the following terminology: At any point during the execution of Procedure 1, we say that an edge can legally be assigned to a subset Ej if this assignment does not make the maximum degree of (V, Ej ) larger than 2d. Also, we let P = {E1, . . . , Ea}. We will show in Lemma 1 that the index j ′ in line 10 is such that e can legally be assigned to Ej ′ and that the number in line 12 can be encoded using ⌈log(d + 1)⌉ bits. 5 Lemma 1. Suppose that during the execution of Procedure 1, the second for- loop has just been entered and that e = es. Let j ′ be the lowest index such that Ej ′ ∩ E(vi) ≤ 2d − 1. Then, e can legally be assigned to Ej ′ . Furthermore, j ′ is among the d + 1 lowest indices in J(e). Proof. Assume that e = (vi, vk) is a front-edge at vi and a back-edge at vk. Because i < k, none of the front-edges at vk has yet been assigned to any subset in P. Since vk has at most d back-edges (including e), it follows that no subset in P currently contains more than d − 1 edges incident to vk. Thus, if e cannot legally be assigned to some subset Ej, this can only be because it would violate the degree constraint at vi. That is, e can be legally assigned to Ej if and only if Ej ∩ E(vi) ≤ 2d − 1. Since at most ∆ − 1 = a · 2d − 1 edges incident to vi have arrived earlier than e, and since there are a subsets in P, this implies that e can legally be assigned to at least one subset in P. Let j ′ be the lowest index such that e can legally be assigned to Ej ′ . Clearly, j ′ ∈ J(e) since Prev(e, vi) ⊆ E(vi). We will show that j ′ is in fact among the d + 1 lowest indices in J(e). Let j ∈ J(e). By definition of J(e), the number of edges in Ej which are incident to vi and arrive before e is at most 2d − 1. Thus, if e cannot legally be assigned to Ej, then there must be an edge f ∈ Ej which is incident to vi but arrives later than e. The front-edges at vi arriving later than e has not yet been assigned to any subset in P, and so f must be a back-edge at vi. Since vi has at most d back-edges, there can be at most d indices j ∈ J(e) such that e cannot legally be assigned to Ej. It follows that j ′ must be among ⊓⊔ the d + 1 lowest indices in J(e). Combining the assumption that G has maximum degree ∆ = a2d with Lemma 1 shows that Procedure 1 constructs a partition E1, . . . , Ea of E such that the maximum degree of (V, Ei) is 2d, for 1 ≤ i ≤ n. Furthermore, the number in line 12 is at most d + 1 (and non-negative), and hence it can be en- coded in binary using ⌈log(d + 1)⌉ bits. It follows from Theorem 1 that each of the graphs (V, Ei) can be edge colored using 2d colors since they all have maxi- mum degree 2d and are d-degenerate (because they are subgraphs of G which is d-degenerate). This proves the correctness of Procedure 1. The algorithm for the case where 2d divides ∆. We now describe how the algorithm, ALG, uses the advice provided by the oracle. Note that when an edge e arrives, ALG is able to compute the set of indices J(e) as defined in line 9 of Procedure 1, since J(e) only depends on d and the edges that have arrived earlier than e. Thus, ALG can compute the index j ′ such that e was assigned to Ej ′ by Procedure 1 by learning the number {j ∈ J(e) : j < j ′} from the last ⌈log(d + 1)⌉ bits of B(e). The algorithm (internally) assigns e to Ej ′ . Then, ALG reads the integer, c, encoded by the first ⌈log(2d)⌉ bits of B(e) and colors e with the color ((j ′ − 1)2d + c). It follows that for all 1 ≤ j ≤ a, the algorithm colors the edges of Ej with the colors ((j − 1)2d + 1), . . . , j2d and produces a coloring of Ej which is equivalent to the coloring Cj computed by the oracle. Thus, ALG produces an optimal edge coloring of G. 6 The general case. Using the algorithm for the case where 2d divides ∆ as a subroutine, we are now ready to prove Theorem 2. Proof (of Theorem 2). Fix d ∈ N. We will describe an algorithm, ALG, and an oracle, ø, satisfying the conditions of the theorem. Let G = (V, E) be a d- degenerate input graph of maximum degree ∆. To each edge e ∈ E, the oracle associates a bit string, B(e), of length 1 + ⌈log(2d)⌉ + ⌈log(d + 1)⌉. The definition of B falls into two cases. Case: ∆ < 2d. The oracle computes an optimal edge coloring C of G. Since ∆ < 2d, Vizing's Theorem implies that at most 2d different colors are used in C. Let e ∈ E. The first bit of B(e) will be a 0. The next ⌈log(2d)⌉ bits will encode the color assigned to e in C. The remaining ⌈log d⌉ bits of B(e) are set arbitrarily. Case: ∆ ≥ 2d. Fix a, b ∈ N such that ∆ = a2d + b and 0 ≤ b ≤ 2d − 1. By assumption, a ≥ 1. The oracle computes an optimal edge coloring C of G. Since ∆ ≥ 2d, Theorem 1 implies that ∆ = a2d + b colors are used in C. Let E0 be the edges colored with the colors 1, 2, . . . , b. For e ∈ E0, the bit string B(e) is defined as follows: The first bit is a 0. The next ⌈log(2d)⌉ bits encode the color assigned to e in C (this is clearly possible since b ≤ 2d − 1). The remaining ⌈log d⌉ bits of B(e) are set arbitrarily. Let G′ = (V, E \ E0). Since G′ is a2d-edge-colorable, its maximum degree is at most a2d. On the other hand, no vertex in V is incident to more than b edges from E0, and so the maximum degree is at least ∆ − b = a2d. Furthermore, removal of edges cannot increase the degeneracy of a graph. Thus, G′ must be d-degenerate. For edges in G′, the first bit of B(e) is set to 1. The remaining bits of B(e) are constructed by running Procedure 1 on G′. We will now define the algorithm, ALG. For technical reasons, and since the algorithm does not know χ′(G), we begin by allowing the algorithm to use colors from {0, 1} × N. The algorithm receives the advice B(e) along with each edge e ∈ E. If the first bit of B(e) is a 0, the algorithm learns which color, c, to use for e ∈ E0 by reading the next ⌈log(2d)⌉ bits of B(e). It then assigns the color (0, c) to e. If the first bit of B(e) is a 1 then ALG simulates, using the remaining bits of B(e), the algorithm for the case where 2d divides ∆ with G′ as input graph. If that algorithm would assign the color c to e, ALG assigns the color (1, c) to e. One can easily modify ALG to use colors from the set {1, . . . , χ′(G)} as follows: The first time some color (i, c), i ∈ {0, 1}, is supposed to be used, ALG selects the lowest color c′ from {1, . . . , χ′(G)} which has not yet been used. From then on, ⊓⊔ ALG always uses the color c′ instead of (i, c). Improvements of the algorithm. The family of algorithms from Theorem 2 can be used to create a single algorithm which works even if we do not assume that a constant upper bound on the degeneracy is known a priori. In the advice- with-request model, the oracle starts by computing the degeneracy, dgn(G), of the input graph G. Then, the oracle finds the largest integer d such that 1 + ⌈log(2d)⌉ + ⌈log(d + 1)⌉ = 1 + ⌈log(2 dgn(G))⌉ + ⌈log(dgn(G) + 1)⌉. Clearly, dgn(G) ≤ d and hence G is d-degenerate. When the algorithm receives the very 7 first advice string, it determines d from the length of the advice received. From there on, Theorem 2 applies. Note that we do not increase the amount of advice by using d instead of dgn(G) as an upper bound on the degeneracy. In the advice- on-tape model, the oracle can simply write the value d onto the advice tape in a self-delimiting way using O(log d) bits (e.g., by writing ⌈log d⌉ in unary and then d itself in binary). This gives the following theorem. Theorem 3. In both the advice-with-request and the advice-on-tape model, there exists an edge-coloring algorithm which produces an optimal coloring and uses O(m log d) bits of advice in total, where d is the degeneracy of the input graph. We will show in Theorem 5 that in the advice-with-request model, at least Ω(log d) bits per edge are required to achieve optimality. Note that this matches asymptotically the upper bound of Theorems 2 and 3. However, the exact number of bits used by the algorithm presented can be lowered. For example, we would like to mention that the algorithm can rather easily be modified to use only a single bit per edge in the case of 1-degenerate graphs (forests). 3 Lower bounds 3.1 Sublinear advice is no better than no advice Recall that one very interesting aspect of the advice-on-tape model is that it allows an algorithm to read a sublinear number of advice bits. However, we will now show that linear advice is required to break the lower bound of 2 on the competitive ratio for edge-coloring. We remark that the hard input instances used in Theorem 4 are the same as the ones used in [3] to obtain the lower bound of 2 for the competitive ratio of algorithms without advice. The proof of Theorem 4 essentially shows how the techniques used in [3] can be extended to obtain a lower bound which holds even for algorithms with sublinear advice. Theorem 4. Let ε > 0 and let ALG be a (2 − ε)-competitive edge-coloring algorithm. Then ALG must read at least Ω(m) bits of advice, where m is the number of edges. This lower bound holds even if the input graph is required to be a forest. The constant of Ω(m) depends on ε. Proof. Let ALG be a (2 − ε) competitive algorithm in the advice-on-tape model (in the advice-with-request model, Theorem 4 follows directly from [3]). By def- inition, there exists a constant c0 such that ALG(σ) ≤ (2 − ε)OPT(σ) + c0 for any input sequence σ. Fix ∆ ≥ 2 such that ε∆ > c0 + 1. The adversary graph will be a forest of maximum degree ∆ (and therefore ∆-edge-colorable). We introduce some notation which will be used in the proof. Let α = (∆ − 1) ·(cid:0)2∆−2 β = (cid:0) α ∆−1(cid:1) + 1, let ∆(cid:1) and let R ∈ N be a large integer. A star is the complete bipartite graph K1,∆−1. We say that a collection of stars are colored the same if the edges of all of the stars are colored using the same ∆ − 1 colors. The values α and β have been chosen such that the following holds: Fact 1: Let C be an edge coloring of α stars using at most 2∆ − 2 colors. Then, at least ∆ stars must be colored the same in C. 8 Fact 2: Let C1, C2, . . . , Ck be edge colorings of α stars such that each edge coloring uses at most 2∆ − 2 colors. Then, there exist ∆ stars such that these stars are colored the same in at least ⌈k/β⌉ of the colorings. Fact 1 follows from the pigeonhole principle. Fact 2 follows since there are β ways to select the ∆ stars guaranteed to exist by Fact 1. The total number of edges in the forest will be m = (α + ∆)R. Let b be the maximum number of advice bits read by ALG on inputs of length m. Note that each of the 2b possible advice strings read by ALG on inputs of length m corresponds to a deterministic online algorithm without advice. Using this observation, we convert ALG into 2b deterministic algorithms, A1, . . . , A2b , such that minj Aj(σ) ≤ ALG(σ) for any sequence σ of m edges. We say that Aj is alive if the number of colors used by Aj so far is at most 2∆ − 2. We will now describe the adversary. The adversary starts by revealing R rows, where each row consists of α stars. The remaining edges are revealed in a number of rounds, one for each row. In round i, where 1 ≤ i ≤ R, the adversary uses the following strategy: Let k be the number of algorithms alive just before round i. The adversary selects ∆ stars from row i which are colored the same by at least ⌈k/β⌉ of the algorithms alive. Since an algorithm which is alive has used at most 2∆ − 2 colors, this is always possible by Fact 2. Let vi ∆ be the vertices of degree ∆ − 1 in the stars selected. The adversary reveals ∆ edges, (v, vi ∆), connecting these vertices to a new vertex, v. An algorithm Aj which have colored the selected stars with the same ∆ − 1 colors is forced to use ∆ other colors for these new edges and, hence, to use 2∆ − 1 colors in total. Thus, at the end of round i, the number of algorithms alive is at most k − ⌈k/β⌉ ≤ (1 − 1/β) k. 1), . . . , (v, vi 1, . . . , vi Since ε∆ > c0 + 1, we have that 2∆ − 1 > (2 − ε)∆ + c0. In particular, at least one algorithm Aj must be alive after round R since the number of colors used by ALG is at most (2−ε)∆+c0. Before the first round, the number of algorithms alive is at most 2b. After the last round, the number of algorithms alive is therefore at most (1 − 1/β)R 2b. Thus, it must hold that 1 ≤ (1 − 1/β)R 2b. But, this implies that b ≥ R log(cid:18) β β − 1(cid:19) = log(cid:16) β β−1(cid:17) α + ∆ m = Ω(m). (1) This proves the theorem since the number of rounds R (and therefore also m) ⊓⊔ can be chosen arbitrarily large. We remark that the hidden constant in the Ω(m) lower bound of Theorem 4 decreases very fast as ε tends to zero. However, the main point of Theorem 4, that sublinear advice does not offer any advantage, is not affected by this. 3.2 Tight lower bounds in the advice-with-request model As we have shown, O(m) bits of advice suffice to achieve optimality for graphs of bounded degeneracy. A natural question is whether this holds for general graphs. 9 We give a partial negative answer by showing that in the advice-with-request model, this is not the case, not even for bipartite graphs. It is a well-known result of Konig [26] that bipartite graphs are ∆-edge- colorable. In the proof of Theorem 5, we will use the following gadget to ensure that two edges cannot be assigned different colors in an optimal edge coloring. Definition 1. Let n ≥ 1. The graph Hn consists of a complete bipartite graph Kn,n = (L, R) together with vertices vl, vr and edges {(vl, v) : v ∈ L}, {(vr, v) : v ∈ R}. The vertex vl (vr) is denoted the leftmost (rightmost) vertex. We say that two edges e1 = (x1, y1) and e2 = (x2, y2) are connected by an Hn if y1 is the leftmost vertex and y2 is the rightmost vertex of the same Hn (and neither x1 nor x2 is part of that Hn). See Figure 1. el er Fig. 1. G4: Two edges el and er (dashed lines) connected by an H4 (solid lines). Lemma 2. For n ≥ 1, let Gn be the graph consisting of two edges, el and er, connected by an Hn. Then, Gn is (n + 1)-edge-colorable. On the other hand, an edge coloring of Gn in which el and er are assigned different colors must use at least n + 2 colors. Proof. Gn can be edge colored using n + 1 colors since it is a bipartite graph of maximum degree n+1. Let C be an edge coloring of Gn such that C(el) 6= C(er), where C(e) is the color assigned to the edge e. Suppose, by way of contradiction, that only n+1 different colors are used in C. Since el and er are colored differently, the set of colors used for edges between vl and L cannot be identical to the set of colors used for edges between vr and R, since this would contradict that C uses only n + 1 colors. Thus, there exists a color, c, such that there is an edge e = (vl, v), v ∈ L colored with the color c, while no edge between vr and R is colored with the color c. It follows that for each u ∈ R, there must be an edge between u and a vertex in L colored with the color c, since u has degree n + 1, C uses n+1 colors and the edge (vr, u) is not colored with the color c. In particular, since L = R, there must be an edge from a vertex in R to v colored with the ⊓⊔ color c. This is a contradiction, since (vl, v) is also colored with the color c. Theorem 5. An optimal edge-coloring algorithm in the advice-with-request model must use at least Ω(log ∆) bits of advice per edge, even for bipartite graphs, where ∆ is the maximum degree of the input graph. Proof. Fix ∆ ≥ 2. At the beginning, the adversary reveals two stars K1,∆. Let {x1, . . . , x∆} and {y1, . . . , y∆} be the vertices of degree 1 in each of these two 10 stars, and let x and y be the center vertices. Furthermore, let t be the time step right after both stars have been revealed. At time t, the adversary picks a permutation π of {1, 2, . . . , ∆}. For each 1 ≤ i ≤ ∆, the edge (x, xi) is then connected to the edge (y, yπ(i)) by an H∆−1 through xi and yπ(i). Since the resulting graph is bipartite and has maximum degree ∆, it can be colored using ∆ colors. Let ALG be an algorithm in the advice-with-request model such that, at time t, the total number of advice bits received by ALG is strictly less than log(∆!). We claim that ALG cannot be optimal. Note that the adversary has ∆! different permutations to choose from. This implies that there must exist two different permutations π, π′ such that up until time t, the algorithm receives exactly the same bits of advice for both of these permutations. Thus, ALG produces the same coloring, C, of the two stars no matter which of π and π′ the adversary chooses to use. Let C(u, v) be the color assigned to the edge e = (u, v) in C. Fix i such that π(i) 6= π′(i). Because the edges are adjacent, C(y, yπ(i)) 6= C(y, yπ′(i)). Since C(x, xi) cannot be the same as both C(y, yπ(i)) and C(y, yπ′(y)), we may assume without loss of generality that C(x, xi) 6= C(y, yπ(i)). By Lemma 2, this implies that ALG will use at least ∆ + 1 colors when the adversary chooses the permutation π. We conclude that an optimal algorithm must have received at least log(∆!) bits of advice at time t. Since only 2∆ edges are revealed before time t, this is only possible if the algorithm receives at least log(∆!) 2∆ = Ω(log ∆) ⊓⊔ bits of advice per edge. For the adversary graph used in Theorem 5, the number of edges is m = O(∆3). Thus, we may restate the lower bound of Ω(log ∆) bits per edge in terms of m and get a lower bound of Ω(log(m1/3)) = Ω(log m) bits per edge. This shows that even if we insist on measuring the amount of advice solely as a function of m (and not also ∆), the trivial upper bound of O(m log m) on the advice complexity is still asymptotically tight. Furthermore, the graph is ∆-regular. It follows that the degeneracy d of the graph is d = ∆. Thus, the lower bound may also be stated in terms of the degeneracy as Ω(log d) bits per edge. This matches asymptotically the upper bound of Theorems 2 and 3. 4 Concluding remarks and open problems As a consequence of Euler's formula, the degeneracy of a planar graph is at most 5. Thus, Theorem 2 implies that 8 bits of advice per edge (and hence 8m = O(m) bits in total) suffice to achieve optimality for planar graphs. On the other hand, since a forest is a planar graph, Theorem 4 shows that Ω(m) bits of advice are necessary just to achieve a competitive ratio better than 2. As mentioned, the greedy algorithm is 2-competitive [3] and uses no advice at all. Thus, Theorems 2 and 4 completely determines (asymptotically) the advice complexity of edge coloring planar graphs, in both models of advice complexity. For bipartite graphs, the picture is not as clear. The lower bound of Theo- rem 5 for bipartite graphs relies on the assumption that an algorithm receives 11 a fixed number of advice bits per edge, and so it only holds in the advice-with- request model. The lower bound may be viewed as a worst-case lower bound: We show that there exist some edges for which Ω(log ∆) bits of advice are re- quired. The advice-on-tape model allows us to also study the amortized number of advice bits per edge. Determining the advice complexity of edge-coloring for bipartite graphs in the advice-on-tape model is left as an interesting open problem. Acknowledgements. The author wishes to thank Joan Boyar and Lene M. Favrholdt for helpful discussions. References 1. Anna Adamaszek, Marc P. Renault, Adi Ros´en, and Rob van Stee. Reordering buffer management with advice. In WAOA, volume 8447 of LNCS, pages 132 -- 143, 2013. 2. Susanne Albers and Matthias Hellwig. Online makespan minimization with parallel schedules. In SWAT, volume 8503 of LNCS, pages 13 -- 25, 2014. 3. Amotz Bar-Noy, Rajeev Motwani, and Joseph Naor. The greedy algorithm is optimal for on-line edge coloring. Inf. Process. Lett., 44(5):251 -- 253, 1992. 4. Kfir Barhum. Tight bounds for the advice complexity of the online minimum steiner tree problem. In SOFSEM, volume 8327 of LNCS, pages 77 -- 88, 2014. 5. Shai Ben-David and Allan Borodin. A new measure for the study of on-line algo- rithms. Algorithmica, 11(1):73 -- 91, 1994. 6. Maria Paola Bianchi, Hans-Joachim Bockenhauer, Juraj Hromkovic, and Lucia Keller. Online coloring of bipartite graphs with and without advice. Algorithmica, 70(1):92 -- 111, 2014. 7. Hans-Joachim Bockenhauer, Dennis Komm, Rastislav Kr´alovic, and Richard Kr´alovic. On the advice complexity of the k-server problem. In ICALP (1), volume 6755 of LNCS, pages 207 -- 218, 2011. 8. Hans-Joachim Bockenhauer, Dennis Komm, Rastislav Kr´alovic, Richard Kr´alovic, In ISAAC, and Tobias Momke. On the advice complexity of online problems. volume 5878 of LNCS, pages 331 -- 340, 2009. 9. Hans-Joachim Bockenhauer, Dennis Komm, Richard Kr´alovic, and Peter Ross- manith. The online knapsack problem: Advice and randomization. Theor. Comput. Sci., 527:61 -- 72, 2014. 10. Allan Borodin, Sandy Irani, Prabhakar Raghavan, and Baruch Schieber. Com- petitive paging with locality of reference. J. Comput. Syst. Sci., 50(2):244 -- 258, 1995. 11. Joan Boyar, Lene M. Favrholdt, Christian Kudahl, and Jesper W. Mikkelsen. Ad- vice complexity for a class of online problems. In STACS, LIPIcs, 2015. To appear. 12. Joan Boyar, Shahin Kamali, Kim S. Larsen, and Alejandro L´opez-Ortiz. On the list update problem with advice. In LATA, volume 8370 of LNCS, pages 210 -- 221, 2014. 13. Joan Boyar, Shahin Kamali, Kim S. Larsen, and Alejandro L´opez-Ortiz. Online bin packing with advice. In STACS, volume 25 of LIPIcs, pages 174 -- 186, 2014. 14. Marek Chrobak and Takao Nishizeki. Improved edge-coloring algorithms for planar graphs. J. Algorithms, 11(1):102 -- 116, 1990. 12 15. Richard Cole and Lukasz Kowalik. New linear-time algorithms for edge-coloring planar graphs. Algorithmica, 50(3):351 -- 368, 2008. 16. Stefan Dobrev, Rastislav Kr´alovic, and Euripides Markou. Online graph explo- ration with advice. In SIROCCO, volume 7355 of LNCS, pages 267 -- 278, 2012. 17. Stefan Dobrev, Rastislav Kr´alovic, and Richard Kr´alovic. Advice complexity of maximum independent set in sparse and bipartite graphs. Theor. Comput. Syst., 56(1):197 -- 219, 2015. 18. Stefan Dobrev, Rastislav Kr´alovic, and Dana Pardubsk´a. Measuring the problem- relevant information in input. RAIRO Theor. Inform. Appl., 43(3):585 -- 613, 2009. 19. Yuval Emek, Pierre Fraigniaud, Amos Korman, and Adi Ros´en. Online computa- tion with advice. Theor. Comput. Sci., 412(24):2642 -- 2656, 2011. 20. Michal Forisek, Lucia Keller, and Monika Steinov´a. Advice complexity of online coloring for paths. In LATA, volume 7183 of LNCS, pages 228 -- 239, 2012. 21. Ian Holyer. The NP-completeness of edge-coloring. SIAM J. Comput., 10(4):718 -- 720, 1981. 22. Juraj Hromkovic, Rastislav Kr´alovic, and Richard Kr´alovic. Information complex- ity of online problems. In MFCS, volume 6281 of LNCS, pages 24 -- 36, 2010. 23. Tommy R. Jensen and Bjarne Toft. Graph Coloring Problems. Wiley, 2011. 24. Anna R. Karlin, Mark S. Manasse, Larry Rudolph, and Daniel Dominic Sleator. Competitive snoopy caching. Algorithmica, 3:77 -- 119, 1988. 25. Claire Kenyon. Best-fit bin-packing with random order. In SODA, pages 359 -- 364, 1996. 26. D´enes Konig. Uber Graphen und ihre Anwendung auf Determinantentheorie und Mengenlehre. Math. Ann., 77(4):453 -- 465, 1916. 27. Elias Koutsoupias and Christos H. Papadimitriou. Beyond competitive analysis. SIAM J. Comput., 30(1):300 -- 317, 2000. 28. Prabhakar Raghavan. A statistical adversary for on-line algorithms. In On-Line Algorithms, DIMACS Series in Discrete Mathematics and Theoretical Computer Science, pages 79 -- 83, 1991. 29. Marc P. Renault, Adi Ros´en, and Rob van Stee. Online algorithms with advice for bin packing and scheduling problems. CoRR, abs/1311.7589, 2013. 30. Sebastian Seibert, Andreas Sprock, and Walter Unger. Advice complexity of the online coloring problem. In CIAC, volume 7878 of LNCS, pages 345 -- 357, 2013. 31. Daniel D. Sleator and Robert E. Tarjan. Amortized efficiency of list update and paging rules. Commun. ACM, 28(2):202 -- 208, 1985. 32. Michael Stiebitz, Diego Scheide, Bjarne Toft, and Lene M. Favrholdt. Graph Edge Coloring: Vizing's Theorem and Goldberg's Conjecture. Wiley, 2012. 33. V. G. Vizing. On an estimate of the chromatic class of a p-graph (in Russian). Metody Diskret. Analiz., 3:25 -- 30, 1964. 34. V. G. Vizing. Critical graphs with given chromatic class (in Russian). Metody Diskret. Analiz., 5:9 -- 17, 1965. 35. Xiao Zhou and Takao Nishizeki. Edge-coloring and f-coloring for various classes of graphs. J. Graph Algorithms Appl., 3(1), 1999. 13
1508.00142
2
1508
2015-10-14T08:22:04
Online Contention Resolution Schemes
[ "cs.DS", "cs.DM" ]
We introduce a new rounding technique designed for online optimization problems, which is related to contention resolution schemes, a technique initially introduced in the context of submodular function maximization. Our rounding technique, which we call online contention resolution schemes (OCRSs), is applicable to many online selection problems, including Bayesian online selection, oblivious posted pricing mechanisms, and stochastic probing models. It allows for handling a wide set of constraints, and shares many strong properties of offline contention resolution schemes. In particular, OCRSs for different constraint families can be combined to obtain an OCRS for their intersection. Moreover, we can approximately maximize submodular functions in the online settings we consider. We, thus, get a broadly applicable framework for several online selection problems, which improves on previous approaches in terms of the types of constraints that can be handled, the objective functions that can be dealt with, and the assumptions on the strength of the adversary. Furthermore, we resolve two open problems from the literature; namely, we present the first constant-factor constrained oblivious posted price mechanism for matroid constraints, and the first constant-factor algorithm for weighted stochastic probing with deadlines.
cs.DS
cs
Online Contention Resolution Schemes Moran Feldman∗ Ola Svensson† Rico Zenklusen‡ October 15, 2015 Abstract We introduce a new rounding technique designed for online optimization problems, which is related to contention resolution schemes, a technique initially introduced in the context of submodular function maximization. Our rounding technique, which we call online contention resolution schemes (OCRSs), is applicable to many online selection problems, including Bayesian online selection, oblivious posted pricing mechanisms, and stochastic probing models. It allows for handling a wide set of constraints, and shares many strong properties of offline contention resolution schemes. In particular, OCRSs for different constraint families can be combined to obtain an OCRS for their intersection. Moreover, we can approximately maximize submodular functions in the online settings we consider. We, thus, get a broadly applicable framework for several online selection problems, which improves on previous approaches in terms of the types of constraints that can be handled, the objective functions that can be dealt with, and the assumptions on the strength of the adversary. Furthermore, we resolve two open problems from the literature; namely, we present the first constant-factor constrained oblivious posted price mechanism for matroid constraints, and the first constant-factor algorithm for weighted stochastic probing with deadlines. Keywords: contention resolution schemes, online algorithms, matroids, prophet inequalities, oblivious posted pricing, stochastic probing 5 1 0 2 t c O 4 1 ] S D . s c [ 2 v 2 4 1 0 0 . 8 0 5 1 : v i X r a ∗School of Computer and Communication Sciences, EPFL. Email: [email protected]. Supported by ERC Starting Grant 335288-OptApprox. †School of Computer and Communication Sciences, EPFL. Email: [email protected]. Supported by ERC Starting Grant 335288-OptApprox. ‡Department of Mathematics, ETH Zurich, and Department of Applied Mathematics and Statistics, Johns Hopkins University. Email: [email protected]. 1 Introduction Recently, interest has surged in Bayesian and stochastic online optimization problems. These are problems where we can use limited a priori information to select elements arriving online, often subject to classical combinatorial constraints such as matroids, matchings and knapsack constraints. Examples include posted pricing mechanisms [8, 24, 18], prophet inequalities [18], probing models [17, 1], stochastic matchings [3], and secretary problems [2, 20, 15].1 Simultaneous with this development, interest has arose also in gener- alizing the optimization of linear objective functions to relevant nonlinear objective functions. A particular focus was set on submodular functions, which is a function class that captures the property of diminishing returns, a very natural property in many of the above-mentioned settings [21, 1, 4, 16]. A very successful approach for these problems is based on first using the a priori information to formu- late an (often linear) relaxation whose optimal fractional solution x∗ upper bounds the performance of any online (or even offline) algorithm. Then, x∗ is used to devise an online algorithm whose goal is to recover a solution of a similar objective value as x∗. Such an online algorithm can also be interpreted as an online rounding procedure for rounding x∗. In particular, online rounding approaches have recently been used to obtain nearly optimal and surprisingly elegant results for stochastic matchings (see Bansal et al. [3]), and for a very general probing model introduced by Gupta and Nagarajan [17] with applications in posted pricing mechanisms, online matching problems and beyond. A key ingredient in the general rounding algorithms presented in [17] are so-called contention resolution schemes (CRSs), a rounding technique introduced by Chekuri et al. [10] in the context of (offline) submodu- lar function maximization. CRSs are defined with respect to a constraint family, like matroids, matching, or knapsack constraints. Interestingly, the existence of a so-called ordered CRS for the given constraint family is all that is needed to apply the techniques of [17]. Whereas this generality is very appealing, there are some inherent barriers in current CRSs that hinder a broader applicability to online settings beyond the probing model defined in [17]. More precisely, most settings considered in [17] require that the algorithm can choose the order in which to obtain new online information about an underlying ground set over which the objective is optimized. This is due to the fact that most CRSs need to round the components of a fractional point x∗ step by step in a particular order. In this paper we introduce a stronger notion of contention resolution schemes that overcomes this restric- tion and allows for the online information to be presented adversarially. We show that such schemes exist for many interesting constraint families, including matroid constraints and knapsack constraints. As we dis- cuss in Section 1.3, this leads to a broadly applicable online rounding framework that works in considerably more general settings than previous approaches. Furthermore, our techniques answer two open problems from the literature: we show the existence of a constrained oblivious posted-pricing mechanism (COPM) for matroids, intersection of matroids, and further constraints families (a question first raised in [8]); and we get an O(1)-competitive algorithm for the weighted probing problem with deadlines introduced in [17]. Additionally, our rounding approach yields optimal guarantees (up to moderate constant factors) for a class of online submodular function maximization problems. Before we formally define our rounding framework (Section 1.1), state our results (Section 1.2) and describe the aforementioned applications (Section 1.3), it is helpful to introduce our rounding framework in the light of a concrete example. Consider the following Bayesian online selection problem studied by Kleinberg and Weinberg [18] in the context of prophet inequalities. There is a finite set N of items or elements, and a nonnegative random variable Ze for each e ∈ N, where all {Ze}e∈N are independent. The distributions of all Ze are known and for simplicity we assume they are continuous. Furthermore, a matroid 1Strictly speaking, secretary problems have no a priori information. However, as items arrive in a random order, most algorithms first observe a fraction of the elements (serving as the a priori information), and then devise an online strategy based on this information. 1 M = (N, F) on N is given.2 Let {ze}e∈N be realizations of the random variables {Ze}e∈N . The goal is to select a subset I ⊆ N of the elements that is independent, i.e., I ∈ F, and whose value z(I) := Pe∈E ze is as large as possible. The way how elements can be selected works as follows. Elements e ∈ N reveal one by one their realization ze, in a fixed prespecified order that is unknown to the algorithm. Whenever a value ze is revealed, one has to choose whether to select e or discard it, before the next element reveals its realization. A natural way to approach this problem is to define a threshold te ≥ 0 for each e ∈ N and only accept elements e ∈ N whose realization is at least the threshold, i.e., ze ≥ te; we call such elements active. Let xe be the probability of e being active, i.e., xe = Pr[Ze ≥ te]. Notice that the set of all active elements is distributed like a random set that contains each element e independently with probability xe. We denote such a set by R(x). As we show in Section 4, using a convex relaxation one can find thresholds te such that: (i) x = (xe)e∈N is in the matroid polytope PF ,3 and (ii) an algorithm that disregards the matroid constraint and accepts any active element would have an expected return at least as good as the one of an optimal offline algorithm. Our goal is to design an online algorithm that only selects active elements, such that an independent set I is obtained where Pr[e ∈ I] ≥ c · xe for all e ∈ E, where c ∈ (0, 1] is a constant as large as possible. It is not hard to check that such a procedure would lead to an objective value of at least c times the offline optimum. The guarantee we are seeking closely resembles the notion of c-balanced CRSs as defined in [10], which is an offline algorithm that depends on x and returns for any set S ⊆ N a (potentially random) subset π(S) ⊆ S with π(S) ∈ F such that Pr[e ∈ π(R(x))] ≥ c · xe. The only reason why this procedure is not applicable in the above context is that, in general, π needs to know the realization of the full set R(x) in advance to determine π(R(x)). However, R(x) is revealed element by element in the above selection problem. A key observation in [17] is that some CRSs do not need to know the full set R(x) upfront, but can round step by step if the elements come in some prescribed order chosen by the algorithm. However, in the above setting, as in many other combinatorial online problems, the order cannot be chosen freely. We overcome this limitation through a considerably stronger notion of CRSs, which we call online contention resolution schemes (OCRSs). 1.1 Online contention resolution schemes OCRSs, like classical contention resolution schemes, are defined with respect to a relaxation of the feasible sets of a combinatorial optimization problem. Consider a finite ground set N = {e1, . . . , en}, and a family of feasible subsets F ⊆ 2N , which is down-closed, i.e., if I ∈ F and J ⊆ I then J ∈ F. Let PF ⊆ [0, 1]N be the polytope corresponding to the feasible sets F, i.e., PF is the convex hull of all characteristic vectors of feasible sets: PF = conv({1F I ∈ F}) . We highlight that throughout this paper we focus on down-closed feasibility constraints. Definition 1.1 (relaxation). We say that a polytope P ⊆ [0, 1]N is a relaxation of PF if it contains the same {0, 1}-points, i.e., P ∩ {0, 1}N = PF ∩ {0, 1}N . We start by defining online contention resolution schemes (OCRS) simply as algorithms that can be applied to the online selection problem highlighted in the introduction. The performance of an OCRS is then characterized by additional properties that we define later. 2We recall that a matroid M = (N, F) consists of a finite ground set N and a nonempty family F ⊆ 2N of subsets of N satisfying: (i) If I ∈ F , J ⊆ I, then J ∈ F, and (ii) if I, J ∈ F , J > I, then ∃e ∈ J \ I with I ∪ {e} ∈ F. If not stated otherwise, we assume that matroids are given by an independence oracle that, for every I ⊆ N, returns whether I ∈ F. 3The matroid polytope PF is the convex hull of all characteristic vectors of independent sets. In particular it can be described by PF = {x ∈ RN ≥0 x(S) ≤ rank(S) ∀S ⊆ N }, where rank(S) = max{I I ⊆ S, I ∈ F} is the rank function of M. 2 Definition 1.2 (Online contention resolutions scheme (OCRS)). Let us consider the following online selec- tion setting. A point x ∈ P is given and let R(x) be a random subset of active elements. The elements e ∈ N reveal one by one whether they are active, i.e., e ∈ R(x), and the decision whether to select an active element is taken irrevocably before the next element is revealed. An OCRS for P is an online algorithm that selects a subset I ⊆ R(x) such that 1I ∈ P . Most of the OCRSs that we present follow a common algorithmic theme, which leads us to the definition of greedy OCRS. Definition 1.3 (Greedy OCRS). Let P ⊆ [0, 1]N be a relaxation for the feasible sets F ⊆ 2N . A greedy OCRS π for P is an OCRS that for any x ∈ P defines a down-closed subfamily of feasible sets Fπ,x ⊆ F, and an element e is selected when it arrives if, together with the already selected elements, the obtained set is in Fπ,x. If the choice of Fπ,x given x is randomized, we talk about a randomized greedy OCRS; otherwise, we talk about a deterministic greedy OCRS. We also simplify notation and abbreviate Fπ,x by Fx when the OCRS π is clear from the context. For simplicity of presentation, and because all our main results are based on greedy OCRSs, we restrict our attention to this class of OCRSs, and focus on greedy OCRSs when defining and analyzing properties. As mentioned in the example shown in the introduction, a desirable property of OCRSs would be that every element e ∈ N gets selected with probability at least c · xe for a constant c > 0 as large as possible. This property is called c-balancedness in the context of classical contention resolution schemes. However, to be precise about such properties in the online context that we consider, one has to specify the power of the adversary who chooses the order of the elements. Adversaries of different strengths have been considered in various online settings. For example, one arguably weak type of adversary is an offline adversary, who has to choose the order of the elements upfront, before any elements get revealed. On the other end, the most powerful adversary that can be considered is what we call the almighty adversary; an almighty adversary knows upfront the outcomes of all random events, which includes the realization of R(x) and the outcome of the random bits that the algorithm may query. An almighty adversary can thus calculate exactly how the algorithm will behave and reveal the elements in a worst case order. A typical adversary type that is in between these two extremes is an online adversary, who can choose the next element to reveal online depending on what happened so far; thus, it has the same information as the online algorithm. Throughout this paper, when not indicated otherwise, we assume to play against the almighty adversary. In the context of greedy OCRSs, we define a considerably stronger notion than c-balancedness, which we call c-selectability, and which leads to results even against the almighty adversary. In words, a greedy OCRS is c-selectable if with probability at least c, the random set R(x) is such that an element e is selected no matter what other elements I of R(x) have been selected so far as long as I ∈ Fx. Thus, it guarantees that an element is selected with probability at least c against any (even the almighty) adversary. Definition 1.4 (c-selectability). Let c ∈ [0, 1]. A greedy OCRS for P is c-selectable if for any x ∈ P we have Pr[I ∪ {e} ∈ Fx ∀ I ⊆ R(x), I ∈ Fx] ≥ c ∀e ∈ N . We highlight that the probability in Definition 1.4 is over the random outcomes of R(x) when dealing with a deterministic greedy OCRS; when the greedy OCRS is randomized, then the probability is over R(x) and the random choice of Fx. We call an element e ∈ N selectable for a particular realization of R(x) and random choice of Fx if I ∪ {e} ∈ Fx for all I ⊆ R(x) with I ∈ Fx. As aforementioned, the c-selectability is a very strong property that implies guarantees against any adversary. Despite this strong definition, we show that Ω(1)-selectable greedy OCRSs exist for many natural constraints. 3 Often, a larger factor c can be achieved when x is supposed to be in a down-scaled version of P . This is similar to the situation in classical contention resolution schemes. Definition 1.5 ((b, c)-selectability). Let b, c ∈ [0, 1]. A greedy OCRS for P is (b, c)-selectable if for any x ∈ b · P we have Pr[I ∪ {e} ∈ Fx ∀ I ⊆ R(x), I ∈ Fx] ≥ c ∀e ∈ N . Notice that a (b, c)-selectable greedy OCRS implies a randomized bc-selectable greedy OCRS because we can “scale down” x online by only considering each element e with probability b independent of the other elements. Observation 1.6. A (b, c)-selectable greedy OCRS for P implies a (randomized) bc-selectable greedy OCRS for P . The existence of OCRSs is interesting even regardless of efficiency issues. Still, in many applications it is important to have efficient OCRSs. Definition 1.7 (efficiency). A greedy OCRS π is efficient if there exists a polynomial time algorithm that, for a given input x, samples an efficient independence oracle for the set Fπ,x. That is, an oracle that answers in polynomial time queries of the form: is a set S ⊆ N in Fπ,x? We next summarize our technical results before highlighting the implications of our results to various online settings. 1.2 Our results Our first technical result proves the existence of greedy OCRSs with constant selectability for relaxations of several interesting families of constraints. All the greedy OCRSs described by Theorem 1.8 are either efficient, or can be made efficient at the cost of an arbitrarily small constant ε > 0 loss in the selectability guarantee. Theorem 1.8. There exist: • For every b ∈ [0, 1], a (b, 1 − b)-selectable deterministic greedy OCRS for matroid polytopes. • For every b ∈ [0, 1], a (b, e−2b)-selectable randomized greedy OCRS for matching polytopes.4 • For every b ∈ [0, 1/2], a (b, 1−2b 2−2b )-selectable randomized greedy OCRS for the natural relaxation of a knapsack constraint. Interestingly, it turns out that there is no (b, c)-selectable deterministic greedy OCRS for the natural re- laxation of a knapsack constraint for any constants b and c. This stands in contrast to the case of the matching polytope, for which the randomized greedy OCRS given by Theorem 1.8 can be made deterministic at the cost of only a small loss in the selectability. Like offline CRSs, greedy OCRSs can be combined to form greedy OCRSs for more involved con- straints. Theorem 1.9. If π1 is a (b, c1)-selectable greedy OCRS for a polytope P1, and π2 is a (b, c2)-selectable greedy OCRS for a polytope P2, then there exists a (b, c1 · c2)-selectable greedy OCRS for the polytope P1 ∩ P2. Moreover, the last greedy OCRS is efficient if π1 and π2 are. 4Our greedy OCRS works also for a weaker relaxation of matching which only bounds the degree of each node. 4 Notice that Theorem 1.9 can be applied repeatedly to combine several OCRSs. Thus, Theorems 1.8 and 1.9 prove together the existence of constant selectability greedy OCRSs for any constant intersection of matroid, matching and knapsack constraints. It is easy to see that, given a non-negative increasing linear objective function, a (b, c)-selectable greedy OCRS for a polytope P can be used to round online a vector x ∈ bP while losing only a factor of c in the objective. Theorem 1.10 proves this result formally, and extends it to nonnegative submodular5 functions. To state this theorem, we need to define some notation. Given a function f : 2N → R, the multilinear extension of f is a function F : [0, 1]N → R whose value for a vector x ∈ [0, 1]N is F (x) = E[f (R(x))]. Informally, F (x) is the expected value of f over a set obtained by randomly rounding every coordinate of x independently. Theorem 1.10. Given a nonnegative monotone6 submodular function f : 2N → R≥0 and a (b, c)-selectable greedy OCRS for a polytope P , applying the greedy OCRS to an input x ∈ bP results in a random set S satisfying E[f (S)] ≥ c·F (x), where F is the multilinear extension of f . Moreover, even if f is not monotone, E[f (R(1/2 · 1S))] ≥ (c/4) · F (x), where the random decisions used to calculate R(1/2 · 1S) are considered part of the algorithm, and thus, known to the almighty adversary. In many applications the use of Theorem 1.10 requires finding offline, using the available a priori infor- mation, a vector x (approximately) maximizing the multilinear extension F . This can often be done using known algorithms. For example, Calinescu et al. [7] proved that given a non-negative monotone submodular function f : 2N → R≥0 and a solvable7 polytope P ⊆ [0, 1]N , one can efficiently find a fractional point x ∈ P for which F (x) ≥ (1 − e−1) · max{f (S) 1S ∈ P }. Chekuri et al. [10] showed that even when f is not monotone, an analogous result can be obtained with a worse constant factor of 0.325 instead of 1 − e−1 when P is solvable and down-closed. A simpler procedure with a stronger constant factor was later presented by Feldman et al. [14], implying that one can efficiently find a fractional point x ∈ P for which F (x) ≥ (e−1 − o(1)) · max{f (S) 1S ∈ P } as long as the polytope P is solvable and down-closed. The result of Theorem 1.10 for a non-monotone submodular objective can sometimes be improved when assuming an online adversary (instead of an almighty one). The class of OCRSs for which this can be done is a bit involved to define, and we defer its definition to Section 3. We state here only the following special case of the result we prove. Theorem 1.11. Let π be a (b, c)-selectable greedy OCRS π for a polytope P that was obtained by using Theorem 1.9 to combine the OCRS of Theorem 1.8. Then, for every given non-negative submodular function f : 2N → R≥0 there exists an OCRS π′ for P that for every input vector x ∈ bP and online adversary selects a random set S such that E[f (S))] ≥ c · F (x). The OCRS π′ guaranteed by Theorem 1.11 is not efficient. However, if π is efficient then π′ can be made efficient at the cost of an additive loss of N −d · max{f ({e}) xe > 0} in the guarantee (where d is any positive constant). 1.3 Applications In this section we present a few applications for our technical results. All these applications were previously studied in the literature, and connections have been found between them. In this work we show that all three applications can be reduced to finding appropriate OCRSs. In addition to proving new results, we believe that these reductions into one common setting clarify the connections between the three applications. 5A set function f : 2N → R is submodular if f (A) + f (B) ≥ f (A ∪ B) + f (A ∩ B) for every two sets A, B ⊆ N. 6A set function f : 2N → R is monotone if f (A) ≤ f (B) for every two sets A ⊆ B ⊆ N. 7A polytope is solvable if one can optimize linear functions over it. 5 Prophet inequalities for Bayesian online selection problems Consider again the Bayesian online selection problem we sketched earlier in the introduction. We recall that the setting in this problem consists of a matroid M = (N, F) and independent non-negative ran- dom variables Ze for every e ∈ N with known distributions. Moreover, the random variables Ze satisfy maxe∈N E[Ze] < ∞. An offline adversary chooses upfront the order in which the elements e ∈ N reveal a realization ze of Ze. The task is to select online an independent set of elements I ∈ F with total weight z(I) =Pe∈I ze as high as possible. A fundamental result about the relative power of offline and online algorithms in a Bayesian setting was obtained by Krengel, Sucheston and Garling (see [19]) for the special case when M is the uniform matroid of rank one, i.e., precisely one element can be selected. They showed that there exists a selection algorithm returning a single element of expected weight as least 1 2 E[maxe∈N Ze], i.e., half of the weight of the best offline solution, which is the best solution obtainable by an algorithm that knows all realizations upfront. Recently, Kleinberg and Weinberg [18] extended this result considerably by showing that the same guarantee can be obtained when selecting multiple elements that have to be independent in the matroid M, i.e., there exists an online algorithm returning a set I ∈ F satisfying E"Xe∈I Ze# ≥ 1 2 E"max(Xe∈S S ∈ F)# . (1) Ze (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Inequalities of type (1) are often called prophet inequalities due to the interpretation of the offline adversary as a prophet. Moreover, Kleinberg and Weinberg generalized their result to the setting where F are the common independent sets in the intersection of p matroids. For this setting, they present an online algorithm 1 4p−2 times the expected maximum weight of a feasible set. Kleinberg and whose expected profit is at least Weinberg’s algorithms work not just against an offline adversary, which is the adversary type typically assumed in Bayesian online selection, but also against an online adversary. Using a simple, yet very general link between greedy OCRSs and prophet inequalities we can generate prophet inequalities from greedy OCRSs. Theorem 1.12. Let F ⊆ 2N be a down-closed set family and P be a relaxation of F. If there exists a c-selectable greedy OCRS for P then there is an online algorithm for the Bayesian online selection problem with almighty adversary that returns a set I ∈ F satisfying E"Xe∈I Ze# ≥ c · E"max(Xe∈S S ∈ F)# . Ze (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) As we discuss in Section 4, the above theorem can be made constructive in many cases, assuming that the OCRS is efficient and some natural optimization problems involving the distributions of the random weights Ze can be solved efficiently. Our results show that constant-factor prophet inequalities are often possible even against an almighty adversary. Moreover, we get Θ(1)-factor prophet inequalities for a wide set of new constraint families. Corollary 1.13. There are Θ(1)-factor prophet inequalities for the Bayesian online selection problem against the almighty adversary for any constraint family that is an intersection of a constant number of matroid, knapsack, and matching constraints. In contrast, so far, the most general prophet inequality was the 1 4p−2-factor prophet inequality of Klein- berg and Weinberg for the intersection of p matroids. Interestingly, even for this specific setting of the intersection of p matroids, considered by Kleinberg and Weinberg, our general approach allows for obtain- ing a better constant for p ≥ 4 (against a stronger adversary). 6 Corollary 1.14. There is an against the almighty adversary when the feasible sets are described by the intersection of p matroids. e(p+1)-factor prophet inequality for the Bayesian online selection problem 1 That our results hold against an almighty adversary is in particular of importance for applications of prophet inequalities to posted pricing mechanisms. Indeed, one of the main technical difficulties that Klein- berg and Weinberg [18] had to overcome to apply their results to posted pricing mechanism, was the fact that their results were only with respect to an online adversary. Oblivious posted pricing mechanisms We start by introducing the Bayesian single-parameter mechanism design setting (short BSMD), largely following [8]. There is a single seller providing a set N of services, and for each service e ∈ N there is one agent interested in e, whose valuation is drawn from a nonnegative random variable Ze. The Ze are independent and have known distributions. Furthermore, there is a down-closed family F ⊆ 2N representing feasibility constraints faced by the seller, i.e., the seller can provide any set of services S ∈ F. The setting is called single-parameter because every agent is interested in precisely one service. The goal in this setting is to find truthful mechanisms maximizing the expected revenue. From a theoretical point of view, this setting is well understood and optimally solved by Myersons’s mechanism [22]. Unfortunately, the resulting mechanism is impractical, and thus, rarely employed. Fur- thermore, it does not extend to multi-parameter settings where an agent may, for example, be interested in buying one out of several items, a setting known as Bayesian multi-parameter unit-demand mechanism de- sign (BMUMD). Therefore, Chawla et al. [8] suggested considerably simpler and more robust alternatives having many advantages while maintaining an almost optimal performance [8, 24, 18]. The idea is to offer to the agents sequentially take-it-or-leave-it prices as follows. Agents are considered one by one, in an order chosen by the algorithm. Whenever an agent e ∈ N is considered, the algorithm either makes no offer to e—and thus e does not get served—or, if e can be added to the elements selected so far without violating feasibility, an offer pe ∈ R≥0 is made to e. Agent e will then accept the offer if Ze ≥ pe and decline if Ze < pe. This type of mechanism, with the additional freedom that the algorithm can choose the order in which to consider the agents, is called a sequential posted price mechanism. A natural stronger version of sequen- tial posted price mechanisms, called constrained oblivious posted price mechanisms (COPM), suggested by Chawla et al. [8], allows for dealing with the multi-parameter setting BMUMD, and has many further inter- ≥0, F ′), where p are the take-it-or-leave-it esting properties. Formally, a COPM is defined by a tuple (p ∈ RE prices, and F ′ ⊆ F. A COPM defined by (p, F ′) works as follows. Consider the moment when a new agent e arrives and let S be the set of agents served so far. If S ∪ {e} 6∈ F ′, then e is skipped; otherwise, e is of- fered the price pe. In short the COPM maintains a feasible set in the more restricted family F ′, and greedily selects any agent e that does not destroy feasibility in F ′ and has a valuation of at least pe. Furthermore, the order of the agents is chosen by an adversary at the beginning of the procedure, knowing all valuations ze, the prices pe and the family F ′. A COPM can also be randomized, in which case the tuple (p, F ′) is chosen at random at the beginning of the algorithm. So far, COPMs with an O(1) gap with respect to the optimal mechanism were only known for very restricted types of matroids, and the intersection of two partition matroids [8]. For general matroids, the best previously known COPM was a non-efficient procedure with an optimality gap of O(log(rank)), where rank is the size of a largest feasible set of the matroid [8]. In particular, the existence of an COPM for general matroids with constant optimality gap remained an open problem. Exploiting a link between greedy OCRSs and COPMs, we resolve the open question about O(1)-optimal COPMs for matroids raised in [8], and show that even much more general constraint families admit O(1)- optimal COPMs. 7 Theorem 1.15. Let F ⊆ 2N be a down-closed family and P be a relaxation of F. If there is a c-selectable greedy OCRS for P , then there is a COPM for F that, even against an almighty adversary, is at most a factor of c worse than the optimal truthful mechanism. Using the reduction from the multi-parameter setting to the single-parameter setting presented in [8] we obtain results for BMUMD under very general feasibility constraints. Corollary 1.16. Let F be the intersection of a constant number of matroid, knapsack, and matching con- straints. Then there is a posted price mechanism for BMUMD on F whose optimality gap with respect to the optimal truthful mechanism is at most a constant. Moreover, as we highlight in Section 4, the mechanisms obtained through our greedy OCRSs can be implemented efficiently under mild assumptions. Stochastic probing Recently, Gupta and Nagarajan [17] introduced the following stochastic probing model. Given is a finite ground set N and each element e ∈ N is active with a given probability pe ∈ [0, 1], independently of the other elements. Furthermore, there is a weight function w : N → Z, and two down-closed constraint families Fin, Fout ⊆ 2N on N, which are called the inner and outer constraints, respectively. The goal is to select a subset of active elements of high weight according to the following rules. An algorithm must first probe an element e ∈ N to select it. If a probed element e is active, then e is selected, otherwise it is not. The algorithm can choose the order in which elements are probed. The set Q of all probed elements must satisfy Q ∈ Fout and the set S ⊆ Q of all selected elements must satisfy S ∈ Fin. Hence, at any step of the algorithm an element can only be probed if adding it to the currently probed elements does not violate Fout, and adding it to the elements selected so far does not violate Fin. Gupta and Nagarajan [17] showed that this model captures numerous applications. Furthermore, they show how so-called ordered CRSs can be used to get approximately optimal approximation factors for many constraint families including the intersection of a constant number of matroids. However, due to their use of ordered CRSs, the presented algorithms crucially rely on the fact that the order in which elements are probed can be chosen freely. Replacing their use of ordered CRSs with OCRSs we can drop this requirement. Theorem 1.17. Let Fin, Fout ⊆ 2N be two down-closed families. If there are a (b, cin)-selectable greedy OCRS πin for a relaxation Pin of Fin and a (b, cout)-selectable greedy OCRS πout for a relaxation Pout of Fout, then there is a (b · cin · cout)-approximation for the weighted stochastic probing problem where the order in which elements can be probed is chosen by an almighty adversary and the inner and outer constraints are given by Fin and Fout, respectively.8 Moreover, if πin and πout are efficient and there are separation oracles for Pin and Pout, then the above algorithm has a polynomial time complexity. It turns out that the extension to arbitrary probing orders resolves an open question of [17] about stochas- tic probing with deadline. In a probing problem with deadlines there is a deadline de ∈ Z≥1 for each element e ∈ N, indicating that e can only be probed as one of the first de elements that get probed. Using a clever technique, Gupta and Nagarajan [17] presented an O(1)-approximation for this problem setting for the un- weighted case, i.e., w is the all-ones vector, when Fin, Fout are k-systems9, for k = O(1). They left it as an open question how to approach the weighted version of stochastic probing with deadlines. Using OCRSs 8Similar to [17] one can strengthen the theorem, and only assume an offline CRS for Fout and an OCRS for Fin. The fact that an offline CRS suffices for Fout can sometimes be used to get better approximation factors. For simplicity of presentation, we do not go into these details here, and also in Theorem 1.18 and 1.19. 9A k-system F ⊆ 2N is a down-closed family such that, for any S ⊆ N, the ratio of the sizes of any two maximal sets of F that are contained in S is at most k. In particular, k-systems generalize the intersection of k matroids. 8 we can leverage Theorem 1.17 to consider elements in increasing order of their deadlines, which allows for addressing this open question. Theorem 1.18. Let Fin, Fout ⊆ 2N be two down-closed families. If there are a (b, cin)-selectable greedy OCRS πin for a relaxation Pin of Fin and a (b, cout)-selectable greedy OCRS πout for a relaxation Pout of Fout, then there is a (b(1 − b) · cin · cout)-approximation for the weighted stochastic probing with deadlines problem where the inner and outer constraints are given by Fin and Fout, respectively. Moreover, if πin and πout are efficient and there are separation oracles for Pin and Pout, then the above algorithm has a polynomial time complexity. We highlight that the stochastic probing problem with monotone submodular objectives but without deadlines—in short, submodular stochastic probing—was considered by Adamczyk et al. [1], who presented for this setting a (1 − 1/e)/(kin + kout + 1)-approximation when Fin and Fout are the intersection of kin and kout matroids, respectively. Using our techniques we obtain O(1)-approximations for considerably more general settings of submodular stochastic probing. More precisely, we can handle a very broad set of constraints, with a probing order chosen by an almighty adversary (instead of being choosable by the algorithm). Theorem 1.19. Let Fin, Fout ⊆ 2N be two down-closed families. If there are a (b, cin)-selectable greedy OCRS πin for a relaxation Pin of Fin and a (b, cout)-selectable greedy OCRS πout for a relaxation Pout of Fout, then there is a ((1 − e−b − o(1)) · cin · cout)-approximation for the submodular stochastic probing problem where the order in which elements can be probed is chosen by an almighty adversary and the inner and outer constraints are given by Fin and Fout, respectively. Moreover, if πin and πout are efficient and there are separation oracles for Pin and Pout, then the above algorithm has a polynomial time complexity. We remark that the same idea used to derive Theorem 1.18 from Theorem 1.17 can also be used to derive from Theorem 1.19 a result for the submodular stochastic probing with deadlines problem. 2 Constructing Online Contention Resolution Schemes In this section we prove the existence (or non-existence) of OCRSs for various polytopes. Sections 2.1, 2.2 and 2.3 study OCRSs for matroid polytopes, matching polytopes and the natural relaxation of knapsack constraints, respectively. The results proved in these sections prove together Theorem 1.8. Theorem 1.9, which shows that greedy OCRSs for different polytopes can be combined to create greedy OCRSs for the intersection of these polytopes, is proved in Section 2.4. 2.1 OCRS for matroids In this section we give a greedy OCRS for matroid polytopes. For standard matroidal concepts such as span, rank, contraction and restriction, we refer the reader to Appendix A. Also recall that, for a given matroid M = (N, F), the matroid polytope PF is defined by {x ∈ RN main result of this section can be stated as follows. ≥0 ∀S ⊆ N Pe∈S xe ≤ rank(S)}. The Theorem 2.1. Let b ∈ [0, 1]. There exists a (b, 1 − b)-selectable deterministic greedy OCRS for any matroid polytope PF ⊆ [0, 1]N on ground set N . Combining Theorem 1.9 with Theorem 2.1, we also get a greedy OCRS for the intersection of k ma- troids. Corollary 2.2. Let b ∈ [0, 1], and let P1, . . . , Pk ⊆ [0, 1]N be k matroid polytopes over a common ground set N . Then there exists a (b, (1 − b)k)-selectable deterministic greedy OCRS for P = ∩k i=1Pi. 9 Note that the above corollary implies (by Observation 1.6) that there is a b(1 − b)k-selectable greedy OCRS for P . Moreover, choosing b = 1 1+k in Corollary 2.2, we obtain the following. Corollary 2.3. Let P1, . . . , Pk ⊆ [0, 1]N be matroid polytopes over a common ground set N , let P = i=1Pi, and let c = 1 ∩k e(k+1). Then there exists a c-selectable greedy OCRS for P . k+1 (1 − 1 1+k )k ≥ 1 The rest of this section is devoted to the proof of Theorem 2.1. Consider a matroid M = (N, F) and let PF be the associated polytope. Our greedy OCRS is based on using x ∈ PF to find a chain decomposition of the elements ∅ = Nℓ ( Nℓ−1 ( · · · ( N1 ( N0 = N . It then accepts an active element e ∈ Ni \ Ni+1 if e together with the already accepted elements in Ni \ Ni+1 forms an independent set in the matroid (M/Ni+1)Ni, i.e., the matroid obtained from M by contracting Ni+1 and then restricting to Ni. To see that this OCRS is a greedy OCRS, note that the above algorithm is equivalent to defining the family Fx = {I ⊆ N : ∀i I ∩ (Ni \ Ni+1) is independent in (M/Ni+1)Ni}. The family Fx is clearly a down-closed family of sets (since each (M/Ni+1)Ni is a matroid and its independent sets are, thus, down-closed). Moreover, Fx is a subset of feasible sets because (see, e.g., Theorem 5.1 in [23]) if Ii is an independent set of (M/Ni+1)Ni for every i, then the set ∪iIi is independent in M. Even though we do not need this fact, we highlight that Fx itself describes a family of independent sets of a matroid. This follows from the fact that Fx is the family of all (disjoint) unions of independent sets in the matroids (M/Ni+1)Ni for i ∈ {0, . . . , ℓ − 1}, implying that Fx are the independent sets of the union matroid obtained by taking the union of all matroids (M/Ni+1)Ni for i ∈ {0, . . . , ℓ − 1}. Having shown that the above algorithm is a greedy OCRS for any chain decomposition of the elements, we turn our attention to the task of defining a chain that maximizes the selectability of our greedy OCRS. For a fixed chain, we have that the selectability of an element e ∈ Ni \ Ni+1 is Pr[I ∪ {e} ∈ Fx ∀ I ⊆ R(x), I ∈ Fx] = Pr[e 6∈ spani ((R(x) ∩ (Ni \ Ni+1)) \ {e})] , where spani(·) denotes the span function of matroid (M/Ni+1)Ni. Our objective is therefore to construct a chain decomposition that maximizes Pr[e 6∈ spani ((R(x) ∩ (Ni \ Ni+1)) \ {e})] or equivalently mini- mizes Pr[e ∈ spani ((R(x) ∩ (Ni \ Ni+1)) \ {e})] . (2) We now describe an iterative procedure for constructing a chain decomposition so that (2) is at most b for each element. Initially, the chain only consists of the ground set N0 = N. We need to refine the chain if there exists an element e ∈ N such that Pr[e ∈ span(R(x) \ {e})] > b. We do that in a “minimal” way as follows: • Let S = ∅. • While there exists e ∈ N0 \ S such that Pr[e ∈ span ((R(x) ∪ S) \ {e})] > b, add e to S. We then let N1 = S. Note that if N1 is a strict subset of N0 then we have made progress and we repeat the above procedure (on the matroid induced by N1) to obtain N2 ( N1, and so on, until we obtain Nℓ = ∅. Thus, if we assume that the procedure terminates, then, by construction, the chain satisfies Pr[spani ((R(x) ∩ (Ni \ Ni+1)) \ {e})] ≤ b for all i and e ∈ Ni \ Ni+1 . The rest of this section is devoted to show that the chain construction always terminates. As described above, this implies a (b, 1 − b)-selectable greedy OCRS, and thus proves Theorem 2.1. 10 2.1.1 Proof of termination of chain construction To prove that the chain decomposition terminates, it is sufficient to show that N1 = S ( N0 = N for any (non-empty) matroid as the chain decomposition then recurses on the matroid induced by N1 (so the same argument implies that N2 ( N1 assuming N1 6= ∅, and so on). Notice that the definition of S implies that S can only increase as coordinates of x are increased. Hence, it is safe to assume that x ∈ b · PB, where PB = {x ∈ PF x(N ) = rank(N )} is the base polytope of the matroid M, which is the set of all maximal vectors in PF . For proofs in the rest of the section it will be convenient to have the following equivalent view of the construction of S = N1 in the refinement procedure. • Let S0 = ∅, and let S1 = {e ∈ N Pr[e ∈ span (R(x) \ {e})] > b} be the set of elements that are “likely” to be spanned. • Assuming we have defined S0, S1, . . . , Si−1, let Si = {e ∈ N Pr[e ∈ span ((R(x) ∪ Si−1) \ {e})] > b} , that is, Si contains those elements that are likely to be spanned assuming that the elements of Si−1 are contracted (or equivalently appear with probability 1). Notice that Si−1 ⊆ Si for every i ≥ 1, and Si = Si−1 implies Si = Sj for every j > i. Thus, we must have N1 = S = SN . The key technical part of the termination analysis is the following lemma. Lemma 2.4. It always holds that: xe Pr[e ∈ span (R(x) ∪ S)] ≤ b · (x(N ) + (1 − b) rank(S)) . Xe∈N Moreover, the inequality is strict if S 6= ∅. Before proving the lemma, let us see that it implies what we want: Corollary 2.5. If N 6= ∅ then N1 = S ( N . Proof. The corollary is clearly true if S = ∅. Otherwise, by Lemma 2.4, x(S) ≤ x(span (R(x) ∪ S)) = Xe∈N < b(x(N ) + (1 − b) rank(S)) ≤ b rank(N ) . xe Pr[e ∈ span (R(x) ∪ S)] As x(S) < b · rank(N ) and x(N ) = b · rank(N ) by our assumption that x ∈ bPB, we get x(S) < x(N ), which implies N \ S 6= ∅. Let us now continue with the proof of the our technical lemma. Proof of Lemma 2.4. Let S′ = {e1, e2, . . . , ek} be a basis of the matroid M S obtained by first greedily selecting elements from S0, then greedily adding elements from S1, and so on. Consider the distribution µ over 2N defined according to the following sampling procedure: 1. Let A be a random set originally distributed like R(x). 2. For j = 1, 2, . . . , k, if ej 6∈ span(A), add ej to A. 3. Output A. 11 Observe that this sampling procedure guarantees that the distributions of span(S ∪ R(x)), span(S′ ∪ R(x)) and span(A) are identical. Therefore, Pr[e ∈ span (R(x) ∪ S)] = PrA∼µ[e ∈ span(A)] . Now simple calculations yield Pe∈N xePrA∼µ[e ∈ span(A)] = EA∼µ[x(span(A))] ≤ b · EA∼µ[rank(span(A))] = b · EA∼µ[rank(A)] ≤ b · EA∼µ[A] . (using x ∈ b · PI) We complete the proof by showing that EA∼µ[A] ≤ x(N ) + (1 − b) rank(S). To see this, note that k EA∼µ[A] = x(N ) + Pr[ej 6∈ span(R(x) ∪ {e1, . . . , ej−1})] Xj=1 ≤ x(N ) + (1 − b)k = x(N ) + (1 − b) · rank(S) , where the inequality follows from the following argument. If we let i be the smallest index so that ej ∈ Si, then by the construction of S′ we have Pr[ej ∈ span(R(x) ∪ {e1, . . . , ej−1})] ≥ Pr[ej ∈ span(R(x) ∪ Si−1)] > b. Finally, we remark that the strict inequality Pr[ej ∈ span(R(x) ∪ Si−1)] > b implies that the inequality in the statement is strict if S 6= ∅. Efficient implementation The only step that is not constructive in the description of our OCRS for matroids is the computation of probabilities of the type Pr[e ∈ span((R(x) ∪ Si−1) \ {e})]. One can easily get around this issue by using good estimates through Monte-Carlo sampling, leading to the following. Lemma 2.6. For any ǫ > 0 and α > 0, there is a randomized construction of a chain ∅ = Nℓ ( Nℓ−1 ( . . . ( N1 ( N0 = N such that with probability at least 1 − N −α the greedy OCRS defined by the chain is (b, 1 − b − ǫ)-selectable. Furthermore, the time needed for this construction is O(α · 1 ǫ2 · poly(N ) · T ), where T is the time for a single call to the independence oracle of the matroid, and we assume that we can sample a Bernoulli random variable in O(1) time. Proof. For simplicity we define pe,S = Pr[e ∈ span((R(x) ∪ S) \ {e})] for e ∈ N and S ⊆ N. As before, we focus on the construction of N1; the algorithm is then applied recursively. We recall that in the above- mentioned construction we set N1 = S, where S was constructed from S = ∅ by adding elements e ∈ N satisfying pe,S > b. To perform this step constructively we will, whenever we need a probability pe,S, use an estimate pe,S obtained through Monte-Carlo sampling. By standard results on Monte-Carlo sampling (see, e.g., [11]) it suffices to use O(α · 1 ǫ2 · log N ) many samples to obtain a value pe,S such that Pr [pe,S ∈ [pe,S − ǫ, pe,S]] ≥ 1 − N −3−α . Hence, to construct S, we start with S = ∅ and successively add elements e ∈ N \ S with pe,S > b. There are at most N elements we add to S, and to add one element to S we may have to check the values pe,S of all elements in N \ S. Hence, to construct S we use at most O(N 2) estimates of the type pe,S. At the end of this procedure we set N1 = S and repeat. Since there are at most O(N ) sets in the final chain ∅ = Nℓ ( . . . ( N0 = N, the total number of estimates we need is bounded by O(N 3), which implies the claimed running time of our algorithm. Moreover, with probability at least 1 − N −α, all our estimates 12 pe,S satisfy pe,S ∈ [pe,S − ǫ, pe,S]. To prove the lemma, we assume from now on that all our estimates fulfil this property and show that this implies that the OCRS we obtain is (b, 1 − b − ǫ)-selectable. Notice that during our construction of S we only add elements e to S satisfying b < pe,S ≤ pe,S. Hence, the elements we add would also have been added to S in the construction that uses the true probabilities pe,S. Therefore, for the same reasons showing that S ( N when using the true probabilities pe,S, we also have S ( N. It remains to observe that at the end of the construction of S, i.e., when we set N1 = S, the probability 1 − pe,S = Pr[e 6∈ span((S ∪ R(x)) \ {e})] of an element e ∈ N \ S being selectable is at least 1 − b − ǫ. This indeed holds since 1 − pe,S ≥ 1 − pe,S − ǫ ≥ 1 − b − ǫ . 2.2 OCRSs for matchings in general graphs In this section we describe an OCRS that works for a relaxation PG of matching in a general graph G = (V, E). Specifically, the relaxation polytope PG is defined as: Pg∈δ(u) xg ≤ 1 ∀ u ∈ V ≥ 0 ∀ g ∈ E , xg where δ(u) is the set of edges incident to the node u. Observe that this relaxation is weaker than the matching polytope, hence, our results hold also for the matching polytope. We would like to stress that the ground set in this section is the set of edges, and thus, unlike in the rest of the paper, we denote it by E. Some ideas from the proof of Theorem 2.7 can be traced to offline CRSs given by [14].10 Theorem 2.7. For every b ∈ [0, 1], there exists a (b, e−2b)-selectable randomized greedy OCRS for the relaxation PG ⊆ [0, 1]E of matching in a graph G = (V, E). Proof. Let x ∈ bPG be the input point to the OCRS, and let A ∼ R(x) be the set of active elements. Our OCRS begins by selecting a subset K of potential edges, where every edge g ∈ E belongs to K with probability (1 − e−xg )/xg, independently (observe that this probability in indeed always within the range [0, 1]). Whenever an edge g reveals whether it is active, the OCRS selects it if g ∈ A ∩ K and the addition of g to the set of already selected edges does not make this set an illegal matching. Observe that for any fixed choice of K this OCRS is a deterministic greedy OCRS, and thus, for a random K it is a randomized greedy OCRS. Next, let us show that our OCRS is (b, e−2b)-selectable. Consider an arbitrary edge g′ = uv ∈ E. We need to prove that with probability at least e−2b the edge g′ is in K, and can be added to any matching which is a subset of A ∩ K. Formally, we need to prove: Pr[g′ ∈ K, A ∩ K ∩ (δ(u) ∪ δ(v) \ {g′}) = ∅] ≥ e−2b . Clearly, every edge g ∈ E belongs to A ∩ K with probability xg · (1 − e−xg )/xg = 1 − e−xg. Since the membership of every edge in K and A is independent from the membership of other edges in these sets, we get: Pr[g′ ∈ K, A ∩ K ∩ (δ(u) ∪ δ(v) \ {g′}) = ∅] = Pr[g′ ∈ K] · Yg∈δ(u)∪δ(v)\{g′ } Pr[g 6∈ A ∩ K] e−xg = Yg∈δ(u)∪δ(v)\{g′ } (1 − e−xg′ ) xg′ · e− Pg∈δ(u)∪δ(v)\{g′} xg = ≥ (1 − e−xg′ ) xg′ · (1 − e−xg′ ) xg′ · e−2(b−xg′ ) = · e−2b ≥ e−2b , exg′ (exg′ − 1) xg′ 10The details of these CRSs are omitted in [14], but can be found in [13]. 13 where the first inequality holds since the membership of x in bPG guarantees that the total x-values of the edges in δ(u) \ {g′} (or δ(v) \ {g′}) is at most b − xg′. Remark: If one is interested in a deterministic greedy OCRS, it is possible to set K equal to E determin- istically in the greedy OCRS described by the last proof. A simple modification of the proof shows that the resulting deterministic greedy OCRS is (b, (1 − b)2)-selectable. 2.3 OCRSs for knapsack constraint In this section we consider the problem of defining an OCRS for a polytope P ⊆ [0, 1]N defined by a single knapsack constraint. That is, each element e ∈ N has an associated size se ∈ [0, 1] and P is defined by Pe∈N sexe ≤ 1 xe ∈ [0, 1] for e ∈ N . We begin with an interesting simple observation. Proposition 2.8. For every n ≥ 1, there exists a knapsack constraint over a ground set of n elements such that no deterministic greedy OCRS for the polytope defined by this constraint is (b, c)-selectable for any pair of b ∈ [0, 1] and c > (1 − b)n−1. Proof. Consider the knapsack constraint defined by the ground set N = {1, 2, . . . , n} and sizes s1 = s2 = · · · = sn−1 = 1/n, sn = 1. Assume towards a contradiction that there exists a deterministic greedy OCRS that is (b, c)-selectable for some b ∈ [0, 1] and c > (1 − b)n−1, and consider the family Fx of feasible sets used by this OCRS for the possible input x1 = x2 = · · · = xn−1 = b, xn = b/n. Since the OCRS is (b, c)-selectable for c > 0, each element e ∈ N must be included in at least one set of the family Fx. Thus, by the down-monotonicity of Fx it must contain the set {e} for every e ∈ N. On the other hand, for every e ∈ N \ {n} we have {e, n} 6∈ F, and thus, also {e, n} 6∈ Fx. Combining all these observations, we get: Pr[I ∪ {n} ∈ Fx ∀ I ⊆ R(x), I ∈ Fx] ≤ Pr[e 6∈ R(x) ∀ e ∈ N \ {n}] = (1 − b)n−1 < c , which contradicts the (b, c)-selectability of the assumed OCRS. The next theorem shows that randomized greedy OCRSs can do much better. Some of the ideas used by this theorem can be traced back to an offline CRS presented by [10] for knapsack constraints. Theorem 2.9. For every b ∈ [0, 1/2], there exists a(cid:16)b, 1−2b polytope P defined by a knapsack constraint. 2−2b(cid:17)-selectable randomized greedy OCRS for any Proof. Let x ∈ bP be the input point to the OCRS, and let Nbig = {e ∈ N se > 1/2} be the subset of elements that are big. We use bbig to denote the total part of the knapsack occupied by big elements in the fractional solution x. Formally, bbig = Xe∈Nbig sexe . Observe that bbig is always within the range [0, b]. The randomized greedy OCRS we use is defined as follows. With probability pbig accept greedily the elements of Nbig while respecting the knapsack inequality, where pbig is the probability pbig = 1 − 2b + 2bbig 2 − 2b . 14 With the remaining probability accept greedily the small elements of N \Nbig while respecting the knapsack inequality. It is easy to see that this OCRS is indeed a randomized greedy OCRS. We continue to analyze the selectability of the above OCRS. Observe that for any big element e′ ∈ Nbig: Pr[I ∪ {e′} ∈ Fx ∀ I ⊆ R(x), I ∈ Fx] ≥ Prh{e′} ∈ Fx,Pe∈R(x)∩Nbig se ≤ 1 − se′i . The event {e′} ∈ Fx is simply the event that the OCRS decides to accept big elements. Given that this event se ≤ 1 − se′ guarantees that for every subset I of R(x) ∩ Nbig one can (3) add the element e′ without violating the knapsack constraint. We can lower bound (3) as follows. occurs, the conditionPe∈R(x)∩Nbig Prh{e′} ∈ Fx,Pe∈R(x)∩Nbig 1 − 2b + 2bbig se ≤ 1 − se′i = pbig · Pr[R(x) ∩ (Nbig \ {e′}) = ∅] 1 − 2b + 2bbig · (1 − x(Nbig)) ≥ · (1 − 2bbig) ≥ 1 − 2b 2 − 2b , ≥ 2 − 2b 2 − 2b where the first inequality follows from the union bound and the second inequality uses the fact that se > 1/2 for every e ∈ Nbig. Similarly, for an element e 6∈ Nbig we have: Pr[I ∪ {e′} ∈ Fx ∀ I ⊆ R(x), I ∈ Fx] ≥ Prh{e′} ∈ Fx,Pe∈R(x)\Nbig ≥ (1 − pbig) · Pr[s(R(x) \ (Nbig ∪ {e′})) ≤ 1/2] ≥(cid:18)1 − 1 − 2b + 2bbig se ≤ 1 − se′i 1/2 (cid:19) (cid:19) ·(cid:18)1 − b − bbig 2 − 2b = 1 − 2bbig 2 − 2b · (1 − 2b + 2bbig) ≥ 1 − 2b 2 − 2b , where the third inequality follows from Markov’s inequality. 2.4 Combining constraints Like offline CRSs (see [10]), greedy OCRSs can be combined to form greedy OCRSs for more involved constraints. Definition 2.10. Given two greedy OCRSs π1 and π2 for polytopes P1 and P2, the combination of π1 and π2 is a greedy OCRS π for the polytope P = P1 ∩ P2. For every input x ∈ P , π is defined by the down-closed family Fπ,x = Fπ1,x ∩ Fπ2,x. Theorem 1.9 is an immediate implication of the next lemma. Lemma 2.11. Let π1 and π2 be (b, c1)-selectable and (b, c2)-selectable greedy OCRSs, respectively. The combination of π1 and π2 is (b, c1 · c2)-selectable. Proof. Let P1 and P2 be the polytopes of π1 and π2, respectively. Additionally, let x ∈ b(P1 ∩ P2), and let e be an arbitrary element of N. We need to prove that: Pr[I ∪ {e} ∈ Fπ1,x ∩ Fπ2,x ∀ I ⊆ R(x), I ∈ Fπ1,x ∩ Fπ2,x] ≥ c1 · c2 . For ease of notation, let us denote by χe(A, F, F ′) an indicator for the event that I ∪ {e} ∈ F for ev- ery set I ⊆ A obeying I ∈ F ′. Using this notation, the inequality that we need to prove becomes: Pr[χe(R(x), Fπ1,x ∩ Fπ2,x, Fπ1,x ∩ Fπ2,x)] ≥ c1 · c2. On the other hand, observe that x ∈ b(P1 ∩ P2) ⊆ bP1. Hence, the (b, c1)-selectability of π1 implies that: Pr[χe(R(x), Fπ1,x, Fπ1,x ∩ Fπ2,x)] ≥ Pr[χe(R(x), Fπ1,x, Fπ1,x)] = Pr[I ∪ {e} ∈ Fπ1,x ∀ I ⊆ R(x), I ∈ Fπ1,x] ≥ c1 . 15 where the first inequality follows since χe is a non-increasing function of its third argument (when the other two arguments are fixed). Similarly, we also get: Pr[χe(R(x), Fπ2,x, Fπ1,x ∩ Fπ2,x)] ≥ c2. Next, observe that χe is also non-increasing in its first argument (when the other two arguments are fixed). Hence, if we let R be a random set distributed like R(x), then, by the FKG inequality: Pr[χe(R(x), Fπ1,x ∩ Fπ2,x, Fπ1,x ∩ Fπ2,x)] = Pr[χe(R, Fπ1,x, Fπ1,x ∩ Fπ2,x) · χe(R, Fπ2,x, Fπ1,x ∩ Fπ2,x)] ≥ Pr[χe(R(x), Fπ1,x, Fπ1,x ∩ Fπ2,x)] · Pr[χe(R(x), Fπ2,x, Fπ1,x ∩ Fπ2,x)] ≥ c1 · c2 . 3 From Selectability to Approximation In this section we prove Theorems 1.10 and 1.11 which study the relation between the value of a vector x and the the expected value of the output produced by an OCRS given this vector as input. Following is a restatement of Theorem 1.10. Unlike the original statement of the theorem, this restatement uses the notation S(p), where S is a set and p is a probability, to denote a random set containing every element e ∈ S with probability p, independently. Observe that S(p) has the same distribution as R(p · 1S). Theorem 1.10. Given a non-negative monotone submodular function f : 2N → R≥0 and a (b, c)-selectable greedy OCRS for a polytope P , applying the greedy OCRS to an input x ∈ bP results in a random set S satisfying E[f (S)] ≥ c·F (x), where F is the multilinear extension of f . Moreover, even if f is not monotone, E[f (S(1/2))] ≥ (c/4) · F (x), where the random decisions used to calculate S(1/2) are considered part of the algorithm, and thus, known to the almighty adversary. To prove Theorem 1.10 we need to define some concepts regarding offline CRSs. Recall that a CRS for a polytope P is a (possibly random) function π : 2N → 2N that depends on an input vector x ∈ P , and for every set S ⊆ N returns a subset π(S) ⊆ S that obeys the polytope P (i.e., 1 π(S) ∈ P ). Definition 3.1. A CRS π for a polytope P is: • (b, c)-balanced some for b, c ∈ [0, 1] if Pr[e ∈ π(R(x)) e ∈ R(x)] ≥ c · xe whenever the input vector x belongs to bP and xe > 0. • monotone if Pr[e ∈ π(S1)] ≥ Pr[e ∈ π(S2)] whenever e ∈ S1 ⊆ S2. We now define and analyze an interesting notion that allows us to connect the world of OCRSs with that of CRSs. Definition 3.2 (characteristic CRS). The characteristic CRS ¯π of a greedy OCRS π for a polytope P is a CRS for the same polytope P . It is defined for an input x ∈ P and a set A ⊆ N by ¯π(A) = {e ∈ A I ∪ {e} ∈ Fπ,x ∀I ⊆ A, I ∈ Fπ,x}. The following observation shows that ¯π(A) obeys the polytope P and ¯π(A) ⊆ A. Thus, the character- istic CRS ¯π is a true CRS for the polytope P . Observation 3.3. For every set A ⊆ N and a characteristic CRS ¯π of a greedy OCRS π, the set ¯π(A) is always a subset of the elements selected by π when the active elements are the elements of A. Proof. Fix an element e ∈ ¯π(A), and let T be the set of elements selected by the greedy OCRS π imme- diately before e reveals whether it is active. The definition of ¯π(A) guarantees that T ∪ {e} ∈ Fπ,x since T ∈ Fπ,x, and thus, e is accepted by π. 16 Lemma 3.4. The characteristic CRS ¯π of a (b, c)-selectable greedy OCRS π is (b, c)-balanced and mono- tone. Proof. Let P denote the polytope of the greedy OCRS π (and its characteristic CRS ¯π), and fix a vector x ∈ bP . Since π is (b, c)-selectable, we get for a set A distributed like R(x) and an arbitrary element e ∈ N: Pr[e ∈ ¯π(A) e ∈ A] = Pr[I ∪ {e} ∈ Fπ,x ∀ I ⊆ A, I ∈ Fπ,x e ∈ A] = Pr[I ∪ {e} ∈ Fπ,x ∀ I ⊆ A, I ∈ Fπ,x] ≥ c . The last inequality implies, by definition, that ¯π is a (b, c)-balanced CRS. Next, let us prove that ¯π is monotone. Fix an instantiation of Fπ,x, an element e ∈ N and two sets e ∈ A1 ⊆ A2 ⊆ N. If e ∈ ¯π(A2), then we know that I ∪ {e} ∈ Fπ,x for every I ⊆ A2, I ∈ Fπ,x. Thus, clearly, I ∪ {e} ∈ Fπ,x for every I ⊆ A1 ⊆ A2, I ∈ Fπ,x, which implies e ∈ ¯π(A1). In summary, we got that: and thus, even when we do not fix the instantiation of Fπ,x: e ∈ ¯π(A2) ⇒ e ∈ ¯π(A1) , Pr[e ∈ ¯π(A2)] ≤ Pr[e ∈ ¯π(A1)] , which completes the proof that ¯π is monotone. To continue the proof of Theorem 1.10 we need to state some known results. The following lemma follows from the work of [10] (mostly from Theorem 1.3 in that work). Lemma 3.5. For every given non-negative submodular function f : 2N → R≥0, there exists a function ηf : 2N → 2N that always returns a subset of its argument (i.e., ηf (S) ⊆ S for every S ⊆ N ) having the following property. For every monotone (b, c)-balanced CRS π for a polytope P and input vector x ∈ bP : where F (x) is the multilinear extension of f . E[f (ηf (π(R(x))))] ≥ c · F (x) , The following two known lemmata about submodular functions have been rephrased to make them fit our notation better. Lemma 3.6 (Lemma 2.2 of [12]). Let g : 2N → R be a submodular function, and let T be an arbitrary set T ⊆ N . For every random set Tp ⊆ T which contains every element of T with probability p (not necessarily independently): E[g(Tp)] ≥ (1 − p)g(∅) + p · g(T ) . Lemma 3.7 (Lemma 2.2 of [5]). Let g : 2N → R≥0 be a non-negative submodular function. For every random set Np ⊆ N which contains every element of N with probability at most p (not necessarily inde- pendently): We are now ready to prove Theorem 1.10. E[g(Np)] ≥ (1 − p)g(∅) . Proof of Theorem 1.10. Let ¯π be the characteristic CRS of the OCRS π we consider, and let A ∼ R(x) be the set of active elements. For notational convenience, let us also denote by S′ the set ηf (¯π(A)). Notice that S′ is a subset of the set S of accepted elements since ¯π(A) is a subset of S by Observation 3.3. Lemmata 3.4 and 3.5 imply together the inequality E[f (S′)] = E[f (ηf (¯π(A)))] ≥ c · F (x). To complete the proof of the 17 first part of the theorem, it is now enough to observe that by the monotonicity of f : E[f (S)] ≥ E[f (S′)] ≥ c · F (x). To prove the second part of the theorem, let us fix the set A and the family Fπ,x which, for brevity, we denote by Fx in the rest of the proof. Observe that the set S′ is deterministic once A and Fx are fixed, and let us denote this set by S′ A,Fx(1/2) containing every element of S′ with probability 1/2, independently, and then adding to it a random set ∆ ⊆ N \ S′ . By controlling the order in which elements reveal whether they are active, the adversary can make the distribution of ∆ depend on S′ A,Fx(1/2); however, ∆ is guaranteed to contain every element with probability at most 1/2 for every given choice of S′ . Hence, we can think of S(1/2) as obtained by first calculating a set S′ A,Fx(1/2). Using this observation we get: A,Fx A,Fx A,Fx E[f (S(1/2)) A, Fx] = E[f (S′(1/2) ∪ ∆) A, Fx] Pr[S′ A,Fx(1/2) = B A, Fx] · E[f (B ∪ ∆) S′ A,Fx(1/2) = B, A, Fx] Pr[S′ A,Fx(1/2) = B A, Fx] · E[f (B) A, Fx] 2 = E[f (S′(1/2)) A, Fx] 2 = XB⊆S′ ≥ XB⊆S′ A,Fx A,Fx E[f (S′) A, Fx] ≥ 4 , where the first inequality follows from Lemma 3.7 since the function hB(T ) = f (B ∪ T ) is non-negative and submodular for every set B ⊆ N, and the second inequality follows from Lemma 3.6. Taking an expectation over the possible values of the set A and the family Fx, we get: E[f (S(1/2))] = EA,Fx[E[f (S(1/2)) A, Fx]] ≥ EA,Fx(cid:20) E[f (S′) A, Fx] 4 (cid:21) = E[f (S′)] 4 ≥ (c/4) · F (x) . Notice that the result proved by Theorem 1.10 for non-monotone functions loses a factor of 4 in the guarantee. To avoid that, we also consider online adversaries. Unfortunately, we do not have an improved result for greedy OCRSs against online adversaries. Instead, we study the performance of a different family of ORCSs against such adversaries. Definition 3.8 (element-monotone OCRS). An element-monotone OCRS is an OCRS characterized by a down-closed family Fu ⊆ 2N \{e} for every element e ∈ N , where the families {Fe}e∈N can be either deterministic (a deterministic element-monotone OCRS) or taken from some joint distribution (a randomized element-monotone OCRS). Such an OCRS accepts an active element e if and only if A<e ∈ Fe, where A<e is the set of active elements that revealed that they are active before e does so. One can observe that all the results we prove for greedy OCRSs in this paper can be easily applied also to element-monotone OCRSs with the following modified definition of (b, c)-selectability. Definition 3.9 ((b, c)-selectability for element-monotone OCRSs). Let b, c ∈ [0, 1]. An element-monotone OCRS for P is (b, c)-selectable if for any x ∈ b · P we have Pr[R(x) \ {e} ∈ Fe] ≥ c ∀e ∈ N . Moreover, the greedy OCRSs we describe for specific polytopes can be converted into similar element- monotone OCRSs with the same (b, c)-selectability guarantee (in fact the greedy OCRS we describe for matroids is already an element-monotone OCRS without any modifications). Our objective in the rest of this section is to prove the next theorem. Notice that Theorem 1.11 is a special case of this theorem. 18 Theorem 3.10. Given an element-monotone (b, c)-selectable OCRS π and a non-negative submodular func- tion f : 2N → R≥0, there exists an OCRS π′ that for every input vector x ∈ bP and online adversary selects a random set S such that E[f (S))] ≥ c · F (x). To prove Theorem 3.10, we need some notation. Let σa denote an arbitrary fixed absolute order over the elements of N. Given element e ∈ N and a vector y ∈ [0, 1]N , let F (e y) denote the marginal contribution obtained by increasing the coordinate of e in y to 1. Formally, F (e y) = F (y ∨ 1{e}) − F (y). Finally, we say that x is non-reducible if F (e x ∧ 1 is the set of elements that appear before e in the order σa. a ) ≥ 0 for every element e ∈ N having xe > 0, where σ<e σ<e a Observation 3.11. If x is reducible, then there exists a non-reducible vector x′ ≤ x obeying F (x′) ≥ F (x). Proof. Consider the vector x′ obtained from x by the following process. Start with x′ ← x. Scan the elements in the order σa. For every element e, if F (e x′ ∧ 1 e to 0. Clearly this process ends up with a non-reducible vector x′. Moreover, every step of the process only increases the value of F (x′), and thus, this value ends up at least as large as its initial value F (x). To see why this is the case, e is reduced to 0 for some element e ∈ N, and let x1 and x2 be the consider a step in which the value of x′ vector x′ before and after the reduction. Then, a ) < 0, then reduce x′ σ<e F (x1) = f (∅) + Xe′∈N x1 e′ · F (e′ x1 ∧ 1 σ<e′ a ≤ f (∅) + Xe′∈N \{e} x1 e′ · F (e′ x2 ∧ 1 σ<e′ a ) ≤ f (∅) + Xe′∈N \{e} ) = F (x2) , x1 e′ · F (e′ x1 ∧ 1 σ<e′ a ) where the first inequality holds since F (e x1 ∧ 1 larity. σ<e a ) < 0, and the second inequality holds by submodu- Observation 3.11 shows that it is enough to prove Theorem 3.10 for non-reducible x. If x is reducible, the OCRS π′ can calculate a non-reducible x′ having F (x′) ≥ F (x), and then “pretend” that some active elements are in fact inactive in a way that makes every element e active with probability x′ e, independently. Determining x′ requires exponential time, but even if one wants a polynomial time OCRS π′ it is possible to use sampling to get, for every constant d > 0, a non-reducible vector x′ having F (x′) ≥ F (x) − N −d · max{f ({e}) xe > 0}. The OCRS π′ we use in the proof of Theorem 3.10 works as follows: whenever π′ learns that an element N \{e}), and then checks whether the e is active it complements the set A<e to have the distribution R(x ∧ 1 resulting random set is in Fe. More formally, let σ be the order in which the elements reveal whether they are active, and let σ>e be the set of elements that appears after e in the order σ. Then, when e reveals that it is active, the OCRS π′ decides to accept it if A<e ∪ R(x ∧ 1σ>e ) ∈ Fe (for a random realization of the random set R(x ∧ 1σ>e ). Observation 3.12. The OCRS π′ always selects a set S ∈ F. Proof. Fix the set A of active elements, the families {Fe}e∈N and the order σ in which elements reveal whether they are active. We prove that the observation holds for any possible choice for these fixed values. Let S′ be the set of elements selected by π. The fact that π′ selects some element e ∈ N (i.e., e ∈ S) means that (S ∩ σ<e) ∪ R(x ∧ 1σ>e) ∈ Fe for some realization of the random set R(x ∧ 1σ>e). Hence, S ∩ σ<e ∈ Fe, which implies that π also selects e (i.e., e ∈ S′). This argument implies that S ⊆ S′. The observation now follows by the down-monotonicity of F since π always returns a set in F. Next, we need to prove the following technical lemma. 19 Lemma 3.13. Let X1, X2 be two random sets that never contain elements e, e′ ∈ N . Additionally, let Y1 and Y2 be two random sets distributed like R(x ∧ 1{e′}) which are independent from each other and from X1, X2 and Fe. Then, assuming Pr[X2 ∈ Fe] > 0, E[f (e X1 ∪ Y1) X2 ∪ Y2 ∈ Fe] ≤ E[f (e X1 ∪ Y1) X2 ∪ Y1 ∈ Fe] . Proof. It is enough to prove the lemma for fixed values of X1, X2 and Fe obeying X2 ∈ Fe. If X2 ∪ {e′} ∈ Fe, then the conditions X2 ∪ Y2 ∈ Fe and X2 ∪ Y1 ∈ Fe always hold and the lemma is trivial, thus, we also assume X2 ∪ {e′} 6∈ Fe. Then, conditioned on the values of X1, X2 and Fe: E[f (e X1 ∪ Y1) X2 ∪ Y2 ∈ Fe] ≤ E[f (e X1) X2 ∪ Y2 ∈ Fe] = E[f (e X1) Y2 = ∅] = E[f (e X1 ∪ Y1) Y1 = ∅] = E[f (e X1 ∪ Y1) X2 ∪ Y1 ∈ Fe] , where the inequality holds by submodularity. Using the last lemma we can now prove the following one, which lower bounds the contribution of an element e to the value of the solution selected by π′. Lemma 3.14. Let A ∼ R(x) be the set of active elements, and let S be the output of π′ given A and an arbitrary online adversary. Then, for every element e ∈ N having xe > 0 and Pr[∅ ∈ Fe] > 0, Pr[e ∈ S e ∈ A] = Pr[R(x) \ {e} ∈ Fe] and E[f (e A ∩ σ<e a ) e ∈ S] ≥ F (e x ∧ 1 ). σ<e a Proof. Observe that the conditions xe > 0 and Pr[∅ ∈ Fe] > 0 are equivalent to Pr[e ∈ S] > 0, and thus, the second expectation we want to bound is well defined for every element e having xe > 0 and Pr[∅ ∈ Fe] > 0. The strategy of an online adversary for determining the order in which elements reveal whether they are active, up to the point when the element e does so, can be characterized by a binary tree with the following properties: • Every leaf is marked by e. • Every internal node is marked by some other element e′ 6= e and has two children called the “accepted child” and the “rejected child”. • The path from the root of the tree to every leaf does not contain a single element more than once. The semantics of understanding the tree as a strategy are as follows. The adversary starts at the root of the tree, and moves slowly down the tree till reaching a leaf. When the adversary is at some node e′ it makes e′ the next element that reveals whether it is active. If e′ is accepted by the OCRS, then the adversary moves to its “accepted child”, otherwise it moves to its “rejected child”. Notice that strategies defined by such trees do not allow the adversary to use the information whether e′ was active or not when the OCRS rejects it, however, since the activation of elements is independent and our OCRS behaves in the same way under both cases, this information cannot help the adversary. In the rest of this proof, we show by induction on the number of leafs in the strategy of the adversary that the lemma holds for every online adversary. Let us start with the case of the single strategy having a single leaf. In this strategy the adversary makes e the first element to reveal whether it is active. This means that: Pr[e ∈ S e ∈ A] = Pr[R(x) \ {e} ∈ Fe] , and E[f (e A ∩ σ<e a ) e ∈ S] = E[f (e A ∩ σ<e = E[f (e A ∩ σ<e a ) R(x) \ {e} ∈ Fe, e ∈ A] a )] = F (e x ∧ 1 ) , σ<e a 20 a where the second equality holds since A ∩ σ<e is independent of the conditions R(x) \ {e} ∈ Fe and e ∈ A. Next, assume the lemma holds for strategies having ℓ − 1 ≥ 1 leaves, and let us prove it for a strategy T having ℓ leaves. Since every internal node of T has two children, T must contain a node w (marked by an element e′ 6= e) having two leaves as children. Let T ′ be the strategy resulting from T by removing the two children of w and making w itself a leaf (by marking it with e). Since T ′ has ℓ − 1 leaves, it obeys the lemma by the induction hypothesis. Hence, it is enough to show that Pr[e ∈ S e ∈ A] is identical under both T and T ′ and E[f (e A ∩ σ<e a ) e ∈ S] is at least as large under T as under T ′. Let χw be the event that the adversary reaches the node w in its strategy. Clearly Pr[χw T ] = Pr[χw T ′], where by conditioning a probability on a strategy of the adversary we mean that the probability is calculated for the case that the adversary uses this strategy. If the last two probabilities are strictly smaller than 1 we also have: Pr[e ∈ S e ∈ A, ¬χw, T ] = Pr[e ∈ S e ∈ A, ¬χw, T ′] . On the other hand, observe that for both strategies T and T ′ the event χw implies the same (deterministic) fixed values for the set Bw of the elements that revealed whether they are active up to the point that the adversary reached w, and the set Aw = A ∩ Bw. Thus, whenever Pr[χw T ] = Pr[χw T ′] > 0: Pr[e ∈ S e ∈ A, χw, T ′] = Pr[Aw ∪ (R(x) \ (Bw ∪ {e})) ∈ Fe] = Pr[Aw ∪ (A ∩ {e′}) ∪ (R(x) \ (Bw ∪ {e, e′})) ∈ Fe] = Pr[e ∈ S e ∈ A, χw, T ] . In conclusion, we got: Pr[e ∈ S e ∈ A, T ] = Pr[e ∈ S e ∈ A, T ′]. Notice that both probabilities must be strictly positive by the induction hypothesis. By Bayes’ law we now get: Pr[χw T , e ∈ S] = Pr[χw e ∈ A, T , e ∈ S] = Pr[e ∈ S e ∈ A, T , χw] · Pr[χw e ∈ A, T ] Pr[e ∈ S e ∈ A, T ] = Pr[e ∈ S e ∈ A, T ′, χw] · Pr[χw e ∈ A, T ′] Pr[e ∈ S e ∈ A, T ′] = Pr[χw e ∈ A, T ′, e ∈ S] = Pr[χw T ′, e ∈ S] , and when the probabilities Pr[χw T , e ∈ S] = Pr[χw T ′, e ∈ S] are strictly smaller than 1 we also have: E[f (e A ∩ σ<e a ) e ∈ S, ¬χw, T ] = E[f (e A ∩ σ<e a ) e ∈ S, ¬χw, T ′] . Hence, to prove that E[f (e A ∩ σ<e show the inequality: a ) e ∈ S] is at least as large under T as under T ′ we are only left to E[f (e A ∩ σ<e a ) e ∈ S, χw, T ] ≥ E[f (e A ∩ σ<e a ) e ∈ S, χw, T ′] whenever Pr[χw T , e ∈ S] > 0. The last inequality holds since: E[f (e A ∩ σ<e a ) e ∈ S, χw, T ′] a )(cid:12)(cid:12)(cid:12) = Ehf (e (Aw ∪ (A \ Bw)) ∩ σ<e a )(cid:12)(cid:12)(cid:12) ≤ Ehf (e (Aw ∪ (A \ Bw)) ∩ σ<e a ) e ∈ S, χw, T ] , = E[f (e A ∩ σ<e Aw ∪ ((R(x) \ Bw) \ {e}) ∈ Fei Aw ∪ (A ∩ {e′}) ∪ ((R(x) \ Bw) \ {e′, e}) ∈ Fei where the inequality holds by Lemma 3.13. We are now ready to prove Theorem 3.10. 21 Proof of Theorem 3.10. If c = 0, then the theorem is trivial. Thus, we may assume c > 0. Recall that S is the set produced by the OCRS π′, and let A ∼ R(x) be the set of active elements. Since, π is a (b, c)- selectable element-monotone contention resolution scheme, A \ {e} must belong to Fe, for every element e ∈ N, with a positive probability. By the down-monotonicity of Fe, we get that ∅ ∈ Fe for every e ∈ N. Next, observe that: Pr[e ∈ S] · E[f (e S ∩ σ<e a ) e ∈ S] Pr[e ∈ S] · E[f (e A ∩ σ<e a ) e ∈ S] E[f (S)] = f (∅) + Xe∈N,xe>0 ≥ f (∅) + Xe∈N,xe>0 ≥ f (∅) + Xe∈N,xe>0 = f (∅) + Xe∈N,xe>0 Pr[R(x) \ {e} ∈ Fe, e ∈ A] · F (e x ∧ 1 a ) σ<e xe · Pr[R(x) \ {e} ∈ Fe] · F (e x ∧ 1 ) . σ<e a where the first inequality holds by submodularity and the second by Lemma 3.14. Since π is a (b, c)- selectable contention resolution scheme, the probability Pr[R(x) \ {e} ∈ Fe] must be at least c for every element e ∈ N. Additionally, since we assumed that x is non-reducible, we also have F (e x ∩ 1 ) ≥ 0 for every element e ∈ N obeying xe > 0. Plugging both observations into the previous inequality gives: σ<e a E[f (S)] ≥ f (∅) + Xe∈N,xe>0 4 Details on applications c · xe · F (e x ∧ 1 a ) = c · F (x) + (1 − c) · f (∅) ≥ c · F (x) . σ<e In this section we prove the theorems stated in Section 1.3 and provide some additional information. We reuse notation introduced in Section 1.3. 4.1 Prophet inequalities for Bayesian online selection problems Proof of Theorem 1.12 Similar relaxation techniques to the one we use here have been been used previously for different related problems (see, e.g., [24]). We start by introducing a relaxation for the expected value of the prophet, i.e., E[max{Pe∈S Ze S ∈ F}]. Let I ∗ ∈ argmax{Pe∈I Zi I ∈ F} be an optimal (random) set for the prophet, and we define e = Pr[e ∈ I ∗] for e ∈ N. Our relaxation seeks probabilities pe that have the role of p∗ p∗ e. Observe first that since I ∗ ∈ F with probability 1, we have that p∗ is a convex combination of characteristic vectors of feasible sets, and hence, p∗ ∈ P (we recall that P is a relaxation for F). Our relaxation assigns an optimistic objective value to each probability vector p ∈ P . More precisely, for any e ∈ N we assume in the relaxation that element e gets selected when Ze takes one of its pe-fraction of highest values. In particular, if Ze follows a continuous distribution with cumulative distribution function Fe, then we assume that Ze gets selected whenever Ze ≥ qe := F −1 (1 − pe) and, consequently, the x · dFe(x). More generally, when Ze does not follow a continuous distribution, the expected value of Ze on the highest pe-fraction of realizations can contribution of e to the objective of the prophet is ge(pe) = R ∞ qe e 22 be described as follows: ge(pe) = (pe − (1 − Fe(qe))) · qe +Zx∈(qe,∞) x · dFe(x), where qe = qe(pe) = min{α Fe(α) ≥ 1 − pe} . In words, we assume that e gets selected whenever Ze > qe. Moreover, if Ze = qe, then e gets selected with probability pe − 1 + Fe(qe). Putting things together, the relaxation we consider is the following. ge(pe) max p∈P Xe∈N (4) By the above discussion this is indeed a relaxation. Moreover, one can easily observe that ge is a concave functions, and thus, in many settings one can efficiently obtain a near-optimal solution to this relaxation using convex optimization techniques. However, if we are only interested in proving the existence of a prophet inequality as stated in Theorem 1.12, we do not need an efficient procedure to solve (4). Let x ∈ P be an optimal solution to (4). We now create an algorithm for the Bayesian online selection problem based on the point x ∈ P and the c-selectable OCRS for P which exists by assumption. Whenever an element e ∈ N reveals in the Bayesian online selection problem we say that e is active if its random variable Ze realizes within the largest xe-fraction of realizations. More formally, e is active if either: (i) Ze > qe(x), or (ii) if Ze = qe(x) (assuming Pr[Ze = qe(x)] > 0), we toss a coin and declare e to be active with probability xe−1+Fe(qe(x)) Pr[Ze=qe(x)] . Let A ⊆ N be the random set of active elements. Observe that A is distributed like R(x), the random subset of N that contains each element e ∈ N with probability xe independently of the others. Also, by definition of active elements we have E[Ze · 1e∈A] = ge(xe) ∀e ∈ N . (5) Our algorithm for the Bayesian online selection problem applies a c-selectable OCRS to the set A to obtain a random set I ⊆ A, I ∈ F. To prove the theorem, we show that the expected value of I is at least a c-fraction of the optimal value of (4), i.e., E[Pe∈I Ze] ≥ c ·Pe∈N ge(xe). Since the OCRS is c-selectable, we have Pr[e ∈ I] ≥ c · xe ∀e ∈ N . (6) A key observation is that the distribution of Ze conditioned on e ∈ I is the same as the distribution of Ze conditioned on e ∈ A. This follows from the fact that the OCRS does not consider the precise value of Ze, but only knows whether e ∈ A or not. In particular, this implies E[Ze e ∈ I] = E[Ze e ∈ A] ∀e ∈ N . (7) 23 Combining the above observations we get Pr[e ∈ I] · E[Ze e ∈ I] E"Xe∈I Ze# = Xe∈N ≥ c ·Xe∈N = c ·Xe∈N = c ·Xe∈N xe · E[Ze e ∈ A] (by (6) and (7)) Pr[e ∈ A] · E[Ze · 1e∈A e ∈ A] (since Pr[e ∈ A] = xe) ge(xe) (by (5)) . The last inequality shows that our procedure is worse by at most a factor of c compared to the value of the relaxation (4), which completes the proof. 4.2 Oblivious posted pricing mechanisms Proof of Theorem 1.15 The proof for Theorem 1.15 goes along the same lines as the proof of Theorem 1.12 presented in Section 4.1, but uses a different relaxation. The relaxation we employ is the same as the one used by Yan [24]. For completeness and ease of understanding we replicate some of the arguments in [24] and refer to the excellent discussion of this relaxation in [24] for more details about it. Consider the random set of agents I ∗ ⊆ N, I ∗ ∈ F served by Myerson’s mechanism, i.e., an optimal e = Pr[e ∈ I ∗] be the probability that e gets served. Since only feasible truthful mechanism, and let q∗ subsets of agents can be served, we have q∗ ∈ P , because P is a relaxation of F. For this fixed q∗ we can now define independent mechanism design problems for the different agents as follows. For each e ∈ N, we are interested in finding a price distribution (for the price offered to e), that maximizes the expected revenue under the constraint that e gets served with probability equal to q∗ e. Based on results by Myerson [22], it follows that the optimal price distribution can be chosen to be a two- price distribution, which can be determined through a well-known technique in mechanism design known as ironing (we refer to [24] for details). We denote by Re(q∗ e ) the expected revenue of this optimal distribution, which can be shown to be concave in q∗ e, and by De(q∗ e ) the distribution itself. Since the family of these independent mechanism design problems for the agents is less constrained than the original BSMD, in which e ) is an upper bound to the expected revenue of an optimal mechanism for the original BSMD (we refer to [24] for a formal proof). Hence, the following is a convex relaxation of the original BSMD. we also had to make sure that the set of all served agents is in F, we have that Pe∈N Re(q∗ max(Xe∈N Re(qe)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) q ∈ P) (8) The COPM we construct needs probabilities x ∈ P such that Pe∈N Re(xe) is an upper bound on the revenue of Myerson’s mechanism. By the above discussion, this holds for x = q∗, or for x being an optimal solution to (8). To make this step constructive one can follow, for example, the sampling-based approach of Chawla et al. [9]; they estimate the probabilities q∗ by running Myerson’s mechanism sufficiently many times. Alternatively, one could use convex optimization techniques to optimize the relaxation (8).11 Our 11We highlight that even if only an approximately optimal x ∈ P can be obtained, i.e., one such that α · Pe∈N Re(xe) upper bounds the optimal revenue for some α > 1, then all of what follows still goes through simply with an additional loss of a factor α. This will lead to a COPM that is at most a factor of α · c worse than Myerson’s mechanism. 24 COPM is randomized and defined by the following randomization over tuples (p, F ′). The price vector ≥0 is drawn according to the product distribution×e∈N De(xe), where each pe for e ∈ N is drawn p ∈ RN independently according to the two-price distribution De(xe). The family F ′ is chosen to be equal to the family Fx of the c-selectable OCRS for the point x ∈ P . Hence, if our OCRS is deterministic, then also F ′ = Fx is deterministic, in which case the randomization of our COPM is solely on the price vector p. To prove Theorem 1.15 we show that our COPM has an expected revenue of at least c ·Pe∈N Re(xe). We call an agent e ∈ N active if its personal (random) valuation Ze is at least as large as the (random) price pe. In other words, we say that e is active if it would accept the offer presented by our COPM. By the definition of the distributions De(xe), we have that each agent e is active with probability xe, independently of all other agents. Notice that an agent e ∈ N being active does not imply that e gets selected, because a COPM is allowed to reject an agent if feasibility in F ′ is not maintained. However, because our OCRS is c-selectable, we have that for any e ∈ N with probability at least c, the agent e can be added to the agents served so far no matter which subset of the active agents has been already served; furthermore, this event is independent of whether e is active itself. The expected revenue that our COPM gets from agent e is therefore at least c · Re(xe), which completes the proof. Extension to other objectives are objectives of the form E[Pe∈N Finally, we notice that, as highlighted by Yan [24], the used relaxation can easily be extended to a much larger class of objective functions that are decomposable with respect to the agents. More precisely, these 1Ze≥pe · ge(Ze, pe)], where for e ∈ N, ge is a function of the (random) valuation Ze of e and the price pe offered to e. In particular, the maximization of revenue which we dis- cussed above corresponds to ge(Ze, pe) = pe. Similarly, one can deal with welfare maximization or surplus maximization by defining ge(Ze, pe) = Ze and ge(Ze, pe) = Ze − pe, respectively. The above reasoning why our COPM is at most a factor of c worse than the optimal truthful mechanism extends to such objectives without modifications. 4.3 Stochastic probing We begin with the proof of Theorem 1.17. Consider the following relaxation. We use w in the relaxation to denote the natural extension of w to vectors (formally, w(x) = Pe∈N w(e) · xe). Additionally, the relaxation uses the expression p ◦ x to denote the element-wise multiplication of the probabilities vector p and the variables vector x. Clearly this relaxation can be solved efficiently when there is a separation oracle for the polytopes Pin and Pout. (R1) max w(p ◦ x) p ◦ x ∈ Pin x ∈ Pout x ∈ [0, 1]N The following lemma proves an important property of (R1). The proof of this lemma is based on the observation that one feasible solution for (R1) is the vector x ∈ [0, 1]N in which xe is equal to the marginal probability that the optimal algorithm probes element e. Lemma 4.1 (Claim 3.1 of [17]). The optimal value of (R1) upper bounds the the expected performance of the optimal algorithm for the weighted stochastic probing problem. Let x∗ be an optimal solution for (R1). By Lemma 4.1, to prove Theorem 1.17 we only need to show an algorithm for the weighted stochastic probing problem which finds a solution of expected weight at least b(cin · cout) · w(p ◦ x∗). Our algorithm for the weighted stochastic probing problem is given as Algorithm 1. 25 Algorithm 1: Probing Algorithm 1 Let Aout be a random set distributed like R(bx∗). 2 Let Fout ⊆ Fout be an instantiation of the random family Fπout,bx∗. 3 Let Fin ⊆ Fin be an instantiation of the random family Fπin,p◦(bx∗). 4 Let Q, S ← ∅. 5 for every element e ∈ N in the order chosen by the adversary do 6 7 8 if e ∈ Aout, S ∪ {e} ∈ Fin and Q ∪ {e} ∈ Fout then Add e to Q and probe e. if e is active then Add e to S. 9 return S. The next observation shows that Algorithm 1 is a legal algorithm for the weighted stochastic probing problem. Observation 4.2. The following always hold when Algorithm 1 terminates: • The set Q of probed elements is in Fout ⊆ Fout. • The set S of selected elements is in Fin ⊆ Fin. • The set S contains exactly the active elements of Q. In the rest of the section we use notation and results introduced in Section 3. Let ¯πin and ¯πout denote the characteristic CRSs of the greedy OCRSs πin and πout, respectively. We would like to use ¯πin and ¯πout to lower bound the value of a subset of S, and through that subset also the value of S. To achieve that objective we first need to describe the said subset of S as an expression of ¯πin and ¯πout. Let Ain be the set of elements that belong to Aout and are also active. One can observe that Ain is distributed like R(p ◦ x). Additionally, let us couple the randomness of Algorithm 1 and the CRSs ¯πin and ¯πout as follows: we use the same instantiations for the random families Fπin,p◦(bx∗) and Fπout,bx∗ in both Algorithm 1 and the definitions of ¯πin and ¯πout, respectively. Notice that this coupling implies: ¯πin(Ain) = {e ∈ Ain I ∪ {e} ∈ Fin ∀I ⊆ Ain, I ∈ Fin} and ¯πout(Aout) = {e ∈ Aout I ∪ {e} ∈ Fout ∀I ⊆ Aout, I ∈ Fout} . Observation 4.3. ¯πin(Ain) ∩ ¯πout(Aout) ⊆ S. Proof. Consider an element e ∈ ¯πin(Ain) ∩ ¯πout(Aout). Since e ∈ ¯πin(Ain) ⊆ Ain, e must be both active and in Aout. Let Se and Qe denote the sets S and Q immediately before e is processed by Algorithm 1. Clearly Se ⊆ Ain and Se ∈ Fin. Together with the fact that e ∈ ¯πin(Ain), these observations imply that Se ∪ {e} ∈ Fin. An analogous arguments shows also that Qe ∪ {e} ∈ Fout. Hence, we proved that e is an active element obeying all the conditions on Line 6 when processed by Algorithm 1, and therefore, e is added to S by the algorithm. We defined Aout as a random set distributed like R(bx∗) and Ain as the intersection of Aout and the set of active elements. However, for the purpose of analyzing the value of the set ¯πin(Ain) ∩ ¯πout(Aout) we can assume any construction procedure that results in the same joint distribution of Ain and Aout. The following is a convenient construction that we are going to use from this point on: the set Ain is a random set distributed like R(p ◦ (bx∗)). The set Aout is calculated by starting with Ain and adding to it every 26 element e 6∈ Ain with probability bx∗ e), independently. Notice that this construction indeed produces the same joint distribution of the sets Ain and Aout as the original construction. For ease of notation, let us denote by z a vector in [0, 1]N defined by: ze = bx∗ e) for every e ∈ N. Using this notation we get that Aout has the same distribution as Ain ∪ R(z). e(1 − pe)/(1 − bpex∗ e(1 − pe)/(1 − bpex∗ The new construction of Aout implies that Aout is a random function of Ain, and so is the expression ¯πin(Ain) ∩ ¯πout(Aout). Thus, we can define a new CRS ¯π for Pin by the equality ¯π(Ain) = ¯πin(Ain) ∩ ¯πout(Aout). Notice that ¯π is a true CRS for Pin in the sense that it always outputs a set in Fin since ¯πin(Ain) is guaranteed to be in Fin. Let us now study the properties of ¯π. Lemma 4.4. The CRS ¯π is monotone. Proof. We need to show that every element e ∈ N and two sets e ∈ T1 ⊆ T2 ⊆ N obey the inequality: Pr[e ∈ ¯π(Ain) Ain = T1] = Pr[e ∈ ¯πin(Ain) ∩ ¯πout(Aout) Ain = T1] ≥ Pr[e ∈ ¯πin(Ain) ∩ ¯πout(Aout) Ain = T2] = Pr[e ∈ ¯π(Ain) Ain = T2] . This is true since: Pr[e ∈ ¯πin(Ain) ∩ ¯πout(Aout) Ain = T1] = Pr[e ∈ ¯πin(T1) ∩ ¯πout(T1 ∪ R(z))] = Pr[e ∈ ¯πin(T1)] · Pr[e ∈ ¯πout(T1 ∪ R(z))] ≥ Pr[e ∈ ¯πin(T2)] · Pr[e ∈ ¯πout(T2 ∪ R(z))] = Pr[e ∈ ¯πin(T2) ∩ ¯πout(T2 ∪ R(z))] = Pr[e ∈ ¯πin(Ain) ∩ ¯πout(Aout) Ain = T2] , where the inequality follows since both ¯πin and ¯πout are monotone by Lemma 3.4. The following lemma shows that ¯π obeys a weak variant of balanceness. Definition 4.5. A CRS π for a polytope P is (x, c)-balanced for a vector x and c ∈ [0, 1] if Pr[e ∈ π(R(x)) e ∈ R(x)] ≥ c for every element e ∈ N having xe > 0. Lemma 4.6. The CRS ¯π is (p ◦ (bx∗), cin · cout)-balanced. Proof. Since Ain is distributed like R(p ◦ (bx∗)), we need to show that Pr[e ∈ ¯πin(Ain) ∩ ¯πout(Aout) e ∈ Ain] ≥ c1 · c2 holds for every element e ∈ N having bpex∗ e > 0. Since ¯πin and ¯πout are monotone by Lemma 3.4, we get that both Pr[e ∈ ¯πin(T )] and Pr[e ∈ ¯πout(T ∪ R(z))] are decreasing functions of T as long as e is in T . Thus, by the FKG inequality: Pr[e ∈ ¯πin(Ain) ∩ ¯πout(Aout) e ∈ Ain] = Pr[e ∈ ¯πin(Ain) ∩ ¯πout(Ain ∪ R(z)) e ∈ Ain] ≥ Pr[e ∈ ¯πin(Ain) e ∈ Ain] · Pr[e ∈ ¯πout(Ain ∪ R(z)) e ∈ Ain] = Pr[e ∈ ¯πin(Ain) e ∈ Ain] · Pr[e ∈ ¯πout(Aout) e ∈ Aout] , where the last equality uses the fact that the membership of every element in the sets Ain and R(z) is independent from the membership of other elements in these sets. The set Ain is distributed like R(p ◦ (bx∗)) and the vector p ◦ (bx∗) is inside the polytope bPin. Thus, since ¯πin is (b, cin)-balanced by Lemma 3.4, we get: Pr[e ∈ ¯πin(Ain) e ∈ Ain] ≥ cin. Similarly, the set Aout is distributed like R(bx∗) and the vector bx∗ is inside the polytope bPout. Thus, since ¯πout is (b, cout)-balanced by Lemma 3.4, we get: Pr[e ∈ ¯πin(Aout) e ∈ Aout] ≥ cout. The lemma now follows by combining the above inequalities. In the following corollary we use w to denote its natural extension to sets, i.e., w(T ) =Pe∈T w(e). Corollary 4.7. E[w(S)] ≥ b(cin · cout) · w(p ◦ x∗). 27 Proof. By Lemma 4.6, linearity of the expectation and the observation that Ain is distributed like R(p ◦ (bx∗)), we get: E[w(¯π(Ain))] = Xe∈N = Xe∈N ≥ Xe∈N w(e) · Pr[e ∈ ¯π(R(p ◦ (bx∗)))] w(e) · Pr[e ∈ R(p ◦ (bx∗))] · Pr[e ∈ ¯π(R(p ◦ (bx∗))) e ∈ R(p ◦ (bx∗))] w(e) · (pe ◦ (bx∗ e)) · (cin · cout) = b(cin · cout) · w(p ◦ x∗) . Since all the weights are non-negative and ¯π(Ain) = ¯πin(Ain) ∩ ¯πout(Aout) ⊆ S by Observation 4.3, the last inequality implies E[w(S)] ≥ E[w(¯π(Ain))] ≥ b(cin · cout) · w(p ◦ x∗). Following the above discussion, Theorem 1.17 is implied by the last corollary. We can now prove Theorem 1.18 as a direct consequence of Theorem 1.17. Proof of Theorem 1.18. Consider a down-closed set F ⊆ 2N containing every set T ⊆ N if and only if all the elements of T can be queried while respecting the deadlines. Formally, F =nT ⊆ 2N (cid:12)(cid:12)(cid:12) ∀1≤d≤N {e ∈ T de ≤ d} ≤ do . By definition (N, F) is a laminar matroid, thus, by Theorem 1.8 there exists a (b, 1 − b)-selectable greedy OCRS for its matroid polytope PF . Together with the existence of πout we get, by Theorem 1.9, a (b, (1 − b)cout)-selectable greedy OCRS for the polytope P ′ out = Pout ∩ PF . Notice that this polytope is a relaxation of the down-closed family F ′ out has a separation oracle whenever Pout has such an oracle. out = Fout ∩ F. Moreover, P ′ For convenience, let us use (F1, F2)-probing as a shorthand for the weighted stochastic probing problem with F1 and F2 as the inner and outer constraints, respectively. Consider the best algorithm for (Fin, Fout)- probing with deadlines. Since this algorithm probes with respect to the deadlines, the set of elements it probes must be in F. Hence, the same algorithm is also an algorithm for (Fin, F ′ out)-probing. Thus, by Theorem 1.17 we have an algorithm ALG for (Fin, F ′ out)-probing whose approximation ratio is b(1−b)·cin · cout compared to the best algorithm for (Fin, Fout)-probing with deadlines. Moreover, the approximation ratio of ALG holds regardless of the order in which ALG can probe elements. The algorithm we suggest for (Fin, Fout)-probing with deadlines is ALG when we allow it to probe elements in increasing deadlines order. We have already proved that ALG has the approximation ratio guaranteed by the theorem, so we only need to explain why does it respect the deadlines. Assume towards a contradiction that ALG probes element e after time de. This means that ALG probes a set T of at least de elements before it probes e. However, since ALG can probe elements only in increasing deadlines order, all the elements of T ∪ {e} have a deadline of at most de. The last observation implies that T ∪ {e} 6∈ F, which contradicts the fact that the set of elements probed by ALG is always in F ′ out ⊆ F. The rest of this section is devoted to proving Theorem 1.19. Let f : 2N → R≥0 be the non-negative monotone submodular objective function of the problem, i.e., the value of an output S of the probing algo- rithm is f (S). We need to introduce an extension of f to [0, 1]N studied by [6]. f +(x) = max  XT ⊆N αT · f (T )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) XT ⊆N αT ≤ 1, αT ≥ 0 and ∀e∈N Xe∈T ⊆N . αT ≤ xe  28 Intuitively, f + is equal to the largest possible expected value of f over a distribution of sets in which every element e appears with a marginal probability at most xe. Using this extension, we can now introduce a variant of the relaxation (R1) that works for monotone submodular objectives. (R2) max f +(p ◦ x) p ◦ x ∈ Pin x ∈ Pout x ∈ [0, 1]N Let us explain why we use the extension f + in (R2) instead of the simpler multilinear extension. An algorithm for the submodular stochastic probing may choose the next element to probe based on the set of elements previously probed and the results of these probes. Thus, the membership of elements in the solution produced by the algorithm is not independent, and this is captured by f +. Using this intuition, the work of [1] implies the following counterpart of Lemma 4.1. Lemma 4.8. The optimal value of (R2) upper bounds the the expected performance of the optimal algorithm for the submodular stochastic probing problem. Additionally, [1] also shows that a variant of the continuous greedy algorithm of [7] can be used to find a point x obeying all the constraints of (R2) and also the inequality F (p ◦ x) ≥ (1 − e−1) · f +(p ◦ x∗), where F is the multilinear extension of f and x∗ is the optimal solution for (R2). The same argument can also be used to show that by stopping the continuous greedy algorithm at time b, instead of letting it reach time 1, one gets a point x ∈ [0, 1]N obeying p ◦ x ∈ bPin, x ∈ bPout and F (p ◦ x) ≥ (1 − e−b − o(1)) · f +(p ◦ x∗).12 The algorithm we use to prove Theorem 1.19 is Algorithm 1 modified by replacing the vector bx∗ with x. Additionally, we use the same definition of the CRS ¯π given above, and observe that Lemmata 4.4 and 4.6 still apply to this CRS (with x replacing bx∗ in the appropriate places). To analyze the output of this CRS we observe that the proof of [10] for Lemma 3.5 in fact proves the following stronger version of the lemma. Note that this version strictly generalizes Lemma 3.5 since being (b, c)-balanced is equivalent to being (x, c)-balanced for every vector x ∈ bP . Lemma 4.9. For every given non-negative submodular function f : 2N → R≥0, there exists a function ηf : 2N → 2N that always returns a subset of its argument (i.e., ηf (S) ⊆ S for every S ⊆ N ) having the following property. For every input vector x ∈ [0, 1]N and monotone (x, c)-balanced CRS π: where F (x) is the multilinear extension of f . E[f (ηf (π(R(x))))] ≥ c · F (x) , We are now ready to prove the next lemma, which together with Lemma 4.8, proves Theorem 1.19. Lemma 4.10. E[f (S)] ≥ (cin · cout) · F (p ◦ x), where S is the output set of the modified Algorithm 1. Proof. Let S′ be the set ηf (π(Ain)) ⊆ π(Ain) = ¯πin(Ain) ∩ ¯πout(Aout) ⊆ S. By combining Lemmata 4.4, 4.6 and 4.9 and using the observation that Ain is distributed like R(p ◦ x), we get: E[f (S′)] ≥ (cin · cout) · F (p ◦ x) . Using the monotonicity of f we now get: E[f (S)] ≥ E[f (S′)] ≥ (cin · cout) · F (p ◦ x). 12The idea of running the continuous greedy for less time instead of scaling its output was first introduced by [14]. 29 References [1] M. Adamczyk, M. Sviridenko, and J. Ward. Submodular stochastic probing on matroids. In 31st Symposium on Theoretical Aspects of Computer Science (STACS), pages 29–40, 2014. [2] M. Babaioff, N. Immorlica, and R. Kleinberg. Matroids, secretary problems, and online mechanisms. In Proceedings of the 18th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 434–443, 2007. [3] N. Bansal, A. Gupta, J. Li, J. Mestre, V. Nagarajan, and A. Rudra. When LP is the cure for your matching woes: Improved bounds for stochastic matchings. Algorithmica, 63(4):733–762, 2012. [4] M. Bateni, M. Hajiaghayi, and M. Zadimoghaddam. Submodular secretary problem and extensions. ACM Transactions on Algorithms, 9(4):32:1–32:23, October 2013. [5] N. Buchbinder, M. Feldman, J. Naor, and R. Schwartz. Submodular maximization with cardinality constraints. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1433–1452, 2014. [6] G. Calinescu, C. Chekuri, M. P´al, and J. Vondr´ak. Maximizing a submodular set function subject to a matroid constraint. In Proceedings of the 12th International Integer Programming and Combinatorial Optimization Conference (IPCO), pages 182–196, 2007. [7] 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(6):1740–1766, 2011. [8] S. Chawla, J. Hartline, D. Malec, and B. Sivan. Multi-parameter mechanism design and sequential posted pricing. In Proceedings of the 42nd ACM Symposium on Theory of Computing (STOC), pages 311–320, New York, NY, USA, 2010. ACM. [9] S. Chawla, J. Hartline, D. Malec, and B. Sivan. Multi-parameter mechanism design and sequential posted pricing. http://arxiv.org/abs/0907.2435v2, 2010. [10] C. Chekuri, J. Vondr´ak, and R. Zenklusen. Submodular function maximization via the multilinear relaxation and contention resolution schemes. SIAM Journal on Computing, 43(6):1831–1879, 2014. [11] P. Dagum, R. Karp, M. Luby, and S. Ross. An optimal algorithm for Monte Carlo estimation. SIAM Journal on Computing, 29(5):1484–1496, 2000. [12] U. Feige, V. S. Mirrokni, and J. Vondr´ak. Maximizing non-monotone submodular functions. SIAM Journal on Computing, 40(4):1133–1153, 2011. [13] M. Feldman. Maximization Problems with Submodular Objective Functions. PhD thesis, Computer Science Department, Technion - Israel Institute of Technology, July 2013. [14] M. Feldman, J. Naor, and R. Schwartz. A unified continuous greedy algorithm for submodular maxi- mization. In Proceedings of the 52nd IEEE Symposium on Foundations of Computer Science (FOCS), pages 570–579, 2011. [15] M. Feldman, O. Svensson, and R. Zenklusen. A simple O(log log(rank))-competitive algorithm for the matroid secretary problem. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1189–1201, 2015. 30 [16] M. Feldman and R. Zenklusen. The submodular secretary problem goes linear. In Proceedings of 56th Annual IEEE Symposium on Foundations of Computer Science (FOCS), 2015. [17] A. Gupta and V. Nagarajan. A stochastic probing problem with applications. In Proceedings of Integer Programming and Combinatorial Optimization (IPCO), pages 205–216, 2013. [18] R. Kleinberg and S. M. Weinberg. Matroid prophet inequalities. In Proceedings of the 44th Annual ACM Symposium on Theory of Computing (STOC), pages 123–136, 2012. [19] U. Krengel and L. Sucheston. On semiamarts, amarts, and processes with finite value. In J. Kuelbs, editor, Probability on Banach Spaces, volume 4 of Advances in probability and related topics, pages 197–266. Marcel Dekker Inc., 1978. [20] O. Lachish. O(log log Rank) competitive ratio for the matroid secretary problem. In Proceedings of the 55th IEEE Symposium on Foundations of Computer Science (FOCS), pages 326–335. IEEE, 2014. [21] B. Lehmann, D. Lehmann, and N. Nisan. Combinatorial auctions with decreasing marginal utilities. Games and Economic Behavior, 55(2):270 – 296, 2006. Mini Special Issue: Electronic Market Design. [22] R. B. Myerson. Optimal auction design. Mathematics of Operations Research, 6(1):58–73, 1981. [23] J. A. Soto. Matroid secretary problem in the random-assignment model. SIAM Journal on Computing, 42(1):178–211, 2013. [24] Q. Yan. Mechanism design via correlation gap. In Proceedings of the Twenty-second Annual ACM- SIAM Symposium on Discrete Algorithms (SODA), pages 710–719. SIAM, 2011. A Definitions of Matroidal Concepts Recall that a matroid M = (N, F) is a tuple consisting of a finite ground set N, and a nonempty family F ⊆ 2N of subsets of the ground set, called independent sets, which satisfy: (i) I ⊆ J ∈ F ⇒ I ∈ F, and (ii) I, J ∈ F, I > J ⇒ ∃e ∈ I \ J s.t. J ∪ {e} ∈ F. The rank of a set S ⊆ 2N is the size of a maximum cardinality independent subset of S. The rank function of the matroid M is a function rank : 2N → Z≥0 (where Z≥0 is the set of all non-negative integers) assigning each set its rank. More formally, rank(S) = max{I I ∈ F, I ⊆ S} . Observe that the rank of an independent set is equal to its size. The rank of the matroid M itself is defined as rank(N ). Notice that rank(S) ≤ rank(N ) for every subset S ⊆ N. A set S ⊆ N is called a base of M if it is independent and has maximum rank, i.e., S = rank(S) = rank(N ). We say that an element e ∈ N is spanned by a set S ⊆ N if adding e to S does not increase the rank of S. On the other hand, the span of a subset S ⊆ N is the set of elements that are spanned by it. More formally, the span of a set S is span(S) = {e ∈ N rank(S + e) = rank(S)}. Given a subset N ′ ⊆ N, the restriction of M to N ′, denoted by M N ′, is the matroid obtained from M by keeping only the elements of N ′. Formally, M N ′ is the matroid (N ′, F ∩ 2N ′ ). On the other hand, contracting N ′ in M results in another matroid, denoted by M/N ′, over the ground set N \ N ′. A set is independent in M/N ′ if and only if adding a base of N ′ to it results in an independent set of M. It turns 31 out that this definition is independent of the base that is chosen for N ′. Formally, M/N ′ is the matroid (N \ N ′, F ′), where: F ′ = {S ⊆ N \ N ′ rank(S ∪ N ′) = S + rank(N ′)} . 32
1704.07279
1
1704
2017-04-24T15:18:40
Finding, Hitting and Packing Cycles in Subexponential Time on Unit Disk Graphs
[ "cs.DS", "cs.CG" ]
We give algorithms with running time $2^{O({\sqrt{k}\log{k}})} \cdot n^{O(1)}$ for the following problems. Given an $n$-vertex unit disk graph $G$ and an integer $k$, decide whether $G$ contains (1) a path on exactly/at least $k$ vertices, (2) a cycle on exactly $k$ vertices, (3) a cycle on at least $k$ vertices, (4) a feedback vertex set of size at most $k$, and (5) a set of $k$ pairwise vertex-disjoint cycles. For the first three problems, no subexponential time parameterized algorithms were previously known. For the remaining two problems, our algorithms significantly outperform the previously best known parameterized algorithms that run in time $2^{O(k^{0.75}\log{k})} \cdot n^{O(1)}$. Our algorithms are based on a new kind of tree decompositions of unit disk graphs where the separators can have size up to $k^{O(1)}$ and there exists a solution that crosses every separator at most $O(\sqrt{k})$ times. The running times of our algorithms are optimal up to the $\log{k}$ factor in the exponent, assuming the Exponential Time Hypothesis.
cs.DS
cs
Finding, Hitting and Packing Cycles in Subexponential Time on Unit Disk Graphs∗ Fedor V. Fomin1, Daniel Lokshtanov1, Fahad Panolan1, Saket Saurabh1,2, and Meirav Zehavi1 1Department of Informatics, University of Bergen, Norway, {fomin,daniello,fahadn.panolan,meirav.zehavi}@ii.uib.no 2The Institute of Mathematical Sciences, HBNI, Chennai, India, [email protected] Abstract an n-vertex unit disk graph G and an integer k, decide whether G contains We give algorithms with running time 2O(√k log k) · nO(1) for the following problems. Given • a path on exactly/at least k vertices, • a cycle on exactly k vertices, • a cycle on at least k vertices, • a feedback vertex set of size at most k, and • a set of k pairwise vertex-disjoint cycles. For the first three problems, no subexponential time parameterized algorithms were previously known. For the remaining two problems, our algorithms significantly outperform the previously best known parameterized algorithms that run in time 2O(k0.75 log k) · nO(1). Our algorithms are based on a new kind of tree decompositions of unit disk graphs where the separators can have size up to kO(1) and there exists a solution that crosses every separator at most O(√k) times. The running times of our algorithms are optimal up to the log k factor in the exponent, assuming the Exponential Time Hypothesis. 1 Introduction Unit disk graphs are the intersection graphs of unit circles in the plane. That is, given n-unit circles in the plane, we have a graph G where each vertex corresponds to a circle such that there is an edge between two vertices when the corresponding circles intersect. Unit disk graphs form one of the most well studied graph classes in computational geometry because of their use in modelling optimal facility location [41] and broadcast networks such as wireless, ad-hoc and sensor networks [26, 34, 43]. These applications have led to an extensive study of NP-complete problems on unit disk graphs in the realms of computational complexity and approximation algorithms. We refer the reader to [12, 20, 30] and the citations therein for these studies. However, these problems remain hitherto unexplored in the light of parameterized complexity with exceptions that are few and far between [1, 10, 25, 33, 39]. ∗Supported by Pareto-Optimal Parameterized Algorithms, ERC Starting Grant 715744, Parameterized Approx- imation, ERC Starting Grant 306992, and Rigorous Theory of Preprocessing, ERC Advanced Investigator Grant 267959. 1 In this paper we consider the following basic problems about finding, hitting and packing cycles on unit disk graphs from the viewpoint of parameterized algorithms. For a given graph G and integer k, • Exact k-Cycle asks whether G contains a cycle on exactly k vertices, • Longest Cycle asks whether G contains a cycle on at least k vertices, • Feedback Vertex Set asks whether G contains a vertex set S of size k such that the graph G \ S is acyclic, and • Cycle Packing asks whether G contains a set of k pairwise vertex-disjoint cycles. Along the way, we also study Longest Path (decide whether G contains a path on exactly/at least k vertices) and Subgraph Isomorphism (SI). In SI, given connected graphs G and H on n and k vertices, respectively, the goal is to decide whether there exists a subgraph in G that is isomorphic to H. T hroughout the paper we assume that a unit disk graph is given by a set of n points in the Euclidean plane and there is a graph where vertices correspond to these points and there is an edge between two vertices if and only if the distance between the two points is at most 2. While all these problems remain NP-complete on planar graphs, substantially faster-subexponential- In parameterized complexity each of these problems serves as a testbed for development of fundamental algorithmic techniques such as color-coding [2], the polynomial method [35, 36, 42, 4], matroid based techniques [23] for Longest Path and Longest Cycle, and kernelization tech- niques for Feedback Vertex Set [40]. We refer to [14] for an extensive overview of the literature on parameterized algorithms for these problems. For example, the fastest known algorithms solving Longest Path are the 1.66k · nO(1) time randomized algorithm of Bjorklund et al. [4], and the 2.597k · nO(1) time deterministic algorithm of Zehavi [44]. Moreover, unless the Exponential Time Hypothesis (ETH) of Impagliazzo, Paturi and Zane [31] fails, none of the problems above can be solved in time 2o(k) · nO(1) [31]. parameterized algorithms are known on planar graphs. In particular, by combining the bidimen- sionality theory of Demaine et al. [15] with efficient algorithms on graphs of bounded treewidth [19], Longest Path, Longest Cycle, Feedback Vertex Set and Cycle Packing are solvable in time 2O(√k)nO(1) on planar graphs. The parameterized subexponential "tractability" of such problems can be extended to graphs excluding some fixed graph as a minor [17]. The bidimen- sionality arguments cannot be applied to Exact k-Cycle and this was one of the motivations for developing the new pattern-covering technique, which is used to give a randomized algorithm for Exact k-Cycle running in time 2O(√k log2 k)nO(1) on planar and apex-minor-free graphs [22]. The bidimensionality theory was also used to design (efficient) polynomial time approximation scheme ((E)PTAS) [16, 24] and polynomial kernelization [21] on planar graphs. It would be interesting to find generic properties of problems, similar to the theory of bidimen- sionality for planar-graph problems, that could guarantee the existence of subexponential param- eterized algorithms or (E)PTAS on geometric classes of graphs, such as unit disk graphs. The theory of (E)PTAS on geometric classes of graphs is extremely well developed and several methods have been devised for this purpose. This includes methods such as shifting techniques, geometric sampling and bidimensionality theory [30, 28, 27, 29, 13, 38, 25]. However, we are still very far from a satisfactory understanding of the "subexponential" phenomena for problems on geometric graphs. We know that some problems such as Independent Set and Dominating Set, which are solvable in time 2O(√k)nO(1) on planar graphs, are W[1]-hard on unit disk graphs and thus the existence of 2 an algorithm of running time f (k)· nO(1) is highly unlikely for any function f [37]. The existence of a vertex-linear kernel for some problems on unit disk graphs such as Vertex Cover [11] or Con- nected Vertex Cover [33] combined with an appropriate separation theorem [1, 10, 39] yields a parameterized subexponential algorithm. A subset of the authors of this paper used a different approach based on bidimensionality theory to obtain subexponential algorithms of running time 2O(k0.75 log k) · nO(1) on unit disk graphs for Feedback Vertex Set and Cycle Packing in [25]. No parameterized subexponential algorithms on unit disk graphs for Longest Path, Longest Cycle, and Exact k-Cycle were known prior to our work. Our Results. We design subexponential parameterized algorithms, with running time 2O(√k log k)· nO(1), for Exact k-Cycle, Longest Cycle, Longest Path, Feedback Vertex Set and Cycle Packing on unit disk graphs and unit square graphs. It is also possible to show by known NP-hardness reductions for problems on unit disk graphs [12] that an algorithm of running time 2o(√k) · nO(1) for any of our problems on unit disk graphs would imply that ETH fails. Hence our algorithms are asymptotically almost tight. Along the way we also design Turing kernels (in fact, many to one) for Exact k-Cycle, Longest Cycle, Longest Path and SI. That is, we give a polynomial time algorithm that given an instance of Exact k-Cycle or Longest Cycle or Longest Path or SI, produces polynomially many reduced instances of size polynomial in k such that the input instance is a Yes-instance if and only if one of the reduced instances is. As a byproduct of this we obtain a 2O(k log k) · nO(1) time algorithm for SI when G is a unit disk graph and H is an arbitrary connected graph. It is noteworthy to remark that a simple disjoint union trick implies that Exact k-Cycle, Longest Cycle, Longest Path, and SI do not admit a polynomial kernel on unit disk graphs [8]. Finally, we remark that we do not use Turing kernels to design our subexponential time algorithms except for Exact k-Cycle. The subexponential time parameterized algorithm for Exact k-Cycle also uses a "double layering" of Baker's technique [3]. All our subexponential time algorithms have the following theme in common. If an input n- vertex unit disk graph G contains a clique of size poly(k) (such a clique can be found in polynomial time), then we have a trivial Yes-instance or No-instance, depending on the problem. Otherwise, we show that the unit disk graph G in a Yes-instance of the problem admits, sometimes after a polynomial time preprocessing, a specific type of (ω, ∆, τ )-decomposition, where the meaning of ω, ∆ and τ is as follows. The vertex set of G is partitioned into cliques C1, . . . , Cd, each of size at most ω = kO(1). We also require that after contracting each of the cliques Ci to a single vertex, the maximum vertex degree ∆ of the obtained graph G is O(1), while the treewidth τ of G is O(√k). Moreover, the corresponding tree decomposition of G can be constructed efficiently. We use the tree decomposition of G to construct a tree decomposition of G by "uncontracting" each of the contracted cliques Ci. While the width of the obtained tree decomposition of G can be of order ω· τ = kO(1), we show that each of our parameterized problems can be solved in time f (∆)· ωf (∆)·τ . Here we use dynamic programming over the constructed tree decomposition of G, however there is a twist from the usual way of designing such algorithms. This part of the algorithm is problem- specific-in order to obtain the claimed running time, we have to establish a very specific property for each of the problems. Roughly speaking, the desired property of a problem is that it always admits an optimal solution such that for every pair of adjacent bags X, Y of the tree decomposition of G, the number of edges of this solution "crossing" a cut between X and Y is O(√k). We remark that the above decomposition is only given in the introduction to present our ideas for all the algorithms in a unified way. 3 2 Preliminaries For a positive integer t, we use [t] as a shorthand for {1, 2, . . . , t}. Given a function f : A → B and a subset A′ ⊆ A, let fA′ denote the restriction of the function f to the domain A′. For a function f : A → B and B′ ⊆ B, f−1(B′) denote the set {a ∈ A : f (a) ∈ B′}. For t, t′ ∈ N, a set [t] × [t′], i ∈ [t] and j ∈ [t′] we use (∗, j) and (i,∗) to denote the sets {(i′, j) : i′ ∈ [t]} and {(i, j′) : j′ ∈ [t′]}, respectively. For a set U , we use 2U to denote the power set of U . Graph Theory. We use standard notation and terminology from the book of Diestel [18] for graph-related terms which are not explicitly defined here. Given a graph G, V (G) and E(G) denote its vertex-set and edge-set, respectively. When the graph G is clear from context, we denote n = V (G) and m = E(G). Given U ⊆ V (G), we let G[U ] denote the subgraph of G induced by U , and we let G \ U denote the graph G[V (G) \ U ]. For an edge subset E, we use V (E) to denote the set of endpoints of edges in E and G[E] to denote the graph (V (E), E). For X, Y ⊆ V (G), we use E(X) and E(X, Y ) to denote the edge sets {{u, v} ∈ E(G) : u, v ∈ X} and {{u, v} ∈ E(G) : u ∈ X, v ∈ Y }, respectively. Moreover, we let N (U ) denote the open neighborhood of G. In case U = {v}, we denote N (v) = N (U ). Given an edge e = {u, v} ∈ E(G), we use G/e to denote the graph obtained from G by contracting the edge e. In other words, G/e denotes the graph on the vertex-set (V (G)\{u, v})∪{x{u,v}}, where x{u,v} is a new vertex, and the edge-set E(G) = E(G[V (G)\{u, v}])∪{{x{u,v}, w} w ∈ N ({u, v})}. A graph H is called a minor of G, if H can be obtained from G by a sequence of edge deletion, edge contraction and vertex deletion. In a graph G, a sequence of vertices [u1u2 . . . uℓ] is called a path in G, if for any i, j ∈ [ℓ], i 6= j, ui 6= uj and {ur, ur+1} ∈ E(G) for all r ∈ [ℓ − 1]. We also call the path P = [u1u2 . . . uℓ] as u1-uℓ path. The internal vertices of a path P = [u1u2 . . . uℓ] are {u2, u3, . . . , uℓ−1}. For a path P = [u1u2 . . . uℓ], we use ←−P to denote the path [uℓuℓ−1 . . . u1]. For any two paths P1 = [u1 . . . ui] and P2 = [ui . . . uℓ], we use P1P2 to denote the path [u1u2 . . . uℓ]. A sequence of vertices [u1u2 . . . uℓ] is called a cycle in G, if u1 = uℓ, [u1u2 . . . uℓ−1] is a path and {uℓ−1, uℓ} ∈ E(G). For a path or a cycle Q, we use V (Q) to denote the set of vertices in Q. Given k ∈ N, we let Kk denote the compete graph on k vertices. For a set X, we use K[X] to denote the complete graph on X. Given a, b ∈ N, an a × b grid is a graph on a · b vertices, vi,j for (i, j) ∈ [a] × [b], such that for all i ∈ [a − 1] and j ∈ [b], it holds that vi,j and vi+1,j are neighbors, and for all i ∈ [a] and j ∈ [b − 1], it holds that vi,j and vi,j+1 are neighbors. For ease of presentation, for any function f : D → [a] × [b], i ∈ [a] and j ∈ [b], we use f−1(i, j), f−1(∗, j), and f−1(i,∗) to denote the sets f−1((i, j)), f−1((∗, j)), and f−1((i,∗)), respectively. A path decomposition is defined as follows. Definition 2.1. A path decomposition of a graph G is a sequence P = (X1, X2, . . . , Xℓ), where each Xi ⊆ V (G) is called a bag, that satisfies the following conditions. • Si∈[ℓ] Xi = V (G). • For every edge {u, v} ∈ E(G) there exists i ∈ [ℓ] such that {u, v} ⊆ Xi. • For every vertex v ∈ V (G), if v ∈ Xi ∩ Xj for some i ≤ j, then v ∈ Xr for all r ∈ {i, . . . , j}. The width of P is maxi∈[ℓ] Xi − 1. The pathwidth of G is the minimum width of a path decomposition of G, and it is denoted by pw(G). A tree decomposition is a structure more general than a path decomposition, which is defined as follows. 4 Definition 2.2. A tree decomposition of a graph G is a pair T = (T, β), where T is a tree and β is a function from V (T ) to 2V (G), that satisfies the following conditions. • Sx∈V (T ) β(x) = V (G). • For every edge {u, v} ∈ E(G) there exists x ∈ V (T ) such that {u, v} ⊆ β(x). • For every vertex v ∈ V (G), if v ∈ β(x) ∩ β(y) for some x, y ∈ V (T ), then v ∈ β(z) for all z on the unique path between x and y in T . The width of T is maxx∈V (T ) β(x) − 1. Each β(x) is called a bag. Moreover, we let γ(x) denote the union of the bags of x and its descendants. In other words, a path decomposition is a tree decomposition where T is a path, but it will be convenient for us to think of a path decomposition as a sequence using the syntax in Definition 2.1. The treewidth of G is the minimum width of a tree decomposition of G, and it is denoted by tw(G). Proposition 2.3 ([9]). Given a graph G and an integer k, in time 2O(k) · n, we can either decide that tw(G) > k or output a tree decomposition of G of width 5k. A nice tree decomposition is a tree decomposition of a form that simplifies the design of dynamic programming (DP) algorithms. Formally, Definition 2.4. A tree decomposition T = (T, β) of a graph G is nice if for the root r of T , it holds that β(r) = ∅, and each node v ∈ V (T ) is of one of the following types. • Leaf: v is a leaf in T and β(v) = ∅. • Forget: v has exactly one child u, and there exists a vertex w ∈ β(u) such that β(v) = β(u) \ {w}. • Introduce: v has exactly one child u, and there exists a vertex w ∈ β(v) such that β(v) \ {w} = β(u). • Join: v has exactly two children, u and w, and β(v) = β(u) = β(w). Proposition 2.5 ([6]). Given a graph G and a tree decomposition T of G, a nice tree decomposition T ′ of the same width as T can be computed in linear time. Geometric Graphs. Given a set of geometric objects, O, we say that a graph G represents O if each vertex in V (G) represents a distinct geometric object in O, and every geometric object in O is represented by a distinct vertex in V (G). In this case, we abuse notation and write V (G) = O. The intersection graph of O is a graph G that represent O and satisfies E(G) = {{u, v} : u, v ∈ O, u ∩ v 6= ∅}. Let P = {p1 = (x1, y1), p2 = (x2, y2), . . . , pn = (xn, yn)} be a set of points in the Euclidean plane. In the unit disk graph model, for every i ∈ [n], we let di denote the disk of radius 1 whose centre is pi. Accordingly, we denote D = {d1, d2, . . . , dn}. Then, the unit disk graph of D is the intersection graph of D. Alternatively, the unit disk graph of D is the geometric graph of G such that E(G) = {{pi = (xi, yi), pj = (xj, yj)} pi, pj ∈ D, i 6= j,p(xi − xj)2 + (yi − yj)2 ≤ 2}. In the unit square graph model, for every i ∈ [n], we let si denote the axis-parallel unit square whose centre is pi. Accordingly, we denote S = {s1, s2, . . . , sn}. Then, the unit square graph of S is the intersection graph of S. Alternatively, the unit square graph of S is the geometric graph of G such that E(G) = {{pi = (xi, yi), pj = (xj, yj)} pi, pj ∈ S, i 6= j,xi − xj ≤ 1,yi − yj ≤ 1}. 5 3 Clique-Grid Graphs In this section, we introduce a family of "grid-like" graphs, called clique-grid graphs, that is tailored to fit our techniques. Given a unit disk/square graph G, we extract the properties of G that we would like to exploit, and show that they can be captured by an appropriate clique-grid graph. Let us begin by giving the definition of a clique-grid graph. Roughly speaking, a graph G is a clique-grid graph if each of its vertices can be embedded into a single cell of a grid (where multiple vertices can be embedded into the same cell), ensuring that the subgraph induced by each cell is a clique, and that each cell can interact (via edges incident to its vertices) only with cells at "distance" at most 2. Formally, Definition 3.1 (clique-grid graph). A graph G is a clique-grid graph if there exists a function f : V (G) → [t] × [t′], for some t, t′ ∈ N, such that the following conditions are satisfied. 1. For all (i, j) ∈ [t] × [t′], it holds that f−1(i, j) is a clique. 2. For all {u, v} ∈ E(G), it holds that if f (u) = (i, j) and f (v) = (i′, j′) then Such a function f is a representation of G. i − i′ ≤ 2 and j − j′ ≤ 2. We note that a notion similar to clique-grid graph was also used by Ito and Kadoshita [32]. For the sake of clarity, we say that a pair (i, j) ∈ [t] × [t′] is a cell. Moreover, whenever we discuss a clique-grid graph, we assume that we also have the representation. Next, we show that a unit disk graph is a clique-grid graph. Lemma 3.2. Let D be a set of points in the Euclidean plane, and let G be the unit disk graph of D. Then, a representation f of G can be computed in polynomial time. √2 . ymax − ymin Proof. Denote xmin = min{xi pi = (xi, yi) ∈ D}, xmax = max{xi pi = (xi, yi) ∈ D}, ymin = min{yi pi = (xi, yi) ∈ D} and ymax = max{yi pi = (xi, yi) ∈ D}. Accordingly, denote bt = xmax − xmin If bt = ⌈bt⌉, then denote t = bt + 1, and otherwise denote t = bt. Similarly, if bt′ = ⌈bt′⌉, then denote t′ = bt′ + 1, and otherwise denote t′ = bt′. Now, define f : V (G) → [t] × [t′] as follows. For all pi = (xi, yi) ∈ V (G), define ai = ⌊ + 1⌋, bi = ⌊ + 1⌋ and f (pi) = (ai, bi). and bt′ = xi − xmin√2 yi − ymin√2 √2 + 1⌋ and ⌊ yi − ymin√2 First, let us verify that Condition 1 in Definition 3.1 is satisfied. To this end, let pi = (xi, yi) + 1⌋ = + 1⌋. Thus, we have that xi − xj < √2 and xi − xmin√2 and pj = (xj, yj) be two distinct vertices in V (G) such that f (pi) = f (pj). Then, ⌊ xj − xmin√2 ⌊ yi − yj < √2. In particular, p(xi − xj)2 + (yi − yj)2 < 2, which implies that (pi, pj) ∈ E(G). let us verify that Condition 2 in Definition 3.1 is satisfied. To this end, let {pi = (xi, yi), pj = (xj, yj)} ∈ E(G). Recall that f (pi) and f (pj) are denoted by (ai, bi) and (aj, bj), respectively. Thus, to prove that f (pj) ∈ {(a′, b′) ai − a′ ≤ 2,bi − b′ ≤ 2}, it should be shown that ai − aj ≤ 2 and bi − bj ≤ 2. By substituting ai, aj, bi and bj, it should be shown that yj − ymin√2 + 1⌋ = ⌊ Next, • ⌊ xi − xmin√2 ⌋ − ⌊ xj − xmin√2 ⌋ ≤ 2, and 6 yi − ymin√2 ⌋ − ⌊ yj − ymin√2 ⌋ ≤ 2. • ⌊ We focus on the proof of the first item, as the proof of the second item is symmetric. Without loss xj − xmin√2 of generality, suppose that xj ≤ xi. Then, it remains to show that ⌊ ⌋ ≤ 2. Since G is the unit disk graph of D and {pi, pj} ∈ E(G), it holds thatp(xi − xj)2 + (yi − yj)2 ≤ 2. ⌋ ≤ ⌊X +√2⌋− xi − xmin√2 In particular, xi − xj ≤ 2. Denote X = ⌊X⌋ ≤ 2. ⌋ − ⌊ xj − xmin√2 xj − xmin√2 xi − xmin√2 . Then, ⌊ ⌋−⌊ Similarly, we show the following. Lemma 3.3. Let S be a set of points in the Euclidean plane, and let G be the unit square graph of S. Then, a representation f of G can be computed in polynomial time. Proof. Denote xmin = min{xi pi = (xi, yi) ∈ D}, xmax = max{xi pi = (xi, yi) ∈ D}, ymin = min{yi pi = (xi, yi) ∈ D} and ymax = max{yi pi = (xi, yi) ∈ D}. Accordingly, denote bt = xmax − xmin and bt′ = ymax − ymin. If bt = ⌈bt⌉, then denote t = bt + 1, and otherwise denote t = bt. Similarly, if bt′ = ⌈bt′⌉, then denote t′ = bt′ + 1, and otherwise denote t′ = bt′. Now, define f : V (G) → [t] × [t′] as follows. For all pi = (xi, yi) ∈ V (G), define ai = ⌊xi − xmin + 1⌋, bi = ⌊yi − ymin + 1⌋ and f (pi) = (ai, bi). First, let us verify that Condition 1 in Definition 3.1 is satisfied. To this end, let pi = (xi, yi) and pj = (xj, yj) be two distinct vertices in V (G) such that f (pi) = f (pj). Then, ⌊xi − xmin + 1⌋ = ⌊xj − xmin + 1⌋ and ⌊yi − ymin + 1⌋ = ⌊yj − ymin + 1⌋. Thus, we have that xi − xj < 1 and yi − yj < 1, which implies that (pi, pj) ∈ E(G). let us verify that Condition 2 in Definition 3.1 is satisfied. To this end, let {pi = (xi, yi), pj = (xj, yj)} ∈ E(G). Recall that f (pi) and f (pj) are denoted by (ai, bi) and (aj, bj), respectively. Thus, to prove that f (pj) ∈ {(a′, b′) ai − a′ ≤ 2,bi − b′ ≤ 2}, it should be shown that ai − aj ≤ 2 and bi − bj ≤ 2. In fact, we will actually prove that ai − aj ≤ 1 and bi − bj ≤ 1. By substituting ai, aj, bi and bj, it is sufficient to show that Next, • ⌊xi − xmin⌋ − ⌊xj − xmin⌋ ≤ 1, and • ⌊yi − ymin⌋ − ⌊yj − ymin⌋ ≤ 1. We focus on the proof of the first item, as the proof of the second item is symmetric. Without loss of generality, suppose that xj ≤ xi. Then, it remains to show that ⌊xi− xmin⌋−⌊xj − xmin⌋ ≤ 1. Since G is the unit disk graph of D, {pi, pj} ∈ E(G) and xj ≤ xi, it holds that xi − xj ≤ 1. Denote X = xj − xmin. Then, ⌊xi − xmin⌋ − ⌊xj − xmin⌋ ≤ ⌊X + 1⌋ − ⌊X⌋ ≤ 1. Consequently, we have the following. Corollary 3.4. Let (G, O, H, k) ((G, O, k)) be an instance of SI (resp. Longest Cycle) on unit disk/square graphs. Then, in polynomial time, one can output a representation f such that (G, f, H, k) (resp. (G, f, k)) is an instance of SI (resp. Longest Cycle) on clique-grid graphs that is equivalent to (G, O, H, k) (resp. (G, O, k)). We conclude this section by introducing the definition of an ℓ-NCTD, which is useful for doing our dynamic programming algorithms. Definition 3.5. A tree decomposition T = (T, β) of a clique-grid graph G with representation f is a nice ℓ-clique tree decomposition, or simply an ℓ-NCTD, if for the root r of T , it holds that β(r) = ∅, and for each node v ∈ V (T ), it holds that 7 • There exist at most ℓ cells, (i1, j1), . . . , (iℓ, jℓ), such that β(v) =Sℓ • The node v is of one of the following types. t=1 f−1(it, jt), and – Leaf: v is a leaf in T and β(v) = ∅. – Forget: v has exactly one child u, and there exists a cell (i, j) ∈ [t] × [t′] such that – Introduce: v has exactly one child u, and there exists a cell (i, j) ∈ [t] × [t′] such that f−1(i, j) ⊆ β(u) and β(v) = β(u) \ f−1(i, j). f−1(i, j) ⊆ β(v) and β(v) \ f−1(i, j) = β(u) \ f−1(i, j). – Join: v has exactly two children, u and w, and β(v) = β(u) = β(w). A nice ℓ-clique path decomposition, or simply an ℓ-NCPD, is an ℓ-NCTD where T is a path. In this context, for convenience, we use the notation referring to a sequence presented in Section 2. 4 The Cell Graph of a Clique-Grid Graph In this section, we introduce two compact representations of clique-grid graphs. By examining these representations, we are able to infer information on the structure of clique-grid graphs that are also unit disk/square graphs. Definition 4.1 (backbone). Given a clique-grid graph G with representation f : V (G) → [t] × [t′], an induced subgraph H of G is a backbone for (G, f ) if for every two distinct cells (i, j), (i′, j′) ∈ [t] × [t′] for which there exist u ∈ f−1(i, j) and v ∈ f−1(i′, j′) such that {u, v} ∈ E(G), there also exist u′ ∈ f−1(i, j) and v′ ∈ f−1(i′, j′) such that {u′, v′} ∈ E(H). If no induced subgraph of H is a backbone for (G, f ), then H is a minimal backbone for (G, f ). First, we bound the maximum degree of a minimal backbone. Lemma 4.2. Let G be a clique-grid graph with representation f , and let H be a minimal backbone for (G, f ). Then, for all (i, j) ∈ [t] × [t′], it holds that f−1(i, j) ∩ V (H) ≤ 24. Furthermore, the maximum degree of H is at most 599. Proof. By Condition 2 in Definition 3.1, we have that for all cells (i, j) ∈ [t] × [t′], it holds that f−1(i, j) ∩ V (H) ≤ {(i′, j′) ∈ [t] × [t′] \ {(i, j)} i − i′ ≤ 2,j − j′ ≤ 2} ≤ 24. Thus, for all (i, j) ∈ [t] × [t′], the degree in H of a vertex in f−1(i, j) ∩ V (H) is bounded by ( [(i′,j ′)∈[t]×[t′] f−1(i, j) ∩ V (H)) \ {v} ≤ {(i′, j′) ∈ [t] × [t′] i − i′ ≤ 2,j − j′ ≤ 2} · 24 − 1 i−i′≤2 j−j ′≤2 = 25 · 24 − 1 = 599 Note that it is easy to compute a minimal backbone. The most naive computation simply initializes H = G; then, for every vertex v ∈ V (G), it checks if the graph H \ {v} has the same backbone as H, in which case it updates H to H \ {v}. Thus, we have the following. Observation 4.3. Given a clique-grid graph G with representation f , a minimal backbone H for (G, f ) can be computed in polynomial time. To analyze the treewidth of a backbone, we need the following.1 1The paper [25] does not consider unit square graphs, but the arguments it presents for unit disk graphs can be adapted to handle unit square graphs as well. 8 Proposition 4.4 ([25]). Any unit disk/square graph with maximum degree ∆ contains a grid as a minor. tw 100∆3 × tw 100∆3 Thus, we have the following. ℓ Lemma 4.5. Given a clique-grid graph G that is a unit disk/square graph, a representation f of G and an integer ℓ ∈ N, in time 2O(ℓ) · nO(1), one can either correctly conclude that G contains 100 · 5993 × 100 · 5993 grid as a minor, or obtain a minimal backbone H for (G, f ) with a nice a tree decomposition T of width at most 5k. Proof. By Lemma 4.2, Observation 4.3 and Proposition 4.4, in polynomial time, one can compute ℓ ℓ ℓ 100 · 5993 × a minimal backbone of H such that H either contains a 100 · 5993 grid as a minor or has treewidth at most ℓ. Since H is a subgraph of G, it holds that if H contains an a × b grid as a minor, then G also contains an a × b grid as a minor. Thus, by Propositions 2.5 and 2.3, we conclude the proof of the lemma. We use Lemma 4.5 with ℓ = O(√k). Next, we define a more compact representation of a clique-grid graph. Definition 4.6 (cell graph). Given a clique-grid graph G with representation f : V (G) → [t]× [t′], the cell graph of G, denoted by cell(G), is the graph on the vertex-set {vi,j : i ∈ [t], j ∈ [t′], f−1(i, j) 6= ∅} and edge-set {{vi,j , vi′,j ′} : (i, j) 6= (i′, j′),∃u ∈ f−1(i, j)∃v ∈ f−1(i′, j′) such that {u, v} ∈ E(G)}. By Definitions 4.1 and 4.6, we directly conclude the following. Observation 4.7. For a clique-grid graph G, a representation f of G and a backbone H for (G, f ), it holds that cell(G) is a minor of H. Since for any graph G and a minor H of G, it holds that tw(H) ≤ tw(G), we have the following. Observation 4.8. For a clique-grid graph G, a representation f of G and a backbone H for (G, f ), it holds that tw(cell(G)) ≤ tw(H). Overall, from Lemma 4.5 and Observation 4.8, we directly have the following. Lemma 4.9. Given a clique-grid graph G that is a unit disk/square graph, a representation f of G and an integer ℓ ∈ N, in time 2O(ℓ) · nO(1), one can either correctly conclude that G contains a 100 · 5993 × 100 · 5993 grid as a minor, or compute a nice tree decomposition of cell(G) of width at most 5ℓ. ℓ ℓ Note that a nice tree decomposition of cell(G) of width 5ℓ corresponds to a 5ℓ-NCTD of G. In other words, Lemma 4.9 implies the following. Corollary 4.10. Given a clique-grid graph G that is a unit disk/square graph, a representation f of G and an integer ℓ ∈ N, in time 2O(ℓ) · nO(1), one can either correctly conclude that G contains 100 · 5993 × a 100 · 5993 grid as a minor, or compute a 5ℓ-NCTD of G. ℓ ℓ 9 5 Turing Kernels For the sake of uniformity, throughout this section, we denote an instance (G, O, k) ((G, f, k)) of Longest Cycle on unit disk/square graphs (resp. clique-grid graphs) also by (G, O, H, k) (resp. (G, f, H, k)) where H is the empty graph. Our objective is to show that both SI and Longest Cycle on unit disk/square graphs admit a Turing kernel. More precisely, we prove the following. Theorem 5.1. Let (G, O, H, k) be an instance of SI ( Longest Cycle) on unit disk/square graphs. Then, in polynomial time, one can output a set I of instances of SI (resp. Longest Cycle) on unit disk/square graphs such that (G, O, H, k) is a Yes-instance if and only if at least one instance in I is a Yes-instance, and for all (bG, bO, bH,bk) ∈ I, it holds that V (bG) = O(k3), E(bG) = O(k4), bH = H and bk = k. Definition 5.2. Let G be a clique-grid graph with representation f : V (G) → [t] × [t′], H′ be a subgraph of G, and ℓ ∈ N. We say that H′ is ℓ-stretched if there exist cells (i, j), (i′, j′) ∈ [t] × [t′] such that the following conditions are satisfied. To prove Theorem 5.1, we first need two definitions. • It holds that i − i′ ≥ 2ℓ or j − j′ ≥ 2ℓ (or both). • It holds that V (H′) ∩ f−1(i, j) 6= ∅ and V (H′) ∩ f−1(i′, j′) 6= ∅. Definition 5.3. Let I = (G, f : V (G) → [t] × [t′], k) be an instance of Longest Cycle on clique- grid graphs. We say that I is a stretched instance if G has a cycle C that is ℓ-stretched for some ℓ ≥ 2k. We proceed by proving two claims concerning solutions to Longest Cycle and SI on clique- grid graphs. Lemma 5.4. Let I = (G, f : V (G) → [t] × [t′], H, k) be an instance of SI on clique-grid graphs. Then, for any subgraph H′ of G that is isomorphic to H, it holds that H′ is not 2k-stretched. Proof. Let H′ be a subgraph of G that is isomorphic to H. Denote imin = min{i ∈ [t] : (Sj∈[t′] f−1(i, j))∩ : (Sj∈[t′] f−1(i, j)) ∩ V (H′) 6= ∅}, jmin = min{j ∈ [t′] V (H′) 6= ∅}, imax = max{i ∈ [t] (Si∈[t] f−1(i, j)) ∩ V (H′) 6= ∅} and jmax = max{j ∈ [t′] : (Si∈[t] f−1(i, j)) ∩ V (H′) 6= ∅}. To prove that H′ is not 2k-stretched, we need to prove that imax − imin < 2k and jmax − jmin < 2k. We only prove that imax − imin < 2k, as the proof that jmax − jmin < 2k is symmetric. Let i1 < i2 < ··· < iℓ for the appropriate ℓ be the set of indices i ∈ [t] such thatSj∈[t′] f−1(i, j))∩ V (H′) 6= ∅}. Note that i1 = imin and iℓ = imax. We claim that for all r ∈ [ℓ − 1], it holds that ir+1 − ir ≤ 2. Suppose, by way of contradiction, that there exists r ∈ [ℓ− 1] such that ir+1 − ir > 2. Recall that H is a connected graph, and therefore H′ is also a connected graph. Thus, there exists an edge {u, v} ∈ E(H′) ⊆ E(G) and indices i ≤ ir and i′ ≥ ir+1 such that u ∈Sj∈[t′] f−1(i, j)) and v ∈Sj∈[t′] f−1(i′, j)). However, this contradicts the fact that f is a representation of G. Now, since for all r ∈ [ℓ − 1], we proved that ir+1 − ir ≤ 2, we have that that there exist at + 1 indices i ∈ [t] such that Sj∈[t′] f−1(i, j)) ∩ V (H′) 6= ∅. However, V (H) ≤ k. imax − imin least : Therefore 2 imax − imin 2 + 1 ≤ k, which implies that imax − imin < 2k. Lemma 5.5. Let I = (G, f : V (G) → [t]×[t′], k) be an instance of Longest Cycle on clique-grid graphs. Then, it can be determined in polynomial time whether I is a stretched instance, in which case it is also a Yes-instance. 10 Proof. It is well known that for any given graph and pair of vertices in this graph, one can determine (in polynomial time) whether the given graph has a cycle that contains both given vertices by checking whether there exists a flow of size 2 between them (see, e.g., [5]). Thus, by considering every pair (u, v) of vertices in V (G) such that i − i′ ≥ 2k or j − j′ ≥ 2k (or both) where f (u) = (i, j) and f (v) = (i′, j′), we can determine (in polynomial time) whether I is a stretched instance. Now, suppose that I is a stretched instance. Then, G has a cycle C that is ℓ-stretched for some ℓ ≥ 2k. Note that I′ = (G, f, C,V (C)) is a Yes-instance of SI on clique-grid graphs. Thus, by Lemma 5.4, it holds that C is not 2V (C)-stretched. Therefore, ℓ < 2V (C), and since ℓ ≥ 2k, we conclude that k < V (C). Thus, I is a Yes-instance. Next, we prove a statement similar to the one of Theorem 5.1, but which concerns clique-grid graphs. Our method is inspired by Baker's technique [3]. Lemma 5.6. Let I = (G, f : V (G) → [t] × [t′], H, k) be an instance of SI ( Longest Cy- cle) on clique-grid graphs. Then, in polynomial time, one can output a set I of instances of SI (resp. Longest Cycle) on clique-grid graphs such that (G, f, H, k) is a Yes-instance if and only if at least one instance in I is a Yes-instance, and for all (bG, bf : V (bG) → [bt] × [bt′], bH,bk) ∈ I, it holds that bG is either an induced subgraph of G or Kbk, bt,bt′ ≤ 2k = O(bk), bf−1(i, j) <bk for any cell (i, j) ∈ [t] × [t′], bH = H and bk = k. Proof. First, suppose that there exists a cell (i, j) ∈ [t] × [t′] such that f−1(i, j) ≥ k, then by Definition 3.1, G[f−1(i, j)] is a clique on at least k vertices. In particular, the pattern H is a subgraph of G[f−1(i, j)], and therefore it is also a subgraph of G. Thus, in this case, we conclude the proof by setting I to be the set that contains only one instance, (Kk, bf : V (Kk) → [1]×[1], H, k). From now on, suppose that for all cells (i, j) ∈ [t] × [t′], it holds that f−1(i, j) < k. Second, in case the input instance I is of Longest Cycle, we use the computation given by Lemma 5.5 to determine whether I is a stretched instance. If the answer is positive, then by Lemma 5.5, it holds that I is a Yes-instance. In this case, we again conclude the proof by setting also suppose that if the input instance I is of Longest Cycle, then it is not stretched . I to be the set that contains only one instance, (Kk, bf : V (Kk) → [1] × [1], H, k). From now on, Now, our kernelization algorithm works as follows. For every (p, q) ∈ [t] × [t′], it computes Gp,q = G[ f−1(i, j)]. [ p≤i<min{p+2k,t+1} q≤j<min{q+2k,t′+1} Accordingly, it computes fp,q : V (Gp,q) → [min{2k, t}] × [min{2k, t′}] as follows. For every v ∈ V (Gp,q), compute fp,q(v) = (i − p + 1, j − q + 1) where (i, j) = f (v). Note that for all (i, j) ∈ p,q (i, j) = f−1(i + p − 1, j + q − 1). Thus, since f is [min{2k, t}] × [min{2k, t′}], it holds that f−1 a representation of G, it holds that fp,q is a representation of Gp,q. Finally, our kernelization algorithm outputs I = {Ip,q = (Gp,q, fp,q, H, k) : (p, q) ∈ [t] × [t′]}. To conclude the proof, it remains to show that (G, f, H, k) is a Yes-instance if and only if at least one instance in I is a Yes-instance. Since for all (Gp,q, fp,q, H, k) ∈ I, it holds that Gp,q is an induced subgraph of G, we have that if (G, f, H, k) is a No-instance, then every instance in I is No-instance as well. Next, suppose that (G, f, H, k) is a Yes-instance. Let us consider two cases. • (G, f, H, k) is an instance of SI. Then, let H′ be a subgraph of G that is isomorhpic to H. Denote imin = min{i ∈ [t] : (Sj∈[t′] f−1(i, j)) ∩ V (H′) 6= ∅}, imax = max{i ∈ [t] : (Sj∈[t′] f−1(i, j)) ∩ V (H′) 6= ∅}, jmin = min{j ∈ [t′] : (Si∈[t] f−1(i, j)) ∩ V (H′) 6= ∅} and 11 jmax = max{j ∈ [t′] : (Si∈[t] f−1(i, j)) ∩ V (H′) 6= ∅}. By Lemma 5.4, it holds that both imax − imin < 2k and jmax − jmin < 2k. Therefore, H′ is a subgraph of Gimin,jmin, which implies that Ip,q is a Yes-instance. • (G, f, H, k) is an instance of Longest Cycle. Then, let C be a subgraph of G that is a cycle on at least k vertices. Denote imin = min{i ∈ [t] : (Sj∈[t′] f−1(i, j))∩ V (C) 6= ∅}, imax = max{i ∈ [t] : (Sj∈[t′] f−1(i, j))∩V (C) 6= ∅}, jmin = min{j ∈ [t′] : (Si∈[t] f−1(i, j))∩V (C) 6= ∅} and jmax = max{j ∈ [t′] : (Si∈[t] f−1(i, j)) ∩ V (C) 6= ∅}. Since (G, f, H, k) is not stretched, it holds that both imax − imin < 2k and jmax − jmin < 2k. Therefore, C is a subgraph of Gimin,jmin, which implies that Ip,q is a Yes-instance. Towards proving Theorem 5.1, we extract a claim that is reused in Sections 6 and 7. Corollary 5.7. Let (G, O, H, k) be an instance of SI ( Longest Cycle) on unit disk/square graphs. Then, in polynomial time, one can output a set I of instances of SI (resp. Longest Cycle) on clique-grid graphs such that (G, O, H, k) is a Yes-instance if and only if at least one instance in I is a Yes-instance, and for all (bG, bf , bH,bk) ∈ I, it holds that bG is either an induced subgraph of G or Kbk, bt,bt′ = O(bk), bf−1(i, j) <bk for any cell (i, j) ∈ [bt] × [bt′], bH = H and bk = k. Proof. First, by Corollary 3.4, we obtain (in polynomial time) an instance (G, f, H, k) of SI (Longest Cycle) on clique-grid graphs that is equivalent to (G, O, H, k). Then, by Lemma 5.6 with (G, f, H, k), we obtain (in polynomial time) the desired set I. We are now ready to prove Theorem 5.1. Proof of Theorem 5.1. First, by Corollary 5.7, we obtain (in polynomial time) a set I of instances of SI (Longest Cycle) on clique-grid graphs such that (G, O, H, k) is a Yes-instance if and only if at least one instance in I is a Yes-instance, and for all (bG, bf , bH,bk) ∈ I, it holds that bG is either an induced subgraph of G or Kbk, bt,bt′ = O(bk2), bf−1(i, j) ≤bk for a cell (i, j) ∈ [bt] × [bt′], bH = H and bk = k. Thus, to conclude our proof, it is sufficient to show that for any instance (bG, bf , bH,bk) ∈ I, we can compute (in polynomial time) an equivalent instance (G′, O′, H′, k′) of SI (Longest Cycle) on unit disk/square graphs such that O′ = O(k′3), H′ = H and k′ = k. To this end, fix some instance (bG, bf , bH,bk) ∈ I. Let us first handle the simple case where bG is equal to Kbk. Here, we conclude the proof by defining p′i = (0, i/k) for i ∈ [k], and then setting O′ = {p′i : i ∈ [k]}. Now, suppose that bG is an induced subgraph of G. Then, we have that V (bG) ⊆ O, and the unit disk/square graph of V (bG) is exactly bG. Thus, we define (G′, O′, H′, k′) = (bG, V (bG), bH,bk). It remains to show that V (bG) = O(k3),E(bG) = O(k4). V (bG) = X(i,j)∈[bt]×[bt′] By Definition 3.1, it holds that f−1(i, j). Thus, since bt,bt′ = O(k) and bf−1(i, j) ≤ k for (i, j) ∈ [bt] × [bt′], we have that V (bG) = O(k3). Now, denote X = {((i, j), (i′, j′)) : i, i′ ∈ [t], j, j′ ∈ [t′],i−i′ ≤ 2,j−j′ ≤ 2}. Sincebt,bt′ = O(k), we have that X = O(k2). By Definition 3.1, it also holds that E(bG) ≤ X((i,j),(i′,j ′))∈X f−1(i, j) · f−1(i′, j′). Thus, since X = O(k2), and bf−1(i, j) ≤ k for (i, j) ∈ [bt] × [bt′], we have that E(bG) = O(k4). 12 6 Exact k-Cycle In this section we prove the following theorem. Theorem 6.1. Exact k-Cycle on unit disk/square graphs can be solved in 2O(√k log k) · nO(1) time. Towards proving Theorem 6.1, we design an algorithm which given a clique-grid graph G along with its representation f : V (G) → [t] × [t′] and an integer k as input, runs in time 2O(√k log k)V (G)O(1) and decides whether G has a cycle of length k or not. In Section 5 (Lemma 5.6) we have seen that SI admits a polynomial sized Turing kernel on clique-grid graphs. Hence to give an algorithm of running time 2O(√k log k)V (G)O(1), we can restrict to instances of size bounded by polynomial in k. More precisely, because of Lemma 5.6, we can assume that the input to our algorithm is (G, f : V (G) → [t] × [t′], k) where G is a clique-grid graph with a representation f , f−1(i, j) < k for all (i, j) ∈ [t] × [t′] and t, t′ ≤ 2k. Without loss of generality we can assume that f is a function from V (G) to [2k] × [2k], because [t] × [t′] ⊆ [2k] × [2k]. Given an instance (G, f : V (G) → [2k] × [2k], k), the algorithm applies a method inspired by Baker's technique [3] and obtains a family, F , of 2O(√k log k) instances of Exact k-Cycle. The family F has following properties. 1. In each of these instances the input graph is an induced subgraph of G and has size kO(1). 2. The input (G, f : V (G) → [2k] × [2k], k) is a Yes-instance if and only if there exists an instance (H, f∗ : V (H) → [2k] × [2k], k) ∈ F which is a Yes-instance. 3. More over, for any instance (H, f∗ : V (H) → [2k] × [2k], k) ∈ F , H has a nice 7√k-clique path decomposition (7√k-NCPD). We will call the family F satisfying the above properties as good family. Let (H, f∗ : V (H) → [2k] × [2k], k) be an instance of F . Let P = (X1, . . . , Xq) be a 7√k-NCPD of H. We first prove that if there is a cycle of length k in H, then there is a cycle C of length k in H such that for any two distinct cells (i, j) and (i′, j′) of f , the number of edges with one end point in (i, j) and other in (i′, j′) is at most 4. Let C be such a cycle in H. Then using the property of C we get the following important property. For any i ∈ [q], the number of edges of V (C) with one end point in Xi and other in Si<j≤q Xj is upper bounded by O(√k). The above mentioned property allows us to design a dynamic programming (DP) algorithm over 7√k-NCPD, P, for Exact k-Cycle in time 2O(√k log k). Now we are ready to give formal details about the algorithm. As explained before, we assume that the number of vertices in the input graph is bounded by kO(1). Lemma 6.2. Let (G, f : V (G) → [2k] × [2k], k) be an instance of Exact k-Cycle, where G is a clique-grid graph with representation f , f−1(i, j) < k for all (i, j) ∈ [2k]× [2k] and V (G) = kO(1). Given (G, f : V (G) → [2k] × [2k], k), there is an algorithm running in time 2O(√k log k) that outputs a good family F . 13 j=i·2ℓ+1 i j=1 ⌈ Proof. Let C be a k length cycle in G. First we define a column of the 2k×2k grid. For any j ∈ [2k] the set of cells {(i, j) : i ∈ [2k]} is called a column. There are 2k columns for the 2k × 2k grid. We partition 2k columns of the 2k × 2k grid with k blocks of two consecutive columns and label them from the set of labels [√k]. That is, each pair of columns 2i − 1 and 2i, where i ∈ [k] is labelled with i mod √k. In other words both column 2i − 1 and 2i are labelled with i mod √k. Then by pigeon hole principle there is a label ℓ ∈ {1, 2, . . . ,√k} such that the number of vertices from V (C) which are in columns labelled ℓ is at most √k. As V (G) ≤ kO(1), the number of vertices of G in columns labelled ℓ is at most kO(1). We guess the vertices of V (C) which are in the columns labelled ℓ. The number of potential guesses is bounded by kO(√k). Let Y be the set of guessed vertices of V (C) which are in the columns labelled by ℓ. Notice that Y ≤ √k. Then we delete all the vertices in columns labelled ℓ, except the vertices of Y . Let S be the set of deleted vertices. By the property 2 of clique-grid graph, G\(S∪Y ) is a disjoint union of clique-grid graphs each of which is represented by a function with at most 2√k columns. That is, let G1 = G[S2(ℓ−1) f−1(∗, j)], and Gi+1 = G[Smin{i·2ℓ+2√k,2k} f−1(∗, j)] for all i ∈ {1, . . . ,⌈√k⌉}. Notice that Gi is clique-grid graph with representation fi : V (Gi) → [2k]×[2√k] defined as, fi(u) = (r, j), when f (u) = (r, (i−1)2ℓ+j). ⌈√k⌉+1. By the property 2 of clique-grid graph, G \ (S ∪ Y ) = G1 ⊎ . . . ⊎ G Claim 6.3. G \ S has a nice 7√k-clique path decomposition (7√k-NCPD). Proof. First, for each i ∈ {1, . . . ,⌈√k⌉ + 1}, we define a path decomposition of Gi such that each √k⌉−1, and Y ≤ √k, bag is a union of at most 6√k many cells of fi. As G\ (S ∪ Y ) = G1 ⊎ . . .⊎ G by adding Y to each bag of all path decompositions we can get a required nice 7√k-clique path decomposition for G \ S. Now, for each Gi, we define a path decomposition Pi = (Xi,1, Xi,2, . . . Xi,2k−2) where Xi,j = (j,∗) ∪ f−1 f−1 (j + 2,∗). We claim that Pi is indeed a path decomposition of i Gi. Notice that Sk−1 (∗,∗) = V (Gi). By property 2 of clique-grid graph, we have that for each edge {u, v} ∈ E(G), there exists j ∈ [2k − 2] such that {u, v} ∈ Xi,j. For each u ∈ V (G), u is contained in at most three bags and these bags are consecutive in the sequence (Xi,1, Xi,2, . . . Xi,2k−2). Hence Pi is a path decomposition of Gi. Since Xi,j = f−1 (j + (j + 2,∗), number of columns in fi is at most 2√k and each cell of fi is a cell of f , 1,∗) ∪ f−1 each Xi,j is a union of 6√k many cells of f . Since G \ (S ∪ Y ) = G1 ⊎ . . . ⊎ G ⌈√k⌉+1, the sequence P′ = (X1,1, . . . X1,2k−2, X2,1, . . . X2,2k−2, . . . , X ⌈√k⌉−1,2k−2) is a path decomposition of G \ (S ∪ Y ). More over, the vertices of each bag is a union of vertices from at most 6√k cells of f . Also, since Y ≤ √k, the sequence P = (X1,1 ∪ Y, . . . X1,k−2 ∪ Y, . . . X ⌈√k⌉−1,k−2 ∪ Y ) obtained by adding Y to each bag of P′ we get a path decomposition of G \ S. More over, the vertices of each bag in P is a union of vertices from at most 7√k cells of f . We can turn the path decomposition P to a 7√k-NCPD by an algorithm similar to the one mentioned in Proposition 2.5. Our algorithm will construct a family F as follows. For each ℓ ∈ {1, . . . ,⌈√k⌉} and for two subsets of vertices S and Y such that S ∪ Y is a set of vertices in the columns labelled ℓ and Y ≤ √k, our algorithm will include an instance (G \ S, fV (G)\S , k) in F . The number of choices of S and Y is bounded by 2O(√k log k) and thus the size of F is bounded by 2O(√k log k). pigeon hole principle there is ℓ ∈ {1, . . . ,⌈√k⌉} such that at most √k vertices from V (C) are in the columns labelled by ℓ. Let S′ be the set of vertices in the columns labelled by ℓ. Let Y = S′ ∩ V (C) and S = S′ \ Y . Notice that Y ≤ √k. The instance (G \ S, fV (G)\S , k) in F , is a Yes instance. This completes the proof of the lemma. We claim that F is indeed a good family. Suppose there is a cycle C of length k in G. Then, by (j + 1,∗) ∪ f−1 ⌈√k⌉−1,1, . . . X j=1 Xi,j = f−1 i i (j,∗) ∪ f−1 i i i 14 ur • • ur′ vr • • vr′ ur • • ur′ vr • • vr′ Figure 1: Illustration of Lemma 6.4. Figure on the left is the cycle C = [urvr]Q1[ur′vr′]Q2 and the one on the right is the cycle C′ = [urur′]←−Q 1[vrvr′]Q2 Now we can assume that we are solving Exact k-Cycle on (H, f, k), where (H, f, k) ∈ F (here we rename the function fV (H) with f for ease of presentation). Now we prove that if there is a cycle of length k in H, then there is a cycle C of length k in H such that for any two cells (i, j) and (i′, j′) of f , the number of edges of E(C) with one end point in (i, j) and other (i′, j′) is at most 5. Lemma 6.4. Let (H, f : V (H) → [2k] × [2k], k) be a Yes instance of Exact k-Cycle. Then there is a cycle C of length k in H such that for any two distinct cells (i, j) and (i′, j′) of f , the number of edges of E(C) with one end point in (i, j) and other (i′, j′) is at most 5. Proof. Let C be a k length cycle such that the number edges of E(C) whose end points are in different cells is minimized. We claim that for any two disjoint cells (i, j) and (i′, j′), the number of edges of E(C) with one end point in (i, j) and other (i′, j′) is at most 4. Suppose not. Then there exist (i, j) and (i′, j′) such that the number of edges of E(C) with one end point in (i, j) and other in (i′, j′) is at least 6. Let C = P1[u1v1]P2[u2v2]P3[u3v3]P4[u4v4]P5[u5v5]P6[u6v6] where for each {ur, vr}, r ∈ [6], one end point is in the cell (i, j) and other in the cell (i′j′), and each subpath Pℓ, ℓ ∈ [6], can be empty too. Since C is a cycle, at least 3 edges from {{ur, vr} : i ∈ [6]} form a matching. Let {ur1, vr1},{ur2 , vr2} and {ur3, vr3} be a matching of size 3, where {r1, r2, r3} ⊆ [6]. Then, by pigeon hole principle there exist r, r′ ∈ {r1, r2, r3} such that either ur, ur′ ∈ f−1(i, j) or ur, ur′ ∈ f−1(i′, j′). Without loss of generality assume that ur, ur′ ∈ f−1(i, j) (otherwise we rename cell (i, j) with (i′, j′) and vice versa). That is, C = [urvr]Q1[ur′vr′]Q2 such that ur, ur′ ∈ f−1(i, j) and vr, vr′ ∈ f−1(i′, j′). Then, since f−1(i, j) and f−1(i′, j′) are cliques, C′ = [urur′]←−Q 1[vrvr′]Q2 is a k length cycle in G, such that the number edges of E(C′) whose end points are in different cells is less than that of E(C), which is contradiction to our assumption. See Fig. 1 for an illustration of C and C′. This completes the proof of the lemma. Next we design a DP algorithm that finds a cycle of length k, if it exists, satisfying properties of Lemma 6.4. Lemma 6.5. Let (H, f : V (H) → [2k] × [2k], k) ∈ F be an instance of Exact k-Cycle and P be a 7√k-NCPD of H. Then, given (H, f : V (H) → [2k] × [2k], k) and P, there is an algorithm A which runs in time 2O(√k log k), and outputs Yes, if there is a cycle C in H such that for any two distinct cells (i, j) and (i′, j′) of f , the number of edges with one end point in (i, j) and other (i′, j′) is at most 5. Otherwise algorithm A will output No. 15 Proof. Algorithm A is a DP algorithm over the 7√k-NCPD P = (X1, . . . Xq) of H. For any ℓ ∈ [q], we define Hℓ be the induced subgraph H[Si≤ℓ Xi] of H. Define C to be the set of k length cycles in H such that for any C ∈ C and two disjoint cells (i, j) and (i′, j′) of f , the number of edges of E(C) with one end point in (i, j) and other (i′, j′) is at most 5. Let C ∈ C. Since P is a 7√k-NCPD and the fact that for any two distinct cells (i, j) and (i′, j′) of f , the number of edges of C with one end point in (i, j) and other (i′, j′) is at most 5, we have that for any bag Xℓ of P, the number of vertices of V (C) ∩ Xℓ which has a neighbour in V (H) \ Xℓ is bounded by O(√k). This allows us to keep only 2O(√k log k) states in the DP algorithm. Fix any ℓ ∈ [q] and define CL bCL = {{u, v} there is a u-v path in CL}. Notice that SP∈ bCL P ⊆ Xℓ. Since Xℓ is a union of vertices from at most 7√k many cells of or 1 in CL and SP∈ bCL P is at most 5· 24· 7√k = 840√k. In our DP algorithm we will have that the cardinality ofSP∈ bCL state indexed by (ℓ, bCL,E(CL)) which will be set to 1. Formally, for any ℓ ∈ [q], k′ ∈ [k] and a family Z of vertex disjoint sets of size at most 2 of Xℓ with the property that the cardinality of SZ∈Z Z is at most 840√k, we will have a DP table entry A[ℓ,Z, k′]. For each ℓ ∈ [q], we maintain the following correctness invariant. f and for any two distinct cells (i, j) and (i′, j′) of f , the number of edges of E(C) with one end point in (i, j) and other (i′, j′) is at most 5, and by property 2 of the clique-grid graph, we have the set of paths of C (or the cycle C itself) when we restrict C to Hℓ. That is CL = Hℓ[E(C)]. Let P is the set of vertices of degree 0 Correctness Invariants: (i) For every C ∈ C, let CL = Hℓ[E(C)] and bCL = {{u, v} there is a connected component P in CL and P is a u-v path as well}. Then A[ℓ, bCL,E(CL)] = 1, (ii) for any family Z of vertex disjoint sets of size at most 2 of Xℓ with 0 < SZ∈Z Z ≤ 840√k, k′ ∈ [k], and A[ℓ,Z, k′] = 1, there is a set Q of Z vertex disjoint paths in Hℓ where the end points of each path are specified by a set in Z and E(Q) = k′, and (iii) If A[ℓ,∅, k] = 1, then there is a cycle of length k in Hℓ. The correctness of the our algorithm will follow from the correctness invariant. Before explaining the computation of DP table entries, we first define some notations. Fix ℓ ∈ [q]. For any C ∈ C, define CL = Hℓ[E(C)] and CR = H[E(C) \ E(CL)]. For any family Q of vertex disjoint paths with end points in Xℓ, define bQ = {{u, v} there is a u-v path in Q}. That is, for any C ∈ C, bCL = {{u, v} there is a u-v path in CL}. Now we explain how to compute the values A[·,·,·]. In what follows we explain how to compute A[ℓ,Z, k′] for every ℓ ∈ [q], k′ ∈ [k] and family Z of vertex disjoint sets of size at most 2 of Xℓ with SZ∈Z Z ≤ 840√k, the running to compute it from the previously computed DP table entries, and prove the correctness invariants. While proving the correctness invariants for ℓ, we assume that the correctness invariant holds for ℓ − 1. When ℓ = 1, X1 = ∅ and the DP table entries are defined as follows. A[1,∅, k′] =(cid:26) 1 if k′ = 0 0 otherwise Since H1 = (∅,∅), the correctness invarient follows. The values A[1,∗,∗] can be computed in O(1) time. Now we move to the case where ℓ > 1. Case 1: Xℓ is an Introduce bag. That is Xℓ = Xℓ−1 ∪ f−1(i, j) for some cell (i, j). Fix a family Z of vertex disjoint sets of size at most 2 of Xℓ such that SZ∈Z Z is at most 840√k and k′ ∈ [k]. Define Qℓ(r) to be the set Q of vertex disjoint paths in H[Xℓ \ Xℓ−1] = H[f−1(i, j)] with at most 120 end points and E(Q) = r. Recall that that bQ = {{u, v} there is a u-v path in Q}. Define bQℓ(r) = {bQ : Q ∈ Qℓ(r)}. 16 Claim 6.6. bQℓ(r) = kO(1) and bQℓ(r) can be enumerated in time kO(1). Proof. We know that H[Xℓ \ Xℓ−1] is a clique on f−1(i, j). For any family W of vertex disjoint sets of size at most 2 of f−1(i, j), one can get W vertex disjoint paths with end points being the one specified by the sets in W with total number of edges r, only if either {W ∈ W : W = 2} = r W = 2} + f−1(i, j) \SW∈W W ≥ r. Hence or 1 ≤ {W ∈ W : we can enumerate bQℓ(r) in time kO(1) For any family Y of sets of size at most 2, define Y′ = {A ∈ Y : A = 2}. For any three families Y1,Y2 and Y3 of sets of size at most 2 in Xℓ, we say that Y1 ∪ Y2 ∪ Y3 for a family of Y,Si∈[3] Y′i) form a family of paths paths (respectively, a cycle) in G′ = K[Xℓ], if the graph (S i∈[3] (respectively, a cycle). Consider the case when Z 6= ∅. W = 2} < r and {W ∈ W : Y ∈Yi Otherwise, If Z ∈ bQℓ(k′), then we set A[ℓ,Z, k′] = 1 A[ℓ,Z, k′] = max n A[ℓ − 1,Z′, k′′] E′ ⊆ E  [Q∈ bQ Z′ ∪ bQ ∪ E′ forms a set R of paths in K[Xℓ], and bR = Zo : Z′ 6= ∅ and there exist r ∈ N, bQ ∈ bQℓ(r), Q, [Z∈cZ ′ Z  such that ,E′ ≤ 120, k′ = k′′ + r + E′, Now consider that case when Z = ∅. Otherwise If A[ℓ − 1,∅, k′] = 1, then we set A[ℓ,∅, k′] = 1 (1) (2) (3) (4) A[ℓ,∅, k′] = max n A[ℓ − 1,Z′, k′′] E′ ⊆ E  [Q∈ bQ k′ = k′′ + r + E′, and Z′ ∪ bQ ∪ E′ forms a cycle in K[Xℓ]o : there exist r ∈ N, bQ ∈ bQℓ(r), Z Q, [Z∈cZ ′  such that ,E′ ≤ 120, Notice that in the above computation (Equations 2 and 4) the number of potential choices for Z′ is bounded by 2O(√k log k). By Claim 6.6 we know that the cardinality of bQℓ(r) is at most kO(1) and it can be enumerated in time kO(1). Since Xℓ = kO(1), the number of choices for E′ is the above computation is bounded by kO(1). This implies that we can compute A[ℓ,Z, k′] using previously computed DP entries in time 2O(√k log k). Before proving the correctness invariant, we state the following simple claim, which can be proved using induction of ℓ. Claim 6.7. For any ℓ ∈ [q], A[ℓ,∅, 0] = 1. 17 L Now we prove the correctness invariants. Let C ∈ C. Recall that CL = Hℓ[E(C)] and bCL = {{u, v} there is a connected component P in CL and P is a u-v path as well}. Partition the edges CL into E1 ⊎ E2 ⊎ E′ where E1 = E(CL) ∩ E(Hℓ−1), E2 = E(CL) ∩ E(Xℓ \ Xℓ−1) and E′ = E(CL) ∩ E(Xℓ−1, Xℓ \ Xℓ−1). Let C′L = H[E1]. That is, C′L = Hℓ−1[E(C)]. Let bC′L = {{u, v} there is a u-v path in C′L}. We have two cases based whether bCL = ∅ or not. Suppose bCL 6= ∅. If CL is a subgraph of H[Xℓ \ Xℓ−1], then bCL ∈ bQ(E(CL)). Then by Equation 1, we have that A[ℓ, bCL,E(CL)] = 1. So now we have that CL is not a subgraph of H[Xℓ \ Xℓ−1]. This implies that either E1 6= ∅ or E2 6= ∅. In either case, we have that bC′L 6= ∅. Since Xℓ−1 is a union of vertices from 7√k cells, the property 2 of clique-grid graph and C ∈ C, we have that the number of edges with one endpoint Xℓ−1 and other in H \ Xℓ−1 is at most 5 · 24 · 7√k = 840√k. This implies that SD∈ bC ′ D ≤ 840√k. By the correctness invariant of statement (i) for ℓ− 1, we have that (a) A[ℓ− 1, bC′L,E(C′L)] = 1. Consider the graph H[E2]. The graph H[E2] is a collection Q of paths in H[Xℓ \ Xℓ−1] = K[f−1(i, j)]. Since C ∈ C, the number of edges of E(C) with one end point in f−1(i, j) and other in Xℓ−1 is at most 4 · 25 = 120. This implies that (b) E′ ≤ 120 and (c) bQ ∈ bQℓ(r), where r = E(Q). By facts (a), (b) and (c), using Equation 2, we get A[ℓ, bCL,E(CL)] = 1. Now consider the case when bCL = ∅. In this case either E(C) ∩ Hℓ = ∅ or E(C) ⊆ E(Hℓ). If E(C) ∩ Hℓ = ∅, then E(CL) = 0 and hence A[ℓ, bCL,E(CL)] = A[ℓ,∅, 0] = 1, by Claim 6.7. Now we have bCL = ∅ and E(C) ⊆ E(Hℓ). This implies that E(CL) = k. If E(CL) = E(C′L), then A[ℓ−1, bC′L, k] = A[ℓ−1,∅, k] = 1, by the statement (i) of the correctness invariant for ℓ−1. So, now we have E(CL) 6= E(C′L). This implies that either E2 or E′ is not empty. Since f−1(i, j) < k and CL = C form a cycle and E(CL) 6= E(C′L), we have that bC′L 6= ∅. The graph H[E2] is a collection Q D ≤ 840√k, (e) of paths in H[Xℓ \ Xℓ−1] = K[f−1(i, j)]. As like before, we can bound (d) SD∈ bC ′ E′ ≤ 120 and (g) bQ ∈ bQℓ(r), where r = E(Q). By (d) and the statement (i) of the correctness invariant for ℓ− 1, we get (h) A[ℓ− 1, bC′L,E(C′L)] = 1. By facts (h), (e) and (d), using Equation 4, we get A[ℓ, bCL,E(CL)] = A[ℓ,∅, k] = 1. This completes the proof of statement (i). Now we need to prove statement (ii) in the correctness invariants. Let Z be a family of vertex disjoint sets of size at most 2 of Xℓ with 0 < SZ∈Z Z ≤ 840√k and k′ ∈ [k]. Notice that Z 6= ∅. Suppose in the above computation we set A[ℓ,Z, k′] = 1. Either A[ℓ,Z, k′] is set to 1 because of Equation 1 or because of Equation 2. If A[ℓ,Z, k′] is set to 1 because of Equation 1, then we know that Z ∈ bQℓ(k′). By the definition of bQℓ(k′), we get that there is a set R of vertex disjoint paths in H[Xℓ \ Xℓ−1], hence in H[Xℓ] and bR = Z. So, now assume that A[ℓ,Z, k′] is set to 1 because of Equation 2. This implies that there exist k′′, r ∈ N, a family Z′ of vertex disjoint sets of size at most 2 of Xℓ−1, bQ ∈ bQℓ(r), and E′ ⊆ E(cid:16)SQ∈ bQ Q,SZ∈cZ ′ Z(cid:17) such that A[ℓ − 1,Z′, k′′] = 1, E′ ≤ 120, k′ = k′′ + r + E′, Z′ ∪ bQ ∪ E′ forms a set of paths R in K[Xℓ] with bR = Z. Since A[ℓ − 1,Z′, k′′] = 1, by the statement (ii) of the correctness invariant for ℓ − 1, we have that there is a set Y of Z′ vertex disjoint paths in Hℓ−1 where the end points of each path are specified by a set in Z′ and E(Y) = k′′. Let Q be the set of paths in Qℓ(r) corresponding to the set bQ. Thus by replacing each edge of Z′ in Z′ ∪ bQ∪ E′ by the corresponding path in Y and each edge of bQ by a corresponding path in Q, we can get a set W of vertex disjoint paths in Hℓ, because the internal vertices of paths in Y are disjoint from (Xℓ \ Xℓ−1) ∪SZ∈Z Z and the interval vertices of paths in Q are disjoint from Xℓ−1 ∪SZ∈Z Z. More over, cW = Z and E(W) = E(Y) + E(Q) + E′ = k′′ + r + E′ = k′. This completes the proof of statement (ii) in the correctness invariant. Now we prove statement (iii) in the correctness invariants. Suppose we set A[ℓ,∅, k] = 1. Then either A[ℓ,∅, k] is set to 1 because of Equation 3 or because of Equation 4. If A[ℓ,∅, k] is set to L 18 1 because of Equation 1, then we know that A[ℓ − 1,∅, k] = 1, then by the statement (iii) of the correctness invariant for ℓ − 1, we have that there is a cycle of length k in Hℓ−1 and hence in Hℓ. Suppose A[ℓ,∅, k] is set to 1 because of Equation 4. Then, there exist k′′, r ∈ N, a family Z′ of vertex disjoint sets of size at most 2 of Xℓ−1, bQ ∈ bQℓ(r), and E′ ⊆ E(cid:16)SQ∈ bQ Q,SZ∈cZ ′ Z(cid:17) such that A[ℓ − 1,Z′, k′′] = 1, E′ ≤ 120, k = k′′ + r + E′, Z′ ∪ bQ ∪ E′ forms a cycle in K[Xℓ]. Since A[ℓ − 1,Z′, k′′] = 1, by the statement (ii) of the correctness invariant for ℓ − 1, we have that there is a set Y of Z′ vertex disjoint paths in Hℓ−1 where the end points of each path are specified by a set in Z′ and E(Y) = k′′. Let Q be the set of paths in Qℓ(r) corresponding to the set bQ. Thus by replacing each edge of Z′ in Z′ ∪ bQ ∪ E′ by the corresponding path in Y and each edge of bQ by a corresponding path in Q, we can get a cycle C in Hℓ, because the internal vertices of paths in Y are disjoint from (Xℓ \ Xℓ−1) ∪SZ∈Z Z and the interval vertices of paths in Q are disjoint from Xℓ−1 ∪SZ∈Z Z. More over, E(C) = E(Y) + E(Q) + E′ = k′′ + r + E′ = k. This completes Case 2: Xℓ is a forget bag. Fix a family Z of vertex disjoint sets of size at most 2 of Xℓ such that SZ∈Z Z is at most 840√k and k′ ∈ [k]. the proof of statement (iii) in the correctness invariant. A[ℓ,Z, k′] = A[ℓ − 1,Z, k′] (5) Clearly A[ℓ,Z, k′] can be computed in O(1) time using the previously computed DP table entries. Now we prove the correctness invariant. Let C ∈ C. Recall that CL = Hℓ[E(C)] and bCL = {{u, v} there is a connected component P in CL and P is a u-v path as well}. By argu- D ≤ 840√k. Since Hℓ = Hℓ−1, we have that ments similar to those in Case 1, we get SD∈ bCL CL = Hℓ−1[E(C)]. Hence by the correctness invariant for ℓ−1, we have that A[ℓ−1, bCL,E(CL)] = 1. Hence, by Equation 5, A[ℓ − 1, bCL,E(CL)] = 1. Now we need to prove statement (ii) of the correctness invariants. Let Z be a family of vertex disjoint sets of size at most 2 of Xℓ with 0 < SZ∈Z Z ≤ 840√k and k′ ∈ [k]. Suppose in the above computation (Equation 5) we set A[ℓ,Z, k′] = 1. This implies that A[ℓ − 1,Z, k′] = 1. Since A[ℓ− 1,Z, k′] = 1, by the correctness invariant for ℓ− 1, we have that there is a set Y of Z vertex disjoint paths in Hℓ−1 where the end points of each path are specified by a set in Z and E(Y) = k′. Since Hℓ = Hℓ−1, Y is the required set of vertex disjoint paths and this completes the proof of statement (ii) in the correctness invariant. Now we prove the statement (iii) in the correctness invariants. Suppose in the above computa- tion (Equation 5) we set A[ℓ,∅, k] = 1. This implies that A[ℓ − 1,∅, k] = 1 Since A[ℓ − 1,∅, k] = 1, by the correctness invariant for ℓ − 1, we have that there is k length cycle in Hℓ−1, and hence in Hℓ. This completes the proof of correctness invariants. Algorithm A output Yes if A[q,∅, k] = ∅ and a output No otherwise. The correctness of the algorithm follows from the correctness invariants. Now we analyse the total running time. Notice that V (H) = kO(1) and number of DP table entries is bounded by 2O(√k log k). Each DP table entry can be computed in time 2O(√k log k) using the previously stored values in the DP table. Hence the total running time of the algorithm is 2O(√k log k). Lemmata 5.6, 6.2, 6.4 and 6.5 implies the following Lemma. Lemma 6.8. Exact k-Cycle on clique-grid graphs can be solved in time 2O(√k log k)nO(1). Theorem 6.1 follows from Lemma 6.8 and Corollary 3.4. We can design a similar algorithm to solve Longest Path in time 2O(√k log k)nO(1). 19 7 Longest Cycle In this section, we show that Longest Cycle admits a subexponential-time parameterized algo- rithm. More precisely, we prove the following. Theorem 7.1. Longest Cycle on unit disk/square graphs can be solved in time 2O(√k log k)·nO(1). We start by stating a direct implication of Lemma 6.8. Corollary 7.2. Given a graph G, representation f and k ∈ N, it can be determined in time 2O(√k log k) · nO(1) whether G contain a cycle whose number of vertices is between k and 2k. Proof. Run the algorithm given by Lemma 6.8 with k = ℓ, ℓ + 1, . . . , 2ℓ, and return Yes if and only if at least one of the executions returns Yes. Correctness and running time follow directly from Lemma 6.8. Next, we examine the operation that contracts an edge. To this end, we need the following. Definition 7.3. A pair (u, v) of distinct vertices u, v ∈ V (G) is contractible if f (u) = f (v). Note that if (u, v) is a contractible pair, then by Condition 1 in Definition 3.1, it holds that {u, v} ∈ E(G). Now, given a contractible pair (u, v), denote e = {u, v}, and define the function f/e : V (G/e) → [t] × [t′] as follows. For all w ∈ V (G) \ {v, u}, define f/e(w) = f (w). Moreover, define f/e(x{u,v}) = f (u). By Definitions 3.1 and 4.6, we immediately have the following. Observation 7.4. The function f/e is a representation of G/e. Furthermore, G and G/e have the same cell graph. In particular, we deduce that (G/e, f/e, k) is an instance of Longest Cycle on clique-grid graphs. Next, we note that the operation that contracts an edge preserves the answer No-the correctness of this claim follows from the fact that G/e is a minor of G. Observation 7.5. Let (G, f, k) be an instance of Longest Cycle on clique-grid graphs. Then, (G/e, f/e, k) is an instance of Longest Cycle on clique-grid graphs such that if (G, f, k) is a No-instance, then (G/e, f/e, k) is a No-instance. Now, we also verify that in case there exists a cycle on at least 2k vertices, the operation that contracts an edge also preserves the answer Yes. Lemma 7.6. Let (G, f, k) be an instance of Longest Cycle on clique-grid graphs such that G contains a cycle C on at least 2k vertices. Then, (G/e, f/e, k) is a Yes-instance. Proof. Denote e = {u, v}. In case V (C) ∩ {u, v} = ∅, then C is also a cycle in G/e, and in case V (C)∩{u, v} = 1, then by replacing the vertex in V (C)∩{u, v} by x{u,v} in C, we obtain a cycle of the same length as C in G/e. In both of these cases, the proof is complete, and thus we next suppose that {u, v} ⊆ V (C). Let us denote C = v1 − v2 − v3 − ··· − vℓ − v1, where v1 = u and vi = v for some i ∈ [ℓ] \ {1}. Note that ℓ ≥ 2k. Without loss of generality, assume that i − 2 ≥ ℓ − i (else we replace each vj, except for v1, by vℓ−j, and obtain a cycle where this property holds). Now, note that C′ = x{u,v} − v2 − ··· − vi−1 − x{u,v} is a cycle in G/e. Moreover, since i − 2 ≥ ℓ − i, it holds that V (C′) = i − 1 ≥ ℓ 2 ≥ k. Thus, (G/e, f/e, k) is a Yes-instance. 20 Before we present our algorithm, we need two additional propositions, handling the extreme cases where we either discover that our input graph contains a large grid or, after a series of operations that contracted edges in G, we ended up with a graph isomorhpic to the cell graph of G. For the first case, we need the following result (see also [17, 14]). Observation 7.7. Let (G, k) be an instance of Longest Cycle on general graphs. If G contains a √k × √k grid as a minor, then (G, k) is a Yes-instance. For the second case, we need the following result (see also [14]). Proposition 7.8 ([7]). Longest Cycle on graphs of treewidth tw can be solved in time 2O(tw ) · nO(1). From Proposition 7.8 and the fact that cell(G) is a minor of G, we have the following. Observation 7.9. Let (G, f, k) be an instance of Longest Cycle on clique-grid graphs. Then, it can be determined in time 2O(tw(cell(G)))·nO(1) whether cell(G) contains a cycle on at least k vertices, in which case (G, f, k) is a Yes-instance. We are now ready to present our algorithm. The proof of correctness and analysis of running times are integrated in the description of the algorithm. Proof of Theorem 7.1. Let (G, O, k) be an instance of Longest Cycle on unit disk/square graphs. By using Corollary 3.4, we first obtain an equivalent instance (G, f, k) of Longest Cycle on clique-grid graphs (both instances refer to the same graph G and parameter k). Next, by using Lemma 4.9 with the parameter ℓ = 100 · 5993 · √k, we either correctly conclude that G contains a √k × √k grid as a minor, or compute a tree decomposition of cell(G) of width at most 500 · 5993 · √k = O(√k). In the first case, by Observation 7.7, we are done. In the latter case, by using Observation 7.9, we determine in time 2O(√k) · nO(1) whether cell(G) contains a cycle on at least k vertices, where if the answer is positive, then we are done. Thus, we next suppose that cell(G) does not contain a cycle on at least k vertices. Now, as long as there exists a contractible pair (u, v), we perform the following operation. First, by using Corollary 7.2, we determine in time 2O(√k log k) · nO(1) whether G contain a cycle whose number of vertices is between k and 2k. If the answer is positive, then we are done (our final answer is Yes). If the answer is negative, then we contract the edge {u, v}. By Lemma 7.6, we obtain an instance that is equivalent to the previous one. Note that the loop described in this paragraph can have at most O(n2) iterations, and therefore its total running time is bounded by 2O(√k log k)· nO(1). Once there does not exist a contractible pair (u, v), as we have only modified the graph by con- tracting edges, on at a time, between contractible pairs, we are left with a graph that is isomorphic to the cell graph of our original input graph. We have already correctly concluded that this graph does not contain a cycle on at least k vertices. Thus, at this point, we correctly answer No. 8 Feedback Vertex Set In this section, we show that Feedback Vertex Set admits a subexponential-time parameterized algorithm. More precisely, we prove the following. Theorem 8.1. Feedback Vertex Set on unit disk/square graphs can be solved in time 2O(√k log k)· nO(1). 21 First, we observe that if we find a large grid, we can answer No (see also [17, 14]). Observation 8.2. Let (G, k) be an instance of Feedback Vertex Set. If G contains a 2√k × 2√k grid as a minor, then (G, k) is a No-instance. This observation leads us to the following. Lemma 8.3. Let (G, O, k) be an instance of Feedback Vertex Set on unit disk/square graphs. Then, in time 2O(√k log k)·V (G)O(1), one can either solve (G, O, k) or obtain an equivalent instance (G, f, k) of Feedback Vertex Set on clique-grid graphs together with an O(√k)-NCTD of G. Corollary 4.10 with ℓ = 200 · 5993 · √k = O(√k), we either correctly conclude that G contains a 2√k × 2√k grid as a minor, or compute an O(√k)-NCTD of G. In both cases, by Observation 8.2, Proof. First, by using Lemmata 3.2 or 3.3, we obtain a representation f of G. Then, by using we are done. Because of Lemma 8.3, to prove Theorem 8.1, we can focus on Feedback Vertex Set on clique-grid graphs, where the input also contains a O(√k)-NCTD. That is, the input of Feedback Vertex Set on clique-grid graphs is a tuple (G, f, k,T ) where G is a clique-grid graph with representation f and T = (T, β) is a O(√k)-NCTD of G. Notice that if there is a cell (i, j) of f , such that f−1(i, j) ≥ k + 3, then there is no feedback vertex set of size at most k in G, because f−1(i, j) is a clique of size at least k + 3 in G. Observation 8.4. Let (G, f, k,T ) be an instance of Feedback Vertex Set, where G is a clique- grid graph with representation f . If there is a cell (i, j) in f such that f−1(i, j) ≥ k + 3, then (G, f, k,T ) is a No-instance. The following observation follows from the fact that T is a O(√k)-NCTD and f−1(i, j) ≤ k + 2 for any cell (i, j) of f . Observation 8.5. For any v ∈ V (T ), β(v) = O(k1.5). Notice that G has a feedback vertex set of size at most k if and only if there is a vertex subset F ⊆ V (G) of cardinality at least V (G) − k such that G[F ] is a forest. Hence, instead of stating the problem as finding a k sized feedback vertex set in G, we can state it as finding an induced subgraph H of G with maximum number of vertices such that H is a forest. Max Induced Forest (MIF) Input: A clique-grid graph G with representation f and an integer k such that T is a c√k- NCTD of G and for any cell (i, j) in f , f−1(i, j) ≤ k + 2, where c is a constant Question: Is there subset W ⊆ V (G) such that G[W ] is a forest and W ≥ V (G) − k Observation 8.6. Let (G, f, k,T ) be an instance of MIF. Then (G, f, k,T ) is a Yes-instance of MIF if and only if (G, f, k,T ) is a Yes-instance of Feedback Vertex Set. Parameter: k By Lemma 8.3 and Observations 8.4 and 8.6, to prove Theorem 8.1, it is sufficient that we prove the following result (which is the focus of the rest of this section). Lemma 8.7. MIF on clique-grid graphs can be solved in time 2O(√k log k) · nO(1). 22 Proof sketch. We explain a DP algorithm which given as input (G, f, k,T ) where G is a clique-grid graph with representation f , T = (T, β) is a c√k-NCTD, c is a constant and f−1(i, j) ≤ k + 2 for any cell (i, j) of f and outputs Yes if there is an induced forest with at least V (G) − k vertices and outputs No otherwise. Here we use the term solution for a vertex subset S ⊆ V (G) with the property that G[S] is a forest. First notice that any solution S contains at most 2 vertices from f−1(i, j) for any cell (i, j). Now, the following claim follows from the fact that T is a c√k-NCTD Claim 8.8. For any v ∈ V (T ) and any solution S, S ∩ β(v) ≤ 2c√k. and any solution contain at most 2 vertices from f−1(i, j) for any cell (i, j). We first briefly explain what is the table entries in a standard DP algorithm for our problem on graphs of bounded treewidth [14]. Then we explain that in fact many of the entries we compute in the standard DP table is redundant in our case, because of Observation 8.5 and Claim 8.8. That is, Observation 8.5 and Claim 8.8, shows that only 2O(√k log k)V (G)O(1) many states in the DP table are relevant in our case. Recall that for any v ∈ V (T ), γ(v) denote the union of the bags of v and its descendants. The standard DP table for our problem will have an entry indexed by (v, U, U1 ⊎ U2 . . . Uℓ = U ) where v ∈ V (T ), U ⊆ β(v). The table entry A[v, U, U1 ⊎ U2 . . . Uℓ] stores the following information: the maximum cardinality of a vertex subset W ⊆ G[γ(v)] such that W ∩ β(v) = U , G[W ] is a forest with a set of connected components C and for any C ∈ C, either V (C) ∩ β(v) = ∅ or V (C) ∩ β(v) = Ui for some i ∈ [ℓ]. Notice that the total number of DP table entries is bounded by twO(tw)V (G)O(1) where tw is the width of the tree decomposition T . One can easily show that the computation of the DP table at a node can be done in time polynomial in the size of the tables of its children. By Observation 8.5 and Claim 8.8, we know that for any bag β(v) in T , the potential number of subsets of β(v) which can be part of any solution is at most 2O(√k log k). This implies that we only need to compute the DP table entries for indices (v, U, U1 ⊎ U2 . . . Uℓ = U ) where v ∈ V (T ), U ⊆ β(v) and U ≤ 2c√k. Thus, the size of DP table, and hence the time to compute it takes 2O(√k log k)nO(1) time. This concludes the description. 9 Cycle Packing In this section, we show that Cycle Packing admits a subexponential-time parameterized algo- rithm. More precisely, we prove the following. Theorem 9.1. Cycle Packing on unit disk/square graphs can be solved in time 2O(√k log k)·nO(1). First, we observe that if we find a large grid, we can answer Yes (see also [17, 14]). Observation 9.2. Let (G, k) be an instance of Cycle Packing on general graphs. If G contains a 2√k × 2√k grid as a minor, then (G, k) is a Yes-instance. This observation leads us to the following. Lemma 9.3. Let (G, O, k) be an instance of Cycle Packing on unit disk/square graphs. Then, in time 2O(√k log k) · nO(1), one can either solve (G, O, k) or obtain an equivalent instance (G, f, k) of Cycle Packing on clique-grid graphs together with an O(√k)-NCTD of G. Corollary 4.10 with ℓ = 200 · 5993 · √k = O(√k), we either correctly conclude that G contains a 2√k × 2√k grid as a minor, or compute an O(√k)-NCTD of G. In both cases, by Observation 9.2, Proof. First, by using Lemmata 3.2 or 3.3, we obtain a representation f of G. Then, by using we are done. 23 Now, note that if there exists a cell (i, j) ∈ [t]× [t′] such that f−1(i, j) ≥ 3k, then by Condition 1 in Definition 3.1, G[f−1(i, j)] is a clique on at least 3k vertices and thus it contains k pairwise vertex-disjoint cycles (triangles). More precisely, we have the following. Observation 9.4. Let (G, f : V (G) → [t]× [t′], k) of Cycle Packing on clique-grid graphs. Then, if there exists a cell (i, j) ∈ [t] × [t′] such that f−1(i, j) ≥ 3k, then (G, f, k) is a Yes-instance. By Lemma 9.3 and Observation 9.4, to prove Theorem 9.1, it is sufficient that we prove the following result (which is the focus of the rest of this section). Lemma 9.5. Cycle Packing on clique-grid graphs can be solved in time 2O(√k log k) · nO(1), as- suming that the input includes an O(√k)-NCTD of G, and that for every cell (i, j) ∈ [t] × [t′], it holds that f−1(i, j) ≤ 3k. Let (G, f : V (G) → [t] × [t′], k) denote the input instance of Cycle Packing, and let T = (T, β) denote our O(√k)-NCTD of G. Note that since T is an O(√k)-NCTD, and since for every (i, j) ∈ [t] × [t′], it holds that f−1(i, j) ≤ 3k, we also have the following. Observation 9.6. For all v ∈ V (T ), it holds that β(v) = O(k1.5). We proceed by considering the "interaction" between cells in the context of the manner in which cycles in a solution cross their boundaries. To be precise, by Definition 3.1, we first observe the following. Observation 9.7. Let C be an induced cycle in G. Then, there does not exist a cell (i, j) ∈ [t]× [t′] and two distinct vertices u, v ∈ V (C) ∩ f−1(i, j) such that {u, v} /∈ E(C). In particular, for every cell (i, j) ∈ [t] × [t′], exactly one of the following conditions holds. 1. V (C) ⊆ f−1(i, j). 2. V (C) ∩ f−1(i, j) = 1. 3. V (C) ∩ f−1(i, j) = 2 and the two vertices in V (C) ∩ f−1(i, j) are neighbors in C. Next, note that given a set C of pairwise vertex-disjoint cycles and a cycle C ∈ C that is not an induced cycle in G, by replacing C in C by an induced cycle in G[V (C)], we obtain another set of pairwise vertex-disjoint cycles. Thus, we have the following. Observation 9.8. If (G, f, k) is a Yes-instance, then G contains a set C of k pairwise-disjoint induced cycles. Definition 9.9. Given two distinct cells (i, j), (i′, j′) ∈ [t]× [t′], we say that C crosses ((i, j), (i′, j′)) if there exist (not necessarily distinct) u, v ∈ f−1(i, j) and distinct w, r ∈ f−1(i′, j′) such that {u, w},{v, r} ∈ E(C). Moreover, we say that C crosses {(i, j), (i′, j′)} if it crosses at least one of the pairs ((i, j), (i′, j′)) and ((i′, j′), (i, j)). Definition 9.10. Given three distinct cells (i1, j1), (i2, j2), (i3, j3) ∈ [t] × [t′], we say that C crosses ((i1, j1), (i2, j2), (i3, j3)) if there exist u ∈ f−1(i1, j1), (not necessarily distinct) v, w ∈ f−1(i2, j2) and r ∈ f−1(i3, j3) such that {u, v},{w, r} ∈ E(C). Moreover, we say that C crosses {(i1, j1), (i2, j2), (i3, j3)} if it crosses at least one of the tuples in {((is, js), (ir, jr), (it, jt)) : {s, r, t} = {1, 2, 3}}. Next, we use the definitions above to capture the set of cycles which we would like detect (if a solution exists). 24 Definition 9.11. A set C of pairwise vertex-disjoint induced cycles is simple if it satisfies the following conditions. • For every two distinct cells (i, j), (i′, j′) ∈ [t] × [t′], there exist at most two cycles in C that cross {(i, j), (i′, j′)}. • For every three distinct cells (i1, j1), (i2, j2), (i3, j3) ∈ [t] × [t′], there exist at most two cycles in C that cross {(i1, j1), (i2, j2), (i3, j3)}. Given a cycle C (in G), denote cross(C) = {{u, v} ∈ E(C) : f (u) 6= f (v)}, and given a set C of cycles, denote cross(C) = ∪C∈Ccross(C). Next, we show that we can focus on the deciding whether a simple set, rather than a general set, of k pairwise-disjoint cycles exists. Lemma 9.12. If (G, f, k) is a Yes-instance, then G contains a simple set of k pairwise-disjoint induced cycles. Proof. Suppose that (G, f : V (G) → [t] × [t′], k) is a Yes-instance. Next, let C denote a set of k pairwise vertex-disjoint induced cycles that minimizes cross(C) among all such sets of cycles (the existence of at least one such set of induced cycles is guaranteed by Observation 9.8). We will show that C is simple. In what follows, we implicitly rely on Condition 1 in Definition 3.1. First, suppose that there exist two distinct cells (i, j), (i′, j′) ∈ [t] × [t′] and three cycles in C that cross {(i, j), (i′, j′)}. Let C1, C2 and C3 denote these three cycles. Then, at least one of the three following conditions is true. 1. There exist distinct s, t ∈ {1, 2, 3} such that (V (Cs) ∪ V (Ct)) ∩ f−1(i, j) ≥ 3 and (V (Cs) ∪ V (Ct)) ∩ f−1(i′, j′) ≥ 3: In this case, we replace Cs and Ct in C by some cycle on three vertices in G[(V (Cs) ∪ V (Ct)) ∩ f−1(i, j)] and some cycle on three vertices in G[(V (Cs) ∪ V (Ct)) ∩ f−1(i′, j′)]. We thus obtain a set of k pairwise vertex-disjoint cycles, C′, such that cross(C′) < cross(C), which is a contradiction to the choice of C. 2. (V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i, j) = 3 and (V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i′, j′) ≥ 6: In this case, we replace C1, C2 and C3 in C by some cycle on three vertices in G[(V (C1) ∪ V (C2)∪V (C3))∩f−1(i, j)] and two vertex-disjoint cycles, each on three vertices, in G[(V (C1)∪ V (C2) ∪ V (C3)) ∩ f−1(i′, j′)]. We thus obtain a set of k pairwise vertex-disjoint cycles, C′, such that cross(C′) < cross(C), which is a contradiction to the choice of C. 3. (V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i, j) ≥ 6 and (V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i′, j′) = 3: This case is symmetric to the previous one. Second, suppose that there exist three distinct cells (i1, j1), (i2, j2), (i3, j3) ∈ [t] × [t′] and three cycles in C that cross {(i1, j1), (i2, j2), (i3, j3)}. Let C1, C2 and C3 denote these three cycles. Then, it holds that (V (C1)∪V (C2)∪V (C3))∩f−1(i1, j1) ≥ 3, (V (C1)∪V (C2)∪V (C3))∩f−1(i2, j2) ≥ 3 and (V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i3, j3) ≥ 3. We replace C1, C2 and C3 in C by some cycle on three vertices in G[(V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i1, j1)], some cycle on three vertices in G[(V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i2, j2)], and some cycle on three vertices in G[(V (C1) ∪ V (C2) ∪ V (C3)) ∩ f−1(i3, j3)]. Now, we examine the information given by Lemma 9.12 to extract a form that will be easier for us to exploit. To this end, we need the following. Given a set C of cycles and a cell (i, j) ∈ [t] × [t′], denote cross(C, i, j) = (S cross(C)) ∩ f−1(i, j) (note that S cross(C) is the set of every vertex that is an endpoint of an edge in cross(C)). 25 Lemma 9.13. If (G, f : V (G) → [t] × [t′], k) is a Yes-instance, then G contains a set C of k pairwise-disjoint induced cycles such that for every cell (i, j) ∈ [t]×[t′], it holds that cross(C, i, j) ≤ 2304 = O(1). Proof. Suppose that (G, f, k) is a Yes-instance. By Lemma 9.12, there exists a simple set C of k pairwise-disjoint induced cycles. Let (i, j) ∈ [t] × [t′] be some cell. Given a cell (i′, j′) ∈ [t] × [t′] \ {(i, j)}, denote C(i′, j′) = {C ∈ C : C crosses {(i, j), (i′, j′)}}. Moreover, given cells (i2, j2), (i3, j3) ∈ [t]×[t′]\{(i, j)}, denote C(i2, j2, i3, j3) = {C ∈ C : C crosses {(i, j), (i2, j2), (i3, j3)}}. Now, we define two sets of indices: • I = {(i′, j′) ∈ [t] × [t′] \ {(i, j)} : C(i′, j′) 6= ∅}. • I′ = {((i2, j2), (i3, j3)) ∈ ([t] × [t′] \ {(i, j)}) × ([t] × [t′] \ {(i, j), (i2, j2)}) : C(i2, j2, i3, j3) 6= ∅}. Then, by Observation 9.7 and Lemma 9.12, it holds that cross(C, i, j) ≤ 2( [(i′,j ′)∈I ≤ 4(I + I′). C(i′, j′) + [ ((i2,j2),(i3,j3))∈I ′ C(i2, j2, i3, j3)) Note that {(i′, j′) ∈ [t] × [t′] \ {(i, j)} i − i′ ≤ 2,j − j′ ≤ 2} ≤ 24. Thus, by Condition 2 in Definition 3.1, we have that I ≤ 24 and I′ ≤ 24 · 23 = 552. Therefore, cross(C, i, j) ≤ 4(24 + 552) = 2304. We are now ready to prove Lemma 9.5. Except for the arguments where we crucially rely on Lemma 9.13 and the fact the we have an O(√k)-NCTD and not some general nice tree decompo- sition, the description of the DP is standard (see, e.g., [14]). Thus, we only give a sketch of the proof. Proof sketch of Lemma 9.5. Let us first examine a standard DP table A to solve Cycle Packing when the parameter is tw(G). Here, we have an entry A[v,Z, k′] for every node v ∈ V (T ), multiset Z of subsets of sizes 1 or 2 of β(v) and nonnegative integer k′ ≤ k. Moreover, each set of size 1 in Z has only one occurrence and its vertex does not appear in any set of size 2 in Z, and every vertex in β(v) appears in at most two sets in Z. Each such entry stores either 0 or 1. The value is 1 if an only if there exist a set S of k′ pairwise vertex-disjoint cycles in G[γ(v)] and a set P of internally pairwise vertex-disjoint paths in G[γ(v)] such that the following conditions are satisfied. • (SC∈S V (C)) ∩ (SP∈P V (P )) = ∅. • On the one hand, for every cycle C ∈ C, it holds that V (C)∩β(v) ≤ 1 and if V (C)∩β(v) = 1 then there exists a set in Z that is equal to V (C) ∩ β(v). On the other hand, if Z contains a set of size 1, then there exists a cycle C ∈ C such that V (C) ∩ β(v) equals this set. • On the one hand, for every path P ∈ P, it holds that P contains at least three vertices, both endpoints of P belong to a distinct occurrence of a set in Z (of size 2), and none of the internal vertices of P belongs to β(v). On the other hand, for every occurrence X of a set of size 2 in Z, there exists a distinct path P in P such that the set containing the two endpoints of P is equal to X. 26 The entry A[v,Z, k′] can be computed by examining the all entries A[u, bZ,bk] where u is a child of v in T (recall that v can have at most two children). At the end of the computation of A, we conclude that the input instance is a Yes-instance if and only if A[r,∅, k] contains 1 where r is the root of T . By Observation 9.6, we deduce that A contains 2O(k log k) · n entries, where each entry can be computed in time 2O(k log k). We claim that for every v ∈ V (T ), it is sufficient to compute only 2O(√k log k) entries. More precisely, for every v ∈ V (T ), it is sufficient to compute only entries A[v,Z, k′] such that SZ = O(√k) (there are only 2O(√k log k) such entries). Indeed, suppose that the input instance is a Yes- instance. Then, by Lemma 9.13, there exists a set C of k pairwise vertex-disjoint induced cycles such that for every cell (i, j) ∈ [t]×[t′], it holds that cross(C, i, j) = O(1). Now, we sketch the main arguments that show that for every v ∈ V (T ), we still have an entry that "captures" C (as explained below) and we are able to compute it in time 2O(√k log k), which would imply that eventually, we would still be able to deduce that A[r,∅, k] contains 1. For this purpose, consider some v ∈ V (T ). First, we notice that since for every cell (i, j) ∈ [t] × [t′], it holds that cross(C, i, j) = O(1), by Observation 9.7, and since T is an O(√k)-NCTD, we have that there exists a set U of at most O(√k) vertices in β(v) such that every cycle C ∈ C satisfies at least one of the following conditions. 1. V (C) ∩ β(v) ⊆ U 2. V (C) ⊆ γ(v) \ β(v). 3. V (C) ⊆ V (G) \ γ(v). Now, we let S denote the set of cycles in C such that all of their vertices, except at most one that belongs to β(v), belong to γ(v) \ β(v). Accordingly, we denote k′ = S. Moreover, let P denote the set of every subpath of a cycle in C whose endpoints belong to β(v) and whose set of internal vertices is a subset of size at least 1 of γ(v) \ β(v). Finally, we define Z as the multiset {β(v) ∩ O O ∈ S ∪ P}. Then, it holds that S Z = O(√k) and C witnesses that A[v,Z, k′] should be 1. Overall, by the existence of the set U that is mentioned above, we conclude the entry A[v,Z, k′] can be computed in time 2O(√k log k). This completes the proof sketch. 10 Conclusion In this paper, we gave subexponential algorithms of running time 2O(√k log k) · nO(1) for a number of parameterized problems about cycles in unit disk graphs. The first natural question is whether the log k factor in the exponent can be shaved off. While we were not able to do it, we do not exclude such a possibility. In particular, it would be very interesting to build a theory for unit disk graphs, which is similar to the bidimensionality theory for planar graphs. In this context, it will be useful to provide a general characterization of parameterized problems admitting subexponential algorithms on unit disk graphs. References [1] Jochen Alber and Jir´ı Fiala. Geometric separation and exact solutions for the parameterized independent set problem on disk graphs. In Foundations of Information Technology in the Era of Network and Mobile Computing, pages 26–37. Springer, 2002. [2] Noga Alon, Raphael Yuster, and Uri Zwick. Color-coding. J. Assoc. Comput. Mach., 42(4):844– 856, 1995. 27 [3] Brenda S. Baker. Approximation algorithms for NP-complete problems on planar graphs. J. Assoc. Comput. Mach., 41(1):153–180, 1994. [4] Andreas Bjorklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto. Narrow sieves for parameterized paths and packings. CoRR, abs/1007.1161, 2010. [5] Andreas Bjorklund, Thore Husfeldt, and Nina Taslaman. Shortest cycle through specified In Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete elements. Algorithms, SODA 2012, Kyoto, Japan, January 17-19, 2012, pages 1747–1753, 2012. [6] Hans L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput., 25(6):1305–1317, 1996. [7] Hans L. Bodlaender, Marek Cygan, Stefan Kratsch, and Jesper Nederlof. Deterministic sin- gle exponential time algorithms for connectivity problems parameterized by treewidth. Inf. Comput., 243:86–111, 2015. [8] Hans L. Bodlaender, Rodney G. Downey, Michael R. Fellows, and Danny Hermelin. On problems without polynomial kernels. J. Comput. Syst. Sci., 75(8):423–434, 2009. [9] Hans L. Bodlaender, Pal Grønas Drange, Markus S. Dregi, Fedor V. Fomin, Daniel Lokshtanov, and Michal Pilipczuk. A ckn 5-approximation algorithm for treewidth. SIAM J. Comput., 45(2):317–378, 2016. [10] Timothy M. Chan. Polynomial-time approximation schemes for packing and piercing fat ob- jects. J. Algorithms, 46(2):178–189, 2003. [11] Jianer Chen, Iyad A. Kanj, and Weijia Jia. Vertex cover: improvements. Journal of Algorithms, 41(2):280–301, 2001. further observations and further [12] Brent N. Clark, Charles J. Colbourn, and David S. Johnson. Unit disk graphs. Discrete Mathematics, 86(1-3):165–177, 1990. [13] Kenneth L. Clarkson and Kasturi R. Varadarajan. Improved approximation algorithms for geometric set cover. Discrete & Computational Geometry, 37(1):43–58, 2007. [14] Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, D´aniel Marx, Marcin Pilipczuk, Micha l Pilipczuk, and Saket Saurabh. Parameterized Algorithms. Springer, 2015. [15] Erik D. Demaine, Fedor V. Fomin, Mohammadtaghi Hajiaghayi, and Dimitrios M. Thi- likos. Subexponential parameterized algorithms on graphs of bounded genus and H-minor-free graphs. J. ACM, 52(6):866–893, 2005. [16] Erik D. Demaine and MohammadTaghi Hajiaghayi. Bidimensionality: new connections be- tween fpt algorithms and ptass. In Proceedings of the 16th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2005), pages 590–601, New York, 2005. ACM-SIAM. [17] Erik D. Demaine and MohammadTaghi Hajiaghayi. The bidimensionality theory and its algo- rithmic applications. Comput. J., 51(3):292–302, 2008. [18] Reinhard Diestel. Graph Theory, 4th Edition, volume 173 of Graduate texts in mathematics. Springer, 2012. 28 [19] Frederic Dorn, Eelko Penninkx, Hans L. Bodlaender, and Fedor V. Fomin. Efficient exact algorithms on planar graphs: Exploiting sphere cut decompositions. Algorithmica, 58(3):790– 810, 2010. [20] Adrian Dumitrescu and J´anos Pach. Minimum clique partition in unit disk graphs. Graphs and Combinatorics, 27(3):399–411, 2011. [21] F. V. Fomin, D. Lokshtanov, S. Saurabh, and D. M. Thilikos. Bidimensionality and kernels. In Proceedings of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2010), pages 503–510. SIAM, 2010. [22] Fedor V. Fomin, Daniel Lokshtanov, D´aniel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Subexponential parameterized algorithms for planar and apex-minor-free graphs via low treewidth pattern covering. In Proceedings of the 57th Annual Symposium on Foundations of Computer Science (FOCS), to appear, 2016. [23] Fedor V. Fomin, Daniel Lokshtanov, Fahad Panolan, and Saket Saurabh. Efficient computation of representative families with applications in parameterized and exact algorithms. J. ACM, 63(4):29, 2016. [24] Fedor V. Fomin, Daniel Lokshtanov, Venkatesh Raman, and Saket Saurabh. Bidimensionality and EPTAS. In Proceedings of the Twenty-Second Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2011, San Francisco, California, USA, January 23-25, 2011, pages 748–759, 2011. [25] Fedor V. Fomin, Daniel Lokshtanov, and Saket Saurabh. Bidimensionality and geometric graphs. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1563–1575. SIAM, 2012. [26] William K Hale. Frequency assignment: Theory and applications. Proceedings of the IEEE, 68(12):1497–1514, 1980. [27] Sariel Har-Peled and Mira Lee. Weighted geometric set cover problems revisited. JoCG, 3(1):65–85, 2012. [28] Sariel Har-Peled and Kent Quanrud. Approximation algorithms for polynomial-expansion and low-density graphs. In Algorithms - ESA 2015 - 23rd Annual European Symposium, Patras, Greece, September 14-16, 2015, Proceedings, volume 9294, pages 717–728. Springer, 2015. [29] Dorit S. Hochbaum and Wolfgang Maass. Approximation schemes for covering and packing problems in image processing and VLSI. J. ACM, 32(1):130–136, 1985. [30] Harry B. Hunt III, Madhav V. Marathe, Venkatesh Radhakrishnan, S. S. Ravi, Daniel J. Rosenkrantz, and Richard Edwin Stearns. Nc-approximation schemes for NP- and pspace- hard problems for geometric graphs. J. Algorithms, 26(2):238–274, 1998. [31] Russell Impagliazzo, Ramamohan Paturi, and Francis Zane. Which problems have strongly exponential complexity. Journal of Computer and System Sciences, 63(4):512–530, 2001. [32] Hiro Ito and Masakazu Kadoshita. Tractability and intractability of problems on unit disk graphs parameterized by domain area. In Proceedings of the 9th International Symposium on Operations Research and Its Applications (ISORA10), pages 120–127, 2010. 29 [33] Bart M. P. Jansen. Polynomial kernels for hard problems on disk graphs. In Proceedings of the 12th Scandinavian Symposium and Workshops on Algorithm Theory (SWAT), volume 6139 of Lecture Notes in Comput. Sci., pages 310–321. Springer, 2010. [34] KARL Kammerlander. C 900-an advanced mobile radio telephone system with optimum frequency utilization. IEEE journal on selected areas in communications, 2(4):589–597, 1984. [35] Ioannis Koutis. Faster algebraic algorithms for path and packing problems. In Proceedings of the 35th International Colloquium on Automata, Languages and Programming (ICALP 2008), volume 5125 of Lecture Notes in Computer Science, pages 575–586, 2008. [36] Ioannis Koutis and Ryan Williams. Algebraic fingerprints for faster algorithms. Commun. ACM, 59(1):98–105, 2016. [37] D´aniel Marx. Efficient approximation schemes for geometric problems? In Proceedings of the 13th Annual European Symposium on Algorithms (ESA), volume 3669 of Lecture Notes in Comput. Sci., pages 448–459. Springer, 2005. [38] Nabil H. Mustafa, Rajiv Raman, and Saurabh Ray. Settling the apx-hardness status for geometric set cover. In 55th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2014, Philadelphia, PA, USA, October 18-21, 2014, pages 541–550. IEEE Computer Society, 2014. [39] Warren D. Smith and Nicholas C. Wormald. Geometric separator theorems & applications. In Proceedings of the 39th Annual Symposium on Foundations of Computer Science (FOCS), pages 232–243. IEEE Computer Society, 1998. [40] St´ephan Thomass´e. A quadratic kernel for feedback vertex set. ACM Transactions on Algo- rithms, 6(2), 2010. [41] DW Wang and Yue-Sun Kuo. A study on two geometric location problems. Information processing letters, 28(6):281–286, 1988. [42] Ryan Williams. Finding paths of length k in O∗(2k) time. Inf. Process. Lett., 109(6):315–318, 2009. [43] Yu-Shuan Yeh, J Wilson, and S Schwartz. Outage probability in mobile telephony with direc- tive antennas and macrodiversity. IEEE journal on selected areas in communications, 2(4):507– 511, 1984. [44] Meirav Zehavi. Mixing color coding-related techniques. In Proceedings of the 23rd Annual European Symposium on Algorithms (ESA), volume 9294 of Lecture Notes in Comput. Sci., pages 1037–1049. Springer, 2013. 30
1210.5786
1
1210
2012-10-22T01:14:02
Optimizing Tile Concentrations to Minimize Errors and Time for DNA Tile Self-Assembly Systems
[ "cs.DS" ]
DNA tile self-assembly has emerged as a rich and promising primitive for nano-technology. This paper studies the problems of minimizing assembly time and error rate by changing the tile concentrations because changing the tile concentrations is easy to implement in actual lab experiments. We prove that setting the concentration of tile $T_i$ proportional to the square root of $N_i$ where $N_i$ is the number of times $T_i$ appears outside the seed structure in the final assembled shape minimizes the rate of growth errors for rectilinear tile systems. We also show that the same concentrations minimize the expected assembly time for a feasible class of tile systems. Moreover, for general tile systems, given tile concentrations, we can approximate the expected assembly time with high accuracy and probability by running only a polynomial number of simulations in the size of the target shape.
cs.DS
cs
Optimizing Tile Concentrations to Minimize Errors and Time for DNA Tile Self-Assembly Systems Ho-Lin Chen ∗ Ming-Yang Kao † Abstract DNA tile self-assembly has emerged as a rich and promising primitive for nano-technology. This pa- per studies the problems of minimizing assembly time and error rate by changing the tile concentrations because changing the tile concentrations is easy to implement in actual lab experiments. We prove that setting the concentration of tile Ti proportional to the square root of Ni where Ni is the number of times Ti appears outside the seed structure in the final assembled shape minimizes the rate of growth errors for rectilinear tile systems. We also show that the same concentrations minimize the expected assembly time for a feasible class of tile systems. Moreover, for general tile systems, given tile concentrations, we can approximate the expected assembly time with high accuracy and probability by running only a polynomial number of simulations in the size of the target shape. 2 1 0 2 t c O 2 2 ] S D . s c [ 1 v 6 8 7 5 . 0 1 2 1 : v i X r a [email protected]. for Mathematics of ∗Center Information, California Institute of Technology, Pasadena, CA 91101, USA. Email: †Department of Electrical Engineering and Computer Science, Northwestern University, Evanston, IL 60208, USA. Email: [email protected]. This author's work was supported in part by NSF Grant CCF-1049899. 1 Introduction Considerable modern research in science and engineering has aimed to control smaller and smaller systems in many fields, including computer science and material science. As the size of a system approaches the molecular scale, precise direct external control becomes prohibitively costly, if not impossible. As a result, bottom-up self-assembly has emerged as a rich and promising primitive for nano-technology. In particular, DNA has received much attention as a substrate for molecular self-assembly because its combinatorial na- ture enables the programming of molecular behaviors by choosing appropriate DNA sequences to encode information. In addition, lab techniques for the manipulation of DNA are already well developed. For these considerations, DNA self-assembly has been proposed for a variety of applications, e.g., as a means to perform computation [4, 22, 29], construct molecular patterns [9, 12, 18, 19, 24, 34], and build nano-scale machines [5, 10, 13, 23, 25, 33]. DNA tiles which self-assemble according to simple rules have been developed in lab [31] and mathe- matically analyzed based on the combinatorial tile assembly model (aTAM) proposed by Rothemund and Winfree [17]. Under this model, there is a set of square tiles with a glue on each of the four edges. Each glue has a certain affinity for itself called strength. The self-assembly process starts from a distinguished seed structure. Assembly proceeds as tiles attach to the partially assembled structure (initially, just the seed structure) one by one when the combined strength of matched glues between a tile and the partial structure is at least the temperature of the tile system. Many interesting tile systems have been designed under aTAM, including systems that build counters [1, 8] and squares [11, 15, 17], perform Turing-universal computa- tion [29], and produce arbitrary computable shapes [16, 27]. Unfortunately, in laboratory settings, several events that aTAM does not model have been frequently observed. These events are referred to as errors in the tile self-assembly process. A more realistic stochastic model called the kinetic tile assembly model (kTAM) was proposed by Winfree [29] to describe the rates of these errors. The kTAM model calculates the rates for various types of attachments and detachments of tiles based on thermodynamics. In order to make DNA tile self-assembly practical, there are two important factors that need to be mini- mized, namely, the error rate and the time of the assembly process. One approach to reducing the error rate of a tile assembly system [6, 7, 14, 26, 30] is to convert an existing error-prone tile system to a more robust tile system that assembles into the same shape or pattern up to scaling. These error correcting techniques increase the number of tile types by a multiplicative factor and thus are hard to implement in practice. In contrast, it is easy to change the concentrations of tiles. Therefore, it is natural to consider reducing the er- ror rate by changing the concentrations of tiles. This approach has been studied using computer simulations and lab experiments. However, no closed-form formulas or efficient algorithms for finding the optimal tile concentrations have been previously found. It is also natural to consider changing the tile concentrations in order to minimize the assembly time. Adleman et al. [2] designed an algorithm to find tile concentrations that approximate the minimum expected assembly time within an O(log n) factor. Goel et al. [8] showed that if all tiles have equal concentrations, then the expected assembly time is proportional to the longest length of a path in the assembly order of the target shape. Also, some studies employed computer simulations to characterize the trade-offs between the time and the error rate of an assembly process [6, 30]. Our Results On the problem of minimizing the error rate, we formulate the rate of growth errors in terms of tile concentrations based on the kinetic tile assembly model. Using our formulation, we show that setting the concentration of each tile Ti proportional to the square root of the number of times Ti appears outside the seed structure in the target shape minimizes the rate of growth errors. This result holds for all rectilinear tile systems (i.e., tile systems that have the same growth directions for all tiles fixed throughout the assembly 1 process) as well as many other systems that have been implemented in lab [3, 21]. We also have simulation results showing that facet errors can significantly affect the accuracy of the optimal tile concentrations predicted by our mathematical analysis. On the problem of minimizing the assembly time, we prove that the above concentrations for minimizing the rate of growth errors also minimizes the expected assembly time for a feasible class of tile systems. Moreover, for general tile systems, given tile concentrations, we show that the average assembly time over a polynomial number of simulations in the size of the target shape can approximate the expected assembly time with high accuracy and probability. The remainder of this paper is organized as follows. Section 2 describes the two tile assembly models that we use. Section 3 contains the theoretical results on minimizing the rate of growth errors. Section 4 contains the simulation results on growth errors and some discussion on facet errors. Section 5 contains the theoretical results on estimating and minimizing the expected assembly time. Section 6 concludes the paper with some open problems. 2 Two Tile Assembly Models The Combinatorial Tile Assembly Model The combinatorial tile assembly model was proposed by Rothemund and Winfree [17]. It extends the theoretical model of tiling by Wang [28] to include a mecha- nism for growth based on the physics of molecular self-assembly. Informally, a tile self-assembly system has a set of tiles, each of which is a square with glues of various types on each of the four edges. Two tiles will stick to each other if they have compatible glues. Below we present a succinct definition of this model with minor modifications for ease of explanation. A tile is an oriented unit square with the north, east, south and west edges labeled from some alphabet Σ of glues. For each tile t, the glues of its four edges are denoted as σN (t), σE(t), σS(t), and σW (t). We describe a tile t as the quadruple (σN (t), σE(t), σS(t), σW (t)). Consider the triple <T, g, τ > where T is a finite set of tiles, τ ∈ Z>0 is the temperature, and g is the glue strength function from Σ × Σ to Z≥0. It is assumed that for all x, y ∈ Σ, the inequality x (cid:54)= y implies g(x, y) = 0 and there is a glue null ∈ Σ, such that g(x, null) = g(null, x) = 0 for all x ∈ Σ. A configuration is a map from Z2 to T(cid:83) empty, where empty is a special symbol indicating the absence of any tile. A tile system is a quadruple T = <T, s, g, τ >, where T, g, τ are as above and s is a special configuration called the seed structure. Let C and D be two configurations. Suppose that there exist some t ∈ T and some (x, y) ∈ Z2 such that D = C except that at (x, y), C(x, y) = null and D(x, y) = t. Let fN,C,t(x, y) = g(σN (t), σS(C(x, y + 1)). Informally, fN,C,t(x, y) is the strength of the bond on the north edge of t in configuration C. We define fS,C,t(x, y), fE,C,t(x, y) and fW,C,t(x, y) similarly. Then tile t is attachable to C at position (x, y) iff fC,t(x, y) ≡ fN,C,t(x, y) + fS,C,t(x, y) + fE,C,t(x, y) + fW,C,t(x, y) ≥ τ. We write C →T D to denote the transition from C to D by attaching a tile to C at position (x, y). Informally, C →T D iff D can be obtained from C by adding a tile t such that the total strength of interaction between t and C is at least τ. A terminal assembly is a configuration A such that there is no configuration B for which A →T B. When a tile t attaches to configuration C at position (x, y), the edges U of t with fU,C,t(x, y) > 0 are called the input edges; all other edges are called the output edges. A tile system is rectilinear if there is a unique terminal assembly that can be reached starting from the seed structure, each tile t has the same input and output edges every time it attaches, and all tiles have the same input and output edges. The Kinetic Tile Assembly Model According to the combinatorial tile assembly model, a tile t attaches at a position (x, y) in a configuration C iff the total strength fC,t(x, y) of matched glues is at least τ, and 2 any tiles that attached never fall off. In practice, tiles may attach with a weaker binding strength, and tiles that already attached may fall off. These events can cause the tile system to behave differently from the combinatorial tile assembly model. We treat these deviations as errors and try to minimize the probability of having these events. In this paper, we use the kinetic tile assembly model proposed by Winfree [29] to model the forward and reverse rates, which are the rates at which a tile attaches to and falls off from a specific position, respectively. This model computes these rates as functions of thermodynamic parameters as follows: 1. The concentrations of the tiles are held constant throughout the self-assembly process. 2. The only two reactions allowed are single tiles attaching to and dissociating from a configuration. 3. The forward rate for tile Ti is kf ci, where kf is a constant and ci is the concentration of tile Ti. This notation is used throughout this paper. 4. The reverse rate for a tile t attached to configuration C at position (x, y) to fall off is kre−bGse, where kr and Gse are constants and b = fC,t(x, y) is the total strength of matched glues between t and C. Here, the parameters kf and kr give the time scale of the self-assembly. The value of Gse is determined by the binding strength of the sticky ends of DNA tiles. We use cmax and cmin to denote the maximum and minimum concentrations allowed in the tile system. If one wants the tile system to assemble according to the combinatorial tile assembly model most of the time, then the following two conditions need to hold. First, if the total binding strength between a tile and the original configuration it just attached to is less than τ, then the tile must fall off quickly, i.e., kre−(τ−1)Gse (cid:29) kf cmax. Second, if a tile t is attachable to a position in C, then the forward rate at which it attaches should be greater than the reverse rate at which it falls off, i.e., kf cmin > kre−τ Gse. In practice, since each tile may have a slightly different value for the parameter kf and the strength of each glue may vary, one often needs to set kf and kr (by changing an experiment's temperature) such that kf cmin (cid:29) kre−τ Gse. For the remainder of the paper, we assume kre−(τ−1)Gse (cid:29) kf cmax > kf cmin (cid:29) kre−τ Gse. We also assume that our seed structure is made by some other processes (e.g., DNA origami [18]) and its tiles never fall off. 3 Minimizing the Error Rate In this section, we consider the problem of changing the concentrations of tiles to minimize the failure probability (i.e., error rate) for a rectilinear tile system. There are three types of errors in tile self-assembly. A growth error refers to an incorrect tile attaching at a position instead of the correct tile [30]. A facet error 3 refers to an incorrect tile attaching at a position where no tile is supposed to attach [6]. A nucleation error refers to single tiles attaching to each other to form a lattice without the seed structure [20]. In this section, we only consider minimizing growth errors. It has been shown [30] that if one slows down the growth of the boundary tiles of the target shape, the growth front will be roughly triangular. In this situation, growth errors are the dominant type of errors among the above three types. We want to compute the probability that a tile Tj causes a growth error by attaching at a position (x, y) where only Ti can attach with total binding strength at least τ. First, Ti can attach at that position at rate kf ci. Once Ti is attached, the probably of it falling off is negligible since kf cmin >> kre−τ Gse. Second, Tj can attach at that position at rate kf cj. When Tj attaches, it can fall off at rate kre−(τ−m)Gse, where m is the total strength of the mismatched glues between Ti and Tj on their input edges. Tj can also get locked in place and cause an error due to the attachment of one or more adjacent tiles. The rate r at which Tj gets locked in place may vary with the features in the partially assembled shape near position (x, y) such as long facets. In this paper, we assume that r is the same for all positions (x, y) and tiles t. The allowable reactions related to Ti and Tj are summarized in Figure 1. From the above description of reaction rates, we know that at a given position (x, y) where tile Ti is supposed to attach, the probability of having a growth error caused r+kre−(τ−m)Gse , which is roughly at the order of e−mGse since r ≤ 2kf cmax. by Tj is cj ci Therefore, at position (x, y), the total probability of a growth error is ij. Here, ij = r (cid:80) j(cid:54)=i ijcj . ci Figure 1: A Markov chain describing attachments of Ti and Tj, where C indicates a correct tile. For a self-assembly process, the error rates at different positions depend on each other. However, if one wants to have a high probability of success, one almost always needs to set the experimental condition such that the error rate at each position is much smaller than 1/n. In this case, minimizing the sum of error rates over all positions is a good approximation of minimizing the actual overall error rate of the tile assembly system. Thus, in the remainder of this section, we will minimize (cid:0)(cid:80) Ni (cid:88) i (cid:1), j(cid:54)=i ijcj ci (1) where Ni is the number of positions outside the seed structure to which Ti is supposed to attach. 4 jCCCCCCCCCCCCCCCCCCTT............k ck cfjfik errjiseTjCCCCCC!( !m)Gcorrect attachment by Tgrowth error by T growth error by T locked ini!j Theorem 1 For a rectilinear tile system with a unique terminal assembly, the error rate (i.e., probability of failure) is minimized when the concentration of each tile Ti is proportional to Ni, where Ni is the number of times tile Ti appears outside the seed structure in the correct terminal assembly of the tile system. √ Proof: From Equation 1, we can scale the tile concentrations ci without loss of generality such that i ci = 1, and we need to solve the following minimization problem: (cid:80) (cid:1), j(cid:54)=i ijcj ci i Ni (cid:0)(cid:80) Minimize(cid:88) subject to(cid:88) (cid:0)(cid:80) j(cid:54)=i ijcj i Λ = Ni (cid:88) (cid:0)(cid:80) i ci (cid:1) + (cid:88) j(cid:54)=i ijcj c2 i ci = 1. (cid:1) + λ( (cid:88) Nj ij cj j(cid:54)=i ci = 1. We need to solve = −Ni ∂Λ ∂ci and The Lagrange multiplier for this minimization problem is (cid:88) i ci − 1). + λ = 0 for all i (2) Simplifying Equation 2, we obtain(cid:88) (cid:0) − Ni j(cid:54)=i i ijcj c2 i + Nj ij cj (cid:1) + λ = 0 for all i, and consequently the error rate is minimized when √ √ Ni(cid:80) ci = . Ni i √ 2 Two points about the proof of Theorem 1 are worth noticing. Firs, the error rate only depends on the ratio between the tile concentrations. Therefore, the error rate is minimized when the concentration of Ti is Ni even when we vary each ci between cmax and cmin. Second, the same proof can apply proportional to to all tile systems that satisfy ij = ji for all i, j. Hence Theorem 1 is valid for many other systems already implemented in lab such as zig-zag ribbons [21] and counters seeded by origami [3]. Moreover, Theorem 1 still applies if we add either a uniform proofreading scheme [30] or a snaked proofreading scheme [6] to the tile system. However, for a proofreading system to work, we need kf · ci to be sufficiently close to kre−τ Gse for all tiles Ti, which is false in the parameter range that we use in this paper. 5 4 Simulation Results for Theorem 1 We used a software called xgrow [32] to simulate four tile systems to determine their error rates under different tile concentrations. To obtain a good estimate of the error rate of a tile system, we would choose our parameters such that errors can be frequently observed. However, in most tile systems, if we use such parameters, we will reach some configuration very different from the terminal assembly predicted by the combinatorial tile assembly model. Since our prediction of the optimal tile concentrations depends on the terminal assembly, we made a design decision to perform simulations on tile systems for which each error only affects one position of the terminal assembly. We simulated four tile systems named as A1, A2, B1, and B2. Each of the four systems operates at τ = 2 and only has two tiles X and Y shown in Figure 2(a) beside the seed structure. The only difference between the four systems is their seed structures. The seed structures of tile systems A1 and A2 are shown in Figure 2(b). The lengths of their seed structures are adjusted such that NX : NY = 25 : 1 and 64 : 1 for A1 and A2, respectively, where NX and NY are the numbers of positions X and Y appear in the terminal assembly. The seed structures of tile systems B1 and B2 are shown in Figure 2(c). The lengths of their seed structures are also adjusted such that NX : NY = 25 : 1 and 64 : 1 for B1 and B2, respectively. These systems are rectilinear with all tiles having their input edges on the south and east edges. Since tiles X and Y have the same output edges, when an error happens, the error only affects the position where the erroneous tile is attached. The unique terminal assemblies and example configurations generated by simulations of tile systems A1 and B1 are shown in Figures 3 and 4, respectively. Theorem 1 predicts that the rate of growth errors is minimized when cX : cY = 5 : 1 for systems A1 and B1, and when cX : cY = 8 : 1 for systems A2 and B2. Figure 2: (a) Tiles X and Y , where all glues have strength 1. (b) An L-shaped seed structure for systems A1 and A2. (c) A seed structure with two vertical facets and one horizontal facet for systems B1 and B2. The simulation results are shown in Figure 5. In systems A1 and A2, the optimal tile concentration ratios are 2.5 : 1 and 3 : 1, respectively. In systems B1 and B2, the optimal tile concentration ratios are roughly 7.5 : 1 and 15 : 1, respectively. The major reason causing these deviations from the predictions made by Theorem 1 is the facet errors. Since tiles X and Y both have glue 0 on the south edge, having a long horizontal facet may introduce a large number of facet errors. For systems A1 and A2, notice that long horizontal facets are generated because tile Y (colored yellow) has lower concentrations and grows slower than X. An example configuration for system A1 that demonstrates these horizontal facets is shown 6 011111110000000000001111111000Y10(a)0(b)X000(c)000000 Figure 3: The left figure is the unique terminal assembly for system A1. The right figure is an example configuration for system A1 generated by an xgrow simulation. Figure 4: The left figure is the unique terminal assembly for system B1. The right figure is an example configuration for system B1 generated by an xgrow simulation. 7 Figure 5: Plots of error rates vs. the ratios between tile concentrations. Each data point represents m = 20, 000 simulations. The simulations use Gse = 9 for systems A1 and A2, Gse = 11 for systems B1 and B2, cX + cY = e−16, √ and kf = kr. Error bars show two standard deviations of the errors, computed using σ = σsimulation/ m. 8 024681012140.10.150.20.250.30.350.40.450.5ratio between Cx and Cyerror rate for each position (%)Error Rates vs. Tile Concentrations for Systems A1 and A2 25:1, A164:1, A2024681012141618200.40.60.811.21.41.6ratio between Cx and Cyerror rate averaged over all positions (%)Error Rates vs. Tile Concentrations for Systems B1 and B2 25:1, B164:1, B2 in Figure 3. Such undesirable facets become longer and more when we increase the ratio between cX and cY . Therefore, the actual optimal tile concentration is biased towards having more Y than predicted by Theorem 1. For systems B1 and B2, each terminal assembly is separated into a left portion and a right portion by the seed structure, as shown in Figure 4. Horizontal facets can only be generated in the left portion, where all tiles should be X. Hence, we can reduce facet errors by decreasing the concentration of tile Y and thus the actual optimal tile concentration is biased towards having fewer Y than predicted by Theorem 1. 5 Minimizing the Expected Assembly Time This section assumes that only the correct tiles can attach and any tile that already attached never falls off. We minimize the expected assembly time by varying the tile concentrations. Theorem 2 Consider any tile system with the four properties that 1. tiles can only attach one by one, 2. only the correct tiles can attach, 3. any tile that already attached never falls off, and 4. there is a unique terminal assembly. Assume that the total tile concentration is(cid:80) i ci = 1. Setting ci = time of the tile system. Ni(cid:80) √ √ i Ni minimizes the expected assembly 1 (cid:80) We want to minimize the sum(cid:80) Proof: From the kinetic tile assembly model [29], the expected time for a tile Ti to attach to a location (x, y) is . By the four properties of the given tile system in the theorem, the expected assembly time is kf ci Ni , where Ni is the number of times Ti appears outside the seed structure in the terminal assembly. 1 kf ci i ci = 1. The Lagrange multiplier for this minimization i Ni ci i problem is subject to(cid:80) (cid:88) Λ = Ni ci i (cid:88) + λ( ci − 1). i + λ = 0 for all i ci = 1, √ √ Ni(cid:80) i . Ni Solving the equations and we obtain ∂Λ ∂ci = − Ni c2 i (cid:88) i ci = 2 In settings that are more general than Theorem 2 assumes, the optimal tile concentrations to minimize the expected assembly time may significantly deviate from the ci's determined in Theorem 1. Lemma 3 describes an example of such deviation. 9 total tile concentration is(cid:80) Lemma 3 Consider a tile system for which properties 2 through 4 in Theorem 2 hold but property 1 is replaced by allowing tiles to attach in parallel whenever they can. Also, as in Theorem 2, assume that the i ci = 1. Further assume that in the final assembly, there are N tiles not in the seed structure, and all N tiles can attach to the seed structure directly and in parallel. Then the optimal tile concentrations that minimize the expected assembly time must satisfy ci ≥ 1 k ln N , where k is the number of tile types. Proof: A key point of this proof is that the attachment of tiles to all N positions outside the seed structure in the terminal assembly can happen in parallel. If all tiles have the same concentration 1/k, then the expected assembly time is k ln N. If any tile has concentration lower than k ln N , then the attachment of that single tile non-optimally takes expected time more than k ln N. Thus, when the expected assembly time is minimized, all tile concentrations must be at least 2 For general tile assembly systems, we do not know how to analytically find the optimal tile concentra- tions to minimize the expected assembly time. However, we show in Theorem 5 below that given a set of tile concentrations, only a polynomial number of simulations is required in order to approximate the expected assembly time with high accuracy and probability. k ln N . 1 1 Lemma 4 Consider any tile system for which properties 2 through 4 in theorem 2 hold but there is no assumption on whether tiles can attach only one by one or in parallel. If the assembly process of the tile system takes expected time S, then for any  > 0, the average of the assembly times over 48S2 1  simulations of the assembly process will be between S −  and S +  with probability at least 3/4. Proof: We only need to bound the variance of the assembly time of a simulation to show that the average of the assembly times of simulations converges fast. Suppose the expected time for the final shape to assemble is S. From Markov's inequality, the probability of having the time of a simulation greater than 2S is at most 0.5. Also, the configuration at time 2S contains the seed structure because tiles in the seed structure do not fall off. Therefore if the assembly process is not finished at time 2S, then starting from time 2S, the expected time for the process to finish is less than S. Thus, the probability that a simulation takes more than 2kS 2i (2iS)2 = 24S2.  simulations, then the probability that the average of the assembly 2 time is at most 2−k, and the variance of the assembly time of a simulation is at most(cid:80) Thus, for any given , if we run 48S2 1 times of the simulations lands between S −  and S +  is at least 3/4. Theorem 5 Consider any tile system for which properties 2 through 4 in Theorem 2 hold but there is no assumption on whether tiles can attach only one by one or in parallel. Let N be the number of positions outside the seed structure in the terminal assembly. If the assembly process of the tile system takes expected time S, then for any  > 0, the average of the assembly times over O(n4 ) simulations of the assembly process will be between S −  and S +  with probability at least 3/4. Proof: Goel et al. [8] showed that if all tiles have concentrations c, then the expected assembly time is Θ(d/c), where d is the length of the longest path in the assembly order of the terminal assembly. Since reducing tile concentrations only slows down the assembly process, the expected assembly time S is O(d/cmin) = O(n/cmin). The theorem follows from this upper bound on S and Lemma 4. 2 1  c2 min 1 i 6 Further Research In Section 3, we gave closed-form formulas to minimize the growth errors by varying the concentration of each tile. In Section 4, we found in simulations that facet errors are also an important factor that needs to 10 be considered in lab implementations. At the theoretical level, it is open to find closed-form formulas or efficient algorithms to minimize the facet errors by varying the tile concentrations. In Section 5, we gave closed-form formulas to minimize the expected assembly time for a feasible class of tile systems by varying the tile concentrations. For general tile systems, the best known algorithm can compute an O(log n)-approximation of the minimum expected assembly time [2]. It is of interest to determine whether one can compute the precise minimum expected assembly time or an estimate with a better approximation factor than O(log n). Given tile concentrations, we showed that simulations can accurately predict the expected assembly time with high probability. The time it takes to run the required simulations is polynomial in the size of the terminal assembly, not the tile system itself. It would be useful if one can approximate the expected assembly time just by analyzing the tile system and some succinct features of the terminal assembly (e.g., the number of times each tile appears outside the seed structure in the terminal assembly) in time polynomial in the size of the tile system. References [1] L. Adleman, Q. Cheng, A. Goel, and M.-D. Huang. Running time and program size for self-assembled squares. In Proceedings of the Thirty-third Annual ACM Symposium on Theory of Computing, pages 740 -- 748, 2001. [2] L. Adleman, Q. Cheng, A. Goel, M.-D. Huang, D. Kempe, P. Moisset de Espans, and P. Rothemund. In Proceedings of the Thiry-Fourth Annual Combinatorial optimization problems in self-assembly. ACM Symposium on Theory of Computing, pages 23 -- 32, 2002. [3] R. Barish, R. Schulman, P. W. K. Rothemund, and E. Winfree. An information-bearing seed for nucleating algorithmic self-assembly. In Proceedings of the National Academy of Sciences, volume 106, pages 6054 -- 6059, 2009. [4] R. D. Barish, P. W. K. Rothemund, and E. Winfree. Two computational primitives for algorithmic self-assembly: Copying and counting. Nano Letters, 5(12):2586 -- 2592, 2005. [5] J. Bishop and E. Klavins. An improved autonomous DNA nanomotor. Nano Letters, 7(9):2574 -- 2577, 2007. [6] H.-L. Chen and A. Goel. Error free self-assembly using error prone tiles. In Proceedings of the Tenth International Meeting on DNA Based Computers, pages 62 -- 75, June 2004. [7] H.-L. Chen, C. Luhrs, and A. Goel. Dimension augmentation and combinatorial criteria for efficient error-resistant DNA self-assembly. In Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 409 -- 418, 2008. [8] Q. Cheng, A. Goel, and P. Moisset. Optimal self-assembly of counters at temperature two. In Pro- ceedings of the First Conference on Foundations of Nanoscience: Self-Assembled Architectures and Devices, pages 62 -- 75, 2004. [9] H. Dietz, S. Douglas, and W. Shih. Folding DNA into twisted and curved nanoscale shapes. Science, 325:725 -- 730, 2009. [10] B. Ding and N. Seeman. Operation of a DNA robot arm inserted into a 2D DNA crystalline substrate. Science, 384:1583 -- 1585, December 2006. 11 [11] D. Doty. Randomized self-assembly for exact shapes. In Proceedings of the 50th Annual IEEE Sym- posium on Foundations of Computer Science, pages 85 -- 94, 2009. [12] S. Douglas, H. Dietz, T. Liedl, B. Hogberg, F. Graf, and W. Shih. Self-assembly of DNA into nanoscale three-dimensional shapes. Nature, (459):414 -- 418, 2009. [13] S. Green, J. Bath, and A. Turberfield. Coordinated chemomechanical cycles: a mechanism for au- tonomous molecular motion. Physical Review Letters, (101):238101, 2008. [14] S. Sahu J. Reif and P. Yin. Compact error-resilient computational DNA tiling assemblies. In Proceed- ings of the Tenth International Meeting on DNA Based Computers, pages 293 -- 307, 2004. [15] M.-Y. Kao and R. Schweller. Reducing tile complexity for self-assembly through temperature pro- gramming. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 571 -- 580, 2006. [16] M. Lagoudakis and T. LaBean. 2D DNA self-assembly for satisfiability. In Proceedings of the 5th DIMACS Workshop on DNA Based Computers in DIMACS Series in Discrete Mathematics and Theo- retical Computer Science, volume 54, pages 141 -- 154, 1999. [17] P. Rothemund and E. Winfree. The program-size complexity of self-assembled squares (extended In Proceedings of the Thirty-Second Annual ACM Symposium on Theory of Computing, abstract). pages 459 -- 468, 2000. [18] P. W. K. Rothemund. Folding DNA to create nanoscale shapes and patterns. Nature, (440):297 -- 302, March 2006. [19] P. W. K. Rothemund, N. Papadakis, and E. Winfree. Algorithmic self-assembly of DNA Sierpinski triangles. PLOS Biology, 2:424 -- 436, 2004. [20] R. Schulman and E. Winfree. Programmable control of nucleation for algorithmic self-assembly. In Proceedings of the Tenth International Meeting on DNA Based Computers, pages 319 -- 328, 2004. [21] R. Schulman and E. Winfree. Self-replication and evolution of DNA crystals. In Proceedings of the Fifth European Conference on Artificial Life, pages 734 -- 743, 2005. [22] G. Seelig, D. Soloveichik, D. Zhang, and E. Winfree. Enzyme-free nucleic acid logic circuits. Science, 314:1585 -- 1588, 2006. [23] W.B. Sherman and N.C. Seeman. A precisely controlled DNA bipedal walking device. Nano Letters, 4:1203 -- 1207, 2004. [24] W. M. Shih, J. D. Quispe, and G. F. A. Joyce. A 1.7-kilobase single-stranded DNA that folds into a nanoscale octahedron. Nature, (427):618 -- 621, 2004. [25] J.-S. Shin and N.A. Pierce. A synthetic DNA walker for molecular transport. Journal of American Chemistry Society, 126:10834 -- 10835, 2004. [26] D. Soloveichik, M. Cook, and E. Winfree. Combining self-healing and proofreading in self-assembly. Natural Computing, (7):203 -- 218, 2008. 12 [27] D. Soloveichik and E. Winfree. Complexity of self-assembled shapes. SIAM Journal on Computation, 36:1544 -- 1569, 2007. [28] H. Wang. Proving theorems by pattern recognition ii. Bell Systems Technical Journal, 1961. 40:1-42. [29] E. Winfree. Algorithmic Self-Assembly of DNA. PhD thesis, California Institute of Technology, Pasadena, 1998. [30] E. Winfree and R. Bekbolatov. Proofreading tile sets: Error correction for algorithmic self-assembly. In Proceedings of the Ninth International Meeting on DNA Based Computers. Madison, Wisconsin, June 2003. [31] E. Winfree, F. Liu, L. Wenzler, and N. Seeman. Design and self-assembly of two-dimensional DNA crystals, 6 pages. Nature, (394):539 -- 544, Aug 1998. [32] E. Winfree et al.. The xgrow simulator. http://www.dna.caltech.edu/Xgrow/xgrow www.html. [33] B. Yurke, A. Turberfield, A. Mills Jr, F. Simmel, and J. Neumann. A DNA-fuelled molecular machine made of DNA. Nature, (406):605 -- 608, Aug 2000. [34] Y. Zhang and N. Seeman. Construction of a DNA-truncated octahedron. Journal of American Chemical Society, 116(5):1661, 1994. 13
1311.3731
1
1311
2013-11-15T05:50:38
Chapter 10: Algebraic Algorithms
[ "cs.DS", "math.NA", "cs.SC" ]
Our Chapter in the upcoming Volume I: Computer Science and Software Engineering of Computing Handbook (Third edition), Allen Tucker, Teo Gonzales and Jorge L. Diaz-Herrera, editors, covers Algebraic Algorithms, both symbolic and numerical, for matrix computations and root-finding for polynomials and systems of polynomials equations. We cover part of these large subjects and include basic bibliography for further study. To meet space limitation we cite books, surveys, and comprehensive articles with pointers to further references, rather than including all the original technical papers.
cs.DS
cs
Computing Handbook (Third edition) Volume I: Computer Science and Software Engineering Allen Tucker, Teo Gonzales and Jorge L. Diaz-Herrera, editors Taylor and Francis Group Publishers, 2014 3 1 0 2 v o N 5 1 ] S D . s c [ 1 v 1 3 7 3 . 1 1 3 1 : v i X r a 1 CHAPTER 10: ALGEBRAIC ALGORITHMS 1 Ioannis Z. Emiris Department of Informatics and Telecommunications, University of Athens, Athens 15784, Greece. [email protected] Victor Y. Pan Mathematics and Computer Science Department, Lehman College, City University of New York, Bronx, NY 10468, USA. [email protected]. http://comet.lehman.cuny.edu/vpan/ Elias P. Tsigaridas project PolSys, Laboratoire d’ Informatique de Paris 6 Universit Pierre and Marie Curie and INRIA Paris-Rocquencourt, France [email protected] 1 Introduction Algebraic algorithms deal with numbers, vectors, matrices, polynomials, for- mal power series, exponential and differential polynomials, rational functions, algebraic sets, curves and surfaces. In this vast area, manipulation with matri- ces and polynomials is fundamental for modern computations in Sciences and Engineering. The list of the respective computational problems includes the so- lution of a polynomial equation and linear and polynomial systems of equations, univariate and multivariate polynomial evaluation, interpolation, factorization and decompositions, rational interpolation, computing matrix factorization and decompositions (which in turn include various triangular and orthogonal factor- izations such as LU, PLU, QR, QRP, QLP, CS, LR, Cholesky factorizations and eigenvalue and singular value decompositions), computation of the matrix char- acteristic and minimal polynomials, determinants, Smith and Frobenius normal forms, ranks, and (generalized) inverses, univariate and multivariate polynomial resultants, Newton’s polytopes, greatest common divisors, and least common multiples as well as manipulation with truncated series and algebraic sets. Such problems can be solved by using the error-free symbolic computations with infinite precision. Computer algebra systems such as Maple and Mathe- matica compute the solutions based on various nontrivial computational tech- niques such as modular computations, the Euclidean algorithm and continuous fraction approximation, Hensel’s and Newton’s lifting, Chinese Remainder algo- rithm, elimination and resultant methods, and Grobner bases computation. The 1This material is based on work supported in part by the European Union through Marie- Curie Initial Training Network “SAGA” (ShApes, Geometry, Algebra), with FP7-PEOPLE contract PITN-GA-2008-214584 (first author), by NSF Grant CCF-1116736 and PSC CUNY Awards 63153–0041 and 64512–0042 (second author), by the Danish Agency for Science, Technology and Innovation (postdoctoral grant), Danish NRF and NSF of China (grant 61061130540), CFEM, and the Danish Strategic Research Council (third author). Sections 3.5, 5, and “Further information” have been written jointly by all authors, Section 4 has been contributed essentially by the first author, the other sections by the second author. 2 price to achieve perfect accuracy is the substantial memory space and computer time required to support the computations. The alternative numerical methods rely on operations with binary or dec- imal numbers truncated or rounded to a fixed precision. Operating with the IEEE standard floating point numbers represented with single or double preci- sion enables much faster computations using much smaller memory but requires theoretical and/or experimental study of the impact of rounding errors on the output. The study involves forward and backward error analysis, linear and nonlinear operators, and advanced techniques from approximation and pertur- bation theories. Solution of some problems involves more costly computations with extended precision. The resulting algorithms support high performance libraries and packages of subroutines such as those in Matlab, NAG SMP, LA- PACK, ScaLAPACK, ARPACK, PARPACK, MPSolve, and EigenSolve. In this chapter we cover both approaches, whose combination frequently increases their power and enables more effective computations. We focus on the algebraic algorithms in the large, popular and highly important fields of matrix computations and root-finding for univariate polynomials and systems of multivariate polynomials. We cover part of these huge subjects and include basic bibliography for further study. To meet space limitation we cite books, surveys, and comprehensive articles with pointers to further references, rather than including all the original technical papers. Our expositions in Sections 2 and 3 follow the line of the first surveys in this area in [163, 168, 173, 174, 175]. We state the complexity bounds under the random access machine (RAM) model of computation [1, 96]. In most cases we assume the arithmetic model, that is we assign a unit cost to addition, subtraction, multiplication, and division of real numbers, as well as to reading or writing them into a memory location. This model is realistic for computations with a fixed (e.g., the IEEE standard single or double) precision, which fits the size of a computer word, and then the arithmetic model turns into the word model [96]. In other cases we allow working with extended precision and assume the Boolean or bit model, assigning a unit cost to every Boolean or bitwise operation. This accounts for both arithmetic operations and the length (precision) of the operands. We denote the bounds for this complexity by OB(·). We explicitly specify whether we use the arithmetic, word, or Boolean model unless this is clear from the context. We write ops for “arithmetic operations”, “log” for “log2” unless specified otherwise, and OB(·) to show that we are ignoring logarithmic factors. 2 Matrix Computations Matrix computations is the most popular and a highly important area of sci- entific and engineering computing. Most frequently they are performed nu- merically, with values represented using the IEEE standard single or double precision. In the chapter of this size we must omit or just barely touch on many important subjects of this field. The reader can find further material and bibli- ography in the surveys [163, 168] and the books [6, 8, 21, 56, 62, 64, 103, 110, 178, 3 223, 228, 240] and for more specific subject areas in [6, 103, 223, 228, 238, 240] on eigendecomposition and SVD, [8, 56, 62, 103, 110, 223, 228] on other numer- ical matrix factorizations, [23, 130] on the over- and under-determined linear systems, their least-squares solution, and various other numerical computations with singular matrices, [106] on randomized matrix computations, [114, 178] on structured matrix computations, [21, 103, 172, 211] on parallel matrix algo- rithms, and [43, 47, 66, 67, 96, 97, 115, 116, 169, 172, 202, 183, 227, 239] on “Error-free Rational Matrix Computations”, including computations over finite fields, rings, and semirings that produce solutions to linear systems of equations, matrix inverses, ranks, determinants, characteristic and minimal polynomials, and Smith and Frobenius normal forms. 2.1 Dense, Sparse and Structured Matrices. Their Storage and Multiplication by Vectors An m × n matrix A = [ ai,j , i = 1, . . . , m; j = 1, . . . , n ] is also denoted [ai,j]m,n i,j=1 and [A1 . . . Am]; it is a 2-dimensional array with the (i, j)th entry [A]i,j = ai,j and the jth column Aj . AT is the transpose of A. Matrix A is a column vector if n = 1 and a row vector if m = 1. Vector v = [vi]n i=1 is an nth dimensional column vector. The straightforward algorithm computes the product Av by performing (2n − 1)m ops; this is optimal for general (dense unstructured) m × n matrices, represented with their entries, but numerous applications involve structured matrices represented with much fewer than mn scalar values. A matrix is singular if its product by some vectors vanish; they form its null space. An m × n matrix is sparse if it is filled mostly with zeros, having only φ = o(mn) nonzero entries. An important class is the matrices associated with graphs that have families of small separators [102, 134]. This includes banded matrices [bi,j]i,j with small bandwidth 2w+1 such that bi,j = 0 unless i−j ≤ w. A sparse matrix can be stored economically by using appropriate data structures and can be multiplied by a vector fast, in 2φ − m ops. Sparse matrices arise in many important applications, e.g., to solving ordinary and partial differential equations (ODEs and PDEs) and graph computations. Dense structured n × n matrices are usually defined by O(n) parameters, and one can apply FFT to multiply such matrix by a vector by using O(n log n) or O(n log2 n) ops [178]. Such matrices are omnipresent in applications in signal and image processing, coding, ODEs, PDEs, particle simulation, and Markov chains. Most popular among them are the Toeplitz matrices T = [ti,j ]m,n i,j=1 and the Hankel matrices H = [hi,j]m,n i,j=1 where ti,j = ti+1,j+1 and hi,j = hi+1,j−1 for all i and j in the range of their definition. Each such matrix is defined by m + n− 1 entries of its first row and first or last column. Products T v and Hv can be equivalently written as polynomial products or vector convolutions; their FFT-based computation takes O((m + n) log(m + n)) ops per product [1, 21, 178]. Many other fundamental computations with Toeplitz and other structured matrices can be linked to polynomial computations enabling acceleration in both 4 areas of computing [17, 18, 19, 20, 21, 24, 81, 85, 150, 151, 152, 168, 172, 178, 187, 208, 209]. Similar properties hold for Vandermonde matrices V = [vj i ]m−1,n−1 ]m,n and Cauchy matrices C = [ i,j=1 where si and tj denote m + n distinct i,j=0 1 si−tj i,j scalars. One can extend the structures of Hankel, B´ezout, Sylvester, Frobenius (com- panion), Vandermonde, and Cauchy matrices to more general classes of matrices by associating linear displacement operators. (See [21, 178] for the details and the bibliography.) The important classes of semiseparable, quasiseparable and other rank structured m × n matrices generalize banded matrices and their in- verses; they are expressed by O(m + n) parameters and can be multiplied by vectors by performing O(m + n) ops [68, 232]. 2.2 Matrix Multiplication, Factorization, Randomization The straightforward algorithm computes the m × p product AB of m × n by n × p matrices by using 2mnp − mp ops, which is 2n3 − n2 if m = n = p. This upper bound is not sharp. Strassen decreased it to O(n2.81) ops in 1969. His result was first improved in [162] and 10 times afterward, most recently by Coppersmith and Winograd in [48], Stothers in [225], and Vasilevska Williams in [234], who use Cnω ops for ω < 2.376, ω < 2.374 and ω < 2.3727, respectively. Due to the huge overhead constants C, however, we have that Cnω < 2n3 only for enormous values n. The well recognized group-theoretic techniques [44] enable a distinct description of the known matrix multiplication algorithms, but so far have only supported the same upper bounds on the complexity as the preceding works. References [225] and [234] extend the algorithms given in Reference [48], which in turn combines arithmetic progression technique with the previous advanced techniques. Each technique, however, contributes to a dramatic increase of the overhead constant that makes the resulting algorithms practically noncompetitive. The only exception is the trilinear aggregating technique of [161] (cf. [163]), which alone supports the exponent 2.7753 [128] and together with the Any Pre- cision Approximation (APA) techniques of [163] was an indispensable ingredient of all algorithms that have beaten Strassen’s exponent 2.81 of 1969. The triple product property (TPP), which is the basis of [44], may very well have a natural link to trilinear aggregating, although the descriptions available for the two ap- proaches are distinct. For matrices of realistic sizes the numerical algorithms in [118], relying on trilinear aggregating, use about as many ops as the algorithms of Strassen of 1969 and Winograd of 1971 but need substantially less memory space and are more stable numerically. The exponent ω of matrix multiplication is fundamental for the theory of computing because O(nω) or O(nω log n) bounds the complexity of many impor- tant matrix computations such as the computation of det A, the determinant of an n× n matrix A; its inverse A−1 (where det A 6= 0); its characteristic polyno- mial cA(x) = det( xI − A ) and minimal polynomial mA(x), for a scalar variable x; the Smith and Frobenius normal forms; the rank, rank A; a submatrix of A 5 having the maximal rank, the solution vector x = A−1 v to a nonsingular linear system of equations A x = v, and various orthogonal and triangular factoriza- tions of the matrix A, as well as various computations with singular matrices and seemingly unrelated combinatorial and graph computations, e.g., pattern recognition or computing all pair shortest distances in a graph [21, p. 222] or its transitive closure [1]. Consequently, all these operations use O(nω) ops where theoretically ω < 2.3727 [1, chap.6], [21, chap. 2]. In practice, however, the so- lution of all these problems takes order of n3 ops, because of the huge overhead constant C of all known algorithms that multiply n× n matrices in Cnω ops for ω < 2.775, the overhead of the reduction to a matrix multiplication problem, the memory space requirements, and numerical stability problems [103]. Moreover, the straightforward algorithm for matrix multiplication remains the users’ choice because it is highly effective on parallel and pipeline architec- tures [103, 211]; on many computers it supersedes even the so called “superfast” algorithms, which multiply a pair of n × n structured matrices in nearly linear arithmetic time, namely, by using O(n log n) or O(n log2 n) ops, where both input and output matrices are represented with their short generator matrices having O(n) entries [178]. Numerous important practical problems have been reduced to matrix mul- tiplication because it is so effective. This has also motivated the development of block matrix algorithms (called level-three BLAS, which is the acronym for Basic Linear Algebra Subprograms). Devising asymptotically fast matrix multipliers, however, had independent technical interest. E.g., trilinear aggregating was a nontrivial decomposition of the 3-dimensional tensor associated with matrix multiplication, and [161] was the first of now numerous examples where nontrivial tensor decompositions enable dramatic acceleration of important matrix computations [124, 137, 160]. The two basic techniques below extend matrix multiplication. Hereafter O denotes matrices filled with zeros; I is the square identity matrices, with ones on the diagonal and zeros elsewhere. Suppose we seek the Krylov sequence or Krylov matrix [Biv]k−1 i=0 for an n× n matrix B and an n-dimensional vector v [103, 104, 239]; in block Krylov com- putations the vector v is replaced by a matrix. The straightforward algorithm uses (2n− 1)n(k− 1) ops, that is about 2n3 for k = n. An alternative algorithm first computes the matrix powers B2, B4, B8, . . . , B2s , s = ⌈ log k ⌉ − 1 , by n×2i matrices, for i = 0, 1, . . . , s: and then the products of n×n matrices B2i [ v, Bv ] =(cid:2) B2v, B3v (cid:3) , (cid:2) v, Bv, B2v, B3v (cid:3) =(cid:2) B4v, B5v, B6v, B7v (cid:3) , B v , B2 B4 ... 6 A =(cid:20) I O I (cid:21)(cid:20) A0,0 O S (cid:21)(cid:20) I A−1 O 0,0A0,1 (cid:21) The last step completes the evaluation of the Krylov sequence in 2s + 1 matrix multiplications, by using O(nω log k) ops overall. Special techniques for parallel computation of Krylov sequences for sparse and/or structured matrices A can be found in [170]. According to these tech- niques, Krylov sequence is recovered from the solution to the associated linear system (I − A) x = v, which is solved fast in the case of a special matrix A. Another basic idea of matrix algorithms is to represent the input matrix A as a block matrix and to operate with its blocks rather than with its entries. E.g., one can compute det A and A−1 by first factorizing A as a 2 × 2 block matrix, (1) I O A1,0A−1 0,0 where S = A1,1 − A1,0A−1 0,0A0,1. The 2 × 2 block triangular factors are readily invertible, det A = (det A0,0) det S and (BCD)−1 = D−1C −1B−1, and so the cited tasks for the input A are reduced to the same tasks for the half-size ma- trices A0,0 and S. It remains to factorize them recursively. The northwestern blocks (such as A0,0), called leading principal submatrices, must be nonsingular throughout the recursive process, but this property holds for the highly impor- tant class of symmetric positive definite matrices A = CT C, det C 6= 0, and can be also achieved by means of symmetrization, pivoting, or randomization [1, chap. 6], [21, chap. 2], [178, sects. 5.5 and 5.6]). Recursive application of (1) should produce the LDU factorization A = LDU where the matrices L and U T are lower triangular and D diagonal. Having this factorization computed , we can readily solve linear systems Axi = bi for various vectors bi, by using about 2n2 ops for each i, rather than 2 3 n3 + O(n2) in Gaussian elimination. Factorizations (including PLU, QR, QRP, QLP, CS, LR, Cholesky factor- izations and eigenvalue and singular value decompositions) are the most basic tool of matrix computations (see, e.g., [223]), recently made even more pow- erful with randomization (see [106, 186, 188, 193, 194, 195, 196, 198], and the bibliography therein). It is well known that random matrices tend to be non- singular and well conditioned (see, e.g., [218]), that is they lie far from singular matrices and therefore [103, 110, 223] are not sensitive to rounding errors and are suitable for numerical computations. The solution x = A−1b of a nonsin- gular linear system Ax = b of n equations can be obtained with a precision pout in O B(n3p + n2pout) Boolean time for a fixed low precision p provided the matrix A is well conditioned; that accelerates Gaussian elimination by an order of magnitude for large n + pout. Recent randomization techniques in [106, 186, 188, 193, 194, 195, 196, 198] extend this property to much larger class of linear systems and enhance the power of various other matrix computations with singular or ill conditioned matrices, e.g., their approximation by low-rank matrices, computing a basis for the null space of a singular matrix, and ap- proximating such bases for nearby singular matrices. Similar results have been proved for rectangular and Toeplitz matrices. We refer the reader to [106, 218, 99] on impressive progress achieved in many other areas of matrix computations by means of randomization techniques. 7 2.3 Solution of linear systems of equations The solution of a linear system of n equations, Ax = b is the most frequent operation in scientific and engineering computations and is highly important theoretically. Gaussian elimination solves such a system by applying (2/3)n3 + O(n2) ops. Both Gaussian elimination and (Block) Cyclic Reduction use O(nw2) ops for banded linear systems with bandwidth O(w). One can solve rank structured linear systems in O(n) ops [68, 232]; generalized nested dissection uses O(n1.5) flops for the inputs associated with small separator families [134, 169, 202]. Likewise, we can dramatically accelerate Gaussian elimination for dense structured input matrices represented with their short generators, defined by the associated displacement operators. This includes Toeplitz, Hankel, Van- dermonde, and Cauchy matrices as well as matrices with similar structures. The MBA divide-and-conquer “superfast” algorithm (due to papers by Morf of 1974/1980 and Bitmead and Anderson of 1980) solves nonsingular structured linear systems of n equations in O(n log2 n) ops by applying the recursive 2 × 2 block factorization (1) and preserving matrix structure [21, 178, 191, 206]. In the presence of rounding errors, however, Gaussian elimination, the MBA and Cyclic Reduction algorithms easily fail unless one applies pivoting, that is interchanges the equations (and sometimes unknowns) to avoid divisions by absolutely small numbers. A by-product is the factorization A = P LU or A = P LU P ′, for lower triangular matrices L and U T and permutation matrices P and P ′. Pivoting, however, takes its toll. It “usually degrades the performance” [103, page 119] by interrupting the string of arithmetic computations with the foreign operations of comparisons, is not friendly to block matrix algorithms and updat- ing input matrices, hinders parallel processing and pipelining, and tends to de- stroy structure and sparseness, except for the inputs that have Cauchy-like and Vandermonde-like structure. The latter exceptional classes have been extended to the inputs with structures of Toeplitz/Hankel type by means of displacement transformation [167, 178]. The users welcome this numerical stabilization, even though it slows down the MBA algorithm by a factor of n/ log2 n, that is from “superfast” to “fast”, which is still by a factor of n faster than the solution for general unstructured inputs, which takes order n3 ops. Can we avoid pivoting in numerical algorithms with rounding for general, sparse and structured linear systems to achieve both numerical stability and superfast performance? Yes, for the important classes where the input matri- ces A = (aij )i,j are diagonally dominant, that is aii > Pi6=j aij or aii > Pj6=i aij for all i, or symmetric positive definite, that is A = CT C for a nonsin- gular matrix C. To these input classes Gaussian elimination, Cyclic Reduction, and the MBA algorithm can be safely applied with rounding and with no piv- oting. For some other classes of sparse and positive definite linear systems, pivoting has been modified into nested dissection, Markowitz heuristic rule, and other techniques that preserve sparseness during the elimination yielding faster solution without causing numerical problems [62, 101, 134, 169, 202]. Can we extend these benefits to other input matrix classes? 8 Every nonsingular linear system A x = b is equivalent to the symmetric positive definite ones AT A x = AT b and A AT y = b where x = Ay, but great caution is recommended in such symmetrizations because the condition number κ(A) = A2A−12 ≥ 1 is squared in the transition to the matrices AT A and AAT , which means growing propagation and magnification of rounding errors. There are two superior directions. The algorithms of [195, 196, 199] avoid pivoting for general and structured linear systems by applying randomization. These techniques are recent, proposed in [186, Sect. 12.2], but their effectiveness has formal and experimental support. A popular classical alternative to Gaussian elimination is the iterative so- lution, e.g., by means of the Conjugate Gradient and GMRES algorithms [10, 103, 104, 233]. They compute sufficiently long Krylov sequences (defined in the previous section) and then approximate the solution with linear combinations Pi ciAib orPi ci(AT A)iAT b for proper coefficients ci. The cost of computing the product of the matrix A or AT A by a vector is dominant, but it is small for structured and sparse matrices A. One can even call a matrix sparse or structured if and only if it can be multiplied by a vector fast. Fast convergence to the solution is critical. It is not generally guaranteed but proved for some important classes of input matrices. The major challenge are the extension of these classes and the design of powerful methods for special input classes, notably multilevel methods (based on the algebraic multigrid) [149, 140, 201] and tensor decompositions [160, 124], highly effective for many linear systems arising in discretization of ODEs, PDEs, and integral equations. Preconditioning of the input matrices at a low computational cost accelerates convergence of iterations for many important classes of sparse and structured linear systems [10, 104], and more recently, based on randomized precondition- ing, for quite general as well as structured linear systems [186, 188, 193, 194, 195, 196, 198]. One can iteratively approximate the inverse or pseudo-inverse of a matrix [103, Section 5.5.4] by means of Newton’s iteration Xi+1 = 2Xi − XiM Xi, i = 0, 1, . . .. We have I − M Xi+1 = (I − M Xi)2 = (I − M X0)2i+1 ; therefore, the residual norm I − M Xi is squared in every iteration step, I − M Xi ≤ I − M X02i for i = 1, 2, . . ., and so convergence is very fast unless I − M X0 ≥ 1 or is near 1. The cost of two matrix multiplications is dominant per an iteration step; this makes the computation fast on multiprocessors as well as in the case of structured matrices M and Xi. See more on Newton’s iteration, including the study of its initialization, convergence, and preserving displacement matrix structure, in [178, chapters 4 and 6], [203, 185, 200, 205, 189, 182]. 2.4 Symbolic Matrix Computations Rational matrix computations for a rational or integer input (such as the so- lution of a linear system and computing the determinant of a matrix) can be performed with no errors. To decrease the computational cost, one should con- trol the growth of the precision of computing. Some special techniques achieve 9 this in rational Gaussian elimination [7, 97]. As a more fundamental tool one can reduce the computations modulo a sufficiently large integer m to obtain the rational or integer output values z = p/q (e.g., the solution vector for a linear system) modulo m. Then we can recover z from two integers m and z mod m by applying the continued fraction approximation algorithm, in other contexts called Euclidean algorithm [96, 237]. Instead we can readily obtain z = z mod m if z mod m < r or z = −m + z mod m if z mod m < r otherwise, provided we know that the integer z lies in the range [−r, r] and if m > 2r. Computing the determinant of an integer matrix, we can choose the modulus m based on Hadamard’s bound. A nonsingular linear system Ax = v can become singular after the reduction modulo a prime p but only with a low probability for a random choice of a prime p in a fixed sufficiently large interval as well as for a reasonably large power of two and a random integer matrix [206]. One can choose m = m1m2 ··· mk for pairwise relatively prime integers m1, m2, . . . , mk (we call them coprimes), then compute z modulo all these co- primes, and finally recover z by applying the Chinese Remainder algorithm [1, 96]. The error-free computations modulo mi require the precision of log mi bits; the cost of computing the values z mod mi for i = 1, . . . , k dominates the cost of the subsequent recovery of the value z mod m. Alternatively one can apply p-adic (Newton–Hensel ) lifting [96]. For solving linear systems of equations and matrix inversion they can be viewed as the sym- bolic counterparts to iterative refinement and Newton’s iteration of the previous section, both well known in numerical linear algebra [183]. Newton’s lifting begins with a prime p, a larger integer k, an integer ma- trix M , and its inverse Q = M −1 mod p, such that I − QM mod p = 0. Then one writes X0 = Q, recursively computes the matrices Xj = 2Xj−1 − Xj−1M Xj−1 mod (p2j ) for j = 1, 2, . . . , k, and finally recovers the inverse matrix M −1 from Xk = M −1 mod p2k ), notes that I − XjM = 0 mod (p2j . Hensel’s lifting begins with the same input complemented with an integer vector b. Then one writes r(0) = b, recursively computes the vectors u(i) = Qr(i) mod p, r(i+1) = (r(i) − M u(i))/p, i = 0, 1, . . . , k − 1, and x(k) =Pk−1 i=0 u(i)pi such that M x(k) = b mod (pk), and finally recovers the solution x to the linear system M x = b from the vector x(k) = x mod (pk). Newton’s and Hensel’s lifting are particularly powerful where the input ma- trices M and M −1 are sparse and/or structured, e.g., Toeplitz, Hankel, Van- dermonde, Cauchy. Hensel’s lifting enables the solution in nearly optimal time under both Boolean and word models [183]. We can choose p being a power of two and use computations in the binary mode. Reference [69] discusses lifting for sparse linear systems. 2.5 Computing the Sign and the Value of a Determinant The value or just the sign of det A, the determinant of a square matrix A, are required in some fundamental geometric and algebraic/geometric computations 10 such as the computation of convex hulls, Voronoi diagrams, algebraic curves and surfaces, multivariate and univariate resultants and Newton’s polytopes. Faster numerical methods are preferred as long as the correctness of the output can be certified. In the customary arithmetic filtering approach, one applies fast numerical methods as long as they work and, in the rare cases when they fail, shifts to the slower symbolic methods. For fast numerical computation of det A one can employ factorizations A = P LU P ′ (see Section 2.2) or A = QR [45, 103], precondition the matrix A [186], and then certify the output sign [207]. If A is a rational or integer matrix, then the Chinese Remainder algorithm of the previous subsection is highly effective, particularly using heuristics for working modulo m for m much smaller than Hadamard’s bound on det A [26]. Alternatively [165, 166, 70], one can solve linear systems Ay(i) = b(i) for random vectors b(i) and then apply Hensel’s lifting to recover det A as a least common denominator of the rational components of all y(i). Storjohann in [224] advanced randomized Newton’s lifting to yield det A more directly in the optimal asymptotic Boolean time OB(nω+1) for ω < 2.3727. Wiedemann in 1986, Coppersmith in 1994, and a number of their successors compute det A by extending the Lanczos and block Lanczos classical algorithms. This is particularly effective for sparse or structured matrices A and in further extension to multivariate determinants and resultants (cf. [117, 85, 86, 180]). 3 Polynomial Root-Finding and Factorization 3.1 Computational Complexity Issues Approximate solution of an nth degree polynomial equation, p(x) = nXi=0 pi xi = pn nYj=1 (x − zj) = 0 , pn 6= 0, (2) that is the approximation of the roots z1, . . . , zn for given coefficients p0, . . . , pn, is a classical problem that has greatly influenced the development of mathemat- ics and computational mathematics throughout four millennia, since the Sume- rian times [173, 174]. The problem remains highly important for the theory and practice of the present day algebraic and algebraic/geometric computation, and new root-finding algorithms appear every year [141, 142, 143, 144]. To approximate even a single root of a monic polynomial p(x) within error bound 2−b we must process at least (n + 1)nb/2 bits of the input coefficients p0, . . . , pn−1. Indeed perturb the x-free coefficient of the polynomial (x − 6/7)n by 2−bn. Then the root x = 6/7 jumps by 2−b, and similarly if we perturb the coefficients pi by 2(i−n)b for i = 1, . . . , n−1. Thus to ensure the output precision of b bits, we need an input precision of at least (n − i)b bits for each coefficient pi, i = 0, 1, . . . , n − 1. We need at least ⌈(n + 1)nb/4⌉ bitwise operations to process these bits, each operation having at most two input bits. It can be surprising, but we can approximate all n roots within 2−b by using bn2 Boolean (bit) operations up to a polylogarithmic factor for b of order n log n 11 or higher, that is we can approximate all roots about as fast as we write down the input. We achieve this by applying the divide-and-conquer algorithms in [171, 173, 179] (see [123, 157, 219] on the related works). The algorithms first compute a sufficiently wide root-free annulus A on the complex plane, whose exterior and interior contain comparable numbers of the roots, that is the same numbers up to a fixed constant factor. Then the two factors of p(x) are numerically computed, that is F (x), having all its roots in the interior of the annulus, and G(x) = p(x)/F (x), having no roots there. Then the polynomials F (x) and G(x) are recursively factorized until factorization of p(x) into the product of linear factors is computed numerically. From this factorization, approximations to all roots of p(x) are obtained. For approximation of a single root see the competitive algorithms of [177]. It is interesting that, up to polylog factors, both lower and upper bounds on the Boolean time decrease to bn [179] if we only seek the factorization of p(x), that is, if instead of the roots zj, we compute scalars aj and bj such that p(x) − nYj=1 (ajx − cj) < 2−bp(x) (3) for the polynomial norm Pi qixi =Pi qi. The isolation of the zeros of a polynomial p(x) of (2) having integer coeffi- cients and simple zeros is the computation of n disjoint discs, each containing exactly one root of p(x). This can be a bottleneck stage of root approximation because one can contract such discs by performing a few subdivisions and then apply numerical iterations (such as Newton’s) that would very rapidly approxi- mate the isolated zeros within a required tolerance. Reference [184] yields even faster refinement by extending the techniques of [171, 173, 179]. Based on the classical “gap theorem” (recently advanced in [84]), Schonhage in [219, Sect. 20] has reduced the isolation problem to computing factorization (3) for b = ⌈(2n + 1)(l + 1 + log(n + 1))⌉ where l is the maximal coefficient length, that is the minimum integer such that ℜ(pj) < 2l and ℑ(pj) < 2l for j = 0, 1, . . . , n. Combining the cited algorithms of [171, 173, 179] with this reduction yields Theorem 3.1 Let polynomial p(x) of (2) have n distinct simple zeros and inte- ger coefficients in the range [−2τ , 2τ ]. Then one can isolate the n zeros of p(x) from each other at the Boolean cost OB(n2τ ). The algorithms of [171, 173, 179] incorporate the techniques of [157, 219], but advance them and support substantially smaller upper bounds on the com- putational complexity. In particular these algorithms decrease by a factor of n the estimates of [219, Theorems 2.1, 19.2 and 20.1] on the Boolean complexity of polynomial factorization, root approximation and root isolation. 12 3.2 Root-Finding via Functional Iterations About the same record complexity estimates for root-finding would be also sup- ported by some functional iteration algorithms if one assumes their convergence rate defined by ample empirical evidence, although never proved formally. The users accept such an evidence instead of the proof and prefer the latter algo- rithms because they are easy to program and have been carefully implemented; like the algorithms of [171, 173, 177, 179] they allow tuning the precision of computing to the precision required for every output root, which is higher for clustered and multiple roots than for single isolated roots. For approximating a single root z, the current practical champions are mod- ifications of Newton’s iteration, z(i + 1) = z(i) − a(i)p(z(i))/p′(z(i)), a(i) being the step-size parameter [136], Laguerre’s method [94, 107], and the Jenkins– Traub algorithm [112]. One can deflate the input polynomial via its numerical division by x− z to extend these algorithms to approximating a small number of other roots. If one deflates many roots, the coefficients of the remaining factor can grow large as, e.g., in the divisor of the polynomial p(x) = x1000 + 1 that has degree 498 and shares with p(x) all its roots having positive real parts. For the approximation of all roots, a good option is the Weierstrass–Durand– Kerner’s (hereafter WDK) algorithm, defined by the recurrence , j = 1, . . . , n, l = 0, 1, . . . . (4) zj(l + 1) = zj(l) − p (zj(l)) pnQi6=j (zj(l) − zi(l)) It has excellent empirical global convergence. Reference [209] links it to poly- nomial factorization and adjusts it to approximating a single root in O(n) ops per step. A customary choice of n initial approximations zj(0) to the n roots of the polynomial p(x) (see [16] for a heuristic alternative) is given by zj(0) = j = 1, . . . , n. Here t > 1 is a fixed scalar and r is an up- x = r} r t exp(2π√−1/n) , per bound on the root radius, such that all roots zj lie in the disc {x : on the complex plane. This holds, e.g., for r = 2 max i<n pi/pn 1 n−i . (5) For a fixed l and for all j the computation in (4) uses O(n2) ops. We can use just O(n log2 n) ops if we apply fast multipoint polynomial evaluation algorithms based of fast FFT based polynomial division [1, 21, 25, 178, 190], but then we would face numerical stability problems. As with Newton’s, Laguerre’s, Jenkins–Traub’s algorithms and the Inverse Power iteration in [17, 208], one can employ this variant of the WDK to ap- proximate many or all roots of p(x) without deflation. Toward this goal, one can concurrently apply the algorithm at sufficiently many distinct initial points j = 1, . . . , N ≥ n (on a large circle for large t) or according to [16]. The work can be distributed among processors that do not need to interact with each other until they compute the roots. zj(0) = r t exp(2π√−1/N ) , 13 See [141, 142, 143, 144, 173] and references therein on this and other effec- tive functional iteration algorithms. Reference [16] covers MPSolve, the most effective current root-finding subroutines, based on Ehrlich–Aberth’s algorithm. 3.3 Matrix Methods for Polynomial Root-Finding By cautiously avoiding numerical problems [103, Sec.7.4.6], one can approximate the roots of p(x) as the eigenvalues of the associated (generalized) companion matrices, that is matrices having characteristic polynomial p(x). Then one can employ numerically stable methods and the excellent software available for matrix computations, such as the QR celebrated algorithm. E.g., Matlab’s subroutine roots applies it to the companion matrix of a polynomial. Fortune in [93] and in his root-finding package EigenSolve (citing earlier work of 1995 by Malek and Vaillancourt) apply it to other generalized companion matrices and update them when the approximations to the roots are improved. The algorithms of [17, 18, 19, 181, 15, 231, 208, 197] exploit the structure of (generalized) companion matrices, e.g., where they are diagonal plus rank-one (hereafter DPR1) matrices, to accelerate the eigenvalue computations. The pa- pers [17, 208] apply and extend the Inverse Power method [103, Section 7.6.1]; they exploit matrix structure, simplify the customary use of Rayleigh quotients for updating approximate eigenvalues, and apply special preprocessing tech- niques. For both companion and DPR1 inputs the resulting algorithms use linear space and linear arithmetic time per iteration step, enable dramatic par- allel acceleration, and deflate the input in O(n) ops; for DPR1 matrices repeated deflation can produce all n roots with no numerical problems. The algorithms of [18, 19, 15, 231] employ the QR algorithm, but decrease the arithmetic time per iteration step from quadratic to linear by exploiting the rank matrix structure of companion matrices. Substantial further refinement of these techniques is required to make them competitive with MPSolve. See [244] on recent progress. The papers [181, 197] advance Cardinal’s polynomial root-finders of 1996, based on repeated squaring. Each squaring is reduced to performing a small number of FFTs and thus uses order n log n ops. One can weigh potential advantage of convergence to nonlinear factors of p(x), representing multiple roots or root clusters, at the price of increasing the time per step by a factor of log n versus the Inverse Power method, advanced for root-finding in [17, 208]. 3.4 Extension to Approximate Polynomial GCDs Reference [176] combines polynomial root-finders with algorithms for bipartite matching to compute approximate univariate polynomial greatest common di- visor (GCD) of two polynomials, that is, the GCD of the maximum degree for two polynomials of the same or smaller degrees lying in the ǫ-neighborhood of the input polynomials for a fixed positive ǫ. Approximate GCDs are required in computer vision, algebraic geometry, computer modeling, and control. For a single example, GCD defines the intersection of two algebraic curves defined by 14 the two input polynomials, and approximate GCD does this under input per- turbations of small norms. See [14] on the bibliography on approximate GCDs, but see [167, 178, 195] on the structured matrix algorithms involved. 3.5 Univariate Real Root Isolation and Approximation In some algebraic and geometric computations, the input polynomial p(x) has real coefficients, and only its real roots must be approximated. One of the fastest real root-finders in the current practice is still MPSolve, which uses almost the same running time for real roots as for all complex roots. This can be quite vexing, because very frequently the real roots make up only a small fraction of all roots [77]. Recently, however, the challenge was taken in the papers [208, 197], whose numerical iterations are directed to converge to real and nearly real roots. This promises acceleration by a factor of d/r where the input polynomial has d roots, of which r roots are real or nearly real. In the rest of this section we cover an alternative direction, that is real root-finding by means of isolation of the real roots of a polynomial. We write p(x) = ad xd + ··· + a1 x + a0, assume integral coefficients with the maximum bit size τ = 1 + maxi≤d{lg ai}, and seek isolation of real roots, that is seek real line intervals with rational endpoints, each containing exactly one real root. We may seek also the root’s multiplicity. We assume rational algorithms, that is, error-free algorithms that operate with rational numbers. If all roots of p(x) are simple, then the minimal distance between them, the separation bound, is at most b = d−(d+2)/2(d + 1)(1−d)/22τ (1−d), or roughly 2− eO(dτ ) (e.g., [147]), and we isolate real roots as soon as we approximate them within less than b/2. Effective solution algorithms rely on Continued Fractions (see below), having highly competitive implementation in synaps [153, 109] and its descendant realroot, a package of mathemagix, on the Descartes’ rule of signs, and the Sturm or Sturm–Habicht sequences. Theorem 3.2 The rational algorithms discussed in the sequel isolate all r real roots of p(x) in eOB(d4τ 2) bitwise ops. Under certain probability distributions for the coefficients, they are expected to use eOB(d3τ ) or eOB(rd2τ ). The bounds exceed those of Theorem 3.1, but [204] has changed this, by closing the gap. Moreover rational solvers are heavily in use, have long and respected history, and are of independent technical interest. Most popular are the subdivision algorithms, such as sturm, descartes and bernstein. By mimicking binary search, they repeatedly subdivide an initial interval that con- tains all real roots until every tested interval contains at most one real root. They differ in the way of counting the real roots in an interval. The algorithm sturm (due to the work by Sturm of 1835, see [96]) is the closest to binary search; it produces isolating intervals and root multiplicities at the cost eOB(d4τ 2) [63, 83]; see [77] on the decrease of the expected cost to eOB(rd2τ ). 15 The complexity of both algorithms descartes and bernstein is eOB(d4τ 2) [72, 83]. Both rely on Descartes’ rule of sign, but the bernstein algorithm also employs the Bernstein basis polynomial representation. See [235, 2] on the theory and history of descartes, [46, 216, 71, 146, 217] on its modern versions, and [83, 156] and the references therein on the bernstein algorithm. The Continued Fraction algorithm, cf, computes the continued fraction ex- pansions of the real roots of the polynomial. The first formulation of the algo- rithm is due to Vincent. By Vincent’s theorem repeated transforms x 7→ c + 1 x eventually yield a polynomial with zero or one sign variation and thus (by Descartes’ rule) with zero or resp. one real root in (0,∞). In the latter case the inverse transformation computes an isolating interval. Moreover, the c’s in the transform correspond to the partial quotients of the continued fraction expansion of the real root. Variants differ in the way they compute the partial quotients. Recent algorithms control the growth of coefficient bit-size and decrease the bit-complexity from exponential (of Vincent) to eOB(d3τ ) expected and eOB(d4τ 2) worst-case bit complexity. See [145, 220, 229, 230] and the references therein on these results, history and variants of CP algorithms. 4 Systems of Nonlinear Equations Given a system {p1(x1, . . . , xn), . . . , pr(x1, . . . , xn)} of nonlinear polynomials with rational coefficients, the n-tuple of complex numbers (a1, . . . , an) is a so- lution of the system if pi(a1, . . . , an) = 0, 1 ≤ i ≤ r. Each pi(x1, . . . , xn) is said to be an element of Q[x1, . . . , xn], the ring of polynomials in x1, . . . , xn over the field of rational numbers. In this section, we explore the problem of solving a well-constrained system of nonlinear equations, namely when r = n, which is the typical case in applications. We also indicate how an initial phase of exact algebraic computation leads to certain numerical methods that can approximate all solutions; the interaction of symbolic and numeric computation is currently an active domain of research, e.g. [22, 82, 125]. We provide an overview and cite references to different symbolic techniques used for solving systems of al- gebraic (polynomial) equations. In particular, we describe methods involving resultant and Grobner basis computations. Resultants, as explained below, formally express the solvability of algebraic systems with r = n + 1; solving a well-constrained system reduces to a resultant computation as illustrated in the sequel. The Sylvester resultant method is the technique most frequently utilized for determining a common root of two polynomial equations in one variable. However, using the Sylvester method successively to solve a system of multivariate polynomials proves to be inefficient. It is more efficient to eliminate n variables together from n + 1 polynomials, thus, leading to the notion of the multivariate resultant. The three most com- monly used multivariate resultant matrix formulations are those named after Sylvester or Macaulay [36, 38, 135], those named after B´ezout or Dixon [33, 60, 121], or the hybrid formulation [57, 113, 122]. Extending the Sylvester-Macaulay 16 type, we shall emphasize also sparse resultant formulations [37, 98, 226]. For a unified treatment, see [81]. The theory of Grobner bases provides powerful tools for performing compu- tations in multivariate polynomial rings. Formulating the problem of solving systems of polynomial equations in terms of polynomial ideals, we will see that a Grobner basis can be computed from the input polynomial set, thus, allowing for a form of back substitution in order to compute the common roots. Although not discussed, it should be noted that the characteristic set al- gorithm can be utilized for solving polynomial systems. Although introduced for studying algebraic differential equations [214], the method was converted to ordinary polynomial rings when developing an effective method for automatic theorem proving [242]. Given a polynomial system P , the characteristic set algorithm computes a new system in triangular form, such that the set of com- mon roots of P is equivalent to the set of roots of the triangular system [120]. Triangular systems have k1 polynomials in a specific variable, k2 polynomials in this and one more variable, k3 polynomials in these two and one more variable, and so on, for a total number of k1 + ··· + kn polynomials. 4.1 Resultant of Univariate Systems The question of whether two polynomials f (x), g(x) ∈ Q[x], f (x) = fnxn + fn−1xn−1 + ··· + f1x + f0 , g(x) = gmxm + gm−1xm−1 + ··· + g1x + g0 , have a common root leads to a condition that has to be satisfied by the coef- ficients of f, g. Using a derivation of this condition due to Euler, the Sylvester matrix of f, g (which is of dimension m+n) can be formulated. The vanishing of the determinant of the Sylvester matrix, known as the Sylvester resultant, is a necessary and sufficient condition for f, g to have common roots in the algebraic closure of the coefficient ring. As a running example let us consider the following bivariate system [131]: f = x2 + xy + 2x g = x2 + y − 1 = 0 , + 3x − y2 + 2y − 1 = 0 . Without loss of generality, the roots of the Sylvester resultant of f and g treated as polynomials in y, whose coefficients are polynomials in x, are the x-coordinates of the common roots of f, g. More specifically, the Sylvester re- sultant with respect to y is given by the following determinant: det   x + 1 x2 + 2 x − 1 0 −1 x + 1 2 0 x2 + 2 x − 1 x2 + 3 x − 1   = −x3 − 2 x2 + 3 x . An alternative matrix of order max{m, n}, named after B´ezout, yields the same determinant. 17 The roots of the Sylvester determinant are {−3, 0, 1}. For each x value, one can substitute the x value back into the original polynomials yielding the solu- tions (−3, 1), (0, 1), (1,−1). More practically, one can use the Sylvester matrix to reduce system solving to the computation of eigenvalues and eigenvectors as explained in “Polynomial System Solving by Using Resultants”. The Sylvester formulations has led to a subresultant theory, which produced an efficient algorithm for computing the GCD of univariate polynomials and their resultant, while controlling intermediate expression swell [213, 133]. Sub- resultant theory has been generalized to several variables, e.g. [32, 53]. 4.2 Resultants of Multivariate Systems The solvability of a set of nonlinear multivariate polynomials is determined by the vanishing of a generalization of the resultant of two univariate polynomials. We examine two generalizations: the classical and the sparse resultants. Both generalize the determinant of n + 1 linear polynomials in n variables. The classical resultant of a system of n + 1 polynomials with symbolic coeffi- cients in n variables vanishes exactly when there exists a common solution in the projective space over the algebraic closure of the coefficient ring [50]. The sparse (or toric) resultant characterizes solvability of the same overconstrained system over a smaller space, which coincides with affine space under certain genericity conditions [51, 98, 226]. The main algorithmic question is to construct a matrix whose determinant is the resultant or a nontrivial multiple of it. Cayley, and later Dixon, generalized B´ezout’s method to a set {p1 (x1, . . . , xn) , . . . , pn+1 (x1, . . . , xn)} of n + 1 polynomials in n variables. The vanishing of the determinant of the B´ezout–Dixon matrix is a necessary and sufficient condition for the polynomials to have a nontrivial projective common root, and also a necessary condition for the existence of an affine common root [33, 60, 81, 121]. A nontrivial resultant multiple, known as the projection operator, can be extracted via a method dis- cussed in [41, thm. 3.3.4]. This article, along with [73], explain the correlation between residue theory and the B´ezout–Dixon matrix; the former leads to an alternative approach for studying and approximating all common solutions. Macaulay [135] constructed a matrix whose determinant is a multiple of the classical resultant; he stated his approach for a well-constrained system of n homogeneous polynomials in n variables. The Macaulay matrix simultaneously generalizes the Sylvester matrix and the coefficient matrix of a system of linear equations. Like the Dixon formulation, the Macaulay determinant is a multiple of the resultant. Macaulay, however, proved that a certain minor of his ma- trix divides the matrix determinant to yield the exact resultant in the case of generic coefficients. To address arbitrary coefficients, Canny [36] proposed a general method that perturbs any polynomial system and extracts a nontrivial projection operator from Macaulay’s construction. By exploiting the structure of polynomial systems by means of sparse elimi- nation theory, a matrix formula for computing the sparse resultant of n+1 poly- 18 nomials in n variables was given in [37] and consequently improved in [40, 76]. Like the Macaulay and Dixon matrices, the determinant of the sparse resultant matrix, also known as Newton matrix, only yields a projection operation. How- ever, in certain cases of bivariate and multihomogeneous systems, determinantal formulae for the sparse resultant have been derived [57, 80, 122]. To address degeneracy issues, Canny’s perturbation has been extended in the sparse con- text [54]. D’Andrea [52] extended Macaulay’s rational formula for the resultant to the sparse setting, thus defining the sparse resultant as the quotient of two determinants; see [79] for a simplified algorithm in certain cases. Here, sparsity means that only certain monomials in each of the n + 1 poly- nomials have nonzero coefficients. Sparsity is measured in geometric terms, namely, by the Newton polytope of the polynomial, which is the convex hull of the exponent vectors corresponding to nonzero coefficients. The mixed vol- ume of the Newton polytopes of n polynomials in n variables is defined as an integer-valued function that bounds the number of toric common roots of these polynomials [13]. This remarkable bound is the cornerstone of sparse elimination theory. The mixed volume bound is significantly smaller than the classical B´ezout bound for polynomials with small Newton polytopes but they coincide for polynomials whose Newton polytope is the unit simplex multiplied by the polynomial’s total degree. Since these bounds also determine the degree of the sparse and classical resultants, respectively, the latter has larger degree for sparse polynomials. Last, but not least, the classical resultant can identi- cally vanish over sparse systems, whereas the sparse resultant can still yield the desired information about their common roots [51]. 4.3 Polynomial System Solving by Using Resultants Suppose we are asked to find the common roots of a set of n polynomials in n variables {p1(x1, . . . , xn), . . ., pn(x1, . . . , xn)}. By augmenting this set by a generic linear polynomial [36, 51], we construct the u-resultant of a given system of polynomials. The u-resultant is named after the indeterminates u, tradition- ally used to represent the generic coefficients of the additional linear polynomial. The u-resultant factors into linear factors over the complex numbers, providing the common roots of the given polynomials equations. The method relies on the properties of the multivariate resultant, and hence, can be constructed using either Macaulay’s, Dixon’s, or sparse formulations. An alternative approach is to hide a variable in the coefficient field [74, 81, 138]. Consider the previous example augmented by a generic linear form: p1 = x2 + xy + 2x + y − 1 = 0 , p2 = x2 + 3x − y2 + 2y − 1 = 0 , + vy + w = 0 . pl = ux As described in [38], the following (transposed) Macaulay matrix M corre- 19 sponds to the u-resultant of the above system of polynomials: M =   0 u 0 v 1 0 1 1 2 0 0 1 1 2 −1 0 0 0 0 1 0 −1 0 0 1 0 0 0 1 1 3 0 0 −1 0 2 1 3 2 −1 0 0 −1 0 0 0 0 −1 1 0 −1 0 0 0 0 0 u 1 0 0 0 w v 3 0 2 −1 2 0 −1 0 0 0 0 u 0 w 0 0 0 0 v 0 0 0 0 0 0 0 u 0 0 0 0 0 w v 0 0 w   . It should be noted that det(M ) = (u − v + w)(−3u + v + w)(v + w)(u − v) corresponds to the affine solutions (1,−1), (−3, 1), (0, 1), whereas one solution at infinity corresponds to the last factor. Resultant matrices can also reduce polynomial system solving to a regular or generalized eigenproblem (cf. “Matrix Eigenvalues and Singular Values Prob- lems”), thus, transforming the nonlinear question to a problem in linear algebra. This is a classical technique that enables us to numerically approximate all solu- tions [4, 39, 41, 74, 81]. For demonstration, consider the previous system and its resultant matrix M . The matrix rows are indexed by the following row vector of monomials in the eliminated variables: v =(cid:2)x3, x2y, x2, xy2, xy, x, y3, y2, y, 1(cid:3) . Vector vM expresses the polynomials indexing the columns of M , which are multiples of the three input polynomials by various monomials. Let us specialize variables u and v to random values. Then M contains a single variable w and is denoted M (w). Solving the linear system vM (w) = 0 in vector v and in scalar w is a generalized eigenproblem, since M (w) can be represented as M0 + wM1, where M0 and M1 have numeric entries. If, moreover, M1 is invertible, we arrive at the following eigenproblem: v (M0 + wM1) = 0 ⇐⇒ v(cid:0)−M −1 1 M0 − wI(cid:1) = 0 ⇐⇒ v(cid:0)−M −1 1 M0(cid:1) = wv . For every solution (a, b) of the original system, there is a vector v among the computed eigenvectors, which we evaluate at x = a, y = b and from which the solution can be recovered by division [74]. As for the eigenvalues, they correspond to the values of w at the solutions; see [75] on numerical issues, and an implementation. An alternative method for approximating or isolating all real roots of the system is to use the so-called Rational Univariate Representation (RUR) of algebraic numbers [35, 215]. This allows us to express each root coordinate as the value of a univariate polynomial, evaluated over an algebraic number, 20 which is specified as a solution of a single polynomial equation. All polynomials involved in this approach are derived from the resultant. The resultant matrices are sparse and have quasi Toeplitz/Hankel structure (also called multilevel Toeplitz/Hankel structure), which enables their fast mul- tiplication by vectors. By combining the latter property with various advanced nontrivial methods of multivariate polynomial root-finding, substantial accel- eration of the construction and computation of the resultant matrices and ap- proximation of the system’s solutions was achieved in [24, 85, 86, 150, 151, 152]. A comparison of the resultant formulations can be found, e.g., in [81, 120, 138]. The multivariate resultant formulations have been used for diverse appli- cations such as algebraic and geometric reasoning [41, 59, 138], including sepa- ration bounds for the isolated roots of arbitrary polynomial systems [84], robot kinematics [55, 212, 138], and nonlinear computational geometry, computer- aided geometric design and, in particular, implicitization [32, 42, 78, 87, 111]. 4.4 Grobner Bases Solving systems of nonlinear equations can be formulated in terms of polynomial ideals [50, 105, 127]. The ideal generated by a system of polynomials p1, . . . , pr over Q[x1, . . . , xn] is the set of all linear combinations (p1, . . . , pr) = {h1p1 + ··· + hrpr h1, . . . , hr ∈ Q [x1, . . . , xn]} . The algebraic variety of p1, . . . , pr ∈ Q[x1, . . . , xn] is the set of their common roots, V (p1, . . . , pr) = {(a1, . . . , an) ∈ Cn p1 (a1, . . . , an) = . . . = pr (a1, . . . , an) = 0} . A version of the Hilbert Nullstellensatz states that V (p1, . . . , pr) = the empty set ∅ ⇐⇒ 1 ∈ (p1, . . . , pr) over Q [x1, . . . , xn] , which relates the solvability of polynomial systems to the ideal membership problem. 2 . . . xen A term t = xe1 1 xe2 n of a polynomial is a product of powers with deg(t) = e1 + ··· + en. In order to add needed structure to the polynomial ring we will require that the terms in a polynomial be ordered in an admissible fashion [50, 97]. Two of the most common admissible orderings are the lex- icographic order (≺l), where terms are ordered as in a dictionary, and the degree order (≺d), where terms are first compared by their degrees with equal degree terms compared lexicographically. A variation to the lexicographic order is the reverse lexicographic order, where the lexicographic order is reversed. Much like a polynomial remainder process, the process of polynomial reduc- tion involves subtracting a multiple of one polynomial from another to obtain a smaller degree result [50, 105, 127]. A polynomial g is said to be reducible with respect to a set P = {p1, . . . , pr} of polynomials if it can be reduced by one or more polynomials in P . When g is no longer reducible by the polynomials in P , we say that g is reduced or is a normal form with respect to P . 21 For an arbitrary set of basis polynomials, it is possible that different re- duction sequences applied to a given polynomial g could reduce to different normal forms. A basis G ⊆ Q[x1, . . . , xn] is a Grobner basis if and only if every polynomial in Q[x1, . . . , xn] has a unique normal form with respect to G. Buchberger [27, 28, 29] showed that every basis for an ideal (p1, . . . , pr) in Q[x1, . . . , xn] can be converted into a Grobner basis {p∗ concomitantly designing an algorithm that transforms an arbitrary ideal basis into a Grobner basis. Another characteristic of Grobner bases is that by using the above mentioned reduction process we have g ∈ (p1 . . . , pr) ⇐⇒ g mod (p∗ 1, . . . , p∗ s) = 0 . 1, . . . , p∗ s} = GB(p1, . . . , pr), Further, by using the Nullstellensatz it can be shown that p1 . . . , pr viewed as a system of algebraic equations is solvable if and only if 1 6∈ GB(p1, . . . , pr). Depending on which admissible term ordering is used in the Grobner bases construction, an ideal can have different Grobner bases. However, an ideal can- not have different (reduced) Grobner bases for the same term ordering. Any system of polynomial equations can be solved using a lexicographic Grobner basis for the ideal generated by the given polynomials. It has been observed, however, that Grobner bases, more specifically lexicographic Grobner bases, are hard to compute [139]. In the case of zero-dimensional ideals, those whose vari- eties have only isolated points, a change of basis algorithm was outlined in [90], which can be utilized for solving: one computes a Grobner basis for the ideal generated by a system of polynomials under a degree ordering. The so-called change of basis algorithm can then be applied to the degree ordered Grobner basis to obtain a Grobner basis under a lexicographic ordering. Significant progress has been achieved in the algorithmic realm by Faug`ere [88, 89]. Another way to finding all common real roots is by means of RUR; see the previous section. All polynomials involved in this approach can be derived from the Grobner basis. A rather recent development concerns the generalization of Grobner bases to border bases, which contain all information required for system solving but can be computed faster and seem to be numerically more stable [127, 154, 222, 155]. Turning to Lazard’s example in form of a polynomial basis, p1 = x2 +xy +2x p2 = x2 +y −1 , +3x −y2 +2y −1 , one obtains (under lexicographical ordering with x≺ly) a Grobner basis in which the variables are triangulated such that the finitely many solutions can be com- puted via back substitution: p1 p2 p3 ∗ = x2 ∗ = ∗ = +3x xy − x y2 +2y −2 , −y +1 , −1 . The final univariate polynomial has minimal degree, whereas the polynomials used in the back substitution have total degree no larger than the number of 22 1, p∗ 2, p∗ roots. As an example, x2y2 is reduced with respect to the previously computed Grobner basis {p∗ 3} = GB(p1, p2) along two distinct reduction paths, both yielding −3x − 2y + 2 as the normal form. There is a strong connection between lexicographic Grobner bases and the previously mentioned resultant techniques. For some types of input polynomials, the computation of a reduced system via resultants might be much faster than the computation of a lexicographic Grobner basis. Grobner bases can be used for many polynomial ideal theoretic operations [29, 49]. Other applications include computer-aided geometric design [111], polynomial interpolation [129], coding and cryptography [92], and robotics [91]. 5 Research Issues and Summary Algebraic algorithms deal with numbers, vectors, matrices, polynomials, formal power series, exponential and differential polynomials, rational functions, alge- braic sets, curves and surfaces. In this vast area, manipulations with matrices and polynomials, in particular the solution of a polynomial equation and linear and polynomial systems of equations, are most fundamental in modern compu- tations in Sciences, Engineering, and Signal and Image Processing. We reviewed the state of the art for the solution of these three tasks and gave pointers to the extensive bibliography. Among numerous interesting and important research directions of the topics in Sections 2 and 3, we wish to cite computations with structured matrices, including their applications to polynomial root-finding, currently of growing interest, and new techniques for randomized preprocessing for matrix computa- tions, evaluation of resultants and polynomial root-finding. Section 4 of this chapter has briefly reviewed polynomial system solving based on resultant matrices as well as Grobner bases. Both approaches are currently active. This includes practical applications to small and medium-size systems. Efficient implementations that handle the nongeneric cases, including multiple roots and nonisolated solutions, is probably the most crucial issue to- day in relation to resultants. The latter are also studied in relation to a more general object, namely the discriminant of a well-constrained system, which characterizes the existence of multiple roots. Another interesting current direc- tion is algorithmic improvement by exploiting the structure of the polynomial systems, including sparsity, or the structure of the encountered matrices, for both resultants and Grobner bases. 6 Defining Terms Characteristic polynomial: Shift an input matrix A by subtracting the iden- tity matrix xI scaled by variable x. The determinant of the resulting ma- trix is the characteristic polynomial of the matrix A. Its roots coincide with the eigenvalues of the shifted matrix A − xI. 23 Condition number of a matrix is a scalar κ which grows large as the ma- trix approaches a singular matrix; then numeric inversion becomes an ill-conditioned problem. κ OUTPUT ERROR NORM ≈ INPUT ERROR NORM. Degree order: An order on the terms in a multivariate polynomial; for two variables x and y with x ≺ y the ascending chain of terms is 1 ≺ x ≺ y ≺ x2 ≺ xy ≺ y2 ···. Determinant: A polynomial in the entries of a square matrix whose value is invariant in adding to a row (resp. column) any linear combination of other rows (resp. columns). det(AB) = det A·det B for a pair of square matrices A and B, det B = − det A if the matrix B is obtained by interchanging a pair of adjacent rows or columns of a matrix A, det A 6= 0 if and only if a matrix A is invertible. Determinant of a block diagonal or block triangular matrix is the product of the diagonal blocks, and so det A = (det A0.0) det S under (1). One can compute a determinant by using these properties and matrix factorizations, e.g., recursive factorization (1). Grobner basis: Given a term ordering, the Grobner basis of a polynomial ideal is a generating set of this ideal, such that the (multivariate) division of any polynomial by the basis has a unique remainder. Lexicographic order: An order on the terms in a multivariate polynomial; for two variables x and y with x ≺ y the ascending chain of terms is 1 ≺ x ≺ x2 ≺ ··· ≺ y ≺ xy ≺ x2y ··· ≺ y2 ≺ xy2 ···. Matrix eigenvector: A column vector v such that Av = λv, for a square matrix A and the associated eigenvalue λ. A generalized eigenvector v satisfies the equation Av = λBv for two square matrices A and B and the associated eigenvalue λ. Both definitions extend to row vectors that premultiply the associated matrices. Mixed volume: An integer-valued function of n convex polytopes in n-dimen- sional Euclidean space. Under proper scaling, this function bounds the number of toric complex roots of a well-constrained polynomial system, where the convex polytopes are defined to be the Newton polytopes of the given polynomials. Newton polytope: The convex hull of the exponent vectors corresponding to terms with nonzero coefficients in a given multivariate polynomial. Ops: Arithmetic operations, i.e., additions, subtractions, multiplications, or divisions; as in flops, i.e., floating point operations. Resultant: A polynomial in the coefficients of a system of n polynomials with n + 1 variables, whose vanishing is the minimal necessary and sufficient condition for the existence of a solution of the system. Separation bound: The minimum distance between two (complex) roots of a univariate polynomial. 24 Singularity: A square matrix is singular if its product with some nonzero matrix is the zero matrix. Singular matrices do not have inverses. Sparse matrix: A matrix whose zero entries are much more numerous than its nonzero entries. Structured matrix: A matrix whose every entry can be derived by a formula depending on a smaller number of parameters, typically on O(m + n) parameters for an m×n matrix, as opposed to its mn entries. For instance, an m × n Cauchy matrix has as the entry in row i and column j and is defined by m + n parameters si and tj, i = 1, . . . , m; j = 1, . . . , n. Typically a structured matrix can be multiplied by a vector in nearly linear arithmetic time. si−tj 1 References [1] Aho, A., Hopcroft, J., Ullman, J., The Design and Analysis of Algorithms. Addison-Wesley, Reading, MA, 1974. [2] Alesina, A., Galuzzi, M., A new proof of Vincent’s theorem. L’Enseignement Math´ematique, 44, 219–256, 1998. [3] Anderson, E., Bai, Z., Bischof, C., Blackford, S., Demmel, J., Dongarra, J., Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A., Sorensen, D. LAPACK Users’ Guide. 3rd Edition, SIAM, 1999. [4] Auzinger, W., Stetter, H.J., An elimination algorithm for the computation of all zeros of a system of multivariate polynomial equations. In Proc. Intern. Conf. on Numerical Math., Intern. Series of Numerical Math., 86, 12–30. Birkhauser, Basel, 1988. [5] Bach, E., Shallit, J., Algorithmic Number Theory, Volume 1: Efficient Algorithms. The MIT Press, Cambridge, MA, 1996. [6] Bai, Z., Demmel, J., Dongarra, J., Ruhe, A., van der Vorst, H., editors, Templates for the Solution of Algebraic Eigenvalue Problems: A Practical Guide. SIAM, Philadelphia, 2000. [7] Bareiss, E.H., Sylvester’s identity and multistep integers preserving Gaus- sian elimination. Math. Comp., 22, 565–578, 1968. [8] Barrett, R., Berry, M.W., Chan, T.F., Demmel, J., Donato, J., Dongarra, J., Eijkhout, V., Pozo, R., Romine, C., Van Der Vorst, H., Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods. SIAM, Philadelphia, 1993. [9] Basu, S., Pollack, R., Roy, M.-F., Algorithms in Real Algebraic Geometry, Algorithms and Computation in Mathematics, 10, Springer, 2003. 25 [10] Benzi, M., Preconditioning techniques for large linear systems: a survey. J. Computational Physics, 182, 418–477, 2002. [11] Berberich, E., Eigenwillig, A., Hemmer, M., Hert, S., Kettner, L., Mehlhorn, K., Reichel, J., Schmitt, S., Schomer, E., Wolpert, N., EX- ACUS: Efficient and Exact Algorithms for Curves and Surfaces. In ESA, LNCS, 1669, 155–166, Springer, 2005. [12] Berlekamp, E.R., Factoring polynomials over large finite fields. Math. Comp., 24, 713–735, 1970. [13] Bernshtein, D.N., The number of roots of a system of equations. Funct. Anal. and Appl., 9(2), 183–185, 1975. [14] Bini, D.A., Boito, P., A fast algorithm for approximate polynomial GCD based on structured matrix computations. Operator Theory: Advances and Applications, 199, 155–173, Birkhauser, 2010. [15] Bini, D.A., Boito, P., Eidelman, Y., Gemignani, L., Gohberg, I., A fast implicit QR algorithm for companion matrices. Linear Algebra and Appli- cations, 432, 2006–2031, 2010. [16] Bini, D.A., Fiorentino, G., Design, analysis, and implementation of a Mmultiprecision polynomial rootfinder. Numer. Algs., 23, 127–173, 2000. [17] Bini, D.A., Gemignani, L., Pan, V.Y., Inverse power and Durand/Kerner iteration for univariate polynomial root-finding. Computers & Math. (with Appl.), 47 (2/3), 447–459, 2004. [18] Bini, D.A., Gemignani, L., Pan, V.Y., Fast and stable QR eigenvalue algo- rithms for generalized companion matrices and secular equation. Numer. Math., 3, 373–408, 2005. [19] Bini, D.A., Gemignani, L., Pan, V.Y., Improved initialization of the ac- celerated and robust QR-like polynomial root-finding. Electronic Trans- actions on Numerical Analysis, 17, 195–205, 2004. [20] Bini, D., Pan, V.Y., Polynomial division and its computational complex- ity, J. Complexity, 2, 179–203, 1986. [21] Bini, D., Pan, V.Y., Polynomial and Matrix Computations, Volume 1, Fundamental Algorithms. Birkhauser, Boston, 1994. [22] Bini, D.A., Pan, V.Y., Verschelde, J., eds., Special Issue on Symbolic– Numerical Algorithms. Theoretical Comp. Sci., 409, 2, 255–268, 2008. [23] Bjorck, A., Numerical Methods for Least Squares Problems. SIAM, 1996. [24] Bondyfalat, D., Mourrain, B., Pan, V.Y., Computation of a specified root of a polynomial system of equations using eigenvectors. Linear Alg. Appls., 319, 193–209, 2000. Also Proc. ISSAC, 252–259, ACM Press, 1998. 26 [25] Borodin, A., Munro, I., Computational Complexity of Algebraic and Nu- meric Problems. American Elsevier, New York, 1975. [26] Bronnimann, H., Emiris, I.Z., Pan, V.Y., Pion, S., Sign determination in residue number systems. Theor. Comp, Science, 210 (1), 173–197, 1999. [27] Buchberger, B., Ein Algorithmus zum Auffinden der Basiselemente des Restklassenringes nach einem nulldimensionalen Polynomideal. Disserta- tion, University of Innsbruck, Austria, 1965. [28] Buchberger, B., A theoretical basis for the reduction of polynomials to canonical form. ACM SIGSAM Bulletin, 10(3), 19–29, 1976. [29] Buchberger, B., Grobner bases: An algorithmic method in polynomial ideal theory. In Recent Trends in Multidimensional Systems Theory, Bose, N.K., Ed., 184–232. D. Reidel, Dordrecht (Holland), 1985. [30] Buchberger, B., Collins, G.E., Loos, R., Albrecht, R., eds. Computer Algebra: Symbolic Algebraic Computation. Springer, 2nd edition, 1983. [31] Burgisser, P., Clausen, M., Shokrollahi, M.A., Algebraic Complexity The- ory. Springer, Berlin, 1997. [32] Bus´e, L., D’Andrea, C. Inversion of parameterized hypersurfaces by means of subresultants. In Proc. ISSAC, 65–71, ACM Press, 2004. [33] Bus´e, L., Elkadi, M., Mourrain, B. Residual resultant of complete inter- section. J. Pure & Applied Algebra, 164, 35–57, 2001. [34] Bus´e, L., Elkadi, M., Mourrain, B., eds. Special Issue on Algebraic– Geometric Computations, Theor. Comp. Science, 392 (1-3), 1-178, 2008. [35] Canny, J., Some Algebraic and Geometric Computations in PSPACE. In Proc. ACM Symp. Theory of Computing, 460–467, 1988. [36] Canny, J., Generalized characteristic polynomials. J. Symbolic Computa- tion, 9(3), 241–250, 1990. [37] Canny, J., Emiris, I.Z., A Subdivision-Based Algorithm for the Sparse Resultant, J. ACM, 47(3), 417–451, 2000. [38] Canny, J., Kaltofen, E., Lakshman, Y., Solving systems of non-linear polynomial equations faster. In Proc. ISSAC, 121–128, ACM, 1989. [39] Canny, J., Manocha, D., Efficient techniques for multipolynomial resultant algorithms. In Proc. ISSAC, 85–95, ACM Press, 1991. [40] Canny, J., Pedersen, P., An algorithm for the Newton resultant. Technical Report 1394, Computer Science Dept., Cornell University, 1993. 27 [41] Cardinal, J.-P., Mourrain, B., Algebraic approach of residues and appli- cations. In The Math. of Numerical Analysis, Lects. in Applied Math., 32, 189–210, AMS, Providence, RI, 1996. [42] Chen, F., Cox, D.A., Liu, Y., The mu-basis and implicitization of a ratio- nal parametric surface. J. Symbolic Computation, 39(6), 689–706, 2005. [43] Chen, Z., Storjohann, A., A BLAS based C library for exact linear algebra on integer matrices. In Proc. ISSAC, 92–99, ACM Press, 2005. [44] Cohn, H., Kleinberg, R., Szegedy, B., Umans, C., Group-theoretic algo- rithms for matrix multiplication. Proc. IEEE FOCS, 379–388, 2005. [45] Clarkson, K.L., Safe and effective determinant evaluation. Proc. IEEE FOCS, 387–395, IEEE Computer Society Press, 1992. [46] Collins, G.E., Akritas, A., Polynomial real root isolation using Descartes’ rule of signs. In SYMSAC ’76, 272–275, ACM Press, NY, 1976. [47] Coppersmith, D., Solving homogeneous linear equations over GF(2) via block Wiedemann algorithm. Math. of Comput., 62(205), 333–350, 1994. [48] Coppersmith, D., Winograd, S., Matrix multiplication via arithmetic pro- gressions. J. Symbolic Computation, 9(3), 251–280, 1990. [49] Cox, D.A., Grobner bases: a sampler of recent developments. In Proc. ISSAC, 387–388, ACM, 2007. [50] Cox, D., Little, J., O’Shea, D. Ideals, Varieties, and Algorithms, 2nd edition. Undergraduate Texts in Mathematics, Springer, New York, 1997. [51] Cox, D., Little, J., O’Shea, D. Using Algebraic Geometry, 2nd edition. Graduate Texts in Mathematics, 185, Springer, New York, 2005. [52] D’Andrea, C., Macaulay-style formulas for the sparse resultant. Trans. of the AMS, 354, 2595–2629, 2002. [53] D’Andrea, C., Krick, T., Szanto, A., Multivariate subresultants in roots. J. Algebra, 302(1), 16–36, 2006. [54] D’Andrea, C., Emiris, I.Z., Computing sparse projection operators. In Symbolic Computation: Solving Equations in Algebra, Geometry, and En- gineering, 121–139, AMS, Providence, RI, 2001. [55] Daney, D., Emiris, I.Z., Robust parallel robot calibration with partial information. In Proc. IEEE Intern. Conf. Robotics & Automation, Seoul, pp. 3262–3267, 2001. [56] Demmel, J.J.W., Applied Numerical Linear Algebra. SIAM, 1997. [57] Dickenstein, A., Emiris, I.Z., Multihomogeneous resultant formulae by means of complexes. J. Symbolic Comp., 36, 317–342, 2003. 28 [58] Dickenstein, A., Emiris, I.Z., editors, Solving polynomial equations: foun- dations, algorithms and applications. In Algorithms and Computation in Mathematics, 14, Springer, Berlin, 2005. [59] Dickenstein, A., Sturmfels, B., Elimination theory in codimension 2. J. Symb. Comp., 34(2):119–135, 2002. [60] Dixon, A.L., The elimination of three quantics in two independent vari- ables. In Proc. London Mathematical Society, 6, 468–478, 1908. [61] Dongarra, J., Bunch, J., Moler, C., and Stewart, P. LINPACK Users’ Guide. SIAM, Philadelphia, PA, 1978. [62] Dongarra, J.J., Duff, I.S., Sorensen, D.C. and Van Der Vorst, H.A., Nu- merical Linear Algebra for High-Performance Computers. SIAM, 1998. [63] Du, Z., Sharma, V., Yap, C.K., Amortized bound for root isolation via Sturm sequences. [236], pp. 113–129. [64] Duff, I.S., Erisman, A.M. and Reid, J.K., Direct Methods for Sparse Ma- trices. Clarendon Press, Oxford, England, 1986. [65] Dumas, J.-G., Gautier, T., Giesbrecht, M., Giorgi, P., Hovinen, B., Kaltofen, E., Saunders, B.D., Turner, W.J., and Villard, G. LinBox: A generic library for exact linear algebra. In Cohen, A.M., Gao, X.-S., Takayama, N., eds., Proc. ICMS 200, 40-50, Beijing, China, 2002. [66] Dumas, J-G., Gautier, T., Pernet, C., Finite field linear algebra subrou- tines. In Proc. ISSAC, 63–74, ACM Press, 2002. [67] Dumas, J-G., Giorgi, P., Pernet, C., Finite field linear algebra package. In Proc. ISSAC, 118–126, ACM Press, 2004. [68] Eidelman, Y., Gohberg, I., On a New Class of Structured Matrices, Inte- gral Equations & Operator Theory, 34, 293–324, Birkhauser, 1999. [69] Eberly, W., Giesbrecht, M., Giorgi, P., Storjohann, A., Villard, G., Faster inversion and other black box matrix computations using efficient block projections. In Proc. ISSAC, 143–150, ACM Press, 2007. [70] Eberly, W., Giesbrecht, M., Villard, G., On computing the determinant and Smith form of an integer matrix. Proc. IEEE FOCS, 675–685, 2000. [71] Eigenwillig, A., Kettner, L., Krandick, W., Mehlhorn, K., Schmitt, S., Wolpert, N., A Descartes Algorithm for Polynomials with Bit-Stream Coefficients. In CASC’2005, LNCS, 3718, 38–149. Springer, 2005. [72] Eigenwillig, A., Sharma, V., Yap, C.K., Almost tight recursion tree bounds for the Descartes method. Proc. ISSAC, 71–78, ACM, 2006. 29 [73] Elkadi, M., Mourrain, B., Algorithms for residues and Lojasiewicz expo- nents. J. Pure & Appl. Algebra, 153, 27–44, 2000. [74] Emiris, I.Z., On the complexity of sparse elimination. J. Complexity, 12, 134–166, 1996. [75] Emiris, I.Z., Matrix Methods for Solving Algebraic Systems, In Symbolic Algebraic Methods and Verification Methods, Springer, Wien, pp. 69–78, 2001. Also arxiv.org/abs/1201.5810, 2011. [76] Emiris, I.Z., Canny, J.F., Efficient incremental algorithms for the sparse resultant and the mixed volume. J. Symb. Comput., 20(2), 117–149, 1995. [77] Emiris, I.Z., Galligo, A., Tsigaridas, E.P., Random polynomials and ex- pected complexity of bisection methods for real solving. Proc. ISSAC, 235–242, ACM Press, New York, 2010. [78] Emiris, I.Z., Kalinka, T., Konaxis, C., Luu-Ba, T., Implicitization of curves and surfaces using predicted support, in [126]. [79] Emiris, I.Z., Konaxis, C., Single-lifting Macaulay-type formulae of gener- alized unmixed sparse resultants, J. Symb. Comp., 46(8), 919–942, 2011. [80] Emiris, I.Z., Mantzaflaris, A., Multihomogeneous resultant matrices for systems with scaled support. In Proc. ISSAC, 143–150, ACM, 2009. [81] Emiris, I.Z., Mourrain, B., Matrices in elimination theory. J. Symbolic Computation, 28, 3–44, 1999. [82] Emiris, I.Z., Mourrain, B., Pan, V.Y., eds. Special Issue on Algebraic and Numerical Algorithms, Theor. Comp. Science, 315, 307–672, 2004. [83] Emiris, I.Z., Mourrain, B., Tsigaridas, E.P., Real Algebraic Numbers: Complexity Analysis and Experimentation. In Reliable Implementations of Real Number Algorithms: Theory and Practice, LNCS, Springer, 2007. [84] Emiris, I.Z., Mourrain, B., Tsigaridas, E.P., The DMM Bound: Multi- variate (Aggregate) Separation Bound. In Proc. ISSAC, 242–250, ACM Press, 2010. [85] Emiris, I.Z., Pan, V.Y., Symbolic and numeric methods for exploiting structure in constructing resultant matrices. J. Symb. Comp., 33, 393– 413, 2002. [86] Emiris I.Z., Pan, V.Y., Improved algorithms for computing determinants and resultants. J. Complexity, 21 (1), 43–71, 2005. Also Proc. CASC’03, (E. W. Mayr, V. G. Ganzha, E. V. Vorozhtzov, eds.) 81–94, 2003. [87] Emiris, I.Z., Tzoumas, G.M., Exact and efficient evaluation of the InCircle predicate for parametric ellipses and smooth convex objects, Computer- Aided Design, 40(6), 691–700, 2008. 30 [88] Faug`ere, J.-C., A new efficient algorithm for computing Grobner bases (F4). J. Pure & Applied Algebra, 139, 61–88, 1999. [89] Faug`ere, J.-C., A new efficient algorithm for computing Grobner bases without Reduction to Zero (F5). In Proc. ISSAC, 75–83, ACM, 2002. [90] Faug`ere, J.-C., Gianni, P., Lazard, D., Mora, T., Efficient computation of zero-dimensional Grobner bases by change of ordering. J. Symbolic Com- putation, 16(4), 329–344, 1993. [91] Faug`ere, J-C., Lazard, D., The Combinatorial Classes of Parallel Manip- ulators. Mechanism and Machine Theory, 30, 765–776, 1995. [92] Faug`ere, J.-C., Levy-dit-Vehel, F., Perret, L., Cryptanalysis of MinRank. In Proc. CRYPTO, pp. 280–296, 2008. [93] Fortune, S., An Iterated Eigenvalue Algorithm for Approximating Roots of Univariate Polynomials. J. Symbolic Comp., 33 (5), 627–646, 2002. [94] Foster, L.V., Generalizations of Laguerre’s method: higher order methods. SIAM J. Numer. Anal., 18, 1004–1018, 1981. [95] Garbow, B.S. et al., Matrix Eigensystem Routines: EISPACK Guide Ex- tension. Springer, New York, 1972. [96] von zur Gathen, J., Gerhard, J., Modern Computer Algebra. Cambridge U. Press, Cambridge, 2003 (2nd edition). [97] Geddes, K.O., Czapor, S.R., Labahn, G., Algorithms for Computer Alge- bra. Kluwer Academic, 1992. [98] Gelfand, I.M., Kapranov, M.M., Zelevinsky, A.V., Discriminants, Resul- tants and Multidimensional Determinants. Birkhauser, Boston, 1994. [99] Gilbert, A., Indyk, P., Sparse Recovery Using Sparse Matrices. Proceedings of IEEE, 2010. [100] George, A., Liu, J.W.-H., Computer Solution of Large Sparse Positive Definite Linear Systems. Prentice Hall, Englewood Cliffs, NJ, 1981. [101] Gilbert, J.R., Schreiber, R., Highly parallel sparse Cholesky factorization. SIAM J. on Scientific Computing, 13, 1151–1172, 1992. [102] Gilbert, J.R., Tarjan, R.E., The analysis of a nested dissection algorithm. Numer. Math., 50, 377–404, 1987. [103] Golub, G.H., Van Loan, C.F., Matrix Computations, 3rd ed., Johns Hop- kins University Press, Baltimore, MD, 1996. [104] Greenbaum, A., Iterative Methods for Solving Linear Systems. SIAM Pub- lications, Philadelphia, PA, 1997. 31 [105] Greuel, G.-M., Pfister, G. A Singular Introduction to Commutative Al- gebra (with contributions by O. Bachmann, C. Lossen, H. Schonemann). Springer, 2002. [106] Halko, N., Martinsson, P.G., Tropp, J.A., Finding Structure with Ran- domness: Probabilistic Algorithms for Constructing Approximate Matrix Decompositions, SIAM Review, 53, 2, 217–288, 2011. [107] Hansen, E., Patrick, M., Rusnak, J., Some modifications of Laguerre’s method. BIT, 17, 409–417, 1977. [108] Heath, M.T., Ng, E., Peyton, B.W., Parallel algorithms for sparse linear systems. SIAM Review, 33, 420–460, 1991. [109] Hemmer, M., Tsigaridas, E.P., Zafeirakopoulos, Z., Emiris, I.Z., Karave- las, M., Mourrain, B., Experimental evaluation and cross-benchmarking of univariate real solvers. In Proc. SNC’09, Kyoto, Japan, 2009. [110] Higham, N.J., Accuracy and Stability of Numerical Algorithms. SIAM, Philadelphia, 2002 (second edition). [111] Hoffmann, C.M., Sendra, J.R., Winkler, F. Special Issue on Parametric Algebraic Curves and Applications, J. Symbolic Comp., 23, 1997. [112] Jenkins, M.A., Traub, J.F., A three-stage variable-shift iteration for poly- nomial zeros and its relation to generalized Rayleigh iteration. Numer. Math., 14, 252–263, 1970. [113] Jouanolou, J.-P., Formes d’Inertie et R´esultant : Un Formulaire. Adv. in Math., 126:119–250, 1997. Also TR 499/P-288, IRMA, Strasbourg, 1992. [114] Kailath, T., Sayed, A., eds. SIAM volume on Fast Reliable Algorithms for Matrices with Structure, SIAM Publications, Philadelphia, 1999. [115] Kaltofen, E., Pan, V.Y., Processor efficient parallel solution of linear sys- tems over an abstract field. In Proc. SPAA’91, 180–191, ACM, NY, 1991. [116] Kaltofen, E., Pan, V.Y., Processor-efficient parallel solution of linear sys- tems II: the positive characteristic and singular cases. In Proc. FOCS’92, 714–723, IEEE Computer Society, Los Alamitos, CA, 1992. [117] Kaltofen, E., Villard, G., Computing the sign or the value of the determi- nant of an integer matrix, a complexity survey. J. Computational Applied Math., 162(1), 133–146, 2004. [118] Kaporin, I., The aggregation and cancellation techniques as a practical tool for faster matrix multiplication. [82], pp. 469–510. [119] Kapur, D., Geometry theorem proving using Hilbert’s Nullstellensatz. J. Symbolic Computation, 2, 399–408, 1986. 32 [120] Kapur, D., Lakshman, Y.N., Elimination methods an introduction. In Symbolic and Numerical Computation for Artificial Intelligence. Donald, B., Kapur, D., and Mundy, J., Eds., Academic Press, 1992. [121] Kapur, D., Saxena, T., Comparison of various multivariate resultant for- mulations. In in Proc. ISSAC, 187–195, ACM, 1995. [122] Khetan, A., The resultant of an unmixed bivariate system. J. Symbolic Computation, 36, 425–442, 2003. [123] Kirrinnis, P., Polynomial factorization and partial fraction decomposition by simultaneous Newton’s iteration. J. of Complexity, 14, 378–444, 1998. [124] Kolda, T. G., and Bader, B. W., Tensor Decompositions and Applications. SIAM Review, 51(3), 455–500, 2009. [125] Kotsireas, I., Mourrain, B., Pan, V. Y., eds., Special Issue on Algebraic and Numerical Algorithms. Theor. Comp. Sci., 412, 16, 1443–1543, 2011. [126] Kotsireas, I., Mourrain, B., Pan, V. Y., Zhi, L., eds., Special Issue on Symbolic-Numerical Algorithms. Theor. Comp. Sci., 479, 1–186, 2013. [127] Kreuzer, M., and Robbiano, L., Computational Commutative Algebra 1. Springer Verlag, Heidelberg, 2000. [128] Laderman, J., Pan, V.Y., Sha, H.X., On practical algorithms for acceler- ated matrix multiplication. Lin. Alg. Appls., 162–164, 557–588, 1992. [129] Lakshman, Y.N., Saunders, B.D., Sparse polynomial interpolation in non- standard bases. SIAM J. Comput., 24(2), 387–397, 1995. [130] Lawson, C.L., Hanson, R.J., Solving Least Squares Problems. Prentice- Hall, NJ, 1974, and (with a survey of recent developments) SIAM, 1995. [131] Lazard, D., Resolution des systemes d’equation algebriques. Theoretical Comput. Sci., 15, 77–110, 1981. In French. [132] Lenstra, A.K., Lenstra, H.W., Lov´asz, L., Factoring polynomials with rational coefficients. Math. Ann., 261, 515–534, 1982. [133] Lickteig, T., Roy, M.-F., Sylvester–Habicht sequences and fast Cauchy index computation. J. Symbolic Comp., 31(3), 315–341, 2001. [134] Lipton, R.J., Rose, D., Tarjan, R.E., Generalized nested dissection. SIAM J. on Numer. Analysis, 16(2), 346–358, 1979. [135] Macaulay, F.S., Algebraic theory of modular systems. Cambridge Tracts 19, Cambridge, 1916. [136] Madsen, K., A root-finding algorithm based on Newton’s method. BIT, 13, 71–75, 1973. 33 [137] Mahoney, M. W., Maggioni, M., Drineas, P., Tensor-CUR Decompositions for Tensor-based Data. SIAM J. Matrix Anal. Appls., 30, 2, 957–987, 2008. [138] Manocha, D., Algebraic and Numeric Techniques for Modeling and Robotics. Ph.D. Thesis, CSD, DEECS, UC, Berkeley, CA, 1992. [139] Mayr, E.W., Meyer, A.R., The Complexity of the Finite Containment Problem for Petri Nets. J. ACM, 28(3), 561–576, 1981. [140] McCormick, S., Ed., Multigrid Methods. SIAM, Philadelphia, 1987. [141] McNamee, J.M., A 2000 Updated Supplementary Bibliography on Roots of Polynomials. J. Comput. and Applied Mathematics, 142, 433–434, 2002. [142] McNamee, J.M., Numerical Methods for Roots of Polynomials (Part 1), Elsevier, Amsterdam, 2007. [143] McNamee, J.M., Pan, V.Y., Efficient polynomial root-refiners: a survey and new record estimates. Computers Math. (Appls.), 63, 239–254, 2012. [144] McNamee, J.M., Pan, V.Y., Numerical Methods for Roots of Polynomials, Part 2, 780+XIX pages, Elsevier, 2013. [145] Mehlhorn, K., Ray, S., Faster algorithms for computing Hong’s bound on absolute positiveness. J. Symbolic Computation, 45(6), 677–683, 2010. [146] Mehlhorn, K., Sagraloff, M., A deterministic algorithm for isolating real roots of a real polynomial. J. Symb. Computation, 46(1), 70–90, 2011. [147] Mignotte, M., Mathematics for Computer Algebra. Springer-Verlag, 1992. [148] Mignotte, M., Stefanescu, D., Polynomials: An algorithmic approach. Springer, 1999. [149] Miranker, W.L., Pan, V.Y., Methods of Aggregations. Linear Algebra and Its Applications, 29, 231–257, 1980. [150] Mourrain, B., Pan, V.Y., Asymptotic acceleration of solving polynomial systems. Proc. STOC’98, 488–496, ACM Press, New York, 1998. [151] Mourrain, B. , Pan, V.Y., Multivariate polynomials, duality and struc- tured matrices. J. Complexity, 16 (1), 110–180, 2000. [152] Mourrain, B., Pan, V.Y., Ruatta, O., Accelerated solution of multivariate polynomial systems of equations. SIAM J. Comp., 32 (2), 435–454, 2003. [153] Mourrain, B., Pavone, J.-P., Tr´ebuchet, P., Tsigaridas, E.P., synaps: a library for symbolic-numeric computing. In Proc. 8th Int. Symp. Effective Methods in Alg. Geom. (MEGA), Italy, 2005 (software presentation). [154] Mourrain, B., Tr´ebuchet, P., Solving projective complete intersection faster. J. Symbolic Computation, 33(5), 679–699, 2002. 34 [155] Mourrain, B., Tr´ebuchet, P., Stable normal forms for polynomial system solving Theor. Comp. Science, 409(2), 229–240, 2008. [156] Mourrain, B., Vrahatis, M., Yakoubsohn, J.C., On the complexity of isolating real roots and computing with certainty the topological degree. J. Complexity, 18(2), 2002. [157] Neff, C.A., Reif, J.H., An O(nl+ǫ) algorithm for the complex root problem. Proc. IEEE FOCS, 540–547, 1994. [158] Nguyen, P.Q., Valle, B. (Eds.) The LLL Algorithm, Survey and Appli- cations. Series: Information Security and Cryptography, XIV, 496 pp., Springer, 2010, ISBN 978-3-642-02294-4. [159] Ortega, J.M., Voight, R.G., Solution of partial differential equations on vector and parallel computers. SIAM Review, 27, 2, 149–240, 1985. [160] Oseledets, I. V., Tyrtyshnikov, E. E., Breaking the curse of dimensionality, or how to use SVD in many dimensions. SISC, 31, 5, 3744–3759, 2009. [161] Pan, V. Y., On schemes for the evaluation of products and inverses of matrices (in Russian), Uspekhi Mat. Nauk, 27, 5 (167), 249–250, 1972. [162] Pan, V. Y., Strassen’s algorithm is not optimal. Trilinear technique of aggregating. Proc. IEEE FOCS, 166–176, 1978. [163] Pan, V.Y., How can we speed up matrix multiplication? SIAM Rev., 26(3), 393–415, 1984. [164] Pan, V.Y., How to Multiply Matrices Faster, volume 179 of Lecture Notes in Computer Science. Springer Verlag, Berlin, 1984. [165] Pan, V.Y., Complexity of parallel matrix computations. Theoretical Com- puter Science, 54, 65–85, 1987. [166] Pan, V.Y., Computing the determinant and the characteristic polynomials of a matrix via solving linear systems of equations. Information Processing Letters, 28, 71–75, 1988. [167] Pan, V. Y., On computations with dense structured matrices. Math. of Comp., 55, 191, 179–190, 1990. Also Proc. ISSAC, 34–42, ACM, 1989. [168] Pan, V.Y., Complexity of computations with matrices and polynomials. SIAM Review, 34(2), 225–262, 1992. [169] Pan, V.Y., Parallel solution of sparse linear and path systems. In Synthe- sis of Parallel Algorithms, Reif, J.H., Ed., chapter 14, 621–678. Morgan Kaufmann, San Mateo, CA, 1993. [170] Pan, V.Y., Parallel computation of a Krylov matrix for a sparse and struc- tured input. Mathematical and Computer Modelling, 21(11), 97–99, 1995. 35 [171] Pan, V.Y., Optimal and nearly optimal algorithms for approximating polynomial zeros. Computers in Mathematics (with Applications), 31(12), 97–138, 1996. Also STOC’95, 741–750, ACM, Press, New York, 1995. [172] Pan, V.Y., Parallel computation of polynomial GCD and some related parallel computations over abstract fields. Theor. Comp. Science, 162(2), 173–223, 1996. [173] Pan, V.Y., Solving a polynomial equation: Some history and recent progress. SIAM Review, 39(2), 187–220, 1997. [174] Pan, V.Y., Solving polynomials with computers. American Scientist, 86, 62–69, January–February 1998. [175] Pan, V.Y., Some recent algebraic/numerical algorithms. Electr. Proc. IMACS/ACA, 1998. www-troja.fjfi.cvut.cz/aca98/sessions/approximate [176] Pan, V.Y., Numerical computation of a polynomial GCD and extensions. Information and Computation, 167(2), 71–85, 2001. Also Proc. SODA’98, 68–77, ACM Press, and SIAM Publications, 1998. [177] Pan, V.Y., On approximating complex polynomial zeros: Modified quadtree (Weyl’s) construction and improved Newton’s iteration. J. of Complexity, 16 (1), 213–264, 2000. [178] Pan, V.Y., Structured Matrices and Polynomials: Unified Superfast Algo- rithms. Birkhauser/Springer, Boston/New York, 2001. [179] Pan, V.Y., Univariate polynomials: nearly optimal algorithms for factor- ization and rootfinding. J. Symbolic Computations, 33 (5), 701–733, 2002. [180] Pan, V.Y., On theoretical and practical acceleration of randomized com- putation of the determinant of an integer matrix. Zapiski Nauchnykh Sem- inarov POMI (in English), 316, 163–187, St. Petersburg, Russia, 2004. Also available at http://comet.lehman.cuny.edu/vpan/ [181] Pan, V.Y., Amended DSeSC power method for polynomial root-finding. Computers and Math. (with Applications), 49 (9–10), 1515–1524, 2005. [182] Pan, V.Y., Newton’s iteration for matrix inversion, advances and exten- sions. Matrix Methods: Theory, Algorithms and Applications (eds. V. Ol- shevsky, E. Tyrtyshnikov), pp. 364–381, World Scientific, 2010. [183] Pan, V.Y., Nearly optimal solution of rational linear systems of equations with symbolic lifting and numerical initialization. Computers & Math. with Applications, 62, 1685–1706, 2011. [184] Pan, V.Y., Root-refining for a Polynomial Equation. Proceedings of CASC 2012, Lecture Notes in Computer Science, Springer, 2012. 36 [185] Pan, V.Y., Branham, S., Rosholt, R., Zheng, A., Newton’s iteration for structured matrices and linear systems of equations. [114], Ch. 7, 189–210. [186] Pan, V.Y., Grady, D., Murphy, B., Qian, G., Rosholt, R.E., Schur aggre- gation for linear systems and determinants, pp. 255–268 in [22]. [187] Pan, V.Y., Ivolgin, D., Murphy, B., Rosholt, R.E., Tang, Y., Wang, X., Root-finding with eigen-solving. [236], pp. 185–210. [188] Pan, V.Y., Ivolgin, D., Murphy, B., Rosholt, R.E., Tang, Y., Yan, X., Additive preconditioning for matrix computations. Linear Algebra and Applications, 432, 1070–1089, 2010. [189] Pan, V.Y., Kunin, M., Rosholt, R.E., Kodal, H., Homotopic residual cor- rection processes. Math. of Computation, 75, 345–368, 2006. [190] Pan, V.Y., Landowne, E., Sadikou, A., Univariate polynomial division with a remainder by means of evaluation and interpolation. Information Processing Letters, 44, 149–153, 1992. [191] Pan, V.Y., Murphy, B., Rosholt, R.E., Unified nearly optimal algorithms for structured integer matrices. Operator Theory: Advances and Applica- tions, 199, 359–375, Birkhauser, Basel, 2010. [192] Pan, V.Y., Preparata, F.P., Work–preserving speed-up of parallel matrix computations. SIAM J. Comput., 24(4), 811–821, 1995. [193] Pan, V.Y., Qian, G., Randomized preprocessing of homogeneous linear systems of equations. Linear Algebra & Appls., 432, 3272–3318, 2010. [194] Pan, V.Y., Qian, G., Solving linear systems of equations with randomiza- tion, augmentation and aggregation. Linear Algebra & Appls., 437, 2851– 2876, 2012. [195] Pan, V.Y., Qian, G., Zheng, A., Randomized preconditioning of the MBA algorithm. Proc. ISSAC, 281–288, ACM, 2011. [196] Pan, V.Y., Qian, G., Zheng, A., Randomized preconditioning versus piv- oting. Linear Algebra and Its Applications, 438, 4, 1883–1889, 2013. [197] Pan, V.Y., Qian, G., Zheng, A., Real and complex polynomial root-finding via eigen-solving and randomization. Proc. CASC 2012, LNCS, 2012. [198] Pan, V.Y., Qian, G., Zheng, A., Randomized matrix computations, Tech. Report TR 2012005, Ph.D. Program in Computer Science, Grad- uate Center, the City University of New York, 2012. Available at http://www.cs.gc.cuny.edu/tr/techreport.php?id=432. [199] Pan, V.Y., Qian, G., Zheng, A., Chen, Z., Matrix computations and poly- nomial root-finding with preprocessing. Linear Algebra and Its Applica- tions, 434, 854–879, 2011. 37 [200] Pan, V.Y., Rami, Y., Wang, X., Structured matrices and Newton’s itera- tion: unified approach. Linear Algebra Applics., 343/344, 233–265, 2002. [201] Pan, V.Y., Reif, J.H., Compact multigrid. SIAM J. on Scientific and Statistical Computing, 13(1), 119–127, 1992. [202] Pan, V.Y., Reif, J.H., Fast and efficient parallel solution of sparse linear systems. SIAM J. Comp., 22(6), 1227–1250, 1993. [203] Pan, V.Y., Schreiber, R., An improved Newton iteration for the gener- alized inverse of a matrix, with applications. SIAM Journal on Scientific and Statistical Computing, 12(5), 1109–1131, 1991. [204] Pan, V.Y., Tsigaridas E. P., On the Boolean complexity of the real root refinement, Proc. ISSAC, 299–306, ACM Press, 2013. [205] Pan, V.Y., Wang, X., Inversion of displacement operators. SIAM J. on Matrix Analysis and Applications, 24(3), 660–677, 2003. [206] Pan, V.Y., Wang, X., Degeneration of integer matrices modulo an integer. Linear Algebra and Its Applications, 429, 2113–2130, 2008. [207] Pan, V.Y., Yu, Y., Certification of numerical computation of the sign of the determinant of a matrix. Algorithmica, 30, 708–724, 2001. Also Proc. SODA ’99, 715–724, ACM/SIAM, 1999. [208] Pan, V.Y., Zheng, A., New progress in real and complex polynomial root- finding. Computers and Math. (with Applications) 61, 1305–1334. Also Proc. ISSAC, 219–226, ACM Press, 2010. [209] Pan, V.Y., Zheng, A., Root-finding by expansion with independent con- straints. Computers and Math. (with Applications), 62, 3164-3182, 2011. [210] Parlett, B., Symmetric Eigenvalue Problem. Prentice Hall, 1980. [211] Quinn, M.J., Parallel Computing: Theory and Practice. McGraw-Hill, New York, 1994. [212] Raghavan M., Roth, B., Solving polynomial systems for the kinemat- ics analysis and synthesis of mechanisms and robot manipulators. Trans. ASME, Special Issue, 117, 71–79, 1995. [213] Reischert, D., Asymptotically fast computation of subresultants. In Proc. ISSAC, 233–240, ACM, 1997. [214] Ritt, J.F., Differential Algebra. AMS, New York, 1950. [215] Rouillier, F., Solving zero-dimensional systems through the rational uni- variate representation. AAECC Journal, 9, 433–461, 1999. [216] Rouillier, F., Zimmermann, P., Efficient isolation of polynomial’s real roots. J. Computational & Applied Math., 162(1):33–50, 2004. 38 [217] Sagraloff, M., When Newton meets Descartes: A simple and fast algorithm to isolate the real roots of a polynomial. CoRR, abs/1109.6279, 2011. [218] Sankar, A., Spielman, D., Teng, S.-H., Smoothed analysis of the condition numbers and growth factors of matrices. SIAM J. Matrix Analysis, 28(2), 446–476, 2006. [219] Schonhage, A., The fundamental theorem of algebra in terms of compu- tational complexity. Math. Dept., Univ. Tubingen, Germany, 1982. [220] Sharma, V., Complexity of real root isolation using continued fractions. Theor. Comput. Sci., 409(2):292–310, 2008. [221] Brian Smith, James Boyle, Jack Dongarra, Burton Garbow, Y. Ikebe, V Klema, Cleve Moler, Matrix Eigensystem Routines: EISPACK Guide, 2nd edition. Springer, New York, 1970. [222] Stetter, H., Numerical polynomial algebra. SIAM, Philadelphia, 2004. [223] Stewart, G.W., Matrix Algorithms, Vol I: Basic Decompositions. Vol II: Eigensystems. SIAM, Philadelphia, 1998. [224] Storjohann, A., The shifted number system for fast linear algebra on in- teger matrices. Journal of Complexity, 21(4), 609–650, 2005. [225] Stothers, A. J., On the Complexity of Matrix Multiplication. Ph.D. Thesis, University of Edinburgh, 2010. [226] Sturmfels, B., Sparse elimination theory. Proc. Comp.. Alg. Geom. Com- mut. Algebra, Eisenbud, D., Robbiano, L., Eds., Cortona, Italy, 1991. [227] Tarjan, R.E., A unified approach to path problems. J. of ACM, 28(3), 577–593 and 594–614, 1981. [228] Trefethen, L.N., Bau III, D., Numerical Linear Algebra. SIAM, 1997. [229] Tsigaridas, E.P., Improved complexity bounds for real root isolation using Continued Fractions. In S. Ratschan, ed., Proc. 4th Int’l Conf. on Math. Aspects Comp. Inf. Sci. (MACIS), 226–237, Beijing, China, 2011. [230] Tsigaridas, E.P., Emiris, I.Z., On the complexity of real root isolation using Continued Fractions. Theor. Computer Sci., 392, 158–173, 2008. [231] Van Barel, M., Vandebril, R., Van Dooren, P., Frederix, K., Implicit dou- ble shift QR-algorithm for companion matrices. Numer. Math. 116 (2), 177–212, 2010. [232] Vandebril, R., Van Barel, M., Mastronardi, N., Matrix Computations and Semiseparable Matrices: Linear Systems (Volume 1). The Johns Hopkins University Press, Baltimore, Maryland, 2007. 39 [233] van der Vorst, H.A., Iterative Krylov Methods for Large Linear Systems. Cambridge U. Press, Cambridge, 2003. [234] Vassilevska Williams, V., Multiplying matrices faster than Coppersmith– Winograd. Proc. STOC 2012, 887–898, 2012. [235] Vincent, A.J.H., Sur la r´esolution des ´equations num´eriques. J. Math. Pures Appl., 1, 341–372, 1836. [236] Symbolic-Numeric Computation (Wang, D., Zhi, L. editors). Birkhauser, Basel/Boston, 2007. [237] Wang, X., Pan, V.Y., Acceleration of Euclidean Algorithm and Rational Number Reconstruction. SIAM J. of Computing, 32(2), 548–556, 2003. [238] Watkins, D.S., The Matrix Eigenvalue Problem: GR and Krylov Subspace Methods. SIAM, Philadelphia, PA, 2007. [239] Wiedemann, D., Solving sparse linear equations over finite fields. IEEE Trans. Inf. Theory IT–32, 54–62, 1986. [240] Wilkinson, J.H., The Algebraic Eigenvalue Problem. Clarendon Press, Ox- ford, England, 1965. [241] Winkler, F., Polynomial Algorithms in Computer Algebra. Springer, 1996. [242] Wu, W., Basis principles of mechanical theorem proving in elementary geometries. J. Syst. Sci. and Math Sci., 4(3), 207–235, 1984. [243] Yap, C.K., Fundamental Problems of Algorithmic Algebra. Oxford Uni- versity Press, New York, 2000. [244] Zhlobich, P., Differential qd Algorithm with Shifts for Rank-Structured Matrices. SIAM J. on Matrix Analysis and Applications, 33(4), 1153– 1171, 2012. [245] Zippel, R., Effective Polynomial Computations. Kluwer Academic, 1993. Further Information The books and special issues of journals [1, 5, 21, 25, 31, 58, 82, 97, 178, 222, 245] provide a broader introduction to the general subject and further bibliography. There are well-known libraries and packages of subroutines for the most popular numerical matrix computations, in particular, [61] for solving linear systems of equations, [95], [221], ARPACK, and PARPACK for approximating matrix eigenvalues, and [3] for both of the two latter computational problems. Comprehensive treatment of numerical matrix computations and extensive bibli- ography can be found in [103, 223], and there are many more specialized books on them [6, 8, 62, 100, 104, 110, 210, 228, 240] as well as many survey arti- cles [108, 159, 168] and thousands of research articles. Further applications to 40 the graph and combinatorial computations related to linear algebra are cited in “Some Computations Related to Matrix Multiplication” and [169]. On parallel matrix computations see [101, 103, 115, 116, 192] assuming gen- eral input matrices, [101, 108, 169, 202] assuming sparse inputs, [62] assum- ing banded inputs, and [21, 172, 178] assuming dense structured inputs. On Symbolic-Numeric algorithms, see the books [21, 178, 236], surveys [168, 173, 175], special issues [82, 22, 125, 126], and the bibliography therein. For the general area of exact computation and the theory behind algebraic algorithms and computer algebra, see [9, 30, 50, 51, 58, 96, 97, 148, 241, 243, 147, 245]. There is a lot of generic software packages for exact computation, synaps [153], a C++ open source library devoted to symbolic and numeric computa- tions with polynomials, algebraic numbers and polynomial systems, which has been evolving into the realroot package of the open source computer algebra system mathemagix; ntl a high-performance C++ library providing data struc- tures and algorithms for vectors, matrices, and polynomials over the integers and finite fields, and exacus [11], a C++ library for curves and surfaces that pro- vides exact methods for solving polynomial equations. A highly efficient tool is FGb for Grobner basis, and RS for the rational univariate representation, and real solutions of systems of polynomial equations and inequalities. Finally, Lin- Box [65] is a C++ library that provides exact high-performance implementations of linear algebra algorithms. This chapter does not cover the area of polynomial factorization. We refer the interested reader to [96, 132, 158], and the bibliography therein. The SIAM Journal on Matrix Analysis and Applications and Linear Algebra and Its Applications are specialized on Matrix Computations, Mathematics of Computation and Numerische Mathematik are leading among numerous other good journals on numerical computing. The Journal of Symbolic Computation and the Foundations of Computa- tional Mathematics specialize on topics in Computer Algebra, which are also covered in the Journal of Computational Complexity, the Journal of Pure and Applied Algebra and, less regularly, in the Journal of Complexity. Mathematics for Computer Science and Applicable Algebra in Engineering, Communication and Computing are currently dedicated to the subject of the chapter as well. Theoretical Computer Science has become more open to algebraic–numerical and algebraic–geometric subjects [22, 34, 82, 125]. The annual International Symposium on Symbolic and Algebraic Computa- tion (ISSAC) is the main conference in computer algebra; these topics are also presented at the bi-annual Conference MEGA and the newly founded SIAM con- ference on Applications of Algebraic Geometry. They also appear, in the annual ACM Conference on Computational Geometry, as well as at various Computer Science conferences, including SODA, FOCS, and STOC. Among many conferences on numerical computing, most comprehensive ones are organized under the auspices of SIAM and ICIAM. The International Work- shop on Symbolic-Numeric Algorithms can be traced back to 1997 (SNAP in INRIA, Sophia Antipolis) and a special session in IMACS/ACA98 Confer- ence in Prague, Czech Republic, in 1998 [175]. It restarted in Xi’an, China, 41 2005; Timishiora, Romania, 2006 (supported by IEEE), and London, Ontario, Canada, 2007 (supported by ACM). The topics of Symbolic-Numerical Compu- tation are also represented at the conferences on the Foundations of Computa- tional Mathematics (FoCM) (meets every 3 years) and quite often at ISSAC. 42
1709.00644
3
1709
2018-04-03T20:28:17
Optimal Net-Load Balancing in Smart Grids with High PV Penetration
[ "cs.DS", "eess.SY" ]
Mitigating Supply-Demand mismatch is critical for smooth power grid operation. Traditionally, load curtailment techniques such as Demand Response (DR) have been used for this purpose. However, these cannot be the only component of a net-load balancing framework for Smart Grids with high PV penetration. These grids can sometimes exhibit supply surplus causing over-voltages. Supply curtailment techniques such as Volt-Var Optimizations are complex and computationally expensive. This increases the complexity of net-load balancing systems used by the grid operator and limits their scalability. Recently new technologies have been developed that enable the rapid and selective connection of PV modules of an installation to the grid. Taking advantage of these advancements, we develop a unified optimal net-load balancing framework which performs both load and solar curtailment. We show that when the available curtailment values are discrete, this problem is NP-hard and develop bounded approximation algorithms for minimizing the curtailment cost. Our algorithms produce fast solutions, given the tight timing constraints required for grid operation. We also incorporate the notion of fairness to ensure that curtailment is evenly distributed among all the nodes. Finally, we develop an online algorithm which performs net-load balancing using only data available for the current interval. Using both theoretical analysis and practical evaluations, we show that our net-load balancing algorithms provide solutions which are close to optimal in a small amount of time.
cs.DS
cs
Optimal Net-Load Balancing in Smart Grids with High PV Penetration∗ Rajgopal Kannan US Army Research Lab, 12015 Waterfront Drive, Playa Vista, Viktor K. Prasanna Ming Hsieh Department of Electrical Engineering, University of Southern California, Los Angeles, CA-90089 [email protected] Sanmukh R. Kuppannagari Ming Hsieh Department of Electrical Engineering, University of Southern California, Los Angeles, CA-90089 [email protected] CA-90094 [email protected] 8 1 0 2 r p A 3 ] S D . s c [ 3 v 4 4 6 0 0 . 9 0 7 1 : v i X r a ABSTRACT Mitigating Supply-Demand mismatch is critical for smooth power grid operation. Traditionally, load curtailment techniques such as Demand Response (DR) have been used for this purpose. However, these cannot be the only component of a net-load balancing frame- work for Smart Grids with high PV penetration. (cid:140)ese grids can sometimes exhibit supply surplus causing over-voltages. Supply curtailment techniques such as Volt-Var Optimizations are complex and computationally expensive. (cid:140)is increases the complexity of net-load balancing systems used by the grid operator and limits their scalability. Recently new technologies have been developed that enable the rapid and selective connection of PV modules of an installation to the grid. Taking advantage of these advancements, we develop a uni(cid:128)ed optimal net-load balancing framework which performs both load and solar curtailment. We show that when the available curtailment values are discrete, this problem is NP-hard and develop bounded approximation algorithms for minimizing the curtailment cost. Our algorithms produce fast solutions, given the tight timing constraints required for grid operation. We also incorporate the notion of fairness to ensure that curtailment is evenly distributed among all the nodes. Finally, we develop an online algorithm which performs net-load balancing using only data available for the current interval. Using both theoretical anal- ysis and practical evaluations, we show that our net-load balancing algorithms provide solutions which are close to optimal in a small amount of time. 1 INTRODUCTION Electrical power grids have undergone a drastic transformation since the 1970s in terms of both scale and complexity [35]. Techno- logical advances such as the use of bi-directional AMI meters, al- lowing real time remote monitoring and control, have transformed them into smart grids [25]. Adoption of distributed solar energy has increased dramatically due to the falling cost of solar PVs. (cid:140)e installed prices of U.S. residential and commercial PV systems declined 5-7% on average during 1998-2011 [2]. As per the DoE SunShot vision document, solar generated power is expected to grow to 14% of the total power supply in 2030 and 27% by 2050 [34]. Ensuring the matching of demand (load) and supply in a smart grid, also known as net-load balancing, is a critical grid opera- tion. However, the increase in available power supply from solar energy is opening up new challenges in net-load balancing [11]. ∗(cid:140)is work has been funded by the U.S. National Science Foundation under grant number ACI 1339756 and the Department of Energy (DoE) under award number DE-EE0008003. Solar energy is heavily in(cid:131)uenced by the ever changing weather conditions. (cid:140)is high variability in solar generation can lead to fre- quent demand-supply mismatches. (cid:140)is is especially pronounced in a distribution grid where a signi(cid:128)cant portion of supply comes from solar generation. (cid:140)is mismatch, if le(cid:137) unmitigated, can lead to 1) blackouts, if the demand is higher than the generation or 2) cause over-voltages and equipment tripping requiring manual intervention, if generation is higher than demand [16]. Load curtailment techniques for net-load balancing have been studied widely [7]. However, the issue of surplus supply must also be addressed to avoid over-voltages. Voltage Var Optimization (VVO) is a technique used to mitigate the over-voltage problem. VVO works by injecting the required amount of reactive power to reduce voltages to within the tolerable range [26]. Grid oper- ations have tight timing constraints and require solutions with low response time. Calculating the right amount of reactive power to be injected at each node of the grid requires solving Optimal Power Flow (OPF) equations, which are not scalable [26]. New PV technology allows us to leverage the micro-inverters installed at PV installations. (cid:140)ese micro-inverters provide the capability to (dis)connect a subset of PVs from each installation in the grid [16]. We leverage this capability in our framework. For each PV in- stallation, this provides us with a discrete set of solar curtailment strategies. In this work, we develop a net-load balancing framework which can perform both supply and demand curtailment over a horizon. Determining load or supply curtailment strategies when each strat- egy exhibits a discrete curtailment value is, as we show in this work, an NP-hard problem. Current techniques for curtailment strategy selection provide computationally expensive optimal solutions or faster heuristics with no optimality bounds. In contrast, we develop fast and optimal net-load balancing algorithms as a core component of our framework. Our algorithms minimize the cost of curtailment while ensuring that several practical constraints such as achieving the curtailment target, fairness etc. are met. We also develop an online heuristic to address scenarios where load and generation predictions for the entire horizon are not available beforehand. Us- ing both theoretical analysis and practical evaluations, we show that the solutions provided by our net-load balancing algorithms are both scalable and near optimal. 2 RELATED WORKS Signi(cid:128)cant literature exists on performing net-load balancing using load curtailment techniques such as Demand Response (DR). (cid:140)e key idea is to 'shi(cid:137)' the loads away from high demand periods. Load curtailment can be pricing based in which the customers are incentivised or penalized to curtail. Works such as [13, 29] fall into this category. Curtailment can also be performed using direct control from the grid operator. (cid:140)is scenario is be(cid:138)er suited for micro-grids such as a University/Industrial campus. Techniques which focus on direct control based load curtailment fall into two broad categories. (cid:140)e (cid:128)rst category consists of sto- chastic optimization based approaches such as [21] and [14]. One limitation of such approaches is that they require a large num- ber of nodes to ensure that the targeted curtailment is met with high probability – this may not always be feasible [19]. Another approach is deterministic load curtailment in which nodes adopt curtailment strategies. In the real world (including our campus microgrid experience), strategies have discrete curtailment values. Nodes (buildings) can choose strategies from the strategy space such that the total curtailment objective is satis(cid:128)ed while other practical constraints are met. (cid:140)e strategy selection problem, in general, is NP-hard and hence it is di(cid:129)cult to get exact results in a reasonable amount of time. Here again there are two approaches. (cid:140)e (cid:128)rst is to forgo accuracy guarantees in favor of performance. Techniques such as [30], [37] and [31] develop fast algorithms which can have arbitrarily large errors in the objective function (utility maximization, cost minimization etc.). Authors in [30] develop a genetic algorithm based heuristic while [37] presents a heuristic based on change making. (cid:140)e algorithm developed in [31] uses Linear Programming whose solutions need to be rounded to inte- gral values and can have large errors (unbounded integrality gap). (cid:140)e second approach is to provide computationally expensive exact solutions, for example, [23] and [10], where the authors use Mixed ILP for their algorithm. Previously, we developed polynomial time approximation algorithms for "Sustainable" Demand Response in which aggregate curtailment was bounded over intervals of the DR event [19, 20]. However, we did not consider net-load balancing along with fairness and curtailment cost objectives, as proposed. Load Curtailment techniques are ine(cid:130)ective when supply due to solar PVs exceeds the demand. If this is le(cid:137) unmitigated, it causes over-voltages in the system leading to failures. Several works perform reactive solar curtailment in response to rising volt- age. VVO [26] increases reactive power to lower the voltage due to real power while iPlug curtails the solar energy input to the grid by redirecting it to charge storage or coordinate with local demand ramp-up resources [28]. (cid:140)e authors in [22, 33, 36] achieve continuous curtailment from solar PVs by running them at volt- ages other than the Maximum Power Point (MPP). (cid:140)is requires (cid:128)ne grained control of the solar panels. For some scenarios, (cid:128)ne grained control might not be available due to limitations of inverter technology. Our work addresses such scenarios through a curtail- ment model that handles a discrete set of curtailment values and provides bounded polynomial time approximations for achieving discrete curtailment targets. As mentioned in [16], discrete solar curtailment can be performed by simply disconnecting individual PV modules using the micro-inverters installed at PV installations. As opposed to the technique developed in [16], which is reactive to over-voltages, we perform proactive solar curtailment. 3 OUR CONTRIBUTIONS Our work tries to address the limitations of the current frameworks by making the following contributions: (1) To the best of our knowledge, ours is the (cid:128)rst work to develop a curtailment strategy selection framework which can perform discrete solar curtailment pro actively to avoid over-voltages. (2) We develop a uni(cid:128)ed framework which performs both load and solar curtailment. (cid:140)is greatly simpli(cid:128)es the overhead involved in grid management for the operator. (3) We develop algorithms which are fast and provide worst case accuracy guarantee. Hence, we can simultaneously achieve the con(cid:131)icting goals of accuracy and computational tractability with an ability to trade-o(cid:130) one for the other. (4) We incorporate the notion of fairness into our algorithms and also develop an online algorithm for the cases when forecasts for the entire horizon are unavailable. 4 NET-LOAD BALANCING IN SMART GRIDS 4.1 Motivation (cid:140)e Smart Grid that we consider in this work consists of several demand nodes: consumers of electricity, and supply nodes: electric- ity producers. (cid:140)e supply nodes are the customers who have solar PVs installed. A node can act both as a demand node and a supply node. (cid:140)e Smart Grid has a high PV penetration i.e., the supply from solar PVs under normal weather conditions meet the demand of the consumers for most of the day. We assume that during night or during extremely unfavorable weather conditions, conventional sources of electricity are used to meet the demand. Mitigating supply-demand mismatch within tight timing con- straints is critical for smooth operation of a smart grid. As shown in Figure 1, during several intervals of the day, such as regions 1 and 3, the demand of the consumers can exceed the solar supply. (cid:140)is can cause blackouts in the grid. Demand curtailment strategies need to be adopted during such intervals to avoid blackouts. (cid:140)e other extreme is shown using region 2 in Figure 1. (cid:140)ese are the intervals in which the supply due to solar PVs exceeds the demand. (cid:140)is can cause over-voltages in the grid leading to the tripping of fault prevention devices [16]. Under this scenario, supply curtailment strategies are required. We assume there exists a centralized grid operator with the ca- pability of remotely switching a node into a curtailment strategy. A general framework which performs both load and supply curtail- ment greatly simpli(cid:128)es grid management for the grid operator. 4.2 Demand Curtailment Strategies (cid:140)e Demand Curtailment model considered in this work is based on a real world Demand Response implementation in USC's Campus Microgrid [18]. In the Smart Grid, each demand node is associated with several demand curtailment strategies. Examples of strategies include Global Zone Temperature Reset (GTR), Variable Frequency Drive Speed Reset (VFD), Equipment Duty Cycling (Duty) and their combinations [18]. Each curtailment strategy for each node in a given time interval exhibits a discrete curtailment value. (cid:140)is complicates the problem as Linear Programming based techniques, 2 in grid operations. (cid:140)e objective of our framework is to minimize cost while performing net-load balancing. Figure 1: Example Supply Demand Curve which are both fast and optimal can no longer be used. (cid:140)is value can be predicted using algorithms mentioned in [8]. Each node is also associated with a default curtailment strategy of curtailment value 0. Hence, if a node has no curtailment strategy available or does not participate in demand curtailment, we assume that it follows the default strategy. Demand curtailment is known in the literature as Demand Response [6]. 4.3 Solar Curtailment Strategies Each supply node i.e., a node with PV installation in the Smart Grid consists of several solar panels (each solar panel is called a module). Traditionally, modules are connected in series to an inverter which in turn is connected to the grid. However, this topology a(cid:130)ects the e(cid:129)ciency of the PV system as the inverter conditions the output according to the poorest performing module [16]. (cid:140)erefore newer designs, in which each module is independently connected to a micro-inverter are becoming increasingly popular [15]. Technically, each micro-inverter of a PV installation is an in- dependent grid connected generator, turning the PV installation into a segmented generator with discrete generation output. (cid:140)e maximum output of the PV installation will occur when all the solar panels are allowed to feed into the grid. However, at any given time, micro-inverters can be con(cid:128)gured such that only a subset of PV modules are connected to the grid. Our objective is to exploit this capability by controlling the micro-inverter con(cid:128)guration and enabling discrete curtailment of supply. We refer the reader to [16] for more details on utilizing micro-inverters for solar curtailment. Note that the technique developed in [16] is a reactive technique which reacts to voltage increase and requires high frequency volt- age sampling. Our technique is a proactive technique which avoids an increase in voltage by reducing supply in advance. 4.4 Curtailment Cost Each curtailment strategy for each node is associated with a cost value as curtailment leads to a loss in utility. (cid:140)ese costs are de- termined by the grid operator to re(cid:131)ect the loss. Typically, the costs are some function of the curtailment value e.g., if a node, by following a strategy curtails γ, then the cost of this strategy will be f (γ), where f is some function determined by the grid operator. Linear and quadratic functions are commonly used cost functions Figure 2: High Level Overview of Net-Load Balancing Frame- work 4.5 Net-Load Balancing Framework In this work, we develop a generalized framework which performs net-load balancing by selecting load or supply curtailment strate- gies. We de(cid:128)ne net-load balancing horizon as the time horizon during which the net-load balancing framework is used. Net-load balancing horizon is divided into several smaller curtailment hori- zons. A curtailment horizon is de(cid:128)ned as a period of time during which either demand is higher than the supply requiring a demand curtailment or vice-versa. 4.5.1 Model. In our net-load balancing framework, each supply node of the Smart Grid is associated with a generation prediction model such as ARIMA+ANN ensemble [27]. Similarly, each de- mand node is associated with a demand prediction model such as ARIMA [9]. Each node is also associated with a curtailment prediction model [8]. Determining the best prediction model for each node is a separate research topic and is out of the scope of this work. (cid:140)is work uses historical load, generation and curtailment prediction data. 4.5.2 Method. (cid:140)e (cid:131)ow chart in Figure 2 gives a high level overview of our net-load balancing framework. (cid:140)e framework determines the aggregate load and supply for each interval in the net-load balancing horizon. It then identi(cid:128)es a list of load curtail- ment horizons and supply curtailment horizons and the respective curtailment targets (curtailment target calculation is discussed in Section 5.1). For each interval of every curtailment horizon, the net-load balancing framework uses the curtailment prediction mod- els to determine discrete curtailment values for each node. Using the discrete curtailment values, it also generates the cost values associated with them. (cid:140)en, for each curtailment horizon, it runs one of the net-load balancing algorithms detailed in Section 5. (cid:140)e algorithm to run is pre-determined by the grid operator. (cid:140)e algo- rithm returns the curtailment strategies to be followed by each node 3 Region 1:Demand > SupplyRegion 3: Demand > SupplyRegion 2: Supply > Demand252729313335376:007:008:009:0010:0011:0012:0013:0014:0015:0016:0017:0018:00MegaWattsTime of the DayExample Demand Supply CurveDemandSupplySmart Grid model Calculate aggregate consumption and prediction for each interval Identify curtailment horizons Identify load curtailment targets and generate curtailment and cost matrices Identify supply curtailment targets and generate curtailment and cost matrices Run Net Load Balancing Algorithm for load curtailment strategy selection Run Net Load Balancing Algorithm for supply curtailment strategy selection Load > Supply For Each Curtailment Horizon Load Curtailment Strategies Supply Curtailment Strategies Table 1: List of Variables in the Models Variable Meaning M N T Number of nodes Number of curtailment strategies Number of time intervals in curtailment horizon Curtailment achieved by node b following curtail- ment strategy j at time t Cost of node b following curtailment strategy j at time t. Essentially, cost associated with γbj(t) 0-1 decision variable which denotes whether node b should follow (1) strategy j at time t or not (0) Curtailment target for interval t Upper bound on the curtailment achieved in the curtailment horizon Lower bound and upper bound on the curtailment budget for node b Dynamic programming recursion function (and ta- ble) used in Algorithm 1 Dynamic programming recursion function (and ta- ble) used in Algorithm 2 Smallest curtailment target among all the intervals Constant used to round curtailment values in the approximation algorithm. De(cid:128)ned as  Γmin M (cid:100) γb j(t) Rounded curtailment values. De(cid:128)ned as(cid:98)γbj(t) = (cid:101) µ γbj(t) cbj(t) xbj(t) Γt Γ αb Bb , Bb Θt Φ Γmin µ (cid:98)γbj(t) in each time interval of each curtailment horizon. (cid:140)e model, objec- tive and the algorithms for each curtailment horizon are formally discussed in Section 5. We realize that the prediction models incur a prediction error which creates uncertainties in net-load balancing solutions. In this work, we do not address these uncertainties. We plan to address these issues in our future work. 5 NET-LOAD BALANCING ALGORITHMS 5.1 SmartGrid Model for Curtailment Selection As per our model, the Smart Grid consists of M nodes. For each node, there are N curtailment strategies available. Let T be the number of time intervals in the curtailment horizon i.e., the inter- vals during which we schedule the curtailment. We are given a time varying curtailment matrix γ(t) ∈ RM×N with element γbj(t) denoting the discrete curtailment obtained by node b following curtailment strategy j at time t ∈ {1, . . . ,T}. For each time t, we are also given a cost matrix C(t) ∈ RM×N where cbj(t) denotes the cost associated with node b following curtailment strategy j. Let X(t) be the decision matrix. An element xbj(t) = 1 if node b follows curtailment strategy j in interval t and 0 otherwise. For each interval t, we are given a curtailment target Γt by the net-load balancing framework calculated by taking the di(cid:130)erence between the aggregate supply and demand. Γt represents the desirable cur- tailment target for each period, however, it might be exceeded. In order to limit wasteful curtailment, we are also given Γ, which 4 denotes the upper bound on the achieved curtailment in the cur- tailment horizon. (cid:140)e notations used in the following sections are summarized in Table 1. 5.2 Minimum Cost Net-Load Balancing Given the Smart Grid Model above, the objective of the Mini- mum Cost Net-Load Balancing Algorithm is to determine node- curtailment strategy pairs for each interval of the curtailment hori- zon such that: (1) (cid:140)e curtailment target Γt for each interval t is achieved, (2) the cost is minimized for the entire curtailment hori- zon, and (3) the aggregate curtailment across the entire curtailment horizon is no more than Γ. (cid:140)is problem, as we show in Section A in the appendix is NP-hard. We (cid:128)rst formulate the problem using an Integer Linear Program (ILP). However, the time complexity for solving ILPs is exponential. Hence, we develop a polynomial time approximation algorithm for the same. More formally, we develop an algorithm with a runtime which is polynomial in the input size M, N and T and 1 , where  is an  approximation guarantee (accuracy) parameter, which ensures that objective of the problem is minimized and in the worst case the constraints are violated by a maximum factor of (1 ± ). To develop the approximation algorithm, we use a dynamic programming al- gorithm (Equation 6) which for each interval t, determines the cost of achieving various curtailment values, each of which is ≥ Γt . We then use another dynamic programming algorithm (Equation 7) to combine the results of each interval to achieve an aggregated curtailment value of ≤ Γ with minimum cost. (cid:140)e sizes of the tables of both the dynamic programming algorithms are proportional to the maximum possible cost. (cid:140)is leads to very large runtime to solve the problem exactly. Hence, we scale and round the costs. (cid:140)e scaling and rounding causes several curtailment values to be indistinguishable, this introduces error into the value of our solu- tion. (cid:140)us the resulting algorithm is an approximation algorithm (as opposed to exact algorithm) which produces an approximate solution in polynomial time which is independent of the maximum cost. We provide the worst case approximation guarantee for the algorithms. 5.2.1 ILP Formulation. (cid:140)e ILP formulation for the Minimum Cost Net-Load Balancing problem is as follows: (1) ∀t (2) (3) ∀b, t (4) ∀b, j, t (5) Minimize : s.t . cbj(t)xbj(t) t =1 γbj(t)xbj(t) ≥ Γt γbj(t)xbj(t) ≤ Γ j=1 N N N j=1 T T b=1 M M M N b=1 t =1 b=1 j=1 xbj(t) == 1 j=1 xbj(t) ∈ {0, 1} Equation 2 ensures that the curtailment target for each time inter- val is achieved. Equation 3 ensures that the aggregate curtailment is less than the maximum limit Γ. Equation 4 ensures that each node in each time interval follows exactly one strategy (possibly the default strategy with 0 curtailment value). µ M : Z+ ∪ {0} × Θt can be de(cid:128)ned recursively as: For each interval t, we de(cid:128)ne a function Θt . For each γbj(t), de(cid:128)ne(cid:98)γbj(t) = (cid:100) γb j(t) 5.2.2 Approximation Algorithm. Let Γmin = mint {Γt } be the smallest curtailment target among all the intervals. De(cid:128)ne µ =  Γmin (cid:101). Similarly, de(cid:128)ne(cid:98)Γ and(cid:98)Γt∀t. We refer to these values as rounded curtailment values. {1, . . . , M}. Θt((cid:98)γ , b) denotes the minimum cost required to achieve a curtailment value of(cid:98)γ using nodes 1, . . . , b where b ∈ {1, . . . , M}. ∃j (cid:98)γ =(cid:98)γbj(t) (cid:98)γ! =(cid:98)γbj(t) ∀j if(cid:98)γ < 0 minj{cbj(t)} ∞ minj{Θt((cid:98)γ −(cid:98)γbj(t), b − 1) +(cid:98)γbj(t)} Θt((cid:98)γ , b) = if b = 1 and if b = 1 and otherwise ∞  (6) Algorithm 1: Determine node strategy pairs given (c,(cid:98)γ) ∈ St Input: (c,(cid:98)γ), t 2 γcur ←(cid:98)γ 1 xbj(t) ∈ X(t) ← 0∀b, j 3 for b = M to 1 do if b (cid:44) 1 then 4 5 j ← argminj{Θ(γcur −(cid:98)γbj(t), b − 1) + cbj(t)} j ← j (cid:98)γbj(t) == γcur γcur ← γcur −(cid:98)γbj(t) else xbj(t) ← 1 Output: Output X(t), the list of curtailment strategies to be 6 7 8 9 followed by each node in interval t. (cid:140)e dynamic program can be solved by creating a table of size we refer to table using the same variable Θt as the recursive func- tion. Once the table is (cid:128)lled, for each interval t, we de(cid:128)ne a set k × M, where k =(cid:98)Γ for each interval. For notational simplicity, St = {(Θt((cid:98)γ , M),(cid:98)γ)(cid:98)γ ≥ (cid:98)Γt }. For any element (Θt((cid:98)γ , M),(cid:98)γ) ∈ St , by each node to achieve(cid:98)γ with cost Θt((cid:98)γ , M) in the interval t. Algorithm 1 can be used to determine the strategies to be followed element et = (ct ,(cid:98)γt) ∈ St∀t such thatT t =1(cid:98)γt ≤(cid:98)Γ andT Now, given St∀t ∈ {1, . . . ,T}, we need to select exactly one minimized. We de(cid:128)ne a function Φ : Z+ ∪ {0} × {1, . . . ,T}. Φ((cid:98)γ , t) t =1 ct is of(cid:98)γ and time intervals 1, . . . , t. Φ can be de(cid:128)ned recursively as: denotes the minimum cost required to achieve the curtailment value 5 7 8 9 for t = T to 1 do if t (cid:44) 1 then 10 11 else j ← argminj (cj,(cid:98)γj)∈St j ← j (cid:98)γ =(cid:98)γj ,(cj ,(cid:98)γj) ∈ St Run Algorithm 1 with (cj ,(cid:98)γj) to get X(t) (cid:98)γcur ←(cid:98)γcur −(cid:98)γj 12 13 14 15 {Φ((cid:98)γcur −(cid:98)γj , t − 1) + cj} Algorithm 2: Minimum Cost Net-Load Balancing Algorithm 1 Compute(cid:98)γbj(t),(cid:98)Γt∀t,(cid:98)Γ Input: C(t), γ(t), Γt ,∀t, Γ 3 Compute St = {(Θt((cid:98)γ , M),(cid:98)γ)(cid:98)γ ≥(cid:98)Γt }∀t 2 Fill the table Θt∀t using equation 6 5 (cid:98)γcur ← argmin(cid:98)γ {Φ((cid:98)γ ,T)(cid:98)γ ≤(cid:98)Γ} 4 Fill the table Φ using equation 7 6 if(cid:98)γcur == ϕ then No curtailment strategies exist Exit Algorithm Output: X(t)∀t, the list of curtailment strategies to be followed by each node in each interval  ∞ ∞ minj{cj} if t = 1 and if t = 1 and Φ((cid:98)γ , t) = ∃j (cid:98)γ =(cid:98)γj ,(cj ,(cid:98)γj) ∈ St (cid:98)γ! =(cid:98)γj ∀j (cj ,(cid:98)γj) ∈ St if(cid:98)γ < 0 k =(cid:98)Γ. Again, for notational simplicity, we refer to table using (7) (cid:140)is dynamic program requires a table of size k × T , where the same variable Φ as the recursive function. Algorithm 2 can be used to determine the curtailment achieved in each interval and the corresponding node strategy pairs. {Φ((cid:98)γ −(cid:98)γj , t − 1) +(cid:98)γj} minj (cj,(cid:98)γj)∈St otherwise Theorem 5.1. Algorithm 2 is a polynomial time algorithm for minimum cost net-load balancing which in the worst case violates the maximum curtailment constraint (Equation 3) by at most (1+) factor and violates the per interval curtailment target constraint (Equation 2) by at most (1 − ) factor. (cid:140)e proof of this theorem is discussed in the appendix in Sec- tion B. 5.3 Minimum Cost Net-Load Balancing with Fairness Curtailment from a node leads to a loss of utility for the node. Hence, it would be unfair to force some nodes to incur losses due to high curtailment while leaving others with minimal curtailment. (cid:140)e Minimum Cost Net Load Balancing Algorithm discussed in the previous section does not take fairness into account and can lead to solutions with uneven curtailment values from the nodes. We address the issue of fairness in this section by assigning a curtail- ment budget range (which can be set by the grid operator) to each node. (cid:140)e algorithm, by ensuring that no node incurs a curtailment more or less than its budgeted range over each curtailment horizon, ensures that net-load balancing is done in a fair manner. Similar to the previous problem, we (cid:128)rst develop an ILP formula- tion for this problem. We then relax the ILP into a Linear Program (which can be solved in polynomial time) and round back the results to integers. (cid:140)is rounding, however, violates certain constraints and increases the objective value. We provide guarantees on the worst case violation of the constraints and the increase in the objective value in the worst case. 5.3.1 ILP Formulation. Let [αb Bb , Bb] be the curtailment budget for node b with αb ∈ [0, 1]. Both Bb and αb are determined by the grid operator. (cid:140)e problem of minimum cost net-load balancing with fairness can be formulated using the following ILP: Minimize : s.t . cbj(t)xbj(t) t =1 γbj(t)xbj(t) ≥ Γt j=1 j=1 b=1 b=1 T M N M N M N T αb Bb ≤ N N b=1 j=1 t =1 ∀t (8) (9) (10) ∀b (11) γbj(t)xbj(t) ≤ Γ T γbj(t)xbj(t) ≤ Bb j=1 t =1 xbj(t) == 1 j=1 xbj(t) ∈ {0, 1} ∀b, t (12) ∀b, j, t (13) Equation 11 is the additional constraint added that ensures that each node curtails an amount within its budgeted range. Theorem 5.2. For a linear cost function f , Algorithm 3 is a (2,2)- factor Minimum Cost Net Load Balancing with Fairness Algorithm. (cid:138)e cost of the solution achieved by Algorithm 3 is at most twice the optimal while the budget and targeted curtailment constraints (Eqs 10 and 11) are violated by at most a factor of two. Theorem 5.3. For a quadratic cost function f , Algorithm 3 is (4,2)-factor algorithm. Note that the above guarantees are worst case guarantees. We discuss in the appendix the conditions under which these worst case guarantees occur. Knowing the worst case conditions and performance leaves the grid operator prepared for such scenarios. In practice, the performance is signi(cid:128)cantly be(cid:138)er as shown using the experimental results. Algorithm 3: Minimum Cost Net-Load Balancing with Fair- ness Input: C(t), γ(t), Γt ,∀t, Γ, Bb , αb∀b 1 xbj(t) ∈ X(t) ← 0∀b, j, t 2 Relax the ILP to an LP by replacing Equation 13 with 0 ≤ xbj(t) ≤ 1 ∀b, j, t 3 Solve LP to obtain solution x∗ 4 foreach b, t do 5 γ (cid:48) ←N bj(t)∀b, j, t j=1 γbj(t)x∗ bj(t) Let γbi(t) ≤ γ (cid:48) ≤ γbi +1(t) if (γ (cid:48) − γbi(t)) ≥ (γbi +1(t) − γ (cid:48)) then else xbi +1(t) ← 1 xbi(t) ← 1 6 7 8 9 10 Output: X(t)∀t, the list of curtailment strategies to be followed by each node in each interval 5.3.2 Approximation Algorithm. (cid:140)e ILP formulated in Section 5.3.1, when relaxed to a Linear Program will lead to unbounded errors. Hence, to develop an approximation algorithm with theoretical worst case bounds, we (cid:128)rst make the following assumption: (cid:140)e costs cbj(t) are a function of γbj(t) i.e., cbj(t) = f (γbj(t)). We will derive approximation guarantees when the function f is linear and when it is quadratic. In order to develop a bounded approximation algorithm, we (cid:128)rst relax the ILP to a linear program i.e., we replace Equation 13 with 0 ≤ xbj(t) ≤ 1 ∀b, j, t and solve the Linear Program. Solving a linear program takes polynomial amount of time using methods such as inter-point or ellipsoid [12]. However, the solution will contain fractional values for the decision variables xbj(t), ∀b, j, t which need to be rounded to 0 or 1 for a valid solution. Now, naively rounding the decision variables leads to errors which are unbounded. Hence, we develop Algorithm 3 which is a novel round- ing algorithm which guarantees that the constraints are violated by at most a factor of 2 in the worst case. For each b, t, the algorithm j =1 γbj(t)xbj(t) and rounding it to the curtailment value γbj(t) nearest to it. We have the following two results for this algorithm. (cid:140)e proofs are discussed in the appendix. works by computing expected curtailment γ (cid:48) =N 6 5.4 Online Algorithm for Fair Net-Load Balancing (cid:140)e algorithms discussed in the previous two sections require the availability of the curtailment prediction data for the entire horizon. However, certain scenarios require net-load balancing in an online manner. At the beginning of each interval, the data is made available and net-load balancing needs to be performed in a myopic way. BbT We develop a greedy online heuristic algorithm (Algorithm 4) for this problem. (cid:140)e algorithm (cid:128)nds a minimum cost way to achieve the curtailment target Γo = Γt for the current interval l while ensuring that no node curtails more than the budget for the current interval. (cid:140)e upper limit of the budget for the current for each node b is determined by multiplying the ratio of interval Bo b . (cid:140)e lower bound is simply αb Bb. (cid:140)e upper bound ΓT u is determined by multiplying the ratio of t =1 Γt on curtailment Γo t =1 Γt . Let γ o denote the curtailment matrix and Co denote the with Γo l being the curtailment for node b following cost matrix with γ o bj which strategy j and co being its cost. We remove any values γ o bj bj are outside the curtailment budget range from the curtailment matrix γ o. Note that the values Γ, Γt , Bb∀b are unknown for the with Γo l current net-load balancing horizon. (cid:140)ey can be obtained from some past horizon. u ← ΓT b ← BbT 1 Γo 2 Bo t =1 Γt 3 Compute Co t =1 Γt Γo l Γo l l , γ o, Co, Γ, Γt∀t, Bb , αb∀b bj ,(cid:98)Co max ,(cid:98)co l ≤ Θ((cid:98)c, M) ≤ Γo Algorithm 4: Online Algorithm for Fair Net-Load Balancing Input: Γo ∀b max similar to Algorithm 2 using min, Co γ o in which curtailment values outside curtailment budget range are removed. 5 c∗ ← min(cid:98)c{(cid:98)cΓo 4 Fill table Θ using equation 6 6 Run Algorithm 1 with (c∗, Θ(c∗, M)) to get X o Output: X o, the list of curtailment strategies u } 6 RESULTS AND ANALYSIS In addition to providing theoretical guarantees, we perform prac- tical evaluations of the algorithms developed in Section 5. We implemented the algorithms using MATLAB [5]. (cid:140)e LP and ILP algorithms were implemented using IBM ILOG Cplex Optimization Studio [4]. (cid:140)e experiments were performed on Dell optiplex with 4-cores and 4 GB RAM. A net-load balancing horizon of 32 15-min intervals was considered with 16 intervals of load curtailment and 16 intervals of solar curtailment. We evaluated the algorithms by varying the (L,U) pair where, for t =1 Γt and U=Γ (Section 5.3.1). Note that L and U are the lower and upper bound on the curtailment to be achieved in the curtailment horizon and hence represents the feasi- ble curtailment range. (cid:140)e costs of the strategies were evaluated using the function f (γ) = 2γ 2, where γ is the curtailment value of the strategy. Section 6.1 describes the input dataset generation. As the dataset was generated from historical data, perfect knowledge of the future was assumed with no prediction errors. notational simplicity, L=T 6.1 Dataset We obtained the load curtailment data from the demand response implementation on our University Campus. Our campus consists of 150 DR enabled nodes (buildings) each of which can follow 6 load curtailment strategies. (cid:140)e load curtailment values for each node- strategy pair was generated using algorithms mentioned in [8]. We varied the load curtailment target from 500 to 1500 kWh. Unlike load curtailment data for which we had a real world dataset, we had to simulate solar curtailment data. (cid:140)e output of a solar PV is determined mainly by the solar radiance at the PV installation, the PV area and the PV yield [3]. We used the hourly solar radiance data available at [1] for the Los Angeles County. We then used the PV-output calculator available at [3] to calculate the solar generation data by varying the PV area from 2. We also varied the solar panel yield from 5% to 10m 15%. Hence, a (cid:128)xed PV area and yield represents a node in our dataset. To obtain solar curtailment values, if the PV output for a given hour for a node was O, we generated 6 curtailment values: 0, 0.125∗O, 0.25∗O, 0.5∗O, 0.75∗O, O. Hence, each curtailment value 2 to 20m represents a PV connection/disconnection se(cid:138)ing. All the 4 15-min intervals for a given hour were assigned the same curtailment values. For clarity, given an (L, U) pair, we report the error of either solar or load curtailment, whichever one performs worse. 6.2 Minimum Cost Net-Load Balancing We evaluate our Minimum Cost Net Load Balancing Algorithm (Algorithm 2) by varying the (L,U) pairs as discussed above. We perform experiments to compare the cost of the solution obtained by our algorithm against the optimal solution obtained by the ILP. We also perform a scalability analysis of our algorithm. (a)  = 0.5-0.1 (50-10% Error Guarantee) (b)  = 0.05-0.02 (5-2% Error Guarantee) Figure 3: Percentage Error of the curtailment target con- straints for various values of approximation factor  6.2.1 Accuracy Analysis. Figures 3a and 3b show the percentage error of the curtailment target constraint (Equation 2) violation for various values of the theoretical guarantee . For example, if  = 0.05, the algorithm will incur an error of 5% in the worst case. 7 0.0%5.0%10.0%15.0%20.0%25.0%30.0%35.0%Percentage Error Curtailment Range (kWh) e=0.5e=0.2e=0.10.0%1.0%2.0%3.0%4.0%5.0%6.0%Percentage Error Curtailment Range (kWh) e=0.05e=0.02e=0.01 Figure 4: Ratio of the cost of solution obtained by Algorithm 2 and the optimal solution versus the approximation guar- antee () As we can note from the (cid:128)gures, the errors incurred by our solution are within the theoretical guarantees provided by the number . In practice, the errors are much lower. For  = 0.5 (50%), the highest error incurred is 40%. Similarly, for  = 0.2 (20%), barring a few cases, the errors are less than 15%. As evident from (cid:140)eorem 1, the cost of the solutions obtained from Algorithm 2 are less than or equal to the optimal solution. (cid:140)is is possible because instead of tightly satisfying the constraint, as the optimal solution does, Algorithm 2 tries to (cid:128)nd a solution with a lower cost which possibly violates the constraints by a maximum of . Figure 4 shows the ratio of the cost of solution obtained by Algorithm 2 and the optimal solution versus the approximation guarantee (). As we can notice from the (cid:128)gure, for each curtail- ment range, the ratio increases as the approximation guarantee is tightened i.e. reduced. For lower values of  such as 0.02 (2%), the ratio is close to 1. (cid:140)e ratio is never greater than 1 implying that the cost of the solution obtained by Algorithm 2 is always less than the optimal cost. We can also note that for a (cid:128)xed approximation guarantee (), the ratio typically decreases with an increase in the upper bound U of the curtailment range. (cid:140)is trend is more pronounced in higher values of  such as 0.5 (50%) and 0.2 (20%). (cid:140)is is because a higher value of U provides a larger error range in which to search for minimum cost solutions. For example, for 50% error guarantee, the error range which is 750 kWh for U = 1500, is three times larger than the error range of 250 kWh for U = 500. 6.2.2 Scalability Analysis. In order to perform scalability analy- sis, we (cid:128)x the values of T : the number of time intervals and N : the number of curtailment strategies per node. We vary M: the number of nodes for various values of . As one can see from Figure 5a, the algorithm exhibits a near quadratic increase in the runtime with respect to the number of nodes. (cid:140)is is consistent with the runtime complexity analysis in Section B in the Appendix. We also analyze the scalability with respect to  by varying the value of M while keeping T and N (cid:128)xed. As shown in Figure 5b, decreasing  (increasing accuracy) has a signi(cid:128)cant impact on run- time. Hence,  is a parameter that can be used to trade-o(cid:130) accuracy versus computational complexity. A reader might comment that the runtimes observed, especially for smaller values of  are very high. (cid:140)is can be justi(cid:128)ed as the (a) (b) Figure 5: Runtime of Algorithm 2 versus: (a) Number of nodes for various values of epsilon, (b)  (denoted as percent- age error) for various values of the number of nodes problem of net-load balancing is NP-hard and hence, high compu- tation capacity is required to increase the accuracy. Our objective in this work is to show that a polynomial time approximation algo- rithm exists for this NP-hard problem. We did not focus on (cid:128)nding the best optimal solution for the same. Moreover, our experiments are performed on MATLAB. For a real world deployment of this so(cid:137)ware, using faster programming languages such as C++ will sig- ni(cid:128)cantly improve the run times (as high as 10-20 times as per the experience of the authors). In the context of real world scenarios, the California ISO's MRTU applications determine the desired gen- eration changes 5-min ahead of the beginning of the interval and the system needs to start moving towards the set point 2.5 minutes ahead of the interval [24]. Given the typical inverter control delays of the order of milliseconds [16], even our naive MATLAB imple- mentation meets the California ISO constraints for 40 nodes with 8 50%20%10%5%2%250-5000.710.880.940.970.99375-7500.670.850.930.960.99500-10000.620.840.920.950.98600-12000.590.840.930.970.99750-15000.600.830.910.960.990.000.200.400.600.801.001.20Cost Ratio Approximation Guarantee Parameter 250-500375-750500-1000600-1200750-150001002003004005006007008001020304050Runtime (seconds) Number of Nodes 50%20%10%050010001500200025003000350040004500500050%20%10%5%2%Runtime (seconds) Approximation Guarantee (Percentage Error) M = 10M = 20M = 30  = 0.2 (20% error) and 25 nodes for  = 0.1 (10% error). Similar implementation in C++, assuming a conservative estimate of 10x improvement will meet the constraints for 70 nodes with  = 0.1 (10% error) and 40 nodes with  = 0.05 (5% error). We also compare our algorithm against demand curtailment selection techniques such as those developed in [37] and [17]. We observed that these techniques typically incur errors of around 5-10% and in the worst case can go as high as 95%. We excluded the details of this analysis as comparison against the optimal solutions already provides us with an idea of the near optimality of our algorithm. 6.3 Minimum Cost Net-Load Balancing with Fairness In Algorithm 3, we introduced the notion of fairness by de(cid:128)ning cur- tailment budget ranges for nodes. Here we evaluate the empirical performance of Algorithm 3. Note that the budget ranges for each node can be set appropriately by user/grid operator. In our experi- ments, we set the budget Bb for each node b to γ b max Γ where γ b max denotes the sum of the maximum curtailment values across all the intervals. We also set αb = α and vary the value α. max/B b=1 γ b Figure 6: Percentage Error of the Cost of Algorithm 3 w.r.t. the Optimal Cost In order to evaluate the accuracy of our algorithm, we compare against the optimal solution obtained from solving the ILP de(cid:128)ned in Section 5.3.1. Figure 6 shows the percentage error of the cost of the solution produced by algorithm 3 as compared against the optimal cost. Although, the worst case theoretical guarantee is a factor of 4 for quadratic cost function as provided by (cid:140)eorem 5.3, in practice the algorithm performs much be(cid:138)er with errors varying from -0.79% to 1.88%. (cid:140)e negative percentage error implies that the cost of the solution from our algorithm was less than the cost of the optimal solution. Note that this is possible because our solution violates certain constraints which the optimal solution does not. We also studied the percentage of the budget overshot for the nodes across all the values of L and U. (cid:140)e theoretical guarantee of factor 2 (100%) provided by (cid:140)eorem 5.3 is honored in all the cases. We observed that the error is less than 13% (1.13 factor) for the worst performing node. A similar study for the percentage of Figure 7: Gini Coe(cid:129)cient for various values of Alpha (α) the interval curtailment target Γt undershot for all the intervals reveals that the theoretical guarantee of factor 2 (100%) provided by (cid:140)eorem 5.3 is honored in all the cases. In practice the error is less than 7% (1.07 factor) for the worst performing interval. (cid:140)is implies that the curtailment target for the worst performing interval could not be met and was de(cid:128)cit by 7%. We also calculated the gini coe(cid:129)cient – which is the most com- monly used measure of inequality in economics – of the curtailment achieved by each node as a proportion of its budget to measure the fairness of curtailment. Figure 7 shows the results for various values of α for a curtailment range of 500-1000 with 20 nodes. (cid:140)e value of gini decreases with increasing α as the dispersion of the curtailment decreases. Above α = 0.2, no feasible solution could be found. 6.4 Online Algorithm for Minimum Cost Net-Load Balancing with Fairness In order to evaluate Algorithm 4, we compare the cost of the solu- tions obtained against the optimal solutions of the ILP de(cid:128)ned in Section 5.3.1 as generated in Section 6.3. For various values of L and U pairs, we calculate the percentage error in the cost obtained by the online algorithm (Algorithm 4) with respect to the optimal solutions. (cid:140)e budget values Bb input to Algorithm 4 are same as the ones used in Section 6.3. Figure 8: Percentage Error of the Cost of Online Algorithm w.r.t the Optimal Cost 9 250-500375-750500-1000600-1200750-1500666.67-1000833.33-1000800-12001000-1200-1.00%-0.50%0.00%0.50%1.00%1.50%2.00%2.50%Percentage Error of the Cost of Algorithm 3 w.r.t. the Optimal CostCurtailment Range (kWh)Percentage Error α = 00.160.170.180.190.20.210.220.050.10.150.2Gini Alpha Gini 166.67-250208.33-250333.33-500416.66-500500-750625-750666.66-1000833.33-1000800-12001000-12000%5%10%15%20%25%Percentage Error of online algorithm w.r.t. off-line algorithmCurtailment Range (kWh)Percentage Error in Cost Figure 8 shows the results obtained. Even though we do not provide any guarantee on the worst case bounds for the online algorithm, in practice the error incurred is low. (cid:140)e highest error incurred is around 23% (factor 1.23). (cid:140)is makes the online algo- rithm a good candidate for net-load balancing when the predictions for the entire horizon are not known in advance. 7 CONCLUSIONS One of the most signi(cid:128)cant change to the smart grids of future will be the proliferation of PV systems. (cid:140)e current distribution grid is characterized by a few active suppliers such as the utility and a large number of passive consumers with the power (cid:131)owing unidirectionally from the suppliers to the consumers. However, in future the consumers will become an active participant of the grid with the capability of injecting power into the grid. Net-load balancing under this scenario will be a daunting task. In this work, we addressed the problem of performing net-load balancing under the assumption that the nodes can be directly (and remotely) controlled by the grid operator. Due to the hardness of this problem, previous works in the literature had to compromise on either computational tractability or accuracy. We showed that it is possible to achieve both the con(cid:131)icting goals simultaneously. However, there are several challenges which still need to be addressed for seamless PV integration. (cid:140)e uncertainty due to the errors in the forecasting algorithms is not considered in this work. Similarly, this work assumes complete observability and direct control of the grid which is true for micro-grids such as industry/university campus but might not be true for a city wide distribution grid. We will focus on addressing the above mentioned challenges in our future works. REFERENCES [1] 2010. National Solar Radiation Data Base. (2010). h(cid:138)p://rredc.nrel.gov/solar/ old data/nsrdb/1991-2010/hourly/list by state.html [2] 2013. Photovoltaic (PV) Pricing Trends: Historical, Recent, and Near-Term Projections. (2013). h(cid:138)p://www.nrel.gov/docs/fy13osti/56776.pdf [3] 2013-2016. How to calculate the annual solar energy output of a h(cid:138)p://photovoltaic-so(cid:137)ware.com/ (2013-2016). photovoltaic system? PV-solar-energy-calculation.php [4] 2017. ILOG CPLEX Optimization Studio. support/knowledgecenter/SSSA5P/welcome (2017). h(cid:138)p://www-01.ibm.com/ [5] 2017. MATLAB-MathWorks. h(cid:138)ps://www.mathworks.com/products/matlab.html. (2017). h(cid:138)ps://www.mathworks.com/products/matlab.html [6] Mohamed H Albadi and EF El-Saadany. 2007. Demand response in electric- ity markets: An overview. In IEEE power engineering society general meeting, Vol. 2007. 1–5. [7] Mohamed H Albadi and EF El-Saadany. 2008. A summary of demand response in electricity markets. Electric power systems research 78, 11 (2008), 1989–1996. [8] Saima Aman, Charalampos Chelmis, and Viktor Prasanna. 2016. Learning to REDUCE: A Reduced Electricity Consumption Prediction Ensemble. In Workshops at the (cid:138)irtieth AAAI Conference on Arti(cid:128)cial Intelligence. [9] Saima Aman, Marc Frincu, Charalampos Chelmis, Muhammad Noor, Yogesh Simmhan, and Viktor K Prasanna. 2015. Prediction Models for Dynamic De- mand Response. In IEEE International Conference on Smart Grid Communications (SmartGridComm): Data Management, Grid Analytics, and Dynamic Pricing. [10] Antimo Barbato, Cristiana Bolchini, Maurizio Delfanti, Angela Geronazzo, Gio- vanni Acce(cid:138)a, Alessio Dede, Giovanni Massa, and Massimo Trioni. 2015. An energy management framework for optimal demand response in a smart campus. ICGREEN (2015), 11. [11] Prasenjit Basak, S Chowdhury, S Halder nee Dey, and SP Chowdhury. 2012. A literature review on integration of distributed energy resources in the perspective of control, protection and stability of microgrid. Renewable and Sustainable Energy Reviews 16, 8 (2012), 5545–5556. [12] Stephen Boyd and Lieven Vandenberghe. 2004. Convex optimization. Cambridge university press. [21] [13] Jiang Chen, Bo Yang, and Xinping Guan. 2012. Optimal demand response scheduling with stackelberg game approach under load uncertainty for smart grid. In Smart Grid Communications (SmartGridComm), 2012 IEEE (cid:138)ird International Conference on. IEEE, 546–551. [14] Zhi Chen, Lei Wu, and Yong Fu. 2012. Real-time price-based demand response management for residential appliances via stochastic optimization and robust optimization. IEEE Transactions on Smart Grid 3, 4 (2012), 1822–1831. [15] Chris Deline. 2010. Partially shaded operation of multi-string photovoltaic systems. In Photovoltaic Specialists Conference (PVSC), 2010 35th IEEE. IEEE, 000394–000399. [16] Ognjen Gagrica, Phuong H Nguyen, Wil L Kling, and Tadeusz Uhl. 2015. Microin- verter curtailment strategy for increasing photovoltaic penetration in low-voltage networks. IEEE Transactions on Sustainable Energy 6, 2 (2015), 369–379. [17] Nikolaos Gatsis and Georgios B Giannakis. 2011. Cooperative multi-residence demand response scheduling. In Information Sciences and Systems (CISS), 2011 45th Annual Conference on. IEEE, 1–6. [18] Sanmukh R Kuppannagari, Rajgopal Kannan, Charalampos Chelmis, and Viktor K Prasanna. 2016. Implementation of Learning-Based Dynamic Demand Response on a Campus Micro-Grid(cid:135). In (cid:138)e 25th International Joint Conference on Arti(cid:128)cial Intelligence. [19] Sanmukh R Kuppannagari, Rajgopal Kannan, Charalampos Chelmis, Arash S Tehrani, and Viktor K Prasanna. 2016. Optimal customer targeting for sustainable demand response in smart grids. Procedia Computer Science 80 (2016), 324–334. [20] Sanmukh R Kuppannagari, Rajgopal Kannan, and Viktor K Prasanna. 2015. An ILP based Algorithm for Optimal Customer Selection for Demand Response in SmartGrids. In (cid:138)e 2015 International Conference on Computational Science and Computational Intelligence (CSCI). Jungsuk Kwac and Ram Rajagopal. 2013. Demand response targeting using big data analytics. In Big Data, 2013 IEEE International Conference on. IEEE, 683–690. [22] Stephen Lee, Srinivasan Iyengar, David Irwin, and Prashant Shenoy. 2017. Dis- tributed Rate Control for Smart Solar Arrays. In Proceedings of the Eighth Inter- national Conference on Future Energy Systems. ACM, 34–44. [23] Zhonghui Luo, Ratnesh Kumar, Joseph So(cid:138)ile, and Jon C Yingling. 1998. An MILP formulation for load-side demand control. Electric machines and power systems 26, 9 (1998), 935–949. [24] Yuri V Makarov, Clyde Loutan, Jian Ma, and Phillip De Mello. 2009. Operational impacts of wind generation on California power systems. IEEE Transactions on Power Systems 24, 2 (2009), 1039–1050. [25] Khosrow Moslehi and Ranjit Kumar. 2010. A reliability perspective of the smart grid. Smart Grid, IEEE Transactions on 1, 1 (2010), 57–64. [26] Saaed Rahimi, Ma(cid:138)ia Marinelli, and Federico Silvestro. 2012. Evaluation of requirements for Volt/Var control and optimization function in distribution management systems. In Energy Conference and Exhibition (ENERGYCON), 2012 IEEE International. IEEE, 331–336. [27] Pamela Ramsami and Vishwamitra Oree. 2015. A hybrid method for forecasting the energy output of photovoltaic systems. Energy Conversion and Management 95 (2015), 406–413. [28] Subendhu Rongali, Tanuja Ganuy, Manikandan Padmanabhan, Vijay Arya, Shiv- kumar Kalyanaraman, and Mohamad Iskandar Petra. 2016. iPlug: Decentralised dispatch of distributed generation. In Communication Systems and Networks (COMSNETS), 2016 8th International Conference on. IEEE, 1–8. JG Roos and CF Kern. 1996. Modelling customer demand response to dynamic price signals using arti(cid:128)cial intelligence. In Metering and Tari(cid:130)s for Energy Supply, Eighth International Conference on (Conf. Publ. No. 426). IET, 213–217. [30] Tamal Roy, Avijit Das, and Zhen Ni. 2017. Optimization in Load Scheduling of a Residential Community Using Dynamic Pricing. In 2017 IEEE Innovative Smart Grid Technologies Conference (ISGT). [31] Nerea Ruiz, Inigo Cobelo, and Jos´e Oyarzabal. 2009. A direct load control model for virtual power plant management. IEEE Transactions on Power Systems 24, 2 (2009), 959–966. [32] Sartaj Sahni. 1975. Approximate algorithms for the 0/1 knapsack problem. Journal of the ACM (JACM) 22, 1 (1975), 115–124. [33] Akansha Singh, Stephen Lee, David Irwin, and Prashant Shenoy. 2017. Sun- Shade: enabling so(cid:137)ware-de(cid:128)ned solar-powered systems. In Proceedings of the 8th International Conference on Cyber-Physical Systems. ACM, 61–70. [34] SunShot. 2012. SunShot Vision Study A Comprehensive Analysis of the Potential for U.S. Solar Electricity Generation. (2012). h(cid:138)p://www.nrel.gov/docs/fy12osti/ 54294.pdf [35] Chee-Wooi Ten, Chen-Ching Liu, and Govindarasu Manimaran. 2008. Vulner- ability assessment of cybersecurity for SCADA systems. IEEE Transactions on Power Systems 23, 4 (2008), 1836–1846. [36] Reinaldo Tonkoski, Luiz AC Lopes, and Tarek HM El-Fouly. 2011. Coordinated ac- tive power curtailment of grid connected PV inverters for overvoltage prevention. IEEE Transactions on Sustainable Energy 2, 2 (2011), 139–147. [37] Vasileios Zois, Marc Frincu, Charalampos Chelmis, Muhammad Rizwan Saeed, and Viktor Prasanna. 2014. E(cid:129)cient customer selection for sustainable demand response in smart grids. In IGCC. IEEE, 1–6. [29] 10 8 APPENDIX A NP-HARDNESS OF MINIMUM COST NET-LOAD BALANCING PROBLEM In order to prove that the problem of minimum cost net-load bal- ancing is NP-hard, we will de(cid:128)ne a simpler version of the problem and reduce the well known knapsack problem, which is an NP-hard problem to it. Adding any additional constraints to this simpler version will only increase the complexity of the problem. (cid:140)e simpler version of the problem Π is formulated as follows: We are given a set S of node-strategy pairs, where sij ∈ S : i ∈ {1, . . . , M}, j ∈ {1, . . . , N} denotes the node-i-strategy-j pair, where M is the number of node and N is the number of strategies. Given a curtailment value Γ, we need to output a S∗ ⊆ S such that i, j:si j ∈S∗ γ(sij), where γ(sij) denotes the curtailment ob- j=1 I(sij) ≤ 1∀i ∈ {1, . . . , M}, where I(sij) = 1 i, j:si j ∈S∗ C(sij) is minimized, Γ ≤  tained by sij andN if sij ∈ S∗ and 0 otherwise and where C(sij) denotes the cost of curtailment by sij. Theorem A.1. Π is NP-hard. Proof. A 0-1 Knapsack problem [32] is de(cid:128)ned as follows: Given M elements, with element i having value vi and size di, (cid:128)nd a sub- set of elements the sum of whose sizes is ≤ D and the value is maximized. To reduce this problem into Π, for each element i, we add si1 with γ(si1) = −di and C(si1) = −vi. We set Γ = −D. Note that j ∈ {1}. One can easily observe that 0-1 knapsack problem has a solution if and only if Π has a solution. (cid:3) B PROOF OF THEOREM 5.1 the minimum cost required to achieve any curtailment value in the value. Also, we call γ as the unrounded curtailment value. Correct- denotes the cost as- signed to the bucket in table Θ. For each interval t, using induction For a curtailment value γ, we say that(cid:98)γ is the rounded curtailment ness: We de(cid:128)ne Bucket of(cid:98)γ as the range µ(cid:98)γ − µ < γ ≤ µ(cid:98)γ i.e. all the curtailment values which get rounded to(cid:98)γ. CΘ(cid:98)γ ∀t, 0 ≤(cid:98)γ ≤(cid:98)Γ will be on Equation 6, it is easy to show that CΘt(cid:98)γ Bucket of(cid:98)γ for table Θt . Hence, for each element et = (ct ,(cid:98)γt), ct is Bucket of(cid:98)γt corresponding to the table Θt . Now, if we can show the minimum possible cost to achieve any curtailment value in the that the range of curtailment values covered by the elements in St∀t contains the curtailment value chosen by any optimal solution, and that the cumulative curtailment value of any optimal solution at any time t is contained in the entries Φ(:, t) (i.e. entries corresponding to time interval t), then using induction on Φ table, we can show the aggregate cost of the solutions obtained by Algorithm 2 will be less than or equal to the optimal solution. Now, in each interval, the lowest rounded curtailment value(cid:98)γ considered to create the set St is(cid:98)γt . Hence, the lowest unrounded curtailment γ satis(cid:128)es: ment value(cid:98)γ considered by Algorithm 2 in the Φ table is(cid:98)Γ. So, bucket is µ(cid:98)Γ ≥ Γ. Hence, the range of curtailment values consid- γt − µ < γ ≤ γt i.e. γ ≤ γt . Now, the maximum rounded curtail- the maximum curtailment value γ considered in the corresponding ered by Algorithm 2 covers the range in which optimal solution can reside and so Algorithm 2 does not miss any possible solution of a lower cost. 11 2 = . µ µ ).  γit µ i =1 i =1( γit Runtime: (cid:140)e Algorithm (cid:128)lls T Θ tables each of which is of size time. Hence, the total runtime for line 2 and 3 of Algorithm 2 is O( M 2NT 2 O(T 3M 2  2 to output the strategies. Hence, the algorithm is polynomial in the input size M, N ,T and 1  M(cid:98)Γ. We assume that Γ = O(T Γmin). Each entry of Θ requires O(N) (cid:140)e number of entries in table Φ is O(T(cid:98)Γ). Each entry requires O((cid:98)Γ) time. Hence, the total required time to (cid:128)ll Φ is O(T(cid:98)Γ )). Once the tables are (cid:128)lled, the for loop requires O(T MN(cid:98)Γ) Approximation Guarantee: Let(cid:98)Γx =M i =1T t =1(cid:98)γit be the solu- tion from our algorithm, where(cid:98)γit denotes the rounded curtailment thatM i =1(cid:98)γit ≥(cid:98)Γt . Also, γit µ ≤(cid:98)γit ≤ γit + 1) ≤M µ ≤M of(cid:98)γit . (cid:140)is implies that Γt Γt − µM ≤M i =1 γit =⇒ M Now, from line 5 of the algorithm,(cid:98)Γx ≤(cid:98)Γ. So, Γx by node i in time t. From line 3 of the algorithm, for all t, we know + 1 by the de(cid:128)nition + M. So, i =1 γit ≥ Γt −  Γmin ≥ (1 − )Γt as Γt ≥ Γmin. Hence, in each interval, the curtailment target con- straint (Equation 2) is violated by a maximum factor of (1 − ). + 1. (cid:140)is means that Γx ≤ Γ +  Γmin M ) ≤ Γ(1 + ) as Γmin ≤ Γ and M ≥ 1. Hence, the aggregate curtailment target constraint (Equation 3) is violated by a maximum factor of (1 + ). C PROOFS FOR THEOREMS 5.2-5.3 Let γ (cid:48) j=1 γbj(t)xbj(t) be the curtailment value obtained for bt and γ i +1 be the curtailment values node b in time interval t. Let γ i bt bt of strategies between which γ (cid:48) bt ≤ γ (cid:48) . Now, falls i.e. γ i bt if γ (cid:48) , this implies γ (cid:48) bt ≥ (γ i bt )/2 ≥ bt bt /2. Summing over all values of b, t ensures that Equation 10 γ i +1 and the upper bound of Equation 11 are violated by at most a factor of 2. Similarly it can be shown that if the objective function is linear, it will be bounded by a factor of 2 and if it is quadratic, it will be bounded by a factor of 4. is rounded up to γ i +1 bt bt ≤ γ i +1 bt + γ i +1 M ≤ Γ(1 +  =N µ ≤ Γ Now, in order to provide a bound on the constraint violation of Equation 9 and the lower bound of Equation 11, we make an bt ≤ (2k − 1)γ i assumption that γ i +1 . Using this assumption, we bt bt ≥ γ (cid:48) bt/k i.e. the constraint is can ensure that in the worst case γ i violated at most by a factor of k. Note that if γ i = 0, we cannot bj provide any guarantee. (cid:140)e analysis above can be used by the grid operator to improve the e(cid:129)ciency of net-load balancing. (cid:140)e grid operator can setup curtailment con(cid:128)gurations (e.g. load curtailment strategies such as GTR, etc.) such that the di(cid:130)erence between two consecutive cur- tailment values is not vary large. However, it is not always possible to control the curtailment con(cid:128)gurations. Hence, the grid operator can develop techniques by noticing that a higher curtailment value can be expected to have less violations for two reasons: (1) very few values of γ (cid:48) = 0 and (2) since a large number bt of non-zero curtailment strategies will be selected, several of them will be rounded up thus reducing the possibility that Equation 10 is violated by a large factor. Hence, if the required curtailment value is small for a curtailment horizon, the grid operator can reduce the number of nodes which participate in the curtailment horizon. will have γ i bj µ bt
1403.0751
5
1403
2015-07-03T15:22:29
Profile-based optimal matchings in the Student/Project Allocation problem
[ "cs.DS" ]
In the Student / Project Allocation problem (SPA) we seek to assign students to individual or group projects offered by lecturers. Students provide a list of projects they find acceptable in order of preference. Each student can be assigned to at most one project and there are constraints on the maximum number of students that can be assigned to each project and lecturer. We seek matchings of students to projects that are optimal with respect to profile, which is a vector whose rth component indicates how many students have their rth-choice project. We present an efficient algorithm for finding a greedy maximum matching in the SPA context - this is a maximum matching whose profile is lexicographically maximum. We then show how to adapt this algorithm to find a generous maximum matching - this is a matching whose reverse profile is lexicographically minimum. Our algorithms involve finding optimal flows in networks. We demonstrate how this approach can allow for additional constraints, such as lecturer lower quotas, to be handled flexibly. Finally we present results obtained from an empirical evaluation of the algorithms.
cs.DS
cs
Profile-based optimal matchings in the Student/Project Allocation problem∗ Augustine Kwanashie1, Robert W. Irving1, David F. Manlove1,† and Colin T.S. Sng2,‡ 1 School of Computing Science, University of Glasgow, UK 2 Amazon.com, Inc., Texas, USA Abstract In the Student / Project Allocation problem (spa) we seek to assign students to individual or group projects offered by lecturers. Students provide a list of projects they find acceptable in order of preference. Each student can be assigned to at most one project and there are constraints on the maximum number of students that can be assigned to each project and lecturer. We seek matchings of students to projects that are optimal with respect to profile, which is a vector whose rth component indicates how many students have their rth-choice project. We present an efficient algorithm for finding a greedy maximum matching in the spa context – this is a maximum matching whose profile is lexicographically maximum. We then show how to adapt this algo- rithm to find a generous maximum matching – this is a matching whose reverse profile is lexicographically minimum. Our algorithms involve finding optimal flows in net- works. We demonstrate how this approach can allow for additional constraints, such as lecturer lower quotas, to be handled flexibly. Finally we present results obtained from an empirical evaluation of the algorithms. Keywords: Greedy maximum matching; Generous maximum matching; Matching profile; Augmenting path 1 Introduction In most academic programmes students are usually required to take up individual or group projects offered by lecturers. Students may be required to rank a subset of the projects they find acceptable in order of preference. Each project is offered by a unique lecturer who may also be allowed to rank the projects she offers or the students who are interested in taking her projects in order of preference. Each student can be assigned to at most one project and there are usually constraints on the maximum number of students that can be assigned to each project and lecturer. The problem then is to assign students to projects in a manner that satisfies these capacity constraints while taking into account the preferences of the students and lecturers involved. This problem has been described in the literature as the Student-Project Allocation problem (spa) [4, 21, 5, 16]. Variants of spa also exist in which lower quotas are assigned to projects and/or lecturers. These ∗A preliminary version of this paper appeared in the proceedings of IWOCA 2014: the 25th International Workshop on Combinatorial Algorithms. †Supported by Engineering and Physical Sciences Research Council grant EP/K010042/1. Correspond- ing author. Email [email protected]. ‡Work done while at the School of Computing Science, University of Glasgow. 1 lower quotas indicate the minimum number of students to be assigned to each project and lecturer. Although described in an academic context, applications of spa need not be limited to assigning students to projects but may extend to other scenarios, such as the assignment of employees to posts in a company where available posts are offered by various departments. Applications of spa in an academic context can be found at the University of Glasgow [29], the University of York [7, 18, 27], the University of Southampton [6, 10] and the Geneva School of Business Administration [28]. As previously stated, it is widely accepted that matching problems (like spa) are best solved by centralised matching schemes where agents submit their preferences and a central authority computes an optimal matching that satisfies all the specified criteria [9]. Moreover the potentially large number of students and projects involved in these schemes motivates the need to discover efficient algorithms for finding optimal matchings. 1.1 Two-sided preferences and stability In spa, students are always required to provide preference lists over projects. However, variants of the problem may be defined depending on the presence and nature of lecturer preference lists. Some variants of spa require both students and lecturers to provide preference lists. These variants include: (i) the Student/Project Allocation problem with lecturer preferences over Students (spa-s) [4] which requires each lecturer to rank the students who find at least one of her offered projects acceptable, in order of preference, (ii) the Student/Project Allocation problem with lecturer preferences over Projects (spa- p) [21, 16] which involves lecturers ranking the projects they offer in order of preference and (iii) the Student/Project Allocation problem with lecturer preferences over Student- Project pairs (spa-(s,p)) [4, 5] where lecturers rank student-project pairs in order of preference. These variants of spa have been studied in the context of the well-known stability solution criterion for matching problems [9]. The general stability objective is to produce a matching M in which no student-project pair that are not currently matched in M can simultaneously improve by being paired together (thus in the process potentially abandoning their partners in M ). A full description of the results relating to these spa variants can be found in [20]. 1.2 One-sided preferences and profile-based optimality In many practical spa applications it is considered appropriate to allow only students to submit preferences over projects. When preferences are specified by only one set of agents in a two-sided matching problem, the notion of stability becomes irrelevant. This motivates the need to adopt alternative solution criteria when lecturer preferences are not allowed. In this subsection we describe some of these solution criteria and briefly present results relating to them. These criteria consider the size of the matchings produced as well as the satisfaction of the students involved. When preference lists of lecturers are absent, the spa problem becomes a two-sided matching problem with one-sided preferences. We assume students’ preference lists can contain ties in these spa variants. Various optimality criteria for such problems have been studied in the literature [20]. Some of these criteria depend on the profile or the cost of a matching. In the spa context, the profile of a matching is a vector whose rth component indicates the number of students obtaining their rth-choice project in the matching. The cost of a matching (w.r.t. the students) is the sum of the ranks of the assigned projects in the students’ preference lists (that is, the sum of rxr taken over all components r of the profile, where xr is the rth component value). 2 students’ preferences: s1 : p1 s2 : p1 s3 : p2 p3 p2 p3 lecturers’ offerings: l1 : {p1, p2} l2 : {p3} project capacities: c1 = 1, c2 = 1, c3 = 1 lecturer capacities: d1 = 2, d2 = 1 Figure 1: A spa instance I A minimum cost maximum matching is a maximum cardinality matching with mini- mum cost. A rank-maximal matching is a matching that has lexicographically maximum profile [15, 13]. That is the maximum number of students are assigned to their first-choice project and subject to this, the maximum number of students are assigned to their second choice project and so on. However a rank maximal matching need not be a maximum matching in the given instance (see, e.g., [20, p.43]). Since it is usually important to match as many students as possible, we may first optimise the size of the matching before considering student satisfaction. Thus we define a greedy maximum matching [14, 22, 11] to be a maximum matching that has lexicographically maximum profile. The intuition behind both rank-maximal and greedy maximum matchings is to maximize the number of students matched with higher ranked projects. This may lead to some students being matched to projects that are relatively low on their preference lists. An alternative ap- proach is to find a generous maximum matching which is a maximum matching in which the minimum number of students are matched to their Rth-choice project (where R is the maximum length of any students’ preference list) and subject to this, the minimum number of students are matched to their (R − 1)th-choice project and so on. Greedy and generous maximum matchings have been used to assign students to projects in the School of Computing Science, and students to elective courses in the School of Medicine, both at the University of Glasgow, since 2007. Figure 1 shows a sample spa instance with greedy and generous maximum matchings, namely M1 = {(s1, p3), (s2, p1), (s3, p2)} and M2 = {(s1, p2), (s2, p1), (s3, p3)} respectively. A special case of spa, where each project is offered by a unique lecturer with an infinite upper quota and zero lower quota, can be modelled as the Capacitated House Allocation problem with Ties (chat). This is a variant of the well-studied House Allocation problem (ha) [12, 30] which involves the allocation of a set of indivisible goods (which we call houses) to a set of applicants. In chat, each applicant is required to rank a subset of the houses in order of preference with the houses having no preference over applicants. The applicants play the role of students and the houses play the role of projects and lecturers. As in the case of spa, we seek to find a many-to-one matching comprising applicant-house pairs. Efficient algorithms for finding profile-based optimal matchings in chat have been studied in the literature [11, 14, 25, 22]. The most efficient of these is the O(R∗m n) algorithm for finding rank-maximal, greedy maximum and generous maximum matchings in chat problems due to Huang et al. [11] where R∗ is the maximum rank of any applicant in the matching, m is the sum of all the preference list lengths and n is the total number of applicants and houses. These models however fail to address the issue of load balancing among lecturers. In order to keep the assignment of students fair each lecturer will typically have a minimum (lower quota) and maximum (capacity/upper quota) number of students they are expected to supervise. These numbers may vary for different lecturers according to other administrative and academic commitments. √ The chat algorithms mentioned above are based on modelling the problem in terms of a bipartite graph with the aim of finding a matching in the graph which satisfies the stated 3 criteria. However a more flexible approach would be to model the problem as a network with the aim of finding a flow that can be converted to a matching which satisfies the stated criteria. spa has also been investigated in the network flow context [2, 29] where a mini- mum cost maximum flow algorithm is used to find a minimum cost maximum matching and other profile-based optimal matchings. The model presented in [29] allows for lower quotas on lecturers and projects as well as alternative lecturers to supervise each project. By an appropriate assignment of edge weights in the network it is shown that a minimum cost maximum flow algorithm (due to Orlin [23]) can find rank maximal, generous maximum and greedy maximum matchings in a spa instance. This takes O(m log n(m + n log n)) time in the worst case, where m and n are the number of vertices and edges in the network respectively. In the spa context this takes O(m2 2 log n1 +m2n1 log2 n1) time where n1 is the numbers of students and m2 is the sum of all the students’ preference list lengths. However this approach involves assigning exponentially large edge weights (see, e.g., [20, p.405]), which may be computationally infeasible for larger problem instances due to floating point inaccuracies in dealing with such high numbers. For example given a large spa instance involving say, n1 = 100 students each ranking R = 10 projects in order of preference, edge weights could potentially be of the order nR 1 = 10010 = 1020 (and arithmetic involving such weights could easily require more than the 15-17 significant figures available in a 64- bit double-precision floating representation). Since the flow algorithms involve comparing these edge weights, floating point precision errors could easily cause them to fail in prac- tice. Moreover using the standard assumption that arithmetic on numbers of magnitude O(n1) takes constant time, arithmetic on edge weights of magnitude O(nR 1 ) would add an additional factor of O(R) onto the running time of Orlin’s algorithm. 1.3 Other spa models and approaches The variants of spa already discussed above have been motivated by both practical and theoretical interests. These variants are usually distinguished by the (i) feasibility and (ii) optimality criteria specific to them. In this section, we discuss some more spa models found in the literature as well as other approaches that have been used to solve these problems. The techniques employed include Integer Programming (IP) [6, 28, 24, 17], [24, 17], Constraint Programming (CP) [7, 27], and others [26, 10, 19]. In [24], an IP model for spa was presented with the aim of optimising the overall satisfaction of the students and the lecturers offering the projects (i.e., minimising the overall cost on both sides). In [6] an IP model was presented for spa problems involving individual and group projects. Various objective functions were also employed (often in a hierarchical manner). These include minimising the cost, balancing the work-load among lecturers, maximising the number of students assigned and maximising the number of first-choice assignments (w.r.t. In [28] a more general IP model for spa which allows project lower quotas was also presented. However none of these models simultaneously consider profile-based optimality as well as upper and lower quota constraints. student preferences). 1.4 Our contribution In Section 2 we formally define the spa model. In Section 3 we present an O(n2 1Rm2) time algorithm for finding a greedy maximum matching given a spa instance and prove its correctness. The algorithm takes lecturer upper quotas into consideration. In Section 4 we show how this algorithm can be modified in order to find a generous maximum matching. Section 5 introduces lecturer lower quotas to the spa model and shows how our algorithm can be modified to handle this variant. In Section 6 we present results from an empirical 4 evaluation of the algorithms described. We conclude the paper in Section 7 by presenting some open problems. 2 Preliminary definitions An instance I of the spa problem consists of a set S of students, a set P of projects and a set L of lecturers. Each student si ranks a set Ai ⊆ P of projects that she considers acceptable in order of preference. This preference list of projects may contain ties. Each project pj ∈ P has an upper quota cj indicating the maximum number of students that can be assigned to it. Each lecturer lk ∈ L offers a set of projects Pk ⊆ P and has an upper quota d+ k indicating the maximum number of students that can be assigned to lk. Unless explicitly mentioned, we assume that all lecturer lower quotas are equal to 0. The sets {P1, . . . , Pk} partition P. If project pj ∈ Pk, then we denote lk = l(pj). An assignment M in I is a subset of S × P such that: 1. Student-project pair (si, pj) ∈ M implies pj ∈ Ai. 2. For each student si ∈ S, {(si, pj) ∈ M : pj ∈ Ai} ≤ 1. k for all lecturers lk ∈ L. If (si, pj) ∈ M we denote M (si) = pj. For a project pj, M (pj) is the set of students assigned to pj in M . Also if (si, pj) ∈ M and pj ∈ Pk we say student si is assigned to project pj and to lecturer lk in M . We denote the set of students assigned to a lecturer lk as M (lk). A matching in this problem is an assignment M that satisfies the capacity constraints of the projects and lecturers. That is, M (pj) ≤ cj for all projects pj ∈ P and M (lk) ≤ d+ Given a student si and a project pj ∈ Ai, we define rank(si, pj) as 1 + the number of projects that si prefers to pj. Let R be the maximum rank of a project in any student’s pref- erence list. We define the profile ρ(M ) of a matching M in I as an R-tuple (x1, x2, ..., xR) where for each r (1 ≤ r ≤ R), xr is the number of students si assigned in M to a project pj such that rank(si, pj) = r. Let α = (x1, x2, ..., xR) and σ = (y1, y2, ..., yR) be any two pro- files. We define the empty profile OR = (o1, o2, ..., oR) where or = 0 for all r (1 ≤ r ≤ R). We also define the negative infinity profile B− R = (b1, b2, ..., bR) where br = −∞ (1 ≤ r ≤ R) R = (b1, b2, ..., bR) where br = ∞ (1 ≤ r ≤ R). We define and the positive infinity profile B+ the sum of two profiles α and σ as α + σ = (x1 + y1, x2 + y2, ..., xR + yR). Given any q (1 ≤ q ≤ R), we define α + q = (x1, ..., xq−1, xq + 1, xq+1, ..., xR). We define α − q in a similar way. We define the total order (cid:31)L on profiles as follows. We say α left dominates σ, denoted by α (cid:31)L σ if there exists some r (1 ≤ r ≤ R) such that xr(cid:48) = yr(cid:48) for 1 ≤ r(cid:48) < r and xr > yr. We define weak left domination as follows. We say α (cid:23)L σ if α = σ or α (cid:31)L σ. We may also define an alternative total order ≺R on profiles as follows. We say α right dominates σ (α ≺R σ) if there exists some r (1 ≤ r ≤ R) such that xr(cid:48) = yr(cid:48) for r < r(cid:48) ≤ R and xr < yr. We also define weak right domination as follows. We say α (cid:22)R σ if α = σ or α ≺R σ. The spa problem can be modelled as a network flow problem. Given a spa instance I, we construct a flow network N (I) = (cid:104)G, c(cid:105) where G = (V, E) is a directed graph and c is a non-negative capacity function c : E → R+ defining the maximum flow allowed through each edge in E. The network consists of a single source vertex vs and sink vertex vt and is constructed as follows. Let V = {vs, vt}∪S ∪P ∪L and E = E1∪ E2∪ E3∪ E4 where E1 = {(vs, si) : si ∈ S}, E2 = {(si, pj) : si ∈ S, pj ∈ Ai}, E3 = {(pj, lk) : pj ∈ P, lk = l(pj)} and E4 = {(lk, vt) : lk ∈ L}. We set the capacities as follows: c(vs, si) = 1 for all (vs, si) ∈ E1, c(si, pj) = 1 for all (si, pj) ∈ E2, c(pj, lk) = cj for all (pj, lk) ∈ E3 and c(lk, vt) = d+ k for all (lk, vt) ∈ E4. 5 We call a path P (cid:48) from vs to some project pj a partial augmenting path if P (cid:48) can be extended adding the edges (pj, l(pj)) and (l(pj), vt) to form an augmenting path with respect to flow f . Given a partial augmenting path P (cid:48) from vs to pj, we define the profile of P (cid:48), denoted ρ(P (cid:48)), as follows: ρ(P (cid:48)) = OR + (cid:88){rank(si, pj) : (si, pj) ∈ P (cid:48) ∧ f (si, pj) = 0} − (cid:88){rank(si, pj) : (pj, si) ∈ P (cid:48) ∧ f (si, pj) = 1} where additions are done with respect to the + and − operations on profiles. Unlike the profile of a matching, the profile of an augmenting path may contain negative values. Also if P (cid:48) can be extended to a full augmenting path P with respect to flow f by adding the edges (pj, l(pj)) and (l(pj), vt) where vs and pj are the endpoints of P (cid:48), then we define the profile of P , denoted by ρ(P ), to be ρ(P ) = ρ(P (cid:48)). Multiple partial augmenting paths may exist from vs to pj, thus we define the maximum profile of a partial augmenting path from vs to pj with respect to (cid:31)L, denoted Φ(pj), as follows: Φ(pj) = max(cid:31)L{ρ(P (cid:48)) : P (cid:48) is a partial augmenting path from vs to pj}. An augmenting path P is called a maximum profile augmenting path if ρ(P ) = max(cid:31)L{Φ(pj) : pj ∈ P}. Let f be an integral flow in N . We define the matching M (f ) in I induced by f as follows: M (f ) = {(si, pj) : f (si, pj) = 1}. Clearly by construction of N , M (f ) is a matching in I, such that M (f ) = f. If f is a flow and P is an augmenting path with respect to f then ρ(M(cid:48)) = ρ(M ) + ρ(P ) where M = M (f ), M(cid:48) = M (f(cid:48)) and f(cid:48) is the flow obtained by augmenting f along P . Also given a matching M in I, we define a flow f (M ) in N corresponding to M as follows: ∀ (vs, si) ∈ E1, f (vs, si) = 1 if si is matched in M and f (vs, si) = 0 otherwise. ∀ (si, pj) ∈ E2, f (si, pj) = 1 if (si, pj) ∈ M and f (si, pj) = 0 otherwise. ∀ (pj, lk) ∈ E3, f (pj, lk) = c(cid:48) ∀ (lk, vt) ∈ E4, f (lk, vt) = d(cid:48) j = M (pj) k = M (lk) j where c(cid:48) k where d(cid:48) We define a student si to be exposed if f (vs, si) = 0 meaning that there is no flow through si. Similarly we define a project pj to be exposed if f (pj, lk) < cj and f (lk, vt) < d+ k where lk = l(pj). Let M be a matching of size k in I. We say that M is a greedy k-matching if there is no other matching M(cid:48) such that M(cid:48) = k and ρ(M(cid:48)) (cid:31)L ρ(M ). If k is the size of a maximum cardinality matching in I, we call M a greedy maximum matching in I. Also we say that M is a generous k-matching if there is no other matching M(cid:48) such that M(cid:48) = k and ρ(M(cid:48)) ≺R ρ(M ). If k is the size of a maximum cardinality matching in I, we call M a generous maximum matching in I. We also define the degree of a matching M to be the rank of one of the worst-off students matched in M or 0 if M is an empty set. 3 Greedy maximum matchings in spa In this section we present the algorithm Greedy-max-spa for finding a greedy maximum matching given a spa instance. The algorithm is based on the general Ford-Fulkerson algorithm for finding a maximum flow in a network [8]. We obtain maximum profile augmenting paths by adopting techniques used in the bipartite matching approach for finding a greedy maximum matching in ha [14] and chat [25]. 6 The Greedy-max-spa algorithm shown in Algorithm 1 takes in a spa instance I as input and returns a greedy maximum matching M in I. A flow network N (I) = (cid:104)G, c(cid:105) is constructed as described in Section 2. Given a flow f in N (I) that yields a greedy k-matching M (f ) in I, if k is not the size of a maximum flow in N (I), we seek to find a maximum profile augmenting path P with respect to f in N (I) such that the new flow f(cid:48) obtained by augmenting f along P yields a greedy (k + 1)-matching M (f(cid:48)) in I. Lemmas 3.1 and 3.2 show the correctness of this approach. We firstly show that if k is smaller than the size of a maximum flow in N (I) then such a path is bound to exist. j , p2 Let M(cid:48) k+1 be a greedy (k +1)-matching in I (this exists because k < η). Then C(M(cid:48) Lemma 3.1. Let I be an instance of spa and let η denote the size of a maximum matching in I. Let k (1 ≤ k < η) be given and suppose that Mk is a greedy k-matching in I. Let N = N (I) and f = f (Mk). Then there exists an augmenting path P with respect to f in N such that if f(cid:48) is the result of augmenting f along P then Mk+1 = M (f(cid:48)) is a greedy (k + 1)-matching in I. Proof. Let I(cid:48) = C(I) be a new instance of spa obtained from I as follows. Firstly we add all students in I to I(cid:48). Next, for every project pj ∈ P, we add cj clones p1 j to I(cid:48) j , ..., pcj each of capacity 1. We then add all lecturers in I to I(cid:48). If pj ∈ Ai in I, we add (si, pr j ) to I(cid:48) for all r (1 ≤ r ≤ cj). If pj ∈ Pk is in I, we add (pr j , lk) to I(cid:48) for all r (1 ≤ r ≤ cj). Also j ) = t for all r (1 ≤ r ≤ cj). Let G(cid:48) be the underlying if rank(si, pj) = t, we set rank(si, pr graph in I(cid:48) involving only the student and project clones. With respect to the matching Mk = M (f ), we construct a cloned matching C(Mk) in I(cid:48) as follows. If project pj is j ) to C(Mk) for all 1 ≤ r ≤ xj. assigned xj students sq,1, sq,2, ..., sq,xj in Mk we add (sq,r, pr Hence C(Mk) is a greedy k-matching in I(cid:48). k+1) is a greedy (k + 1)-matching in I(cid:48). Let X = C(Mk) ⊕ C(M(cid:48) k+1). Then each connected component of X is either (i) an alternating cycle, (ii) an even-length alternating path or (iii) an odd-length alternating path in G(cid:48) (with no restrictions on which matching the end edges belong to). The aim is to show that, by eliminating a subset of X, we are left with a set of connected components which can be transformed into a single augmenting path with respect to f (C(Mk)) in N (I(cid:48)) and subsequently a single augmenting path with respect to f (Mk) in N (I). Eliminating connected components of X: Suppose D ⊆ X is a type (i) connected component of X or a type (ii) connected component of X whose end vertices are students k+1)) (cid:31)L (we may call this a type (ii)(a) component). Suppose also that ρ(D ∩ C(M(cid:48) ρ(D ∩ C(Mk)). A new matching C(M(cid:48) k) in G(cid:48) of cardinality k can be created from C(Mk) by replacing all the C(Mk)-edges in D with the C(M(cid:48) k+1)-edges in D (i.e. by augmenting C(Mk) along D). Since the upper quota constraints of the lecturers involved are not violated after creating C(M(cid:48) k) is also a valid spa k)) (cid:31)L ρ(C(Mk)) which is a contradiction to the fact matching in I(cid:48). Moreover ρ(C(M(cid:48) that C(Mk) is a greedy k-matching in I(cid:48). A similar contradiction (to the fact that C(M(cid:48) k+1) is a greedy (k + 1)- matching in I(cid:48)) exists if we assume ρ(D∩ C(Mk)) (cid:31)L ρ(D∩ C(M(cid:48) k+1)). Thus ρ(D ∩ C(M(cid:48) Form the argument above, no type (i) or type (ii)(a) connected component of X con- tributes to a change in the size or profile as we augment from C(Mk) to C(M(cid:48) k+1) or vice versa. In fact, this is true for any even-length connected component of X which does not cause lecturer upper quota constraints to be violated as we augment from C(Mk) to C(M(cid:48) k+1) or vice versa. The claim can further be extended to certain groups of con- nected components which, when considered together, (i) have equal numbers of C(Mk) and C(M(cid:48) k+1) edges and (ii) do not cause lecturer upper quota constraints to be violated k) from C(Mk), it follows that C(M(cid:48) k+1)) = ρ(D ∩ C(Mk)). 7 k+1) in I(cid:48) which can be constructed by augmenting C(M(cid:48) as we augment from C(Mk) to C(M(cid:48) k+1) or vice versa. In all these cases, it is possible to eliminate such components (or groups of components) from consideration. Using the above reasoning, we begin by eliminating all type (i) and type (ii)(a) connected components of X. Let D be the union of all the edges in type (i) and type (ii)(a) connected components of X. Let X(cid:48) = X\D. Then it follows that X(cid:48) = C(Mk) ⊕ C(M(cid:48)(cid:48) k+1) for some greedy (k + 1)-matching C(M(cid:48)(cid:48) k+1) along all type (i) and type (ii)(a) components of X. Thus X(cid:48) contains (1) even-length alter- nating paths whose end vertices are project clones (we call these type (ii)(b) paths), (2) odd-length alternating paths whose end edges are in C(Mk) (we call these type (iii)(a) paths) and (3) odd-length alternating paths whose end edges are in C(M(cid:48)(cid:48) k+1) (we call these type (iii)(b) paths). Although these alternating paths are vertex disjoint, there are special cases where two alternating paths in X(cid:48) may be joined together by pairing their end project clone vertices. Joining alternating paths: Consider some lecturer lq and project pj ∈ Pq. We extend the notation l(pj) to include all clones of pj (i.e. l(pr j ) = lq for all r (1 ≤ r ≤ cj)). Let k+1)} and xq = Xq j is unmatched in C(M(cid:48)(cid:48) Xq = {(si, pr j ) ∈ C(Mk) : lq = l(pr j ) ∧ pr Thus Xq is the set of end edges incident to project clones belonging to a subset of the type (ii)(b) and type (iii)(a) paths in X(cid:48). Let j ) ∧ pr j is unmatched in C(Mk)} and yq = Yq Yq = {(si, pr j ) ∈ C(M(cid:48)(cid:48) k+1) : lq = l(pr k+1)∧pr j : lq = l(pr j )∧pr Note that vq ≥ yq if and only if v(cid:48) j is matched in C(Mk)} and zq = Zq q + yq + zq where vq and v(cid:48) k+1) respectively. k+1) (i.e. if they are used to augment C(M(cid:48)(cid:48) On the other hand, assume yq > vq. Then xq > v(cid:48) Thus Yq is the set of end edges incident to project clones belonging to a subset of the type (ii)(b) and type (iii)(b) paths in X(cid:48). Also let Zq = {pr j is matched in C(M(cid:48)(cid:48) Thus dq = vq + xq + zq and dq = v(cid:48) positions that lq has in C(Mk) and C(M(cid:48)(cid:48) q are the number of unassigned q ≥ xq. If vq ≥ yq then all the paths with end edges in Yq can be considered as valid alternating paths in C(Mk) (i.e. if they are used to augment q ≥ xq C(Mk), lq’s upper quota will not be violated in the resulting matching). Since v(cid:48) then all the paths with end edges in Xq can be considered as valid alternating paths in C(M(cid:48)(cid:48) k+1), lq’s upper quota will not be violated in the resulting matching). q ⊆ Yq be an arbitrary subset of Yq of size vq and let X(cid:48) q. Thus all paths with end edges in X(cid:48) k+1) q = yq − vq = Xq\X(cid:48) and C(Mk) respectively. Also Yq\Y (cid:48) q. We can thus form a 1 − 1 correspondence between the edges in Yq\Y (cid:48) q. Let j(cid:48) ) ∈ Xq\X(cid:48) q be the end edges of two alternating paths in X(cid:48). (si, pr The paths can be joined together by pairing the clones of both end projects thus forming j(cid:48) ) at lq. These project pairs can be formed from all edges in Yq\Y (cid:48) a project pair (pr and Xq\X(cid:48) q. In the cases where project pairs are formed, the resulting path (which we call a com- pound path) may be regarded as a single path along which C(Mk) or C(M(cid:48)(cid:48) k+1) may be augmented. In some cases, the two projects being paired may be end vertices of a single (or compound) alternating path. Thus pairing them together will form a cycle. Since the cycle is of even length and the lecturer’s upper quota will not be violated if it is used to q can be considered as valid alternating paths in C(M(cid:48)(cid:48) q ⊆ Xq be an arbitrary subset of Xq of size v(cid:48) q and (si(cid:48), pr(cid:48) j , pr(cid:48) j ) ∈ Yq\Y (cid:48) q = xq − v(cid:48) q and those in Xq\X(cid:48) q. Let Y (cid:48) q and Y (cid:48) q 8 compound type (ii)(a) path compound type (iii)(a) path compound type (iii)(b) path s1 s2 s3 p1 p2 p3 p4 s1 s2 s3 p1 p2 p3 p4 s1 s2 s3 s5 s6 p1 p2 p3 p4 p5 p6 (a) (b) (c) ∈ C(Mk) Figure 2: Some types of compound path in X(cid:48) ∈ C(M(cid:48)(cid:48) k+1) k+1) it can be eliminated right away. For each lecturer lq ∈ L, augment C(Mk) or C(M(cid:48)(cid:48) once the pairings between alternating paths in Yq\Y (cid:48) q have been carried out (where applicable) and any formed cycles have been eliminated, we are left with a set of single or compound alternating paths of the following types (for simplicity we call all remaining alternating paths compound paths even though they may consist of only one path). q and Xq\X(cid:48) 1. A compound type (ii)(a) path - a compound path with an even number of edges with both end vertices being students. This path will contain a type (iii)(a) path at one end, and a type (iii)(b) path at the other end with zero or more type (ii)(b) paths in between (See Figure 2(a)). Such a path can be eliminated from consideration. 2. A compound type (ii)(b) path - a compound path with an even number of edges with both end vertices being project clones. This path will contain one or more type (ii)(b) paths joined together. Such a path can also be eliminated from consideration as its end edges are incident to exposed project clones. 3. A compound type (iii)(a) path - a compound path with an odd number of edges with both end edges being matched in C(Mk). This path will contain a type (iii)(a) path at one end with zero or more type (ii)(b) paths joined to it (See Figure 2(b)). We will consider these paths for elimination later in this proof. 4. A compound type (iii)(b) path - a compound path with an odd number of edges with both end edges being matched in C(M(cid:48)(cid:48) k+1). This path will contain a type (iii)(b) path at one end with zero or more type (ii)(b) paths joined to it (See Figure 2(c)). We will consider these paths for elimination later in this proof. Eliminating compound paths: At this stage we are left with only compound type (iii)(a) and compound type (iii)(b) paths in X(cid:48). These paths, if considered independently decrease and increase the size of C(Mk) by 1 respectively. Since C(M(cid:48)(cid:48) k+1) = C(Mk) + 1 9 then there are q type (iii)(a) paths and (q + 1) type (iii)(b) paths. Consider some com- pound type (iii)(b) path D(cid:48) and some compound type (iii)(a) path D(cid:48)(cid:48). Then we can k+1) along D(cid:48) ∪ D(cid:48)(cid:48). Suppose consider the combined effect of augmenting C(Mk) or C(M(cid:48)(cid:48) k+1)) (cid:31)L ρ((D(cid:48) ∪ D(cid:48)(cid:48)) ∩ C(Mk)). A new matching C(M(cid:48)(cid:48) that ρ((D(cid:48) ∪ D(cid:48)(cid:48)) ∩ C(M(cid:48)(cid:48) k ) in G(cid:48) of cardinality k can be created by augmenting C(Mk) along D(cid:48) ∪ D(cid:48)(cid:48). Since the upper quota constraints on the lecturers involved are not violated after creating C(M(cid:48)(cid:48) k ) from k )) (cid:31)L ρ(C(Mk)) C(Mk), then C(M(cid:48)(cid:48) which is a contradiction to the fact that C(Mk) is a greedy k-matching in I(cid:48). A similar contradiction (to the fact that C(M(cid:48)(cid:48) k+1) is a greedy (k + 1)-matching in I(cid:48)) exists if we assume ρ((D(cid:48)∪D(cid:48)(cid:48))∩C(Mk)) (cid:31)L ρ((D(cid:48)∪D(cid:48)(cid:48))∩C(M(cid:48)(cid:48) k+1)) = ρ((D(cid:48)∪ D(cid:48)(cid:48))∩ C(Mk)). It follows that, considering D(cid:48) and D(cid:48)(cid:48) together, the size and profile of the matching is unaffected as augment from C(Mk) to C(M(cid:48)(cid:48) k+1) or vice versa and so both D(cid:48) and D(cid:48)(cid:48) can be eliminated from consideration. k ) is also a valid spa matching in I(cid:48). Thus ρ(C(M(cid:48)(cid:48) k+1)). Thus ρ((D(cid:48)∪D(cid:48)(cid:48))∩C(M(cid:48)(cid:48) j , pr(cid:48) Generating an augmenting path in N (I): Once all these eliminations have been done, since C(M(cid:48)(cid:48) k+1) = C(Mk) + 1 it is easy to see that there remains only one path P (cid:48) left in X(cid:48) which is a compound type (iii)(b) path. The path P (cid:48) can then be transformed to a component D in G(I) (where G(I) is basically the undirected counterpart of N (I) j (1 ≤ r ≤ cj) in P (cid:48) with the without capacities) by replacing all the project clones pr original project pj and, for every joined pair of project clones (pr j(cid:48) ), adding the lecturer j ) = l(pr(cid:48) l(pr j(cid:48) ) in between them. Thus a project may now appear more than once in D. A lecturer may also appear more than once in D. Consider some project pj ∈ D that appears more than once. Then let P (cid:48)(cid:48) ⊂ P (cid:48) be the path consisting of edges between the first and last occurrence of the pj clones in P (cid:48) (P (cid:48)(cid:48) corresponds to a collection of cycles belonging to D in G(I) involving pj). Thus P (cid:48)(cid:48) is of even length and both end projects of P (cid:48)(cid:48) are clones of the same project. Augmenting C(Mk) k+1) along P (cid:48)(cid:48) will not violate the lecturer upper quota constraints or affect the or C(M(cid:48)(cid:48) size or profile of the matching obtained (again using the same arguments presented above). Thus P (cid:48)(cid:48) can be eliminated from consideration. Although this potentially breaks P (cid:48) into two separate paths in G(I(cid:48)) it still remains connected in G(I). Similarly consider some lecturer lk ∈ D that appears more than once. Then let P (cid:48)(cid:48)(cid:48) ⊂ P (cid:48) be the path consisting of edges between the first and last occurrence of the lk clones in P (cid:48) (P (cid:48)(cid:48)(cid:48) corresponds to a collection of type (ii)(b) paths with project clones offered by lk). Thus augmenting C(Mk) k+1) along P (cid:48)(cid:48)(cid:48) will not violate the lecturer upper quota constraints or affect the or C(M(cid:48)(cid:48) size or profile of the matching obtained (again using the same arguments presented above). Thus P (cid:48)(cid:48)(cid:48) can be eliminated from consideration. Doing the above steps continually for all projects and lecturers that occur more than once in D eventually yields a valid path in G(I) in which all nodes are visited only once. Finally we describe how the path D in G(I), obtained after removing duplicate projects and lecturers, can be transformed to an augmenting path P in N (I) (i.e. we establish the direction of flow from vs to vt through P in N (I)). Firstly we add the edge (vs, si) to P where si is the exposed student in D. Next for every edge (si(cid:48), pj(cid:48)) ∈ M(cid:48)(cid:48) k+1 ∩ D we add a forward edge (si(cid:48), pj(cid:48)) to P . Also for every edge (si(cid:48)(cid:48), pj(cid:48)(cid:48)) ∈ Mk ∩ D we add a backward edge (pj(cid:48)(cid:48), si(cid:48)(cid:48)) to P . Finally we add the edges (pj, l(pj)) and (l(pj), vt) to P where pr j is the end project vertex in D. Thus P is an augmenting path with respect to f = f (Mk) in N (I) such that if f(cid:48) is the flow obtained when f is augmented along P then M (f(cid:48)) is a greedy (k + 1)-matching in N (I). Lemma 3.2. Let f be a flow in N and let Mk = M (f ). Suppose that Mk is a greedy k-matching. Let P be a maximum profile augmenting path with respect to f . Let f(cid:48) be the 10 Algorithm 1 Greedy-max-spa Require: spa instance I; Ensure: return matching M ; 1: define flow network N (I) = (cid:104)G, c(cid:105); 2: define empty flow f ; 3: loop 4: 5: 6: 7: 8: end if 9: 10: end loop P = Get-max-aug(N (I), f ); if P (cid:54)= null then augment f along P ; else return M (f ); flow obtained by augmenting f along P . Now let Mk+1 = M (f(cid:48)). Then Mk+1 is a greedy (k + 1)-matching. Proof. Suppose for a contradiction that Mk+1 is not a greedy (k + 1)-matching. By Lemma 3.1, there exists an augmenting path P (cid:48) with respect to f such that if f(cid:48) is the result of augmenting f along P (cid:48) then M(cid:48) k+1 = M (f(cid:48)) is a greedy (k + 1)-matching. Hence k+1) = ρ(M ) + ρ(P (cid:48)) and ρ(Mk+1) = ρ(M ) + ρ(P ), ρ(M(cid:48) it follows that ρ(P (cid:48)) (cid:31)L ρ(P ), a contradiction to the assumption that P is a maximum profile augmenting path. k+1) (cid:31)L ρ(Mk+1). Since ρ(M(cid:48) The Get-max-aug algorithm shown in Algorithm 2 accepts a flow network N (I) and flow f as input and finds an augmenting path of maximum profile relative to f or reports that none exists. The latter case implies that M (f ) is already a greedy maximum match- ing. The method consists of three phases: an initialisation phase (lines 1 -15), the main phase which is a loop containing two other loops (lines 16 - 43) and a final phase (lines 44 - 52) where the augmenting path is generated and returned. For each project pj the Get-max-aug method maintains a variable ρ(pj) describing the profile of a partial augmenting path P (cid:48) from some exposed student to pj. It also maintains, for every project pj ∈ P, a pointer pred(pj) to the student or lecturer preceding pj in P (cid:48). For every lecturer lk ∈ L a pointer pred(lk) is also used to refer to any project preceding lk in P (cid:48). Thus the final augmenting path produced will pass through each lecturer or project at most once. The initialisation phase of the method involves setting all pred pointers to null and ρ profiles to B− R . Next, the method seeks to find, for each project pj, a partial augmenting path ((vs, si), (si, pj)) from the source, through an exposed student si to pj should one exist. In the presence of multiple paths satisfying this criterion, the path with the best profile (w.r.t. (cid:31)L) is selected. The variables pred(pj) and ρ(pj) are updated accordingly. Thus at the end of this phase ρ(pj) indicates the maximum profile of an augmenting path of length 2 via some exposed student to pj should one exist. If such a path does not exist then ρ(pj) and pred(pj) remain B− In the main phase, the algorithm then runs f iterations, at each stage attempting to increase the quality (w.r.t. (cid:31)L) of the augmenting paths described by the ρ profiles. Each iteration runs two loops. Each loop identifies cases where the flow through one edge in the network can be reduced in order to allow the flow through another to be increased while improving the profile of the projects involved. In both loops, the decision on whether to switch the flow between candidate edges is made based on an edge relaxation operation similar to that used in the Bellman-Ford algorithm for solving the single source shortest path problem in which edge weights may be negative. In the first loop, we seek to evaluate the gain that may be derived from switching the flow through a student from one project R and null respectively. 11 to another. Given an edge (si, pk) with a flow of 1 in f and edge (si, pj) with no flow in f , we define σ to be the resulting profile of pj if the partial augmenting path ending at pk is to be extended (via si) to pj. Thus σ will become the new value of ρ(pj) should this extension take place. If σ (cid:31)L ρ(pj) (i.e. if the proposed profile is better than the current one), we extend the augmenting path to pj and update ρ(pj) = σ and pred(pj) = si. In the second loop, we seek to evaluate the gain that may be derived from switching k ⊆ Pk be flow to some lecturer from one project to another. Given a lecturer lk, let P (cid:48) k ⊆ Pk be the set of the set of projects offered by lk with positive outgoing flow and P (cid:48)(cid:48) projects offered by lk that are undersubscribed in M (f ). Then we seek to determine if an improvement can be obtained by switching a unit of flow from some project pj ∈ P (cid:48) to some other project pm ∈ P (cid:48)(cid:48) k k . This is achieved by comparing the ρ(pj) and ρ(pm) profiles and updating ρ(pj) = ρ(pm), pred(pj) = lk and pred(lk) = pm if ρ(pm) (cid:31)L ρ(pj) where ρ(pm) represents the profile of a partial augmenting path that does not already pass through lk (i.e., pred(pm) (cid:54)= lk). This means that the partial augmenting path ending at pm can be extended further (via lk) to pj while improving its profile. The intuition is that, after augmenting along such a path, pm gains an extra student while pj loses one. During the final phase, we iterate through all exposed projects and find the one with the largest profile with respect to (cid:31)L (say pq). An augmenting path is then constructed through the network using the pred values of the projects and lecturers and the matched edges in M (f ) starting from pq. The generated path is returned to the calling algorithm. If no exposed project exists, the method returns null. We next show that Get-max-aug method produces such a maximum profile augmenting path in N with respect to f should one exist. Lemma 3.3. Given a spa instance I, let f be a flow in N = N (I) where k = f is not the size of a maximum matching in I and M (f ) is a greedy k-matching in I. Algorithm Get-max-aug finds a maximum profile augmenting path in N with respect to f . Proof. Consider some project pj in P. For any q (0 ≤ q ≤ k) and for any r (0 ≤ r ≤ k), we define Φ2q+1,2r(pj) to be the maximum profile of any partial augmenting path with respect to f in N that starts at an exposed student, ends at pj, and involves at most 2q + 1 student-project edges and at most 2r project-lecturer edges. We represent the length of such a path using the pair (2q + 1, 2r). Thus Φ2k+1,2k(pj) gives the maximum profile of any partial augmenting path starting at an exposed student and ending at pj. If such a path does not exist then Φ2k+1,2k(pj) = B− R . Firstly we seek to show that after q iterations of the main loop of Get-max-aug where 0 ≤ q ≤ k, ρq(pj) (cid:23)L Φ2q+1,2q(pj) for every project pj ∈ P where ρq(pj) is the profile computed at pj after q iterations of the main loop. For each project pm ∈ P let S(cid:48) We prove this inductively. For the base case, let q = 0. Then Φ1,0(pm) is the maximum profile of any partial augmenting path of length (1, 0) from an exposed student to project pm. Hence, from the initialisation phase of Get-max-aug, ρ0(pm) = Φ1,0(pm) and thus ρ0(pm) (cid:23)L Φ1,0(pm). For the inductive step, assume 1 ≤ q ≤ k and that the claim is true after the (q − 1)th iteration (i.e. ρq−1(pm) (cid:23)L Φ2q−1,2q−2(pm) for any pm ∈ P). We will show that the claim is true for the qth iteration (i.e. ρq(pm) (cid:23)L Φ2q+1,2q(pm)). m = {si ∈ S : (si, pm) ∈ E ∧ f (si, pm) = 0} and for each lecturer lk ∈ L let P (cid:48) k = {pm ∈ P : lk = l(pm) ∧ f (pm, lk) < cm}. For each iteration of the main loop, we perform a relaxation step involving some student-project pair (si, pm) where si ∈ S(cid:48) m and/or a relaxation step involving some project-lecturer pair (pm, lk) where pm ∈ P (cid:48) k. Consider some project pm. If there does not exist a partial augmenting path from an exposed student to pm, of length ≤ (2q + 1, 2q − 2) and with a better profile than Φ2q−1,2q−2(pm), then Φ2q+1,2q−2(pm) = Φ2q−1,2q−2(pm). Otherwise there exists a partial 12 Algorithm 2 Get-max-aug (method for Greedy-max-spa) Require: flow network N (I) = (cid:104)G, c(cid:105) where G = (V, E), flow f where M (f ) is a greedy f- matching; ρ(pj) = B− R ; pred(pj) = null; for all exposed student si ∈ S such that pj ∈ Ai do 1: /* initialisation */ 2: for project pj ∈ P do 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: end for 13: for lecturer lk ∈ L do ρ(pj) = σ; pred(pj) = si; end if end for σ = OR + rank(si, pj); if σ (cid:31)L ρ(pj) then /* first loop */ for all (si, pj) ∈ E where f (si, pj) = 0 and f (si, pk) = 1 for some pk ∈ Ai do σ = ρ(pk) − rank(si, pk) + rank(si, pj); if σ (cid:31)L ρ(pj) then ρ(pj) = σ; pred(pj) = si; end if end for /* second loop */ for all lecturer lk ∈ L do σ = B− R ; pz = null; for all project pm ∈ Pk such that l(pm) = lk ∧ f (pm, lk) < cm do for all project pj ∈ Pk such that l(pj) = lk ∧ f (pj, lk) > 0 ∧ pj (cid:54)= pz do pred(lk) = null; 14: 15: end for 16: /* main phase */ 17: for 1...f do 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: end for end if end for end for if ρ(pm) (cid:31)L σ then σ = ρ(pm); pz = pm; end if end for if pz (cid:54)= null then ρ(pj) = σ; pred(pj) = lk; pred(lk) = pz; 13 44: /* final phase */ 45: ρ = max(cid:31)L({B− 46: if ρ (cid:31)L B− R then R} ∪ {ρ(pj) : pj ∈ P is exposed}); pq = arg max(cid:31)L({B− R} ∪ {ρ(pj) : pj ∈ P is exposed}); 47: 48: Q = path obtained by following pred values and matched edges in M (f ) from pq to an exposed student; return (cid:104)vs(cid:105) ++ reverse(Q) ++ (cid:104)l(pq), vt(cid:105); /*++ denotes concatenation*/ 49: 50: else 51: 52: end if return null; augmenting path from an exposed student to pm of length at least (2q + 1, 2q − 2) with a better profile than Φ2q−1,2q−2(pm). Such a path must contain a partial augmenting path from an exposed student to some project pm(cid:48) such that: Φ2q+1,2q−2(pm) = Φ2q−1,2q−2(pm(cid:48)) + rank(si, pm) − rank(si, pm(cid:48)). where si ∈ S(cid:48) m and f (si, pm(cid:48)) = 1. Thus we note the following identity involving Φ2q+1,2q−2(pm): Φ2q+1,2q−2(pm) = max(cid:31)L{Φ2q−1,2q−2(pm), {Φ2q−1,2q−2(pm(cid:48)) + rank(si, pm) − rank(si, pm(cid:48)) : si ∈ S(cid:48) m ∧ f (si, pm(cid:48)) = 1}}. (1) Let ρ(cid:48) q(pm) be the profile computed at pm after the first sub-loop during the qth iteration of the main loop of the Get-max-aug algorithm (i.e. at Line 25 during the qth iteration). Then q(pm) = max(cid:31)L{ρq−1(pm), ρ(cid:48) {ρq−1(pm(cid:48)) + rank(si, pm) − rank(si, pm(cid:48)) : si ∈ S(cid:48) m ∧ f (si, pm(cid:48)) = 1}}. (2) By the induction hypothesis, ρq−1(pm) (cid:23)L Φ2q−1,2q−2(pm). Thus: q(pm) = max(cid:31)L{ρq−1(pm),{ρq−1(pm(cid:48)) + rank(si, pm) − rank(si, pm(cid:48)) : ρ(cid:48) (cid:23)L max(cid:31)L{Φ2q−1,2q−2(pm),{Φ2q−1,2q−2(pm(cid:48)) + rank(si, pm) − rank(si, pm(cid:48)) : m ∧ f (si, pm(cid:48)) = 1}}. (by equation 2). m ∧ f (si, pm(cid:48)) = 1}}. (by the inductive hypothesis) si ∈ S(cid:48) si ∈ S(cid:48) = Φ2q+1,2q−2(pm). (by equation 1) Therefore: q(pm) (cid:23)L Φ2q+1,2q−2(pm). ρ(cid:48) (3) Again, if there does not exist a partial augmenting path from an exposed student to pm, of length ≤ (2q + 1, 2q) and with a better profile than Φ2q+1,2q−2(pm), then Φ2q+1,2q(pm) = Φ2q+1,2q−2(pm). Otherwise there exists a partial augmenting path from an exposed student to pm of length (2q + 1, 2q) with a better profile than Φ2q+1,2q−2(pm). We can therefore note the following identity involving Φ2q+1,2q(pm): Φ2q+1,2q(pm) = max(cid:31)L{Φ2q+1,2q−2(pm), {Φ2q+1,2q−2(pm(cid:48)) : lk = l(pm) ∧ pm(cid:48) ∈ P (cid:48) k ∧ f (pm, lk) > 0 ∧ f (lk, vt) = d+ k }}. After the qth iteration of the main loop has completed, we have: ρq(pm) = max(cid:31)L{ρ(cid:48) q(pm), {ρ(cid:48) q(pm(cid:48)) : lk = l(pm) ∧ pm(cid:48) ∈ P (cid:48) k ∧ f (pm, lk) > 0 ∧ f (lk, vt) = d+ k }}. (4) (5) 14 We observe that the extra condition (pred(pm) (cid:54)= lk) in Line 29 of the second loop, does not affect the correctness of equation 5. Suppose pred(pm) = lk, then ρ(pm) must have been updated during the qth iteration of the second loop (or during a previous iteration and has remained unchanged) by some project profile ρ(p(cid:48) j). Thus setting ρ(pj) = ρ(pm) and pred(lk) = pm would be incorrect as p(cid:48) j is now the source of ρ(pm) and not pm. Moreover if indeed ρ(pm) = ρ(p(cid:48) j would be encountered later on during the iteration of the second loop. j) (cid:31)L ρ(pj) then p(cid:48) ρq(pm) = max(cid:31)L{ρ(cid:48) (cid:23)L max(cid:31)L{Φ2q+1,2q−2(pm),{Φ2q+1,2q−2(pm(cid:48)) : lk = l(pm) ∧ q(pm(cid:48)) : lk = l(pm) ∧ pm(cid:48) ∈ P (cid:48) q(pm), {ρ(cid:48) pm(cid:48) ∈ P (cid:48) k ∧ f (pm, lk) > 0 ∧ f (lk, vt) = d+ k ∧ f (pm, lk) > 0 ∧ f (lk, vt) = d+ k }} (from equation 3) k }}. = Φ2q+1,2q(pm) (by equation 4). Therefore: ρq(pm) (cid:23)L Φ2q+1,2q(pm). But any partial augmenting path from an exposed student to pj with respect to flow f can have length at most (2k + 1, 2k). Thus ρ(pj) = Φ2k+1,2k(pj) after k iterations of the main loop. Finally we show that a partial augmenting path P (cid:48) (and subsequently a full augmenting path) can be constructed by following the pred values of projects and lecturers and the matched edges in M (f ) starting from some exposed project pj with the maximum ρ(pj) profile, and ending at some exposed student (i.e. we show that such a path is continuous and contains no cycle). Suppose for a contradiction that such a path P (cid:48) contained a cycle C. Then at some step X during the execution of the algorithm, C would have been formed when, for some project pj, either (i) pred(pj) was set to some student si or (ii) pred(pj) was set to some lecturer lk. Let P (cid:48)(cid:48) be any path in N (I). We may extend our definitions for the profile of a matching and a partial augmenting path to cover the profile of any path in N (I) as follows: ρ(P (cid:48)(cid:48)) = OR +(cid:80){rank(si, pj) : (si, pj) ∈ P (cid:48)(cid:48) ∩ E2 ∧ f (si, pj) = 0} − (cid:80){rank(si, pj) : (pj, si) ∈ P (cid:48)(cid:48) ∩ E2 ∧ f (si, pj) = 1}. Considering case (i) let pm = M (si). Also let ρ(cid:48)(pj) and ρ(pj) be the profiles of partial augmenting paths from some exposed student to pj before and after step X respectively. Then ρ(pj) (cid:31)L ρ(cid:48)(pj). Also ρ(pj) = ρ(pm) + rank(si, pj) − rank(si, pm), i.e., ρ(pj) = ρ(pm) + ρ(P (cid:48)(cid:48)) where P (cid:48)(cid:48) = {(si, pj), (si, pm)}. Since we can also trace a path through all the other projects in C (using pred values and matched edges) from pm to pj, it follows that ρ(pm) = ρ(cid:48)(pj) + ρ(C\{(si, pj), (si, pm)}). Thus ρ(pj) = ρ(cid:48)(pj) + ρ(C). Note that ρ(C) = ρ(C(cid:48)\M ) − ρ(C(cid:48) ∩ M ) and C(cid:48) = C ∩ E2 is the set of edges in C involving only students and projects. As ρ(pj) (cid:31)L ρ(cid:48)(pj), it follows that ρ(C(cid:48)\M ) (cid:31)L ρ(C(cid:48) ∩ M ). But since C(cid:48)\M = C(cid:48) ∩ M, and lecturer capacities are clearly not violated by the algorithm, a new matching M(cid:48) = M ⊕ C(cid:48) can be generated such that ρ(M(cid:48)) (cid:31)L ρ(M ) and M(cid:48) = M = f, a contradiction to the fact that M is a greedy f-matching in I. Considering case (ii) let pm = pred(lk). As before let ρ(cid:48)(pj) and ρ(pj) be the profiles of partial augmenting paths from some exposed student to pj before and after step X respectively. Then ρ(pj) (cid:31)L ρ(cid:48)(pj). Also ρ(pj) = ρ(pm). Since we can also trace a path through all the other projects in C (using pred values and matched edges) from pm to pj, it follows that ρ(pm) = ρ(cid:48)(pj) + ρ(C\{(pj, lk), (pm, lk)}) = ρ(cid:48)(pj) + ρ(C). Thus ρ(pj) = ρ(cid:48)(pj) + ρ(C). Note that ρ(C) = ρ(C(cid:48)\M ) − ρ(C(cid:48) ∩ M ) and C(cid:48) = C ∩ E2 is 15 the set of edges in C involving only students and projects. As ρ(pj) (cid:31)L ρ(cid:48)(pj), it follows that ρ(C(cid:48)\M ) (cid:31)L ρ(C(cid:48) ∩ M ). A similar argument to the one presented above shows a contradiction to the fact that M is a greedy f-matching in I. From Lemmas 3.1, 3.2 and 3.3, we can conclude that the algorithm Greedy-max-spa finds a greedy maximum matching given a spa instance. Concerning the complexity of the algorithm, the main loop calls Get-max-aug η times where η is the size of a maxi- mum cardinality matching in I. The first phase of Get-max-aug performs O(m2) profile comparison operations and O(n3) initialisation steps for the lecturer pred values where m2 = E2, n3 = L, and each profile comparison step requires O(R) time. The loop in the main phase of Get-max-aug runs k times where k is the value of the flow ob- tained at that time. The first and second loops perform O(m2) and O(n2) relaxation steps respectively where n2 = P and each relaxation step requires O(R) time to com- pare profiles. The final phase of the algorithm performs O(n2) profile comparisons, each also taking O(R) time. Thus the overall time complexity of the Get-max-aug method is O(m2R + n3 + kR(m2 + n2) + n2R) = O(kR(m2)). Thus the overall time complexity of the Greedy-max-spa algorithm is O(n2 1Rm2). When considering the additional factor of O(R) due to arithmetic on edge weights of 2 log(n1 + n2) + Rm2(n1 + n2) log2(n1 + n2)) O(nR 1 ) size, Orlin’s algorithm runs in O(Rm2 time. Suppose n1 ≥ n2. Then Orlin’s algorithm runs in O(Rm2 2 log n1 + n1Rm2 log2 n1) time. If the first term of Orlin’s runtime is larger than the second then our algorithm is as m2 ≥ n1. If the second term of Orlin’s runtime is slower by a factor of larger than the first then our algorithm is slower by a factor of Now suppose n2 > n1. Then Orlin’s algorithm runs in O(Rm2 log2 n1 2 log n2 + n2Rm2 log2 n2) time. If the first term of Orlin’s runtime is larger than the second then our algorithm is as m2 ≥ n1 and n2 > n1. If the second slower by a factor of term of Orlin’s runtime is larger than the first then our algorithm is slower by a factor of ≤ n1 ≤ n1 ≤ n1 log n1 m2 log n1 ≤ n1 log n1 log n1 m2 log n2 log n2 n2 1 n2 1 n1 . n2 1 n2 log2 n2 ≤ n1 log2 n2 ≤ n1 log n1 as n2 > n1. So our algorithm is slower than Orlin’s by a factor of in all cases. A straightfor- ward refinement of our algorithm can be made by observing that if no profile is updated during an iteration of the main loop, then no further profile improvements can be made and we can terminate the main loop at this point. We conclude with the following theorem. log n1 n1 Theorem 3.4. Given a spa instance I, a greedy maximum matching in I can be obtained in O(n2 1Rm2) time. 4 Generous maximum matchings in spa Analogous to the case for greedy maximum matchings, generous maximum matchings can also be found by modelling spa as a network flow problem. Given a spa instance I we define the following terms relating to partial augmenting paths in N (I). For each project pj ∈ P, we define the minimum profile of a partial augmenting path from vs through an exposed student to pj with respect to ≺R, denoted Φ(cid:48)(pj), as follows: Φ(cid:48)(pj) = min≺R{ρ(P (cid:48)) : P (cid:48) is a partial augmenting path from vs to pj}. If a partial augmenting path P (cid:48) ending at project pj can be extended to an augmenting path P by adding edges (pj, l(pj)) and (l(pj), vt) then such an augmenting path is called a minimum profile augmenting path if ρ(P ) = min≺R{Φ(cid:48)(pj) : pj ∈ P}. A similar approach to that used to find a greedy maximum matching can be adopted in order to find a generous maximum matching. The main Greedy-max-spa algorithm will remain unchanged (we 16 will call it Generous-max-spa for convenience) as the intuition remains to successively find larger generous k-matchings until a generous maximum matching is obtained. We however make slight changes to the Get-max-aug algorithm in order to find a minimum profile augmenting path in the network should one exist (the resulting algorithm is then known as Get-min-aug). The changes are as follows. (i) We replace all occurrences of left domination (cid:31)L with right domination ≺R. (ii) We also replace all occurrences of negative infinity profile B− R . (iii) Finally we replace both max functions (in lines 45 and 47) with the min function. Analogous statements and proofs of Lemmas 3.1, 3.2 and 3.3 exist in this context. Thus we may conclude with the following theorem concerning the Generous-max-spa algorithm. R with a positive infinity profile B+ Theorem 4.1. Given a spa instance I, a generous maximum matching in I can be ob- tained in O(n2 1Rm2) time. 5 Lecturer lower quotas k and now additionally has a lower quota d− In spa problems it is often required that the workload of supervising student projects is evenly spread across the lecturing staff (i.e., that project allocations are load-balanced with respect to lecturers). This is important because any project allocation should be seen by lecturers to be fair. Moreover a lecturer’s workload may have an effect on her performance in other academic and administrative duties. One way of achieving some notion of load-balancing with respect to lecturers is to introduce lower quotas. A lower quota on lecturer lk is the minimum number of students that must be assigned to lk in any feasible solution. We call this extension the Student/Project Allocation problem with Lecturer lower quotas (spa-l). In an instance I of spa-l, each lecturer lk has an upper quota dk(I)+ = d+ k (I) (it will be helpful to indicate specific instances to which these lower quotas refer within the notation). We assume that d− k (I), 1}. In the spa-l context, our definition of a matching as presented in Section 2 needs to be tightened slightly. A constrained matching is a matching M in the spa context with the additional property that, for each lecturer lk, M (lk) ≥ d− k (I). A constrained maximum matching is a maximum matching taken over the set of constrained matchings in I. Suppose that L is the sum of the lecturer k (I)) and η is the size of a maximum matching in I 1. For some k in (L ≤ k ≤ η), let M(cid:48) k denote the set of constrained matchings of size k in I. A matching M ∈ M(cid:48) k is a constrained greedy k-matching if M has lexicographically maximum profile, taken over all matchings in M(cid:48) k. An analogous definition for a constrained generous k-matching can be made. lower quotas in I (i.e. L =(cid:80) k (I) ≥ 0 and d+ k (I) ≥ max{d− lk∈L d− Due to the introduction of these lecturer lower quotas, instances of spa-l are not guaranteed to admit a feasible solution. Thus given an instance I of spa-l, we seek to find a constrained greedy or a constrained generous maximum matching should one exist. We therefore present results analogous to Lemmas 3.1, 3.2 and 3.3. Firstly however, we make the following observations. Proposition 5.1. Given an spa-l instance I, the size of a constrained maximum matching (should one exist) in I is equal to the size of a maximum matching in the underlying spa instance in I. Proof. Assume I admits a constrained matching. Then, by dropping the upper quota of each lecturer lq ∈ L from d+ q (I), and finding a saturating flow in the net- work obtained from the resulting instance, we can obtain a matching Mk of size k where q (I) to d− 1We will prove that η is equal to the size of a maximum constrained matching in Proposition 5.1 17 students’ preferences: s1 : p1 s2 : p3 s3 : p3 p2 p2 lecturers’ offerings: l1 : {p1} l2 : {p2} l3 : {p3} c1 = c3 = 1, d+ d− 1 = d− 1 = d+ 3 = 0 and d− 2 = 2 3 = 1 and c2 = d+ 2 = 2 Figure 3: A spa-l instance I k =(cid:80) lq∈L d− q . By returning the lecturer upper quotas to their original values and then successively finding and satisfying standard augmenting paths (starting from f (Mk)) we are bound to obtain a constrained maximum matching as lecturers do not lose any as- signed students in the process. The absence of an augmenting path relative to the final flow is proof that the flow (and resulting constrained matching) is maximum. We also observe that a constrained greedy k-matching Mk in I need not be a greedy k-matching in I. That is, there may exist a matching M(cid:48) k of size k in I such that M(cid:48) k violates some of its lecturer lower quotas (i.e. M(cid:48) k is not a constrained matching) and k) (cid:31)L ρ(Mk). Figure 3 shows a spa-l instance whose unique constrained greedy ρ(M(cid:48) maximum matching is M = {(s1, p2), (s2, p2), (s3, p3)} and a greedy maximum matching M(cid:48) = {(s1, p1), (s2, p2), (s3, p3)} such that ρ(M(cid:48)) (cid:31)L ρ(M ). However it is sufficient to show that, starting from Mk, we can successively identify and augment (w.r.t. the incumbent flow) maximum profile augmenting paths in N (I) until a constrained greedy maximum matching is found. Next we show that such augmenting paths exist. Lemma 5.2. Let I be an instance of spa-l and let η denote the size of a constrained maximum matching in I. Let k (1 ≤ k < η) be given and suppose that Mk is a constrained greedy k-matching in I. Let N = N (I) and f = f (Mk). Then there exists an augmenting path P with respect to f in N such that if f(cid:48) is the result of augmenting f along P then Mk+1 = M (f(cid:48)) is a constrained greedy (k + 1)-matching in I. Let M(cid:48) Proof. The proof is analogous to that presented for Lemma 3.1. We show that considering constrained matchings does not affect most of the arguments presented in the proof of Lemma 3.1. We will deal with the cases where considering constrained matchings may affect the arguments presented in the proof of Lemma 3.1. Firstly we observe that after cloning the projects in I to form a spa-l instance I(cid:48) = C(I), the process of converting matchings in I to I(cid:48) and vice versa is unaffected when the matchings considered are con- strained. Thus since Mk is a constrained greedy k-matching in I, C(Mk) is a constrained greedy k-matching in I(cid:48). k+1 be a constrained greedy (k + 1)-matching in I (this exists because k < k+1) is a constrained greedy (k + 1)-matching in I(cid:48). Let X = C(Mk) ⊕ η). Then C(M(cid:48) C(M(cid:48) k+1). Then each connected component of X is either (i) an alternating cycle, (ii)(a) an even-length alternating path whose end vertices are students, (ii)(b) an even-length alternating path whose end vertices are projects, (iii)(a) an odd-length alternating path whose end edges are in C(Mk) or (iii)(b) an odd-length alternating path whose end edges are in C(M(cid:48) k+1). We firstly show that the procedures used to “join” and “eliminate” these connected components in Lemma 3.1 are unaffected when C(Mk) and C(M(cid:48) k+1) are constrained matchings. The even-length components that we firstly consider are: 1. type (i) and type (ii)(a) alternating paths. 2. compound type (ii)(a) paths. 18 We firstly observe that C(Mk) and C(M(cid:48)(cid:48) Let C(M(cid:48)(cid:48) k+1) along all these even-length paths. Then X(cid:48) = C(Mk) ⊕ C(M(cid:48)(cid:48) When considering the elimination of these even-length components (or compound paths), the requirement that the upper quotas of the lecturers involved must not be violated still holds even if the matchings considered are constrained. Moreover the number of students assigned to each lecturer never drops when considering the elimination of these even-length components (or compound paths). k+1) be the constrained greedy (k + 1)-matching obtained from augmenting C(M(cid:48) k+1) consists of a set of compound type(ii)(b) paths, compound type (iii)(a) and compound type (iii)(b) paths. These paths, if considered independently, may lead to some lecturer losing an assigned student when they are used to augment C(Mk) or C(M(cid:48)(cid:48) k+1). Thus the elimination argument, as presented in the proof of Lemma 3.1, does not hold. We modify this argument slightly as follows in the case of constrained matchings. k+1) are constrained matchings. Thus aug- menting C(Mk) or C(M(cid:48)(cid:48) k+1) along X(cid:48) leads to a constrained matching. When all the ele- ments in X(cid:48) are considered together, no lecturer violates her lower quota. If some lecturer loses a student due to some component of X(cid:48) and drops below her lower quota, the she must gain an extra student due to another component in X(cid:48). But since C(M(cid:48)(cid:48) k+1) = C(Mk)+1 there are q compound type (iii)(a) paths and (q +1) compound type (iii)(b) paths in X(cid:48) for some integer q. Compound type (ii)(b) components do not affect the size of the matchings. We claim that there exists some compound type (iii)(b) path P (cid:48) in X(cid:48) such that when considering all the other components in X(cid:48) (i.e. X(cid:48)\P (cid:48)), lecturer upper and lower quotas are not violated and the size of the matchings are unchanged. Thus the elimination arguments presented in the proof of Lemma 3.1 can be applied to X(cid:48)\P (cid:48). P (cid:48) can be k+1(lp) > Mk(lp) ≥ d− extended to end with edge (lp, vt) such that M(cid:48)(cid:48) p . If C(M(cid:48)(cid:48)(cid:48) k+1) is k+1) along X(cid:48)\P (cid:48), the constrained greedy (k +1)-matching obtained from augmenting C(M(cid:48)(cid:48) k+1(lp) ≤ Mk(lp) k+1)⊕ C(Mk) = P (cid:48). If such a path P (cid:48) does not exist then M(cid:48)(cid:48) then C(M(cid:48)(cid:48)(cid:48) for all lp ∈ L, a contradiction. The rest of the proof for Lemma 3.1, involving the generation of an augmenting path, follows through. Lemma 5.3. Let f be a flow in N and let Mk = M (f ). Suppose that Mk is a constrained greedy k-matching. Let P be a maximum profile augmenting path with respect to f . Let f(cid:48) be the flow obtained by augmenting f along P . Now let Mk+1 = M (f(cid:48)). Then Mk+1 is a constrained greedy (k + 1)-matching. Proof. The proof for Lemma 3.2 holds even if M (f ) and M (f(cid:48)) are constrained matchings as the number of students assigned to a lecturer never reduces as we augment f along P . Lemma 5.4. Given an spa-l instance I, let f be a flow in N (I) where k = f is not the size of a constrained maximum matching in I and M (f ) is a constrained greedy k- matching in I. Algorithm Get-max-aug finds a maximum profile augmenting path in N (I) with respect to f . Proof. We observe that the proof presented for Lemma 3.3 also holds in this case even if M (f ) is a constrained greedy k-matching. The first part of the proof shows that after q iterations of the main loop of Get-max-aug where 0 ≤ q ≤ k, ρ(pj) (cid:23)L Φ2q+1,2q(pj) for every project pj ∈ P where Φ2q+1,2q(pj) is the maximum profile of any partial augmenting path of length ≤ (2q + 1, 2q) from an exposed student to pj. By inspection, we observe that this argument remains unchanged even if M (f ) is a constrained matching in I. 19 k (I); k (I(cid:48)) = d− k (I(cid:48)) = 0; set d+ 3: set d− 4: 5: end for 6: {I(cid:48) becomes a spa instance} 7: M(cid:48) = Greedy-max-spa(I(cid:48)); 8: if M(cid:48) = (cid:80) lk∈L d− k (I) then copy f (M(cid:48)) in N (I(cid:48)) into f in N (I); loop P = Get-max-aug(N (I), f ); if P (cid:54)= null then augment f along P ; else return M (f ); Algorithm 3 Greedy-max-spa-l Require: spa-l instance I; Ensure: return a matching M if one exists or null otherwise; 1: copy I to from new instance I(cid:48); 2: for all lecturer lk ∈ I(cid:48) do 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: else 19: 20: end if end if end loop return null; The second part of the proof shows that a partial augmenting path P (cid:48) (and sub- sequently a full augmenting path) can be constructed by following the pred values of projects and lecturers and the matched edges in M (f ) starting from some exposed project pj with the maximum ρ(pj) profile going through some exposed student and ending at the source vs. That is, we show that such a path is continuous and contains no cycle. We prove this by demonstrating that, should a cycle C exist, then augmenting f along C would yield a flow of the same size f(cid:48) such that M (f(cid:48)) (cid:31)L M (f ) which is a contradiction to the fact that M (f ) is a greedy k−matching. This result also holds in the case where M (f ) is a constrained matching as any cycle found will not cause a lecturer to lose any assigned students and so the above arguments can still be made. Given Lemmas 5.2, 5.3 and 5.4, the Greedy-max-spa algorithm can be employed as part of an algorithm to find a constrained greedy maximum matching in a spa-l instance should one exist. This new algorithm (which we call Greedy-max-spa-l) is presented in Algorithm 3. The algorithm takes an spa-l instance I as input and returns a constrained greedy maximum matching M , should one exist, or null otherwise. A spa instance I(cid:48) is constructed from I by setting d− k (I) for each lecturer lk. Next we find a greedy maximum matching M(cid:48) in I(cid:48) using the Greedy-max-spa algorithm. If f(cid:48) = f (M(cid:48)) is not a saturating flow (i.e., one in which all edges (lk, vt) ∈ E4 are saturated), then I admits no constrained matching and we return null. Otherwise we augment flow f in N (I) by calling the Get-max-aug algorithm, where f is the flow in N (I) obtained from cloning f(cid:48) in N (I(cid:48)). We continuously augment the flow until no augmenting path exists. The matching M = M (f ) obtained from the resulting flow f is a greedy maximum constrained matching in I. Constrained generous maximum matchings can also be found in a similar way. We conclude with the following theorem. k (I(cid:48)) = 0 and d+ k (I(cid:48)) = d− Theorem 5.5. Given a spa-l instance I, a constrained greedy maximum matching and a constrained generous maximum matching in I can be obtained, should one exist, in O(n2 1Rm2) time. 20 lk∈L d− since f =(cid:80) Proof. Firstly we show that the matching M(cid:48) obtained in Line 7 of the Greedy-max-spa-l algorithm is a constrained greedy f-matching in I. Suppose otherwise and some other constrained matching M(cid:48)(cid:48) of the same size exists in I such that ρ(M(cid:48)(cid:48)) (cid:31)L ρ(M(cid:48)). Then k (I), every lecturer has exactly the same number of assigned students in M(cid:48) and M(cid:48)(cid:48) so M(cid:48)(cid:48) is a valid matching in I(cid:48). This contradicts the fact that M(cid:48) is a greedy maximum matching in I(cid:48). Lemmas 5.2, 5.3 and 5.4 prove that once we obtain a constrained greedy f-matching in I (should one exist), the rest of the algorithm finds a maximum constrained greedy maximum matching in I. For finding a constrained generous maximum matching we simply replace the call to Greedymaxspa in Line 7 and the call to Get-max-aug in Line 11 of the Greedy-max-spa-l algorithm with a call to the Generous-max-spa and the Get-min-aug algorithms respec- tively as described in Section 4. 6 Empirical evaluation 6.1 Introduction The Greedy-Max-Spa and Generous-Max-Spa algorithms were implemented in Java and evaluated empirically. In this section, we present results from empirical evaluations carried out on the algorithm implementations using both real-world and randomly-generated data. Results from the implemented algorithms were compared with those produced by an IP model of spa in order to improve our confidence in the correctness of both implementations. We also investigate the feasibility issues that will be faced if a Min-Cost-Max-Flow (mcmf) approach (as suggested in [29]) is to be used when solving instances of spa involving large numbers of students and projects or were students have long preference lists. Other experiments carried out involve varying certain properties of the randomly-generated spa instances while measuring the runtime of the algorithms and the size, degree and cost of the matchings produced. An instance generator was used to construct random spa instances which served as input for the algorithm implementations. This generator can be configured to vary certain properties of the spa instances produced as follows: 1. The number of students n1 (with a default value of n1 = 100). The number of projects and lecturers are set to n2 = 0.3n1 and n3 = 0.3n1 respectively. 2. The minimum Rmin and maximum Rmax length of any student’s preference list (with default values Rmin = Rmax = 10). 3. The popularity λ of the projects, as measured by the ratio between the number of students applying for one of the most popular projects and the number of students applying for one of the least popular projects (default value of 5). 4. The total capacity of the projects CP and lecturers CL. These capacities were not divided evenly amongst the projects and lecturers involved (default values are CP = 1.2n1 and CL = 1.2n1). 5. The tie density td (0 ≤ td ≤ 1) of the students’ preference list. This is the probability that some project is tied with the one preceding it on some student’s preference list (default value is td = 0). 21 6. The total project and lecturer lower quotas LP and LL respectively. These lower quotas were divided evenly amongst the projects and lecturers involved (default values are LP = LL = 0). We also created spa instances from anonymised data obtained from previous runs of the student-project allocation scheme at the School of Computing Science, University of Glasgow and solved them using the implemented algorithms. We measured the runtime taken by the algorithms as well as the size, cost and degree of the matchings obtained. Experiments were carried out on a Windows machine with 4 Intel(R) Core(R) i5-2400 CPUs at 3.1GHz and 8GB RAM. In the following subsections we present results obtained from the empirical evaluations carried out. In Section 6.2 we present the results of correctness tests carried out by comparing results obtained from IP models of spa and implemented algorithms. In Section 6.3 we demonstrate when the mcmf approach becomes infeasible in practice. In Section 6.4 we present results from running the algorithms against real-world spa instances. In Section 6.5 we vary certain properties of randomly generated spa instances while measuring the runtime of the algorithms and the size, degree and cost of the matchings produced. We make some concluding remarks in Section 6.6. 6.2 Testing for correctness Although the Greedy-Max-Spa and Generous-Max-Spa algorithms have been proven to be correct (See Theorems 3.4 and 4.1), bugs may still exist in the implementations. In order to improve our confidence in any empirical results obtained as part of an experimental evaluation of the algorithms’ performance, we compared results from the implemented algorithms with those obtained from IP models of spa. For each value of n1 in the range n1 ∈ {20, 40, 60, ..., 200, 300, 400, ..., 1000}, 10, 000 random spa instances were generated and solved using both methods. For each spa instance generated, Rmin = Rmax = 10 (henceforth we refer to Rmin = Rmax as R). The profiles of the resulting matchings were then compared and observed to be identical for all the instances generated. The resulting matchings were also tested to ensure they obeyed all the upper quota constraints for lecturers and projects. These correctness tests show that our implementations are likely to be correct. 6.3 Feasibility analysis of the mcmf approach We implemented an algorithm for finding a minimum cost maximum flow in a given network. As stated in [2, 29], by the appropriate assignment of edge costs/weights in the underlying network N (I) of a spa instance I, a minimum cost maximum flow algorithm can be used to find greedy and generous maximum matchings in I. We argued that this approach (as described in [2, 29]) would be infeasible due to the floating-point inaccuracies caused by the assignment of exponentially large edge costs/weights in the network. In this section we investigate this claim experimentally and demonstrate the feasibility issues that arise when using various Java data types to represent these edge weights. Firstly we describe the cost functions required by a minimum cost maximum flow algorithm to find greedy and generous maximum matchings. For finding greedy maximum 1 − nR−k matchings we set the cost of an edge between a student si and a project pj as nR−1 where k = rank(si, pj). For finding generous maximum matchings we set the cost of an edge between a student si and a project pj as nk−1 1 where k = rank(si, pj). The cost for all other edges in the network are set to 0. 1 For the mcmf approach, we define an instance as infeasible if the matching pro- duced is not optimal with respect to the greedy or generous criteria (when compared 22 with optimal results produced by the Greedy-Max-Spa and Generous-Max-Spa algorithms and CPLEX). We also consider an instance infeasible if the JVM runs out of mem- ory when using the mcmf algorithm but does not when using the Greedy-Max-Spa and Generous-Max-Spa algorithms. Figure 4: mcmf feasibility results Figure 4 shows the feasibility results using three Java data types. For each value of n1 (number of students) in the range n1 ∈ {10, 20, 30, ..., 100} and for each value of R (length of each student’s preference list) in the range R ∈ {5, 6, ..., min{20, 1.2n1}}, we generated 1000 random spa instances and solved them using the mcmf approach and the Greedy-Max-Spa algorithm. The graph shows the value of R at which infeasible solutions were first encountered. As expected, this number drops as we increase the instance size. Due to their greater precision that the long and double data types (when compared with int), we see that they handle much larger instances before encountering infeasibility issues. All instances tested for n1 = 10 when using long and n1 ∈ {10, 20, 30, 40} when using double produced optimal matchings. This is probably because we do not yet encounter range errors (in the case of long) and precision errors (in the case of double) when solving these instances. The relatively low values of R and n1 observed where infeasibility prevails (e.g., n1 = 60, R = 6 for the int type) reinforces our argument that approaches based on mcmf which employ these exponentially large edge weights are not scalable. 6.4 Real-world data spa instances derived from anonymised data obtained from previous runs of the student- project allocation scheme at the School of Computing Science, University of Glasgow were created and solved using the Greedy-max-spa algorithm. This section discusses some of the results obtained. Table 1 shows the properties of the generated spa instances (with lecturer capacities not being considered in the 07/08 and 08/09 sessions) and Table 2 shows details of various profile-based optimal matchings found. The results demonstrate a drawback in adopting the greedy optimisation criterion, namely that some students may have projects that are far down their preference lists. In all but the 2011/2012 session, at least one student had her worst-choice project in a greedy maximum matching. In the 2013/2014 session the number of students with their worst- choice project is reasonably high and so the greedy maximum matching would probably not be selected for that year. The degree of generous maximum matchings are usually less than the others (obviously they are never greater). This is usually an attractive property in such matching schemes. In all the years considered apart from the 2013/2014 session all students got their third 23 Session n1 n2 147 14/15 155 13/14 133 12/13 11/12 103 63 10/11 102 09/10 08/09∗ 56 07/08∗ 61 51 51 38 31 34 32 37 35 n3 R CP CL 80 37 77 40 63 34 26 62 66 29 72 28 - 56 61 - 147 155 133 103 63 102 56 61 6 5 5 5 5 5 5 5 Table 1: Real-world spa instances Session M Greedy Profile (30, 7, 1, 5, 5, 3) (26, 7, 4, 6, 8) (26, 6, 3, 2, 1) (22, 6, 2, 1) (25, 4, 3, 1, 1) (23, 4, 2, 2, 1) (26, 6, 2, 1, 2) (20, 9, 5, 0, 1) 14/15 13/14 12/13 11/12 10/11 09/10 08/09∗ 07/08∗ 51 51 38 31 34 32 37 35 Generous Min-Cost Cost Profile 110 116 60 44 51 50 58 58 (16, 16, 9, 6, 4) (15, 18, 9, 6, 3) (21, 13, 4) (20, 9, 2) (21, 9, 4) (19, 10, 3) (23, 11, 3) (17, 14, 4) Cost Profile 119 117 59 44 51 48 54 57 (28, 11, 3, 5, 2, 2) (23, 12, 5, 6, 5) (23, 11, 3, 1) (20, 9, 2) (24, 5, 4, 1) (20, 9, 2, 1) (23, 11, 3) (17, 14, 4) Cost 101 111 58 44 50 48 54 57 Table 2: Real-world spa results choice project or better in the generous maximum matchings produced. However in the 2013/2014 session applying the generous optimality criterion did not improve on the degree of the matchings produced. One of the major advantages of the minimum cost maximum matching optimality criterion is that in a certain sense it is more “egalitarian”. Minimising the overall cost of the matchings produced is also a very natural objective. It may be considered a disadvantage if matchings obtained by adopting the profile-based optimality criteria have significantly larger costs than the minimum obtainable cost. However, from the results obtained on these real-world datasets, there is very little difference between the costs of the greedy and generous maximum matchings and the minimum obtainable costs (except, once again, for the 2013/2014 session). Thus we can choose one of the profile-based optimal matchings with some confidence that it is “almost” of minimum cost. In Section 6.5 we consider these differences on multiple randomly generated spa instances. 6.5 Randomly-generated instances 6.5.1 Introduction This section discusses some of the results obtained by varying certain properties of the randomly generated spa instances and measuring the cost, size and degree of the matchings produced. For each instance generated we found a greedy maximum matching, a generous maximum matching and a minimum cost maximum matching. 24 6.5.2 Varying the number of students Keeping R constant, we investigated the effects of increasing the number of students n1 (and by implication n2, n3, CP and CL using the default dependencies listed in Section 6.1) on the degree, cost and size of the matchings produced as well as the time taken to find these matchings. For each value of n1 in the range n1 ∈ {100, 200, 300, ..., 700} we generated and solved 100 random spa instances. Figure 5: Mean matching degree vs n1 Figure 6: Mean algorithm runtime vs n1 Figure 5 shows the way the mean degree varies as we increase the number of students. The mean degrees of the greedy maximum matchings are the highest of the three with mean values ≥ 8 for n1 > 200. As expected generous maximum matchings have the smallest degree, which rises slowly from about 4.8 to 6.5. An interesting observation is that the mean degree does not steeply rise as we increase the number of students. Also the mean degree for the minimum cost maximum matching is closer to the generous maximum matching degree than that of the greedy maximum matching. This is probably due to the fact that the cost function (rank in this case) is greater for higher degrees than lower ones, so, in some way, by minimising the cost, we are also seeking matchings with fewer students matched to projects that are father down their preference lists (i.e. have higher ranks). Figure 6 shows how long it takes to find both profile-based optimal matchings. The main observation is that both Greedy-max-spa and Generous-max-spa algorithms are scalable and can handle decent-sized instances in reasonable times. Figure 7 shows how the cost of the matchings generated vary with the number of stu- dents. The cost seems to grow proportionally with the number of students. We observe that greedy maximum matchings have larger costs than generous and minimum cost max- imum matchings. This corresponds to the mean degree curves shown in Figures 5 where greedy maximum matchings tend to match some students to projects further down their preference list thus adding to the cost of the matching. The average size of the matchings produced was very close to n1 for all values of n1 tested. 6.5.3 Varying preference list length The length of students’ preference list is one property that can be varied easily in practice (in the spa context, it is often feasible to ask students to rank more projects if required). So, will increasing the length of the preference lists affect the quality of the matchings pro- duced or the time taken to find them? For each value of R in the range R ∈ {1, 2, 3, ..., 10} we tested this by varying the preference list lengths of 1, 000 randomly generated spa 25 Figure 7: Mean matching cost vs n1 instances. Each instance had n1 = 100 students (with n2, n3, CP and CL all assigned their default values). Figure 8: Mean matching cost vs R Figure 9: Mean matching size vs R Figure 8 shows how the mean cost of the matchings obtained varied as we increased the preference list lengths. For the profile-based optimal matchings, the mean cost rises steeply from R = 1 to R = 4 but seems to level off beyond that. We observe that the overall cost of the matchings produced does not significantly change for R > 5. Thus asking students to submit preference lists greater than 5 will not significantly affect the overall quality of the generous and minimum cost maximum matchings obtained. Once again we observe a difference between the cost of the greedy maximum matchings and the other two. Figure 9 also shows an important trend as it highlights the value of R beyond which there is little increase in the mean matching size of profile-based optimal matchings. For the instances generated in this experiment, that value is R = 5. Thus asking students to submit preference lists of length greater than 5 will not significantly affect the overall size of maximum matchings obtained. Figure 10 shows how the mean degree of the matchings varied as we increased preference list length. For values of R ≤ 3 all matchings have the same mean degree as it is likely that some student gets her 3rd choice in each of these matchings. The curve for minimum cost maximum matchings is closer (with respect to degree) to that of generous maximum matchings (obviously generous maximum matchings 26 have lower degrees in general). They both seem to rise steeply for R ≤ 5 and then level off at R = 7 and beyond. Thus asking students to submit preference lists greater than 7 will not significantly affect the overall degree of generous and minimum cost maximum matchings obtained. As expected, greedy maximum matchings had the highest degrees. For R > 5, the mean degree for greedy maximum matchings does not level off but continues to grow fairly steeply. Figure 10: Mean matching degree vs R Finally we consider how long it takes for the implemented algorithms to find their solutions. In general, the algorithms all seem to handle spa instances with relatively long preference lists (R = 10) in reasonable time (< 1.5s). 6.5.4 Varying project popularity Not all projects will be equally popular and so it is worth investigating the effects the relative popularity λ of the projects may have on the size and quality of the matchings produced. For these experiments, we set n1 = 100 (with all the other default values) and varied the popularity of the projects involved from 0 to 9 in steps of 1, generating 1, 000 random instances for each popularity value. From Figure 11 we see that the cost of the matchings produced gradually increases as we increase the popularity ratio with the cost of the greedy maximum matching being slightly higher than the others (in line with other observations). From Figure 12 we observe no clear trend in the size of the matchings produced as we vary the popularity ratio. Figure 13 shows the gaps between the mean degree of matchings produced using the various algorithms. Once again we see the mean degrees for the minimum cost and generous maximum matchings being considerably lower than that of the generous maxi- mum matchings as the popularity ratio increases. Runtimes for the Greedy-max-spa and Generous-max-spa algorithms were less than 0.25s. 6.6 Concluding remarks Table 3 gives a breakdown of the profiles of 10, 000 randomly generated spa instances of size n1 = 100 with preference list length R = 10. It shows the percentage of students with their first choice projects, second choice projects, and so on for greedy, generous and minimum cost maximum matchings (represented by M1, M2 and M3 respectively). Although the choice of which profile-based optimal matching is best will, in practice, be problem-specific, the results (as presented in Sections 6.4 and 6.5) give us a general idea 27 Figure 11: Mean matching cost vs Figure 12: Mean matching size vs popularity popularity Figure 13: Mean matching degree vs popularity of the strengths and weaknesses of the various optimality criteria. We summarise these points below. 1st 67.94 53.07 61.88 2nd 18.16 38.24 26.84 3rd 7.00 8.68 9.31 4th 3.14 0.00 1.85 5th 1.63 0.00 0.13 6th 0.90 0.00 0.00 7th 0.55 0.00 0.00 8th 0.34 0.00 0.00 9th 0.21 0.00 0.00 10th Cost 0.14 0.00 0.00 161.23 155.62 151.51 M1: M2: M3: Table 3: Mean matching profile and cost With greedy maximum matchings we increase the percentage of students that are happy with their assigned projects (i.e., obtain their first choice). A rough estimate of how much better a greedy maximum matching is compared with other profile-based optimal matchings is the difference in the number of first-choice projects. Table 3 shows that the percentage of students with their first-choice project is higher when compared with minimum cost maximum matchings (by 6.06%) and significantly higher when compared with greedy maximum matchings (by 14.87%). However this is achieved at the risk of also increasing the percentage of students who are disappointed with their assigned projects 28 (we say a student si is disappointed with pj = M (si) if rank(si, pj) > (cid:100)R/3(cid:101)). With generous maximum matchings we reduce the percentage of disappointed stu- dents. A rough estimate of how much better off a student is in a generous maximum matching compared with a greedy maximum matching, is the difference in the degree of the matchings. Table 3 shows a significant improvement in the degree as we move from greedy maximum matchings (with some matchings having a degree of 10) and generous maximum matchings (with all matchings having a degree ≤ 3). Although this is usually a very attractive property, this is achieved without considering the percentage of students who are happy with their assignments. Interestingly the generous criterion will continue to attempt to minimise the number of students matched to their nth choice project even as n tends to 1. This motivates a hybrid version of profile-based optimality where we initially adopt the generous criterion and, at some point (say for rth choice projects where r ≤ 3), switch to the greedy criterion. Often the profile of a minimum cost maximum matching lies “in between” the two extremes given by a greedy maximum and generous maximum matching. This can be seen in terms of both the percentage of students with first-choice projects and the degree of the matchings. In terms of the percentage of students with first-choice projects, the results show that minimum cost maximum matchings lie almost halfway between greedy and generous maximum matching percentages. In terms of the degree of the matchings, it seems that minimum cost maximum matchings are a lot closer to generous than greedy maximum matchings. This is usually seen as a desirable property. 7 Conclusion In this paper we investigates the Student / Project Allocation problem in the context of profile-based optimality. We showed how greedy and generous maximum matchings can be found efficiently using network flow techniques. We also presented a range of empirical results obtained from evaluating these efficient algorithms. An obvious question to ask at this stage relates to which other extensions of spa of practical relevance or theoretical significance can be investigated. These include: 1. Can we improve on the O(n2 1Rm2) algorithm for finding greedy and generous max- imum matchings in spa? One approach would be to determine whether there are faster ways of finding maximum profile augmenting paths in the underlying network than that presented in Algorithm 2. Another approach may be perhaps to abandon the network flow method and consider adopting other techniques used for solving similar problems in the chat context [14, 22, 11]. 2. The notion of Pareto optimality has been well studied in the ha context [1, 3]. It is easy to see that the profile-based optimality criteria defined here imply Pareto optimality. However studying Pareto optimality in its own right is of theoretical interest. Since Pareto optimal matchings in chat can be of varying sizes, this extends to spa. Given a spa instance we may seek to find a maximum Pareto optimal matching in time faster than O(n2 1Rm2). References [1] A. Abdulkadiroglu and T. Sonmez. Random serial dictatorship and the core from random endowments in house allocation problems. Econometrica, 66(3):689–701, 1998. 29 [2] D. J. Abraham. Algorithmics of two-sided matching problems. Master’s thesis, Uni- versity of Glasgow, Department of Computing Science, 2003. [3] D. J. Abraham, K. Cechl´arov´a, D. F. Manlove, and K. Mehlhorn. Pareto optimality in house allocation problems. In Proceedings of ISAAC 2004: the 15th Annual Inter- national Symposium on Algorithms and Computation, volume 3341 of Lecture Notes in Computer Science, pages 3–15. Springer, 2004. [4] D. J. Abraham, R.W. Irving, and D. F. Manlove. Two algorithms for the Student- Project allocation problem. Journal of Discrete Algorithms, 5(1):79–91, 2007. [5] A. H. Abu El-Atta and M. I. Moussa. Student project allocation with preference lists over (student,project) pairs. In Proceedings of ICCEE 09: the Second International Conference on Computer and Electrical Engineering, pages 375–379. IEEE, 2009. [6] A.A. Anwar and A.S. Bahaj. Student project allocation using integer programming. IEEE Transactions on Education, 46(3):359–367, 2003. [7] J. Dye. A constraint logic programming approach to the stable marriage problem and its application to student-project allocation. BSc Honours project dissertation, University of York, Department of Computer Science, 2001. [8] L.R. Ford and D.R. Fulkerson. Flows in Networks. Princeton University Press, 1962. [9] D. Gusfield and R.W. Irving. The Stable Marriage Problem: Structure and Algo- rithms. MIT Press, 1989. [10] P.R. Harper, V. de Senna, I.T. Vieira, and A.K. Shahani. A genetic algorithm for the project assignment problem. Computers and Operations Research, 32:1255–1265, 2005. [11] C.-C. Huang, T. Kavitha, K. Mehlhorn, and D. Michail. Fair matchings and related problems. In Proceedings of FSTTCS 2013: the 33rd International Conference on Foundations of Software Technology and Theoretical Computer Science, volume 24, pages 339–350. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, 2013. [12] A. Hylland and R. Zeckhauser. The efficient allocation of individuals to positions. Journal of Political Economy, 87(2):293–314, 1979. [13] R.W. Irving. Greedy matchings. Technical Report TR-2003-136, University of Glas- gow, Department of Computing Science, 2003. [14] R.W. Irving. Greedy and generous matchings via a variant of the Bellman-Ford algorithm. Unpublished manuscript, 2006. [15] R.W. Irving, T. Kavitha, K. Mehlhorn, D. Michail, and K. Paluch. Rank-maximal matchings. ACM Transactions on Algorithms, 2(4):602–610, 2006. [16] K. Iwama, S. Miyazaki, and H. Yanagisawa. Improved approximation bounds for the student-project allocation problem with preferences over projects. Journal of Discrete Algorithms, 13:59–66, 2012. [17] B. A. Kassa. A linear programming approach for placement of applicants to academic programs. SpringerPlus, 2(1):1–7, 2013. [18] D. Kazakov. Co-ordination of student-project allocation. Manuscript, University of York, Department of Computer Science, 2002. 30 [19] G. Han L. Pan, S. C. Chu and J. Z. Huang. Multi-criteria student project allocation: A case study of goal programming formulation with dss implementation. In Proceedings of ISORA 2009: The Eighth International Symposium on Operations Research and Its Applications, Zhangjiajie, China, pages 75–82, 2009. [20] D. F. Manlove. Algorithmics of Matching Under Preferences. World Scientific, 2013. [21] D. F. Manlove and G. O’Malley. Student project allocation with preferences over projects. Journal of Discrete Algorithms, 6:553–560, 2008. [22] K. Mehlhorn and D. Michail. Network problems with non-polynomial weights and applications. Unpublished manuscript, 2006. [23] J.B. Orlin. A faster strongly polynomial minimum cost flow algorithm. Operations Research, 41(2):338–350, 1993. [24] H. M. Saber and J. B. Ghosh. Assigning students to academic majors. Omega, 29(6):513 – 523, 2001. [25] C.T.S. Sng. Efficient Algorithms for Bipartite Matching Problems with Preferences. PhD thesis, University of Glasgow, Department of Computing Science, 2008. [26] C. Y. Teo and D. J. Ho. A systematic approach to the implementation of final year IEEE Transactions on project in an electrical engineering undergraduate course. Education, 41(1):25–30, 1998. [27] M. Thorn. A constraint programming approach to the student-project allocation problem. BSc Honours project dissertation, University of York, Department of Com- puter Science, 2003. [28] S. Varone and D. Schindl. Course opening, assignment and timetabling with stu- dent preferences. In Proceedings of ICORES: International Conference on Operations Research and Enterprise Systems, 2013. [29] M. Zelvyte. The student-project allocation problem using network flow. BSc Honours project dissertation, University of Glasgow, School of Mathematics and Statistics, 2014. [30] L. Zhou. On a conjecture by Gale about one-sided matching problems. Journal of Economic Theory, 52(1):123–135, 1990. 31
1811.09126
2
1811
2018-11-26T02:10:08
Utilizing Dynamic Properties of Sharing Bits and Registers to Estimate User Cardinalities over Time
[ "cs.DS" ]
Online monitoring user cardinalities (or degrees) in graph streams is fundamental for many applications. For example in a bipartite graph representing user-website visiting activities, user cardinalities (the number of distinct visited websites) are monitored to report network anomalies. These real-world graph streams may contain user-item duplicates and have a huge number of distinct user-item pairs, therefore, it is infeasible to exactly compute user cardinalities when memory and computation resources are limited.Existing methods are designed to approximately estimate user cardinalities, whose accuracy highly depends on parameters that are not easy to set. Moreover, these methods cannot provide anytime-available estimation, as the user cardinalities are computed at the end of the data stream. Real-time applications such as anomaly detection require that user cardinalities are estimated on the fly. To address these problems, we develop novel bit and register sharing algorithms, which use a bit array and a register array to build a compact sketch of all users' connected items respectively. Compared with previous bit and register sharing methods, our algorithms exploit the dynamic properties of the bit and register arrays (e.g., the fraction of zero bits in the bit array at each time) to significantly improve the estimation accuracy, and have low time complexity (O(1)) to update the estimations each time they observe a new user-item pair. In addition, our algorithms are simple and easy to use, without requirements to tune any parameter. We evaluate the performance of our methods on real-world datasets. The experimental results demonstrate that our methods are several times more accurate and faster than state-of-the-art methods using the same amount of memory.
cs.DS
cs
Utilizing Dynamic Properties of Sharing Bits and Registers to Estimate User Cardinalities over Time Pinghui Wang1,2, Peng Jia1, Xiangliang Zhang3, Jing Tao1,2,4, Xiaohong Guan2,1,5, Don Towsley6 1MOE Key Laboratory for Intelligent Networks and Network Security, Xi'an Jiaotong University, China 2Shenzhen Research Institute of Xi'an Jiaotong University, Shenzhen, China 3King Abdullah University of Science and Technology, Thuwal, SA 4Zhejiang Research Institute of Xi'an Jiaotong University, Hangzhou, China 5Department of Automation and NLIST Lab, Tsinghua University, Beijing, China 6School of Computer Science, University of Massachusetts Amherst, MA, USA Email: {phwang, jtao, xhguan, pengjia}@sei.xjtu.edu.cn, [email protected], [email protected] Abstract -- Online monitoring user cardinalities (or degrees) in graph streams is fundamental for many applications. For example in a bipartite graph representing user-website visiting activities, user cardinalities (the number of distinct visited websites) are monitored to report network anomalies. These real-world graph streams may contain user-item duplicates and have a huge number of distinct user-item pairs, therefore, it is infeasible to exactly compute user cardinalities when memory and compu- tation resources are limited. Existing methods are designed to approximately estimate user cardinalities, whose accuracy highly depends on parameters that are not easy to set. Moreover, these methods cannot provide anytime-available estimation, as the user cardinalities are computed at the end of the data stream. Real- time applications such as anomaly detection require that user cardinalities are estimated on the fly. To address these problems, we develop novel bit and register sharing algorithms, which use a bit array and a register array to build a compact sketch of all users' connected items respectively. Compared with previous bit and register sharing methods, our algorithms exploit the dynamic properties of the bit and register arrays (e.g., the fraction of zero bits in the bit array at each time) to significantly improve the estimation accuracy, and have low time complexity (O(1)) to update the estimations each time they observe a new user- item pair. In addition, our algorithms are simple and easy to use, without requirements to tune any parameter. We evaluate the performance of our methods on real-world datasets. The experimental results demonstrate that our methods are several times more accurate and faster than state-of-the-art methods using the same amount of memory. I. INTRODUCTION Many real-world networks are given in the form of graph streams. Calling network is such an example with nodes representing users and an edge representing a call from one user to another. When web surfing activities are modeled as a bipartite graph stream where users and items refer to network hosts and websites respectively, an edge represents a visit by a user to a website. Monitoring the cardinalities (or degrees) of users in these networks is fundamental for many applications such as network anomaly detection [17], [54], [36], [51], where a user's cardinality is defined to be *Peng Jia, Jing Tao and Xiaohong Guan are corresponding authors. the number of distinct users/items that the user connects to in the regular/bipartite graph stream of interest. Due to the large-size and high-speed nature of these graph streams, it is infeasible to collect the entire graph especially when the computation and memory resources are limited. For example, network routers have fast but very small memories, which leads their traffic monitoring modules incapable to exactly compute the cardinalities of network users. Therefore, it is important to develop fast and memory efficient algorithms to approximately compute user cardinalities over time. Compared with using a counter to record a user's frequency (i.e., the number of times the user occurred) over time, one needs to build a hash table of distinct occurred edges to handle edge duplicates in graph streams when computing user cardinalities. Therefore, computing user cardinalities is more complex and difficult than computing user frequencies for large data streams, and frequency estimation methods such as Count-Min sketch [10] fails to approximate user cardinalities. To address this challenge, a variety of cardinality estimation methods such as Linear-Time Probabilistic Count- ing (LPC) [46] and HyperLogLog (HLL) [19] are developed to approximately compute cardinalities. An LPC/HLL sketch consists of m bits/registers, where m is a parameter affecting the estimation accuracy. Since user cardinalities are not known in advance and change over time, one needs to set m large (e.g., thousand) to achieve reasonable accuracy for each user, whose cardinality may vary over a large range. However, this method wastes considerable memory because a large value of m is not necessary for most users, which have small cardinalities. To solve this problem, [54], [50], [43], [47] develop different virtual sketch methods to compress each user's LPC/HLL sketch into a large bit/register array shared by all users. These virtual sketch methods build each user's virtual LPC/HLL sketch using m bits/registers randomly selected from the large bit/register array. This significantly reduces memory usage because each bit/register may be used by more than one user. However, bits/registers in a user's virtual LPC/HLL sketch may be contaminated by other users. We refer to these bits/registers as "noisy" bits/registers. In practice, most users have small cardinalities and their virtual LPC/HLL sketches tend to contain many "noisy" bits/registers, which results in large estimation errors. Another limitation of existing methods is that they are unable to report user cardinalities on the fly, because they are customized to estimate user cardinalities after all the data has been observed. For real-time applications like on-line anomaly detection, it is important to track user cardinalities in real-time. For example, network monitoring systems are required to detect abnormal IP addresses such as super spreaders (i.e., IP addresses with cardinalities larger than a specified threshold) on the fly. More- over, online monitoring of IP address cardinalities over time also facilitates online detection of stealthy attacks launched from a subclass of IP addresses. To address the above challenges, we develop two novel streaming algorithms FreeBS and FreeRS to accurately es- timate user cardinalities over time. We summarize our main contributions as: • Compared with previous bit and register sharing meth- ods, our algorithms FreeBS and FreeRS exploit the dynamic properties of the bit and register arrays over time (e.g., the fraction of zero bits in the bit array at each time) to signifi- cantly improve the estimation accuracy. To be more specific, FreeBS/FreeRS allows the number of bits/registers used by a user to dynamically increase as its cardinality increases over time and each user can use all shared bits/registers, which results in more accurate user cardinality estimations. • Our algorithms report user cardinality estimations on the fly and allow to track user cardinalities in real-time. The time complexity is reduced from O(m) in state-of-the-art methods CSE [50] and vHLL [47] to O(1) for updating user cardinality estimations each time they observe a new user-item pair. • We evaluate the performance of our methods on real-world datasets. Experimental results demonstrate that our methods are orders of magnitude faster and up to 10,000 times more accurate than state-of-the-art methods using the same amount of memory. The rest of this paper is organized as follows. The problem formulation is presented in Section II. Section III introduces preliminaries. Section IV presents our algorithms FreeBS and FreeRS. The performance evaluation and testing results are presented in Section V. Section VI summarizes related work. Concluding remarks then follow. II. PROBLEM FORMULATION To formally define our problem, we first introduce some notation. Let Γ = e(1)e(2) ··· be the graph stream of interest consisting of a sequence of edges. Note that an edge in Γ may appear more than once. In this paper, we focus on bipartite graph streams consisting of edges between users and items. Our methods however easily extend to regular graphs. Let S and D denote the user and item sets, respectively. For t = 1, 2, . . ., let e(t) = (s(t), d(t)) denote the tth edge of Γ, where s(t) ∈ S and d(t) ∈ D are the user and the item of e(t) respectively. Let N (t) denote the set of distinct items s n(t) = (cid:80) that user s connects to before and including time t. Define s = N (t) s to be the cardinality of user s at time t. Then, n(t) s∈S N (t) s is the sum of all user cardinalities at time t. In this paper, we develop fast and accurate methods for estimating user cardinalities at times t = 1, 2, . . . using a limited amount of memory. When no confusion arises, we omit the superscript (t) to ease exposition. III. PRELIMINARIES A. Estimating a Single User's Cardinality 1) Linear-Time Probabilistic Counting: For a user s ∈ S, Linear-Time Probabilistic Counting (LPC) [46] builds a sketch Bs to store the set of items that s connects to, i.e., N (t) s . For- mally, Bs is defined as a bit array consisting of m bits, which are initialized to zero. Let h(d) be a uniform hash function with range {1, . . . , m}. When user-item pair (s, d) arrives, the h(d)th bit in Bs is set to one, i.e., Bs[h(d)] = 1. For any bit Bs[i], 1 ≤ i ≤ m, the probability that it remains zero at time t is P (Bs[i] = 0) = (1 − 1 the number of zero bits in Bs at time t. Then, the expectation of U (t) s −n (t) is computed as E(U (t) s m . Based on the above equation, when U (t) s > 0, Whang et al. [46] estimate n(t) s i=1 P (Bs[i] = 0) ≈ me s ) = (cid:80)m s . Denote by U (t) m )n(t) as s n(t,LPC) s = −m ln U (t) s m . is [0, m ln m], and its expectation and s The range of n(t,LPC) variance are computed as ) ≈ n(t) E(n(t,LPC) s s + (cid:32) 1 2 (cid:32) n (t) s m − n(t) s m e (cid:33) , . − 1 (cid:33) Var(n(t,LPC) s ) ≈ m n (t) s m − n(t) s m e − 1 2) HyperLogLog: To estimate the cardinality of user s, HyperLogLog (HLL) [19] is developed based on the Flajolet- Martin (FM) sketch [20] Rs consisting of m registers Rs[1], . . . , Rs[m]. All m registers are initialized to 0. For 1 ≤ i ≤ m, let R(t) s [i] be the value of Rs[i] at time t. When a user-item pair (s, d) arrives, HLL maps the item into a pair of random variables h(d) and ρ(d), where h(d) is an integer uni- formly selected from {1, . . . , m} at random and ρ(d) is drawn from a Geometric(1/2) distribution, P (ρ(d) = k) = 1 2k for k = 1, 2, . . .. 1 Then, register Rs[h(d)] is updated as [h(d)], ρ(d)}. At time t, Flajolet et al. [19] estimate n(t) s s s [h(d)] ← max{R(t−1) R(t) (cid:80)m n(t,HLL) s = αmm2 i=1 2−R(t)[i] as , 1Functions h(d) and ρ(d) are usually implemented as: Let Φ(d) = (cid:104)x1x2 · · · (cid:105) be the binary format of the output of a hash function Φ(d), and b = (cid:100)log2 m(cid:101). Then, h(d) is defined as h(d) = (x1x2 · · · xb mod m) + 1 and ρ(d) is defined as the number of leading zeros in (cid:104)xb+1xb+2 · · · (cid:105) plus one. (a) CSE (b) vHLL Figure 1. Overview of bit sharing method CSE and register sharing method vHLL. Virtual CSE/vHLL sketches of users may contain "noisy" bits/registers (e.g., the bit and register in red and bold in the figure). where αm is the following constant to correct for bias (cid:18) (cid:90) ∞ (cid:18) αm = m 0 log2 2 + x 1 + x (cid:19)m (cid:19)−1 dx . The above formula for αm is complicated. In practice, αm is computed numerically, e.g., α16 ≈ 0.673, α32 ≈ 0.697, α64 ≈ 0.709, and αm ≈ 0.7213/(1 + 1.079/m) for m ≥ 128. The error of n(t,HLL) is analyzed as s E(n(t,HLL) s n(t) s ) = 1 + δ1(n(t) s ) + o(1), lim s →∞ n(t) (cid:113) lim s →∞ n(t) Var(n(t,HLL) s n(t) s ) = βm√ m + δ2(n(t) s ) + o(1). s s ) < 5× 10−5 and δ2(n(t) where δ1 and δ2 represent oscillating functions of a tiny am- s ) < 5× 10−4 plitude (e.g., δ1(n(t) as soon as m ≥ 16) which can be safely neglected for all practical purposes, and βm is a constant for a specific m, e.g., β16 ≈ 1.106, β32 ≈ 1.070, β64 ≈ 1.054, β128 ≈ 1.046, and β∞ ≈ 1.039. Since n(t,HLL) is severely biased for small cardinalities, HLL treats the HLL sketch Rs as an LPC sketch (i.e., a bitmap (cid:80)m αmm2 of m bits) when is i=1 2−R estimated as −m ln U (t) m , where U (t) is the number of registers among Rs[1], . . ., Rs[m] that equal 0 at time t. Therefore, we easily find that LPC outperforms HLL for small cardinalities under the same memory usage. < 2.5m. In this case, n(t) s (t) s [i] 3) Discussions: To compute all user cardinalities, one can use an LPC or HLL sketch to estimate each user cardinality. Clearly, using a small m, LPC and HLL will exhibit large errors for users with large cardinalities. Most user cardinalities are small and assigning an LPC/HLL sketch with large m to each user in order to accurately estimate large user cardinal- ities is wasteful as LPC and HLL do not require to set a large m to achieve reasonable estimation accuracy for users with small cardinalities. In practice, the user cardinalities are s s not known in advance and vary over time. Therefore, it is difficult to set an optimal value of m when using LPC and HLL to estimate all user cardinalities. In the next subsection, we introduce state-of-the-art methods to address this problem, and also discuss their shortcomings. B. Estimating All User Cardinalities 1) CSE: Compressing LPC Sketches of All Users into a Shared Bit Array: As shown in Figure 1 (a), CSE [50] consists of a large bit array A and m independent hash functions f1(s), ..., fm(s), each mapping users to {1, . . . , M}, where M is the length of the one dimensional bit array A. Similar to LPC, CSE builds a virtual LPC sketch for each user and embeds LPC sketches of all users in A. For user s, its virtual LPC sketch Bs consists of m bits selected randomly from A by the group of hash functions f1(s), ..., fm(s), that is Bs = (A[f1(s)], . . . , A[fm(s)]). Each bit in A is initially set to zero. When a user-item pair (s, d) arrives, CSE sets the h(d)th bit in Bs to one. Similar to LPC, h(d) is a uniform hash function with range {1, . . . , m}. Since the h(d)th element in Bs is bit A[fh(d)(s)], CSE only needs to set bit A[fh(d)(s)], i.e., A[fh(d)(s)] ← 1. Let U (t) be the number of zero bits in Bs and U (t) be the number of zero bits in A at time t. A user's virtual LPC sketch can be viewed as a regular LPC sketch containing "noisy" bits (e.g., the bit in red and bold in Figure 1 (a)), that are wrongly set from zero to one by items of other users. To remove the estimation error introduced by "noisy" bits, Yoon et al. [50] estimate n(t) s as s n(t,CSE) s = −m ln U (t) s m + m ln U (t) M . On the right-hand side of the above equation, the first term is the same as the regular LPC, and the second term corrects the error introduced by "noisy" bits. The bias and variance of n(t,CSE) are given by eqs. (23) and (24) in the original paper [50]. s (cid:1)(cid:1)(cid:2)(cid:3)(cid:4)(cid:4)(cid:4)(cid:3)(cid:2)(cid:5)(cid:6)(cid:7)(cid:8)(cid:9)(cid:10)(cid:11)(cid:12)(cid:13)(cid:7)(cid:2)(cid:3)(cid:14)(cid:15)(cid:16)(cid:8)(cid:4)(cid:14)(cid:15)(cid:16)(cid:8)(cid:7)(cid:17)(cid:18)(cid:7)(cid:19)(cid:8)(cid:12)(cid:11)(cid:7)(cid:5)(cid:20)(cid:21)(cid:22)(cid:23)(cid:7)(cid:8)(cid:24)(cid:12)(cid:16)(cid:25)(cid:9)(cid:7)(cid:17)(cid:18)(cid:7)(cid:5)(cid:26)(cid:27)(cid:2)…(cid:2)(cid:2)(cid:27)…(cid:27)(cid:2)(cid:2)(cid:27)(cid:27)(cid:27)(cid:27)(cid:27)(cid:27)(cid:27)(cid:27)(cid:27)(cid:27)(cid:2)(cid:2)∨∨∨∨∨∨∨∨∨∨∨∨∨∨(cid:27)(cid:2)…(cid:2)(cid:2)(cid:1)…(cid:27)(cid:12)(cid:28)(cid:14)(cid:12)(cid:13)(cid:13)(cid:15)(cid:29)(cid:30)(cid:17)(cid:31)(cid:12)(cid:11)(cid:10)(cid:16)(cid:17)(cid:11)(cid:11)(cid:12)(cid:14)(cid:19)(cid:15) (cid:16)(cid:7)(cid:4)(cid:3)(cid:14)(cid:15)(cid:16)(cid:8)(cid:7)(cid:17)(cid:18)(cid:7)(cid:19)(cid:8)(cid:12)(cid:11)(cid:7)(cid:5)(cid:20)!(cid:15)(cid:11)(cid:16)(cid:19)(cid:10) (cid:7)(cid:7)(cid:21)(cid:22)(cid:23)(cid:7)(cid:8)(cid:24)(cid:12)(cid:16)(cid:25)(cid:9)(cid:7)(cid:17)(cid:18)(cid:7)(cid:5)(cid:26)(cid:4)(cid:14)(cid:15)(cid:16)(cid:8)(cid:7)(cid:17)(cid:18)(cid:7)(cid:19)(cid:8)(cid:12)(cid:11)(cid:7)(cid:6)(cid:20)(cid:21)(cid:22)(cid:23)(cid:7)(cid:8)(cid:24)(cid:12)(cid:16)(cid:25)(cid:9)(cid:7)(cid:17)(cid:18)(cid:7)(cid:7)(cid:6)(cid:26)(cid:11)(cid:12)(cid:14)(cid:19)(cid:15) (cid:16)(cid:7)(cid:4)(cid:3)(cid:14)(cid:15)(cid:16)(cid:8)(cid:7)(cid:17)(cid:18)(cid:7)(cid:19)(cid:8)(cid:12)(cid:11)(cid:7)(cid:6)(cid:20)!(cid:15)(cid:11)(cid:16)(cid:19)(cid:10) (cid:7)(cid:7)(cid:21)(cid:22)(cid:23)(cid:7)(cid:8)(cid:24)(cid:12)(cid:16)(cid:25)(cid:9)(cid:7)(cid:17)(cid:18)(cid:7)(cid:6)(cid:26)(cid:1)(cid:1)(cid:2)(cid:3)(cid:4)(cid:4)(cid:3)(cid:2)(cid:5)(cid:6)(cid:7)(cid:8)(cid:9)(cid:10)(cid:11)(cid:12)(cid:13)(cid:7)(cid:2)(cid:11)(cid:12)(cid:14)(cid:15)(cid:8)(cid:16)(cid:12)(cid:11)(cid:8)(cid:17)(cid:17)(cid:18)(cid:17)(cid:19)(cid:19)(cid:17)(cid:12)(cid:20)(cid:21)(cid:12)(cid:13)(cid:13)(cid:15)(cid:22)(cid:14)(cid:23)(cid:24)(cid:12)(cid:11)(cid:10)(cid:16)(cid:23)(cid:11)(cid:11)(cid:12)(cid:21)(cid:25)(cid:15)(cid:26)(cid:16)(cid:7)(cid:3)(cid:11)(cid:12)(cid:14)(cid:15)(cid:8)(cid:16)(cid:12)(cid:11)(cid:8)(cid:7)(cid:23)(cid:27)(cid:7)(cid:25)(cid:8)(cid:12)(cid:11)(cid:7)(cid:4)(cid:28)(cid:29)(cid:15)(cid:11)(cid:16)(cid:25)(cid:10)(cid:26)(cid:7)(cid:30)(cid:31)(cid:31)(cid:7)(cid:8) (cid:12)(cid:16)!(cid:9)(cid:7)(cid:23)(cid:27)(cid:7)(cid:4)"(cid:3)(cid:11)(cid:12)(cid:14)(cid:15)(cid:8)(cid:16)(cid:12)(cid:11)(cid:8)(cid:7)(cid:23)(cid:27)(cid:7)(cid:25)(cid:8)(cid:12)(cid:11)(cid:7)(cid:4)(cid:28)(cid:30)(cid:31)(cid:31)(cid:7)(cid:8) (cid:12)(cid:16)!(cid:9)(cid:7)(cid:23)(cid:27)(cid:7)(cid:4)"(cid:3)(cid:11)(cid:12)(cid:14)(cid:15)(cid:8)(cid:16)(cid:12)(cid:11)(cid:8)(cid:7)(cid:23)(cid:27)(cid:7)(cid:25)(cid:8)(cid:12)(cid:11)(cid:7)(cid:5)(cid:28)(cid:30)(cid:31)(cid:31)(cid:7)(cid:8) (cid:12)(cid:16)!(cid:9)(cid:7)(cid:23)(cid:27)(cid:7)(cid:5)"(cid:19)(cid:18)…#(cid:19)…(cid:19)(cid:18)…(cid:1)(cid:19)…(cid:20)(cid:10)$(cid:20)(cid:10)$(cid:20)(cid:10)$(cid:20)(cid:10)$(cid:20)(cid:10)$(cid:20)(cid:10)$(cid:20)(cid:10)$(cid:11)(cid:12)(cid:21)(cid:25)(cid:15)(cid:26)(cid:16)(cid:7)(cid:3)(cid:11)(cid:12)(cid:14)(cid:15)(cid:8)(cid:16)(cid:12)(cid:11)(cid:8)(cid:7)(cid:23)(cid:27)(cid:7)(cid:25)(cid:8)(cid:12)(cid:11)(cid:7)(cid:5)(cid:28)(cid:29)(cid:15)(cid:11)(cid:16)(cid:25)(cid:10)(cid:26)(cid:7)(cid:30)(cid:31)(cid:31)(cid:7)(cid:8) (cid:12)(cid:16)!(cid:9)(cid:7)(cid:23)(cid:27)(cid:7)(cid:5)" 2) vHLL: Compressing HLL Sketches of All Users into a Shared Bit Array: Xiao et al. [47] develop a register sharing method, vHLL, which extends the HLL method to estimate all user cardinalities. vHLL consists of a list of M registers R[1], . . . , R[M ], which are initialized to zero. To maintain the virtual HLL sketch Rs of a user s, vHLL uses m independent hash functions f1(s), ..., fm(s) to randomly select m registers from all registers R[1], . . . , R[M ], where each function f1(s), ..., fm(s) maps users to {1, . . . , M}. Formally, Rs is defined as Rs = (R[f1(s)], . . . , R[fm(s)]). For 1 ≤ i ≤ M, let R(t)[i] be the value of R[i] at time t. When a user-item pair (s, d) arrives, it maps the item to a pair of two random variables h(d) and ρ(d), where h(d) is an integer uniformly selected from {1, . . . , m} at random, and ρ(d) is a random integer drawn from a Geometric(1/2) distribution, which is similar to HLL. We can easily find that the h(d)th element in the virtual HLL sketch of user s is R[fh(d)(s)], therefore, vHLL only needs to update register R[fh(d)(s)] as R(t)[fh(d)(s)] ← max{R(t−1)[fh(d)(s)], ρ(d)}. A user's virtual HLL sketch can be viewed as a regular HLL containing "noisy" registers (e.g., the register in red and bold in Figure 1 (b)), which are wrongly set by items of other users. To remove the estimation error introduced by "noisy" registers, Xiao et al. [47] estimate n(t) s as n(t,vHLL) s = M M − m αmm2 i=1 2−R(t)[fi(s)] − mαM M i=1 2−R(t)[i] (cid:80)M the first where αm is the same as that of HLL. For the two terms between the parentheses on the right-hand side of the above equation, term is the same as the regular HLL, and the second term corrects the error introduced by "noisy" registers. Similar to the regular HLL, the first term is replaced by −m ln < 2.5m where U (t) . . ., R[fm(s)] n(t,vHLL) s s . The variance of n(t,vHLL) n(t) Var(n(t,vHLL) (n(t) − n(t) registers among R[f1(s)], time t. The expectation of ) ≈ s , that is, E(n(t,vHLL) is approximately computed as ) ≈ s + (n(t) − n(t) m (n(t) M )2 + ), where n(t) = s ) m M counts the total number of distinct user-item pairs U (t) m when is the number of that equal 0 at (cid:1) + (1.04n(t)m)2 (cid:80)m i=1 2−R(t)[fi(s)] αmm2 approximately equals n(t) s M 2 (cid:0)1 − m (M−m)2 ( 1.042 (cid:80) s ) m M M 3 s s s∈S n(t) s s occurred before and including time t. C. Unsolved Challenges Challenge 1: It is difficult to set parameter m for both CSE and vHLL. The estimation accuracy of CSE and vHLL highly depends on the value of m, as we can see in above discussions. Increasing m introduces more "unused" bits in virtual LPC sketches of occurred users, which can become contaminated with noise. Here "unused" bits refer to the bits in a user's virtual LPC sketch that no user-item pairs of the (cid:33) user are hashed into. However, decreasing m introduces large estimation errors for users with large cardinalities. Similarly, vHLL also confronts the same challenge in determining an optimal m. Later our experimental results will also verify that errors increase with m for users with small cardinalities under CSE and vHLL. Challenge 2: It is computationally intensive to estimate user cardinalities for all values of t. At each time, both CSE and vHLL require time complexity O(m) to compute the cardinality of a single user. When applied to compute cardinalities for all users in S at all times, CSE and vHLL have to be repeatedly called and will incur high computational cost, which prohibits their application to high speed streams in an on-line manner. IV. OUR METHODS In this section, we present our streaming algorithms FreeBS and FreeRS for estimating user cardinalities over time. FreeBS and FreeRS are designed based on two novel bit sharing and register sharing techniques, respectively. The basic idea behind our methods can be summarized as: Unlike vHLL/CSE mapping each user's items into m (cid:28) M bits/registers, FreeBS/FreeRS randomly maps user-item pairs into all M bits/registers in the bit/register array. Thus, users with larger cardinalities (i.e., connecting to a larger number of items) tend to use more bits/registers. For each user-item pair e(t) = (s(t), d(t)) occurred at time t, we discard it when updating e(t) does not change any bit/register in the bit/register array shared by all users. Otherwise, e(t) is a new user-item pair that does not occur before time t, and we increase the cardinality q(t) , where q(t) is defined as the estimation of user s(t) by 1 probability that a new user-item pair changes any bit/register in the bit/register array at time t. To some extent, the above procedure can be viewed as a sampling method such that each new user-item pair arriving at time t is sampled with probability q(t) and each user's cardinality is estimated using the Horvitz-Thompson estimator [25]. , A. FreeBS: Parameter-Free Bit Sharing Data Structure. The pseudo-code for FreeBS is shown as Algorithm 1. FreeBS consists of a one-dimensional bit array B of length M, where each bit B[j], 1 ≤ j ≤ M, is initialized to zero. In addition, FreeBS uses a hash function h∗(e) to uniformly and independently map each user-item pair e = (s, d) to an integer in {1, . . . , M} at random, i.e., M , and P (h∗(e) = i ∧ h∗(e(cid:48)) = i(cid:48)e (cid:54)= e(cid:48)) = P (h∗(e) = i) = 1 M 2 , i, i(cid:48) ∈ {1, . . . , M}. Note that h∗(e) differs from the hash 1 function h(s) used by CSE that maps user s to an integer in {1, . . . , M} at random. Update Procedure. When a user-item pair e = (s, d) arrives at time t, FreeBS first computes a random variable h∗(e), and then sets B[h∗(e)] to one, i.e., B[h∗(e)] ← 1. Let B(t) 0 denote the set of the indices corresponding to zero bits in B at time 0 = {i : B(t)[i] = 0, 1 ≤ t. Formally, B(t) 0 i ≤ M}. Let n(t,FreeBS) denote the cardinality estimate for user s s at time t. We initialize n(0,FreeBS) to 0. Next, we describe is defined as B(t) s (cid:32) (cid:80)m s Proof. Let δe denote an indicator that equals 1 when updating a user-item pair e incurs a value change of B[h∗(e)] (i.e., B[h∗(e)] changes from 0 to 1), and 0 otherwise. We easily have n(t,FreeBS) s = (cid:88) i∈T (t) s δe(i) q(i) B . For each δe(i), we have E(δe(i)q(i) e(i)q(i) B , . . . , q(t) Var(δe(i)q(i) Define Q(t) B ) = E(δ2 B = {q(1) 1 ≤ i ≤ t, B ) = q(i) B , B )−(E(δe(i)q(i) B }. Then, we have B ))2 = q(i) B −(q(i) B )2. E(n(t,FreeBS) s Q(t) B ) = E  (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Q(t) B  (cid:88) (cid:88) (cid:88) s i∈T (t) s i∈T (t) E(δe(i)Q(t) B ) δe(i) q(i) B q(i) B P (δe(i) = 1Q(t) B ) q(i) B = = s i∈T (t) = n(t) s . B , random variables δe(i), i ∈ T (t) Given Q(t) of each other. Then, we have s , are independent . E(n(t,FreeBS) s ) = E(E(n(t,FreeBS) s Q(t) B )) = E(n(t) s ) = n(t) s . The variance of n(t,FreeBS) s is computed as Var(n(t,FreeBS) s Q(t) B ) = Var ← 0, s ∈ S; Algorithm 1: The pseudo-code for FreeBS. B[1, . . . , M ] ← [0, . . . , 0]; n(FreeBS) m0 ← M; s foreach e = (s, d) in Γ do if B[h∗(e)] == 0 then ← n(FreeBS) B[h∗(e)] ← 1; n(FreeBS) s m0 ← m0 − 1; + M m0 ; s end end s is computed on-line. Let m(t) 0 denote how n(t,FreeBS) the number of zero bits in B at time t. Let q(t) B denote the probability of e changing a bit in B from 0 to 1 at time t. Formally, q(t) 0 = B(t) B is defined as q(t) B = P (h∗(e) = i) = B(t−1) 0 M = m(t−1) 0 M . (cid:88) i∈B(t−1) 0 Let 1(P) denote the indicator function that equals 1 when predicate P is true and 0 otherwise. Besides setting B[h∗(e)] to 1 at time t with the arrival of user-item pair e = (s, d), we also update the cardinality estimate of user s as n(t,FreeBS) s ← n(t−1,FreeBS) s + 1(B(t−1)[h∗(e)] = 0) q(t) B s(cid:48) For any other user s(cid:48) ∈ S\{s}, we keep its cardinality estimate unchanged, i.e., n(t,FreeBS) . We easily find that q(t) B can be fast computed incrementally. That is, we initialize q(1) B ← n(t−1,FreeBS) to 1, and incrementally compute q(t+1) B − 1(B(t−1)[h∗(e)] = 0) B ← q(t) q(t+1) t ≥ 1. , as s(cid:48) B M Hence, the time complexity of FreeBS for processing each user-item pair is O(1). Error Analysis. Let T (t) denote the set of the first occurrence times of user-item pairs associated with user s in stream Γ. Formally, we define T (t) as s s s = {i : s(i) = s ∧ e(j) (cid:54)= e(i), 0 < j < i ≤ t}. T (t) Theorem 1: The expectation and variance of n(t,FreeBS) s Var(n(t,FreeBS) s ) = where E( 1 q(i) B ) = ) − 1 , 1 q(t) B E( (cid:32) (cid:1)( j−k E(n(t,FreeBS) ) = n(t) s , i∈T (t) s s E( (cid:88) M(cid:0)n(i) (cid:18) j 1 + M(cid:88) j=1 ≈ e n(i) M )−n(t) s ≤ n(t) s 1 q(i) B (cid:1)(cid:80)j−1 k=0(−1)k(cid:0)j (cid:18) M − j M − n(i) M 1 M n(i) e k M )n(i) (cid:19)(cid:19) − 1 .  (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Q(t) B s  (cid:88) (cid:88) (cid:88) (cid:88) s s i∈T (t) i∈T (t) i∈T (t) s δe(i) q(i) B i∈T (t) Var(δe(i)Q(t) B ) (q(i) B )2 B − (q(i) q(i) B )2 (q(i) B )2 − n(t) s . 1 q(i) B = = = are (cid:33) B )) = 0, using the equation Q(t) s Since Var(E(n(t,FreeBS) Var(X) = Var(E(XY )) + E(Var(XY )), we have Q(t) B )) ) − n(t) ) = E(Var(n(t,FreeBS) = E( Var(n(t,FreeBS) s s s (cid:88) (cid:88) i∈T (t) E( s 1 q(i) B 1 q(i) B = i∈T (t) s ) − n(t) s . In what follows we derive the formula for E( 1 q(i) B ). For j specific distinct bits in B, there exist j!τ (n(i), j) ways to map n(i) distinct user-item pairs occurred in stream Γ before and including time i into these bits given that each bit has at least one user-item pair, where τ (n(i), j), the Stirling number of the second kind [2], is computed as j−1(cid:88) (−1)k τ (n(i), j) = In addition, there exist(cid:0)M k=0 B, therefore we have (cid:18)j (cid:19) (cid:1) ways to select j distinct bits from , 0 < j ≤ n(i). (j − k)n(i) k j (cid:0)M 0 = M − jn(i)) = k=0(−1)k(cid:0)j (cid:1)(cid:80)j−1 M(cid:88) (cid:1)j!τ (n(i), j) (cid:1)( j−k M(cid:0)n(i) M n(i) k j j . M )n(i) . M − j P (m(i) Then, we have E( 1 q(i) B ) = j=1 Next, we introduce a method to approximately compute E( 1 by its Taylor series q(i) B around E(q(i) ). We expand the function 1 q(i) B B ) as (cid:32) (cid:33) + B − E(q(i) (q(i) (E(q(i) B ))3 B ))2 ) ≈ E E( 1 q(i) B 1 E(q(i) B ) 1 E(q(i) B ) + − q(i) B − E(q(i) B ) (E(q(i) B ))2 Var(q(i) B ) (E(q(i) B ))3 . = From [46] (eqs.(5) and (6) in [46]), we easily have E(q(i) e− n(i) we obtain E(q(i) M (1− (1 + n(i) M − n(i) M (e n(i) M )e− n(i) M − 1)). B ) = 1 B ) ≈ e n(i) M e− n(i) M (1 + 1 B ) = M ). Then, (cid:3) M and Var(q(i) B. FreeRS: Parameter-Free Register Sharing Data Structure. The pseudo-code for FreeRS is shown as Algorithm 2. FreeRS consists of M registers R[1], . . ., R[M ], which are initialized to zero. In addition, FreeRS also uses a hash function h∗(e) to randomly map each user-item pair e = (s, d) to an integer in {1, . . . , M} and another function ρ∗(e) that maps e to a random integer in {1, 2, . . .} according to a Geometric(1/2) distribution. Note that h∗(e) and ρ∗(e) differ from hash functions h(s) and ρ(s) used by vHLL, which map user u to a random integer in {1, . . . , M} and {1, 2, . . .}, respectively. Update Procedure. When user-item pair e = (s, d) arrives at time t, FreeRS first computes two random variables h∗(e) and ρ∗(e), and then updates R(t)[h∗(e)] as R(t)[h∗(e)] ← max{R(t−1)[h∗(e)], ρ∗(e)}. R denote the probability of e changing the value of a is Let q(t) register among R[1], . . . , R[M ] at time t. Formally, q(t) R defined as P (h∗(e) = j ∧ R(t)[j] > R(t−1)[j]) M(cid:88) (cid:80)M j=1 2−R(t−1)[j] j=1 M q(t) R = = . n(t,FreeRS) s = Algorithm 2: The pseudo-code for FreeRS. R[1, . . . , M ] ← [0, . . . , 0]; qR ← 1; n(FreeRS) foreach e = (s, d) ∈ Γ do s ← 0, s ∈ S; if ρ∗(e) > R[h∗(e)] then qR ← qR + 2−ρ∗ (e)−2−R[h∗ (e)] R[h∗(e)] ← ρ∗(e); ← n(FreeRS) n(FreeRS) s + 1 qR M ; s ; end end s Let n(t,FreeRS) denote the cardinality estimate of user s at time t. When user-item pair e = (s, d) arrives at time t, we update the cardinality estimate of user s as n(t,FreeRS) s ← n(t−1,FreeRS) s + 1(R(t)[h∗(e)] (cid:54)= R(t−1)[h∗(e)]) . q(t) R s(cid:48) ← n(t−1,FreeRS) . Similar to q(t) incrementally. In detail, we initialize q(1) For any other user s(cid:48) ∈ S\{s}, we keep its cardinality estimate unchanged, i.e., n(t,FreeRS) B , we compute q(t) R = 1 R and incrementally compute q(t+1) R ← q(t) q(t+1) R + as s(cid:48) R 2−ρ∗(e) − 2−R[h∗(e)] m 1(R(t)[h∗(e)] (cid:54)= R(t−1)[h∗(e)]). Hence, the time complexity of FreeRS for processing each user-item pair is also O(1). Error Analysis. We derive the error of n(t,FreeRS) Theorem 2: The expectation and variance of n(t,FreeRS) as follows: are s s (cid:32) (cid:33) E(n(t,FreeRS) s ) = n(t) s , E( 1 q(i) R (cid:88) (cid:80) s i∈T (t) E( ) − 1 , Var(n(t,FreeRS) s ) = s )−n(t) s ≤ n(t) (cid:0) n(i) M n(i)−1(cid:80)M 1 q(t) R (cid:1)ΠM where E( 1 q(i) R with ) = γnj ,kj = n1,...,nM n1+...+nM =n(i) k1,...,kM≥0 (cid:88)  (1 − 2−kj )nj − (1 − 2−kj +1)nj , nj > 0, kj > 0 nj > 0, kj = 0 nj = 0, kj = 0. j=1 2−kj j=1γnj ,kj 0, 1, , ) is approximately 1.386n(i) E( 1 q(i) R Proof. Let ξe denote an indicator equal to 1 when processing a user-item pair e incurs a value change of any R[1], . . . , R[M ], and 0 otherwise. We have when n(i) > 2.5M. M (cid:88) i∈T (t) s ξe(i) q(i) R . For each ξe(i), we have E(ξe(i)q(i) e(i)q(i) Var(ξe(i)q(i) Similar to FreeBS, define R ) = E(ξ2 1 ≤ i ≤ t, R ) = q(i) R , R )−(E(ξe(i)q(i) R ))2 = q(i) R −(q(i) R )2. Then, we have E(n(t,FreeRS) s R }. R , . . . , q(t) R = {q(1) Q(t) (cid:88) R ) = E( Q(t) ξe(i) q(i) R i∈T (t) s (cid:12)(cid:12)(cid:12) Q(t) R ) = n(t) s . Therefore, we obtain E(n(t,FreeRS) s ) = E(E(n(t,FreeRS) s Q(t) R )) = E(n(t) s ) = n(t) s . (cid:88) s R is given Q(t) − n(t) s . R , all ξe(i) (i ∈ T (t) Given Q(t) Similar to FreeBS, the variance of n(t,FreeRS) s ) are independent of each other. (cid:88) ) = E(Var(n(t,FreeRS) ) − n(t) =E( s s Q(t) R ) = Var(n(t,FreeRS) 1 q(i) R Q(t) It is easily shown that Var(E(n(t,FreeRS) R )) = 0. Using equation Var(X) = Var(E(XY )) + E(Var(XY )), we have Var(n(t,FreeRS) i∈T (t) s s Q(t) R )) s s E( s = i∈T (t) i∈T (t) 1 q(i) R ) − n(t) s . 1 q(i) R In what follows we derive the formula for E( 1 q(i) R ). Using h∗(·), FreeRS randomly splits stream Γ into M sub-streams Γj, 1 ≤ j ≤ M. Each R[j] tracks the maximum value of function ρ∗(·) for user-item pairs in sub-stream Γj. At time i, assume that nj distinct user-item pairs have occurred in Γj. Then, P (R(i)[j] = kjnj) = γnj ,kj . Therefore, s (cid:88) P (R(i)[1] = k1, . . . , R(t)[M ] = kMn(i)) = n1+...+nM =n(i) n1,...,nM j=1γnj ,kj . M n(i) An exact expression for E( 1 ) is easily derived. However, q(i) R it is too complex to analyze. Hence, we introduce a method to approximate E( 1 ). From [19], we have E( αM M ) = q(i) q(i) ) ≈ ) ≈ n(i) for n(i) > 2.5M. Therefore, E( 1 R R αM ME( 1 q(i) q(i) R R αM M ≈ 1.386n(i) (cid:3) n(i) M . FreeBS can estimate cardinalities up to(cid:80)M C. Discussions FreeBS vs CSE. FreeBS outperforms CSE in three aspects: (1) i ≈ M ln M, which is larger than the maximum cardinality m ln m allowed by CSE; (2) FreeBS exhibits a smaller estimation error than CSE. From [39], we find that the expectation and the variance of estimation n(t,CSE) ) ≈ n(t) given by CSE are E(n(t,CSE) (cid:32) (cid:33) − 1 E( i=1 )e (t) s M , s n s + s m − n(t) s m 1 q(t) 1 2 (cid:0) n(i) (cid:1)ΠM (cid:80) (cid:32) E( 1 q(t) )e Var(n(t,CSE) s ) ≈ m n (t) s m − n(t) s m (cid:33) − 1 , where q(t) = U (t) M is the fraction of zero bits in the shared bit array at time t. We find that CSE exhibits a large bias s (cid:29) m, while FreeBS is unbiased. When m is when n(t) large (e.g., m approaches to M), FreeBS and CSE perform nearly the same bit setting operations but use their different cardinality estimators. Then, we have E( 1 ). From Theorem 2, therefore, we easily have q(t) ) ≈ E( 1 q(t) B (cid:32) 1 q(t) 1 q(t) (cid:33) − 1 ) − n(t) s m n(t) s m (cid:39) Var(n(t,FreeBS) s ); Var(n(t,CSE) s ) (cid:39) m E( )(1 + > n(t) s E( ) − n(t) s 3) FreeBS has complexity O(1) to update user cardinality estimates each time it observes a new user-item pair, while CSE has complexity O(m). FreeRS vs vHLL. FreeRS and vHLL both can estimate cardinalities up to 22w, where w is the number of bits in a register. However, FreeRS outperforms vHLL in two aspects: 1) FreeRS has complexity O(1) to update user cardinality esti- mates each time it observes a new user-item pair, while vHLL has complexity O(m); 2) FreeRS exhibits a smaller estimation error in comparison with vHLL. From Theorem 2, then we − 1) < have Var(n(t,FreeRS) 1.386n(t)n(t) )− 1) ≈ n(t) s (E( 1 q(t) R s ( n(t) M αM ) ≤ n(t) s s M Var(n(t,vHLL) s , while the variance of vHLL is ) (cid:39) ( M − m 2.163n(t)n(t) s )2 × 1.042 × 2n(t)n(t) m 2.163n(t)n(t) s M s = M − m > . M m M (1 − m M ) FreeBS vs FreeRS. We observe that 1) FreeBS is faster than FreeRS. For each coming user-item pair e, FreeBS only computes h∗(e) to select and set a bit, but FreeRS needs to compute both h∗(e) and ρ∗(e) to select and update a register; 2) Under the same memory usage, we compare the accuracy of FreeBS using M bits and FreeRS using M/w registers, where w is the number of bits in a register. From Theorems 1 and 2, we have Var(n(t,FreeBS) s ) = Var(n(t,FreeRS) ) = s (cid:88) (cid:88) s i∈T (t) E( E( ) − n(t) s , ) − n(t) s , 1 q(i) B 1 q(i) R s i∈T (t) M and E( 1 q(i) R M ) ≈ e n(i) ) ≈ 1.386wn(i) where E( 1 < e n(i) q(i) B M ≥ 0.772w. Therefore, FreeRS is more accurate when n(i) than FreeBS for users not appearing among the first 0.772wM distinct user-item pairs presented on stream Γ. Flajolet et al. [19] observe that HLL exhibits a large error for estimating small cardinalities. To solve this problem, they view a register of HLL as a bit of LPC and estimate the cardinality based on M the fraction of registers that equal 0. When n(i) (cid:28) M/w, we easily find that q(i) is approximately computed as the R fraction of registers that equal 0 at time i, and we have E( 1 ) because the number of bits in FreeBS is w q(i) B times larger than the number of registers in FreeRS under the same memory usage. It indicates that FreeBS is more accurate than FreeRS for users whose user-item pairs appear early in stream Γ. ) < E( 1 q(i) R A. Datasets V. EVALUATION In our experiments, we used a variety of publicly available real-world datasets to evaluate the performance of our methods in comparison with state-of-the-art methods, which are sum- marized in Table I. Dataset sanjose (resp. chicago) consists of one-hour passive traffic traces collected from the equinix- sanjose (resp. equinix-chicago) data collection monitors during March 20, 2014. Twitter, Flickr, Orkut and LiveJournal are all graph-datasets where each edge represents social relationship between any two users and may occur more than once in these datasets. Figure 2 shows the CCDFs of user cardinalities for all datasets used in our experiments. SUMMARY OF DATASETS USED IN OUR EXPERIMENTS. Table I dataset sanjose [1] chicago [1] Twitter [31] Flickr [35] Orkut [35] LiveJournal [35] #users 8,387,347 1,966,677 40,103,281 1,441,431 2,997,376 4,590,650 max-cardinality total cardinality 313,772 106,026 2,997,496 26,185 31,949 9,186 23,073,907 9,910,287 1,468,365,182 22,613,980 223,534,301 76,937,805 B. Baselines FreeBS and CSE [50] are bit-sharing algorithms, while FreeRS and vHLL [47] are register-sharing algorithms, where each register consists of 5 bits, i.e., w = 5. To compare our methods with these two methods under the same memory size, we let FreeBS and CSE have M bits, whereas FreeRS and vHLL have M/5 5-bit registers. Moreover, both CSE and vHLL use virtual sketches to record the cardinality of each user, and we set m (i.e., the number of bits/registers in the virtual sketch) to be the same for both methods. LPC [46] and HyperLogLog++ [23] (short for HLL++) build a sketch for each user s ∈ S to record items that s connects to. Specially, HLL++ is an optimized method of HyperLogLog, which uses 6 bits for each register, and implements bias correction and sparse representation strategies to improve cardinality estimation performance. In our experiments, under the same memory size M, we let LPC have MS bits and HLL++ have 6S 6-bit registers for each user respectively. M In this paper, we aim to compute the cardinalities of all users at each time t = 1, 2, . . .. At each time t, enumerating each occurred user and computing its cardinality requires time O(S(t)m) for methods CSE, vHLL, LPC, and HLL++, where S(t) is the set of occurred users before and include time Figure 2. CCDFs of user cardinalities. t. It is computationally intensive and thus is prohibitive for estimating all users' cardinalities over time t. To solve this problem, we allocate each occurred user s a counter ns to keep tracking of u's cardinality for CSE, vHLL, LPC, and HLL++. For each edge e(t) = (s(t), d(t)) arriving at time t, we only estimate the cardinality of user s(t) for CSE, vHLL, LPC, and HLL++, and then update its counter ns(t) and keep the counters of the other occurred users unchanged, which reduces time complexity from O(S(t)m) to O(m). To track all users' cardinalities over time, therefore, all methods FreeRS, FreeBS, CSE, vHLL, LPC, and HLL++ require a counter for each user, and we do not consider this memory usage in our comparisons. C. Metrics In our experiments, we use a fine-grained metric relative standard error (RSE) to evaluate the performance of estimat- ing the cardinality for any user with a particular cardinality n at time t. Smaller RSE indicates better performance of cardinality estimation. Formally, we define (cid:80) s∈S(n(t) s − n)21(n(t) s∈S 1(n(t) s = n) s = n) . (cid:118)(cid:117)(cid:117)(cid:116)(cid:80) RSE(t)(n) = 1 n D. Runtime For CSE, vHLL, LPC and HLL++, its runtime is mainly determined by the number of bits/registers in each user's (vir- tual) sketch, because estimating a user's cardinality needs to enumerate m bits/registes in the user's sketch, which requires large time complexity O(m). On the contrary, our methods FreeBS and FreeRS have low time complexity O(1) to process each coming element and update the counter for its user. In our experiments, we vary the number of bits/registers in the sketch m to compare the runtime of all six methods. In this case, we record the runtime required for processing each element and updating the cardinality of the user, and then average the update time for all users in the datasets. The experimental results are shown in Figure 3. As m increases, the runtime of all four methods CSE, vHLL, LPC and HLL++ increases. Our methods FreeBS and FreeRS are substantially faster than other four methods for different m. Also we notice that CSE is faster        .,7/3,9     8,3480..,4%9907.7 7:9;04:73, (a) FreeBS (b) FreeRS Figure 3. Runtime of our methods FreeBS and FreeRS in comparison with CSE, vHLL, LPC and HLL++ for different m (i.e., the number of bits/registers in the (virtual) sketch) of a user. than vHLL and FreeBS is faster than FreeRS, this is because register sharing based methods perform more operations than bitmap sharing methods for processing each element. E. Accuracy (c) CSE (d) vHLL s = n(t) s Whenever an element e = (s, d) arrives, we implemented all six methods to estimate the cardinality of the user s. Figure 4 shows the experimental results when all elements in the dataset Orkut arrive. In our experiments, we fixed the memory size M = 5 × 108 bits, and the number of bits/register in the virtual sketch for CSE/vHLL was set to m = 1, 024. Under the fixed memory size, each user in the dataset Orkut used 167 bits for LPC and 28 6-bit registers for HLL++ respectively. Points close to the diagonal line n(t) indicate better cardinality estimation accuracy. From Figure 4, we observe that our methods FreeBS and FreeRS are more accurate than other four methods for different actual cardinalities. CSE and LPC have limited estimation ranges and LPC exhibits extremely bad estimation performance especially for larger cardinalities, therefore we omit the experimental results of LPC in the later experiments. Furthermore, we used the metric RSE to compare the estimation errors of our methods with those of CSE, vHLL and HLL++ at a fine-grained level. Figure 5 shows the RSEs of all methods for all datasets in Table I. We can see that our methods FreeBS and FreeRS are up to 10,000 times more accurate than CSE, vHLL, and HLL++. Bit sharing method FreeBS (resp. CSE) is more accurate than register sharing method FreeRS (resp. vHLL) for characterizing users with small cardinalities. For users with large cardinalities, register sharing method FreeRS (resp. vHLL) outperforms bit sharing method FreeBS (resp. CSE). Specially, the RSE of CSE first decreases and then increases as the actual cardinality increases. This is because CSE has a small estimation range, i.e., m ln m, which is consistent with the original paper [50]. Meanwhile, HLL++ is more accurate than CSE and vHLL for small cardinalities due to its bias correction strategy. Because each user uses fewer registers for HLL++ than vHLL, HLL++ performs larger estimation errors than vHLL for large cardinalities. (e) LPC (f) HLL++ Figure 4. (Orkut) Estimated cardinalities vs actual cardinalities for FreeBS, FreeRS, CSE, vHLL, LPC, and HLL++ under the same memory size M = 5 × 108 (bits), where the number of bits/registers in the virtual sketch for CSE/vHLL m = 1, 024. F. Case Study: Detecting Super Spreaders over Time We implemented methods FreeBS, FreeRS, CSE, vHLL, and HLL++ to detect super spreaders over time, where a super spreader refers to a user connecting to at least ∆n(t) items at time t, where n(t) is the sum of all user cardinalities at time t and 0 < ∆ < 1 is a relative threshold. In our experiments, we set memory size M = 5 × 108 bits and the number of bits/registers in the virtual sketch m = 1, 024. We used two metrics false negative ratio (FNR) and false positive ratio (FPR) to evaluate performance, where FNR is the ratio of the number of super spreaders not detected to the number of super spreaders, and FPR is the ratio of the number of users that are wrongly detected as super spreaders to the number of all users. Figure 6 shows experimental results of all five methods for detecting super spreaders over time in dataset sanjose. We observe that both FreeBS and FreeRS are more accurate than other three methods for detecting super spreaders over time. For example, FNR and FPR for FreeBS and FreeRS are about      2     :5/,9092080.43/8700$700#$$;!     ,.9:,.,7/3,9     0892,90/.,7/3,9     ,.9:,.,7/3,9     0892,90/.,7/3,9     ,.9:,.,7/3,9     0892,90/.,7/3,9     ,.9:,.,7/3,9     0892,90/.,7/3,9     ,.9:,.,7/3,9     0892,90/.,7/3,9     ,.9:,.,7/3,9     0892,90/.,7/3,9 (a) sanjose (b) chicago (c) Twitter (d) Flickr (e) Orkut (f) LiveJournal Figure 5. (All datasets) Cardinality estimation accuracy, where memory size M = 5 × 108 (bits), and m = 1, 024 for CSE/vHLL. Figure 6. (sanjose) Accuracy of detecting super spreaders over time t, where ∆ = 5 × 10−5, M = 5 × 108 (bits), and m = 1, 024 for CSE/vHLL. (ALL DATASETS) PERFORMANCE OF DETECTING SUPER SPREADERS WITH ∆ = 5 × 10−5, M = 5 × 108, m = 1, 024. CSE REPORTED AN EMPTY SET OF USERS FOR TWITTER AND ORKUT DUE TO THE LIMITED ESTIMATION RANGE, THEREFORE WE REPORT THEIR RESULTS ON TWITTER AND ORKUT AS Table II "N/A". dataset sanjose chicago Twitter Flickr Orkut LiveJournal FreeBS 2.54e-3 2.61e-3 2.45e-2 5.13e-3 1.47e-2 4.37e-3 FreeRS 2.27e-3 2.55e-3 2.27e-2 5.55e-3 1.53e-2 4.62e-3 FNR CSE 1.02e-2 8.00e-3 N/A 1.09e-2 N/A 1.04e-2 vHLL 1.12e-2 8.23e-3 6.38e-2 1.13e-2 7.86e-2 9.92e-3 HLL++ 2.88e-2 9.06e-3 1.04e-1 1.38e-2 9.71e-2 1.36e-2 FreeBS 1.61e-7 2.32e-6 2.99e-7 1.18e-5 3.22e-7 4.33e-7 FreeRS 1.76e-7 2.54e-6 2.75e-7 1.04e-5 3.34e-7 4.15e-7 FPR CSE 1.22e-6 8.46e-6 N/A 3.57e-5 N/A 1.22e-6 vHLL 1.08e-6 8.47e-6 6.84e-7 3.87e-5 1.97e-6 1.13e-6 HLL++ 3.38e-6 1.08e-5 1.25e-6 4.13e-5 2.52e-6 1.78e-6 4 to 20 times smaller than other three methods. Table II shows the results for all datasets when all elements arrive. We notice that our methods FreeBS and FreeRS outperform other three methods on all datasets. VI. RELATED WORK Sketch methods use small amount of memory to quickly build compressive summaries of large data streams, and have been successfully used for applications such as heavy hitter detection [15], [16], [11], [12], [52], [51], heavy change detection [27], [9], [38], super host detection [54], [4], [50], [42], [43], [44], cardinality distribution estimation [6], [45], network flow size estimation [13], [24], [49], [28], [37], [29], [30], [33], and network traffic entropy estimation [32], [53]. Next, we discuss existing cardinality estimation methods in detail.        .,7/3,9     #$700$700#$$;      .,7/3,9      #$700$700#$$;        .,7/3,9      #$700$700#$$;      .,7/3,9     #$700$700#$$;      .,7/3,9     #$700$700#$$;     .,7/3,9     #$700$700#$$;            #923:908700$700#$$;              !#923:908700$700#$$; Estimating data streams' cardinalities. To estimate the cardinality of a large data stream (i.e., the number of distinct elements in the data stream), Whang et al. [46] develop the first sketch method LPC. LPC can only estimate cardinal- ities less than m ln m, where m is the size of the LPC sketch. Therefore, it needs to set a large m to handle data streams with large cardinalities. [17], [5] combine LPC and different sampling methods to enlarge the estimation range. Flajolet and Martin [20] develop a sketch method FM, which uses a register to estimate the data stream's cardinality and provides a cardinality estimation bounded by 2w, where w is the number of bits in the register. To further improve the accuracy and decrease the memory usage, sketch meth- ods MinCount [3], LogLog [14], HyperLogLog [19], Hyper- LogLog++ [23], RoughEstimator [26], and HLL-TailCut+ [48] are developed to use a list of m registers and compress the size of each register from 32 bits to 5 or 4 bits under the same estimation range of 232. [22], [34] develop several cardinality estimators based on order statistics of observed samples. Ting [40] introduces the concept of an area cutting process to generally model the above sketch methods and provides a martingale based estimator to further improve the accuracy of these methods. Chen et.al [7] extend HyperLogLog to estimate the cardinality over sliding windows. Besides these sketch methods, sampling methods Wegman's adaptive sampling [18] and distinct sampling [21] are also developed for estimating a large stream's cardinality, while Flajolet et al. [19] reveal that the memory efficiency of these two sampling methods is even worse than the original FM method. Recently, [8], [41] developed methods using the above sketch methods to estimate the cardinalities of set unions and intersections. Estimating all user cardinalities. Significant attention has been paid to develop sketch methods to estimate the cardi- nalities of network hosts (or users) over high speed links. To achieve a desired accuracy, the above methods require a large number of bits/registers for each host because host cardinalities are unknown in advance and vary over a large range. This is not memory efficient because most hosts have small cardinalities. To solve this problem, [54], [50], [43], [47] develop different virtual sketch methods to compress the LPC/HLL sketches of all hosts into a large bit/register array shared by all hosts. Zhao et al. [54] propose a virtual sketch method, which consists of a list of LPC sketches (i.e., a two- dimensional bit array). For each host, they randomly select k (k is usually set to 2 or 3) LPC sketches from the list shared by all hosts. Note that each LPC in the list may be used by more than one hosts, which introduces "noisy" bits in a host's LPCs. To remove the error introduced by "noisy" bits, Zhao et al. [54] develop a method to estimate a host's cardinality based on its k LPC sketches. To further reduce the memory usage, [50], [43] generate each host's virtual LPC sketch by selecting m bits from a large one-dimensional bit array at random. All these virtual sketch methods [50], [43] have to set a large value of m (e.g., thousand) to achieve reasonable accuracy for host cardinalities over a large range. It results in large estimation errors, because most hosts have small cardinalities and many bits in their virtual LPC sketches tend to be contaminated by "noisy" bits. To reduce "noisy" bits in virtual LPC sketches, [39] builds a small regular LPC sketch for each host, which also provides information for estimating the host cardinality. As we mentioned, these LPC based virtual sketch methods have small estimation ranges bounded by m ln m. To enlarge the estimation range, [47] develop a sketch method vHLL, which generates a virtual HLL sketch by randomly selecting m registers from a large register array shared by all hosts. To achieve desired accuracy for host cardinalities over a large range, [47] also needs to set a large value of m. However, it results in a high computational cost and large estimation errors for network hosts with small cardinalities, in which virtual HLL sketches include many "noisy" registers. In addition, the above virtual sketch methods are customized to non- streaming settings, i.e., estimate host cardinalities at the end of an interval, and are computationally expensive to be extended to streaming settings. VII. CONCLUSIONS AND FUTURE WORK In this paper, we develop two novel streaming algorithms FreeBS and FreeRS to accurately estimate user cardinalities over time. Compared to existing bit/register sharing methods using (i.e., selecting) only m bits/registers for each user, FreeBS/FreeRS enables that the number of bits/registers used by a user dynamically increases as its cardinality increases over time and each user can use all shared bits/registers. It is therefore capable to estimate user cardinalities over a large range. For example, existing bit sharing methods can be only used to estimate user cardinalities over the range [0, m ln m]. Our method FreeBS enlarges the range to [0, M ln M ], where M is the total number of bits/registers used by all users. In addition, our algorithms FreeBS and FreeRS exploit dynamic properties of shared bits/registers to significantly improve estimation accuracy. They are simple yet effective, and sharply reduce time complexity of computing all user cardinalities to O(1) each time they observe a new user-item pair. We conduct experiments on real-world datasets, and experimental results demonstrate that our methods FreeBS and FreeRS significantly outperform state-of-the-art methods in terms of accuracy and computational time. In future, we plan to extend our methods to applications such as SDN routers to monitor anomalies. ACKNOWLEDGMENT The research presented in this paper is supported in part by National Key R&D Program of China (2018YFC0830500), National Natural Science Foundation of China (U1301254, 61603290, 61602371), the Ministry of Education&China Mobile Research Fund (MCM20160311), the Natural Sci- ence Foundation of Jiangsu Province (SBK2014021758), 111 International Collaboration Program of China, the Prospective Joint Research of Industry-Academia-Research Joint Innovation Funding of Jiangsu Province (BY2014074), Shenzhen Basic Research Grant (JCYJ20160229195940462, JCYJ20170816100819428), China Postdoctoral Science Foun- dation (2015M582663), Natural Science Basic Research Plan in Shaanxi Province of China (2016JQ6034). REFERENCES [1] Internet traces 2014, center for applied internet data analysis (caida). http://www.caida.org/data/passive/passive 2014 dataset.xml. [2] M. Abramowitz and I. A. Stegun. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Dover, 1964. [3] Z. Bar-Yossef, T. S. Jayram, R. Kumar, D. Sivakumar, and L. Trevisan. Counting distinct elements in a data stream. In RANDOM, 2002. [4] J. Cao, Y. Jin, A. Chen, T. Bu, and Z. Zhang. Identifying high cardinality Internet hosts. In INFOCOM, pages 810 -- 818, April 2009. [5] A. Chen, J. Cao, L. Shepp, and T. Nguyen. Distinct counting with a self-learning bitmap. Journal of the American Statistical Association,, 106(495):879 -- 890, 2011. [6] A. Chen, L. Li, and J. Cao. Tracking cardinality distributions in network traffic. In INFOCOM, pages 819 -- 827, April 2009. [7] W. Chen, Y. Liu, and Y. Guan. Cardinality change-based early detection In INFOCOM, pages 1788 -- 1796. IEEE, of large-scale cyber-attacks. 2013. [8] R. Cohen, L. Katzir, and A. Yehezkel. A minimal variance estimator for the cardinality of big data set intersection. In SIGKDD, 2017. [9] G. Cormode and S. Muthukrishnan. What's hot and what's not: Tracking most frequent items dynamically. In PODC, pages 296 -- 306, July 2003. [10] G. Cormode and S. Muthukrishnan. An improved data stream summary: Journal of Algorithms, the count-min sketch and its applications. 55(1):58 -- 75, 2005. [11] G. Cormode, S. Muthukrishnan, and D. Srivastava. Finding hierarchical In VLDB, pages 464 -- 475, September heavy hitters in data streams. 2003. [12] G. Cormode, S. Muthukrishnan, and D. Srivastava. Diamond in the rough: Finding hierarchical heavy hitters in multi-dimensional data. In SIGMOD, pages 155 -- 166, June 2004. [13] N. Duffield, C. Lund, and M. Thorup. Estimating flow distributions from sampled flow statistics. In SIGCOMM, 2003. [14] M. Durand and P. Flajolet. Loglog Counting of Large Cardinalities, pages 605 -- 617. Springer Berlin Heidelberg, 2003. [15] C. Estan and G. Varghese. New directions in traffic measurement and accounting. In SIGCOMM, pages 323 -- 336, October 2002. [16] C. Estan and G. Varghese. Automatically inferring patterns of resource consumption in network traffic. In SIGCOMM, pages 137 -- 148, Augest 2003. [17] C. Estan, G. Varghese, and M. Fisk. Bitmap algorithms for counting active flows on high speed links. In SIGCOMM, pages 182 -- 209, October 2003. [18] P. Flajolet. On adaptive sampling. Computing, 43(4):391 -- 400, Feb. 1990. [19] P. Flajolet, E. Fusy, O. Gandouet, and F. Meunier. Hyperloglog: The analysis of a near-optimal cardinality estimation algorithm. In AOFA, 2007. [20] P. Flajolet and G. N. Martin. Probabilistic counting algorithms for data base applications. Journal of Computer and System Sciences, 31(2):182 -- 209, October 1985. [21] P. B. Gibbons. Distinct sampling for highly-accurate answers to distinct In VLDB, pages 541 -- 550, San values queries and event reports. Francisco, CA, USA, 2001. [22] F. Giroire. Order statistics and estimating cardinalities of massive data sets. Discrete Applied Mathematics, 157(2):406 -- 427, 2009. [23] S. Heule, M. Nunkesser, and A. Hall. Hyperloglog in practice: Algo- rithmic engineering of a state of the art cardinality estimation algorithm. In EDBT/ICDT, pages 683 -- 692, 2013. [24] N. Hohn and D. Veitch. Inverting sampled traffic. In SIGCOMM, pages 222 -- 233, October 2003. [25] D. Horvitz and D. Thompson. A generalization of sampling without replacement from a finite universe. Journal of the American Statistical Association, 47(260):663 -- 685, 1952. [26] D. M. Kane, J. Nelson, and D. P. Woodruff. An optimal algorithm for the distinct elements problem. In PODS, pages 41 -- 52, 2010. [27] B. Krishnamurthy, S. Sen, Y. Zhang, and Y. Chen. Sketch-based change detection: Methods, evaluation, and applications. In SIGCOMM, pages 234 -- 247, October 2003. [28] A. Kumar, M. Sung, J. Xu, and J. Wang. Data streaming algorithms In for efficient and accurate estimation of flow size distribution. SIGMETRICS, pages 177 -- 188, June 2004. [29] A. Kumar, M. Sung, J. Xu, and E. W. Zegura. A data streaming algorithm for estimating subpopulation flow size distribution. In SIG- METRICS, pages 61 -- 72, June 2005. [30] A. Kumar and J. Xu. Sketch guided sampling -- using onling estimates of flow size for adaptive data collection. In INFOCOM, pages 1 -- 11, April 2006. [31] H. Kwak, C. Lee, H. Park, and S. Moon. What is twitter, a social network or a news media? In WWW, 2010. [32] A. Lall, V. Sekar, M. Ogihara, J. Xu, and H. Zhang. Data streaming algorithms for estimating entropy of network traffic. In SIGMETRICS, pages 145 -- 156, June 2006. [33] P. Lieven and B. Scheuermann. High-speed per-flow traffic measurement In INFOCOM, pages 1253 -- with probabilistic multiplicity counting. 1261, 2010. [34] J. Lumbroso. An optimal cardinality estimation algorithm based on order statistics and its full analysis. In AofA, pages 489 -- 504, 2010. [35] A. Mislove, M. Marcon, K. P. Gummadi, P. Druschel, and B. Bhattachar- jee. Measurement and analysis of online social networks. In IMC, 2007. [36] G. Nychis, V. Sekar, D. G. Andersen, H. Kim, and H. Zhang. An In empirical evaluation of entropy-based traffic anomaly detection. SIGCOMM, pages 151 -- 156, October 2008. [37] B. Ribeiro, T. Ye, and D. Towsley. A resource-minimalist flow size histogram estimator. In SIGCOMM, pages 285 -- 290, October 2008. [38] R. Schweller, Z. Li, Y. Chen, Y. Gao, A. Gupta, E. Parsons, Y. Zhang, P. Dinda, M. yang Kao, and G. Memik. Reversible sketches: Enabling IEEE/ACM monitoring and analysis over high-speed data streams. Transactions on Networking, 15(5):1059 -- 1072, October 2007. [39] J. Tao, P. Wang, X. Guan, and W. Hu. Al-bitmap: Monitoring network traffic activity graphs on high speed links. Inf. Sci., 408:162 -- 175, 2017. [40] D. Ting. Streamed approximate counting of distinct elements: Beating optimal batch methods. In SIGKDD, pages 442 -- 451, 2014. [41] D. Ting. Towards optimal cardinality estimation of unions and intersec- tions with sketches. In SIGKDD, 2016. [42] P. Wang, X. Guan, W. Gong, and D. Towsley. A new virtual indexing In INFOCOM, pages method for measuring host connection degrees. 156 -- 160, April 2011. [43] P. Wang, X. Guan, T. Qin, and Q. Huang. A data streaming method for monitoring host connection degrees of high-speed links. TIFS, 6(3- 2):1086 -- 1098, 2011. [44] P. Wang, X. Guan, D. Towsley, and J. Tao. Virtual indexing based methods for estimating node connection degrees. Computer Networks, 56(12):2773 -- 2787, 2012. [45] P. Wang, X. Guan, J. Zhao, J. Tao, and T. Qin. A new sketch method for measuring host connection degree distribution. TIFS, 9(6):948 -- 960, 2014. [46] K. Whang, B. T. Vander-zanden, and H. M. Taylor. A linear-time prob- abilistic counting algorithm for database applications. IEEE Transaction of Database Systems, 15(2):208 -- 229, June 1990. [47] Q. Xiao, S. Chen, M. Chen, and Y. Ling. Hyper-compact virtual esti- mators for big network data based on register sharing. In SIGMETRICS, pages 417 -- 428, 2015. [48] Q. Xiao, Y. Zhou, and S. Chen. Better with fewer bits: Improving In the performance of cardinality estimation of large data streams. INFOCOM, pages 1 -- 9, 2017. [49] L. Yang and G. Michailidis. Sample based estimation of network traffic flow characteristics. In INFOCOM, pages 1775 -- 1783, May 2007. [50] M. Yoon, T. Li, S. Chen, and J. K. Peir. Fit a spread estimator in small memory. In INFOCOM, pages 504 -- 512, April 2009. [51] M. Yu, L. Jose, and R. Miao. Software defined traffic measurement with opensketch. In USENIX NSDI, pages 29 -- 42, Berkeley, CA, USA, 2013. [52] Y. Zhang, S. Singh, S. Sen, N. G. Duffield, and C. Lund. Online identification of hierarchical heavy hitters: Algorithms, evaluation, and application. In SIGCOMM, pages 101 -- 114, October 2004. [53] H. Zhao, A. Lall, O. Spatscheck, J. Wang, and J. Xu. A data streaming algorithm for estimating entropies of OD flows. In SIGCOMM, pages 279 -- 290, October 2007. [54] Q. Zhao, A. Kumar, and J. Xu. Joint data streaming and sampling tech- niques for detection of super sources and destinations. In SIGCOMM, pages 77 -- 90, October 2005.
1702.07292
1
1702
2017-02-23T16:59:25
Network Construction with Ordered Constraints
[ "cs.DS" ]
In this paper, we study the problem of constructing a network by observing ordered connectivity constraints, which we define herein. These ordered constraints are made to capture realistic properties of real-world problems that are not reflected in previous, more general models. We give hardness of approximation results and nearly-matching upper bounds for the offline problem, and we study the online problem in both general graphs and restricted sub-classes. In the online problem, for general graphs, we give exponentially better upper bounds than exist for algorithms for general connectivity problems. For the restricted classes of stars and paths we are able to find algorithms with optimal competitive ratios, the latter of which involve analysis using a potential function defined over pq-trees.
cs.DS
cs
Network Construction with Ordered Constraints Yi Huang, Mano Vikash Janardhanan, and Lev Reyzin(cid:63) University of Illinois at Chicago, {yhuang89, mjanar2, lreyzin}@uic.edu Abstract. In this paper, we study the problem of constructing a net- work by observing ordered connectivity constraints, which we define herein. These ordered constraints are made to capture realistic prop- erties of real-world problems that are not reflected in previous, more general models. We give hardness of approximation results and nearly- matching upper bounds for the offline problem, and we study the online problem in both general graphs and restricted sub-classes. In the online problem, for general graphs, we give exponentially better upper bounds than exist for algorithms for general connectivity problems. For the re- stricted classes of stars and paths we are able to find algorithms with optimal competitive ratios, the latter of which involve analysis using a potential function defined over pq-trees. Keywords: graph connectivity, network construction, ordered connec- tivity constraints, pq-trees 1 Introduction In this paper, we study the problem of recovering a network after observing how information propagates through the network. Consider how a tweet (through "retweeting" or via other means) propagates through the Twitter network -- we can observe the identities of the people who have retweeted it and the timestamps when they did so, but may not know, for a fixed user, via whom he got the original tweet. So we see a chain of users for a given tweet. This chain is semi-ordered in the sense that, each user retweets from some one before him in the chain, but not necessarily the one directly before him. Similarly, when a virus such as Ebola spreads, each new patient in an outbreak is infected from someone who has previously been infected, but it is often not immediately clear from whom. In a graphical social network model with nodes representing users and edges representing links, an "outbreak" illustrated above is captured exactly by the concept of an ordered constraint which we will define formally below. One could hope to be able to learn something about the structure of the network by observing repeated outbreaks, or a sequence of ordered constraints. Formally we call our problem Network Construction with Ordered Constraints and define it as follows. Let V = {v1, . . . , vn} be a set of ver- tices. An ordered constraint O is an ordering on a subset of V of size s ≥ 2. (cid:63) Supported in part by ARO grant 66497-NS. 7 1 0 2 b e F 3 2 ] S D . s c [ 1 v 2 9 2 7 0 . 2 0 7 1 : v i X r a 2 Yi Huang, Mano Vikash Janardhanan, Lev Reyzin least one 1 ≤ j < i such that the edge e =(cid:8)vkj , vki The constraint O = (vk1, . . . , vks) is satisfied if for any 2 ≤ i ≤ s, there exists at Given a collection of ordered constraints {O1, . . . ,Or}, the task is to construct a set E of edges among the vertices V such that all the ordered constraints are satisfied and E is minimized. (cid:9) is included in a solution. We can see that our newly defined problem resides in a middle ground be- tween path constraints, which are too rigid to be very interesting, and the well- studied subgraph connectivity constraints [7,17,18], which are more relaxed. The established subgraph connectivity constraints problem involves getting an arbi- trary collection of connectivity constraints {S1, . . . , Sr} where each Si ⊂ V and requires vertices in a given constraint to form a connected induced subgraph. The task is to construct a set E of edges satisfying the connectivity constraints such that E is minimized. We want to point out one key observation relating the ordered constraint to the connectivity constraint -- an ordered constraint O = (vk1 , . . . , vks ) is equivalent to s−1 connectivity constraints S2, . . . , Ss, where Si = {vk1, . . . , vki}. We note that this observation plays an important role in several proofs in this paper which employ previous results on subgraph connectivity constraints -- in particular, upper bounds from the more general case can be used in the ordered case (with some overhead), and our lower bounds apply to the general problem. In the offline version of the Network Construction with Ordered Constraints problem, the algorithm is given all of the constraints all at once; in the online version of the problem, the constraints are given one by one to the algorithm, and edges must be added to satisfy each new constraint when it is given. Edges cannot be removed. An algorithm is said to be c-competitive if the cost of its solution is less than c times OPT, where OPT is the best solution in hindsight (c is also called the competitive ratio). When we restrict the underlying graph in a problem to be a class of graphs, e.g. trees, we mean all the constraints can be satisfied, in an optimal solution (for the online case, in hindsight), by a graph from that class. 1.1 Past Work In this paper we study the problem of network construction from ordered con- straints. This is an extension of the more general model where constraints come unordered. For the general problem, Korach and Stern [17] had some of the initial results, in particular for the case where the constraints can be optimally satisfied by a tree, they give a polynomial time algorithm that finds the optimal solution. In subsequent work, in [18] Korach and Stern considered this problem for the even more restricted problem where the optimal solution forms a tree, and all of the connectivity constraints must be satisfied by stars. Then, Angluin et al. [7] studied the general problem, where there is no re- striction on structure of the optimal solution, in both the offline and online settings. In the offline case, they gave nearly matching upper and lower bounds on the hardness of approximation for the problem. In the online case, they give Network Construction with Ordered Constraints 3 a O(n2/3 log2/3 n)-competitive algorithm against oblivious adversaries; we show that this bound can be drastically improved in the ordered version of the prob- lem. They also characterized special classes of graphs, i.e. stars and paths, which we are also able to do herein for the ordered constraint case. Independently of that work, Chockler et al. [12] also nearly characterized the offline general case. In a different line of work Alon et al. [3] explore a wide range of network optimization problems; one problem they study involves ensuring that a network with fractional edge weights has a flow of 1 over cuts specified by the constraints. Alon et al. [2] also study approximation algorithms for the Online Set Cover problem which have been shown by Angluin et al [7] to have connections with Network Construction problems. In related areas, Gupta et al. [16] considered a network design problem for pairwise vertex connectivity constraints. Moulin and Laigret [19] studied network connectivity constraints from an economics perspective. Another motivation for studying this problem is to discover social networks from observations. This and similar problems have also been studied in the learning context [5,6,14,22]. Finally, in query learning, the problem of discovering networks from connec- tivity queries has been much studied [1,4,8,9,15,21]. In active learning of hidden networks, the object of the algorithm is to learn the network exactly. Our model is similar, except the algorithm only has the constraints it is given, and the task is to output the cheapest network consistent with the constraints. 1.2 Our results In Section 2, we examine the offline problem, and show that the Network Con- struction problem is NP-Hard to approximate within a factor of Ω(log n). A nearly matching upper bound comes from Theorem 2 of [7]. In Section 3, we study online problem. For problems on n nodes, for r con- straints, we give an O ((log r + log n) log n) competitive algorithm against obliv- ious adversaries, and an Ω(log n) lower bound (Section 3.1). Then, for the special cases of stars and paths (Sections 3.2 and 3.3), we find asymptotic optimal competitive ratios of 3/2 and 2, respectively. The proof of the latter uses a detailed analysis involving pq-trees [10]. The competitive ratios are asymptotic in n. 2 The offline problem In this section, we examine the Network Construction with Ordered Constraints problem in the offline case. We are able to obtain the same lower bound as Angluin et al. [7] in the general connectivity constraints case. Theorem 1. If P(cid:54)=NP, the approximation ratio of the Network Construction with Ordered Constraints problem is Ω(log n). Proof. We prove the theorem by reducing from the Hitting Set problem. Let (U,S) be a hitting set instance, where U = {u1, . . . , un} is the universe, and 4 Yi Huang, Mano Vikash Janardhanan, Lev Reyzin S = {S1, . . . , Sm} is a set of subsets of U . A subset H ⊂ U is called a hitting set if H ∩ Si (cid:54)= ∅. The objective of the Hitting Set problem is to minimize H. We know from [13,20] that the Hitting Set problem cannot be approximated by any polynomial time algorithm within a ratio of o(log n) unless P=NP. Here we show that the Network Construction problem is inapproximable better than an O(log n) factor by first showing that we can construct a corresponding Network Construction instance to any given Hitting Set instance, and then showing that if there is a polynomial time algorithm that can achieve an approximation ratio o(log n) to the Network Construction problem, then the Hitting Set problem can also be approximated within in a ratio of o(log n), which is a contradiction. We first define a Network Construction instance, corresponding to a given Hitting Set instance (U,S), with vertex set U ∪ W , where W = {w1, . . . , wnc} for some c > 2. Note that we use the elements of the universe of hitting set in- stance as a part of the vertex set of Network Construction instance. The ordered constraints are the union of the following two sets: -- {(ui, uj)}1≤i<j≤n; -- {(Sk, wl)}Sk∈S,1≤l≤nc , where by (Sk, wl) we mean an ordered constraint with all vertices except the last one from a subset Sk of U , while the last vertex wl is an element in W . The vertices from Sk are ordered arbitrarily. We note that the first set of ordered constrains forces a complete graph on U , and the second set of ordering demands that there is at least one edge going out from each Sk connecting each element in W . More specifically let El denote the set of edges incident to wl belonging to any solution to the Network Construction instance. Because of the second set of ordered constraints, the set Hl = {u ∈ U{u, wl} ∈ El} is a hitting set of S! Let H ⊂ U be any optimal solution to the hitting set instance, and denote by OPTH the size of H, it is easy to see the two sets of ordered constraints can be satisfied by putting a complete graph on U and a complete bipartite graph between H and W . Hence the optimal solution to the Network Construction instance satisfies (cid:18)n (cid:19) 2 OPT ≤ + nc OPTH, where OPT is the minimum number of edges needed to solve the Network Con- struction instance. Let us assume that there is a polynomial time approximation algorithm to the Network Construction problem that adds ALG edges. Without loss of generality we can assume that the algorithm add no edge among vertices in W , because any edge within W can be removed without affecting the correct- El. Now if ALG is in the order o (log nOPT), from the fact that Hl = El, we get ness of the solution, which implies that ALG =(cid:0)n o(cid:0)log n(cid:0)(cid:0)n (cid:1)(cid:1) −(cid:0)n (cid:1) (cid:1) +(cid:80)nc (cid:1) + nc OPTH 2 Hl ≤ ALG −(cid:0)n 2 (cid:1) = 2 l min 1≤l≤nc nc 2 nc = o (log n OPTH) , Network Construction with Ordered Constraints 5 which means by finding the smallest set Hl0 among all the Hls, we get a hitting set that has size within an o(log n) factor of the optimal solution to the Hitting (cid:117)(cid:116) Set instance, which is a contradiction. We also observe that the upper bound from the more general problem implies a bound in our ordered case. We note the upper and lower bounds match when r = poly(n). Corollary 1 (of Theorem 2 from Angluin et al. [7]). There is a polynomial time O(log r+log n)-approximation algorithm for the Network Construction with Ordered Constraintsproblem on n nodes and r constraints. Proof. Observing that r ordered constraints imply at most nr unordered con- straints on a graph with n nodes, we can use the O(log r) upper bound from (cid:117)(cid:116) Angluin et al. [7]. 3 The online problem Here, we study the online problem, where constraints come in one at a time, and the algorithm must satisfy them by adding edges as the constraints arrive. 3.1 Arbitrary graphs Theorem 2. The competitive ratio for Online Network Construction with Ordered Constraints problem on n nodes and r ordered constraints has an upper bound of O ((log r + log n) log n) against an oblivious adversary. Proof. To prove the statement, we first define the Fractional Network Con- struction problem, which has been shown by Angluin et al. [7] to have an O(log n)-approximation algorithm. The upper bound is then obtained by ap- plying a probabilistic rounding scheme to the fractional solution given by the approximation. The proof heavily relies on arguments developed by Buchbinder and Noar [11], and Angluin et al. [7]. In the Fractional Network Construction problem, we are also given a set of vertices and a set of constraints {S1, . . . , Sr} where each Si is a subset of the vertex set. Our task is to assign weights we to each edge e so that the maximum flow between each pair of vertices in Si is at least 1. The optimization problem is to minimize(cid:80) we. Since subgraph connectivity constraint is equiva- lent to requiring a maximum flow of 1 between each pair of vertices with edge weight we ∈ {0, 1}, the fractional network construction problem is the linear relaxation of the subgraph connectivity problem. Lemma 2 of Angluin et al. [7] gives an algorithm that multiplicatively updates the edge weights until all the flow constraints are satisfied. It also shows that the sum of weights given by the algorithm is upper bounded by O(log n) times the optimum. As we pointed out in the introduction, an ordered constraint O is equivalent to a sequence of subgraph connectivity constraints. So in the first step, we feed 6 Yi Huang, Mano Vikash Janardhanan, Lev Reyzin the r sequences of connectivity constraints, each one is equivalent to an ordered constraint, to the approximation algorithm to the fractional network construc- tion problem and get the edge weights. Then we apply a rounding scheme similar to the one considered by Buchbinder and Noar [11] to the weights. For each edge e, we choose t random variables X(e, i) independently and uniformly from [0, 1], i=1 X(e, i). We add e to the graph if we ≥ T (e). and let the threshold T (e) = mint Since the rounding scheme has no guarantee to produce a feasible solution, the first thing we need to do is to determine how large t should be to make all the ordered constraints satisfied with high probability. We note that an ordered constraint Oi = {vi1, vi2, . . . , visi} is satisfied if and only if the (s − 1) connectivity constraints {vi1, vi2}, . . . , {vi1, . . . , visi−1, visi} fixed cut C, the probability the cut is not crossed equals (cid:81) are satisfied which is equivalent, in turn, to the fact that there is an edge that goes across the ({vi1, . . . , vij−1} ,{vij}) cut, for 2 ≤ j ≤ si. For any exp(cid:0)−t(cid:80) e∈C(1 − we)t ≤ (cid:80) c∈C we ≥ 1 in the fractional solution given by the approximation algorithm for all cut C = ({vi1, . . . , vij−1} ,{vij}), 1 ≤ i ≤ r, 2 ≤ j ≤ si, and hence the probability that there exists at least one unsatisfied Oi is upper bounded by rn exp (−t). So t = c(log n + log r), for any c > 1, makes the probability that the rounding scheme fails to produce a feasible solution approaches 0 as n increases. Because the probability that e is added equals the probability that at least one X(e, i) is less than we, and hence is upper bounded by wet, we get the (cid:1) . By the max-flow min-cut correspondence, we know that expected number of edges added is upper bounded by t(cid:80) we by linearity of e∈C we expectation. Since the fractional solution is upper bounded by O(log n) times the optimum of the fractional problem, which is upper bounded by any integral solution, our rounding scheme gives a solution that is O ((log r + log n) log n) (cid:117)(cid:116) times the optimum. Corollary 2. If the number of ordered constraints r = poly(n), then the algo- rithm above gives a O(cid:0)(log n)2(cid:1) upper bound for the competitive ratio against an oblivious adversary. edges such that the connectivity constraints are satisfied and (cid:80) cewe is min- Remark 1. We can generalise theorem 2 to the weighted version of the Online Network Construction with Ordered Constraints problem. In the weighted ver- sion, each edge e = (u, v) is associated with a cost ce and the task is to select imised where we ∈ {0, 1} is a variable indicating whether an edge is picked or not and ce is the cost of the edge. The same approach in the proof of Theorem 2 gives an upper bound of O ((log r + log n) log n) for the competitive ratio of the weighted version of the Online Network Construction with Ordered Constraints problem. Theorem 3. This is a Ω(log n) lower bound for the competitive ratio for the Online Network Construction with Ordered Constraints problem against an oblivious adversary. Proof. The adversary divides the vertex set into two parts U and V , where U = n, and gives the constraints as follows. Firstly, it n and V = n − √ √ Network Construction with Ordered Constraints 7 forces a complete graph in U by giving the constraint {ui, uj} for each pair of vertices ui, uj ∈ U . At this stage both the algorithm and optimal solution will have a clique in U , which costs Θ(n). Then, for each v ∈ V , first fix a random permutation πv on U and give the ordered constraint O(v,i) = (πv(1), πv(2), . . . , πv(i), v) . First note that all these constraints can be satisfied by adding ev = {πv(1), v} for each v ∈ V which costs Θ(n). However, the adversary gives constraints in the following order: O(v, √ n),O(v, √ n−1), . . . ,O(v,1). We now claim that for each v ∈ V2, the algorithm will add Ω(log n) edges in expectation. This is because each edge added by the algorithm is a random guess for πv(1) and this edge cuts down the number of unsatisfied O(v,i) by half in expectation. This means the algorithm adds Ω(n + n log n) edges. This gives (cid:117)(cid:116) us the desired result because OPT = O(n). Now we study the online problem when it is known that an optimal graph can be a star or a path. These special cases are challenging in their own right and are often studied in the literature to develop more general techniques [7]. 3.2 Stars Theorem 4. The optimal competitive ratio for the Online Network Con- struction with Ordered Constraints problem when the algorithm knows that an optimal solution forms a star is asymptotically 3/2. Proof. For lower bound, we note that the adversary can simply give Oi = (v1, v2, vi), 3 ≤ i ≤ n obliviously for the first n − 2 rounds. Then an algo- rithm, besides adding {v1, v2} in the first round, can only choose from adding either {v1, vi} or {v2, vi}, or both in each round. After the first n− 2 rounds, the adversary counts the number of v1 and v2's neighbors, and chooses the one with fewer neighbors, say v1, to be the center by adding (v1, vi) for some 3 ≤ i ≤ n. Since the algorithm has to add at least (cid:100)(n − 2)/2(cid:101) edges that are unnecessary in the hindsight, we get an asymptotic lower bound 3/2. For upper bound, assume that the first ordered constraint is O1 is (v1, v2, . . . ), the algorithm works as follows: 1. It adds {v1, v2} in the first round. 2. Then for any constraint that starts with v1 and v2, it splits the remaining vertices in the constraint (other than v1 and v2) into two sets of sizes differing by at most 1, and connects each vertex in first set to v1 and each vertex in the other set to v2. 3. Upon seeing a constraint that does not start with v1 and v2, which reveals the center of the star, it connects the center to all vertices that are not yet connected to the center. Since the algorithm adds, at most n/2 − 1 edges to the wrong center, this gives (cid:117)(cid:116) us an asymptotic upper bound 3/2, which matches the lower bound. 8 Yi Huang, Mano Vikash Janardhanan, Lev Reyzin 3.3 Paths In the next two theorems, we give matching lower and upper bounds (in the limit) for path graphs. Theorem 5. The competitive ratio for the Online Network Construction with Ordered Constraints problem when the algorithm knows that the optimal solution forms a path has an asymptotic lower bound of 2. Proof. Fix an arbitrary ordering of the vertices {v1, v2, v3, . . . , vn}. For 3 ≤ i ≤ n, define the pre-degree of a vertex vi to be the number of neighbors vi has in {v1, v2, v3, . . . , vi−1}. Algorithm 1 below is a simple strategy the adversary can take to force v3, . . . , vn to all have pre-degree at least 2. Since any algorithm will add at least 2n − 3 edges, this gives an asymptotic lower bound of 2. Suppose Algorithm 1 Forcing pre-degree to be at least 2 Give ordered constraint O = (v1, v2, v3, . . . , vn) to the algorithm; for i = 3 to n do if the pre-degree of vi is at least 2 then continue; else pick up at random a path (say Pi) that satisfies all the constraints up to this round and an endpoint u of the path that is not connected to vi, and gives the algorithm the constraint (vi, u); end if end for Pi was the path picked in round i (i.e. Pi satisfies all constraints upto round i). Then, Pi along with the edge (vi, u) is a path that satisfies all constraints upto round i + 1. Hence by induction, for all i, there is a path that satisfies all (cid:117)(cid:116) constraints given by the adversary upto round i. Theorem 6. The competitive ratio for the Online Network Construction with Ordered Constraints problem when the algorithm knows that the optimal solution forms a path has an asymptotic upper bound of 2. Proof. For our algorithm matching the upper bound, we use the pq-trees, intro- duced by Booth and Lueker [10], which keep track all consistent permutations of vertices given contiguous intervals of vertices. Our analysis is based on ideas from Angluin et al. [7], who also use pq-trees for analyzing the general problem.1 A pq-tree is a tree whose leaf nodes are the vertices and each internal node is either a p-node or a q-node. -- A p-node has a two or more children of any type. The children of a p-node form a contiguous interval that can be in any order. 1 Angluin et al. [7] have a small error in their argument because their potential function fails to explicitly consider the number of p-nodes, which creates a problem for some of the pq-tree updates. We fix this, without affecting their asymptotic bound. For the ordered constraints case, we are also able to obtain a much finer analysis. Network Construction with Ordered Constraints 9 -- A q-node has three or more children of any type. The children of a q-node form a contiguous interval, but can only be in the given order of its inverse. Every time a new interval constraint comes, the tree update itself by identifying any of the eleven patterns, P0, P1,. . . , P6, and Q0, Q1, Q2, Q3, of the arrange- ment of nodes and replacing it with each correspondent replacement. The update fails when it cannot identify any of the patterns, in which case the contiguous intervals fail to produce any consistent permutation. We refer readers to Section 2 of Booth and Lueker [10] for a more detailed description of pq-trees. The reason we can use a pq-tree to guide our algorithm is because of an ob- servation made in Section 1 that each ordered constraint (v1, v2, v3, . . . , vk−1, vk) is equivalent to k interval constraints {v1, v2} ,{v1, v2, v3} ,··· ,{v1, . . . , vk−1} , {v1, . . . , vk−1, vk} . So upon seeing one ordered constraints, we reduce the pq- tree with the equivalent interval constraints, in order. Then what our algorithm does is simply to add edge(s) to the graph every time a pattern is identified and replaced with its replacement, so that the graph satisfies all the seen con- straints. Note that to reduce the pq-tree with one interval constraint, there may be multiple patterns identified and hence multiple edges may be added. Before running into details of how the patterns determine which edge(s) to add, we note that, without loss of generality, we can assume that the the algorithm is in either one of the following two stages. -- The pq-tree is about to be reduced with {v1, v2}. -- The pq-tree is about to be reduced with {v1, . . . , vk}, when the reductions with {v1, v2} ,··· , {v1, . . . , vk−1} have been done. Because of the structure of constraints discussed above, we do not encounter all pq-tree patterns in their full generality, but in the special forms demonstrated in Table 1. Based on this, we make three important observations which can be verified by carefully examining how a pq-tree evolves along with our algorithm. 1. The only p-node that can have more than two children is the root. 2. At least one of the two children of a non-root p-node is a leaf node. 3. For all q-nodes, there must at least one leaf node in any two adjacent children. Hence, Q3 doesn't appear. Now we describe how the edges are going to be added. Note that a pq-tree inherently learns edges that appear in optimum even when those edges are not forced by constraints. Apart from adding edges that are necessary to satisfy the constraints, our algorithm will also add any edge that the pq-tree inherently learns. For all the patterns except Q2 such that a leaf node vk is about to be added as a child to a different node, we can add one edge joining vk to vk−1. For all such patterns except Q2, it is obvious that this would satisfy the current constraint and all inherently learnt edges are also added. For Q2, the pq-tree could learn two edges. The first edge is (vk, vk−1). The second one is an edge between the leftmost subtree of the daughter q-node (call Tl) and the node to its left (call vl). Based on Observation 3, vl is a leaf. But based on the algorithm, one of these two edges is already added. Hence, we only need to add one edge when Q2 is applied. For P5, we add the edge as shown in Table 1. 10 Yi Huang, Mano Vikash Janardhanan, Lev Reyzin Pattern Replacement P2 P3 P4(1) P4(2) P5 P6(1) P6(2) Q2 Table 1: Specific patterns and replacements that appear through the algorithm. P4(1) denotes the case of P4 where the top p-node is retained in the replacement and P4(2) denotes the case where the top p-node is deleted. The same is true for P6. P0, P1, Q0, and Q1 are just relabelling rules, and we have omitted them because no edges need to be added. We use the same shapes to represent p-nodes, q-nodes, and subtrees as in Booth and Lueker's paper [10] for easy reference, and we use diamonds to represent leaf nodes. vkvkvkvkvkvkvkvkvkvkvkvk Network Construction with Ordered Constraints 11 Let us denote by P and Q the sets of p-nodes and q-nodes, respectively, and by c(p) the number of children node p has. And let potential function φ of a tree T be defined as φ(T ) = a c(p) + bP + cQ, (cid:88) p∈P where a, b, and c are coefficients to be determined later. number of edges added (cid:80) p∈P c(p) P Q −∆Φ 0 −a − b 1 2a + b − c 0 0 0 0 −1 0 −1 0 −2 1 1 −2 −1 −1 0 −2 −1 2a + b −2 −1 2a + b −1 a + c −2 −1 −1 2a + b + c 0 0 a P2 P3 P4(1) P4(2) P5 P6(1) P6(2) Q2 Q3 1 0 1 1 1 1 1 1 1 Table 2: How the terms in the potential function: (cid:80) c 2c change according to the updates. p∈P c(p), P, and Q We want to upper bound the number of edges added for each pattern by the drop of potential function. We collect the change in the three terms in the potential function that each replacement causes in Table 2, and we can solve a simple linear system to get that choosing a = 2, b = −3, and c = 1 is sufficient. For ease of analysis, we add a dummy vertex vn+1 that does not appear in any constraint. Now, the potential function starts at 2n − 1 (a single p-node with n + 1 children) and decreases to 2 when a path is uniquely determined. Hence, the number of edges added by the algorithm is 2n − 3, which gives the desired (cid:117)(cid:116) asymptotic upper bound. References 1. Noga Alon and Vera Asodi. Learning a hidden subgraph. SIAM Journal on Discrete Mathematics, 18(4):697 -- 712, 2005. 2. Noga Alon, Baruch Awerbuch, and Yossi Azar. The online set cover problem. In Proceedings of the thirty-fifth annual ACM symposium on Theory of computing, pages 100 -- 105. ACM, 2003. 3. Noga Alon, Baruch Awerbuch, Yossi Azar, Niv Buchbinder, and Joseph Seffi Naor. A general approach to online network optimization problems. ACM Transactions on Algorithms (TALG), 2(4):640 -- 660, 2006. 4. Noga Alon, Richard Beigel, Simon Kasif, Steven Rudich, and Benny Sudakov. Learning a hidden matching. SIAM Journal on Computing, 33(2):487 -- 501, 2004. 5. Dana Angluin, James Aspnes, and Lev Reyzin. Optimally learning social networks In International Conference on Algorithmic with activations and suppressions. Learning Theory, pages 272 -- 286. Springer, 2008. 12 Yi Huang, Mano Vikash Janardhanan, Lev Reyzin 6. Dana Angluin, James Aspnes, and Lev Reyzin. Inferring social networks from In International Conference on Algorithmic Learning Theory, pages outbreaks. 104 -- 118. Springer, 2010. 7. Dana Angluin, James Aspnes, and Lev Reyzin. Network construction with sub- graph connectivity constraints. Journal of Combinatorial Optimization, 29(2):418 -- 432, 2015. 8. Dana Angluin and Jiang Chen. Learning a hidden graph using o (logn) queries per edge. Journal of Computer and System Sciences, 74(4):546 -- 556, 2008. 9. Richard Beigel, Noga Alon, Simon Kasif, Mehmet Serkan Apaydin, and Lance Fortnow. An optimal procedure for gap closing in whole genome shotgun sequenc- ing. In Proceedings of the fifth annual international conference on Computational biology, pages 22 -- 30. ACM, 2001. 10. Kellogg S Booth and George S Lueker. Testing for the consecutive ones property, interval graphs, and graph planarity using pq-tree algorithms. Journal of Computer and System Sciences, 13(3):335 -- 379, 1976. 11. Niv Buchbinder and Joseph Naor. The design of competitive online algorithms via a primal: dual approach. Foundations and Trends R(cid:13) in Theoretical Computer Science, 3(2 -- 3):93 -- 263, 2009. 12. Gregory Chockler, Roie Melamed, Yoav Tock, and Roman Vitenberg. Constructing scalable overlays for pub-sub with many topics. In Proceedings of the twenty-sixth annual ACM symposium on Principles of distributed computing, pages 109 -- 118. ACM, 2007. 13. Uriel Feige. A threshold of ln n for approximating set cover. Journal of the ACM (JACM), 45(4):634 -- 652, 1998. 14. Manuel Gomez-Rodriguez, Jure Leskovec, and Andreas Krause. Inferring networks of diffusion and influence. ACM Transactions on Knowledge Discovery from Data (TKDD), 5(4):21, 2012. 15. Vladimir Grebinski and Gregory Kucherov. Reconstructing a hamiltonian cycle by querying the graph: Application to dna physical mapping. Discrete Applied Mathematics, 88(1):147 -- 165, 1998. 16. Anupam Gupta, Ravishankar Krishnaswamy, and R Ravi. Online and stochastic survivable network design. SIAM Journal on Computing, 41(6):1649 -- 1672, 2012. 17. Ephraim Korach and Michal Stern. The clustering matroid and the optimal clus- tering tree. Mathematical Programming, 98(1-3):385 -- 414, 2003. 18. Ephraim Korach and Michal Stern. The complete optimal stars-clustering-tree problem. Discrete Applied Mathematics, 156(4):444 -- 450, 2008. 19. Herv´e Moulin and Francois Laigret. Equal-need sharing of a network under con- nectivity constraints. Games and Economic Behavior, 72(1):314 -- 320, 2011. 20. Ran Raz and Shmuel Safra. A sub-constant error-probability low-degree test, and a sub-constant error-probability pcp characterization of np. In Proceedings of the twenty-ninth annual ACM symposium on Theory of computing, pages 475 -- 484. ACM, 1997. 21. Lev Reyzin and Nikhil Srivastava. Learning and verifying graphs using queries with a focus on edge counting. In International Conference on Algorithmic Learning Theory, pages 285 -- 297. Springer, 2007. 22. Kazumi Saito, Ryohei Nakano, and Masahiro Kimura. Prediction of information diffusion probabilities for independent cascade model. In International Conference on Knowledge-Based and Intelligent Information and Engineering Systems, pages 67 -- 75. Springer, 2008.
1806.01581
1
1806
2018-06-05T09:38:34
Dynamic Programming Optimization in Line of Sight Networks
[ "cs.DS" ]
Line of Sight (LoS) networks were designed to model wireless communication in settings which may contain obstacles restricting node visibility. For fixed positive integer $d$, and positive integer $\omega$, a graph $G=(V,E)$ is a ($d$-dimensional) LoS network with range parameter $\omega$ if it can be embedded in a cube of side size $n$ of the $d$-dimensional integer grid so that each pair of vertices in $V$ are adjacent if and only if their embedding coordinates differ only in one position and such difference is less than $\omega$. In this paper we investigate a dynamic programming (DP) approach which can be used to obtain efficient algorithmic solutions for various combinatorial problems in LoS networks. In particular DP solves the Maximum Independent Set (MIS) problem in LoS networks optimally for any $\omega$ on {\em narrow} LoS networks (i.e. networks which can be embedded in a $n \times k \times k \ldots \times k$ region, for some fixed $k$ independent of $n$). In the unrestricted case it has been shown that the MIS problem is NP-hard when $ \omega > 2$ (the hardness proof goes through for any $\omega=O(n^{1-\delta})$, for fixed $0<\delta<1$). We describe how DP can be used as a building block in the design of good approximation algorithms. In particular we present a 2-approximation algorithm and a fast polynomial time approximation scheme for the MIS problem in arbitrary $d$-dimensional LoS networks. Finally we comment on how the approach can be adapted to solve a number of important optimization problems in LoS networks.
cs.DS
cs
Dynamic Programming Optimization in Line of Sight Networks Pavan Sangha, Prudence W. H. Wong, Michele Zito Department of Computer Science University of Liverpool Liverpool, United Kingdom e-mail: [email protected], [email protected], [email protected] June 6, 2018 Abstract Line of Sight (LoS) networks were designed to model wireless communication in settings which may contain obstacles restricting node visibility. For fixed positive integer d, and positive integer ω, a graph G = (V, E) is a (d-dimensional) LoS network with range parameter ω if it can be embedded in a cube of side size n of the d- dimensional integer grid so that each pair of vertices in V are adjacent if and only if their embedding coordinates differ only in one position and such difference is less than ω. In this paper we investigate a dynamic programming (DP) approach which can be used to obtain efficient algorithmic solutions for various combinatorial problems in LoS networks. In particular DP solves the Maximum Independent Set (MIS) problem in LoS networks optimally for any ω on narrow LoS networks (i.e. networks which can be embedded in a n × k × k . . . × k region, for some fixed k independent of n). In the unrestricted case it has been shown that the MIS problem is NP-hard when ω > 2 (the hardness proof goes through for any ω = O(n1−δ), for fixed 0 < δ < 1). We describe how DP can be used as a building block in the design of good approximation algorithms. In particular we present a 2-approximation algorithm and a fast polyno- mial time approximation scheme for the MIS problem in arbitrary d-dimensional LoS networks. Finally we comment on how the approach can be adapted to solve a number of important optimization problems in LoS networks. 1 Introduction A wireless network typically consists of devices that communicate using radio frequencies, bluetooth or other wireless protocols. Geometric graphs often provide a good model for such networks with vertices representing the devices, and edges associated to the communication 1 ability between pairs of devices. A number of issues reduce the potential of wireless com- munication. First of all there is typically a communication range restriction: devices should be close in distance in order to be able to communicate. Also, real world wireless networks are typically prone to line of sight restrictions, often due to the presence of a large number of obstacles, like those found in urban settings. A group of devices can only communicate if they are both close and also there is no obstacle between them. While the presence of obstacles can be difficult to model, it is clear that a good model of wireless network should ideally incorporate both communication range restrictions and line of sight restrictions. Frieze et al. [11] introduced the notion of (random) 2-dimensional Line of Sight (LoS) networks and studied connectivity problems in this setting. Since then connectivity in higher dimensions, percolation and communication problems have been analyzed [9, 3, 8] in the same n be the d-dimensional cube {1, . . . , n}d. We model. For positive integers d, k and n, let Zd will also work with narrow "cubes" {1, . . . , n} × {1, . . . , x1} × . . . × {1, . . . , xd}, where the xi are positive integers bound by k, a positive integer constant independent of n, which we denote by Zd n,k. We say that distinct points p1 and p2 in one of these cubes share a line of sight if their coordinates differ in a single place. In this paper we mainly work with (vertex) weighted graphs: these will be described by triples (V, E, w) where as usual V is the set of nodes, E is the set of edges, and w is a function assigning a positive weight to each element of V . An unweighted graph is a weighted graph whose weighting function is the constant w(v) = 1 for all v ∈ V . A graph G = (V, E, w) is said to be a (narrow) Line of Sight (LoS) network (with parameters n, k and ω) if there exists an embedding fG : V → Zd n (resp. with fG(V ) ⊆ Zd n,k) such that {u, v} ∈ E if and only if fG(u) and fG(v) share a line of sight and the (Manhattan) distance between fG(u) and fG(v) is less than ω. We refer to ω as the range parameter of the network. LoS networks keep the distance constraints of other geometric models [6] but also provide a simple mechanism to model communication in an environment containing obstacles. In this work we mainly focus on the Maximum Independent Set (MIS) problem (as defined for instance in [10]). In fact we work with the weighted version of this problem, where one is after an independent set of the largest possible total weight, defined as the sum of the weights of the elements of the chosen set. (Narrow) unweighted LoS networks could be seen as simplistic models of urban environment (e.g. a portion of Manhattan, where junctions correspond to nodes and range constraints define the possible connections). In this context large independent sets could be used to assign police officers to junctions so as to maximize the police presence (but still guarantee that two officers cannot shoot each other, assuming their gun's firing range is at most ω − 1 blocks). In general finding the largest independent sets in a graph is NP-hard [12] and even finding good approximate solutions in polynomial time is difficult [13]. On LoS networks, in the unweighted case, if ω = 2 or n the problem can be solved optimally in polynomial time. However, Sangha and Zito [14] showed that the general problem is NP-hard for ω = O(n1−δ) where 0 < δ < 1 is fixed, and that it admits a d-approximation for any ω and an efficient polynomial time approximation scheme (EPTAS) [5] for constant ω. In this paper we describe two algorithms that are guaranteed to output good quality 2 solutions for the MIS in LoS networks when ω is a constant independent of the cube size n. The first one is an approximation algorithm that returns a solution whose total weight is at least half the weight of an optimal solution on any given instance, in any dimension d. For d > 2 no such algorithm was known. The second one is a new polynomial time approximation scheme (EPTAS [4]) that is faster than the one in [14]. The two results hinge on a dynamic programming strategy that can be used to solve optimally the MIS problem on narrow instances, for any ω. The technique also finds application [2] in the following scheduling problems. Suppose that a company manages advertisements from some k clients over a long period of n discrete time points. At any time advertisements of some subset of clients are available to be aired but the company can only select a certain number l of them to advertise due to resource limitation. In addition some "advertisement diversity" policy requires that advertisements from the same client cannot be aired more than once in a given period of ω − 1 time instants. The goal of the company is to schedule the airing of these advertisements satisfying the constraints and maximising the number of advertisements aired. This problem (which from now on will be referred to as AdsSched) has one slight difference from the MIS problem on narrow 2-dimensional LoS networks, in the sense that the "proximity" restriction only applies to one dimension (the time dimension) but not the other (the client dimension). Nevertheless, as to be showed later, the solution we develop can be adapted to solve this problem. Finally, we remark that the approximation strategies described in the context of the MIS apply to a number of other optimization problems in LoS networks. These include Vertex Cover, Min Dominating Set, Min Edge Dominating Set, Max Triangle Packing, Max H-matching, Max Tile Salvage. The rest of the paper is organized as follows. After a section containing some useful definitions, in Section 3, we describe our main technical tool: a dynamic programming approach that solves optimally the MIS problem in narrow (LoS network) instances. We present the algorithm, a proof of correctness and a simple application to the AdsSched problem defined above. The remaining sections present further applications of this idea. Section 4 describes how the dynamic programming algorithm can be incorporated in a semi- online [1] algorithm which always returns a good quality feasible solution to the MIS problem on narrow instances. Section 5 presents the approximation algorithm for the MIS problem in general d-dimensional LoS networks, whereas Section 6 focuses on the EPTAS for the 2-dimensional case, and some additional applications. Section 7 wraps up the paper with a summary of the results presented and some directions for future work. 2 Problem Definitions and Preliminaries In this paper arrays will be d-dimensional tables of non-negative numbers. In particular, for fixed k > 0, narrow arrays are tables of size x1 × . . .× xd−1 × y where the xi ∈ {1, . . . , k} for all i ∈ {1, . . . , d− 1} whereas y is a positive integer no larger than n. It will be convenient to group the first d− 1 indices and so we will often write xd−1 × y instead of x1 × . . .× xd−1 × y or A[i, j] instead of A[i1, . . . , id−1, j]. In this context the jth column of array A will be the collection of elements A[i, j] for all possible values of i. 3 Figure 1: Figure (i) is a graph G and Figure (ii) is its LoS embedding in an 8 × 4 rectangle in Z2 with ω = 4. Figure (iii) represents the array layout of G (ignoring the first ω columns of zeroes) and Figure(iv) is an independent array of largest array sum, corresponding to the largest independent set in the graph G. • For any array A and j1, j2 ∈ {1, . . . , n} with j1 ≤ j2, denote by A[j1 : j2] the sub-array containing columns j1, . . . , j2. When j1 = j2 = j we use A[j] instead of A[j : j] unless ambiguity arises. • For any two arrays A1, A2 of size xd−1 × y, we say that A1 agrees with A2, denoted by A1 ≤a A2, if A1[i, j] ≤ A2[i, j] for all i and j. • For any array A, we denote by h(A) (resp. t(A)) the head (resp. tail) subarray of A containing all but the last column (resp. all but the first column) of A. In other words, h(A) and t(A) have y − 1 columns if A has y columns. • we say that A1 is consistent with A2 (in symbols A1 (cid:15) A2) if t(A1) is the same as h(A2). • Let the column sum of an array A at column j be the quantity (cid:88) Aj = A[i, j]. We refer to the quantity(cid:80) i j Aj as the array sum of A, and we denote it by A. Given a weighted narrow LoS network G = (V, E, w), let array(G) be a kd−1 × (n + ω) array satisfying array(G)[i, j] = w(v) (resp "0") if and only if location (j, i) ∈ Zn,k corresponds (resp. does not correspond) to a vertex v ∈ V in the LoS embedding of G. Also, array(G)[i, j] = 0 for any i and j ∈ {−(ω − 1), . . . , 0}. Figure 1 provides an example. In this setting an independent array I of array(G) is any array of size kd−1 × (n + ω) satisfying 1. I ≤a array(G) and 2. for distinct columns j1, j2 if I[i, j1] > 0 and I[i, j2] > 0 then j1 − j2 ≥ ω and for distinct rows indexed by i1 and i2 if I[i1, j] > 0 and I[i2, j] > 0 then either i1 and i2 do not share a line of sight or they do but the gap between the values of the differing co-ordinate is at least ω. 4 A feasible array W is an array of size kd−1 × ω only containing zeros or ones and such that there exists a kd−1 × ω independent array IW such that W [i, j] = 1 (resp = 0) if and only if IW [i, j] > 0 (= 0). The array IW is a witness of W . Since any feasible array has exactly ω columns it contains at most one non-zero entry per column. We denote by F the set of all feasible arrays of size kd−1 × ω, and for each j ∈ {1, . . . , n}, FG,j ⊆ F is the set of feasible arrays W satisfying W ≤a array(G)[j − ω + 1 : j]. Note that in particular for any independent array I of array(G)[−(ω− 1) : j] for 1 ≤ j ≤ n is the witness of some W ∈ FG,j. We observe that I is an independent set of G if and only if I is an independent array of array(G). Thus finding a maximum total weight independent set in G is equivalent to finding the independent array of array(G) with the largest array sum (we refer to such an array as a largest independent array). In Section 3 we show how a simple DP algorithm finds an independent array of array(G) with the largest array sum by working with the feasible arrays of array(G). Because of this correspondence, in the next section we refer to array(G) as G and we work with arrays instead of graphs. 3 Dynamic Programming MIS[j, W ] = 0 end for −→ 0 ] = 0, where −→ 0 is the kd−1 × ω array of all 0's. Algorithm 1 Computing the largest independent array in G 1: /* Initialisations */ 2: MIS[0, 3: for j = 1, . . . , n do for W ∈ F do 4: 5: 6: 7: end for 8: 9: /* Array sums computation */ 10: for j = 1, . . . , n do for W ∈ FG,j do 11: 12: 13: 14: 15: 16: end for 17: 18: /* Retrieving the independent set */ 19: Find W ∗ ∈ FG,n that maximizes MIS[n, W ] 20: Set I as the rightmost column of W ∗ 21: for j = n downto 2 do 22: 23: 24: end for 25: return I let W ∗ be the feasible array in FG,j−1, W ∗ (cid:15) W , maximizing MIS[j − 1, W ∗] MIS[j, W ] = W [ω]T · G[j]+ MIS[j − 1, W ∗] pred[j, W ] = W ∗ end for W ∗ = pred[j, W ∗] Redefine I as the rightmost column of pred[j, W ∗] concatenated with I Given the array G of size kd−1 × (n + ω), the main idea of the optimal algorithm we describe in this section is to be guided in its choices by a table containing array sums of 5 Figure 2: Figure (i) shows 8 columns of an array G and the independent array I(cid:48) of G[1 : 8] with the largest array sum satisfying I(cid:48)[6 : 8] ≡ W (cid:48). In Figure (ii) the independent array I is the independent array of G[1 : 9] which has the largest array sum satisfying I[7 : 9] ≡ W . Note W (cid:48) (cid:15) W and that I can be obtained from I(cid:48) by appending the last column of W to I(cid:48). independent arrays of portions of G. For each j ∈ {0, . . . , n}, the process manages a table MIS[j, W ], indexed by j as well as all possible kd−1 × ω feasible arrays W . If W ∈ FG,j, we try to extend the independent arrays in G[−(ω − 1) : j − 1] to independent arrays in G[−(ω − 1) : j] witnessing W . Let I(cid:48) be an independent array in G[−(ω − 1) : j − 1] such that I(cid:48)[j − ω : j − 1] is a witness for some W (cid:48) ∈ FG,j−1 and assume that W (cid:48) is consistent with W . By considering the next column of G, we extend I(cid:48) to an independent array I of G[−(ω−1) : j] which is a witness to W . MIS[j, W ] contains the array sum of an independent set whose right-most ω columns are witnessed by W . The expression W [ω]T · G[j] on line 13 of Algorithm 1 is the Frobenius product of W [ω] and G[j]. Figure 2 shows an example in the two dimensional case. Array pred[j, W ] keeps track of the extension that maximizes the size of I(cid:48). Once this is completed for all j's the information in the array pred can be used to retrieve an actual independent set. The following result summarizes the computational properties of Algorithm 1. Theorem 1 Algorithm 1 computes a maximum independent set of a weighted narrow LoS network G in time O(n(k(d−1)/ω ω)kd−1). Proof. The proof is by a simple reductio ad absurdum for each j (similar, say, to the one described in [7, Theorem 15.1] in the context of the longest common subsequence problem). Denote by I an independent array of G of maximum array sum. There must be an independent array I(cid:48) of G[−(ω − 1) : n − 1] such that: I = Iω+n + I(cid:48). Furthermore t(I(cid:48)[n − ω : n − 1]) = h(I[n − ω + 1 : n]), in other words the two independent arrays must be consistent. But then we are safe to assume that MIS[n − 1, W (cid:48)]) I(cid:48) = max W (cid:48)∈FG,n−1:W (cid:48)(cid:15)W (where W is witnessed by I[n − ω + 1 : n]) for otherwise replacing I(cid:48) by the independent set on the right hand side would give us a larger set for I contradicting its optimality. By the same token, I[n − ω + 1 : n] must be a witness of the feasible array W maximizing 6 most a single non-zero entry in each row1. Let t =(cid:6) k W [ω]T · G[j] + maxW (cid:48)∈FG,n−1:W (cid:48)(cid:15)W MIS(n − 1, W (cid:48)). Therefore the independent set returned by Algorithm 1 is at least as large as I. For each j, FG,j = O(ωkd−1) as the elements of this set are kd−1 × ω tables with at is a d − 1 dimensional cube of side length k. The maximum number of non-zero elements in dimension one, say, is t. Furthermore the cube is a d − 1 dimensional object, hence an obvious upper bound on the number of non-zero elements of I is (cid:7). Each column of a feasible array W ω t × kd−2. Finally, the maximum number of elements of FG,j that are consistent with a given W ∈ FG,j−1, for each j, is at most (cid:18) kd−1 (cid:19) t · kd−2 . To see this notice that, starting from an arbitrary W , we get an element of FG,j−1 by chopping off the first column of W and adding an extra column at the other end. A column is a d − 1 dimensional cube with kd−1 positions and there's at most t · kd−2 non-zero positions to be placed in that. Back to Algorithm 1, by the counting argument above, the loop between line 10 and 16 can be completed in time O(n (k(d−1)/ω ω)kd−1) and the result follows. Extensions The DP algorithm described in this section can be adapted to solve optimally a host of other optimization problems in narrow LoS networks. The smallest vertex covers or dominating sets, the largest triangle packings, or H-matchings and many other "hard" combinatorial structures can all be found in polynomial time by using obvious modifications of the strategy described above. Here we show that even problems of a slightly different nature can be solved optimally by our DP approach. An instance of the AdsSched problem defined in Section 1 can be encoded by an array G exactly like the MIS in LoS networks. The only difference is in the definition of feasible solution. Therefore Algorithm 1 can also be used to solve the AdsSched problems, provided the definition of FG,j is slightly modified. In this case the elements of this set are k × ω arrays W satisfying the following conditions (i) W ≤a G[j − ω + 1 : j] (ii) W contains at most one non-zero element in each row. (iii) W contains at most l non-zero elements in each column. Theorem 2 Algorithm 1 solves AdsSched optimally in time O(n kl ωk). Assuming also each column has at most one non-zero entry we get(cid:0)kd−1 1Each row can be filled in at most ω + 1 ways, and there is kd−1 rows: at most (w + 1)kd−1 (cid:1)× j! if there is j ∈ {0, . . . , kd−1} possibilities. (cid:1)(cid:0)ω j j non-empty rows (and columns). 7 Proof. The correctness of the process follows from that of Algorithm 1 as proved in Theorem 1. As to the running time, the only difference is in the maximum number of elements of FG,j that are consistent with a given W ∈ FG,j−1, for each j: there is at most (cid:1) of them. The result follows. (cid:0)k l 4 Semi-online Approximation Algorithms The DP algorithm in Section 3 solves optimally the offline version of the MIS problem in narrow LoS networks and several other related problems, where the entire input is known in advance. This is unrealistic in various practical settings. For example if the time parameter n in the scheduling problem is large, possibly spanning a year or more, then it is likely the input evolves over time. In such sitations it may be desirable to take a different approach, aiming for online algorithmic solutions with good performance guarantees. In this section we consider semi-online strategies that are allowed to observe the input up to a certain look-ahead distance. We show that we can achieve (1 + )-approximation with a look-ahead distance dependent on  > 0. The quality of the approximation can be traded-off against the algorithm running time as well as how much look-ahead it is allowed. We state our main result in terms of the MIS problem, but the strategy can be applied to any of the optimization problems described at the end of Section 3. Theorem 3 There is a semi-online algorithm that for any  > 0 computes a feasible solution for the MIS problem in a narrow LoS network in dimension d that is a (1 + )-approximation of the optimum, in time (cid:18)(cid:18) (cid:19) 1  O 1 + n kd−1 (k(d−1)/ω ω)kd−1 . (cid:19) The main idea of the algorithm mentioned in Theorem 3 is similar to that of the EPTAS described in [14] for general LoS networks. We will argue however that the process we describe here is much faster than the algorithm in that paper, provided k is a constant independent of n. Let G[j1 : j2] where j1 < j2 describe the subgraph of the narrow LoS network G consisting of vertices which are embedded in the region {j1, . . . , j2} × {1, . . . , k} × . . . × {1, . . . , k} (cid:123)(cid:122) d−1 times (cid:125) (cid:124) and their induced edges. Let Ir denote a maximum independent set in G[1 : rω]. A phase in the algorithm starts by computing I0 in a subgraph of G consisting of some column j0 and proceeds to compute Ir, for r ≥ 1, in G[j0 : j0 + rω − 1] provided Ir ≥ (1 + )Ir−1. Thus each Ir in the sequence satisfies Ir ≥ (1 + )rI0. In addition, using the structural properties of a LoS network embedding, we may infer that Ir ≤ kd−1r: at most r vertices can be added to Ir in every row, and there is kd−1 rows altogether. 8 Let r∗ be the least r for which Ir∗+1 < (1 + )Ir∗ (1) We refer to this as the stopping point of the current phase. When condition (1) is reached the process starts another phase from j0 = (r∗ + 1)ω. We start our analysis by proving an upper bound on r∗. Lemma 4 In each phase of the algorithm (cid:18) r∗ ≤ 1 + 1  (cid:19) kd−1 (log 2)2 . Proof. Throughout a phase we have Ir ≥ (1 + )rI0. Thus r∗ is bounded above by the smallest r for which kd−1r < (1 + )r. Such number is not larger than the smallest r satisfying kd−1r < (1 + )r. √ e Taking the logarithms, this is equivalent to √ kd−1r < r log(1 + ). (2) Assuming  < c for some c > 0 this inequality holds if √ kd−1r < r C  ⇔ r > kd−1 (C)2 . (here C = log(1+c) c ). For  ≥ c inequality (2) is satisfied if kd−1r < r log(1 + c) √ which is equivalent to r > kd−1 (log(1 + c))2 . The lemma follows using c = 1. We may now complete the proof of Theorem 3. To obtain a (1 + )-approximation to the maximum independent set once r∗ is obtained we remove Gr∗+1 from the graph G and apply the procedure iteratively to the graph Gr∗+1. Arguing as in [14] we have that if I(cid:48) is the independent set obtained from applying the procedure to Gr∗+1 then Ir∗ ∪ I(cid:48) is a (1 + )-approximation to the maximum independent set in G. As to the running time, computing Ir∗ in each phase takes time O(r∗ ω (k(d−1)/ω ω)kd−1) by Theorem 1. Using the bounds on r∗ from Lemma 4 this can be rewritten as (cid:18)(cid:18) O 1 + (cid:19) 1  (cid:19) . kd−1ω (k(d−1)/ω ω)kd−1 9 Finally since there are at most n/ω phases (we always remove at least ω columns of G in each phase) the algorithm has a worst-case running time of (cid:18)(cid:18) (cid:19) 1  O 1 + n kd−1(k(d−1)/ω ω)kd−1 . (cid:19) Additional Remarks The same framework can be used to devise semi-online (1 + )- approximation heuristics for finding smallest vertex covers or dominating sets, the largest triangle packings, or H-matchings. The analysis of the approximation performance is largely unchanged. The run-time in each case is affected by the run time of the specific DP algorithm used to complete each phase. The approximation heuristics are semi-online since at any moment in time we never work on more than r∗ω columns of the input data. 5 Approximation Algorithms for Unrestricted LoS Net- works In this section we show how the DP approach described in Section 3 can be exploited to define an approximation algorithm for the MIS in arbitrary d-dimensional LoS networks, for d ≥ 2. To avoid cluttering the presentation we first describe and analyze the algorithm for the special case d = 2. Then we outline the modifications necessary to extend the algorithm to the general d-dimensional case. In 2-dimensions, we are given a LoS network (embedded in Z2 n) with range parameter ω > 2. The main idea is to split the input data into strips, each being a narrow LoS network, apply the DP algorithm to each strip, and then combine the solutions obtained for the strips into a solution for the whole instance. In what follow let k = ω−1 and let G[i] be the strip formed by the vertices of G embedded n, for i ∈ {0, . . . , n/k− 1} (assume k divides n for simplicity). in rows ki + 1, . . . , k(i + 1) of Z2 Parameter i in this context is the strip index. Clearly two nodes from different strips with indices having the same parity cannot be adjacent as even if they share a line of sight they are far from each other. Therefore the union of a collection of independent sets found in all odd (resp. even) indexed strips is an independent set of the whole network. The sought approximation algorithm, which we call StripIndependentSet, returns H, the largest of these two sets. Theorem 5 For any fixed ω independent of n, StripIndependentSet is a 2-approximation algorithm for the MIS in a 2-dimensional LoS network. Proof. Let's call Odd (Even) the collection of all odd (even) indexed strips. We can use dynamic programming to find an optimal independent set in each strip. Let DP(Odd) (resp. DP(Even)) be the independent set found using Algorithm 1 on each Odd (resp Even) strip. Let I be an independent set of maximum size in the whole graph. I∩ Odd is an independent set of Odd so it must be 10 Figure 3: Splitting G into n/k strips (k = 3, in the given example, array cells represented as small circles). and Hence DP(Odd) ≥ I∩ Odd DP(Even) ≥ I∩ Even I = (I∩ Odd) + (I∩ Even) ≤ DP(Odd) + DP(Even) ≤ 2 · H. The process requires O(n/k) DP computations, each running in time O(n k ωk) (this comes from Theorem 1 substituting d = 2). The overall run time is therefore O(n2 ωω−1). Generalization to d dimensions The corner greedy strategy in [14] already provides a 2-approximation algorithm for the MIS problem in 2-dimensional LoS networks. The main advantage of the approach described above lies in the fact that algorithm StripIndepen- dentSet can be generalized to arbitrary dimension d > 2. The general strategy is unchanged but the notion of Odd (resp. Even) strip is slightly more elaborate. As in Section 3, it is convenient to think of the network nodes as the elements of a d-dimensional table. In this context a strip is a collection of elements G[k(i1 − 1) + j1, . . . , k(id−1 − 1) + jd, id] where jh ∈ {1, . . . , k} and the vector (i1, . . . , id−1) satisfies ih ∈ {1, . . . , n/k}, for h ∈ {1, . . . , d − 1} (whereas id ∈ {1, . . . , n}). The vector i = (i1, . . . , id−1) is the strip index. A vertex belongs to an odd (resp. even) strip if its strip index satisfies: d−1(cid:88) ih mod 2 = 1 (resp. 0). Figure 4 attempts to give an idea of the partitioning for d = 4. h=1 11 kn Figure 4: Splitting G into strips. Here is one of the n 3-dimensional "bases" (each small cube is labelled by the corresponding triple (i1, i2, i3)). For d = 2, one dimension is split into n/k intervals. For d = 4, three dimensions are split into (n/k)3 cubes of side size k. DP gives an optimal solution in each k3 × n strip. Claim 1 Vertices belonging to different strips whose indices have the same parity are not connected by an edge in G. It follows from the claim above that algorithm StripIndependentSet returns an indepen- dent set in any LoS network embedded in d dimensions and the following result complete our argument. Theorem 6 For any fixed ω and d independent of n, StripIndependentSet is a 2-approximation algorithm for the MIS in a d-dimensional LoS network. Proof. The same argument used to prove Theorem 5 applies. This time O(n/kd−1) DP computations are needed and each of them requires time O(n k(d−1)kd−2 ωkd−1). Therefore the running time of the process is: Since k = ω − 1, the overall algorithm running time is O(n2 k(d−1)kd−2−(d−1) ωkd−1) O(n2 (ω − 1)(d−1)((ω−1)d−2−1) ω(ω−1)d−1). 6 Polynomial Time Approximation Schemes The DP approach in Section 3 can also be exploited to obtain an EPTAS for the MIS problem in general LoS networks, for any d ≥ 2. As in the previous section we first present the idea for the case d = 2. The algorithm works on the given network (which is provided with its embedding in Z2 n) decomposed into strips, as in Figure 3, however we need one additional concept. Let h be a 12 444111112113114121122123124131141211212244344 positive integer. Its value will be fixed later on in our analysis, but for now we require that h be a fixed constant independent of n. A block is a collection of contiguous strips (note that the number of rows in each block is a multiple of k). For each i ∈ {0, . . . , h}, let Bh,i be the partition of G into blocks such that the top one contains i × k rows, and all the others (except perhaps the last one) contain h× k rows. Successive blocks are separated by a single strip. Let ∂Bh,i be the union of these "excluded" strips. Let B be an arbitrary block of Bh,i. Since the product h × k is independent of n, a maximum independent set IB in B can be found in polynomial time using Algorithm 1. The set IB (cid:91) Ii = B∈Bh,i is a maximum independent set of Bh,i. The algorithm returns the largest among I0,I1, . . . ,Ih. Let's call U such set. Let I be a maximum independent set of the whole network. A key Figure 5: Splitting G into blocks. The larger picture on the left hand side describes the top part of B5,3. The smaller picture on the right presents a similar schematic representation of B5,1. In both cases the greyed strips belong to the union of the excluded strips (i.e. ∂B5,3 and ∂B5,1 , respectively). property of independent sets is that a maximum independent set in any strip S of G cannot have less than I∩V (S) vertices (as the vertices in each strip in isolation are less constrained than when they are considered as part of the whole graph). Also, we can write I = I ∩ V (∂Bh,i). h(cid:88) i=0 13 hknih But then by a simple counting argument there must be ı ∈ {0, . . . , h} such that I ∩ V (∂Bh,ı) ≤ I/(1 + h). This implies that a maximum independent set Iı in Bh,ı (which will be eventually found by the algorithm) must satisfy Iı ≥ I ∩ V (Bh,ı) = I − I ∩ V (∂Bh,ı) > h 1 + h I. Thus we have I U ≤ I Iı ≤ 1 + 1 h and the (1 + )-approximation is obtained setting h = (cid:100)1/(cid:101). For each i ∈ {0, . . . , h}, the MIS can be solved exactly in each block of the given partition in time O(n (hk) hk ω ωhk) and there is O(n/hk) blocks. The overall running time is Since k = ω − 1 the running time is O(h n2 ωhk (hk) hk ω −1). O(h n2ωh(ω−1)(h(ω − 1)) hk ω −1). We have proved the following: Theorem 7 There is a polynomial time approximation scheme for the MIS problem in 2-dimensional LoS networks that for any  > 0 returns a (1 + )-approximation in time O(n2 ω ω  −1 ( 1  ).  ) 1 6.1 Arbitrary dimension d > 2 i=0V (∂Bh,i) is a partition A key feature of the PTAS for d = 2 is that the collection of strips ∪h of the given graph vertex set. For d > 2 the construction needs to be a bit careful. Figure 6 provides a diagrammatic picture of a possible PTAS construction for d = 3. Let b be an integer less than d. We say that a cube isomorphic to {1, . . . , n} × . . . × {1, . . . , n} × {1, . . . , x1} × . . . × {1, . . . , xb} (cid:124) (cid:123)(cid:122) b terms (cid:125) (where each of the xi ∈ {1, . . . , k}) is a size n cube narrow with respect to b of its dimensions. In what follows a size n, b-narrow, d-dimensional LoS network is a LoS network whose nodes can be embedded in a size n cube that is narrow with respect to b of its dimensions. Claim 2 Let d and b be fixed positive integers with b < d, and n be an arbitrary integer. For any  > 0, a (1 + )d−b−1-approximation for the MIS in a size n, b-narrow, d-dimensional LoS network can be found in time polynomial in n but exponential in −1. 14 Figure 6: The whole LoS network partitioned into narrow LoS networks, for d = 3. Note that the sizes of the narrow cubes may vary. The black portions represent the vertices that are part of the excluded strips. Proof. The claim can be proved by induction on d − b. Let G be an arbitrary size n, b-narrow, d-dimensional LoS network. If d − b ≤ 1 we can use the dynamic programming strategy described in Section 3 to solve the problem exactly. For arbitrary d− b, without loss of generality assume that G is NOT narrow with respect to dimension one. Any part of G that spans the full length of the unrestricted dimensions, and is also narrow with respect to dimension 1 is a size n, b+1 narrow, d dimensional LoS network. By the inductive hypothesis, the largest independent set of such network can be approximated within (1 + )d−b−2. For any given  let h = (cid:100)1/(cid:101). Let i ∈ {0, . . . , h}. Given G, we partition it into blocks containing n have the first element in the set {1, . . . , ki} or of the form all nodes whose co-ordinates in Zd ki + (k + kh)(j − 2) + l where j ∈ {2, . . . , 2+(cid:98)(n−ki)/(k +kh)(cid:99)} and l ∈ {1, . . . , kh}, except when j takes its largest value (in that case the largest value for l is the remainder of the integer division between n − ki and k + kh). This defines a partition Bh,i whose blocks are size n, b + 1 narrow, d-dimensional LoS networks. For one choice of i, which we denote again by ı, we must have (where I is a maximum independent set of the whole network). Therefore, reasoning like in the 2-dimensional case we have where Iı is the maximum independent set of Bh,ı. This independent set is the union of disjoint sets Iı ∩ Bh,ı(j). By the inductive hypothesis there is an algorithm that finds a set I ∩ V (∂Bh,ı) ≤ I (cid:19) (cid:18) h + 1 I ≤ 1 + 1 h Iı 15 Uı(j) in the jth block of Bh,ı that satisfies Therefore I ≤ and the claim follows. 1 + 1 h Iı ∩ Bh,ı(j) ≤ (1 + )d−b−2 Uı(j) (cid:19) (1 + )d−b−2(cid:88) Uı(j) j Theorem 8 There is a polynomial time approximation scheme for the MIS problem in d- dimensional LoS networks. d−1 − 1. By Claim 2 (with b = 0) there Proof. For any fixed  > 0, define (cid:48) = (1 + ) is an algorithm that returns an independent set whose size is at least (1 + (cid:48))1−d that of a largest independent set in any given LoS network. As to the running time, for each tuple i1, . . . , id−1, the MIS can be solved exactly in each block of the given partition in time 1 (cid:18) (cid:18) and there is O(n/(hk)d−1) blocks. The overall running time is O n (hk) (d−1)(hk)d−1 ω ω(hk)d−1 (cid:18) (cid:16) O hd−1 n2 (hk)d−1 ω (hk) d−1 ω (cid:19) (cid:17)(hk)d−1(cid:19) . Further Comments It is perhaps instructive to compare the algorithm presented in this section with the approximation scheme described in [14] for the MIS in general d-dimensional LoS networks. The algorithm in that paper runs in time O(nd(fd,ω())d(fd,ω())d/ω) where fd,ω() = 2 · (d + 1)! ω (cid:18) ω  − 2/2 (cid:19)d+1 . Since f2,ω() = 12·ω2 (−2/2)3 , for d = 2, the algorithm running time reduces to essentially O(n2 ω9(4ω/2)3 ( 12  − 2/2 )36(2ω/2)3) which is much slower than the bound in Theorem 7, particularly for small  and moderate ω. The PTAS described in this section is quite general and can be applied to several opti- mization problems when the input is a 2-dimensional LoS network that is presented along with its embedding in Z2 n. In particular, simply browsing through [12] Vertex Cover, Min Dominating Set, Min Edge Dominating Set, Max Triangle Packing, Max H-matching, Max Tile Salvage can all be solved to within 1+ of the optimum in a 2-dimensional LoS network, if ω is a fixed constant independent of n. 16 7 Conclusions In this paper we study the maximum independent set problem on narrow LoS networks. We propose an approach that solves this optimazion problem exactly in polynomial time on narrow LoS network, presented with their d-dimensional embedding. We also describe how such algorithm can be used as a subroutine in a semi-online process that is guaranteed to return a heuristic solution that is guaranteed to be only at most a factor 1 +  away from optimality, for any  > 0, in a 2-approximation algorithm for the MIS problem in arbitrary d-dimensional networks, for fixed ω independent of n, and in a PTAS for the 2-dimensional case. We believe that the algorithmic ideas described here can be generalized and applied to other optimisation problems on LoS networks. References [1] Susanne Albers. Online algorithms: a survey. Mathematical Programming, 97(1-2):3–26, 2003. [2] Richard Bellman, Augustine O Esogbue, and Ichiro Nabeshima. Mathematical Aspects of Scheduling and Applications. Elsevier, 2014. [3] B´ela Bollob´as, Svante Janson, and Oliver Riordan. Line-of-sight percolation. Combina- torics, Probability and Computing, 18(1-2):83–106, 2009. [4] M. Cesati and L. Trevisan. On the efficiency of polynomial time approximation schemes. Information Processing Letters, 64(4):165–171, 1997. [5] Marco Cesati and Luca Trevisan. On the efficiency of polynomial time approximation schemes. Information Processing Letters, 64(4):165–171, 1997. [6] Sung Nok Chiu, Dietrich Stoyan, Wilfrid S Kendall, and Joseph Mecke. Stochastic geometry and its applications. John Wiley & Sons, 2013. [7] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. M.I.T. Press, third edition, 2009. [8] Artur Czumaj and Xin Wang. Communication problems in random line-of-sight ad-hoc In International Symposium on Stochastic Algorithms, pages 70–81. radio networks. Springer, 2007. [9] L. Devroye and L. Farczadi. Connectivity for line-of-sight networks in higher dimensions. Dicrete Mathematics and Theoretical Computer Science, 15(2):71–86, 2013. [10] Reinhard Diestel. Graph theory. Springer, 2000. 17 [11] Alan Frieze, Jon Kleinberg, R Ravi, and Warren Debany. Line-of-sight networks. Com- binatorics, Probability and Computing, 18(1-2):145–163, 2009. [12] Michael R Garey and David S Johnson. Computers and intractability: A guide to the theory of NP-completeness, 1979. [13] Johan Hastad. Clique is hard to approximate within n1−ε. Acta Mathematica, 182(1):105–142, 1999. [14] P. Sangha and M. Zito. Finding large independent sets in line of sight networks. In D. Gaur and N. S. Narayanaswamy, editors, Algorithms and Discrete Applied Mathe- matics; Third International Conference CALDAM 2017, volume 10156 of Lecture Notes in Computer Science, pages 332–343. Springer Verlag, 2017. 18
1209.6481
2
1209
2012-11-23T16:21:36
Improved Approximation Algorithms for the Non-preemptive Speed-scaling Problem
[ "cs.DS" ]
We are given a set of jobs, each one specified by its release date, its deadline and its processing volume (work), and a single (or a set of) speed-scalable processor(s). We adopt the standard model in speed-scaling in which if a processor runs at speed s then the energy consumption is s^{\alpha} per time unit, where \alpha>1. Our goal is to find a schedule respecting the release dates and the deadlines of the jobs so that the total energy consumption is minimized. While most previous works have studied the preemptive case of the problem, where a job may be interrupted and resumed later, we focus on the non-preemptive case where once a job starts its execution, it has to continue until its completion without any interruption. We propose improved approximation algorithms for particular instances of the multiprocessor non-preemptive speed-scaling problem.
cs.DS
cs
Improved Approximation Algorithms for the Non-preemptive Speed-scaling Problem∗ Evripidis Bampis1, Giorgio Lucarelli1, and Ioannis Nemparis1,2 1LIP6, Universit´e Pierre et Marie Curie, Paris, France, {Evripidis.Bampis,Giorgio.Lucarelli}@lip6.fr 2Dept. of Informatics and Telecommunications, NKUA, Athens, Greece, [email protected] Abstract We are given a set of jobs, each one specified by its release date, its deadline and its processing volume (work), and a single (or a set of) speed-scalable processor(s). We adopt the standard model in speed-scaling in which if a processor runs at speed s then the energy consumption is sα per time unit, where α > 1. Our goal is to find a schedule respecting the release dates and the deadlines of the jobs so that the total energy consumption is minimized. While most previous works have studied the preemptive case of the problem, where a job may be interrupted and resumed later, we focus on the non-preemptive case where once a job starts its execution, it has to continue until its completion without any interruption. We propose improved approximation algorithms for the multiprocessor non-preemptive speed-scaling problem for particular families of instances, namely instances where all jobs have a common release date (or a common deadline), instances where all jobs are active at some time, and agreeable instances. 1 Introduction One of the main mechanisms used for minimizing the energy consumption in computing systems and portable devices is the so called speed-scaling mechanism. In this setting, the speed of a processor may change dynamically. If the speed of the processor is s(t) at time t then its power is s(t)α, for some constant α > 1, and the energy consumption is the power integrated over time. There is a series of papers in the speed-scaling literature. In their seminal paper, Yao et al. [14] proposed a polynomial-time algorithm for the energy minimization problem of scheduling a set of n jobs J , where each job Jj ∈ J is characterized by its processing volume (work) wj, its release date rj and its deadline dj, on a single speed-scalable processor, assuming that the preemption of the jobs, i.e. the possibility to interrupt the execution of a job and resume it later, is allowed. Most of the subsequent works on energy minimization in the speed-scaling setting allow jobs to preempt. However in practice, preemption causes an important overhead and it is sometimes even impossible, i.e., in the case where external resources are used. Hence, it is natural to disallow it. Only recently, Antoniadis and Huang, in [5], studied the non-preemptive version of the energy minimization problem introduced by Yao et al. [14], and they proved that the problem becomes strongly N P-hard. They have also proposed a constant factor approximation algorithm. ∗Research supported by the French Agency for Research under the DEFIS program TODO, ANR-09-EMER-010, by GDR-RO of CNRS, and by THALIS-ALGONOW. 1 The same paper also studied the problem for a particular family of instances, namely laminar instances. Here for any two jobs Jj and Jj ′ with rj ≤ rj ′ it holds that either dj ≥ dj ′ or dj ≤ rj ′. In fact, such instances typically arise when recursive calls in a program create new jobs. Another interesting family of instances studied in the literature is the family of agreeable instances. In an agreeable instance, for any two jobs Jj and Jj ′ with rj ≤ rj ′ it holds that dj ≤ dj ′, i.e. latter released jobs have latter deadlines. Such instances may arise in situations where the goal is to maintain a fair service guarantee for the waiting time of jobs. Two more special families of instances that we use in our study below are the clique instances and the pure-laminar instances. In a clique instance, for any two jobs Jj and Jj ′ with rj ≤ rj ′ it holds that dj ≥ rj ′. In other words, in a clique instance there is a time, T , where all jobs are active; for example T = min{dj , Jj ∈ J } or T = max{rj, Jj ∈ J }. In a pure-laminar instance, for any two jobs Jj and Jj ′ with rj ≤ rj ′ it holds that dj ≥ dj ′. Note that the family of pure-laminar instances is a special case of both laminar and clique instances. Finally, two other interesting special cases of all the above families, studied by several works in scheduling, are those where all the jobs have either a common release date or a common deadline. 1.1 Related work As mentioned above, for the preemptive single-processor case, Yao et al. [14] proposed an optimal algorithm for finding a feasible schedule with minimum energy consumption. Using an extension of the classical three-field notation, this problem can be denoted as S1rj, dj , pmtnE. The multi- processor case, Srj, dj, pmtnE, where there are m available processors has been solved optimally in polynomial time when preemption and migration of jobs are allowed [2, 4, 8]. The migration assumption means that a job may be interrupted and resumed on the same processor or on another processor. However, the parallel execution of parts of the same job is not allowed. Albers et al. [3] considered the multiprocessor problem Srj, dj, pmtn, no-migE, where the preemption of the jobs is allowed, but not their migration. They first studied the problem where each job has unit work. They proved that the problem is polynomial time solvable for instances with agreeable deadlines. For general instances with unit-work jobs, they proved that the prob- lem becomes strongly N P-hard and they proposed an (αα24α)-approximation algorithm. For the case where the jobs have arbitrary works, the problem was proved to be N P-hard even for in- stances with common release dates and common deadlines. Albers et al. proposed a 2(2 − 1 m )α- approximation algorithm for instances with common release dates, or common deadlines, and an (αα24α)-approximation algorithm for instances with agreeable deadlines. Greiner et al. [11] gave a generic reduction transforming an optimal schedule for the multiprocessor problem with migration, Srj, dj, pmtnE, to a Bα-approximate solution for the multiprocessor problem with preemptions but without migration, Srj, dj, pmtn, no-migE, where Bα is the α-th Bell number. This result holds only when m ≥ α. It has to be noticed here that for the family of agreeable instances, and hence for their special families of instances (instances with common release dates and/or common deadlines), the as- sumption of preemption and no migration is equivalent to the non-preemptive assumption that we consider throughout this paper. More specifically, for agreeable instances, any preemptive schedule can be transformed into a non-preemptive one of the same energy consumption, where the execu- tion of each job Jj ∈ J starts after the completion of any other job which is released before Jj. The correctness of this transformation can be easily proved by induction to the order where the jobs are released. Hence, the results of [3] and [11] for agreeable deadlines hold for the non-preemptive case as well. Finally, the most closely related work is the work of Antoniadis and Huang [5] who consid- 2 ered the energy minimization single-processor non-preemptive speed-scaling problem. They first proved that the problem is N P-hard even for pure-laminar instances. They also presented a 24α−3- approximation algorithm for laminar instances and a 25α−4-approximation algorithm for general instances. Notice that the polynomial-time algorithm for finding an optimal preemptive schedule presented in [14] returns a non-preemptive schedule when the input instance is agreeable. In Table 1, we summarize the most related results of the literature. Several other results concerning scheduling problems in the speed-scaling setting have been presented, involving the optimization of some QoS criterion under a budget of energy, or the optimization of a linear combination of the energy consumption and some QoS criterion (see for example [7, 9, 13]). The interested reader can find more details in the recent survey [1]. Problem Complexity m < α Polynomial [14] Polynomial [10] Polynomial [2, 4, 8] S1rj , dj , pmtnE Srj = 0, dj = d, pmtnE Srj , dj, pmtnE Sagreeable, wj = 1, pmtn, no-migE (∗) Polynomial [3] Srj , dj, wj = 1, pmtn, no-migE Srj = 0, dj = d, pmtn, no-migE (∗) Srj = 0, dj, pmtn, no-migE (∗) Srj , dj = d, pmtn, no-migE (∗) Sagreeable, pmtn, no-migE (∗) Srj , dj, pmtn, no-migE S1agreeableE S1laminarE S1rj , djE N P-hard (m ≥ 2) [3] N P-hard [3] N P-hard N P-hard N P-hard N P-hard Polynomial [14, 5] N P-hard [5] N P-hard αα24α [3] 2(2 − 1 2(2 − 1 αα24α [3] -- Approximation ratio m ≥ α -- -- -- -- Bα [11] Bα [11] Bα [11] -- 24α−3 [5] 25α−4 [5] P T AS [12, 3] m )α [3] min{2(2 − 1 m )α [3] min{2(2 − 1 m )α, Bα} [3, 11] m )α, Bα} [3, 11] Table 1: Complexity and approximability results. sponding non-preemptive problem. (∗)The problem is equivalent with the corre- 1.2 Our contribution In this paper, we explore the approximability for the non-preemptive speed-scaling problem on multiprocessors for special families of instances. More specifically, in Section 3 we consider the multiprocessor case where the jobs have either common release dates or common deadlines. Recall that for these problems algorithms of approximation ratio 2(2 − 1 m )α have been presented in [3], while these results have been improved in [11] to Bα, if α ≤ m and α ≤ 5. We further improve the approximation ratio to (2 − 1 m )α−1, for any value of α and m. In Section 5, we consider the agreeable multiprocessor case and we present a (4(2 − 1 m ))α−1-approximation algorithm. However, for α ≤ m, a Bα-approximation algorithm for the case has been presented in [11]. Hence, this result dominates our approximation factor for α ≤ m. Even if for practical applications the assumption made in [11] that α ≤ m is justified, from a theoretical point of view it is worthwhile to investigate the approximability of the problem when α > m. For the latter case, our result improves the ratio of αα24α given in [3]. A summary of our results compared with the previously known results is given in Table 2. 1.3 Notation and Preliminaries A fundamental property of optimal schedules in the speed-scaling model, which is also true for the problems we study in this paper, is that any job Jj ∈ J runs at a constant speed sj due to the 3 Problem m < α Srj = 0, dj E 2(2 − 1 Srj, dj = dE 2(2 − 1 ScliqueE SagreeableE αα24α [3] -- -- Bα [11] Previous result m ≥ α Our result m )α [3] min{2(2 − 1 m )α [3] min{2(2 − 1 m )α, Bα} [3, 11] m )α, Bα} [3, 11] m )α−1 m )α−1 (2 − 1 (2 − 1 (2(2 − 1 (4(2 − 1 m ))α−1 m ))α−1 < 23α−3 Table 2: Previous known approximation ratios vs. our approximation ratios. j the energy consumed by the execution of Jj in S and by E(S) = Pn convexity of the speed-to-power function. Given a schedule S and a job Jj ∈ J , we denote by E(S, Jj ) = wjsα−1 j=1 E(S, Jj ) the total energy consumed by S. Given an instance I and a job Jj ∈ J , we denote by wj(I) the work, by rj(I) the release date and by dj(I) the deadline of Jj in I. We denote by S ∗ an optimal non-preemptive schedule for the input instance I. For each job Jj ∈ J , we call the interval [rj, dj] the active interval of Jj. The following proposition has been proved in [5] for S1rj , djE but holds also for the corre- sponding problem on parallel processors. Proposition 1 [5] Suppose that the schedules S and S ′ process job Jj with speed s and s′ respec- tively. Assume that s ≤ γs′ for some γ ≥ 1. Then E(S, j) ≤ γα−1E(S ′, j). 2 From Preemptive to Non-preemptive Scheduling In this paper, we explore the idea of transforming an optimal preemptive schedule into a non- preemptive schedule, guaranteeing that the energy consumption of the latter one does not increase more than a factor ρ. Unfortunately, in the following proposition we show that for general instances the ratio between an optimal non-preemptive schedule to an optimal preemptive one can be very large. Proposition 2 The ratio of the energy consumption of an optimal non-preemptive schedule to the energy consumption of an optimal preemptive schedule for the same instance of the single-processor speed-scaling problem can be O(nα−1). Proof. Consider the instance consisting of a single processor, n − 1 unit-work jobs, J1, J2, . . . , Jn−1, and the job Jn of work n. Each job Jj, 1 ≤ j ≤ n − 1, has release date rj = 2j − 1 and deadline dj = 2j, while rn = 0 and dn = 2n − 1 (see Figure 1). The optimal preemptive schedule Spr for this instance assigns to all jobs a speed equal to one. Each job Jj, 1 ≤ j ≤ n − 1, is executed during its whole active interval, while Jn is executed during the remaining n unit length intervals. The total energy consumption of this schedule is E(Spr) = (n − 1) · 1α + n · 1α = 2n − 1. An optimal non-preemptive schedule Snpr for this instance assigns a speed n+2 3 to jobs J1, Jn and J2 and schedules them non-preemptively in this order between time 1 and 4. Moreover, in Snpr each job Jj, 3 ≤ j ≤ n − 1, is assigned a speed equal to one and it is executed during its whole active interval. The total energy consumption of this schedule is E(Snpr) = 3 · ( n+2 3 )α + (n − 3) · 1α. Therefore, we have E(Snpr) E(Spr) = 3·( n+2 3 )α+(n−3)·1α 2n−1 = O(nα−1). 4 J1 w1 = 1 J2 w2 = 1 Jn wn = n speed speed Jn J1 Jn J2 0 1 2 3 4 J1 Jn J2 . . . . . . . . . Jn−1 wn−1 = 1 Jn−1 Jn 2n − 3 2n − 2 2n − 1 time Jn−1 0 1 2 3 4 2n − 3 2n − 2 2n − 1 time Figure 1: An instance of S1rj, dj E for which the ratio of the energy consumption in an optimal non-preemptive schedule to the energy consumption in an optimal preemptive schedule is O(nα−1). In what follows, we show that for some particular families of instances, for which the energy minimization multi-processor speed-scaling problem is known to be N P-hard, it is possible to use the cost of an optimal preemptive schedule as a lower bound of the energy consumption of an optimal non-preemptive schedule in order to obtain good approximation ratios. 3 Common Release Dates or Common Deadlines In this section we deal with Srj = 0, djE and Srj, dj = dE, which are N P-hard as generalizations of Srj = 0, dj = dE. In fact, we will present an approximation algorithm for Srj = 0, dj E, which achieves a better ratio than the known approximation algorithms presented in [3] and [11] for any values of α and m. We also describe how to adapt this algorithm to an algorithm for Srj, dj = dE of the same approximation ratio. Algorithm CRD takes as input an instance I of Srj = 0, dj E and creates first an optimal preemptive schedule for I, using one of the algorithms in [2, 4, 8]. The total execution time ej of each job Jj ∈ J in this preemptive schedule is used to define an appropriate processing time pj for Jj. Then, the algorithm schedules non-preemptively the jobs using these processing times according to the Earliest Deadline First policy, i.e., at every time that a machine becomes idle, the non-scheduled job with the minimum deadline is scheduled on it. The choice of the values of the pj's has been made in such a way that the algorithm completes all the jobs before their deadlines. Algorithm CRD(I) 1: Create an optimal preemptive schedule Spr for I; 2: Let ej be the total execution time of the job Jj ∈ J , in Spr; 3: Schedule the jobs with the Earliest Deadline First (EDF) policy, using the appropriate speed m ), obtaining the such that the processing time of the job Jj ∈ J , is equal to pj = ej/(2 − 1 non-preemptive schedule Snpr; 4: return Snpr; Theorem 3 Algorithm CRD is a (2 − 1 m )α−1-approximation algorithm for Srj = 0, dj E. 5 Proof. We first prove by induction that for the completion time Cj of the job Jj ∈ J , it holds that Cj ≤ dj. For each job Jj, 1 ≤ j ≤ m, it holds that Cj = pj = ej/(2 − 1 m ) ≤ dj, since Jj is selected by the algorithm for Srj, dj, pmtnE such that Spr to be feasible, and hence ej ≤ dj. Assume that our hypothesis is true for all jobs in Jk−1 = {J1, J2, . . . , Jk−1}. For the job Jk, it holds that Ck ≤ j=1 ej m + ek)/(2 − 1 schedule and dk ≥ dj for each job Jj ∈ Jk−1, it holds that ek ≤ dk and Pk Ck ≤ (2 − 1 m ) = dk and Snpr is a feasible schedule. j=1 pj m + pk = ( m )dk/(2 − 1 Moreover, when dividing the execution time of all jobs by (2 − 1 Pk−1 Pk−1 m ). As Spr is a feasible j=1 ej ≤ m · dk. Hence, m ), at the same time the speed of each job is multiplied by the same factor. Thus, using Proposition 1 we have that E(Snpr) ≤ (2 − 1 m )α−1E(Spr) ≤ (2 − 1 m )α−1E(S ∗) since the energy consumed by the optimal preemptive schedule Spr is a lower bound to the energy consumed by an optimal non-preemptive schedule S ∗ for the input instance I. Next, we describe how to transform Algorithm CRD for Srj = 0, dj E into Algorithm CD for Srj, dj = dE. In order to do this, we modify the Line 3 of Algorithm CRD such that to use the Latest Release Date First (LRDF) policy, scheduling the jobs in a backward way starting from the deadline d. Using a similar analysis, the following theorem holds. Theorem 4 Algorithm CD is a (2 − 1 m )α−1-approximation algorithm for Srj, dj = dE. 4 Clique Instances In this section, we present a constant factor approximation algorithm for ScliqueE. Recall that this problem is N P-hard as a generalization of Srj = 0, dj = dE. Moreover, in [5] it is proved that S1pure-laminarE is N P-hard. Hence, even S1cliqueE is N P-hard. Algorithm Cl takes as input a clique instance I and creates first an optimal preemptive schedule, using again one of the algorithms in [2, 4, 8]. Taking into account the execution times of jobs before and after the time T = min{dj, Jj ∈ J } in the preemptive schedule, the algorithm splits the set of jobs into two subsets: the left L and the right R. The set L contains the jobs which have bigger execution time before T , while the set R consists of the jobs of bigger execution time after T . For the jobs in L, we modify their deadlines to T and we use Algorithm CD. For the jobs in R, we modify their release dates to T and we use Algorithm CRD. Then, Algorithm Cl returns the concatenation of the two schedules created by Algorithm CD and Algorithm CRD. Theorem 5 Algorithm Cl is a (2(2 − 1 m ))α−1-approximation algorithm for ScliqueE. Proof. Let S L Algorithm CRD, respectively. By Theorems 4 and 3, respectively, it holds that pr be the preemptive schedules created in Line 1 of Algorithm CD and pr and S R E(Snpr) = E(S L npr) + E(S R npr) ≤ (2 − 1 m )α−1(E(S L pr) + E(S R pr)) (1) Consider, now, the preemptive schedule S that occurs from Spr if we schedule the whole work of each job Jj ∈ L (resp. Jj ∈ R) before (resp. after) the time T at the intervals in which Jj is already executed in Spr. By construction for each job Jj ∈ L (resp. R) it holds that eℓj ≥ erj 6 Algorithm Cl(I) 1: Create an optimal preemptive schedule Spr for I; 2: Let eℓj and erj be the total execution time of each job Jj ∈ J , before and after, respectively, the time T = min{dj, Jj ∈ J } in Spr; 3: Let L = {Jj : eℓj ≥ erj} and R = {Jj : eℓj < erj}; 4: Consider the instance IL consisting of the jobs in L, and each Jj ∈ L is characterized by a work wj(IL) = wj(I), a release date rj(IL) = rj(I), and a deadline dj(IL) = T ; 5: Run Algorithm CD(IL) obtaining the non-preemptive schedule S L 6: Consider the instance IR consisting of the jobs in R, and each Jj ∈ R is characterized by a npr; work wj(IR) = wj(I), a release date rj(IR) = T , and a deadline dj(IR) = dj(I); 7: Run Algorithm CRD(IR) obtaining the non-preemptive schedule S R 8: Create the schedule Snpr by concatenating the schedules S L npr; 9: return Snpr; npr and S R npr; (resp. eℓj < erj). Hence, in order S to be feasible, we have just to double the speed of each job Jj ∈ J , and thus by Proposition 1 we have E(S, Jj) = 2α−1E(Spr, Jj ). In total we get that E(S) = 2α−1E(Spr). Let S L and S R be the parts of S before and after T , respectively, that is E(S) = E(S L)+E(S R). pr is the optimal one, it holds pr concern the same instance, and since S L The schedules S L and S L that E(S L pr) ≤ E(S L). Similarly, it holds that E(S R pr) ≤ E(S R). Therefore, we get E(S L pr) + E(S R pr) ≤ E(S L) + E(S R) = E(S) = 2α−1E(Spr) (2) By combining Equations (1) and (2) and taking into account that E(Spr) is a lower bound to the energy consumed by an optimal non-preemptive schedule S ∗ for I, i.e., E(Spr) ≤ E(S ∗), the theo- rem follows. Corollary 1 Algorithm Cl is a (2(2 − 1 m ))α−1-approximation algorithm for Spure-laminarE. 5 Agreeable Instances In this section we deal with agreeable instances and for α > m we improve the known αα24α- approximation algorithm presented in [3] for SagreeableE, by proposing a (4(2− 1 algorithm. Recall that, SagreeableE is known to be N P-hard as a generalization of Srj = 0, dj = dE. On the other hand, S1agreeableE can be solved in polynomial time [5, 14]. In order to han- dle an agreeable instance I, we will first describe how to partition it into clique subinstances, by splitting the set of jobs J into subsets. m ))α−1-approximation To begin with this partition, we define T1 to be the smallest deadline of any job in J , i.e., T1 = min{dj : Jj ∈ J }. Let J1 ⊆ J be the set of jobs which are released before T1, i.e., J1 = {Jj ∈ J : rj ≤ T1}. Next, we set T2 = min{dj : Jj ∈ J \ J1} and J2 = {Jj ∈ J : T1 < rj ≤ T2}, and we continue this process until all jobs are assigned into a subset of jobs (see Figure 2). Let k be the number of subsets of jobs that have been created. In the above partition, the subsets of jobs are pairwise disjoint. However, the two clique subinstances induced by two subsets of jobs may have time interference. In other words, there may exist two jobs Jj ∈ Jℓ and Jj ′ ∈ Jℓ′, where 0 ≤ ℓ < ℓ′ ≤ k, such that dj ≥ rj ′. Nevertheless, the key observation here is that in the above partition into clique subinstances only two consecutive 7 T1 T2 T3 T4 (a) T3 (b) Figure 2: (a) The partition of jobs. (b) The subset of jobs J3. subsets of jobs may have time interference. In fact a stronger property holds: for each ℓ, 1 ≤ ℓ ≤ k − 1, and each job Jj ∈ Jℓ, the active interval of Jj does not contain Tℓ+1. To see this, given a partition into the subsets of jobs J1, J2, . . . , Jk and the corresponding times T1, T2, . . . , Tk, assume for contradiction that there is a job Jj ∈ Jℓ whose active interval contains Tℓ+1. Hence, it holds that rj ≤ Tℓ and dj > Tℓ+1. Consider, now, the job Jj ′ ∈ Jℓ+1 whose deadline defines Tℓ+1. For Jj ′ it holds that rj ′ > Tℓ and dj ′ = Tℓ+1. Thus, we have that rj < rj ′ and dj > dj ′, which is a contradiction that our instance is agreeable. Next, we propose Algorithm Agr which initially defines the times T1, T2, . . . , Tk and the cor- responding subsets of jobs J1, J2, . . . , Jk. Then, in order to separate the intervals of two consecutive subsets of jobs, our algorithm decreases the active intervals of all jobs by half. This will ensure the feasibility of the schedule for the whole instance I. For each clique subinstance, Algorithm Cl is called and it gives a non-preemptive schedule. Our algorithm returns the concatenation of the schedules for the clique subinstances. Algorithm Agr 1: Find the partition into the subsets of jobs J1, J2, . . . , Jk and the corresponding times T1, T2, . . . , Tk; 2: for ℓ = 1 to k do 3: Consider the clique instance Iℓ consisting of the jobs in Jℓ, and each Jj ∈ Jℓ is characterized by a work wj(Iℓ) = wj(I), a release date rj(Iℓ) = rj(I) + Tℓ−rj (I) , and a deadline dj(Iℓ) = dj(I) − dj (I)−Tℓ Run Algorithm Cl(Iℓ) obtaining the non-preemptive schedule S (ℓ) npr; 2 2 ; 4: 5: Create the schedule Snpr by concatenating the schedules S (1) 6: return Snpr; npr, S (2) npr, . . . , S (k) npr; The following proposition deals with two clique instances consisting of the same set of jobs with different active intervals (as in Line 3 of Algorithm Agr). Note that the proposition holds both for preemptive and non-preemptive schedules. Proposition 6 Consider a clique instance I1 consisting of a set of jobs J1 and let T = min{dj : Jj ∈ J1}. Let I2 be an instance consisting of the set of jobs J2 = J1 and for each Jj ∈ J2 we have that wj(I2) = wj(I1), rj(I2) = rj(I1) + T −rj(I1) . For two optimal schedules S1 and S2 for I1 and I2, respectively, it holds that E(S2) ≤ 2α−1E(S1). and dj(I2) = dj(I1) − dj(I1)−T 2 2 Proof. Note first that the active interval of each job Jj ∈ J1 from dj(I1) − rj(I1) in I1 becomes dj(I2) − rj(I2) = 1 2 (dj(I1) − rj(I1)) in I2. Given an optimal schedule S1 for I1, we can obtain a feasible schedule S ′ 2 for I2 if we decrease 2 and then compact the schedule keeping the execution time of each job Jj ∈ J1 by a factor of 1 8 fixed the time T . In order to do this, we have to increase the speed of Jj by a factor of 2. Hence, 2) = 2α−1E(S1). As S2 is the optimal schedule for I2, the by Proposition 1 it holds that E(S ′ proposition follows. Theorem 7 Algorithm Agr is a (4(2 − 1 m ))α−1-approximation algorithm for SagreeableE. Proof. We first deal with the approximation ratio of the algorithm. Let S (1) pr be the optimal preemptive schedules created in Line 1 of Algorithm Cl with input the instances I1, I2, . . . , Ik, respectively. By Theorem 5, for each ℓ, 1 ≤ ℓ ≤ k, it holds that E(S (ℓ) npr) ≤ (2(2 − m ))α−1E(S (ℓ) 1 pr , . . . , S (k) pr ), and hence pr , S (2) E(Snpr) = k X ℓ=1 E(S (ℓ) npr) ≤ (2(2 − 1 m ))α−1 k X ℓ=1 E(S (ℓ) pr ) (3) For each ℓ, 1 ≤ ℓ ≤ k, let S (ℓ) be the optimal preemptive schedule for the jobs in Jℓ subject pr ) ≤ to their original release dates and deadlines in I. By Proposition 6 we have that E(S (ℓ) 2α−1E(S (ℓ)), and hence k X ℓ=1 E(S (ℓ) pr ) ≤ 2α−1 k X ℓ=1 E(S (ℓ)) (4) Let Spr be an optimal preemptive schedule for the whole instance I. Note that, Pk ℓ=1 E(S (ℓ)) is a lower bound to E(Spr), since all jobs in Sk ℓ=1 S (ℓ) have their original release dates and deadlines, and each of S (ℓ) is an optimal preemptive schedule. Hence, by combining the Equations (3) and (4), the approximation ratio achieved by our algorithm follows. In order to show the feasibility of the schedule Snpr created by Algorithm Agr, it suffices to show that for each ℓ, 1 ≤ ℓ ≤ k − 1, and for any two jobs Jj ∈ Jℓ and Jj ′ ∈ Jℓ+1 it holds that dj(Iℓ) < rj ′(Iℓ+1). More intuitively, we want to show that the active intervals of any two jobs belonging to two consecutive (w.r.t. time) instances does not intersect. By construction, it holds that dj(I) ≤ Tℓ+1 and rj ′(I) > Tℓ. Moreover, we have that dj(Iℓ) = . Therefore, dj(Iℓ) < and rj ′(Iℓ+1) = rj ′(I) + > Tℓ+1+Tℓ Tℓ+1−rj′ (I) 2 2 dj(I) − dj(I)−Tℓ rj ′(Iℓ+1), and the theorem follows. ≤ Tℓ+1+Tℓ 2 2 References [1] S. Albers. Energy-efficient algorithms. Communications of ACM, 53:86 -- 96, 2010. [2] S. Albers, A. Antoniadis, and G. Greiner. On multi-processor speed scaling with migration: extended abstract. In 23rd ACM Symposium on Parallelism in Algorithms and Architectures (SPAA 2011), pages 279 -- 288. ACM, 2011. [3] S. Albers, F. Muller, and S. Schmelzer. Speed scaling on parallel processors. In 19th ACM Sym- posium on Parallelism in Algorithms and Architectures (SPAA 2007), pages 289 -- 298. ACM, 2007. [4] E. Angel, E. Bampis, F. Kacem, and D. Letsios. Speed scaling on parallel processors with migration. In 18th International European Conference on Parallel and Distributed Computing (Euro-Par 2012), volume 7484 of LNCS, pages 128 -- 140. Springer, 2012. 9 [5] A. Antoniadis and C.-C. Huang. Non-preemptive speed scaling. In 13th Scandinavian Sym- posium and Workshops on Algorithm Theory (SWAT 2012), volume 7357 of LNCS, pages 249 -- 260. Springer, 2012. [6] Y. Azar and A. Epstein. Convex programming for scheduling unrelated parallel machines. In 37th annual ACM Symposium on Theory of Computing (STOC 2005), pages 331 -- 337, 2005. [7] E. Bampis, D. Letsios, I. Milis, and G. Zois. Speed scaling for maximum lateness. In 18th Annual International Computing and Combinatorics Conference (COCOON'12), volume 7434 of LNCS, pages 25 -- 36. Springer, 2012. [8] B. D. Bingham and M. R. Greenstreet. Energy optimal scheduling on multiprocessors with mi- gration. In International Symposium on Parallel and Distributed Processing with Applications (ISPA 2008), pages 153 -- 161. IEEE, 2008. [9] D. P. Bunde. Power-aware scheduling for makespan and flow. In 18th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA 2006), pages 190 -- 196. ACM, 2006. [10] J.-J. Chen, H.-R. Hsu, K.-H, Chuang, C.-L. Yang, A.-C. Pang, and T.-W. Kuo. Multiprocessor energy-efficient scheduling with task migration considerations. In 16th Euromicro Conference of Real-Time Systems (ECTRS 2004), pages 101 -- 108, 2004. [11] G. Greiner, T. Nonner, and A. Souza. The bell is ringing in speed-scaled multiprocessor scheduling. In 21st ACM Symposium on Parallelism in Algorithms and Architectures (SPAA 2009), pages 11 -- 18. ACM, 2009. [12] D.S. Hochbaum and D.B. Shmoys. Using dual approximation algorithms for scheduling prob- lems: Theoretical and practical results. Journal of the ACM, 34:144 -- 162, 1987. [13] K. Pruhs, R. van Stee, and P. Uthaisombut. Speed scaling of tasks with precedence constraints. Theory of Computing Systems, 43:67 -- 80, 2008. [14] F. Yao, A. Demers, and S. Shenker. A scheduling model for reduced CPU energy. In 36th Annual Symposium on Foundations of Computer Science (FOCS 1995), pages 374 -- 382, 1995. 10
1806.10327
1
1806
2018-06-27T07:52:11
Online Matching in a Ride-Sharing Platform
[ "cs.DS" ]
We propose a formal graph-theoretic model for studying the problem of matching rides online in a ride-sharing platform. Unlike most of the literature on online matching, our model, that we call {\em Online Windowed Non-Bipartite Matching} ($\mbox{OWNBM}$), pertains to online matching in {\em non-bipartite} graphs. We show that the edge-weighted and vertex-weighted versions of our model arise naturally in ride-sharing platforms. We provide a randomized $\frac{1}{4}$-competitive algorithm for the edge-weighted case using a beautiful result of Lehmann, Lehmann and Nisan (EC 2001) for combinatorial auctions. We also provide an $\frac{1}{2} (1 - \frac{1}{e})$-competitive algorithm for the vertex-weighted case (with some constraint relaxation) using insights from an elegant randomized primal-dual analysis technique of Devanur, Jain and Kleinberg (SODA 2013).
cs.DS
cs
Online Matching in a Ride-Sharing Platform Chinmoy Dutta ∗ Chris Sholley † Abstract We propose a formal graph-theoretic model for studying the problem of matching rides online in a ride-sharing platform. Unlike most of the literature on online matching, our model, that we call Online Windowed Non-Bipartite Matching (OWNBM), pertains to online matching in non- bipartite graphs. We show that the edge-weighted and vertex-weighted versions of our model arise naturally in ride-sharing platforms. We provide a randomized 1 4 -competitive algorithm for the edge-weighted case using a beautiful result of Lehmann, Lehmann and Nisan (EC 2001) for combi- natorial auctions. We also provide an 1 e )-competitive algorithm for the vertex-weighted case (with some constraint relaxation) using insights from an elegant randomized primal-dual analysis technique of Devanur, Jain and Kleinberg (SODA 2013). 2 (1 − 1 1 Introduction In recent times, the rapid advancement and widespread availability of mobile computing have significantly uplifted the face of urban mobility and transporta- tion. A large part of this change is due to the impact created by ride-sharing platforms. Such platforms allow any rider to request a ride at any time and any place at the convenience of a tap on a ride-sharing app installed on her mobile device. On receiving a ride request, the platform fulfils it by choosing one of the nearby drivers available to transport the rider and dispatching her to pick up the rider. Besides the convenience of the ride-hailing process, these platforms can also do marketplace optimization to ensure lower estimated time to pick-up for riders as well as better time utilization for drivers. The major advantage of these platforms, however, is the ride-sharing possi- bility that they enable. With this feature, riders can choose to share the vehicle with other riders heading in the same direction. There are tremendous socio- economical and environmental advantages to this sharing. It lets the riders share the cost of the ride, thereby providing them an economical and affordable means of transportation. Riders can also take advantage of incentives like use ∗Lyft, San Francisco. Email: [email protected] †Lyft, San Francisco. Email: [email protected] 1 of high occupancy lanes. Moreover, ride-sharing eases the burden on the trans- portation infrastructure of cities and helps reduce traffic congestion, specially during heavy commute times. Reducing traffic congestion in turn helps in cut- ting down commute times, thus providing great economic benefit to individuals, businesses and institutions by reducing lost time and increasing productivity. Perhaps even more importantly, ride-sharing provides great environmental ben- efits by reducing air pollution as a result of reduced number of cars on roads, thereby greatly reducing our carbon footprint. In fact, for some densely popu- lated and highly congested cities, intelligent coupling of ride-sharing with smart transit systems seems the only viable and scalable transportation option. Sharing rides with others, however, does incur some costs to the riders like increased detours and travel times as well as some loss of privacy and conve- nience. The task of the ride-sharing platform is to intelligently trade off these costs against the benefits mentioned above. To be able to match rides that in- cur minimal inconvenience to the riders while maximizing marketplace efficiency, therefore, is of paramount importance for a ride-sharing platform. Considering the central role of ride-sharing platforms for transportation and economy, and the central role of this matching problem for such platforms, we strongly believe that there is need for modeling this problem formally and studying it mathe- matically. To the best of our knowledge, such rigorous attempt has not been made for this problem yet. In this paper, we identify the essential aspects of the problem of matching rides in a ride-sharing platform. This then enables us to formally model the problem in graph-theoretic online matching setting. Our modeling leads to new problems in the space of online matching that we believe are of independent theoretical interest and importance. We then provide approximation algorithms for two different variants of our proposed model that arise naturally in the ride- sharing context. 1.1 Matching Rides for Ride-sharing We start by identifying the unique attributes of the problem of matching rides for ride-sharing. We discuss both the constraints that must be satisfied and the objectives that might be optimized subject to satisfying those constraints. 1.1.1 Constraints Spatial constraint Matching rides obviously has a spatial constraint to it. That is, rides should be matched only if there is good spatial overlap among their routes. While the exact notion and criteria of spatial overlap is for the platform to decide, this ensures that none of the riders will experience an unacceptable amount of detour or increase in their travel time. With this spatial criteria in place, the existing rides in the platform that a new ride can be matched to is known once the new ride arrives. 2 Temporal constraint Matching rides also has a temporal constraint to it. For example, two rides cannot be matched together even if they have perfect spatial overlap (that is, exact same pick-up and drop-off locations), if they arrive at very different times. The acceptable maximum period between the arrival of two rides such that they can still be matched together is for the ride-sharing platform to determine. We call this quantity the incidence window. Online constraint Furthermore, the ridesharing platform cannot wait too long for making its decisions and must make them in real-time as rides arrive. In other words, the problem must be solved online without full knowledge of rides to arrive in future. The decision that the platform needs to make for every arriving ride is whether to match-or-dispatch. If the platform decides to match the ride, it must pick an existing ride to match it to. Otherwise, the platform must dispatch a driver to pick-up the ride. The maximum period the platform can wait since the arrival of a ride before it must make a match-or-dispatch decision for it is called the matching window. 1.1.2 Objectives Matching efficiency objective A widely used objective to optimize for while matching rides in a ride-sharing platform is the matching efficiency. A feasible match that satisfies the constraints above provides some efficiency for the sys- tem. For example, one notion of efficiency can be the amount of savings we get by making the match as compared to transporting the riders individually. The savings may be measured in terms of distance driven, time taken, cost of trips or any combination of these. Once the platform fixes the notion of efficiency, the goal it can optimize for could be the system-wide matching efficiency which is the sum of the efficiencies derived from all the matches made. Matching rate objective Another objective that the platform might want to optimize for while matching rides is the matching rate. This is especially impor- tant in the growth stages of a ride-sharing platform where it wants to maximize the volume of shared rides subject to meeting the matching constraints. Dif- ferent rides can have different value for the platform depending upon various factors like distance of the route, origin-destination locations, profitability etc. In this case, the goal the platform can optimize for is the matching rate which is the sum of the values of all the rides that were matched. Both matching efficiency and matching rate are widely used and very closely watched metrics in the ride-sharing industry. 1.2 Our contributions In this paper, we provide a formal model for the problem of matching rides for ride-sharing in a graph-theoretic online matching setting. We call our model online windowed non-bipartite matching (OWNBM). In this model, time is considered discrete and vertices arrive sequentially, one per time step. The 3 edges in the graph represent matchability (that is, satisfying the spatial and temporal constraints). The edges originating from a vertex are revealed once the vertex arrives and each such edge can go to one of the preceding d (incidence window) vertices. It helps to think of the vertices as ordered by arrival times and edges as directed and going from a vertex to a preceding one by that ordering. After w (matching window) time steps since the arrival of a vertex, we must match it to one of the (yet unmatched) vertices it has an edge to or from, or leave it unmatched. A matching is a subset of edges such that every vertex has at most one edge incident on it (either to or from) that is included in the subset. We consider two variants of our model. In the edge-weighted variant, each edge of the graph has a weight and the objective is to construct a matching to maximize the sum of the weights of the edges picked in the matching. This corresponds to the matching efficiency objective for the ride-sharing platform mentioned above. In the vertex-weighted variant of our model, each vertex of the graph has a weight and the objective is to construct a matching to maximize the sum of the weights of the vertices that get matched (has an edge of the matching incident on it, either to or from). This corresponds to the matching rate objective mentioned above. We provide the following approximation algorithms for the edge and vertex weighted versions of windowed online non-bipartite matching. Theorem 1. There is a randomized 1 4 -approximation for edge-weighted OWNBM with w = d, where w and d are the matching and incidence windows respectively. Theorem 2. There is a randomized 1 e )-approximation for vertex-weighted OWNBM with w = d, where w and d are the matching and incidence windows respectively. This is under the assumption that the online algorithm is allowed to match three rides together and is allowed to delete an edge from a 3-match. 2 (1− 1 Note that in Theorem 2 above, while the online solution is allowed to match three rides together, the competitive ratio is measured against the offline optimal which only matches two rides together. (See details in sec 2.) To the best of our knowledge, online matching has not yet been studied for non-bipartite graphs in adversarial settings. Our model is simple and yet power- ful to capture the essential aspects of matching rides in a ride-sharing platform. We believe one of the main novelties of our work is that our model allows for studying online matching in non-bipartite graphs. The notion of incidence and matching windows that we propose leads to an interesting theoretical model that we believe is of independent interest and can find further use outside of the immediate context of ride-sharing. 1.3 Related work Recently, there has been a lot of research interest in ride-sharing and associated challenges and problems. Much of the work has been done in transportation- related literature. A recent study by Santi et al [18] showed about 80% of rides in Manhattan can be shared by two riders. A lot of studies related to fleet 4 management considers ride-sharing without pooling requests, e.g [17, 20, 18, 19]. There has also been a lot of research interest in studying autonomous ride- sharing systems [17, 19, 6]. Heuristic-based solutions to the rider and driver assignment problem were studied in [1, 14]. Alonso-Mora et al. [4] studied real-time high-capacity ride-sharing and route generation. However, their work does not provide a theoretical graph-theoretic online matching formulation for matching rides. Starting with the seminal work of Karp, Vazirani and Vazirani [12], online matching has been widely studied and a vast amount of literature exists on the topic. However, such literature, being mostly motivated by the real-life applica- tions such as online advertising, kidney exchange and online dating, considers the problem in the bipartite setting. The book by Mehta [16] gives a detailed overview of this literature. The work of Karp, Vazirani and Vazirani [12] gave an optimal online algorithm with competitive ratio (1 − 1 e ) for unweighted bi- partite matching in the adversarial arrival model. The vertex-weighted version was studied by Aggarwal, Goel, Karande and Mehta [2] where they gave an optimal (1 − 1 e ) ratio. The edge-weighted version was studied under the ad- ditional economic assumption of free disposal by Feldman, Korula, Mirrokni, Muthukrishnan and Pl [8] where they gave a (1 − 1 e ) competitive ratio. Feldman, Mehta, Mirrokni and Muthukrishnan [9] were the first to beat the (1 − 1 e ) bound for the unweighted version assuming IID arrival model and gave a competitive ratio of 0.67. This was improved by Manshadi, Gharan and Saberi [15] to 0.705. Jaliet and Lu [11] presented adaptive algorithms to further improve the ratio to 0.729 for the unweighted variant, and also achieved a ratio of 0.725 for the vertex-weighted variant. Haeupler, Mirrokni and Zadimoghad- dam [10] first beat the (1 − 1 e ) bound for the edge-weighted variant and achieved a ratio of 0.667. Online matching literature for the non-bipartite setting is extremely lim- ited. Anderson, Ashlagi, Gamarnik and kanoria [5] studied a dynamic model of matching under homogeneous and independent stochastic assumptions to min- imize average wait-times for agents. Akbarpour, Li and Gharan [3] studied dynamic matching with stochastically arriving and departing agents. However, as stated earlier, there has not been any work on online matching in the adver- sarial setting to the best of our knowledge. 1.4 Organization of the paper We formally present our model, definitions and results in Section 2. The proof of our result for edge-weighted OWNBM (Theorem 1) is presented in Section 3, and that for the vertex-weighted case (Theorem 2) is presented in Section 4. Finally, we conclude in Section 5 with discussion of open problems and future directions for research. 5 2 Our Model In this section, we formalize definitions and notations related to our model. We also restate our results formally. Definition 3 (Online Windowed Non-Bipartite Matching (OWNBM)). An in- stance I of the Online Windowed Non-Bipartite Matching problem is a tuple (G, d) where G is a graph and d is a non-negative integer. It satisfies the following properties. • Vertices of G arrive sequentially, one at each time step. • (Directed) edges of G originating from a vertex are revealed when the vertex arrives. • [incidence window (d)] Every (directed) edge in G originating from a vertex terminates at one of the d preceding vertices. A matching M in I is a subset of edges of G such that for every vertex v of G, at most one edge of M is incident on v (either originating from it or terminating at it). Definition 4 (Edge-weighted OWNBM). An edge-weighted OWNBM is an instance I = (G, d) of OWNBM, where every edge e of G has an associated non-negative weight we. The weight of a matching M in I is Pe∈M we. Definition 5 (Vertex-weighted OWNBM). A vertex-weighted OWNBM is an instance I = (G, d) of OWNBM, where every vertex v of G has an associated non-negative weight wv. The weight of a matching M in I is P(u,v)∈M wu +wv. Definition 6 ((r, w)-Competitive algorithm for OWNBM). An (r, w)-Competitive algorithm ALG for OWNBM with r ≤ 1 and w ≥ 0 is an algorithm that, for every instance I = (G, d) of OWNBM, constructs a matching M in I online such that • [matching window (w)] any edge e = (j, i) terminating at a vertex i included in M is picked no later than w time steps after the arrival of i (and hence also j). An edge once picked cannot be deleted from M later. • [competitive ratio (r)] ALGI OPTI ≥ r, where ALGI is the weight of the matching M and OPTI is the maximum (optimal) weight of a matching in I. The weight of the matching is defined depending on whether it is an edge-weighted or a vertex-weighted instance of OWNBM. In case ALG is randomized, M is a random variable and ALGI is the expected weight of M over the randomness used in ALG. We now restate our main results that we already presented earlier. Theorem (Restatement of Theorem 1). There is a randomized ( 1 4 , d)-competitive algorithm for edge-weighted OWNBM where d is the incidence window of the OWNBM instance. 6 Theorem (Restatement of Theorem 2). There is a randomized ( 1 e ), d)- competitive algorithm for vertex-weighted OWNBM where d is the incidence window of the OWNBM instance, if we allow the online algorithm (but not the offline optimal algorithm) to 2 (1 − 1 1. form a 3-matching,and 2. delete an edge (j, i) from a 3-set no later than d steps since the arrival of vertex j. A 3-matching M in I is a set of disjoint subsets of vertices of G, each of size 2 or 3, such that each 2-set is an edge in G, and the induced subgraph of each 3-set has at least 2 edges. The weight of a 3-matching is defined as the sum of weight of all vertices included a 2-set or a 3-set. Note that we do not assume any distribution on edges for our results above. In particular, our results hold for the adversarial model for the arriving vertices and edges. It will be convenient to define a notion of semi-matching for the proofs of both the above theorems. Definition 7 (Semi-matching). Given an instance I = (G, d) of OWNBM, a semi-matching M′ in I is a subset of edges of G such that for every vertex v of G, at most one edge of M′ originates from v and at most one edge of M′ terminates at v. 3 Edge-Weighted OWNBM In this section, we prove Theorem 1. We will need a beautiful result from combinatorial auction theory by Lehmann, Lehmann and Nisan [13]. First, we define an instance of a combinatorial auction from a given instance of OWNBM. Definition 8. Let I = (G, d) be an instance of edge-weighted OWNBM, and let G = (V, E) where V and E are the sets of vertices and edges of G respectively. Let V = n. Define a combinatorial auction with n bidders and n items. Without loss of generality and slightly abusing notation, we assume the vertex set, the item set and the bidder set to be [n]. The valuation vali of the i'th bidder for a set S of items is given by the following. vali(S) = max{ max j∈S;(j,i)∈E w(j,i), 0} The following lemma upper bounds the weight of optimal matching in a edge-weighted OWNBM by the valuation of optimal allocation of the associated combinatorial auction. Lemma 9. Let I = (G, d) be an instance of edge-weighted OWNBM and OPTI be the weight of an optimal matching. Then the optimal allocation for the com- binatorial auction as defined in Definition 8 has valuation at least OPTI . 7 Algorithm 1: 1 ular valuations 2 -approximation for combinatorial auctions with submod- Input: n bidders with submodular valuations and m items Output: A 1 S1 = S2 = . . . = Sn ← ∅; for each item j = 1, 2, . . . , m do 2 -approximation to the optimal allocation let i be the bidder with highest marginal valuation vali(jSi) for item j; Si ← Si ∪ {j}; end return S1 = S2 = . . . = Sn; Proof. To prove the lemma, we produce an allocation with valuation OPTI . Consider an optimal matching M in I. For any edge (j, i) ∈ M, set Si ← {i, j} and Sj ← ∅. For any unmatched vertex k of G, set Sk ← {k}. It is easy to see that the valuation of this allocation is OPTI , which proves the lemmma. Next, we show that the valuation functions for the auction derived from an edge-weighted OWNBM are sub-modular. Lemma 10. The valuation functions for all the bidders in Definition 8 are sub-modular. Proof. Fix bidder i and consider its valuation function vali as defined in Defi- nition 8. Also consider sets S ⊆ T of items and an item k. We will show that the marginal valuation of item k given T is at most the marginal valuation of k given S, i.e., vali(kT ) ≤ vali(kS). Assume the contrary. It is not hard to see that this will imply that max j∈S;(j,i)∈E w(j,i) > max j∈T ;(j,i)∈E w(j,i). Since S ⊆ T , this is an impossibility. Lemma 10 lets us use the following 2-approximation from [13] for combina- torial auctions with sub-modular valuations. (Holds for n bidders and m items; in our case, n = m.) Theorem (Theorem 11 of [13]). If the valuation functions of all the bidders are submodular, then Algorithm 1 is a 1 2 -approximation for the optimal allocation. A useful property of the above theorem is that it works in our online setting as shown in the following lemma. Lemma 11. Let I = (G, d) be an instance of edge-weighted OWNBM and OPTI be the weight of an optimal matching. Then we can construct an allocation for the combinatorial auction as defined in Definition 8 online with valuation at least 1 2 OPTI . Here, the i'th bidder and the i'th item arrives with the arrival of vertex i. 8 Proof. From Theorem 3 and Lemma 10, we immediately see that we can con- struct an allocation with valuation at least half that of the optimal allocation offline once all the vertices of G have arrived. Combining with Lemma 9 gives the valuation of this offline allocation to be at least 1 2 OPTI. The lemma follows by noting that the allocation can be done online (that is, items and bidders corresponding to a vertex i arrives with the arrival of vertex i and item i is allocated to a bidder as soon as the item arrives) due to the following two facts. 1. the 1 2 -approximation algorithm presented above can be run sequentially as items arrive. 2. the marginal valuation of an item for a bidder that has not arrived yet when the item arrives is 0. The following lemma shows that we can do an approximation-preserving transformation from a valuation to a semi-matching online. Lemma 12. Let I = (G, d) be an instance of edge-weighted OWNBM and OPTI be the weight of an optimal matching. Then we can construct a semi-matching M′ of weight 1 2 OPTI online such that any edge (j, i) ∈ M′ terminating at vertex i is picked no later than d time steps after its arrival. Proof. Start by setting M′ ← ∅. Construct the allocation for the combinatorial auction online as in the proof of Lemma 11. Note that an item j is allocated as soon as it arrives. As a result, given the incidence window property of I, the allocation of bidder i , Si is frozen d time steps after arrival of vertex i. For a vertex i, if its valuation val(Si) = 0 after d steps from its arrival, then do not pick any edge terminating at vertex i. Otherwise, set M′ ← M′ ∪ {(j, i)}, where j = argmaxk∈Si w(k,i). It is clear that M′ is a semi-matching as every item is allocated to at most one bidder which means at most one edge of M′ originates from a given vertex j. Also, by construction, we include at most one edge terminating at a given vertex i in M′. It is also clear that the weight of the semi-matching thus constructed is the same as the valuation of the allocation, because for any i, the valuation of the allocation for bidder i equals the weight of the edge terminating at vertex i included in M′. Therefore, by Lemma 11 weight of the constructed semi-matching M′ is at least 1 2 OPTI . The remaining part in the proof of Theorem 1 is to show how can we go from a semi-matching of weight w to a matching of weight at least w/2 online. Consider Algorithm 2 that takes a semi-matching M′ and outputs a matching M in an edge-weighted OWNBM. Lemma 13. Let I = (G, d) be an instance of edge-weighted OWNBM and M′ be a semi-matching in I of weight w. Then Algorithm 2 constructs a random matching M in I of expected weight w/2. 9 Algorithm 2: Constructing matching from semi-matching for edge- weighted OWNBM Input: A semi-matching M′ in an edge-weighted OWNBM I Output: A (random) matching M in I with expected weight at least half the weight of M′ M ← ∅; for each vertex i in increasing order do if (j, i) ∈ M′ for some vertex j then if (i, k) ∈ M′ for some vertex k then if color(k) == green then color(i) = red; end if color(k) == red then color(i) = green; end else choose color(i) green or red with probability 1/2 each; end if color(i) == green then M ← M ∪ (j, i); end end end return M; Proof. We need to show that 1. the constructed set M is a matching, and 2. weight of M is 1/2 of the weight of M′. Notice that we include edge (j, i) in M iff color(i) is green. For (1), assume contrary. Then there exist vertices i, j and k such that both the edges (i, k) and (j, i) are included in M. Since we process vertices in order and vertex k must have been processed first. Since edge (i, k) was included in M, color(k) must be green. This implies color(i) is red, which contradicts that edge (j, i) was also included in M. For (2), it can be easily shown by induction that for any vertex i, such that there exists some edge (j, i) in M′, color(i) = green with probability 1/2. This means the edge (j, i) gets included in M with probability 1/2, which proves that the weight of M is 1/2 of the weight of M′. Proof of Theorem 1. Combining Lemma 12 and Lemma 13, we immediately see that given an instance I = (G, d) of edge-weighted OWNBM, we can construct a matching M in I of weight 1 4 OPTI. Since the semi-matching constructed in 10 Lemma 12 picks an edge (j, i) no later than d time steps after the arrival of i, and since Algorithm 2 processes edges in increasing order of the terminal vertex, this yields a ( 1 4 , d)-competitive algorithm for edge-weighted OWNBM. 4 Vertex-Weighted OWNBM In this section, we prove Theorem 2. Lemma 14. Let I = (G, d) be an instance of vertex-weighted OWNBM. Then Algorithm 3 constructs a (random) semi-matching M′ in I online such that any edge (j, i) ∈ M′ terminating at vertex i is picked no later than d time steps after its arrival. Proof. Obvious from the algorithm. We could lower bound the weight of the semi-matchings constructed by Algorithm 3. But for our proof, we need a stronger claim for which we define the notion of half-weight. Definition 15. A semi-matching M′ in an instance I of vertex-weighted OWNBM constructed by Algorithm 3 is said to be of origin-type if the random variable type took the value origin; else it is said to be of destination-type. The half- weight of an origin-type semi-matching is defined as X wj; (j,i)∈M′ while the half-weight of a destination-type semi-matching is defined as X wi. (j,i)∈M′ We use a beautiful primal-dual proof technique introduced by Devanur, Jain and Kleinberg [7] for lower bounding the expected half-weight of a semi- matching constructed by the algorithm. However, the proof is omitted in this shorter exposition. Lemma 16. Let I = (G, d) be an instance of vertex-weighted OWNBM and OPTI be the weight of an optimal matching. Then Algorithm 3 constructs a (random) semi-matching M′ of expected half-weight 1 2 (1 − 1 e )OPTI. To complete the proof of Theorem 2, we need to show how can we go from a semi-matching of half-weight w to a 3-matching of weight at least w online. The proof of the following lemma is omitted. Lemma 17. Let I = (G, d) be an instance of vertex-weighted OWNBM and M′ be a semi-matching in I of half-weight w. Then we can construct a 3-matching M in I of weight at least w by processing vertices in order. An edge (j, i) is picked in a 2-set or a 3-set while processing vertex i, and may get deleted from a 3-set while processing vetex j. 11 Proof of Theorem 2. Combining Lemma 16 and Lemma 13, we immediately see that given an instance I = (G, d) of vertex-weighted OWNBM, we can con- struct a 3-matching M in I of weight 1 e )OPTI . Since the semi-matching constructed in Algorithm 3 picks an edge (j, i) no later than d time steps after the arrival of i, and since Lemma 17 processes edges in increasing order of the terminal vertex, this yields a randomized ( 1 e ), d)-competitive algorithm for vertex-weighted OWNBM where an edge (j, i) picked in a 3-set may get deleted no later than d steps since the arrival of vertex j. 2 (1 − 1 2 (1− 1 5 Conclusions In this work, we initiated the study of matching rides in a ride-sharing plat- form in a formal graph-theoretic online matching setting. For this purpose, we proposed a model that we call Online Windowed Non-Bipartite Matching (OWNBM). Our model is simple and elegant, and yet remarkably powerful to capture the important attributes of the rider matching problem in ride-sharing platforms. We showed how the edge-weighted and vertex-weighted versions of OWNBM capture the objectives of matching efficiency and matching rate, which are important and widely used metrics in ride-sharing industry. We provided a randomized 1 2 (1− 1 4 -competitive algorithm for the edge-weighted version, and a randomized 1 e )-competitive algorithm for the vertex-weighted version of OWNBM (with some constraints relaxed). While we believe our bounds might be further improved, these are first results for online matching in non-bipartite graphs in the adversarial setting to the best of our knowledge. Our result for the edge-weighted version uses a beautiful result from combina- torial auction theory, while that for the vertex-weighted version uses insights and techniques from a very elegant randomized primal-dual analysis technique in matching theory. We believe our model is of independent theoretical interest and can find use outside of the immediate context of ride-sharing. In fact, one of the novelties of our work is proposing a model for studying online matching in non-bipartite graphs. We leave a range of open questions and future research directions. We believe it is possible to improve the bounds we presented. Our model can also be studied in the stochastic setting where edges are drawn from a distribution which is known or can be learned. We considered two-party matches in this work. One can consider hyper-edges in matching which correspond to matching more than two parties together for sharing a car. We believe that these and other related challenging problems are both theoretically interesting and practically relevant. References [1] Niels Agatz, Alan L. Erera, Martin W. P. Savelsbergh, and Xing Wang. Dynamic ride-sharing: a simulation study in metro atlanta. Transp Res 12 Part B Methodological, 2011. [2] Gagan Aggarwal, Gagan Goel, Chinmay Karande, and Aranyak Mehta. Online vertex weighted bipartite matching and single-bid budgeted alloca- tions. In Proceedings of the twenty-second annual ACM-SIAM symposium on Discrete Algorithms, 2011. [3] Mohammad Akbarpour, Shengwu Li, and Shayan Oveis Gharan. A dy- namic model of barter exchange. In Proceedings of the ACM conference on Economics and computation, 2014. [4] Javier Alonso-Mora, Samitha Samaranayake, Alex Wallar, Emilio Frazzoli, and Daniela Rus. On-demand high-capacity ride-sharing via dynamic trip- vehicle assignment. Proc Natl Acad Sci USA, 2017. [5] Ross Anderson, Itai Ashlagi, David Gamarnik, and Yash Kanoria. A dy- namic model of barter exchange. In Proceedings of the ACM-SIAM Sym- posium on Discrete Algorithms, 2015. [6] Gonalo Homem de Almeida Correia and Bart van Arem. Solving the user optimum privately owned automated vehicles assignment problem (uo- poavap): a model to explore the impacts of self-driving vehicles on urban mobility. Transp Res Part B Methodological, 2016. [7] Nikhil R. Devanur, Kamal Jain, and Robert D. Kleinberg. Randomized primal-dual analysis of ranking for online bipartite matching. In Proceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms, 2013. [8] Jon Feldman, Nitish Korula, Vahab Mirrokni, S. Muthukrishnan, and Mar- tin Pl. Online ad assignment with free disposal. In Internet and network economics, 2009. [9] Jon Feldman, Aranyak Mehta, Vahab Mirrokni, and S. Muthukrishnan. Online stochastic matching: Beating 1-1/e. In Proceedings of the Founda- tions of Computer Science, 2009. [10] Bernhard Haeupler, Vahab S. Mirrokni, and Morteza Zadimoghaddam. On- Improved approximation algorithms. line stochastic weighted matching: Internet and Network Economics, 2011. [11] Patrick Jaillet and Xin Lu. Online stochastic matching: New algorithms with better bounds. Mathematics of Operations Research, 2013. [12] Richard M. Karp, Umesh V. Vazirani, and Vijay V. Vazirani. An optimal In Proceedings of the twenty- algorithm for on-line bipartite matching. second annual ACM symposium on Theory of computing, 1990. [13] Benny Lehmann, Daniel Lehmann, and Noam Nisan. Combinatorial auc- In Proceedings of the 3rd ACM tions with decreasing marginal utilities. conference on Electronic Commerce, 2001. 13 [14] Shuo Ma, Yu Zheng, and Ouri Wolfson. A large scale dynamic taxi rideshar- ing service. In Proc of the 29th International Conference on Data Engi- neering, 2013. [15] Vahideh H. Manshadi, Shayan Oveis Gharan, and Amin Saberi. Online stochastic matching: Online actions based on offline statistics. Mathematics of Operations Research, 2012. [16] Aranyak Mehta. Online matching and ad allocation. Foundations and Trends in Theoretical Computer Science, 2012. [17] Marco Pavone, Stephen L Smith, Emilio Frazzoli, and Daniela Rus. Robotic load balancing for mobility-ondemand systems. Int J Rob Res, 2012. [18] Paolo Santi, Giovanni Resta, Michael Szell, Stanislav Sobolevsky, Steven H. Strogatz, and Carlo Ratti. Quantifying the benefits of vehicle pooling with shareability networks. In Proc Natl Acad Sci USA, 2014. [19] Kevin Spieser, Samitha Samaranayake, Wolfgang Gruel, and Emilio Fraz- zoli. Shared-vehicle mobility-ondemand systems: A fleet operators guide to rebalancing empty vehicles. In Transportation Research Board 95th Annual Meeting, 2016. [20] Rick Zhang and Marco Pavone. Control of robotic mobility-on-demand In Proceedings of Robotics: systems: a queueing-theoretical perspective. Science and Systems Conference, 2014. 14 Algorithm 3: Constructing semi-matching for vertex-weighted OWNBM Input: An instance I = (G, d) of vertex-weighted OWNBM Output: A semi-matching M′ in I let n be the number of vertices in G; define function g(Y ) = eY −1; M′ ← ∅; assume all vertices in G are colored white; pick type as origin or destination with probability 1/2 each; if type == destination then for vertex j in increasing order do pick Yj ∈ [0, 1] uniformly at random; let N (j) be the set of vertices k of color white such that (j, k) is an edge of G; if N j 6= ∅ then let i = argmax{wk(1 − g(Yk)) : k ∈ N (j)}; M′ ← M′ ∪ {(j, i)}; color vertex i black; end end else add d dummy vertices of weight 0 with no edges last in the ordering; for vertex t in increasing order do pick Yt ∈ [0, 1] uniformly at random; let i = t − d; if i > 0 then let N (i) be the set of vertices k of color white such that (k, i) is an edge of G; if N i 6= ∅ then let j = argmax{wk(1 − g(Yk)) : k ∈ N (i)}; M′ ← M′ ∪ {(j, i)}; color vertex j black; end end end end return M′; 15
1110.3619
1
1110
2011-10-17T09:44:13
Playing Mastermind With Constant-Size Memory
[ "cs.DS", "cs.NE" ]
We analyze the classic board game of Mastermind with $n$ holes and a constant number of colors. A result of Chv\'atal (Combinatorica 3 (1983), 325-329) states that the codebreaker can find the secret code with $\Theta(n / \log n)$ questions. We show that this bound remains valid if the codebreaker may only store a constant number of guesses and answers. In addition to an intrinsic interest in this question, our result also disproves a conjecture of Droste, Jansen, and Wegener (Theory of Computing Systems 39 (2006), 525-544) on the memory-restricted black-box complexity of the OneMax function class.
cs.DS
cs
Playing Mastermind With Constant-Size Memory Benjamin Doerr and Carola Winzen∗ Max-Planck-Institut fur Informatik, Saarbrucken, Germany {doerrwinzen}@mpi-inf.mpg.de Abstract We analyze the classic board game of Mastermind with n holes and a constant number of colors. A result of Chv´atal (Combinatorica 3 (1983), 325-329) states that the codebreaker can find the secret code with Θ(n/ log n) questions. We show that this bound remains valid if the codebreaker may only store a constant number of guesses and answers. In addition to an intrinsic interest in this question, our result also disproves a conjecture of Droste, Jansen, and Wegener (Theory of Computing Systems 39 (2006), 525-544) on the memory-restricted black-box complexity of the OneMax function class. 1 Introduction The original Mastermind game is a board game for two players invented in the seventies by Meirowitz. It has pegs of six different colors. The goal of the codebreaker, for brevity called Paul here, is to find a color combination made up by codemaker (called Carole in the following). He does so by guessing color combinations and receiving information on how close this guess is to Carole's secret code. Paul's aim is to use as few guesses as possible. For a more precise description, let us call the colors 1 to 6. Write [n] := {1, . . . , n} for any n ∈ N. Carole's secret code is a length-4 string of colors, that is, a z ∈ [6]4. In each iteration, Paul guesses a string x ∈ [6]4 and Carole replies with a pair (eq(z, x), π(z, x)) of numbers. The first number, eq(z, x), which is usually indicated via black answer-pegs, is the number of positions, in which Paul's and Carole's string coincide. The other number, π(z, x), usually indicated by white answer- pegs, is the number of additional pegs having the right color, but being in the wrong position. Formally eq(z, x) := {i ∈ [4] zi = xi} and π(z, x) := maxρ∈S4 {i ∈ [4] zi = xρ(i)} − eq(z, x), where S4 denotes the set of all permutations of [4]. Paul "wins" the game if he guesses Carole's string, that is, if Carole's answer is (4, 0). We are interested in strategies for Paul that guarantee him to find the secret code with few questions. We thus adopt a worst-case view with respect to Carole's secret code. This is equivalent to assuming that Carole may change her hidden string at any time as long as it remains consistent with all previous answers (devil's strategy). Previous Results. Mathematics and computer science literature produces a plethora of results on the Mastermind problem. For the original game with 6 colors and 4 positions, Knuth [Knu77] ∗Carola Winzen is a recipient of the Google Europe Fellowship in Randomized Algorithms. This research is supported in part by this Google Fellowship. 1 showed that Paul needs at most four queries until being able to identify Carole's string (which he may query in the fifth iteration to win the game). Chv´atal [Chv83] studies a general version of this game with k colors and n positions, that is, the secret code is a length-n string z ∈ [k]n. Denote by d(n, k) the minimum number of guesses that enable Paul to win the game for any secret code. Chv´atal proves that for k < n1−ε, ε > 0 an arbitrarily small constant, we have d(n, k) = O( n log k log n−log k ). More precisely, he shows that for any ε > 0 and n sufficiently large, (2 + ε) n(1+2 log k) log n−log k guesses chosen from [k]n independently and uniformly at random, with high probability, suffice to distinguish between all possible codes (that is, each secret code leads to a different sequence of answers). Therefore, the secret code can be determined after that many guesses. This remains true if Carole replies only with black answer- pegs, that is, if for any of Paul's guesses x she reveals to him only eq(z, x), the number of bits, in which her and Paul's string coincide. For larger values of k, the following is known. For n ≤ k ≤ n2, Chv´atal proves d(n, k) ≤ 2n log k + 4n and for k = ω(n2 log n) he shows (k − 1)/n ≤ d(n, k) ≤ ⌈k/n⌉ + d(n, n2). These results have subsequently been improved. Chen, Cunha, and Homer [CCH96] show that d(n, k) ≤ 2n⌈log n⌉ + 2n +⌈k/n⌉ + 2 for k ≥ n. Goodrich [Goo09] proves d(n, k) ≤ n⌈log k⌉ +⌈(2− 1/k)n⌉ + k for arbitrary k. For k = 2 colors, the Mastermind problem is related to the well-studied coin weighing problem. For this reason, first results on this problem date back to years as early as 1963, when Erdos and R´enyi [ER63] show that d(n, 2) = Θ(n/ log n). Concerning the computational complexity, Stuckman and Zhang [SZ06] show that it is N P -hard to decide whether a given sequence (x(i), (eq(i), π(i)))t i=1 of queries x(i) and answers (eq(i), π(i)) of black and white pegs has a secret code leading to these answers, i.e., whether there exists a string z ∈ [k]n such that eq(z, x(i)) = eq(i) and π(z, x(i)) = π(i) for all i ∈ [t]. Goodrich [Goo09] proves that this is already N P -hard if we only ask for consistence with the black answer-peg replies eq(i). Our results. Originally motivated by a conjecture on black-box complexities (cf. Section 2), we study a memory-restricted version of the Mastermind problem. Since this original motivation asks for the case of two colors only, we restrict ourselves to the number k of colors being constant, though clearly our methods can also be used to analyze larger numbers of colors. The memory-restriction can be briefly described as follows. Given a memory of size m ∈ N, Paul can store up to m guesses and Carole's corresponding replies. Based only on this information, Paul decides on his next guess. After receiving Carole's reply, based only on the content of the memory, the current guess, and the current answer, he decides which m out of the m + 1 strings and answers he keeps in the memory. Note that our memory restriction means that Paul truly has no other memory, in particular, no iteration counters, no experience that certain colors are not used, and so one. So formally Paul's strategy consists of a guessing strategy, which can be fully described by a mapping from m-sets of guesses and answers to strings x ∈ [k]n, and a forgetting strategy, which maps (m + 1)-sets of guesses and answers to m-subsets thereof. Clearly, a memory-restriction makes Paul's life not easier. The O(n/ log n) strategies by Erdos and R´enyi [ER63] and by Chv´atal [Chv83] do use the full history of guesses and answers and thus only work with a memory of size Θ(n/ log n). Surprisingly, this amount of memory is not necessary. In fact, one single memory cell is sufficient. Theorem 1. Let k ∈ N. For all n ∈ N, Paul has a size-one memory strategy winning the Mas- termind game with k colors and n positions in O(n/ log n) guesses. This remains true if we allow 2 Carole to play a devil's strategy and if Carole only reveals the number of fully correct pegs eq(x, z) ("black answer-peg version of Mastermind"). The bound in Theorem 1 is asymptotically tight. A lower bound of Ω(n/ log n) is already true without memory restrictions. This follows easily from an information theoretic argument, cf. [ER63] or [Chv83]. Our result disproves a conjecture of Droste, Jansen, and Wegener [DJW06], who believed that a lower bound of Ω(n log n) should hold for the 2-color black answer-peg Mastermind problem with memory-restriction one. The proof of Theorem 1 is quite technical. For a clearer presentation of the ideas, we first consider the size-two memory-restricted model, cf. Section 3. The proof of Theorem 1 is given in Section 4. Before going into the proofs, in the following section we sketch the connection between Mastermind games and black-box complexities. 2 Mastermind and Black-Box Complexities In this section, we describe the connection between the Mastermind game and black-box complexity. The reader only interested in the Mastermind result may skip this section without loss. Roughly speaking, the black-box complexity of a set of functions is the number of function evaluations needed to find the optimum of an unknown member from that set. Since problem- unspecific search heuristics such as randomized hill-climbers, evolutionary algorithms, simulated annealing etc. do optimize by repeatedly generating new search points and evaluating their objective values ("fitness"), the black-box complexity is a lower bound on the efficiency of such general- purpose heuristics [DJW06]. Black-Box Complexity. Let S be a finite set. A (randomized) algorithm following the scheme of Algorithm 1 is called black-box optimization algorithm for functions S → R. Algorithm 1: Scheme of a black-box algorithm for optimizing f : S → R 1 Initialization: Sample x(0) according to some probability distribution p(0) on S; 2 Query f (x(0)); 3 for t = 1, 2, 3, . . . do 4 5 Depending on (cid:0)(x(0), f (x(0))), . . . , (x(t−1), f (x(t−1)))(cid:1) choose a probability distribution p(t) on S and sample x(t) according to p(t); Query f (x(t)); For such an algorithm A and a function f : S → R, let T (A, f ) ∈ R ∪ {∞} be the expected number of fitness evaluations until A queries for the first time some x ∈ arg max f . We call T (A, f ) the runtime of A for f . For a class F of functions S → R, the A-black-box complexity of F is T (A,F) := supf ∈F T (A, f ), the worst-case runtime of A on F. Let A be a class of black-box algorithms for functions S → R. Then the A-black-box complexity of F is T (A,F) := inf A∈A T (A,F). If A is the class of all black-box algorithms, we also call T (A,F) the unrestricted black-box complexity of F. As said, the unrestricted black-box complexity is a lower bound for the efficiency of randomized search heuristics optimizing F. Unfortunately, often this lower bound is not very useful. For exam- ple, Droste, Jansen, and Wegener [DJW06] observe that the N P -complete MaxClique problem on graphs of n vertices has a black-box complexity of only O(n2). 3 Black-Box Algorithms with Bounded Memory. As a possible solution to this dilemma, Droste, Jansen, and Wegener suggest to restrict the class of algorithms considered from all black- box optimization algorithms to a reasonably large subset. A natural restriction is to forbid the algorithm to exploit the whole history of search points evaluated. This is motivated by the fact that many heuristics, e.g., evolutionary algorithms, only store a bounded size population of search points. Simple hill-climbers or the Metropolis algorithm even store only one single search point. Algorithm 2 is the scheme of a black-box algorithm with bounded memory of size µ. It is important to note that a black-box algorithm with bounded memory is not allowed to access any other information than the one stored in the µ pairs (x(1), f (x(1))), . . . , (x(µ), f (x(µ))), which are currently stored in the memory and, in the selection step, also the information provided by (x(µ+1), f (x(µ+1))). In particular, the algorithm does not have access to an iteration counter. Algorithm 2: Scheme of a black-box algorithm with memory of size µ for optimizing function f : S → R 1 Initialization: M ← ∅; 2 for t = 1, 2, . . . do 3 4 5 Depending (only) on M choose a probability distribution p on S and sample x(µ+1) according to p ; //variation step Query f (x(µ+1)); Select M ⊆ M ∪ {(x(µ+1), f (x(µ+1)))} of size M ≤ µ; //selection step Mastermind and the OneMax function class. A test function often regarded to analyze how the randomized search heuristic under investigation progresses in easy parts of the search space, is the simple OneMax function OneMax : {0, 1}n → R, x 7→Pn i=1 xi. Note that OneMax(x) = eq((1, . . . , 1), x) for all x ∈ {0, 1}n. In fact, for any z ∈ {0, 1}n, eq(z,·) yields an equivalent optimization problem. Let us denote by OneMaxn := {eq(z,·) z ∈ {0, 1}n} the class of all these functions. Due to a coupon collector effect, many classical randomized search heuristics like randomized local search or the (µ + λ) evolutionary algorithm (with µ, λ constants) need Θ(n log n) function evaluations to optimize OneMaxn. As a moments thought reveals, black-box algorithms optimizing OneMaxn correspond to strate- gies for Paul in the Mastermind game (without memory restriction) with two colors and only black answer-pegs used. Hence the unrestricted black-box complexity of OneMaxn is Θ(n/ log n) by the results of Erdos and R´enyi [ER63] and Chv´atal [Chv83]. This connection was seemingly overlooked so far in the randomized search heuristics community, where Droste, Jansen, and Wegener [DJW06] prove an upper bound of O(n) and later Anil and Wiegand [AW09] prove the asymptotically correct bound of O(n/ log n). Since already the first bound is lower than what many randomized search heuristics achieve, Droste, Jansen, and Wegener suggest to investigate the memory-restricted black-box complexity of OneMaxn. They conjecture in [DJW06, Section 6] that a memory restriction of size one leads to a black-box complexity of order Θ(n log n). Again, clearly, the memory-restricted black-box complexity of OneMaxn and optimal strategies for Mastermind with two colors, black answer-pegs only, and a corresponding memory restriction are equivalent questions. Consequently, our result can be rephrased to saying that the black-box 4 complexity of OneMaxn even with the memory restricted to one is Θ(n/ log n), disproving the conjecture of Droste, Jansen, and Wegener. 3 The Mastermind Game with Memory of Size Two Since the proof of Theorem 1 is quite technical, we give in this section a simpler proof showing that with a memory of size two Paul can win the game using only O(n/ log n) guesses. Already this proof contains many ingredients needed to prove Theorem 1, e.g., the use of the random guessing strategy with limited memory, the block-wise determination of the secret code, and the simulation of iteration counters in the memory. Let k ≥ 2 be the number of colors used. In particular for k = 2, it will be convenient to label the colors from 0 to k − 1. Let us denote the set of colors by C := [0..k − 1] := {0, 1, . . . , k − 1}. We assume that k is a constant and that the number n of positions in the string is large, that is, all asymptotic notation is with respect to n. Theorem 2. Paul has a size-two memory strategy winning the black answer-peg only Mastermind game with k colors and n positions in O(n/ log n) guesses. This remains true if we allow Carole to play a devil's strategy. As many previous works, the proof of Theorem 2 heavily relies on random guessing. For the case of k = 2 colors, already Erdos and R´enyi [ER63] showed that there is a t ∈ Θ(n/ log n) such that t guesses x(1), . . . , x(t) chosen from {0, 1}n independently and uniformly at random, together with Carole's black answer-peg answers, uniquely define the hidden code. This was generalized by Chv´atal [Chv83] to the following result. Theorem 3 (from [Chv83]). Let ε > 0, let n > n(ε) be sufficiently large and let k < n1−ε. Let x(1), . . . , x(t) be t ≥ (2 + ε) n(1+2 log k) log n−log k samples chosen from Cn independently and uniformly at random. Then for all z ∈ Cn, the set S consistent := {y ∈ Cn ∀i ∈ [t] : eq(y, x(i)) = eq(z, x(i))} satisfies E[S consistent] ≤ 1 + 1/n. Since the strategy implicit in Theorem 3 needs a memory of size Θ(n/ log n), we cannot apply it directly in our setting. We can, however, adapt it to work on smaller portions ("blocks") of the secret code, and this with much less memory. Let y ∈ Cn and let B ⊆ [n] be a block (i.e., an interval) of size s := ⌈√n⌉. As we shall see, by t ∈ O(s/ log s) times guessing a string obtained from y by replacing the colors in B by randomly chosen ones (and guessing k additional reference strings), we can determine zB, the part of the secret code z in block B. We can do so with a memory of size two only. We store the string obtained from y by altering it on B (sampling string) in one cell. Note that we do not need to remember y, as we only need to ensure that our guesses agree in the positions [n]\ B. We use the other memory cell (storage string, in the following typically denoted by x) to store the random substrings of length s substituted into y at B, and Carole's answers. Note that each such answer can be encoded in binary using ℓn ∈ O(log n) entries of the string. Hence the t guesses and answers can be memorized using a total number of t(s + ℓn) = O(n/ log n) positions. 5 2 Algorithm 3: An almost size-two memory-restricted algorithm winning the k-color black answer-peg only Mastermind game in O(n/ log n) guesses. Remark: x denotes the unique string in M with xn = 1 and y denotes the unique string in M with yn = 0. 1 Initialization: y ← [0 . . . 0]; 3 for i = 1 to ⌈(n − 1)/s⌉ do Query eq(z, y) and update M ← {(y, eq(z, y))}; x ← [0 . . . 01]; //initialization of x Query eq(z, x) and update M by adding (i = 1) or replacing (i > 1) (x, eq(z, x)) in M; for q = 0 to t + k − 1 do if q < k then y ← substitute(y, Bi, [q . . . q]) ; //reference string else y ← substitute(y, Bi, r) where r ∈ CBi u.a.r.; //random guess Query eq(z, y) and update M by replacing (y, eq(z, y)); x ← [x1 . . . xp1(x)BLOCKi(y)binaryℓn(eq(z, y))10 . . . 01] ; //add y's info to x Query eq(z, x) and update M by replacing (x, eq(z, x)); 4 5 6 7 8 9 10 11 12 13 14 while ∆i(y) < Bi do y ← substitute(y, Bi, w), where w ∈ S consistent u.a.r.; Query eq(z, y) and update M by replacing (y, eq(z, y)); i 15 while eq(z, y) < n do y ← substitute(y,{n}, c), where c ∈ C u.a.r., and query eq(z, y); This approach allows us to determine s positions of z using t = O(s/ log s) guesses. Hence we can determine the secret code z with t⌈n/s⌉ = O(n/ log n) guesses as desired. In Algorithm 3 (notation used will be introduced below) we make this strategy more precise by giving it in pseudo-code. Note, however, that this algorithm does not fully satisfy the size-two memory restriction. The reason is that the queries do not only depend on the current state of the memory, but also on iteration counters and, e.g. in lines 9 and 11, on the program counter. Further below, in Algorithm 4 we shall remove this shortcoming with a few additional technicalities, which we are happy to spare for the moment. Before we argue for the correctness of Algorithm 3, let us fix the notation. For any string x ∈ Cn we also write x = [x1 . . . xn]. To ease reading, we allow ourselves to indicate different structural components of x by vertical bars, e.g., x = [x1 . . . xpxp+1 . . . xn]. For i ∈ [⌈(n − 1)/s⌉] let Bi := {(i − 1)s + 1, . . . , is} ∩ [n − 1], the positions of the i-th block. Set BLOCKi(x) := xBi := [x(i−1)s+1 . . . xmin{is,n−1}] , the i-th block of x. For any string r ∈ CBi we define substitute(x, Bi, r) := [x1 . . . x(i−1)srxmin{is,n−1}+1 . . . xn] , the string with the i-th block substituted by r. Similarly, let substitute(y,{n}, c) := [y1 . . . yn−1c]. Note that we do not assign the n-th position to any of the blocks. We do so because in Algorithms 3 and 4 we shall use that position to indicate, which one of the two strings in the memory M is the storage string (the unique x ∈ M with xn = 1) and which one is the sampling string (the unique string y ∈ M with yn = 0). Let p1(x) := max{i ∈ [n − 1] xi = 1}, the largest position i < n of x with entry "1". As mentioned above, we encode Carole's answers eq(z, y) ∈ [0..n] in binary, using ℓn := ⌈log n⌉ + 6 1 positions, and we denote this binary encoding of length ℓn by binaryℓn(eq(z, y)). By ∆i(y) we denote the contribution of the i-th block to the value eq(z, y), i.e., eq(z, y) is the number of positions in the i-th block, in which Paul's guess y and Carole's secret code z coincide. Formally, ∆i(y) := eq(zBi, yBi). Lastly, let S consistent be the set of strings w of length Bi such that substitute(z, Bi, w) is consistent with all of Carole's replies (formal definition follows). We shall see below that both ∆i(y) and S consistent can be computed solely from the content of the memory cells (lines 12 -- 14). i i We now argue for the correctness of Algorithm 3. Let us consider the state of the memory after having sampled all t random samples for the i-th block (that is, we are in lines 12 -- 14). We show that based on the information given in the memory, we can restore the full history of guesses for the i-th block. To this end, first note that for any guess y done in line 9, we used s + ℓn + 1 positions in x for storing its information (line 10; we add the additional "1" at the end to ease determining via p1(x) the positions in x, which have not yet been used for storing information). In lines 6 -- 11 we first asked and stored k non-random guesses xc = substitute(y, Bi, [c . . . c]) and we stored these reference strings together with Carole's replies eq(z, xc) = Pℓn h=1 2h−1xc(s+ℓn+1)−h, c ∈ [0..k − 1]. Therefore, for j ∈ [t], the j-th random sample is r(j) = [x(k+j−1)(s+ℓn+1)+1 . . . x(k+j−1)(s+ℓn+1)+Bi] and the corresponding query was y(j) = substitute(y, Bi, r(j)). We have stored Carole's reply to this guess in binary, and we can infer eq(z, y(j)) =Pℓn h=1 2h−1x(k+j)(s+ℓn+1)−h. This shows how to Next we show how to compute the contributions ∆i(y(j)) of the entries in the i-th block. To this end, note that the constant substrings [c . . . c] in the reference strings xc in total contribute exactly Bi to the sum eq(z, x0) + . . . + eq(z, xk). Formally, Pk−1 c=0 eq([z(i−1)s+1 . . . zmin{is,n−1}], [c . . . c]) = Bi. Since all other positions of the sampling string y are not changed during the phase, in which we determine the i-th block, we infer that regain the full guessing history. ∆i(y(j)) = eq(z, y(j)) − (eq(z, x0) + . . . + eq(z, xk) − Bi)/k . Consequently, in lines 12 -- 14, the algorithm can compute ∆i(y(j)) for all j ∈ [t]. From this it can infer S consistent i := {z ∈ CBi ∀j ∈ [t] : eq(z, BLOCKi(y(j))) = ∆i(y(j))}, the set of possible code segments in Bi. By Theorem 3, the expected size of S consistent is bounded from above by 1 + 1/Bi. Thus, in lines 12 -- 14 we need an expected number of 1 + 1/Bi samples w chosen from S consistent uniformly at random until we find a y = substitute(y, Bi, w) with ∆i(y) = s (which implies that the i-th block of y coincides with Carole's secret code). This shows how we determine the entries of the i-th block in an expected total number of t = O(s/ log s) guesses. i i When Algorithm 3 executes line 15, all but the last entry of y coincide with Carole's secret code. Hence trying random colors in the n-th position finds the hidden code z with an additional expected number of k = Θ(1) guesses. To turn Algorithm 3 into a size-two memory-restricted one, we use the first ℓn entries of x to store in binary the iteration counter i, which indicates the index of the block currently being under consideration. This will move the storage space for the guesses and answers by ℓn positions to the right. Formally, we define i(x) :=Pℓn−1 h=0 2hxℓn−h. The inner for loop needs no additional memory to be simulated, because we can learn from p1(x) how many guesses q(x) have been queried already. More precisely, since storing each guess requires s+ℓn+1 positions and the first ℓn positions are used for indicating the number of already determined entries, we have q(x) := (p1(x)− ℓn)/(s + ℓn + 1) . 7 Algorithm 4: A size-two memory-restricted algorithm winning the k-color black answer-peg only Mastermind game in O(n/ log n) guesses. Remark: x denotes the unique string in M with xn = 1 and y denotes the unique string in M with yn = 0. 1 Initialization: Let M ← ∅ ; // clear memory 2 if M = ∅ then y ← [0...0] ; //first reference string Query eq(z, y) and update M ← {(y, eq(z, y))}; 5 else if M = 1 then x ← [0...01] ; //initialization of storage string Query eq(z, x) and update M ← M ∪ {(x, eq(z, x))}; 8 else if i(x) < ⌈(n − 1)/s⌉ then if x = [0 . . . 01] or ∆i(x)(y) = Bi(x) then 3 4 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 x ← [binaryℓn(i(x) + 1)BLOCKi(x)+1(y)binaryℓn(eq(z, y))10 . . . 01] ; //clear storage string and add first reference string Query eq(z, x) and update M by replacing (x, eq(z, x)); else if Part(y, x) = 1 and q(x) < t + k then if q(x) < k then y ← substitute(y, Bi(x), [q(x) . . . q(x)]) ; //reference string else y ← substitute(y, Bi(x), r) where r ∈ CBi(x) u.a.r.; //random guess Query eq(z, y) and update M by replacing (y, eq(z, y)); else if Part(y, x) = 0 and ∆i(x)(y) < Bi(x) then x ← [x1 . . . xp1(x)BLOCKi(x)(y)binaryℓn(eq(z, y))10 . . . 01]; //add y's info to x Query eq(z, x) and update M by replacing (x, eq(z, x)); else if Part(y, x) = 1 and q(x) = t + k then y ← substitute(y, Bi(x), w) where w ∈ S consistent Query eq(z, y); if ∆i(x)(y) = Bi(x) then Update M by replacing (y, eq(z, y)); chosen u.a.r.; i(x) 23 else if i(x) = ⌈(n − 1)/s⌉ then y ← substitute(y,{n}, c) where c ∈ C\{yn} u.a.r.; Query eq(z, y) ; 26 Go to line 2; Lastly, we need to replace the sequential queries in lines 9 and 11 of Algorithm 3 (as this exploits information stored in the program counter). Fortunately, again we can deduce from the memory where we stand. We define a function Part(y, x), which equals 1 if the information of y has been added to the storage string x already and which equals 0 otherwise. That is, we set Part(y, x) =(1, if Pℓn 0, otherwise . i=1 2i−1xp1(x)−i = eq(z, y) and BLOCKi(x)(y) = [xp1(x)−ℓn−Bi(x) . . . xp1(x)−ℓn−1] Note that Part(y, x) = 1 indicates that the information of y has been stored in x also in the case that our current sample equals the previous one. This is no problem as then the current guess does not give any new information. Hence the use of Part modifies the algorithm to sample t 8 random guesses without immediate repitition. Note that the probability to sample the same string r ∈ CBi(x) twice in a row is at most 1/2 (if the last block consists only of one position and k = 2) and is typically much smaller. Hence, occurrences of this event have no influence on the asymptotic number of guesses needed to win the game. With these modifications, Algorithm 3 becomes the truly size-two memory-restricted Algo- rithm 4. 4 Memory of Size One: Proof of Theorem 1 Compared to the situation in Section 3, Paul faces two additional challenges in the size-one memory- restricted setting. The obvious one is that he has less memory available, in particular, after a large part of the code has been determined and needs to be stored. The more subtle one is that he cannot any longer query a search point and then store whatever is worth storing in the second memory cell. With one memory cell, all he can do is to guess a new string and keep or forget it. 4.1 Linear Time Strategies Before we give a proof of Theorem 1, let us discuss a linear time winning strategy, i.e., a strategy that allows Paul to find Carole's secret code in a linear expected number of guesses using one memory cell only. This linear time strategy will be used in the proof of Theorem 1 to determine the last Θ(n/ log n) entries of the secret code. The basic idea of the linear time strategy is to test each position one by one, from left to right. Since we have just one memory cell, we need to indicate in this one string, which entries have been determined already. We do so by keeping all not yet determined entries at one identical value different from the one of the entry determined last. To this end, let us for all x ∈ Cn define tn(x) := min{i ∈ [n] ∀j ∈ {i, . . . , n} : xj = xi} , the tail number of x. The following lemma describes the linear time strategy. Lemma 4. Let x ∈ Cn. Furthermore, let us denote Carole's secret code by z ∈ Cn. Let us assume that the first tn(x)−1 entries of z have been determined (i.e., Carole can no longer change the entries of [z1 . . . ztn(x)−1]). Further assume that xi = zi for all i < tn(x) and that M = {(x, eq(z, x))} is the current content of the memory cell. There is a size-one memory-restricted guessing procedure LinAlg that -- even if Carole plays a devil's strategy -- after an expected constant number of successive calls modifies the memory such that the string y now in the memory satisfies yi = zi for all i ≤ tn(x) and tn(y) = tn(x) + 1. Every call of LinAlg requires only one guess. Interestingly, for the definition of LinAlg, we need to distinguish between the cases of k = 2 and k ≥ 3 colors, as certain arguments exploit particular properties of these cases. For k = 2 colors, we have analyzed this strategy already in [DW11]. 4.1.1 The case of k = 2 colors C = {0, 1} In this section we prove that for k = 2 colors C = {0, 1}, LinAlg is a procedure that requires, in expectation, three calls to modify the memory content by replacing the current string x that is 9 assumed to satisfy the conditions of Lemma 4, by a string y with tn(y) = tn(x) + 1 and yi = zi for all i ≤ tn(x). i be the i-th unit vector of length n. For all i ∈ [n] let en Algorithm 5: Routine LinAlg for k = 2 colors 1 Assumption: The string x ∈ {0, 1}n in the memory satisfies tn(x) < n and xi = zi for all 2 Sample y ∈ {x ⊕ en 3 Query eq(z, y); 4 if y = x ⊕ en i } uniformly at random; tn(x), x ⊕Pn i=tn(x)+1 en tn(x) then i < tn(x); 6 else 5 7 if eq(z, y) > eq(z, x) then M ← {(y, eq(z, y))}; if eq(z, x) + eq(z, y) = n + tn(x) then M ← {(y, eq(z, y))}; Proposition 5 (from [DW11]). For k = 2 colors, Algorithm 5 satisfies the conditions of Lemma 4. In expectation, three calls to routine LinAlg suffice. Proof. Let x ∈ {0, 1}n be a bit string with tn(x) < n and xi = zi for all i < tn(x). Algorithm 5 samples with probability 1/2 the string y = x ⊕ en samples y = x ⊕Pn If y = x ⊕ en Therefore, let us assume that Algorithm 5 samples y = x ⊕Pn i . We show that ztn(x) = ytn(x)(= xtn(x)) holds if and only if eq(z, x) + eq(z, y) = n + tn(x). By definition we have yi = xi = zi for all i < tn(x). Thus, the first tn(x) − 1 bits of x and y contribute 2(tn(x) − 1) to the sum eq(z, x) + eq(z, y); formally, tn(x), and with probability 1/2 it i . That is, either it flips only the tn(x)-th bit of x or it flips all "tail tn(x), clearly we have ztn(x) = ytn(x) if and only if eq(z, y) > eq(z, x). bits" but the tail numbered one. i=tn(x)+1 en i=tn(x)+1 en eq([z1 . . . ztn(x)−1], [x1 . . . xtn(x)−1]) + eq([z1 . . . ztn(x)−1], [y1 . . . ytn(x)−1]) = 2(tn(x) − 1) . On the other hand, for all i > tn(x) either have zi = xi or zi = 1 − xi = yi. Thus, the last last n − tn(x) bits of x and y contribute exactly n − tn(x) to the sum eq(z, x) + eq(z, y); formally, eq([ztn(x)+1 . . . zn], [xtn(x)+1 . . . xn]) + eq([ztn(x)+1 . . . zn], [ytn(x)+1 . . . yn]) = n − tn(x) . By definition we also have ytn(x) = xtn(x) and, thus, eq(z, x) + eq(z, y) = eq([z1 . . . ztn(x)−1], [x1 . . . xtn(x)−1]) + eq(ztn(x), xtn(x)) + eq([ztn(x)+1 . . . zn], [xtn(x)+1 . . . xn]) + eq([z1 . . . ztn(x)−1], [y1 . . . ytn(x)−1]) + eq(ztn(x), xtn(x)) + eq([ztn(x)+1 . . . zn], [ytn(x)+1 . . . yn]) = 2(tn(x) − 1) + n − tn(x) + 2 eq(ztn(x), xtn(x)) = n + tn(x) + 2 eq(ztn(x), xtn(x)) − 2 This shows that eq(z, x) + eq(z, y) = n + tn(x) if and only if eq(ztn(x), xtn(x)) = 1, i.e., if and only if ztn(x) = xtn(x)(= ytn(x)). 10 tn(x), and y = x ⊕Pn It is immediate that for a secret code z taken from {0, 1}n uniformly at random, the probability to obtain, in one call of LinAlg, a string y with tn(y) = tn(x) + 1 and yi = zi for all i < tn(y) is 1/2. This shows that, if Carole does not play a devil's strategy and if her string is taken from {0, 1}n uniformly at random, we need, on average, two successive calls to procedure LinAlg until we obtain a string y as desired. Proposition 5 follows from the easy observation that it takes, on average, three iterations until i have been sampled. That is, even if Carole plays a both y = x ⊕ en devil's strategy, three calls of Algorithm 5 force her to accept one entry ztn(x) ∈ {0, 1}. 4.1.2 The case of k ≥ 3 colors C = [0..k − 1] The main argument of Proposition 5, namely that Pk−1 c=0 eq(z, [c . . . c]) = n, seems hard to extend to more than two colors with no additional memory. However, having more than two colors can be exploited in a different way as it gives more than one way to mark the tail [xtn(x) . . . xn] of a search point x. Proposition 6. For k ≥ 3 colors, Algorithm 6 satisfies the claims of Lemma 4. i=tn(x)+1 en Algorithm 6: Routine LinAlg for k ≥ 3 colors 1 Assumption: The string x ∈ Cn in the memory satisfies tn(x) < n and xi = zi for all 2 With probability (k − 1)/k sample y ∈ {[x1 . . . xtn(x)−1jxtn(x)+1 . . . xn] j ∈ C\{xtn(x)}} i < tn(x); uniformly at random and with probability 1/k sample y ∈ {[x1 . . . xtn(x)−1j . . . j] j ∈ C\{xtn(x)−1}} uniformly at random; 3 Query eq(z, y); 4 if y = [x1 . . . xtn(x)−1jxtn(x)+1 . . . xn], j 6= xtn(x) then if eq(z, y) > eq(z, x) then M ← {(y, eq(z, y))} ; //ztn(x) = j 5 6 else 7 M ← {(y, eq(z, y))}; for all i < tn(x). Proof. Let x ∈ Cn with tn(x) < n and xi = zi If y = [x1 . . . xtn(x)−1jxtn(x)+1 . . . xn], then clearly we have eq(z, y) > eq(z, x) if and only if ytn(x) = j = ztn(x). Therefore, all we need to show is that, using the strategy of Algorithm 6, it takes a constant number of guesses until for each j ∈ C there exists an ij ∈ C\{j} such that we have queried both x = [z1 . . . ztn(x)−1ij . . . ij] and y = [z1 . . . ztn(x)−1jij . . . ij] in two subsequent guesses. This follows essentially from the fact that k is constant. search point x -- for any bitstring y = current [z1 . . . ztn(x)−1jij . . . ij] the probability to sample y in the second of two subsequent calls to Algo- rithm 6 is constant. Therefore, the expected number of calls to Algorithm 6 until y is sampled is constant. The claim follows by the linearity of expectation. More precisely -- regardless of the 4.2 Proof of Theorem 1 Building on LinAlg and the block-wise random guessing strategy introduced in Section 3, we can now present Paul's winning strategy for the single memory cell setting, which proves Theorem 1. 11 Proof of Theorem 1. The structure of this proof is as follows. First we sketch the main ideas and give a high-level pseudo-code for the size-one memory-restricted strategy winning the black answer- peg only Mastermind game with k colors in O(n/ log n) guesses. After fixing some notation, we then present more details for the different phases, in particular for the random guessing phase, which is the most critical part of this proof. We present here the details of Paul's strategy for the case of k = 2 colors. The generalization to k ≥ 3 colors is pretty much straightforward. Some remarks on the differences between the case of k = 2 and k ≥ 3 colors are given at the end of this proof. Let us begin with the rough overview over Paul's strategy. He determines the first n−Θ(n/ log n) positions using random guessing, where he manages to store the random substrings and Carole's answers in the yet undetermined part of his one string in the memory. As in the proof of Theorem 2, he does so by iteratively determining blocks of length s := ⌈√n⌉. Then, using the linear time strategy from Lemma 4, he determines the missing Θ(n/ log n) entries in O(n/ log n) guesses. To distinguish between the sampling and the linear time phase, Paul uses the last two entries suffix(x) := [xn−1xn] of his string x. He has suffix(x) = [01], when he is in the random guessing phase, and he uses suffix(x) = [cc] for some c ∈ C to indicate that he applies calls to LinAlg. Once Paul has determined all but the last two entries (visible from tn(x) = n− 1), he simply needs to sample uniformly at random from the set of all k2 − 1 remaining possible strings. This clearly determines z in a constant expected number of additional queries (phase 3). The total expected number of guesses can be bounded by number of blocks de- termined in phase 1 queries needed to de- termine any such block n−2 z { s (1 − Θ(log−1 n)) } log s ) O( s z } { + queries needed in phase 2 O( n z } { log n ) + queries needed in phase 3 z}{O(1) = O( n log n ) . A non-trivial part is the random guessing phase. As in the proof of Theorem 2, after guessing t + k strings, we want to be able to regain the full guessing history. If we simply stored the random substring and Carole's reply in some unused part of x, then this changed memory would influence Carole's next answer and we would be unable to deduce information on the next guess from it. We solve this difficulty as follows. We store Carole's latest reply (i.e., value eq(z, x) currently in the memory) and we sample new (random) substrings for the current block at the same time. Here we store the value eq(z, x) in a part of x, for which we know the entries of Carole's hidden code. By this, we can separate in Carole's next answer the influence of the just stored information from the one of the random guess. The precise description of this Sampling strategy is presented below. To gain the storage space, for which we know the hidden code, we need to add another phase, phase 0, in which we apply O(log n) calls to the LinAlg procedure until we have determined the first ℓ := ℓn + 1 positions of z (cf. Lemma 4). This does not change the overall asymptotic number of queries Paul needs to win the game. The pseudo-code for this size-one memory-restricted strategy is given in Algorithm 7. Similar to the notation in the proof of Theorem 2, we denote for any h ∈ [0..n] its binary encoding of length ℓn by binaryℓn(h) and for h ∈ [0..s] we denote its binary encoding of length ℓs := ⌈log s⌉ + 1 by binaryℓs(h). The current block of interest i(x) is encoded in positions {n − ℓs − 1, . . . , n − 2}, i.e., we have i(x) := Pℓs−1 h=0 2hxn−2−h, Bi(x) := {ℓ + (i(x) − 1)s + 1, . . . , ℓ + i(x)s}, and, consequently, BLOCKi(x)(x) := [xℓ+(i(x)−1)s+1 . . . xℓ+i(x)s]. The total number of blocks, which we determine via random guessing, is b := ⌊ n−2 log n )⌋ for some suitable large constant K. The number of random guesses for each block is t := ⌈(2 + ε) s(1+2 log k) log s−log k ⌉ where ε > 0 is an arbitrarily small s (1 − K 12 constant. Lastly, the actual number of already sampled guesses for block Bi(x) is denoted by q(x). As in the proof of Theorem 2, q(x) can be computed via p1(x) := max{i ∈ [n− ℓs− 3] xi = 1} , the largest position i < n− 2− ℓs with entry xi = 1. Details how q(x) can be computed are given in the description of the OptimizeBlock routine, which, after t random samples have been sampled via the Sampling routine, determines BLOCKi(x)(z), stores it in Bi(x) and increases the block counter i(x) by one. Algorithm 7: A size-one memory-restricted algorithm winning the k-color black answer-peg only Mastermind game in O(n/ log n) guesses. 1 Initialization: Let M ← ∅; 2 if M = ∅ then x ← [c . . . c] for some c ∈ C chosen u.a.r.; Query eq(z, x) and update M ← {(x, eq(z, x))}; 5 if ∃c ∈ C : suffix(x) = [cc] ∧ tn(x) ≤ ℓ then LinAlg ; //find the first ℓ entries [z1 . . . zℓ] 6 7 else if ∃c ∈ C : suffix(x) = [cc] ∧ tn(x) = ℓ + 1 then x1 . . . xℓ 0 x ← [0 . . . 0 {z }ℓ coincides with the hidden code) Query eq(z, x) and update M by replacing (x, eq(z, x)); 0 . . . 0 {z }bs n−(2ℓ+bs+ℓs+2) {z 0 } . . . 10 else if suffix(x) = [01] ∧ i(x) ≤ b ∧ q(x) < t + k then Apply Sampling; 12 else if suffix(x) = [01] ∧ i(x) ≤ b ∧ q(x) = t + k then Apply OptimizeBlock; binaryℓs(1)01]; //copy prefix (which 3 4 8 9 11 13 15 16 18 14 else if suffix(x) = [01] ∧ i(x) = b + 1 then x ← [xℓ+bs+s+1 . . . x2ℓ+bs+s+1xℓ+1 . . . xℓ+bsc . . . c] with c ∈ C\{xℓ+bs} u.a.r.; Query eq(z, x) and update M by replacing (x, eq(z, x)); //prepares x for LinAlg 17 else if ∃c ∈ C : suffix(x) = [cc] ∧ ℓ + bs < tn(x) ≤ n − 2 then LinAlg; 19 else if ∃c ∈ C : suffix(x) = [cc] ∧ tn(x) = n − 1 then Sample y ∈ {[x1 . . . xn−2p] p ∈ C2}\{x} uniformly at random; Query eq(z, y); if eq(z, y) = n then M ← {(y, eq(z, y))} ; //secret code found 20 21 22 23 Go to line 2; Let us now present a more detailed description of Algorithm 7. As in the proof of Theorem 2 let us assume that Carole has chosen a fix code z ∈ Cn, which she does not change during the game, i.e., to any of Paul's guesses x she replies eq(z, x). By adopting a worst-case view below, we implicitly still allow Carole to change z as long as the new choice is consistent with all previous replies. If in any iteration we find an x with eq(z, x) = n, we have x = z and all we need to do is to output x. Thus, in what follows we always assume eq(z, x) < n. 13 Initialization of Algorithm 7, lines 1 -- 4. For initialization, Paul picks a c ∈ C uniformly at random and guesses the all-"c"s string of length n, x = [c . . . c]. He updates the memory M ← {(x, eq(z, x))} accordingly. This memory satisfies all conditions of line 1 of routine LinAlg (Algorithms 5 and 6) with tn(x) = 1. Phase 0 of Algorithm 7, lines 5 -- 6. To this string, Paul applies successive calls to the routine LinAlg. By Lemma 4 he finds a string y ∈ Cn with yi = zi, i ≤ ℓ, and tn(y) = ℓ + 1 in an expected number of O(ℓ) guesses. As mentioned above, Paul runs this first phase until he has determined the first entries. This is the number ℓ = ⌈log n⌉ + 2 = ℓn + 1 ℓn = ⌈log n⌉ + 1 of entries needed to store in binary any integer value h ∈ [0..n] plus 1. These bits shall be used in phase 1 of Algorithm 7 to indicate the status of the Sampling routine (first position) and for storing Carole's latest reply eq(z, x) ∈ [0..n] (positions {2, . . . , ℓ}). We shall describe this in more detail below. Intermediate step, lines 7 -- 9. After Paul has determined the first ℓ entries, he needs to prepare the string for the random guessing phase, which is the main part of Algorithm 7. Since we want to use the first ℓ entries to store reference values, we need to make a copy of the prefix (which, by construction, coincides with Carole's hidden code). To this end, we query in line 7 the string y = [ 0 . . . 0 x1 . . . xℓ ℓ+bs entries {z } n−(2ℓ+bs+ℓs+2) entries 0 . . . {z 01] , 0 } binaryℓs(1) } {z ℓs entries where x is the string that is currently in the memory, i.e., the string we obtained through phase 01 and bs = n − Θ(n/ log n) is the number of positions Paul determines using random guessing. As mentioned in the overview, the last two entries suffix(x) = [xn−1xn] = [01] indicate that we are entering the second phase. Note that throughout the game we have suffix(x) =([01], if we are in the second phase of the algorithm [cc], for some c ∈ C, otherwise. In positions {n − ℓs − 1, . . . , n − 2} we indicate in binary the block, which we are currently trying to determine. That is, whenever x is the current string in the memory with suffix(x) = [01], then the block currently of interest is Bi(x) with i(x) =Pℓs−1 i=0 2ixn−2−i . Here in this intermediate step After guessing y and updating the memory by replacing the current one with {(y, eq(z, y))}, Paul enters the first phase (as indicated by suffix(x)). The overall expected number of queries needed until this point is O(ℓ) = O(log n). we initialize i(x) = 1. First phase of Algorithm 7, lines 10 -- 13. The first phase is the main phase of Algorithm 7. In this phase, Paul determines all but n − Θ(n/ log n) entries by iteratively determining blocks of length s = ⌈√n⌉ via random guessing. In total, he determines b = ⌊ n log n(cid:1)⌋ such blocks in this phase. The description of the routines Sampling (in which k reference strings and t random samples are queried for the i(x)-th block Bi(x)) and OptimizeBlock (in which we use the reference s(cid:0)1 − K 1That is, we have tn(x) = ℓ + 1, ∀i ≤ ℓ : xi = zi, and ∃c ∈ C\{xℓ}∀i ≥ tn(x) : xi = c. 14 strings and the random guesses to determine BLOCKi(x)(z), the i(x)-th block of the secret code z) is quite technical. We present the details after the description of the remaining phases. Second phase of Algorithm 7, lines 14 -- 18. In the second phase of Algorithm 7 we again apply successive calls to routine LinAlg to determine all but the last two remaining entries. To this end, we first need to prepare the string. This is done in lines 14 -- 16 of Algorithm 7. It follows from the correctness of the first phase that the string x queried in line 16 satisfies xi = zi for all 1 ≤ i ≤ ℓ + bs. And, by definition, it also satisfies xtn(x)−1 6= xtn(x) with tn(x) = ℓ + bs + 1. From Lemma 4 we infer that via routine LinAlg we find a string x with tn(x) = n − 1 and xi = zi for all 1 ≤ i ≤ n − 2 in an expected number of O(n − 2 − (ℓ + bs)) = O(n/ log n) queries. These are lines 17 and 18 of Algorithm 7. Third phase of Algorithm 7, lines 19 -- 22. Comparable to the last step of Algorithm 4, all we need to do in the last phase of Algorithm 7 is to determine the last two entries. This is done by sampling y uniformly at random from the set of possible target strings {[x1 . . . xn−2p] p ∈ {0, 1}2}\{x} and we find y = z after a constant expected number of queries. This phase is recognized by the algorithm by the fact that tn(x) = n − 1. Note that we have tn(x) ≤ n − 2 in the LinAlg phases -- phases 0 and 2 -- and that we have tn(x) = n in phase 1. Summing up the expected number of queries needed for each phase, we have shown that Paul needs, on average, O(log n) + O(n/ log n) + O(n/ log n) + O(1) = O(n/ log n) until he has identified Carole's hidden code z. In the remainder of this proof we present the details of the first phase of Algorithm 7, the random sampling routine Sampling and the OptimizeBlock routine. As mentioned above, this description requires some technicalities. Therefore, we split it into the following parts: Part I In the first part, we present the general structure of the guesses Paul queries in the sampling phase. Here, we shall also show that the n positions are indeed sufficient to store, for any of the b blocks of length s all necessary information about the samples. Part II The second part, which is brief, provides further notation used in the pseudo-code of Algorithm 8. Part III The main part is the third one. Here we show how the contributions ∆i(x)(r) ∈ [0..s] of the random samples r ∈ Cs can be computed. This also shows that indeed after sampling the t random guesses for the current block of interest, it is possible to regain the full query history using only the information that has been stored in the memory. This is clearly the most technical part of this proof. Part IV We conclude the description of phase 1 in the fourth part, where we explain how the memory is being updated, once the entries BLOCKi(x)(z) of the secret code z in the i(x)-th block have been determined. 15 Part I The general structure of a random query x for determining block Bi(x) is the following. (1) (5) z1 . . . zℓ {z } (6) x = [ x1 (7) (2) (3) r {z}(4) binaryℓn(eq(z, y)) } {z 0 . . . 0 {z } opt(B1) . . . opt(Bi(x)) } {z}(1) {z binaryℓn(eq(z, x0))binaryℓn(eq(z, x1))1 } binaryℓn(eq(z, ref(1)))r(1)∆i(x)(r(1))1 . . . } binaryℓn(eq(z, ref(t′)))r(t′)∆i(x)(rt′ 0 . . . 0 binaryℓs(i(x)) } {z {z (8) )1 } (9) {z (8) continued {z ] , 01 {z}(10) where we use (1) the first entry x1 ∈ {0, 1} to indicate whether we are sampling a new random substring (x1 = 1) or whether we are doing a storage operation only through which we add to x all necessary information from the previous guess(x1 = 0). An explanation of these operation follows below; (2) ℓn entries for encoding the value eq(z, y) ∈ [0..n] of the string y that is currently stored in the memory cell (serves as reference value), (3) (i(x) − 1)s entries for the already determined blocks B1, . . . , Bi(x)−1, (4) s entries for the current block Bi(x) of interest. If we are sampling new information (i.e., if x1 = 1), then the substring r is a string taken from Cs uniformly at random and r is the all-zeros string of length s otherwise; (5) (b − i(x))s zeros for the yet untouched blocks Bb′ with i(x) < b′ ≤ b, (6) ℓ entries for storing the length-ℓ prefix that coincides with Carole's hidden code (obtained trough phase 0), (7) 2ℓn + 1 entries for storing the values eq(z, x0) and eq(z, x1) of the two reference strings x0 and x1 (explanation follows), (8) t′(ℓn + s + ℓs + 1), t′ ≤ t, entries for storing, for each random sample, (i) the value eq(z, ref) for a reference string ref (in binary, requires ℓn positions), (ii) the random sample r ∈ Cs itself, (iii) its contribution ∆i(x)(r) ∈ [0..s] to Carole's reply (in binary, requires ℓs positions), and (iv) one additional "1" (to ease the computation of the number of guesses q(x) via p1(x); details follow), (9) ℓs entries for encoding in binary, which block we are currently trying to determine, and (10) the last two entries, suffix(x), for indicating the current phase of the algorithm. Clearly, one critical part is the limited storage capacity. For this reason, let us show that we , the set of all strings have enough positions to store all the information needed to compute S consistent consistent with Carole's replies for the random guesses in the i(x)-th block Bi(x). i(x) 16 log s−log k = Θ(s/ log n) random guesses (ε > 0 being an arbitrarily small constant). Recall that, by Theorem 3, for determining the i(x)-th block BLOCKi(x)(z) of z, we need t = (2 + ε) s(1+2 log k) In addition, equivalently to the proof of Theorem 2, we need again 2 reference strings x0 and x1 (reference (7) in equation (1)). These two reference strings will be needed to infer the contributions ∆i(x)(r) of the random samples r ∈ Cs in the i(x)-th block. requirement can be bounded from above by From the structure of the guesses presented in equation (1) above, we infer that the total storage 1 + ℓn+bs + ℓ + 2ℓn + 1 + t(ℓn + s + ℓs + 1) + ℓs + 2 = bs + ts + o(n/ log n) ≤ n(cid:0)1 − log n(cid:1) + Θ(n/ log n) + o(n/ log n) < n K for sufficiently large, but constant K and sufficiently large n. This shows that, for sufficiently large n, Paul indeed can store all information needed to compute S consistent in one single string of length n. i(x) Part II Let us now fix the notation used in the pseudo-code of routine Sampling (Algorithm 8). For all b′ < i(x) we set opt(Bb′) := [xℓ+(b′−1)s+1 . . . xℓ+b′s] , the entries of x in the b′-th block. The notation "opt" is justified by the fact that we shall have opt(Bb′) = BLOCKb′(z) for all b′ < i(x). Furthermore, let AddReferenceStringInfo(x) := [0 . . . 0 (1),(2) {z } {z (3) {z opt(B1) . . . opt(Bi(x)−1) } 0 . . . 0 {z } x2 . . . xℓbinaryℓn(eq(z, x))1 } (4) xℓ+i(x)s+1 . . . x2ℓ+bs x2ℓ+bs+2ℓn+2 . . . xn } where the references in the expression above are the same as the ones used in equation (1) and where (∗) is simply a copy of the last entries of x. That is, the AddReferenceStringInfo(x) operation adds to x the values eq(z, x0) and eq(z, x1) to the memory and each of these values is stored in binary notation of length ℓn. Lastly, we denote by Add(eq(z, x)) the operation {z {z (5),(6) } (7) (∗) ] , (3) (1),(2) Add(eq(z, x)) := [ 0 . . . 0 opt(B1) . . . opt(Bi(x)−1) } {z } {z x2 . . . xℓBLOCKi(x)(x)binaryℓs(∆i(x)(BLOCKi(x)(x)))1 } {z which adds (in substring (†)) to the memory xp1(x)+ℓn+s+ℓs+2 . . . xn } • a copy of the value eq(z, ref) of a reference string ref (which was previously stored in xℓ+i(x)s+1 . . . xp1(x) } (2) 0 . . . 0 {z } (5),(6),(7),(8) {z {z (4) (∗) ] , (†) positions {2, . . . , ℓ}), • the random sample BLOCKi(x)(x) of the last guess, • the contribution ∆i(x)(BLOCKi(x)(x)) of the random sample BLOCKi(x)(x) to eq(z, x), and • the one additional "1" that shall ease the computation of q(x), the number of already queried samples. 17 All other but the first ℓ entries (which are set to zero) are copied from x. The references in equation (2) are the same as in equation (1). Algorithm 8: The Sampling routine for k = 2 colors. 1 Assumption: Memory M = {(x, eq(z, x))} satisfies eq(z, x) < n, suffix(x) = [01], i(x) ≤ b, and q(x) < t + 2; 2 if q(x) = 0 ∧ x1 = 0 then x ← [1binaryℓn(eq(z, x))opt(B1) . . . opt(Bi(x)−1)1 . . . 1xℓ+i(x)s+1 . . . xn]; Query eq(z, x) and update M by replacing (x, eq(z, x)); 3 4 5 else if q(x) = 0 ∧ x1 = 1 then x ← AddReferenceStringInfo(x) ; Query eq(z, x) and update M by replacing (x, eq(z, x)); 8 else if 2 ≤ q(x) < t + 2 ∧ x1 = 0 then x ← [1binaryℓn(eq(z, x))opt(B1) . . . opt(Bi(x)−1)rxℓ+i(x)s+1 . . . xn] for r ∈ Cs chosen u.a.r.; Query eq(z, x) and update M by replacing (x, eq(z, x)); 11 else if 2 ≤ q(x) < t + 2 ∧ x1 = 1 then x ← Add(eq(z, x)); Query eq(z, x) and update M by replacing (x, eq(z, x)); 6 7 9 10 12 13 Part III Let us now show in detail how to infer the contributions ∆i(x)(r) of the random guesses. For clarity, we show how to do this for the first block, i.e., for the positions {ℓ + 1 . . . ℓ + s}. The procedure is similar for all other blocks and we shall comment on this case at the end of this part. First note that after the intermediate step in lines 7 to 9 of Algorithm 7, Paul enters the routine ℓ+bs entries n−(2ℓ+bs+ℓs+2) entries and he queries in the first sampling iteration (lines 2 -- 4 of Algorithm 8) Sampling with M = {(x0, eq(z, x0))}, where z1 . . . zℓ x0 = [0 . . . 0 {z x1 = [1binaryℓn(eq(z, x0)) } 1+ℓn=ℓ entries {z } 1 . . . 1 {z } 0 01] , binaryℓs(1) } {z ℓs entries 0 . . . 0 } {z z1 . . . zℓ . . . 0 0 . . . 0 binaryℓs(1)01] {z with the all-ones substring in the first block. We can compute the contribution of the first ℓ entries [1binaryℓn(eq(z, x0))] to the value eq(z, x1) via n−(2ℓ+bs+ℓs+2) entries (b−1)s entries {z s entries } } f (x1) := eq([z1 . . . zℓ], [1binaryℓn(eq(z, x0))]) = eq([x1 ℓ+bs+1 . . . x1 2ℓ+bs], [x1 1 . . . x1 ℓ ]) , and, by the same reasoning, the contribution of the first ℓ entries in x0 to eq(z, x0) via f (x0) = eq([x0 2ℓ+bs], [0 . . . 0]). Let us, for a moment, assume that we now had M = {(x1, eq(z, x1))} and that we had another string ℓ+bs+1 . . . x0 y = [z1 . . . zℓ s entries r {z} (b−1)s entries 0 . . . 0 {z } z1 . . . zℓ 18 n−(2ℓ+bs+ℓs+2) entries 0 . . . 0 {z } binaryℓs(1)01] for some random substring r ∈ Cs. Then we could compute the contribution of the random entries r in the first block B1 of y via ∆1(r) = eq(z, y) − eq(z, x0) + eq(z, x1) + (ℓ − f (x0)) + (ℓ − f (x1)) − s 2 . Key to this equality is the fact that the first ℓ entries of y contribute ℓ to Carole's response eq(z, y) to guess y, whereas the first ℓ entries of x0 and x1 contribute f (x0) + f (x1) to the sum eq(z, x0) + eq(z, x1) and the fact that the entries in the first block, [0 . . . 0] and [1 . . . 1], respectively, contribute in total s towards eq(z, x0) + eq(z, x1). All other entries xi, yi, i > ℓ + s contribute either 2 or 0 to the sum eq(z, x0) + eq(z, x1) and every entry contributes 2 if and only if it contributes 1 to the value eq(z, y). Note however, that we would now have to choose now which of the strings to keep in the memory and we would eventually loose the information eq(z, x1). Therefore, in lines 6 and 7 in Algorithm 8, we first query the reference string x2 = [ 0 . . . 0 ℓ entries {z } s entries 0 . . . 0 0 . . . 0 {z } {z } n − (2ℓ + bs + 2ℓn + 1 + ℓs + 2) entries (b−1)s 0 . . . 0 {z } binaryℓs(1)01] . z1 . . . zℓ binaryℓn(eq(z, x0))binaryℓn(eq(z, x1))1 } 2ℓn+1 entries {z This query is needed only to store the values eq(z, x0) and eq(z, x1) of both reference strings. Since adding the substring [binaryℓn(eq(z, x0))binaryℓn(eq(z, x1))1] to the memory string again changes the number of positions, in which the guess and Carole's hidden string coincide, we need to store this information in the next query as well. More precisely, we have that x0 and x2 differ in exactly the substring [binaryℓn(eq(z, x0))binaryℓn(eq(z, x1))1], and the contribution of this substring (compared to the all-zeros substring which it replaces) is eq(z, x2) − eq(z, x0). Furthermore, we need to indicate that we are sampling a new random substring. This is the first position in the string and the next ℓ − 1 entries are needed to encode in binary the value eq(z, x2). That is, instead of querying y as above we query (lines 9 and 10 in Algorithm 8) x3 = [1binaryℓn(eq(z, x2))r(1)0 . . . 0z1 . . . zℓbinaryℓn(eq(z, x0))binaryℓn(eq(z, x1))1 0 . . . 0binaryℓs(1)01] , where the substring r(1) ∈ Cs in B1 is taken uniformly at random. The number of zeros in the first all-zeros substring is again (b − 1)s and in the second all-zeros substring it is n − (2ℓ + bs + 2ℓn + 1 + ℓs + 2). Now, in the same fashion as above, we can compute the contribution ∆1(r(1)) = eq([zℓ+1 . . . zℓ+s]) of the substring r(1) ∈ Cs via ∆1(r(1)) = eq(z, x3) −(cid:16) eq(z, x0) + eq(z, x1) + (ℓ − f (x1)) + (ℓ − f (x0)) − s 2 + (eq(z, x2) − eq(z, x0)) − (ℓ − f (x3))(cid:17) . (3) Also note that all the information needed for this computation is contained in the string x3 itself. Since later we want to be able to regain the full guessing history, in the next guess we store both the reference value eq(z, x2) as well as the contribution ∆1(r(1)). And, of course, we also 19 Algorithm 9: The OptimizeBlock routine 1 Assumption: Memory M = {(x, eq(z, x))} satisfies eq(z, x) < n, suffix(x) = [01], 2 if x1 = 0 then i(x) ≤ b, and q(x) = t + 2; 3 4 5 7 8 6 else y ← [1 . . . 1opt(B1) . . . opt(Bi(x)−1)wxℓ+i(x)s+1 . . . xn] for w ∈ S consistent Query eq(z, y); if ∆i(x)(BLOCKi(x)(y)) = s then M ← {(y, eq(z, y))} ; //w = BLOCKi(x)(z) x ← Update(x); Query eq(z, x) and update M by replacing (x, eq(z, x)); //string prepared for determining the next block i(x) chosen u.a.r.; need to store the random guess r(1) = BLOCK1(x3) itself. Therefore, we query (lines 12 and 13 in Algorithm 8) in the next iteration of Algorithm 7 x4 = [ 0 . . . 0 z1 . . . zℓbinaryℓn(eq(z, x0))binaryℓn(eq(z, x1))1 BLOCK1(x3) } {z =r(1) binaryℓs(∆1(r(1))) } see equation (3) {z 10 . . . 0binaryℓs(1)01] . By continuing like this we are able to compute, in any iteration of the first phase, the contri- Note that since ∆1(r(1)) ∈ [0..s], we can encode this value using ℓs positions only. butions ∆i(x)(r) of the random substrings r ∈ Cs. As in the proof of Theorem 2 we need to be able to compute how many random guesses have been queried already for the current block of interest. As indicated above, this can be derived from p1(x) as follows. For any random guess r ∈ Cs we use ℓn + s + ℓs + 1 entries for storing all information that will be needed later to regain the full guessing history. Furthermore, we used 2ℓn + 1 entries for storing the values eq(z, x0) and eq(z, x1) of the two reference strings x0 and x1, and we store information only in positions i > 2ℓ + bs. Hence, the number of guesses for block Bi(x) can be computed as (b−1)s binaryℓn(eq(z, x2)) 0 . . . 0 {z }s {z =[x3 2...x3 ℓ ] 0 . . . 0 {z } } {z }ℓ 0, 1, 2 + p1(x)−(2ℓ+bs+2ℓn+1) ℓn+s+ℓs+1 , if p1(x) ≤ 2ℓ + bs and x1 = 0 if p1(x) ≤ 2ℓ + bs and x1 = 1 otherwise. q(x) =  After querying t random guesses (i.e., after querying a total number of t + k guesses) for the first block, we regain the full guessing history from the string x currently in the memory as follows. The i-th random sample r(i) ∈ Cs, which we guessed for the first block is r(i) := [x2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)+ℓn+1 . . . x2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)+ℓn+s] , and the corresponding query was y(i) := [1x2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)+1 . . . x2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)+ℓn r(i)xℓ+s+1 . . . x2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)0 . . . 0xn−ℓs−1 . . . xn] . 20 We have stored in binary the contribution ∆1(r(i)) of r(1) to the overall function value eq(z, y(i)) in positions {2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)+ℓn+s+1 . . . 2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)+ℓn+s+ℓs} and thus we have ∆1(r(i)) = ℓs−1 Xi=0 By Theorem 3, the expected size of 2ix2ℓ+bs+2ℓn+1+(i−1)(ℓn+s+ℓs+1)+ℓn+s+ℓs−i . S consistent 1 := {w ∈ {0, 1}s ∀i ≤ t : eq(y, r(i)) = ∆1(r(i))} is bounded from above by 1 + 1/s. That is, we can now identify BLOCK1(z) in a constant number of guesses. These are lines 3 -- 5 of routine OptimizeBlock (Algorithm 9). As mentioned above, determining the other blocks 2, . . . , b is similar. In these iterations, the (i(x)−1)s entries in positions {ℓ+1, . . . , ℓ+(i(x)−1)s} are already optimized, that is, they coincide with Carole's hidden string z. Thus, they are not changed in any further iteration of Algorithm 9. Part IV Once BLOCKi(x)(z) = [zℓ+(i(x)−1)s+1 . . . zℓ+i(x)s] has been determined, we need to update the memory such that we can start determining the entries of the next block. These are lines 7 and 8 in Algorithm 9. Here we abbreviate Update(x) := [ 0 . . . 0 (a) 0 . . . 0 {z } {z } (e) where (b) {z opt(B1) . . . opt(Bi(x)) } binaryℓs(i(x) + 1) 01 {z}(g) } {z (f ) 0 . . . 0 {z } (c) ] , xℓ+bs+1 . . . x2ℓ+bs } {z (d) (a) the first ℓ entries are set to zero, (b) we now have i(x) already determined blocks, (c) the new block of interest, block i(x) + 1, as well as all blocks b′ > i(x) + 1 are (still) set to zero, (d) we keep the copy of the prefix [z1 . . . zℓ] in positions {ℓ + bs + 1, . . . , 2ℓ + bs}, (e) all information that we have used in the previous query to determine block Bi(x) is removed (and set to zero), (f) the index for the current block of interest is increased by one, and (g) the last two entries still indicate the second phase. The case of k ≥ 3 colors. For the general case, the main strategy as given by Algorithm 7 remains the same. What needs to be changed is the Sampling routine, where instead of sampling only two reference strings x0 and x1, we need to sample k reference strings x0, x1, . . . , xk−1 with BLOCKi(x)(xc) = [c . . . c] for all c ∈ [0..k − 1]. 21 Algorithm 10: The Sampling routine for k ≥ 3 colors. 1 Assumption: Memory M = {(x, eq(z, x))} satisfies eq(z, x) < n, suffix(x) = [01], i(x) ≤ b, and q(x) < t + k; 2 if q(x) = 0 ∧ x1 = 0 then x ← [1binaryℓn(eq(z, x))opt(B1) . . . opt(Bi(x)−1)1 . . . 1xℓ+i(x)s+1 . . . xn]; Query eq(z, x) and update M by replacing (x, eq(z, x)); 3 4 5 else if q(x) = 0 ∧ x1 = 1 then x ← AddReferenceStringInfo(x) ; Query eq(z, x) and update M by replacing (x, eq(z, x)); 8 else if 2 ≤ q(x) < k ∧ x1 = 0 then x ← [1binaryℓn(eq(z, x))opt(B1) . . . opt(Bi(x)−1)q(x) . . . q(x)xℓ+i(x)s+1 . . . xn]; Query eq(z, x) and update M by replacing (x, eq(z, x)); 6 7 9 10 12 13 15 16 18 19 11 else if 2 ≤ q(x) < k ∧ x1 = 1 then x ← AddReferenceStringInfo2(x) ; Query eq(z, x) and update M by replacing (x, eq(z, x)); 14 else if k ≤ q(x) < t + k ∧ x1 = 0 then x ← [1binaryℓn(eq(z, x))opt(B1) . . . opt(Bi(x)−1)rxℓ+i(x)s+1 . . . xn] for r ∈ Cs chosen u.a.r.; Query eq(z, x) and update M by replacing (x, eq(z, x)); 17 else if k ≤ q(x) < t + k ∧ x1 = 1 then x ← Add(eq(z, x)); Query eq(z, x) and update M by replacing (x, eq(z, x)); Algorithm 10 shows the generalized sampling routine. Here we define AddReferenceStringInfo2(x) := [0 . . . 0 (1),(2) {z } x2 . . . xℓbinaryℓn(eq(z, x))1 } opt(B1) . . . opt(Bi(x)−1) {z } xp1(x)+ℓn+s+ℓs+2 . . . xn } xℓ+i(x)s+1 . . . xp1(x) } {z (5),(6),(7),(7′ ) 0 . . . 0 {z } (4) (†) {z (3) {z (∗) ] , where (1) -- (7) are the same references as in equation (1), (7') are the additional positions needed for storing the values eq(z, xj ) of the already queried reference strings x2, . . . , xq(x)−1 (each requiring 2ℓn + 1 positions), (†) we add the information of the q(x)-th reference string xq(x) to the memory (again requiring 2ℓn + 1 positions), and (∗) is simply a copy of the last entries of the previous guess. 22 The substring [x2 . . . xℓ] is needed again to infer the contribution of the positions, in which we added the information of the previous reference string xq(x)−1. The reasoning is the same as in the case of k = 2 colors. Since we added more reference string information, we need to adjust the definition of q(x) accordingly. Since we need 2ℓn + 1 additional bits for each reference string xj, 2 ≤ j ≤ k, and we use ℓn + s + ℓs + 1 entries for storing the information of each random guess, we have q(x) :=   0, if p1(x) ≤ 2ℓ + bs and x1 = 0 1, if p1(x) ≤ 2ℓ + bs and x1 = 1 j, if p1(x) = 2ℓ + bs + 2ℓn + 1 + (j − 2)(2ℓn + 1) and 2 ≤ j < k k + p1(x)−(2ℓ+bs+(k−1)(2ℓn +1)) , otherwise. ℓn+s+ℓs+1 It is easily verified that all statements made in the above proof for k = 2 colors remain cor- rect if we consider the general case of k ≥ 3 colors. Only the computation of the contribu- tions ∆i(x)(BLOCKi(x)(x)), equation (3), becomes a bit more tedious. However, all calculations are straightforward. We omit the details. References [AW09] Gautham Anil and R. Paul Wiegand, Black-box search by elimination of fitness functions, Proc. of Foundations of Genetic Algorithms (FOGA'09), ACM, 2009, pp. 67 -- 78. [CCH96] Zhixiang Chen, Carlos Cunha, and Steven Homer, Finding a hidden code by asking ques- tions, Proc. of the Second Annual International Conference on Computing and Combi- natorics (COCOON'96), Springer, 1996, pp. 50 -- 55. [Chv83] Vasek Chv´atal, Mastermind, Combinatorica 3 (1983), 325 -- 329. [DJW06] Stefan Droste, Thomas Jansen, and Ingo Wegener, Upper and lower bounds for random- ized search heuristics in black-box optimization, Theory of Computing Systems 39 (2006), 525 -- 544. [DW11] Benjamin Doerr and Carola Winzen, Memory-restricted black-box complexity, ECCC TR11-092 (2011). [ER63] Paul Erdos and Alfr´ed R´enyi, On two problems of information theory, Magyar Tud. Akad. Mat. Kutat´o Int. Kozl. 8 (1963), 229 -- 243. [Goo09] Michael T. Goodrich, On the algorithmic complexity of the mastermind game with black- peg results, Information Processing Letters 109 (2009), 675 -- 678. [Knu77] Donald E. Knuth, The computer as a master mind, Journal of Recreational Mathematics 9 (1977), 1 -- 5. [SZ06] Jeff Stuckman and Guo-Qiang Zhang, Mastermind is NP-complete, INFOCOMP Journal of Computer Science 5 (2006), 25 -- 28. 23
1802.06328
1
1802
2018-02-18T03:41:43
Minimum length RNA folding trajectories
[ "cs.DS", "q-bio.BM" ]
The Kinfold and KFOLD programs for RNA folding kinetics implement the Gillespie algorithm to generate stochastic folding trajectories from an initial structure s to a target structure t, in which each intermediate secondary structure is obtained from its predecessor by the addition, removal or shift of a single base pair. Define MS2 distance between secondary structures s and t to be the minimum path length to refold s to t, where a move from MS2 is applied in each step. We describe algorithms to compute the shortest MS2 folding trajectory between any two given RNA secondary structures. These algorithms include an optimal integer programming (IP) algorithm, an accurate and efficient near-optimal algorithm, a greedy algorithm, a branch-and-bound algorithm, and an optimal algorithm if one allows intermediate structures to contain pseudoknots. Our optimal IP [resp. near-optimal IP] algorithm maximizes [resp. approximately maximizes] the number of shifts and minimizes [resp. approximately minimizes] the number of base pair additions and removals by applying integer programming to (essentially) solve the minimum feedback vertex set (FVS) problem for the RNA conflict digraph, then applies topological sort to tether subtrajectories into the final optimal folding trajectory. We prove NP-hardness of the problem to determine the minimum barrier energy over all possible MS2 folding pathways, and conjecture that computing the MS2 distance between arbitrary secondary structures is NP-hard. Since our optimal IP algorithm relies on the FVS, known to be NP-complete for arbitrary digraphs, we compare the family of RNA conflict digraphs with the following classes of digraphs (planar, reducible flow graph, Eulerian, and tournament) for which FVS is known to be either polynomial time computable or NP-hard. Source code available at http://bioinformatics.bc.edu/clotelab/MS2distance/.
cs.DS
cs
Minimum length RNA folding trajectories A.H. Bayegan P. Clote∗ Biology Department, Boston College, Chestnut Hill, MA Abstract Background: Existent programs for RNA folding kinetics, such as Kinefold, Kinfold and KFOLD, implement the Gillespie algorithm to generate stochastic folding trajectories from an initial structure s to a target structure t, in which each intermediate secondary structure is obtained from its predecessor by the application of a move from a given move set. The Kinfold move set M S1 [resp. M S2] allows the addition or removal [resp. addition, removal or shift] of a single base pair. Define the M S1 [resp. M S2] distance between secondary structures s and t to be the minimum path length to refold s to t, where a move from M S1 [resp. M S2] is applied in each step. The M S1 distance between s and t is trivially equal to the cardinality of the symmetric difference of s and t, i.e the number of base pairs belonging to one structure but not the other; in contrast, the computation of M S2 distance is highly non-trivial. Results: We describe algorithms to compute the shortest M S2 folding trajectory between any two given RNA secondary structures. These algorithms include an optimal integer programming (IP) algorithm, an accurate and efficient near-optimal algorithm, a greedy algorithm, a branch-and-bound algorithm, and an optimal algorithm if one allows intermediate structures to contain pseudoknots. A 10-fold slower version of our IP algorithm appeared in WABI 2017; the current version exploits special treatment of closed 2-cycles. Our optimal IP [resp. near-optimal IP] algorithm maximizes [resp. approximately maximizes] the number of shifts and minimizes [resp. approximately minimizes] the number of base pair additions and removals by applying integer programming to (essentially) solve the minimum feedback vertex set (FVS) problem for the RNA conflict digraph, then applies topological sort to tether subtrajectories into the final optimal folding trajectory. We prove NP-hardness of the problem to determine the minimum barrier energy over all possible M S2 folding pathways, and conjecture that computing the M S2 distance between arbitrary secondary structures is NP-hard. Since our optimal IP algorithm relies on the FVS, known to be NP-complete for arbitrary digraphs, we compare the family of RNA conflict digraphs with the following classes of digraphs -- planar, reducible flow graph, Eulerian, and tournament -- for which FVS is known to be either polynomial time computable or NP-hard. Conclusion: This paper describes a number of optimal and near-optimal algorithms to compute the shortest M S2 folding trajectory between any two secondary structures. Source code for our algorithms is available at http://bioinformatics.bc.edu/clotelab/MS2distance/. 1 Background RNA secondary structure is known to form a scaffold for tertiary structure formation [5]. Moreover, sec- ondary structure can be efficiently predicted with reasonable accuracy by using either machine learning with stochastic context-free grammars [23, 35, 39], provided that the training set is sufficiently large and represen- tative, or by using ab initio physics-based models with thermodynamics-based algorithms [27, 25]. Since the latter approach does not depend on any form of homology modeling, it has been successfully used for syn- thetic RNA molecular design [47, 9, 16], to predict microRNA binding sites [32], to discover noncoding RNA genes [44], in simulations to study molecular evolution [3, 42, 36, 15] and in folding kinetics [13, 45, 37, 11]. Software to simulate RNA secondary structure folding kinetics, such as Kinfold and KFOLD, implement the Gillespie algorithm to simulate the moves from one structure to another, for a particular move set. At the ∗ Correspondence [email protected]. Research supported in part by National Science Foundation grant DBI-1262439. 1 elementary-step resolution, two move sets have extensively been studied -- the move set M S1 which allows the addition or removal of a single base pair, and the move set M S2, which allows the addition, removal or shift of a single base pair, where a shift move modifies only one of the two positions in a base pair, as shown in Figure 1. In simulation studies related to RNA secondary structure evolution, the structural distance between two secondary structures s, t is often measured by the base pair distance, denoted dBP (s, t), defined to be the cardinality of the symmetric difference, s (cid:52) t = s − t + t − s, i.e. the number of base pairs belonging to s but not t, plus the number of base pairs belonging to t but not s. In studies concerning RNA folding kinetics, the fast, near-optimal algorithm RNAtabupath [10] and the much slower, but exact (optimal) Barriers algorithm [25] can be used to determine M S1 folding trajectories that minimize the barrier energy, defined as the maximum of the (Turner) free energy difference between an intermediate structure and the initial structure. Thermodynamics-based software such as Kinfold, RNAtabupath, and KFOLD use the nearest neighbor free energy model [41] whose energy parameters are inferred from optical melting experiments. In contrast, the two theorems below concern the Nussinov energy model [29], which assigns −1 per base pair and ignores entropy. Folding trajectories s = s0, s1, . . . , sm = t from s to t may either be direct, whereby each intermediate structure si is required to contain only base pairs from s ∪ t, or indirect, without this restriction. Note that indirect pathways may be energetically more favorable, though longer, than direct pathways, and that the problem of constructing an energetically optimal direct folding pathway is NP-hard. Indeed, the following theorem is proven in [40]. Theorem 1 (Manuch et al. [40]). With respect to the Nussinov energy model, it is NP-hard to determine, for given secondary structures s, t and integer k, whether there exists a direct M S1 folding trajectory from s to t with energy barrier at most k. By an easy construction, we can show an analogous result for M S2 folding pathways. First, we define a direct M S2 folding pathway from secondary structure s to secondary structure t to be a folding pathway s = s0, s1, . . . , sn = t where each intermediate structure si is obtained from si−1 by removing a base pair that belongs to s, adding a base pair that belongs to t, or shifting a base pair belonging to s into a base pair belonging to t. Theorem 2. With respect to the Nussinov energy model, it is NP-hard to determine, for given secondary structures s, t and integer k, whether there exists a direct M S2 folding trajectory from s to t with energy barrier at most k. Proof. Given secondary structures s, t for an RNA sequence a = a1, . . . , an, without loss of generality we can assume that s, t share no common base pair (otherwise, a minimum energy folding trajectory for s − (s ∩ t) and t − (s ∩ t) yields a minimum energy folding trajectory for s, t.) Define the corresponding secondary structures s(cid:48) = {(2i, 2j) : (i, j) ∈ s} t(cid:48) = {(2i − 1, 2j − 1) : (i, j) ∈ t} 2i = ai = a(cid:48) a(cid:48) a(cid:48) = a(cid:48) 1, a(cid:48) 2i−1 2, . . . , a(cid:48) for each 1 ≤ i ≤ n 2n In other words, the sequence a(cid:48) = a1, a1, a2, a2, . . . , an, an is obtained by duplicating each nucleotide of a, and placing each copy beside the original nucleotide; s(cid:48) [resp. t(cid:48)] is obtained by replacing each base pair (i, j) ∈ s by the base pair (2i, 2j) ∈ s(cid:48) [resp. (2i − 1, 2j − 1) ∈ t(cid:48). Since there are no base-paired positions that are shared between s(cid:48) and t(cid:48), no shift moves are possible, thus any direct M S2 folding pathway from s(cid:48) to t(cid:48) immediately yields a corresponding direct M S1 folding pathway from s to t. Since the Nussinov energy of any secondary structure equals −1 times the number of base pairs, it follows that barrier energy of the direct M S2 pathway from s(cid:48) to t(cid:48) is identical to that of the corresponding direct M S1 pathway from s to t. Since M S1 direct barrier energy is an NP-hard problem by Theorem 1, it now follows that the M S2 barrier energy problem is NP-hard. Shift moves, depicted in Figure 1, naturally model both helix zippering and defect diffusion, depicted in Figure 2 and described in [31]. However, shift moves have rarely been considered in the literature, except in 2 the context of folding kinetics [13]. For instance, presumably due to the absence of any method to compute M S2 distance, Hamming distance is used as a proxy for M S2 distance in the work on molecular evolution of secondary structures appearing in [36] -- see also [43], where Hamming distance is used to quantify structural diversity in defining phenotypic plasticity. In this paper, we introduce the first algorithms to compute the M S2 distance between two secondary structures. Although M S1 distance, also known as base pair distance, is trivial to compute, we conjecture that M S2 distance is NP-hard, where this problem can be formalized as the problem to determine, for any given secondary structures s, t and integer m, whether there is an M S2 trajectory s = s0, s1, . . . , sm = t of length ≤ m. We describe an optimal (exact, but possibly exponential time) integer programming (IP) algorithm, a fast, near-optimal algorithm, an exact branch-and-bound algorithm, and a greedy algorithm. Since our algorithms involve the feedback vertex set problem for RNA conflict digraphs, we now provide a bit of background on this problem. Throughout, we are exclusively interested in directed graphs, or digraphs, so unless otherwise indicated, all graphs are assumed to be directed. Any undefined graph-theoretic concepts can be found in the monograph by Bang-Jensen and Gutin [1]. Given a directed graph G = (V, E), a feedback vertex set (FVS) is a subset V (cid:48) ⊆ V which contains at least one vertex from every directed cycle in G, thus rendering G acyclic. Similarly, a feedback arc set (FAS) is a subset E(cid:48) ⊆ E which contains at least one directed edge (arc) from every directed cycle in G. The FVS [resp. FAS] problem is the problem to determine a minimum size feedback vertex set [resp. feedback arc set] which renders G acyclic. The FVS [resp. FAS] problem can be formulated as a decision problem as follows. Given an integer k and a digraph G = (V, E), determine whether there exists a subset V (cid:48) ⊆ V of size ≤ k [resp. E(cid:48) ⊆ E of size ≤ k], such that every directed cycle contains a vertex in V (cid:48) [resp. an edge in E(cid:48)]. In Proposition 10.3.1 of [1], it is proved that FAS and FVS have the same computational complexity, within a polynomial factor. In Theorem 10.3.2 of [1], it is proved that the FAS problem is NP-complete -- indeed, this problem appears in the original list of 21 problems shown by R.M. Karp to be NP-complete [22]. Note that Proposition 10.3.1 and Theorem 10.3.2 imply immediately that the FVS problem is NP- complete. In Theorem 10.3.3 of [1], it is proved that the FAS problem is NP-complete for tournaments, where a tournament is a digraph G = (V, E), such that there is a directed edge from x to y, or from y to x, for every pair of distinct vertices x, y ∈ V . In [30], it is proved that the FAS for Eulerian digraphs is NP-complete, where an Eulerian digraph is characterized by the property that the in-degree of every vertex equals its out-degree. In Theorem 10.3.15 of [1], it is proved that FAS can be solved in polynomial time for planar digraphs, a result originally due to [26]. In [33], a polynomial time algorithm is given for the FAS for reducible flow graphs, a type of digraph that models programs without any GO TO statements (see [19] for a characterization of reducible flow graphs). There is a long history of work on the feedback vertex set and feedback arc set problems, both for directed and undirected graphs, including results on computational complexity as well as exact and approximation algorithms for several classes of graphs -- see the survey [12] for an overview of such results. The plan of the paper is now as follows. In Section 2, we present the graph-theoretic framework for our overall approach and describe a simple, fast algorithm to compute the pseudoknotted M S2 distance, or pk-M S2 distance, between structures s, t. By this we mean the minimum length of an M S2 folding trajectory between s and t, if intermediate pseudoknotted structures are allowed. We show that the pk-M S2 distance between s and t, denoted by dpk−M S2(s, t), is approximately equal to one-half the Hamming distance dH (s, t) between s and t. This result can be seen as justification, ex post facto, for the use of Hamming distance in the investigation of RNA molecular evolution [36]. In Section 3, we describe an exact integer programming (IP) algorithm which enumerates all directed cycles, then solves the feedback vertex problem for the collection of RNA conflict digraphs, as described in Section 3.1. Our IP algorithm is not a simple reduction to the feedback vertex set (FVS) problem; however, since the complexity of FVS/FAS is known for certain classes of digraphs, we take initial steps towards the characterization of RNA conflict digraphs. Our optimal IP algorithm is much faster than a branch-and-bound algorithm, but it can be too slow to be practical to determine M S2 distance between the minimum free energy (MFE) secondary structure and a (Zuker) suboptimal secondary structure for some sequences from the Rfam database [28]. For this reason, in Section 4 we present a fast, near-optimal algorithm, and in Section 5, we present benchmarking results to compare various algorithms of the paper. Since we believe that further study of RNA conflict digraphs may lead to a solution of the question 3 whether M S2 distance is NP-hard, in Appendix A, all types of directed edge that are possible in an RNA conflict digraph are depicted. Appendix B presents details on minimum length pseudoknotted M S2 folding pathways, used to provide a lower bound in the branch-and-bound algorithm of Appendix C. Appendix D presents pseudocode for a greedy algorithm. All algorithms described in this paper have been implemented in Python, and are publicly available at bioinformatics.bc.edu/clotelab/MS2distance. Our software uses the function simple cycles(G) from the software NetworkX https://networkx.github.io/documentation/networkx-1.9/reference/ generated/networkx.algorithms.cycles.simple_cycles.html, and the integer programming (IP) solver Gurobi Optimizer version 6.0 http://www.gurobi.com,2014. 2 M S2 distance between possibly pseudoknotted structures In this section, we describe a straightforward algorithm to determine the M S2-distance dpk−M S2 (s, t) between any two structures s, t of a given RNA sequence a1, . . . , an, where dpk−M S2(s, t) is defined to be length of a minimal length trajectory s = s0, s1, . . . , sm = t, where intermediate structures si may contain pseudoknots, but do not contain any base triples. This variant is called pk-M S2 distance. Clearly, the pk-M S2 distance is less than or equal to the M S2 distance. The purpose of this section is primarily to introduce some of the main concepts used in the remainder of the paper. Although the notion of secondary structure is well-known, we give three distinct but equivalent definitions, that will allow us to overload secondary structure notation to simplify presentation of our algorithms. Definition 3 (Secondary structure as set of ordered base pairs). Let [1, n] denote the set {1, 2, . . . , n}. A secondary structure for a given RNA sequence a1, . . . , an of length n is defined to be a set s of ordered pairs (i, j), with 1 ≤ i < j ≤ n, such that the following conditions are satisfied. 1. Watson-Crick and wobble pairs: If (i, j) ∈ s, then aiaj ∈ {GC, CG, AU, U A, GU, U G}. 2. No base triples: If (i, j) and (i, k) belong to s, then j = k; if (i, j) and (k, j) belong to s, then i = k. 3. Nonexistence of pseudoknots: If (i, j) and (k, (cid:96)) belong to s, then it is not the case that i < k < j < (cid:96). 4. Threshold requirement for hairpins: If (i, j) belongs to s, then j − i > θ, for a fixed value θ ≥ 0; i.e. there must be at least θ unpaired bases in a hairpin loop. Following standard convention, we set θ = 3 for steric constraints. Without risk of confusion, it will be convenient to overload the concept of secondary structure s with two alternative, equivalent notations, for which context will determine the intended meaning. Definition 4 (Secondary structure as set of unordered base pairs). A secondary structure s for the RNA sequence a1, . . . , an is a set of unordered pairs {i, j}, with 1 ≤ i, j ≤ n, such that the corresponding set of ordered pairs {i, j}< def = (min(i, j), max(i, j)) (1) satisfies Definition 3. Definition 5 (Secondary structure as an integer-valued function). A secondary structure s for a1, . . . , an is a function s : [1, . . . , n] → [0, . . . , n], such that satisfies Definition 3; i.e. (cid:110){i, s[i]}< : 1 ≤ i ≤ n, s[i] (cid:54)= 0 (cid:111) (cid:26) 0 j s[i] = if i is unpaired in s if (i, j) ∈ s or (j, i) ∈ s (2) Definition 6 (Secondary structure distance measures). Let s, t be secondary structures of length n. Base pair distance is defined by equation (3) below, and Hamming distance is defined by equation (4) below. dBP (s, t) = {(x, y) : ((x, y) ∈ s ∧ (x, y) (cid:54)∈ t) ∨ ((x, y) ∈ t ∧ (x, y) (cid:54)∈ s)} dH (s, t) = {i ∈ [1, n] : s[i] (cid:54)= t[i]} (3) (4) 4 Throughout this section, the term pseudoknotted structure is taken to mean a set of ordered pairs [resp. unordered pairs resp. function], which satisfies conditions 1,2,4 (but not necessarily 3) of Definition 3. Given structure s on RNA sequence {a1, . . . , an}, we say that a position x ∈ [1, n] is touched by s if x belongs to a base pair of s, or equivalently s[x] (cid:54)= 0. For possibly pseudoknotted structures s, t on {a1, . . . , an}, we partition the set [1, n] into disjoint sets A,B,C,D as follows. Let A be the set of positions that are touched by both s and t, yet do not belong to the same base pair in s and t, so A = {i ∈ [1, n] : s[i] (cid:54)= 0, t(i) (cid:54)= 0, s[i] (cid:54)= t[i]} Let B be the set of positions that are touched by either s or t, but not by both, so B = {i ∈ [1, n] : (s[i] (cid:54)= 0, t[i] = 0) ∨ (s[i] = 0, t[i] (cid:54)= 0)} Let C be the set of positions touched by neither s nor t, so C = {i ∈ [1, n] : s[i] = 0 = t[i]} (5) (6) (7) Let D be the set of positions that belong to the same base pair in both s and t, so D = {i ∈ [1, n] : s[i] (cid:54)= 0, t[i] (cid:54)= 0, s[i] = t[i]} (8) We further partition A ∪ B into a set of maximal paths and cycles, in the following manner. Define an undirected, vertex-colored and edge-colored graph G = (V, E), whose vertex set V is equal to the set A ∪ B of positions that are touched by either s or t, but not by a common base pair in (s ∩ t), and whose edge set E = (s − t) ∪ (t − s) = (s ∪ t) − (s ∩ t) consists of undirected edges between positions that are base-paired together. Color edge {x, y} green if the base pair (x, y) ∈ s− t and red if (x, y) ∈ t− s. Color vertex x yellow if x is incident to both a red and green edge, green if x is incident to a green edge, but not to any red edge, red if x is incident to a red edge, but not to any green edge. The connected components of G can be classified into 4 types of (maximal) paths and one type of cycle (also called path of type 5): type 1 paths have two green end nodes, type 2 paths have a green end node x and a red end node y, where x < y, type 3 paths have a red end node x and a green end node y, where x < y, type 4 paths have two red end nodes, and type 5 paths (cycles) have no end nodes. These are illustrated in Figure 3. Note that all nodes of a cycle and interior nodes of paths of type 1-4 are yellow, while end nodes (incident to only one edge) are either green or red. If X is a connected component of G, then define the restriction of s [resp. t] to X, denoted by s (cid:22) X [resp. t (cid:22) X], to be the set of base pairs (i, j) in s [resp. t] such that i, j ∈ X. With this description, most readers will be able to determine a minimum length pseudoknotted folding pathway from s (cid:22) X to t (cid:22) X, where X is a connected component of G. For instance, if X is a path of type 2 or 3, then a sequence of shift moves transforms s (cid:22) X into t (cid:22) X, beginning with a shift involving the terminal green node. Further details can be found in Appendix B. The formal definitions given below are necessary to provide a careful proof of the relation between Hamming distance and pseudoknotted M S2 distance, also found in Appendix B. Definition 7. Let s, t be (possibly pseudoknotted) structures on the RNA sequence a1, . . . , an. For i, j ∈ [1, n], define i ∼ j if s[i] = j or t[i] = j, and let ≡ be the reflexive, transitive closure of ∼. Thus i ≡ j if i = j, or i = i1 ∼ i2 ∼ ··· ∼ im = j for any m ≥ 1. For i ∈ [1, n], let [i] denote the equivalence class of i, i.e. [i] = {j ∈ [1, n] : i ≡ j}. It follows that i ≡ j if and only if i is connected to j by an alternating red/green path or cycle. The equivalence classes X with respect to ≡ are maximal length paths and cycles, as depicted in Figure 3. Moreover, it is easy to see that elements of A either belong to cycles or are found at interior nodes of paths, while elements of B are found exclusively at the left or right terminal nodes of paths. Note that odd-length cycles cannot exist, due to the fact that a structure cannot contain base triples -- see condition 2 of Definition 3. Moreover, even-length cycles can indeed exist -- consider, for instance, the structure s, whose only base pairs are (1, 15) and (5, 10), and the structure t, whose only base pairs are (1, 5) and (10, 15). Then we have the red/green cycle 1 → 5 → 10 → 15 → 1, consisting of red edge 1 → 5, since (1, 5) ∈ t, green edge 5 → 10, since (5, 10) ∈ s, red edge 10 → 15, since (10, 15) ∈ t, and green edge 15 → 1, since (1, 15) ∈ s. 5 From the discussion before Definition 7, it follows that A in equation (5) consists of the nodes of every cycle together with all interior (yellow) nodes of paths of type 1-4. Moreover, we can think of B in equation (6) as consisting of all path end nodes, i.e. those that have only one incident edge. Let B1 ⊆ B [resp. B2 ⊆ B] denote the set of elements of B that belong to type 1 paths [resp. type 4 paths] of length 1, i.e. positions incident to isolated green [resp. red] edges that correspond to base pairs (i, j) ∈ s where i, j are not touched by t [resp. (i, j) ∈ t where i, j are not touched by s]. Let B0 = B − B1 − B2 be the set of end nodes of a path of length 2 or more. Letting BP1 [resp. BP2] denote the set of base pairs (i, j) that belong to s and are not touched by t [resp. belong to t and are not touched by s], we can formalize the previous definitions as follows. B1 = {i ∈ [1, n] : ∃j [{i, j} ∈ s, t(i) = 0 = t(j)] B2 = {i ∈ [1, n] : ∃j [{i, j} ∈ t, s(i) = 0 = s(j)] B0 = B − (B1 ∪ B2) BP1 = {(i, j) ∈ s : t[i] = 0 = t[j]} BP2 = {(i, j) ∈ t : s[i] = 0 = s[j]} (9) (10) (11) (12) (13) In Appendix B, it is proved that pk-M S2 distance between s (cid:22) X and t (cid:22) X for any maximal path X is (cid:99); in contrast, pk-M S2 distance between s (cid:22) X and t (cid:22) X for any equal to Hamming distance (cid:98) dH (s(cid:22)X,t(cid:22)X) cycle X is equal to (cid:98) dH (s(cid:22)X,t(cid:22)X) 2 (cid:99) + 1. It follows that 2 dpk−M S2(s, t) = (cid:98) dH (s, t) 2 (cid:99) (14) if and only if there are no type 5 paths (i.e. cycles). This result justifies ex post facto the use of Hamming distance in the investigation of RNA molecular evolution [36, 43]. We also have the following. Lemma 8. Let s, t be two arbitrary (possibly pseudoknotted) structures for the RNA sequence a1, . . . , an, and let X1, . . . , Xm be the equivalence classes with respect to equivalence relation ≡ on A ∪ B. Then the pk-M S2 distance between s and t is equal to m(cid:88) (cid:16)s (cid:22) Xi,t (cid:22) Xi(cid:17) dpk−M S2(s, t) = max i=1 This lemma is useful, since the pk-M S2 distance provides a lower bound for the M S2 distance between any two secondary structures, and hence allows a straightforward, but slow (exponential time) branch-and- bound algorithm to be implemented for the exact M S2 distance -- pseudocode for the branch-and-bound algorithm is given in Section C of the Appendix. To compute pk-M S2 distance, we remove those base pairs in s − t that are not touched by t, compute the equivalence classes (connected components) X on the set of positions belonging to the remaining base pairs (provided that the position does not belong to a common base pair of both s and t), then determine for each X a minimum length pk-M S2 folding pathway from s (cid:22) X to t (cid:22) X. The formal pseudocode follows. Algorithm 9 (pk-M S2 distance). M S2-path length between two possibly pseudoknotted structures s, t. remove from s all base pairs of BP1 while Q (cid:54)= ∅ { 1. 2. numM oves = BP1 3. Q = A ∪ B0 4. 5. 6. 7. 8. add to s all base pairs in BP2 9. 10. numM oves = numM oves + BP2 x0 = min(Q); X = [x0] //X is equivalence class of x0 determine path type of X compute minimum length folding pathway from s (cid:22) X to t (cid:22) X numM oves = numM oves + max(s (cid:22) X,t (cid:22) X) 6 11. return numM oves Straightforward details of how to implement line 7 are given in the Appendix. The principle underlying the reason that Algorithm 9 produces a minimum length (pseudoknotted) M S2 folding trajectory from s to t is that we maximize the number of shift moves, since a single shift move from {x, y} ∈ s to {y, z} ∈ t corresponds to the simultaneous removal of {x, y} and addition of {y, z}. We apply this principle in the next section to determine the minimum length (non-pseudoknotted) M S2 folding trajectory from s to t. 3 M S2 distance between secondary structures In this section, we present an integer programming (IP) algorithm to compute the M S2 distance between any two secondary structures s, t, i.e. the minimum length of an M S2 trajectory from s to t. Our algorithm has been cross-checked with the exhaustive branch-and-bound algorithm mentioned at the end of the last section. As in the previous section, our goal is to maximize the number of shift operations in the M S2 trajectory, formalized in the following simple theorem, whose proof is clear. Theorem 10. Suppose that the M S2 distance between secondary structures s, t is k, i.e. base pair distance dBP (s, t) = s − t + t − s = k. Suppose that (cid:96) is the number of shift moves occurring in a minimum length M S2 refolding trajectory s = s0, s1, . . . , sm = t from s to t. Then the M S2 distance between s and t equals dM S2(s, t) = (cid:96) + (k − 2(cid:96)) = k − (cid:96) (15) Our strategy will now be to use a graph-theoretic approach to maximize the number of shift moves. 3.1 RNA conflict digraph Throughout this section, we take s, t to be two arbitrary, distinct, but fixed secondary structures of the RNA sequence a1, . . . , an. Recall the definitions of A, B, C, D in equations (5 -- 8), so that A is the set of positions x ∈ [1, n] that are base-paired in both s and t, but the base pairs in s and t are not identical; B is the set of positions x ∈ [1, n] that are base-paired in one of s or t, but not both; C is the set of positions x ∈ [1, n] that are base-paired in neither s nor t, and D is the set of positions x ∈ [1, n] that are base-paired to the same partner in both s and t. To determine a minimum length M S2 folding trajectory from secondary structure s to secondary structure t is to maximize the number of shift moves and minimize the number of base pair additions and removals. To that end, note that the base pairs in s that do not touch any base pair of t must be removed in any M S2 path from s to t, since there is no shift of such base pairs to a base pair of t -- such base pairs are exactly those in BP1, defined in equation (12). Similarly, note that the base pairs in t that do not touch any base pair of s must occur must be added, in the transformation of s to t, since there is no shift of any base pair from s to obtain such base pairs of t -- such base pairs are exactly those in BP2, defined in equation (13). We now focus on the remaining base pairs of s, all of which touch a base pair of t, and hence could theoretically allow a shift move in transforming s to t, provided that there is no base triple or pseudoknot introduced by performing such a shift move. Examples of all six possible types of shift move are illustrated in Figure 4. To handle such cases, we define the notion of RNA conflict digraph, solve the feedback vertex set (FVS) problem [22] by integer programming (IP), apply topological sorting [7] to the acyclic digraph obtained by removing a minimum set of vertices occurring in feedback loops, then apply shift moves in topologically sorted order. We now formalize this argument. Define the digraph G = (V, E), whose vertices (or nodes) n ∈ V are defined in the following Definition 11 and whose directed edges are defined in Definition 12. Definition 11 (Vertex in an RNA conflict digraph). If s, t are distinct secondary structures for the RNA sequence a1, . . . , an, then a vertex in the RNA conflict digraph G = G(s, t) is a triplet node, or more simply, node v = (x, y, z) consisting of integers x, y, z, such that the base pair {x, y}< = (min(x, y), max(x, y)) belongs to t, and the base pair {y, z}< = (min(y, z), max(y, z)) belongs to s. Let v.t [resp. v.s] denote the base pair {x, y}< [resp. {y, z}<] belonging to t [resp. s]. The 7 middle integer y of node v = (x, y, z) is called the pivot position, since it is common to both s and t. Nodes are ordered by the integer ordering of their pivot positions: (x, y, z) (cid:22) (x(cid:48), y(cid:48), z(cid:48)) if and only if y ≤ y(cid:48) (or y = y(cid:48) and x < x(cid:48), or y = y(cid:48), x = x(cid:48), and z < z(cid:48)). If v = (x, y, z) is a node, then f latten(v) is defined to be the set {x, y, z} of its coordinates. Nodes are representations of a potential shift move, and can be categorized into six types, as shown in Figure 4. Definition 12 (Directed edge in an RNA conflict digraph). Base pairs {a, b}< and {c, d}< are said to touch if {a, b} ∩ {c, d} = 1; in other words, base pairs touch if they form a base triple. Base pairs {a, b}< and {c, d}< are said to cross if either min(a, b) < min(c, d) < max(a, b) < max(c, d) or min(c, d) < min(a, b) < max(c, d) < max(a, b); in other words, base pairs cross if they form a pseudoknot. There is a directed edge from node n1 = (x1, y1, z1) to node n2 = (x2, y2, z2), denoted by (n1, n2) ∈ E or equivalently by n1 → n2, if (1) f latten(n1)∩ f latten(n2) ≤ 1, or in other words if n1 and n2 overlap in at most one position, and (2) the base pair {y1, z1}< ∈ s from n1 either touches or crosses the base pair {x2, y2}< ∈ t from n2. Note that if the base pair {y1, z1}< ∈ s from n1 touches the base pair {x2, y2}< ∈ t from n2, then it must be that z1 = x2; indeed, since each pivot node y1 [resp. y2] belongs to a base pair of both s and t, it cannot be that z1 = y2 (because then {y1, z1}< ∈ s and {y2, z2}< ∈ s would form a base triple in s at z1 = y2), nor can it be that y1 = x2 (because then {x1, y1}< ∈ t and {x2, y2}< ∈ t would form a base triple in t at y1 = x2). Note as well that if n1 = (x1, y1, z1) and n2 = (x2, y2, z2) are triplet nodes, then f latten(n1) ∩ f latten(n2) = 1 implies that either n1 → n2 or n2 → n1. Indeed, if there is a common element shared by n1 and n2, then it cannot be a pivot element, since s and t cannot have a base triple. For the same reason, the common element cannot belong to the base pairs {x1, y1} ∈ t of n1 and {x2, y2} ∈ t of n2 (otherwise t would contain a base triple), nor can the common element belong to the base pairs {y1, z1} ∈ s of n1 and {y2, z2} ∈ s of n2 (otherwise s would contain a base triple). It follows that either {x1, y1}∩{y2, z2} (cid:54)= ∅, or {x2, y2}∩{y1, z1} (cid:54)= ∅. From the assumption that f latten(n1)∩ f latten(n2) = 1, this implies that either n2 → n1 or that n1 → n2, but not both. Finally, note that if n1 = (x1, y1, z1), n2 = (x2, y2, z2) and f latten(n1) ∩ f latten(n2) = 2, then there are exactly three possibilities, all of which can be realized: 1. n1.t = n2.t, so that {x1, y1} = {x2, y2}, as in the example (1, 5) ∈ s, (10, 15) ∈ s, (5, 10) ∈ t, n1 = (10, 5, 1), n2 = (5, 10, 15); 2. n1.s = n2.s, so that {y1, z1} = {y2, z2}, as in the example (1, 5) ∈ t, (10, 15) ∈ t, (5, 10) ∈ s, n1 = (1, 5, 10), n2 = (15, 10, 5); 3. {x1, z1} = {x2, z2}, as shown in Figure 5. This latter example will be called a closed 2-cycle. These considerations produce the equivalent but sharper following definition. Definition 13 (Conflict digraph G = (V, E)). Let s, t be distinct secondary structures for the RNA sequence a1, . . . , an. The RNA confict digraph G(s, t) = (V (s, t), E(s, t)), or G = (V, E) when s, t are clear from context, is defined by E = (n1, n2) : n1 = (x1, y1, z1) ∈ V ∧ n2 = (x2, y2, z2) ∈ V ∧ V = {(x, y, z) : x, y, z ∈ [1, n] ∧ {x, y} ∈ t ∧ {y, z} ∈ s} (cid:110) f latten(n1) ∩ f latten(n2) ≤ 1 ∧(cid:16) (cid:16) z1 = x2∨ [min(y1, z1) < min(x2, y2) < max(y1, z1) < max(x2, y2)]∨ [min(x2, y2) < min(y1, z1) < max(x2, y2) < max(y1, z1)] 8 (cid:17)(cid:111) (16) (17) The set of directed edges of conflict digraph G = (V, E), as defined in Definition 13, establishes a partial ordering on vertices of V with the property that n1 → n2 holds for vertices n1 = (x, y, z), n2 = (u, v, w) if and only if (1) n1 and n2 overlap in at most one position, and (2) when shift move n2 is applied, shifting {v, w} ∈ s to {u, v} ∈ t, the base pair {u, v} either touches or crosses the base pair {y, z} ∈ s in n1. It follows that if n1 → n2, then the shift move in which {y, z} ∈ s shifts to {x, y} ∈ t must be performed before the shift move where {v, w} ∈ s shifts to {u, v} ∈ t -- indeed, if shifts are performed in the opposite order, then after shifting {v, w} ∈ s to {u, v} ∈ t and before shifting {y, z} ∈ s to {x, y} ∈ t, we would create either a base triple or a pseudoknot. Strictly speaking, the overlap condition (1) is not a necessary requirement, and in our first IP algorithm to compute M S2 distance [2], we considered a somewhat more general edge relation without condition (1). If distinct vertices n1, n2 violate condition (1), then f latten(n1) ∩ f latten(n2) = 2, and the constraint (‡) in line 7 of Algorithm 14 would ensure that at most one of n1, n2 are selected by the IP solver for the set V , in the resulting acyclic digraph G = (V , E). Nevertheless, the run time of our algorithm depends heavily on the number of simple directed cycles in the initial conflict digraph G = (V, E). Without condition (1), nodes n1, n2 in a closed 2-cycle (see Figure 5) satisfy n1 → n2 and n2 → n1. Since it is possible that n1 belong to other cycles that do not contain n2, this can (and does) lead to a greatly increased number of directed cycles, hence much longer run time -- indeed, our algorithm in [2] runs 10 times slower than the current algorithm. Before proceeding with the description of the algorithm, we must explain how to treat closed 2-cycles, as shown in Figure 5, for which there exist four integers a1 < a2 < a3 < a4, such that either Case A or Case B holds. Case A: Base pairs (a1, a2) and (a3, a4) belong to t, while base pairs (a1, a4) and (a2, a3) belong to s, as shown in Figure 5a. In this case, the conflict digraph G = (V, E) contains the following 4 vertices v1 = (a1, a2, a3) of type 1, v2 = (a3, a4, a1) of type 5, v3 = (a2, a1, a4) of type 4, and v4 = (a4, a3, a2) of type 2. The overlap of any two distinct vertices has size 2, so by Definition 13, there can be no directed edge between any vertices. There are four optimal trajectories of size 3; for specificity we select the following optimal trajectory: remove (a1, a4) from s (18) Case B: Base pairs (a1, a2) and (a3, a4) belong to s, while base pairs (a1, a4) and (a2, a3) belong to t, as shown in Figure 5b. In this case, the conflict digraph G = (V, E) contains the following 4 vertices v1 = (a1, a4, a3) of type 6, v2 = (a4, a1, a2) of type 3, v3 = (a2, a3, a4) of type 1, and v4 = (a3, a2, a1) of type 2. The overlap of any two distinct vertices has size 2, so by Definition 13, there can be no directed edge between any vertices. There are four optimal trajectories of size 3; for specificity we select the following optimal trajectory: remove (a1, a2) from s (19) In Algorithm 14 below, it is necessary to list all closed 2-cycles, as depicted in Figure 5. This can be done in linear time O(n), for RNA sequence a = a1, . . . , an and secondary structures s, t by computing equivalence classes as defined in Definition 7, then inspecting all size 4 equivalence classes X = {a1, a2, a3, a4} to determine whether Case A or Case B applies. For each such closed 2-cycle, Algorithm 14 computes the partial trajectory (18) or (19) appropriately, then the vertices v1, v2, v3, v4 are deleted. No edges need to be deleted, since there are no edges between vi and vj for 1 ≤ i, j ≤ 4. In creating the partial trajectories, the variable numMoves must be updated. By special treatment of closed 2-cycles, we obtain a 10-fold speed-up in the exact IP Algorithm 14 over that of the precursor Algorithm 10 in our WABI 2017 proceedings paper [2] -- compare run times of Figure 14 with those from Figure 5 of [2]. Except for the special case of closed 2-cycles that must be handled before general treatment, note that Definition 13 establishes a partial ordering on vertices of the conflict digraph G = (V, E), in that edges determine the order in which shift moves should be performed. Indeed, if n1 = {x, y, z}, n2 = {u, v, z} and (n1, n2) ∈ E, which we denote from now on by n1 → n2, then the shift move in which {y, z} ∈ s shifts to {x, y} ∈ t must be performed before the shift move where {v, w} ∈ s shifts to {u, v} ∈ t -- indeed, if shifts are performed in the opposite order, then after shifting {v, w} ∈ s to {u, v} ∈ t and before shifting {y, z} ∈ s to {x, y} ∈ t, we would create either a base triple or a pseudoknot. 9 Our strategy to efficiently compute the M S2 distance between secondary structures s and t will be to (1) enumerate all simple cycles in the conflict digraph G = (V, E) and to (2) apply an integer programming (IP) solver to solve the minimum feedback arc set problem V (cid:48) ⊂ V . Noticing that the induced digraph G = (V , E), where V = V − V (cid:48) and E = E ∩ (V × V ), is acyclic, we then (3) topologically sort G, and (4) perform shift moves from V in topologically sorted order. Algorithm 14 (M S2 distance from s to t). Input: Secondary structures s, t for RNA sequence a1, . . . , an Output: Folding trajectory s = s0, s1, . . . , sm = t, where s0, . . . , sm are secondary structures, m is the minimum possible value for which si is obtained from si−1 by a single base pair addition, removal or shift for each i = 1, . . . , m. First, initialize the variable numMoves to 0, and the list moveSequence to the empty list [ ]. Recall that BP2 = {(x, y) : (x, y) ∈ t, (s − t)[x] = 0, (s − t)[y] = 0}. Bear in mind that s is constantly being updated, so actions performed on s depend on its current value. //remove base pairs from s that are untouched by t 1. BP1 = {(x, y) : (x, y) ∈ s, (t − s)[x] = 0, (t − s)[y] = 0} 2. 3. remove (x, y) from s; numMoves = numMoves+1 for (x, y) ∈ BP1 //define conflict digraph G = (V, E) on updated s and unchanged t define V by equation (16) define E by equation (17) define conflict digraph G = (V, E) 4. 5. 6. 7. maximize (cid:80) (†) (cid:80) v∈C //IP solution of minimum feedback arc set problem v∈V xv where xv ∈ {0, 1}, subject to constraints (†) and (‡) //constraint to remove vertex from each simple cycle of G xv < C for each simple directed cycle C of G //constraint to ensure shift moves cannot be applied if they share same base pair from s or t (‡) xv + xv(cid:48) ≤ 1, for all pairs of vertices v = (x, y, z) and v(cid:48) = (x(cid:48), y(cid:48), z(cid:48)) with {x, y, z}∩{x(cid:48), y(cid:48), z(cid:48)} = 2 //define IP solution acyclic digraph G = (V , E) 8. V = {v ∈ V : xv = 1}; V (cid:48) = {v ∈ V : xv = 0} 9. E = {(v, v(cid:48)) : v, v(cid:48) ∈ V ∧ (v, v(cid:48)) ∈ E} 10. G = (V , E) //handle special, closed 2-cycles for each closed 2-cycle [x] = {a1, a2, a3, a4} as depicted in Figure 5 if [x] is of type A as depicted in Figure 5a remove base pair from s by equation (18) if [x] is of type B as depicted in Figure 5b remove base pair from s by equation (19) 11. 12. 13. 14. 15. 16. V .s = {(x, y) : ∃v ∈ V (v.s = (x, y))} 17. 18. 19. for (x, y) ∈ s − t if (x, y) (cid:54)∈ V .s remove (x, y) from s; numMoves = numMoves+1 //remove base pairs from s that are not involved in a shift move //topological sort for IP solution G = (V , E) topological sort of G using DFS [7] to obtain total ordering ≺ on V for v = (x, y, z) ∈ V in topologically sorted order ≺ shift {y, z} to {x, y} in s; numMoves = numMoves+1 20. 21. 22. //add remaining base pairs from t − s, e.g. from BP2 and type 4,5 paths in Figure 3 for (x, y) ∈ t − s 23. 24. 25. add (x, y) to s; numMoves = numMoves+1 return folding trajectory, numMoves We now illustrate the definitions and the execution of the algorithm for a tiny example where s = {(1, 5), (10, 15), (20, 25)} and t = {(5, 10), (15, 20)}. From Definition 7, there is only one equivalence class X = {1, 5, 10, 15, 20, 25} and it is a path of type 1, as illustrated in Figure 3, where b1 = 1, a1 = 5, b2 = 10, 10 a2 = 15, b3 = 20, a3 = 25. From Definition 11, there are 4 vertices in the conflict digraph G = (V, E), where v1 = (10, 5, 1), v2 = (5, 10, 15), v3 = (20, 15, 10), v4 = (15, 20, 25) -- recall the convention from that definition that vertex v = (x, y, z) means that base pair {y, z} ∈ s and base pair {x, y} ∈ t, so that the pivot position y is shared by base pairs from both s and t. From Definition 12, there are only two directed edges, v1 → v3 since v1.s touches v2.t, and v2 → v4 since v2.s touches v4.t. Note there is no edge from v1 to v2, or from v2 to v3, or from v3 to v4, since their overlap has size 2 -- for instance f latten(v1) = {1, 5, 10}, f latten(v2) = {5, 10, 15}, and f latten(v1)∩f latten(v2) = {5, 10} of size 2. There is no cycle, so the constraint (†) in line 7 of Algorithm 14 is not applied; however the constraint (‡) does apply, so that xv1 + xv2 ≤ 1, xv2 + xv3 ≤ 1, xv3 + xv4 ≤ 1. It follows that there are three possible IP solutions for the vertex set V . Case 1: V = {v1, v3} Then v1.s = (1, 5), v3.s = (10, 15) so V .s = {(1, 5), (10, 15)} and by lines 11-14 we remove base pair (20, 25) from s. Now G = (V , E), where E = {v1 → v3}, so topological sort is trivial and we complete the trajectory by applying shift v1 and then shift v3. Trajectory length is 5. Case 2: V = {v1, v4} Then v1.s = (1, 5), v4.s = (20, 25) so V .s = {(1, 5), (20, 25)} and by lines 11-14 we remove base pair (10, 15) from s. Now G = (V , E), where E = ∅, so topological sort is trivial and we complete the trajectory by applying shift v1 and then shift v4, or by applying shift v4 and then shift v1. Trajectory length is 5. Case 3: V = {v2, v4} Then v2.s = (10, 15), v4.s = (20, 25) so V .s = {(10, 15), (20, 25)} and by lines 11-14 we remove base pair (1, 5) from s. Now G = (V , E), where E = {v2 → v4}, so topological sort is trivial and we complete the trajectory by applying shift v2 and then shift v4. Trajectory length is 5. 3.2 Examples to illustrate Algorithm 14 We illustrate concepts defined so far with three examples: a toy 20 nt RNA sequence, a 25 nt bistable switch, and the 56 nt spliced leader RNA from L. collosoma. 3.2.1 Toy 20 nt sequence For the toy 20 nt sequence GGGAAAUUUC CCCAAAGGGG with initial structure s shown in Figure 6a, and target structure t shown in Figure 6b, the corresponding conflict digraph is shown in Figure 6c. This is a toy example, since the empty structure is energetically more favorable than either structure: free energy of s is +0.70 kcal/mol, while that for t is +3.30 kcal/mol. The conflict digraph contains 6 vertices, 10 directed edges, and 3 simple cycles: a first cycle {(8, 20, 10), (9, 19, 11), (18, 10, 20), (19, 9, 1)} of size 4, a second cycle {[(8, 20, 10), (19, 9, 1)} of size 2, and a third cycle {(18, 10, 20), (9, 19, 11)} of size 2. 3.2.2 Bistable switch Figure 7 depicts the secondary structure for the metastable and the MFE structures, as well as the corre- sponding conflict digraphs for the 25 nt bistable switch, with sequence UGUACCGGAA GGUGCGAAUC UUCCG, taken from Figure 1(b).1 of [20], in which the authors report structural probing by comparative imino proton NMR spectroscopy. The minimum free energy (MFE) structure has -10.20 kcal/mol, while the next metastable structure has -7.40 kcal/mol. Two lower energy structures exist, having -9.00 kcal/mol resp. -7.60 kcal/mol; however, each is a minor variant of the MFE structure. Figures 7a and 7b depict respectively the metastable and the MFE secondary structures for this 25 nt RNA, while Figures 7c and 7d depict respectively the MFE conflict digraph and the metastable conflict digraph. For this 25 nt bistable switch, let s denote the metastable structure and t denote the MFE structure. We 11 determine the following. , then we have the following. s = [(1, 16), (2, 15), (3, 14), (4, 13), (5, 12), (6, 11)] with 6 base pairs t = [(6, 25), (7, 24), (8, 23), (9, 22), (10, 21), (11, 20), (12, 19), (13, 18)] with 8 base pairs A = {6, 11, 12, 13} B = {1, 2, 3, 4, 5, 7, 8, 9, 10, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25} C = {17} D = ∅ BP1 = {(1, 16), (2, 15), (3, 14)} with 3 base pairs BP2 = {(7, 24), (8, 23), (9, 22), (10, 21)} with 4 base pairs B0 = {4, 5, 18, 19, 20, 25} B1 = {1, 2, 3, 14, 15, 16} B2 = {7, 8, 9, 10, 21, 22, 23, 24} and there are three equivalence classes: X1 = {4, 13, 18} of type 2, X2 = {5, 12, 19} of type 2, and X3 = {6, 11, 20, 25} of type 4. Figure 7c depicts the MFE conflict digraph, where s denotes the metastable structure and t denotes In the MFE conflict digraph G = (V, E), vertices are triplet nodes (x, y, z), where the MFE structure. (unordered) base pair {y, z} ∈ s belongs to the metastable [resp. MFE] structure, and (unordered) base pair {x, y} ∈ t belongs to the MFE [resp. metastable] structure. A direct edge (x, y, z) → (u, v, w) oc- curs if {y, z} ∈ s touches or crosses {u, v} ∈ t. Both the MFE and the metastable conflict digraphs are acyclic. Although there are no cycles, the IP solver is nevertheless invoked in line 7 with constraint (‡), resulting in either a first solution V = {(18, 13, 4), (19, 12, 5), (20, 11, 6)} or a second solution V = {(18, 13, 4), (19, 12, 5), (25, 6, 11)}. Indeed, the overlap of vertices (20, 11, 6) and (25, 6, 11) has size 2, so one of these vertices must be excluded from V in 8 of Algorithm 14. Assume that the first solution is returned by the IP solver. Then we obtain the following minimum length M S2 folding trajectory from metastable s to MFE t. Vertex and edge set of G = (V, E) are given by the following. V = {(18, 13, 4), (19, 12, 5), (20, 11, 6), (25, 6, 11)} E = {(18, 13, 4) → (19, 12, 5), (18, 13, 4) → (20, 11, 6), (18, 13, 4) → (25, 6, 11), (19, 12, 5) → (20, 11, 6), (19, 12, 5) → (25, 6, 11)} One of two minimum length M S2 folding trajectories is given by the following. 1. 2. UGUACCGGAAGGUGCGAAUCUUCCG 1234567890123456789012345 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. ((((((....))))))......... .(((((....))))).......... ..((((....))))........... ...(((....)))............ ....((....))(....)....... .....(....)((....))...... ..........(((....)))..... ......(...(((....)))...). ......((..(((....)))..)). ......(((.(((....))).))). ......(((((((....))))))). .....((((((((....)))))))) metastable s remove (1,16) remove (2,15) remove (3,14) shift (4,13) to (13,18) shift (5,12) to (12,19) shift (6,11) to (11,20) add (7,24) add (8,23) add (9,22) add (10,21) add (6,25) Algorithm 14 executes the following steps: (1) Remove base pairs in BP1 from s. (2) Compute conflict digraph G = (V, E). (3) Apply IP solver to determine maximum size V ⊆ V , subject to removing a vertex 12 from each cycle (†) and not allowing any two vertices in V to have overlap of size 2. (4) Topologically sorting the induced digraph G = (V , E). (5) Execute shifts according to total ordering ≺ given by topological sort. (6) Add remaining base pairs from t− s. Note that in trajectory steps 7-10, the base pair added comes from BP2, while that in step 11 is a base pair from t that is "leftover", due to the fact that triplet node (shift move) (25, 6, 11) does not belong to IP solution V . 3.2.3 Spliced leader from L. collosoma For the 56 nt L. collosoma spliced leader RNA, whose switching properties were investigated in [18] by stopped-flow rapid-mixing and temperature-jump measurements, the MFE and metastable structures are shown in Figure 8, along with the conflict digraph for M S2 folding from the metastable structure to the MFE structure. This RNA has sequence AACUAAAACA AUUUUUGAAG AACAGUUUCU GUACUUCAUU GGUAUGUAGA GACUUC, an MFE structure having -9.40 kcal/mol, and an alternate metastable structure having -9.20 kcal/mol. Figure 8 displays the MFE and metastable structures for L. collosoma spliced leader RNA, along with the conflict digraph for M S2 folding from the metastable to the MFE structure. For L. collosoma spliced leader RNA, if we let s denote the metastable structure and t denote the MFE structure, then there are seven equivalence classes: X1 = {10, 45, 31, 23} of type 4; X2 = {11, 43, 33} of type 3; X3 = {12, 42, 34, 20} of type 4, X4 = {13, 41, 35, 19} of type 4, X5 = {22, 32, 44} of type 3, X6 = {24, 54, 30, 48} of type 1, and X7 = {25, 53, 29, 49} of type 1. As in the case with the 25 nt bistable switch, the equivalence classes for the situation where s and t are interchanged are identical, although type 1 paths become type 4 paths (and vice versa), and type 2 paths become type 3 paths (and vice versa). Output from our (optimal) IP algorithm is as follows. AACUAAAACAAUUUUUGAAGAACAGUUUCUGUACUUCAUUGGUAUGUAGAGACUUC 12345678901234567890123456789012345678901234567890123456 Number of Nodes: Number of edges: Number of cycles: s: t: 12 71 5 .......................((((((((((((.....)))))..))))))).. .......((((((..(((((.((((...)))).)))))..))).)))......... .......................((((((((((((.....)))))..))))))).. .......................((.(((((((((.....)))))..)))).)).. .......................((..((((((((.....)))))..)))..)).. .......................((...(((((((.....)))))..))...)).. .......................((....((((((.....)))))..)....)).. .......................((.....(((((.....))))).......)).. .......................((...).(((((.....)))))........).. .......................((...))(((((.....)))))........... .........(.............((...)).((((.....)))))........... .........(...........(.((...)).)(((.....))).)........... .........((..........(.((...)).).((.....))).)........... .........(((.........(.((...)).)..(.....))).)........... .........(((......(..(.((...)).)..)......)).)........... .......(.(((......(..(.((...)).)..)......)).).)......... .......(((((......(..(.((...)).)..)......)).)))......... .......(((((...(..(..(.((...)).)..)..)...)).)))......... .......(((((...((.(..(.((...)).)..).))...)).)))......... .......(((((...((((..(.((...)).)..))))...)).)))......... .......(((((...(((((.(.((...)).).)))))...)).)))......... 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19 20. -9.20 kcal/mol -9.40 kcal/mol metastable s remove (26,52) remove (27,51) remove (28,50) remove (29,49) remove (30,48) (25,53) -> (25,29) (24,54) -> (24,30) (31,45) -> (10,45) (32,44) -> (22,32) (33,43) -> (11,43) (34,42) -> (12,42) (35,41) -> (19,35) add (8,47) add (9,46) add (16,38) add (17,37) add (18,36) add (20,34) .......(((((...(((((.((((...)))).)))))...)).)))......... add (23,31) .......((((((..(((((.((((...)))).)))))..))).)))......... add (13,41) Number of base pair removals: Number of base pair additions: Number of base pair shifts: 7 5 8 13 MS2 Distance: 20 Figure 8a depicts the initial structure s, and Figure 8b depicts the target minimum free energy structure t for spliced leader RNA from L. collosoma. The conflict digraph for the refolding from s to t is shown in Figure 8c. Figure 9a displays the rainbow diagram for spliced leader RNA from L. collosoma, in which the base pairs for the initial structure s (Figure 8a) are shown below the line in red, while those for the target structure t (Figure 8b) are shown above the line in blue. Figure 9c displays the Arrhenius tree, where leaf index 2 represents the initial metastable structure s with free energy -9.20 kcal/mol as shown in Figure 8a, while leaf index 1 represents the target MFE structure t with free energy -9.40 kcal/mol as shown in Figure 8b. In Figure 9b, the dotted blue line depicts the free energies of structures in the shortest M S2 folding trajectory for spliced leader, as computed by Algorithm 14, while the solid red line depicts the free energies of the energy-optimal folding trajectory as computed by the programs RNAsubopt [46] and barriers [14]. 3.2.4 xpt riboswitch from B. subtilis In this section, we describe the shortest M S2 folding trajectory from the initial gene ON structure s to the target gene OFF structure t for the 156 nt xanthine phosphoribosyltransferase (xpt) riboswitch from B. subtilis, where the sequence and secondary structures are taken from Figure 1A of [38]. The gene ON [resp. OFF] structures for the 156 nt xpt RNA sequence AGGAACACUC AUAUAAUCGC GUGGAUAUGG CACGCAAGUU UCUACCGGGC ACCGUAAAUG UCCGACUAUG GGUGAGCAAU GGAACCGCAC GUGUACGGUU UUUUGUGAUA UCAGCAUUGC UUGCUCUUUA UUUGAGCGGG CAAUGCUUUU UUUAUU are displayed in Figure 10a [resp. 10b], while Figure 10c shows the rainbow diagram, where lower red arcs [resp. upper blue arcs] indicate the base pairs of the initial gene ON [resp. target gene OFF] structure. The default structure for the xpt riboswitch in B. subtilis is the gene ON structure; however, the binding of a guanine nucleoside ligand to cytidine in position 66 triggers a conformational change to the gene OFF structure. Figure 10d depicts the conflict digraph G = (V, E) containing 18 vertices, 113 directed edges, and 1806 directed cycles, which is used to compute the shortest M S2 folding trajectory from the gene ON to the gene OFF structure. Figures 11a and 11b show an enlargement of the initial gene ON structure s and target gene OFF structure t, which allows us to follow the moves in a shortest M S2 trajectory that is displayed in Figure 11c. 4 An algorithm for near-optimal M S2 distance Since the exact IP Algorithm 14 could not compute the shortest M S2 folding trajectories between the mini- mum free energy (MFE) structure and Zuker suboptimal structures for some Rfam sequences of even modest size (≈ 100 nt), we designed a near-optimal IP algorithm (presented in this section), and a greedy algorithm (presented in Section D of the Appendix). The exact branch-and-bound algorithm from Appendix C was used to debug and cross-check all algorithms. The run time complexity of both the exact IP Algorithm 14 and the greedy algorithm is due to the possibly exponentially large set of directed simple cycles in the RNA conflict digraph. By designing a 2-step process, in which the feedback arc set (FAS) problem is first solved for a coarse-grained digraph defined below, and subsequently the feedback vertex set (FVS) problem is solved for each equivalence class, we obtain a much faster algorithm to compute a near-optimal M S2 folding trajectory between secondary structures s and t for the RNA sequence {a1, . . . , an}. In the first step, we use IP to solve the feedback arc set (FAS) problem for a particular coarse-grained digraph defined below, whose vertices are the equivalence classes as defined in Definition 7. The number of cycles for this coarse-grained digraph is quite manageable, even for large RNAs, hence the FAS can be efficiently solved. After removal of an arc from each directed cycle, topological sorting is applied to determine a total ordering according to which each individual equivalence class is processed. In the second step, Algorithm 14 is applied to each equivalence class in topologically sorted order, whereby the feedback vertex set (FVS) problem is solved for the equivalence class under consideration. In the remainder of this section, we fill in the details for this overview, and then present pseudocode for the near-optimal Algorithm 15. 14 Given secondary structures s and t for the RNA sequence {a1, . . . , an}, we partition the set [1, n] into disjoint sets A, B, C, D as in Section 2 by following equations (5), (6), (7), (8). The union A∪B is subsequently partitioned into the equivalence classes X1, . . . , Xm, defined in Definition 7. Define the coarse-grain, conflict digraph G = (V, E), whose vertices are the indices of equivalence classes X1, . . . , Xm, and whose directed edges i → j are defined if there exists a base pair (x, y) ∈ s, x, y ∈ Xi which crosses a base pair (u, v) ∈ t, u, v ∈ Xj. Although there may be many such base pairs (x, y) ∈ s and (u, v) ∈ t, there is only one edge between i and j; i.e. G is a directed graph, not a directed multi-graph. If i → j is an edge, then we define Ni,j to be the set of all base pairs (u, v) ∈ s, u, v ∈ Xi that cross some base pair (u, v) ∈ t, u, v ∈ Xj, and let ni,j the number of base pairs in Ni,j. Formally, given equivalence classes X1, . . . , Xm, the coarse-grain, conflict digraph G = (V, E) is defined by V = {1, . . . , m} (cid:110) i → j : ∃(x, y) ∈ s∃(u, v) ∈ t(cid:2)x, y ∈ Xi ∧ u, v ∈ Xj (cid:3)(cid:111) E = (21) A directed edge from i to j may be denoted either by i → j ∈ E or by (i, j) ∈ E. For each edge i → j, we formally define Ni,j and ni,j by the following. (20) (22) (23) ni,j = Ni,j = (x, y) ∈ s : x, y ∈ Xi ∧ ∃(u, v) ∈ t(cid:2)u, v ∈ Xj ∧ (x, y) crosses (u, v)(cid:3)(cid:111) (cid:110) (cid:12)(cid:12)(cid:12)Ni,j (cid:12)(cid:12)(cid:12) maximize (cid:80) ((cid:93)) (cid:80) (i,j)∈E ni,j · xi,j subject to constraint ((cid:93)): xi,j < C 1. (i,j)∈E i,j∈C We now solve the feedback arc set (FAS) problem, rather than the feedback vertex set (FVS) problem, for digraph G, by applying an IP solver to solve the following optimization problem: for every directed cycle C = (i1, i2, i3, . . . , ik−1, ik) This IP problem can be quickly solved, since there is usually only a modest number of directed cycles for the coarse-grained digraph. For each directed edge or arc i → j that is to be removed from a directed cycle, we remove all base pair (x, y) ∈ from structure s that cross some base pair (u, v) ∈ t for which u, v ∈ Xj. Removal of certain base pairs from s can disconnect some previous equivalence classes into two or more connected components, hence equivalence classes X(cid:48) m(cid:48) must be recomputed for the updated structure s and (unchanged) structure t. The conflict, digraph G(cid:48) = (V (cid:48), E(cid:48)) is then defined by equations (20) and (21) for (updated) s and (unchanged) t. Since G(cid:48) is now acyclic, it can be topologically sorted, which determines an ordering σ(1), . . . , σ(m(cid:48)) for processing equivalence classes X(cid:48) m(cid:48). To process an equivalence class X(cid:48), we restrict the exact Algorithm 14 to each equivalence class. Indeed, to process equivalence class X(cid:48), we define a (local) conflict digraph G(X(cid:48)) = (V (X(cid:48)), E(X(cid:48))) defined as follows. 1, . . . , X(cid:48) 1, . . . , X(cid:48) V (X(cid:48)) = {(x, y, z) : x, y, z ∈ X(cid:48) ∧ {x, y} ∈ t ∧ {y, z} ∈ s E(X(cid:48)) = {(x, y, z) → (u, v, w) : (x, y, z) ∈ V (X(cid:48)) ∧ (u, v, w) ∈ V (X(cid:48))∧ {x, y} touches or crosses {v, w} } (24) (25) Algorithm 15 (Near-optimal M S2 distance from s to t). Input: Secondary structures s, t for RNA sequence a1, . . . , an Output: s = s0, s1, . . . , sm = t, where s0, . . . , sm are secondary structures, m is a near-optimal value for which si is obtained from si−1 by a single base pair addition, removal or shift for each i = 1, . . . , m. First, initialize the variable numMoves to 0, and the list moveSequence to the empty list [ ]. Define BP1 = {(x, y) : (x, y) ∈ t, (t − s)[x] = 0, (t − s)[y] = 0}; i.e. BP1 consists of those base pairs in s which are 15 not touched by any base pair in t. Define BP2 = {(x, y) : (x, y) ∈ t, (s − t)[x] = 0, (s − t)[y] = 0}; i.e. BP2 consists of those base pairs in t which are not touched by any base pair in s. //define conflict digraph G = (V, E) on collection of equivalence classes //remove base pairs from s that are untouched by t for (x, y) ∈ BP1 s = s − {(x, y)} numMoves = numMoves + 1 1. 2. 3. //define equivalence classes on updated s, t 4. [1, n] = A ∪ B ∪ C ∪ D 5. 6. 7. 8. 9. determine equivalence classes X1, . . . , Xm with union A ∪ B define V = {1, . . . , m} define E = {(i, j) : 1 ≤ i, j ≤ m} by equation (21) define coarse-grain, conflict digraph G = (V, E) (i,j)∈E ni,j · xi,j subject to constraint ((cid:93)): maximize (cid:80) ((cid:93)) (cid:80) (cid:101)E = {(i, j) : xi,j = 0} //(cid:101)E is set of edges that must be removed //process the IP solution (cid:101)E for (i, j) ∈ (cid:101)E for every directed cycle C = (i1, i2, . . . , ik−1, ik) xi,j < C (i,j)∈E i→j∈C 10. //remove arc from each simple cycle whereni,j defined in equation (23) //IP solution of feedback arc set problem (not feedback vertex set problem) 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. for (x, y) ∈ Ni,j //Ni,j defined in Definition 22 s = s − {(x, y)} //remove base pair from s belonging to feedback arc numMoves = numMoves + 1 //determine equivalence classes X(cid:48) 11. 12. 13. 14. 15. [1, n] = A(cid:48) ∪ B(cid:48) ∪ C(cid:48) ∪ D(cid:48) define X(cid:48) 16. define V (cid:48) = {1, . . . , m(cid:48)} 17. define E(cid:48) = {(i, j) : 1 ≤ i, j ≤ m(cid:48)} by equation (21) 18. define G(cid:48) = (V (cid:48), E(cid:48)) //note that G(cid:48) 19. let σ ∈ Sm(cid:48) be a topological sort of V (cid:48) 20. //process shifts in Xσ(i) in topological order by adapting part of Algorithm 14 for i = 1 to m(cid:48) m(cid:48) whose union is (A(cid:48) ∪ B(cid:48)) m(cid:48) for updated s and (unchanged) t is an acyclic multigraph 1, . . . , X(cid:48) 1, . . . , X(cid:48) //Sm(cid:48) denotes set of all permutations on [1, m(cid:48)] define V (Xσ(i)) by equation (24) define E(Xσ(i)) by equation (25) define G(Xσ(i)) = (V (Xσ(i)), E(Xσ(i))) maximize (cid:80) (†i) (cid:80) v∈C //IP solution of minimum feedback vertex set problem v∈V (Xσ(i)) xv where xv ∈ {0, 1}, subject to constraints (†i) and (‡i) //first constraint removes vertex from each simple cycle of G(Xσ(i)) xv < C for each simple directed cycle C of G(Xσ(i)) //ensure shift moves cannot be applied if they share same base pair from s or t (‡i) xv + xv(cid:48) ≤ 1, for distinct vertices v = (x, y, z), v(cid:48) = (x(cid:48), y(cid:48), z(cid:48)) with {x, y, z} ∩ {x(cid:48), y(cid:48), z(cid:48)} = 2 //define the induced, acyclic digraph G(Xσ(i)) V (Xσ(i)) = {v ∈ V (Xσ(i)) : xv = 1} E(Xσ(i)) = {(v, v(cid:48)) : v, v(cid:48) ∈ V ∧ (v, v(cid:48)) ∈ E(Xσ(i))} let G(Xσ(i)) = (V (Xσ(i)), E(Xσ(i))) for each closed 2-cycle [x] = {a1, a2, a3, a4} as depicted in Figure 5 //handle special, closed 2-cycles if [x] is of type A as depicted in Figure 5a remove base pair from s by equation (18) if [x] is of type B as depicted in Figure 5b remove base pair from s by equation (19) //remove base pairs from s that are not involved in a shift move V (Xσ(i)).s = {(x, y) : ∃v ∈ V (Xσ(i))(v.s = (x, y))} for (x, y) ∈ s − t if (x, y) (cid:54)∈ V (Xσ(i)).s 16 37. 38. 38. 40. 41. 42. 43. 44. 45. 46. 47. remove (x, y) from s; numMoves = numMoves+1 //topological sort of IP solution V (Xσ(i)) topological sort of G(Xσ(i)) using DFS to obtain total ordering ≺ on V (Xσ(i)) for v = (x, y, z) ∈ V in topologically sorted order ≺ //check if shift would create a base triple, as in type 1,5 paths from Figure 3 if s[x] = 1 //i.e. {u, x} ∈ s for some u ∈ [1, n] remove {u, x} from s; numMoves = numMoves+1 shift {y, z} to {x, y} in s; numMoves = numMoves+1 //remove any remaining base pairs from s that have not been shifted for (y, z) ∈ s − t which satisfy y, z ∈ Xσ(i) if (x, y, z) ∈ V (Xσ(i)) where x = t[y] else //{y, z} is a remaining base pair of s but cannot be applied in a shift shift base pair {y, z} ∈ s to {x, y} ∈ t; numMoves = numMoves+1 remove (x, y) from s; numMoves = numMoves+1 //add remaining base pairs from t to s 48. 49. 50. 51. for (x, y) ∈ t − s s = s ∪ {(x, y)} numMoves = numMoves + 1 return moveSequence, numMoves 5 Benchmarking results 5.1 Random sequences Given a random RNA sequence a = a1, . . . an of length n, we generate a list L of all possible base pairs, then choose with uniform probability a base pairs (x, y) from L, add (x, y) to the secondary structure s being constructed, then remove all base pairs (x(cid:48), y(cid:48)) from L that either touch or cross (x, y), and repeat these last three steps until we have constructed a secondary structure having the desired number (n/5) of base pairs. If the list L is empty before completion of the construction of secondary structure s, then reject s and start over. The following pseudocode describes how we generated the benchmarking data set, where for each sequence length n = 10, 15, 20,··· , 150 nt, twenty-five random RNA sequences were generated of length n, with probability of 1/4 for each nucleotide, in which twenty secondary structures s, t were uniformly randomly generated for each sequence so that 40% of the nucleotides are base-paired. 1. 2. 3. 4. 5. 6. for n = 10 to 150 with step size 10 for numSeq = 1 to 25 generate random RNA sequence a = a1, . . . , an of length n generate 20 random secondary structures of a (cid:1) = 190 pairs of structures s, t of a for all (cid:0)20 2 compute optimal and near-optimal M S2 folding trajectories from s to t The number of computations per sequence length is thus 25· 190 = 4750, so the size of the benchmarking set is 15 · 4750 = 71, 250. This benchmarking set is used in Figures 12 -- 16. Figure 12 compares vari- ous distance measures discussed in this paper: M S2 distance computed by the optimal IP Algorithm 14, approximate M S2 distance computed by the near-optimal Algorithm 15, pk − M S2 distance that allows pseudoknotted intermediate structures, M S1 distance, and Hamming distance divided by 2. Additionally, this figure distinguishes the number of base pair additions/removals and shifts in the M S2 distance. Figure 13a shows the scatter plots and Pearson correlation coefficients all pairs of the distance measures: M S2 distance, near-optimal M S2 distance, pk − M S2 distance, Hamming distance divided by 2, M S1 distance. In contrast to Figure 13, the second panel Figure 13b shows the length-normalized values. It is unclear why M S2 distance has a slightly higher length-normalized correlation with both Hamming distance divided by 2 and M S1 distance, than that with approximate M S2 distance, as computed by Algorithm 15 -- despite the fact that the latter algorithm approximates M S2 distance much better than either Hamming distance divided by 2 or M S1 distance. Figure 14 shows that run-time of Algorithms 14 and 15, where the 17 former is broken down into time to generate the set of directed cycles and the time for the IP solver. Note that there is a 10-fold speed-up in Algorithm 14 from this paper, compared with a precursor of this algorithm that appeared in the proceedings of the Workshop in Bioinformatics (WABI 2017). Since Algorithm 15 applies Algorithm 14 to each equivalence class, there is a corresponding, but less striking speed-up in the near- optimal algorithm. Since run-time depends heavily on the number of directed cycles in the conflict digraphs, Figure 15a shows the size of vertex and edge sets of the conflict digraphs for the benchmarking data, and Figure 15b depicts the cycle length distribution for benchmarking data of length 150; for different lengths, there are similar distributions (data not shown). Finally, Figure 15c showns the (presumably) exponential increase in the number of directed cycles, as a function of sequence length. Since Algorithm 15 does not compute the collection of all directed cycles (but only those for each equivalence class), the run time of Algorithm 15 appears to be linear in sequence length, compared to the (presumably) exponential run time of Algorithm 14. 5.2 Rfam sequences In this section, we use data from the Rfam 12.0 database [28] for analogous computations as those from the previous benchmarking section. For each Rfam family having average sequence length less than 100 nt, one sequence is randomly selected, provided that the base pair distance between its MFE structure and its Rfam consensus structure is a minimum. For each such sequence a, the target structure t was taken to be the secondary structure having minimum free energy among all structures of a that are compatible with the Rfam consensus structure, as computed by RNAfold -C [25] constrained with the consensus structure of a. The corresponding initial structure s for sequence a was selected from a Zuker-suboptimal structure, obtained by RNAsubopt -z [25], with the property that dBP(s, t) − dH(s, t) < 0.2 · dBP(s, t). Since we know from Figure 14 that run time of the optimal IP Algorithm 14 depends on the number of cycles in the corresponding RNA conflict digraph, the last criterion is likely to result in a less than astronomical number of cycles. The resulting dataset consisted of 1333 sequences, some of whose lengths exceed 100 nt. Nevertheless, the number of cycles in the RNA constraint digraph of 22 of the 1333 sequences exceeded 50 million (an upper bound set for our program), so all figures described in this section are based on 1311 sequences from Rfam. Figure 17 depicts the moving averages in centered windows [x−2, x+2] of the following distance measures for the 1311 sequences extracted from Rfam 12.0 as described. Distance measures include (1) optimal M S2- distance computed by the exact IP (optimal) Algorithm 14 (where the number of base pair additions (+) or removals (−) is indicated, along with the number of shifts), (2) near-optimal M S2-distance computed by near-optimal Algorithm 15, (3) Hamming distance divided by 2, (4) M S1 distance aka base pair distance, (5) pseudoknotted M S2 distance (pk-M S2) computed from Algorithm 9, (6) optimal local M S2 with parameter d = 10, and (7) optimal local M S2 with parameter d = 20. The latter values were computed by a variant of the exact IP Algorithm 14 with locality parameter d, defined to allow base pair shifts of the form (x, y) → (x, z) or (y, x) → (z, x) only when y−z ≤ d. This data suggests that Hamming distance over 2 (dH(s, t)/2) closely (s, t)) approximates the distance computed by near-optimal Algorithm 15, while pk-M S2 distance (dpk-M S2 is a better approximation to M S2 distance than is Hamming distance over 2. Figure 18 presents scatter plots and Pearson correlation values when comparing various distance measures using the Rfam data. Figure 18a [resp. Figure 18b] presents Pearson correlation [resp. normalized Pearson correlation] values computed, where by normalized, we mean that for each of the 1311 extracted Rfam sequences a with corresponding initial structure s and target structure t, the length-normalized distance measures d(s, t)/a are correlated. Figure 19 depicts the moving average run times as a function of sequence length, where for given value x the run times are averaged for sequences having length in [x − 2, x + 2]. Finally, Figure 20 depicts the number of sequences of various lengths used in the Rfam benchmarking set of 1311 sequences. 6 Conclusion In this paper, we have introduced the first optimal and near-optimal algorithms to compute the shortest RNA secondary structure folding trajectories in which each intermediate structure is obtained from its predecessor by the addition, removal or shift of a base pair; i.e. the shortest M S2 trajectories. Since helix zippering and defect diffusion employ shift moves, one might argue that it is better to include shift moves 18 when physical modeling RNA folding, and indeed the RNA folding kinetics simulation program Kinfold [13] uses the M S2 move set by default. Using the novel notion of RNA conflict directed graph, we describe an optimal and near-optimal algorithm to compute the shortest M S2 folding trajectory. Such trajectories pass through substantially higher energy barriers than trajectories produced by Kinfold, which uses Gillespie's algorithm [17] (a version of event-driven Monte Carlo simulation) to generate physically realistic M S2 folding trajectories. We have shown in Theorem 2 that it is NP-hard to compute the M S2 folding trajectory having minimum energy barrier, and have presented anecdotal evidence that suggests that it may also NP-hard to compute the shortest M S2 folding trajectory. For this reason, and because of the exponentially increasing number of cycles (see Figure 16) and subsequent time requirements of our optimal IP Algorithm 14, it is unlikely that (exact) M S2 distance prove to be of much use in molecular evolution studies such as [3, 42, 15]. Nevertheless, Figures 12 and 17 suggest that either pk-M S2 distance and/or near-optimal M S2 distance may be a better approximation to (exact) M S2 distance than using Hamming distance, as done in [36, 43]. However, given the high correlations between these measures, it is unlikely to make much difference in molecular evolution studies. Our graph-theoretic formulation involving RNA conflict digraphs raises some interesting mathematical questions partially addressed in this paper; in particular, it would be very interesting to characterize the class of digraphs that can be represented by RNA conflict digraphs, and to determine whether computing the shortest M S2 folding trajectory is N P -hard. We hope that the results presented in this paper may lead to resolution of these questions. References [1] J. Bang-Jensen and G. Gutin. Digraphs : theory, algorithms, and applications. Springer monographs in mathematics. Springer, London, New York, 2001. Deuxi`eme impression avec corrections. [2] A.H. Bayegan and P. Clote. An IP algorithm for RNA folding trajectories. In K. Reiner and R. Schwartz, editors, Algorithms in Bioinformatics: 17th International Workshop, WABI 2017, Boston MA, USA, August 21-23, 2017. Springer, 2017. [3] E. Borenstein and E. Ruppin. Direct evolution of genetic robustness in microRNA. Proc. Natl. Acad. Sci. U.S.A., 103(17):6593 -- 6598, April 2006. [4] Pierre Charbit, St´ephan Thomass´e, and Anders Yeo. The minimum feedback arc set problem is np-hard for tournaments. Combinatorics, Probability & Computing, 16(1):1 -- 4, 2007. [5] S. S. Cho, D. L. Pincus, and D. Thirumalai. Assembly mechanisms of RNA pseudoknots are determined by the stabilities of constituent secondary structures. Proc. Natl. Acad. Sci. U.S.A., 106(41):17349 -- 17354, October 2009. [6] P. Clote and A. Bayegan. Network Properties of the Ensemble of RNA Structures. PLoS. One., 10(10):e0139476, 2015. [7] T.H. Cormen, C.E. Leiserson, and R.L. Rivest. Algorithms. McGraw-Hill, 1990. 1028 pages. [8] K. Darty, A. Denise, and Y. Ponty. VARNA: Interactive drawing and editing of the RNA secondary structure. Bioinformatics, 25(15):1974 -- 1975, August 2009. [9] I. Dotu, J. A. Garcia-Martin, B. L. Slinger, V. Mechery, M. M. Meyer, and P. Clote. Complete RNA inverse folding: computational design of functional hammerhead ribozymes. Nucleic. Acids. Res., 42(18):11752 -- 11762, February 2015. [10] I. Dotu, W. A. Lorenz, P. VAN Hentenryck, and P. Clote. Computing folding pathways between RNA secondary structures. Nucleic. Acids. Res., 38(5):1711 -- 1722, 2010. [11] E. C. Dykeman. An implementation of the Gillespie algorithm for RNA kinetics with logarithmic time update. Nucleic. Acids. Res., 43(12):5708 -- 5715, July 2015. 19 [12] P. Festa, P. Pardalos, and M.G.C. Resende. Feedback set problems. In C. Floudas and P. Pardalos, editors, Encyclopedia of Optimization, pages 1005 -- 1016. Springer US, Boston, MA, 2009. Second edition. [13] C. Flamm, W. Fontana, I.L. Hofacker, and P. Schuster. RNA folding at elementary step resolution. RNA, 6:325 -- 338, 2000. [14] C. Flamm, I.L. Hofacker, P.F. Stadler, and M. Wolfinger. Barrier trees of degenerate landscapes. Z. Phys. Chem., 216:155 -- 173, 2002. [15] J. A. Garcia-Martin, A. H. Bayegan, I. Dotu, and P. Clote. RNAdualPF: software to compute the dual partition function with sample applications in molecular evolution theory. BMC. Bioinformatics, 17(1):424, October 2016. [16] J. A. Garcia-Martin, I. Dotu, and P. Clote. RNAiFold 2.0: a web server and software to design custom and Rfam-based RNA molecules. Nucleic. Acids. Res., 43(W1):W513 -- W521, July 2015. [17] D.T. Gillespie. A general method for numerically simulating the stochastic time evolution of coupled chemical reactions. J Comp Phys, 22(403):403 -- 434, 1976. [18] K.A. Harris and D.M. Crothers. The Leptomonas collosoma spliced leader RNA can switch between two alternate structural forms. Biochemistry, 32(20):5301 -- 5311, 1993. [19] Matthew S. Hecht and Jeffrey D. Ullman. Flow graph reducibility. SIAM J. Comput., 1(2):188 -- 202, 1972. [20] C. Hobartner and R. Micura. Bistable secondary structures of small RNAs and their structural probing by comparative imino proton NMR spectroscopy. J. Mol. Biol., 325(3):421 -- 431, January 2003. [21] D.B. Johnson. Finding all the elementary circuits of a directed graph. SIAM J. Comput., 4:77 -- 84, 1975. [22] Richard M. Karp. Reducibility among combinatorial problems. In Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York., pages 85 -- 103, 1972. [23] B. Knudsen and J. Hein. Pfold: RNA secondary structure prediction using stochastic context-free grammars. Nucleic. Acids. Res., 31(13):3423 -- 3428, July 2003. [24] Kazimierz Kuratowski. Sur le probl`eme des gauches en topologie. Fundamenta Mathematicae, 15:271 -- 283, 1930. [25] R. Lorenz, S. H. Bernhart, C. Honer zu Siederdissen, H. Tafer, C. Flamm, P. F. Stadler, and I. L. Hofacker. Viennarna Package 2.0. Algorithms. Mol. Biol., 6:26, 2011. [26] C.L. Lucchesi and D.H. Younger. A minimax arc theorem for directed graphs. J. London Math. Soc, 17:369 -- 374, 1978. [27] D.H. Mathews, J. Sabina, M. Zuker, and H. Turner. Expanded sequence dependence of thermodynamic parameters provides robust prediction of RNA secondary structure. J. Mol. Biol., 288:911 -- 940, 1999. [28] E. P. Nawrocki, S. W. Burge, A. Bateman, J. Daub, R. Y. Eberhardt, S. R. Eddy, E. W. Floden, P. P. Gardner, T. A. Jones, J. Tate, and R. D. Finn. Rfam 12.0: updates to the RNA families database. Nucleic. Acids. Res., 43(Database):D130 -- D137, January 2015. [29] R. Nussinov and A. B. Jacobson. Fast algorithm for predicting the secondary structure of single stranded RNA. Proceedings of the National Academy of Sciences, USA, 77(11):6309 -- 6313, 1980. [30] K. Perrot and T.V. Pham. Np-hardness of minimum feedback arc set problem on Eulerian digraphs and minimum recurrent configuration problem of chip-firing game. CoRR - Computing Research Repository - arXiv, abs/1303.3708, 2013. 20 [31] D. Porschke. Model calculations on the kinetics of oligonucleotide double-helix coil transitions: Evidence for a fast chain sliding reaction. Biophys Chem, 2(2):83 -- 96, August 1974. [32] N. Rajewsky. microrna target predictions in animals. Nat. Genet., 38:S8 -- S13, June 2006. [33] Vijaya Ramachandran. A minimax arc theorem for reducible flow graphs. SIAM J. Discrete Math., 3(4):554 -- 560, 1990. [34] Vijaya Ramachandran. A minimax arc theorem for reducible flow graphs. SIAM J Disc. Math., 3(4):554 -- 560, 1990. [35] P. Schattner, A. N. Brooks, and T. M. Lowe. The tRNAscan-SE, snoscan and snoGPS web servers for the detection of tRNAs and snoRNAs. Nucleic. Acids. Res., 33(Web):W686 -- W689, July 2005. [36] P. Schuster and P.F. Stadler. Modeling conformational flexibility and evolution of structure: RNA as an example. In U. Bastille, M. Roman, and M. Vendruscolo, editors, Structural Approaches to Sequence- Evolution, page 3 -- 36. Springer, Heidelberg, 2007. [37] E. Senter, I. Dotu, and P. Clote. RNA folding pathways and kinetics using 2D energy landscapes. J Math Biol, 2014. [38] A. Serganov, Y.R. Yuan, O. Pikovskaya, A. Polonskaia, L. Malinina, A.T. Phan, C. Hobartner, R. Mi- cura, R.R. Breaker, and D.J. Patel. Structural basis for discriminative regulation of gene expression by adenine- and guanine-sensing mRNAs. Chem. Biol., 11(12):1729 -- 1741, 2004. [39] Z. Sukosd, B. Knudsen, M. Vaerum, J. Kjems, and E. S. Andersen. Multithreaded comparative RNA secondary structure prediction using stochastic context-free grammars. BMC. Bioinformatics, 12:103, 2011. [40] C. Thachuk, J. Manuch, L. Stacho, and A. Condon. NP-completeness of the direct energy barrier height problem. Natural Computing, 10(1):391 -- 405, 2011. [41] D. H. Turner and D. H. Mathews. NNDB: the nearest neighbor parameter database for predicting stability of nucleic acid secondary structure. Nucleic. Acids. Res., 38(Database):D280 -- D282, January 2010. [42] A. Wagner. Robustness and evolvability: a paradox resolved. Proc. Biol Sci., 275(1630):91 -- 100, January 2008. [43] A. Wagner. Mutational robustness accelerates the origin of novel RNA phenotypes through phenotypic plasticity. Biophys. J., 106(4):955 -- 965, February 2014. [44] S. Washietl and I. L. Hofacker. Identifying structural noncoding RNAs using RNAz. Curr Protoc Bioinformatics, 0(O):O, September 2007. [45] Michael T. Wolfinger, W. Andreas Svrcek-Seiler, Christoph Flamm, Ivo L. Hofacker, and Peter F. Stadler. Efficient folding dynamics of RNA secondary structures. J. Phys. A: Math. Gen., 37:4731 -- 4741, 2004. [46] S. Wuchty, W. Fontana, I.L. Hofacker, and P. Schuster. Complete suboptimal folding of RNA and the stability of secondary structures. Biopolymers, 49:145 -- 164, 1999. [47] J. N. Zadeh, B. R. Wolfe, and N. A. Pierce. Nucleic acid sequence design via efficient ensemble defect optimization. J. Comput. Chem., 32(3):439 -- 452, February 2011. 21 Figure 1: Illustration of shift moves, taken from [6]. Figure 2: Defect diffusion [31], where a bulge migrates stepwise to become absorbed in an hairpin loop. The move from structure (a) to structure (b) is possible by the shift (1, 12) → (1, 13), the move from (b) to (c) by shift (2, 11) → (2, 12), etc. Our algorithm properly accounts for such moves with respect to energy models A,B,C. Image taken from [6]. 7 Figures 22 Figure 3: All possible maximal length red-green paths and cycles. Each equivalence class X, as defined in Definition 7, can be depicted as a maximal length path or cycle, consisting of those positions x ∈ [1, n] that are connected by alternating base pairs drawn from secondary structures s (green) and t (red). Each path or cycle X is depicted in a fashion that the leftmost [resp. rightmost position] satisfies the following properties, where End(s, X) [resp. End(t, X)] denotes the set of elements of X that are untouched by t [resp. s]: for paths of type 1, X is even, End(s, X)] = 2, b1 = min(End(s, X)), t[am] = 0; for paths of type 2, X is odd, End(s, X)] = 1 = End(t, X), b0 = min(End(s, X)), s[bm] = 0; for paths of type 3, X is odd, End(s, X)] = 1 = End(t, X), a0 = min(End(t, X)), t[am] = 0; for paths of type 4, X is even, End(t, X)] = 2, a1 = min(End(t, X)), s[bm] = 0; for paths of type 5, or cycles, X must be even, and a1 = min(X). Note that the appearance of positions in left-to-right order does not necessarily respect integer ordering, so the leftmost position is not necessarily the minimum min(X), nor is the rightmost position necessarily the maximum max(X). 23 Figure 4: All six possible shift moves, in which a base pairs of s (teal) that touches a base pairs of t (red) is shifted, thus reducing the base pair distance dBP(s, t) by 2. Each such shift move can uniquely be designated by the triple (x, y, z), where y is the pivot position (common position to a base pair in both s and t), x is the remaining position in the base pair in t, and z is the remaining position in the base pair in s. Figure 5: Two special types of closed 2-cycles. (a) RNA conflict digraph G = (V, E) for secondary structures t and s, where a1 < a2 < a3 < a4 and t = {(a1, a2), (a3, a4)}, and s = {(a1, a4), (a2, a3)}. Nodes of V = {v1, v2, v3, v4} are the following: v1 = (a1, a2, a3) of type 1, v2 = (a3, a4, a1) of type 5, v3 = (a2, a1, a4) of type 4, and v4 = (a4, a3, a2) of type 2. (b) RNA conflict digraph G = (V, E) for secondary structures t and s, where a1 < a2 < a3 < a4 and t = {(a1, a4), (a2, a3)} and s = {(a1, a2), (a3, a4)}. Nodes of V = {v1, v2, v3, v4} are the following: v1 = (a1, a4, a3) of type 6, v2 = (a4, a1, a2) of type 3, v3 = (a2, a3, a4) of type 1, v4 = (a3, a2, a1) of type 2. Since the overlap between any two distinct vertices in (a) and (b) is 2, there are no edges in E for the conflict digraphs of (a) and (b). An optimal trajectory from s to t is constructed by removing a base pair from s, performing a shift, and adding the remaining base pair from t. In each case there are 2 choices for the base pair to remove and two choices for the shift, so 4 optimal trajectories for each of (a) and (b). 24 structure s whose free energy is +0.70 kcal/mol, Figure 6: Conflict digraph for a 20 nt toy example with sequence GGGAAAUUUC CCCAAAGGGG, with initial structure t whose free energy is + 3.30 kcal/mol. a first cycle {(8, 20, 10), (9, 19, 11), (18, 10, 20), (19, 9, 1)} of size 4, a second cycle {[(8, 20, 10), (19, 9, 1)} of size 2, and a third cycle {(18, 10, 20), (9, 19, 11)} of size 2. The conflict digraph contains 3 simple cycles: and target Figure 7: Conflict digraphs for the 25 nt bistable switch with sequence UGUACCGGAA GGUGCGAAUC UUCCG taken from Figure 1(b).1 of [20], in which the authors performed structural probing by comparative imino proton NMR spectroscopy. (a) Minimum free energy (MFE) structure having -10.20 kcal/mol. (b) Alternate metastable structure having next lowest free free energy of -7.40 kcal/mol. Two lower energy structures exist, having -9.00 kcal/mol resp. -7.60 kcal/mol; however, each is a minor variant of the MFE structure. (c) RNA conflict digraph G = (V, E), having directed edges (x, y, z) → (u, v, w) if the (unordered) base pair {y, z} ∈ s touches or crosses the (unordered) base pair {u, v} ∈ t. Here, s is in the metastable structure shown in (b) having -7.40 kcal/mol, while t is the MFE structure shown in (a) having -10.20 kcal/mol. The conflict digraph represents a necessary order of application of shift moves, in order to avoid the creation of base triples or pseudoknots. Note that the digraph G is acyclic, but the IP solver must nevertheless be invoked with constraint (‡) that precludes both vertices (20, 11, 6) and (25, 6, 11) from belonging to the solution V . (d) RNA conflict digraph G(cid:48) = (V (cid:48), E(cid:48)), having similar definition in which roles of s and t are reversed -- i.e. M S2 folding pathways from the MFE structure to the (higher energy) metastable structure. 25 Figure 8: Conflict digraph for the 56 nt spliced leader RNA from L. collosoma with sequence AACUAAAACA AUUUUUGAAG AACAGUUUCU GUACUUCAUU GGUAUGUAGA GACUUC. (a) Metastable structure having free energy of -9.20 kcal/mol. (b) Minimum free energy (MFE) structure having free energy of -9.40 kcal/mol. (c) The RNA conflict digraph for refolding from metastable s to MFE t contains 12 vertices, 61 directed edges and no directed cycles. Minimum free energy (MFE) and metastable structures in (a) and (b) computed by Vienna RNA Package [25]. Secondary structure images generated using VARNA [8]. 26 Figure 9: (a) Rainbow diagram for spliced leader RNA from L. collosoma, in which the base pairs for the initial structure s (Figure 8a) are shown below the line in red, while those for the target structure t (Figure 8b) are shown above the line in blue. (b) Free energies of structures in the shortest M S2 folding trajectory for spliced leader are shown by the dotted blue line, while those for the energy-optimal M S2 folding trajectory are shown in the solid red line. Algorithm 14 was used to compute the shortest M S2 trajectory, while the programs RNAsubopt [46] and barriers [14] were used to compute the energy-optimal folding trajectory. 27 Figure 10: Gene ON and gene OFF structures and the RNA conflict digraph for the 156 nt xanthine phosphoribosyltransferase (xpt) riboswitch from B. subtilis -- structures consistent with in-line probing data taken from Figure 1A of [38]. (a) Gene ON structure (default) in absence of free guanine, having (computed) free energy of -33.11 kcal/mol. (b) Gene OFF structure when guanine binds cytidine in position 66, having (computed) free energy of -56.20 kcal/mol (guanine not shown). (c) Rainbow diagram with red gene ON structure below line and blue gene OFF structure above line. Rainbow diagrams allow one to determine by visual inspection when base pairs touch or cross. (d) Conflict digraph G = (V, E), containing 18 vertices, 113 directed edges, and 1806 directed cycles. Minimum free energy (MFE) and metastable structures in (a) and (b) computed by Vienna RNA Package [25]. Free energy computations using Turner energy model [41] computed with Vienna RNA Package [25]. Secondary structure images generated using VARNA [8]. 28 Figure 11: (a) Initial gene ON structure (default) in absence of free guanine (enlarged image). (b) Target gene OFF structure when guanine binds cytidine in position 66 (enlarged image). (c) Shortest M S2 folding trajectory from the gene ON structure s to the gene OFF structure t for the 156 nt xpt riboswitch from B. subtilis, described in the caption to Figure 10. Note the initial elongation of the P1 helix by the first shift, followed by the stepwise removal of the anti-terminator and construction of the terminator loops by shift 2-10, followed by base pair additions to lengthen the terminator loop. Although (a,b) are duplicated from the previous figure, this is necessary to follow the sequence of moves in the M S2 trajectory. Secondary structure images generated using VARNA [8]. (d) Free energies of structures in the shortest M S2 folding trajectory for xpt are shown by the dotted blue line, while those for the an energy near-optimal M S1 folding trajectory are shown in the solid red line. Algorithm 14 was used to compute the shortest M S2 trajectory, while the program RNAtabuPath [10] was used to compute the energy near-optimal M S1 folding trajectory. The size of the 156 nt xpt riboswitch and the fact that the program RNAsubopt would need to generate all secndary structures within 30 kcal/mol of the minimum free energy -54.1 kcal/mol preclude any possibility that the optimal M S2 trajectory can be computed by application of the program barriers [14]. 29 Figure 12: Benchmarking statistics for optimal and near-optimal algorithm to compute minimum length M S2 folding trajectories between random secondary structures s, t of random RNA sequences of variable lengths. For each sequence length n = 10, 15, 20,··· , 150 nt, twenty-five random RNA sequences were generated of length n, with probability of 1/4 for each nucleotide. For each RNA sequence, twenty secondary structures s, t were uniformly randomly generated so that 40% of the nucleotides are base-paired. Thus the number of computations per sequence length is thus 25 · 190 = 4750, so the size of the benchmarking set is 15 · 4750 = 71, 250. Using this dataset, the average M S2 distance was computed for both the exact IP Algorithm 14 and the near-optimal Algorithm 15. In addition to M S2 distance computed by the exact IP and the near- optimal algorithm, the figure displays pk − M S2 distance (allowing pseudoknots in intermediate structures) as computed by Algorithm 9, the M S1 distance (also known as base pair distance), Hamming distance over 2, and provides a breakdown of the M S1 distance in terms of the number of base pair addition/removal moves "num base pair +/- (optimal)" and the shift moves "num shift moves (optimal)". 30 Figure 13: Pairwise correlations for optimal M S2 distance, pk − M S2 distance, near-optimal M S2 distance, Hamming distance divided by 2, and M S1 distance (also called base pair distance). For each two measures, scatter plots were created for the 71, 250 many data points from the benchmarking set described in Figure 12. Pearson correlation and normalized Pearson correlation values computed, where by normalized, we mean that for each of the 71, 250 data points, we consider the length-normalized distance (distance divided by sequence length). These correlations are statistically significant -- each Pearson correlation values has a p-value less than 10−8. 31 Figure 14: Run time for the exact IP (optimal) algorithm 14 and the near-optimal algorithm 15 to compute minimum length M S2 folding trajectories for the same data set from previous Figure 12. Each data point represents the average µ ± σ where error bars indicate one standard deviation, taken over 71, 250 many sequence/structure pairs. Run time of the optimal algorithm depends on time to perform topological sort, time to enumerate all directed cycles using our Python implementation of Johnson's algorithm [21], and time for the Gurobi IP solver (ordered here by increasing time demands). 32 Figure 15: (Left) Average size of vertex sets V and of directed edge sets E for RNA conflict digraphs G = (V, E) for the data set of described in Figure 12. Error bars represent ±1 standard deviation. Clearly the size of a conflict digraph grows linearly in the length n of random RNAs a = a1, . . . , an, given random secondary structures s, t having n/5 base pairs. (Right) Cycle length distribution for random RNAs a = a1, . . . , an of length n = 150, with randomly chosen secondary structures s, t having n/5 base pairs, using data extracted from the data set described in Figure 12. For values of n = 50, . . . , 150, the cycle length distribution appears approximately normal, although this is not the case for n ≤ 40 (data not shown). Figure 16: Average number of directed cycles as a function of sequence length for the data set described in Figure 12. For each random RNA sequence a = a1, . . . , an of length n, and for each pair of random secondary structures s, t of a having n/5 base pairs, we computed the total number of directed cycles in the conflict digraph G(a, s, t). The figure suggests that starting at a threshold sequence length n, there is an exponential growth in the number of directed cycles in the conflict digraph of random sequences of length n. 33 Figure 17: Moving averages of distance measures graphed as a function of sequence length for the 1311 many sequences extracted from Rfam 12.0 (see text). Distance measures included optimal M S2-distance computed by the exact IP (optimal) algorithm 14 (where the number of base pair additions (+) or removals (−) is indicated, along with the number of shifts),, near-optimal M S2-distance computed by near-optimal algorithm 15, Hamming distance divided by 2, M S1 distance aka base pair distance, pseudoknotted M S2 distance (pk-M S2) computed from Lemma 8, optimal local M S2 with parameter d = 10, and optimal local M S2 with parameter d = 20. The latter values were computed by a variant of the exact IP algorithm 14 where shift moves were restricted to be local with parameter d, whereby base pair shifts of the form (x, y) → (x, z) or (y, x) → (z, x) were allowed only when y − z ≤ d. All moving averages were computed over symmetric [i − 4, i + 4]. From smallest to largest value, the measures are: number of shifts in windows of size 9, i.e. optimal M S2 trajectory < number of base pair additions or deletions (+/−) in optimal M S2 trajectory < pk-M S2 < M S2 distance < Hamming distance over 2 ≈ near-optimal M S2 < M S2 with locality parameter d = 20 < M S2 with locality parameter d = 10 < M S1. 34 Figure 18: Pairwise correlations using Rfam benchmarking data (see text) for optimal M S2 distance, pk − M S2 distance, near-optimal M S2 distance, Hamming distance divided by 2, and M S1 distance (also called base pair distance). For each two measures, scatter plots were created for the 1311 many data points. Pearson correlation and normalized Pearson correlation values computed, where by normalized, we mean that for each of the 1311 data points, we consider the length-normalized distance (distance divided by sequence length). These correlations are statistically significant -- each Pearson correlation values has a p-value less than 2.2 · 10−16. Figure 19: Moving averages of run time as a function of sequence length for the 1311 sequences extracted from Rfam 12.0 (see text). Distance measures considered are the exact M S2 distance computed by the optimal IP Algorithm 14, an approximation to the M S2 distance computed by the near-optimal IP Algorithm 15, the pk − M S2 distance (allowing pseudoknots in intermediate structures) as computed by Algorithm 9, and two variants of exact M S2 distance, where shifts are restricted by locality parameter d = 10, 20. These latter values were computed by the exact IP Algorithm 14 modified to allow base pair shifts of the form (x, y) → (x, z) or (y, x) → (z, x) only when y − z ≤ d. 35 Figure 20: Number of sequences as a function of sequence length for the 1311 sequences extracted from Rfam 12.0 and used in benchmarking tests (see text). Figure 21: RNA conflict digraph G = (V, E) for secondary structures t and s, where t = {(a2, a1), (b1, b2), (c1, c2), (d1, d2)}, and s = {(a2, a3), (b2, b3), (c2, c3), (d2, d3)}. The triplet nodes of V = {va, vb, vc, vd} are the following: va = (a1, a2, a3) of type 3, shift vb = (b1, b2, b3) of type 1, shift vc = (c1, c2, c3) of type 1, and shift vd = (d1, d2, d3) of type 1. The edges in E are the following: va → vb, vb → vc, vc → vd, vd → va. The conflict digraph G = (V, E) is order-isomorphic to the digraph G(cid:48) = (V (cid:48), E(cid:48)), where V (cid:48) = {1, 2, 3, 4} and edges are as follows: 1 → 2 → 3 → 4 → 1. 36 Figure 22: (a) Complete bipartite graph K3,3. A finite graph is planar if and only if it does not contain the forbidden graph K3,3 or the complete graph K5 [24]. (b) Directed graph realized by the RNA conflict digraph in Figure 23. It follows that RNA conflict digraphs are not necessarily planar. (c) Directed graph realized by the RNA conflict digraph in Figure 24. A flow graph is reducible if and only if it does not contain such a forbidden flow graph, where edges between nodes may be replaced by arc-disjoint directed paths [19]. It follows that RNA conflict digraphs are not necessarily reducible flow graphs. Figure 23: RNA conflict digraph that realizes the digraph K3,3 depicted in Figure 22b, whose undirected red edges represent the undirected graph K3,3 depicted in Figure 22b. The nonplanar complete, bipartite digraph K3,3, with shift moves c, b, a, d, e, f , all of type 1, in order from left to right -- i.e. order of positions along the x-axis is given by: c1, b1, a1, a2, b2, c2, d1, e1, f1, c3, b3, a3, f2, e2, d2, d3, e3, f3. Notice that as crosses bt, ct, dt, et and ft so c ← a, b ← a and a → d, a → e, a → f ; bs crosses ct, dt, et and ft so c ← b and b → d, b → e, b → f ; cs crosses dt, et and ft so c → d, c → e, c → f . Figure 24: Forbidden flow graph with nodes i = (i1, i2, i3), a = (a1, a2, a3), b = (b1, b2, b3), c = (c1, c2, c3), where nodes i, a, c are of type 1 and node b is of type 3. Notice that is crosses at so i → a; as crosses bt so a → b; as crosses ct so a → c; bs crosses ct so b → c; cs crosses bt so c ← b. 37 Figure 25: (a) Digraph of an ordered 4-cycle, which is representable by an RNA conflict digraph, as shown in Figure 21. (b) Digraph of an ordered 4-cycle, which is not representable by an RNA conflict digraph. Note that digraph (b) is Eulerian, with the property that the in-degree of each vertex equals its out-degree. (c) Digraph of a tournament on 4 vertices, which is not representable by an RNA conflict digraph. Digraph (a) is isomorphic with digraph (b), thus showing that representability is not preserved under isomorphism. Since it is not difficult to show that all 2(3 2) = 8 tournaments on 3 nodes are representable by RNA conflict digraphs (data not shown), it follows that digraph (c) is a minimum sized non-representable tournament, which we verified by constraint programming. In general there are 2(n 2) many tournaments on n. Figure 26: Example of a 4-node digraph in (a) that is not representable by an RNA conflict digraph. However, by adding an edge to digraph (a), we obtain a representable digraph in (b). Note that digraph (a) is neither order-isomorphic to digraph (b), nor is there an order-preserving embedding of digraph (a) into digraph (b). 38 A Classification of edges in RNA constraint digraphs In this section, we describe the collection of all possible directed edges v → v(cid:48) in which v.s crosses v(cid:48).t, that can appear in an RNA conflict digraph, classified as forward, backward or 2-cycles and according to each type of vertex (see Figure 4 for the six types of vertices). It is straightforward for the reader to imaging additional directed edges v → v(cid:48) in which v.s touches v(cid:48).t, so these are not shown. In addition, we provide the pseudocode for a slow branch-and-bound algorithm to determine a shortest M S2 trajectory. Given two secondary structures s, t for the RNA sequence a1, . . . , an, recall that notation for a shift move from the (unordered) base pair {x, y} ∈ s to the (unordered) base pair {y, z} ∈ t is given by the triple (z, y, x), where the middle coordinate y is the pivot position, common to both base pairs {x, y} ∈ s and {y, z} ∈ t, while the first [resp. last] coordinate z [resp. x] is the remaining position from the base pair {y, z} ∈ t [resp. {x, y} ∈ s]. A directed edge is given from shift move (x, y, z) to shift move (u, v, w) if the base pair {y, z} ∈ s from the first shift move crosses with the base pair {u, v} ∈ t from the second shift move; i.e. min(u, v) < min(y, z) < max(u, v) < max(y, z) or min(y, z) < min(u, v) < max(y, z) < max(u, v). The reason for the directed edge is that if the second shift (u, v, w) is applied before the first shift (x, y, z), then a pseudoknot (crossing) would be created; it follows that the first shift must be applied before the second shift. Edges may be forward (left-to-right) or backward (right-to-left), depending on whether the pivot position of the first shift is (strictly) less than or (strictly) greater than the pivot position of the second shift. This section does not list similar examples, where the (unordered) base pair {y, z} ∈ s from the first shift move touches the (unordered) base pair {u, v} ∈ t from the second shift move, as such examples are clear from Figure 3 of the main text. A.1 Forward Edges 1 2 3 4 5 5 6 6 1 2 3 4 4 55 6 1 2 3 4 4 5 6 6 1 2 3 4 4 5 6 6 forward edge of type 5 → 5 (4,5,2) → (3,6,1) forward edge of type 5 → 1 (3,4,1) → (2,5,6) forward edge of type 2 → 5 (5,4,2) → (3,6,1) forward edge of type 5 → 6 (3,4,1) → (2,6,5) 1 2 33 44 5 6 1 2 33 4 5 5 6 1 2 3 3 4 55 6 1 2 33 4 5 6 6 forward edge of type 1 → 1 (2,3,6) → (1,4,5) forward edge of type 1 → 6 (2,3,6) → (1,5,4) forward edge of type 2 → 1 (4,3,1) → (2,5,6) forward edge of type 1 → 5 (2,3,5) → (4,6,1) 1 2 3 3 4 5 6 6 1 22 3 3 4 5 6 1 2 2 3 44 5 6 1 22 3 4 4 5 6 forward edge of type 2 → 6 (4,3,1) → (2,6,5) forward edge of type 1 → 3 (1,2,5) → (6,3,4) forward edge of type 4 → 1 (3,2,6) → (1,4,5) forward edge of type 1 → 2 (1,2,5) → (6,4,3) 39 1 22 3 4 55 6 1 2 2 3 4 5 5 6 1 2 2 3 4 5 6 6 1 22 3 4 5 6 6 forward edge of type 1 → 1 (1,2,4) → (3,5,6) forward edge of type 4 → 6 (3,2,6) → (1,5,4) forward edge of type 4 → 5 (3,2,5) → (4,6,1) forward edge of type 1 → 6 (1,2,4) → (3,6,5) 1 1 2 2 3 4 5 6 1 1 2 3 3 4 5 6 1 1 2 3 3 4 5 6 1 1 2 3 44 5 6 forward edge of type 3 → 3 (6,1,4) → (5,2,3) forward edge of type 4 → 3 (2,1,5) → (6,3,4) forward edge of type 3 → 2 (6,1,4) → (5,3,2) forward edge of type 3 → 1 (6,1,3) → (2,4,5) 1 1 2 3 4 4 5 6 1 1 2 3 4 55 6 1 1 2 3 4 5 5 6 1 1 2 3 4 5 6 6 forward edge of type 4 → 2 (2,1,5) → (6,4,3) forward edge of type 4 → 1 (2,1,4) → (3,5,6) forward edge of type 3 → 6 (6,1,3) → (2,5,4) forward edge of type 4 → 6 (2,1,4) → (3,6,5) A.2 Backward Edges 1 2 3 4 5 5 6 6 1 2 3 4 4 5 5 6 1 2 3 44 5 6 6 1 2 3 4 4 5 6 6 backward edge of type 6 ← 6 backward edge of type 6 ← 2 backward edge of type 1 ← 6 backward edge of type 6 ← 5 (2,5,4) ← (1,6,3) (1,4,3) ← (6,5,2) (2,4,5) ← (1,6,3) (1,4,3) ← (5,6,2) 1 2 3 3 4 4 5 6 1 2 33 4 5 5 6 1 2 3 3 4 5 5 6 1 2 33 4 5 6 6 backward edge of type 2 ← 2 backward edge of type 1 ← 2 backward edge of type 2 ← 5 backward edge of type 1 ← 5 (6,3,2) ← (5,4,1) (1,3,4) ← (6,5,2) (6,3,2) ← (4,5,1) (1,3,4) ← (5,6,2) 1 2 3 3 4 5 6 6 1 2 2 3 3 4 5 6 1 2 2 3 4 4 5 6 1 2 2 3 44 5 6 backward edge of type 2 ← 6 backward edge of type 2 ← 4 backward edge of type 3 ← 2 backward edge of type 2 ← 1 (5,3,2) ← (1,6,4) (5,2,1) ← (4,3,6) (6,2,3) ← (5,4,1) (5,2,1) ← (3,4,6) 40 1 2 2 3 4 5 5 6 1 2 2 3 4 5 5 6 1 2 2 3 4 5 6 6 1 2 2 3 4 5 6 6 backward edge of type 3 ← 5 backward edge of type 2 ← 2 backward edge of type 3 ← 6 backward edge of type 2 ← 5 (6,2,3) ← (4,5,1) (4,2,1) ← (6,5,3) (5,2,3) ← (1,6,4) (4,2,1) ← (5,6,3) 1 1 2 2 3 4 5 6 1 1 2 3 3 4 5 6 1 1 2 33 4 5 6 1 1 2 3 44 5 6 backward edge of type 4 ← 4 backward edge of type 3 ← 4 backward edge of type 4 ← 1 backward edge of type 3 ← 1 (4,1,6) ← (3,2,5) (5,1,2) ← (4,3,6) (4,1,6) ← (2,3,5) (5,1,2) ← (3,4,6) 1 1 2 3 4 4 5 6 1 1 2 3 4 5 5 6 1 1 2 3 4 5 5 6 1 1 2 3 4 5 6 6 backward edge of type 4 ← 2 backward edge of type 3 ← 2 backward edge of type 4 ← 5 backward edge of type 3 ← 5 (3,1,6) ← (5,4,2) (4,1,2) ← (6,5,3) (3,1,6) ← (4,5,2) (4,1,2) ← (5,6,3) A.3 2-Cycles 1 2 33 4 5 6 6 1 2 3 3 4 5 6 6 1 2 2 3 4 5 5 6 1 2 2 3 4 5 5 6 2-cycle of type 1 ↔ 5 (1,3,5) ↔ (4,6,2) 2-cycle of type 2 ↔ 6 (5,3,1) ↔ (2,6,4) 2-cycle of type 3 ↔ 5 (6,2,4) ↔ (3,5,1) 2-cycle of type 4 ↔ 6 (4,2,6) ↔ (1,5,3) 1 1 2 3 44 5 6 1 1 2 3 4 4 5 6 2-cycle of type 3 ↔ 1 (5,1,3) ↔ (2,4,6) 2-cycle of type 4 ↔ 2 (3,1,5) ↔ (6,4,2) A.4 Summary tables of shift moves edges Table 1 presents a count of all 12 possible bidirectional edges, while Table 2 [resp. Table 3] presents a count of all 34 possible forward [resp. back] directed edges. Here, by bidirectional edge between nodes x and y, we mean the existence of directed edges x → y and y → x. Figures in Sections A.3, A.1 and A.2 depict all of these these directed edges. 41 1 ↔ 5 2 ↔ 6 3 ↔ 5 4 ↔ 6 3 ↔ 1 4 ↔ 2 Table 1: All 6 possible bidirectional edges, or 2-cycles. Note that 1 ↔ 5 is distinct from 5 ↔ 1, since the pivot point from the left node must be less than that from the right node in our notation. Here, by bidirectional edge between nodes x and y, we mean the existence of directed edges x → y and y → x. edge 1 → 1 1 → 2 1 → 3 1 → 4 1 → 5 1 → 6 1 ⇒ ∗ num edge 2 → 1 2 → 2 2 → 3 2 → 4 2 → 5 2 → 6 2 ⇒ ∗ 2 1 1 0 1 2 7 num edge 3 → 1 3 → 2 3 → 3 3 → 4 3 → 5 3 → 6 3 ⇒ ∗ 1 0 0 0 1 1 3 num edge 4 → 1 4 → 2 4 → 3 4 → 4 4 → 5 4 → 6 4 ⇒ ∗ 1 1 1 0 0 1 4 num edge 5 → 1 5 → 2 5 → 3 5 → 4 5 → 5 5 → 6 5 ⇒ ∗ 2 1 1 0 1 2 7 num edge 6 → 1 6 → 2 6 → 3 6 → 4 6 → 5 6 → 6 6 ⇒ ∗ 1 0 0 0 1 1 3 num 0 0 0 0 0 0 0 Table 2: All 24 possible forward edges and their number. Here only shift moves of the form (x, y, z) → (u, v, w) are considered, where the (unordered) base pair {y, z} ∈ s crosses the (unordered) base pair {u, v} ∈ t, where y < v. edge 1 ← 1 1 ← 2 1 ← 3 1 ← 4 1 ← 5 1 ← 6 1 ⇐ ∗ num edge 2 ← 1 2 ← 2 2 ← 3 2 ← 4 2 ← 5 2 ← 6 2 ⇐ ∗ 0 1 0 0 1 1 3 num edge 3 ← 1 3 ← 2 3 ← 3 3 ← 4 3 ← 5 3 ← 6 3 ⇐ ∗ 1 2 0 1 2 1 7 num edge 4 ← 1 4 ← 2 4 ← 3 4 ← 4 4 ← 5 4 ← 6 4 ⇐ ∗ 1 2 0 1 2 1 7 num edge 5 ← 1 5 ← 2 5 ← 3 5 ← 4 5 ← 5 5 ← 6 5 ⇐ ∗ 1 1 0 1 1 0 4 num edge 6 ← 1 6 ← 2 6 ← 3 6 ← 4 6 ← 5 6 ← 6 6 ⇐ ∗ 0 0 0 0 0 0 0 num 0 1 0 0 1 1 3 Table 3: All 24 possible backward edges and their number. Here only shift moves of the form (x, y, z) ← (u, v, w) are considered, where the (unordered) base pair {v, w} ∈ s crosses the (unordered) base pair {x, y} ∈ t, where y < v. 42 B Minimal length pk-M S2 folding pathways This section provides details on the simple algorithms for pk-M S2 minimum length folding pathways for If s and t are (possibly pseudoknotted) structures each of the five types of paths depicted in Figure 3. on [1, n], and X ⊆ [1, n] is an equivalence class, then define the restriction of s [resp. t] to X, denoted by s (cid:22) X [resp. t (cid:22) X], to be the set of base pairs (i, j) in s [resp. t] such that i, j ∈ X. Each path or cycle in A ∪ B can be subdivided into the following five cases. Each equivalence class can be classified as one of five types of paths, depicted in Figure 3 described below. For this classification, we need to define End(s, X) = {x ∈ X : t[x] = 0} and End(t, X) = {x ∈ X : s[x] = 0} -- i.e. End(s, X) [resp. End(t, X)] is the set of elements x of X that belong to a base pair in s [resp. t], but the path cannot be extended because x is not touched by a base pair from t [resp. s]. For each type of path X, we present a (trivial) algorithm that returns the shortest M S2 folding trajectory from s (cid:22) X to t (cid:22) X. Additionally, we determine the relation between the pseudoknotted M S2 distance between s (cid:22) X and t (cid:22) X, denoted dX (s, t), as well as the Hamming distance, denoted dX An equivalence class X of size m is defined to be a path of type 1, if m is even, so path length is odd, and End(s, X) = 2. Let b0 = min(End(s, X)) and for 1 ≤ i < m/2, define ai+1 = s[bi] and bi = t[ai], as shown in Figure 3a. A minimum length sequence of M S2 moves to transform s (cid:22) X into t (cid:22) X is given by the following: pk−M S2 H (s, t). shift base pair (bi, ai) to (ai, bi+1) Path 1 subroutine 1. remove {bm/2, am/2} from s 2. for (m/2) − 1 down to 1 3. An alternate procedure would be to remove the first base pair {b1, a1} and perform shifts from left to right. Notice that if m = X = 2, then a path of type 1 is simply a base pair with the property that neither i nor j is touched by t. For arbitrary m, dX H (s, t) = m, and (s, t) = (cid:98) dX dX pk−M S2 An equivalence class X of size m is defined to be a path of type 2, if m is odd, so path length is even, and End(s, X) = 1 = End(t, X), and min(End(s, X)) < min(End(t, X)). Let b0 = min(End(s, X)) and for 1 ≤ i ≤ (cid:98)m/2(cid:99), define ai+1 = s[bi] and bi = t[ai], as shown in Figure 3b. A minimum length sequence of M S2 moves to transform s (cid:22) X into t (cid:22) X is given by the following: Path 2 subroutine 1. for i = (cid:98)m/2(cid:99) down to 1 2. shift base pair {bi−1, ai} to {ai, bi} (s, t) = dX (cid:99). Moreover, dX (s, t) = max(s (cid:22) X,t (cid:22) X). . The Hamming distance dX (s, t) = m/2, so dX pk−M S2 H (s,t) pk−M S2 pk−M S2 H (s,t) 2 2 (s, t) = (cid:98)m/2(cid:99), so dX (s, t) = (cid:98) dX H (s,t) (cid:99). Moreover, pk−M S2 H (s, t) = m, and dX (s, t) = max(s (cid:22) X,t (cid:22) X). The Hamming distance dX dX pk−M S2 An equivalence class X of size m is defined to be a path of type 3, if m is odd, so path length is even, and End(s, X) = 1 = End(t, X), and min(End(t, X)) < min(End(s, X)). Let a0 = min(End(t, X)) and for 1 ≤ i ≤ (cid:98)m/2(cid:99), define bi = t[ai−1] and ai = s[bi], as shown in Figure 3c. A minimum length sequence of M S2 moves to transform s (cid:22) X into t (cid:22) X is given by the following: Path 3 subroutine 1. for i = 1 to (cid:98)m/2(cid:99) 2. shift base pair {bi, ai} to {ai−1, bi} pk−M S2 2 H (s,t) pk−M S2 (cid:99). Moreover, dX (s, t) = max(s (cid:22) X,t (cid:22) X). H (s, t) = m, and pk-M S2 distance dX The Hamming distance dX (cid:98) dX 2 An equivalence class X of size m is defined to be a path of type 4, if m is even, so path length is odd, and End(t, X) = 2. Let a1 = min(End(t, X)) and for 2 ≤ i < m/2, define ai+1 = s[bi] and for 1 ≤ i ≤ m/2, define bi = t[ai], as shown in Figure 3d. A minimum length sequence of M S2 moves to transform s (cid:22) X into t (cid:22) X is given by the following: Path 4 subroutine 1. for i = 1 to m/2 − 1 pk−M S2 pk−M S2 (s, t) = (s, t) = (cid:98)m/2(cid:99), so dX 43 shift base pair {bi, ai+1} to {ai, bi} pk−M S2 pk−M S2 H (s, t) = m, and dX (s, t) = max(s (cid:22) X,t (cid:22) X). 2. 3. add base pair {am/2, bm/2} Notice that if m = 2, then a path of type 4 is simply a base pair (i, j) ∈ t, with the property that neither i nor j is touched by s. The Hamming distance dX . Moreover, dX An equivalence class X of size m is defined to be a path of type 5, if it is a cycle, i.e. each element x ∈ X is touched by both s and t. Since base triples are not allowed due to condition 2 of Definition 3, cycles have only even length, and so X is also even. Let a1 = min(X), and for 1 ≤ i ≤ m/2, define bi = t[ai], and for 2 ≤ i ≤ m/2, define ai = s[bi−1], as shown in Figure 3e. A minimum length sequence of M S2 moves to transform s (cid:22) X into t (cid:22) X is given by the following: Path 5 subroutine 1. remove base pair {bm/2, a1} 2. for i = 1 to m/2 − 1 3. 4. add base pair {am/2, bm/2} shift base pair {bi, ai+1} to {ai, bi} (s, t) = m/2, so dX (s, t) = dX pk−M S2 H (s,t) 2 pk−M S2 pk−M S2 pk−M S2 (s, t) = (cid:98) dX (s, t) = m/2 + 1, so dX H (s, t) = m, and dX (cid:99) + 1. (s, t) = max(s (cid:22) X,t (cid:22) X). Note that any base pair could have initially been removed In summary, pk-M S2 distance between s (cid:22) X and t (cid:22) X for any maximal path (equivalence class) X is (cid:99); in contrast, pk-M S2 distance between s (cid:22) X and t (cid:22) X for any (cid:99) if and only if there are no The Hamming distance dX Moreover, dX from s, and by relabeling the remaining positions, the same algorithm would apply. equal to Hamming distance (cid:98) dH (s(cid:22)X,t(cid:22)X) cycle X is equal to (cid:98) dH (s(cid:22)X,t(cid:22)X) type 5 paths, thus establishing equation (14. Now let B1 [resp. B2] denote the set of positions of all type 1 paths [resp. type 4 paths] of length 1 -- i.e. positions incident to isolated green [resp. red] edges that correspond to base pairs (i, j) ∈ s where i, j are not touched by t [resp. (i, j) ∈ t where i, j are not touched by s]. As well, let B0 designate the set of positions in B not in either B1 or B2. Note that B1 ⊆ B and B2 ⊆ B, and that formally (cid:99) + 1. It follows that dpk−M S2 (s, t) = (cid:98) dH (s,t) H (s,t) 2 2 2 2 B0 = B − (B1 ∪ B2) B1 = {i ∈ [1, n] : ∃j [{i, j} ∈ s, t(i) = 0 = t(j)] B2 = {i ∈ [1, n] : ∃j [{i, j} ∈ t, s(i) = 0 = s(j)] (26) (27) (28) Note that B1 and B2 have an even number of elements, and that all elements of B − B1 − B2 are incident to a terminal edge of a path of length 2 or more. Correspondingly, define BP1 and BP2 as follows: BP1 = {(i, j) ∈ s : t[i] = 0 = t[j]} BP2 = {(i, j) ∈ t : s[i] = 0 = s[j]} (29) (30) Note that BP1 = B1/2 and BP2 = B2/2. The following is a restatement of Lemma 8. Lemma 16. Let s, t be two arbitrary pseudoknotted structures for the RNA sequence a1, . . . , an, and let X1, . . . , Xm be the equivalence classes with respect to equivalence relation ≡ on A ∪ B0 = [1, n] − B1 − B2 − C − D. Then the pk-M S2 distance between s and t is equal to Alternatively, if X1, . . . , Xm are the equivalence classes on A ∪ B = [1, n] − C − D, then m(cid:88) i=1 m(cid:88) i=1 (cid:16)s (cid:22) Xi,t (cid:22) Xi(cid:17) (cid:16)s (cid:22) Xi,t (cid:22) Xi(cid:17) BP1 + BP2 + max dpk−M S2(s, t) = max 44 C Branch-and-bound algorithm In this section, we present pseudocode for an exact and exhaustive branch-and-bound search strategy [7] to determine a shortest M S2 folding trajectory between two given secondary structures of a given RNA sequence. First base pairs in BP1 and BP3 are removed from s to obtain the root structure. Starting from the root we perform removal and shift of base pairs until the target or an empty structure is achieved. For each state Si, we have the distance dist from the root to Si. Furthermore, we compute a lower bound lb for the M S2 distance from Si to the target structure by calculating the M S2 distance allowing pseudoknots. The optimistic M S2 distance from the source to target is estimated as dist + lb. If the optimistic distance is higher than the incumbent M S2 distance computed so far, the search is stopped and a different state is considered. In order to prune the search tree more effectively, base pairs that cause more conflicts are considered first. Finally, if an empty structure is achieved we compute the list of remaining moves for s. In algorithm 1 we describe a branch and bound algorithm for computing the M S2 distance between two RNA secondary stuctures s and t. First base pairs in BP1 and BP3 are removed from s to obtain the root structure. Starting from the root we perform removal and shift of base pairs until the target or an empty structure is achieved. For each state Si, we have the distance dist from the root to Si. Furthermore, we compute a lower bound lb for the M S2 distance from Si to the target structure by calculating the M S2 distance allowing pseudoknots. The optimistic M S2 distance from the source to target is estimated as dist + lb. If the optimistic distance is higher than the incumbent M S2 distance computed so far, the search is stopped and a different state is considered. In order to prune the search tree more effectively, base pairs that cause more conflicts are considered first. Finally, if an empty structure is achieved we compute the list of remaining moves for s. D Greedy algorithm For a digraph G = (V, E), in this section, we present the pseudocode for a staightforward greedy algorithm to determine a (possibly non-maximal) vertex subset V ⊂ V such that the induced subgraph H = (V , E) contains no directed cycles, where E = E ∩ (V × V ). Nevertheless, in the following greedy algorithm, it is necessary to first generate a list of all (possibly exponentially many) directed cycles. This computational overhead is sidestepped by the near-optimal algorithm in the next section. Algorithm 17 (Greedy approximation of M S2 distance from s to t). Input: Secondary structures s, t for RNA sequence a1, . . . , an Output: Greedy M S2 folding trajectory s = s0, s1, . . . , sm = t, where s0, . . . , sm are secondary structures, m is the minimum possible value for which si is obtained from si−1 by a single base pair addition, removal or shift for each i = 1, . . . , m. First, initialize the variable numMoves to 0, and the list moveSequence to the empty list [ ]. Define BP1 = {(x, y) : (x, y) ∈ t, (t − s)[x] = 0, (t − s)[y] = 0}; i.e. BP1 consists of those base pairs in s which are not touched by any base pair in t. Define BP2 = {(x, y) : (x, y) ∈ t, (s − t)[x] = 0, (s − t)[y] = 0}; i.e. BP2 consists of those base pairs in t which are not touched by any base pair in s. Bear in mind that s is constantly being updated, so actions performed on s depend on its current value. //remove base pairs from s that are untouched by t for (x, y) ∈ BP1 1. 2. remove (x, y) from s; numMoves = numMoves+1 //define conflict digraph G = (V, E) on updated s and unchanged t define V by equation (16) define E by equation (17) define conflict digraph G = (V, E) 3. 4. 5. 6. C = {C1, . . . , Cm} //list of all simple directed cycles in G //determine set V0 of vertices to remove so that restriction of G to V − V0 is acyclic 7. V0 = ∅ //V0 is set of vertices to be removed from V 8. 9. for v ∈ V Cv = {C ∈ C : v ∈ C} 45 Algorithm 1 Branch and bound algorithm for M S2 distance Input: Two RNA secondary structures s and t with length n Output: Minimum number of M S2 moves in the path from s to t 1: BP1 is the set of base pairs (i, j) ∈ s such that neither i nor j is touched by any base pair of t BP2 is the set of base pairs (i, j) ∈ t such that neither i nor j is touched by any base pair of s BP3 is the set of base pairs (i, j) ∈ t, s V = {(x, y, z) : 1 ≤ x, y, z ≤ n; t[b] = a; s[b] = c} 2: remove base pairs in BP1 ∪ BP3 from s 3: remove base pairs in BP2 ∪ BP3 from t 4: for v ∈ V compute nv the the number of crossings between v.s and all base pairs in t 5: sort V in decreasing order by nv 6: best = base pair distance between s and t 7: curdist = 0 8: define a data structure state = {s, t, dist, lb, rm, ad, sh} representing a node in the search tree. (cid:46) in worst case only M S1 moves are used (cid:46) distance between s and current state cs s and t represent the structures in the current state; dist is the M S2 distance from the root;lb is the lower bound for the M S2 distance from s to t for all paths passing through the current state cs; rm, ad and sh are respectively the lists of removals, additions and shifts performed from the root to obtain the current state. (cid:46) state with smallest lower bound cs.lb will be poped (cid:46) current state is a leaf (cid:46) current state is a leaf (cid:46) current state is an internal node Sol = cs best = cs.dist else if (t has no base pairs) then cs = Q.pop() if (cs.lb < best) then if (s has no base pairs) then R = set of base pairs in t cs.ad = cs.ad ∪ R cs.dist = cs.dist + R if (cs.dist < best) then 9: root = state(s, s, best, 0, [ ], [ ], [ ]) 10: define priority queue Q containing states S1, ..., Sm, ordered by Si.lb 11: Q = {root} 12: while (Q is not empty) do 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: R = set of base pairs in s cs.rm = cs.rm ∪ R cs.dist = cs.dist + R if (cs.dist < best) then Sol = cs best = cs.dist else let M be the list of possible shift moves and removals that can be applied to current state cs for m ∈ M do if (m is a shift) then apply move m to s l = optimal number of moves to go from s to t passing through cs + m and allowing pseudoknots if (l < best) then nt = t − m.t ns = s − m.s newState = state(ns, nt, cs.dist + 1, l, cs.rm, cs.ad, cs.sh + m) ns = s − m newState = state(ns, cs.t, cs.dist + 1, l, cs.rm + m, cs.ad, cs.sh) (cid:46) remove the resolved base pair from t (cid:46) remove the resolved base pair from s (cid:46) remove the resolved base pair from s else if (m is a removal) then 42: 43: f inalP ath = BP1 + Sol.rm + Sol.sh + Sol.add + BP2 Q = Q ∪ newState 46 10. 11. 12. 13. 14. 15. 16. 17. 18. while C (cid:54)= ∅ v0 = argmaxvCv //v0 belongs to largest number of cycles V0 = V0 ∪ {v0} V = V − {v0} E = E − {(x, y) : x = v0 ∨ y = v0} G = (V, E) //induced subgraph obtained by removing v0 C = C − Cv0 // remove all cycles containing v0 v0 = (x, y, z) //unpack v0 to obtain base pairs {x, y}< ∈ t, {y, z}< ∈ s s = s − {(min(y, z), max(y, z))} //topological sort of the now acyclic digraph G = (V, E) for updated V, E topological sort of G using DFS [7] to obtain total ordering ≺ on V for v = (x, y, z) ∈ V in topologically sorted order ≺ 19. 20. 21. 22. 23. //check if shift would create a base triple, as in type 1,5 paths from Figure 3 of main text if s[x] = 1 //i.e. {u, x} ∈ s for some u ∈ [1, n] remove {u, x} from s; numMoves = numMoves+1 shift {y, z} to {x, y} in s; numMoves = numMoves+1 //remove any remaining base pairs from s that have not been shifted from BP2 and type 4,5 paths in Figure 3 of main text 24. 25. 26. 27. 28. for (x, y) ∈ s − t //add remaining base pairs from t−s, e.g. for (x, y) ∈ t − s remove (x, y) from s; numMoves = numMoves+1 add (x, y) to s; numMoves = numMoves+1 return folding trajectory, numMoves We now analyze the time and space complexity of the greedy algorithm. In line 6, Johnson's algorithm [21] is used to enumerate all simple directed cycles, resulting in run time O((V + E) · (C + 1)), where V [resp. E] denotes the number of vertices [resp. edges] of the initial conflict digraph G, and C denotes the number of directed cycles of G. Let M = C denote the number of directed cycles in C, and let N = O(V · M ) denote the total number of vertices (counting duplicates) in the set of all simple directed cycles C = {C1, . . . , CM}. Lines 7 through 28 require O(N ) time and space, provided that one introduces the data structures A1, A2, A3, A4, defined by as follows: A1[v] = {C ∈ C : v ∈ C} A2[v] = {k ∈ {1, . . . ,C} : Ck ∈ C ∧ v ∈ Ck} A3[k] = {v ∈ V : v ∈ Ck} if Ck ∈ C else (cid:26) 1 A4[k] = 0 In other words, A1 is a linked list of size V , where A1[v] equals the (current) number of cycles to which v belongs (in line 13, the node A1[v] is deleted from the linked list); A2 is an array of size V , where A2[v] is a linked list of indices k of cycles Ck that contain vertex v (note that the size of linked list A2[i] is A1[i]); A3 is an array of size the number C of cycles, where A3[k] is a linked list of vertices v that belong to Ck; A4 is an array of size the number C of cycles, where A4[k] is a a boolean value (true/false), depending on whether the cycle Ck currently belongs to C (used to implement line 16). Details are left to the reader, or can be gleaned from reading our publicly available source code. It follows that the run time complexity of Algorithm 17 is O((V + E) · (C + 1)) with space complexity of O(V · (C + 1) + E). E Graph theoretical properties E.1 Representable digraphs Recall that digraph G = (V, E) is isomorphic to digraph G(cid:48) = (V (cid:48), E(cid:48)) if there is a bijective function (i.e. one-one and onto) Φ : V → V (cid:48), such that for all u, v ∈ V , (u, v) ∈ E if and only if (Φ(u), Φ(v)) ∈ E(cid:48). Since RNA conflict digraphs have a natural ordering of vertices defined in Definition 11, we now define digraph order-isomorphism. 47 Definition 18 (Order-isomorphism). Let G = (V, E,(cid:22)) [resp. G(cid:48) = (V (cid:48), E(cid:48),(cid:22)(cid:48))] be a digraph, whose vertex set V [resp. V (cid:48)] is totally ordered by (cid:22) [resp. (cid:22)(cid:48)]. We say that G is order-isomorphic to G(cid:48) if there exists an order-preserving bijective function Φ : V → V (cid:48) (i.e. one-one and onto) such that (1) for u, v ∈ V , x (cid:22) y if and only if Φ(u) (cid:22)(cid:48) Φ(v), (2) for u, v ∈ V , (u, v) ∈ E) if and only if (Φ(u), Φ(v)) ∈ E(cid:48). If Φ is an injective function (one-one, but not necessarily onto), then G is said to have an order-preserving embedding in G(cid:48). We say that a digraph G = (V, E) is representable if it is order-isomorphic to an RNA conflict digraph, formally defined as follows. Definition 19 (Representable digraph). Let V = {1, . . . , n} be a set of vertices and E a set of directed edges on V . The digraph G = (V, E) is said to be representable if there exist secondary structures s, t of some RNA sequence a1, . . . , am, an integer N , and an order-preserving function Φ : [1, n] → [1, N ]3 such that (1) for v, v(cid:48) ∈ [1, n], x < y if and only if Φ(v) < Φ(v(cid:48)), (2) for each v ∈ [1, n], Φ(v) = (x, y, z) where x, y, z are distinct, {x, y}< ∈ t, {y, z}< ∈ s, (3) there is an edge u → v in E if and only if Φ(u).s = {y, z}< ∈ s touches or crosses Φ(v).t = {x, y}< ∈ t. As just defined, the notion of representability depends on the nucleotide sequence a1, . . . , an. In a mathematical investigation to determine which digraphs are representable, it is more natural to reinterpret the notion of secondary structure to satisfy requirements 2-4 of Definition 3, but not necessarily requirement 1. The requirement that mapping Φ be order-preserving is important. Consider the RNA conflict digraph G in Figure 21, equivalent to the ordered digraph in Figure 25a, having edges 1 → 2 → 3 → 4 → 1. Clearly G is isomorphic to the digraph G(cid:48) in Figure 25b, although there is no order-isomorphism between G and G(cid:48). Indeed, by writing a program to exhaustively enumerate all representable digraphs having a vertex set of size 4, we know that G(cid:48) is not order-isomorphic to any RNA conflict digraph. It is a straightforward exercise to show that each of the 2(3 2) = 8 many tounaments on 3 nodes is representable (data not shown); however, not all 2(4 2) = 64 many tournaments on 4 nodes are representable, as shown in Figure 25c. Although representability is not invariant under isomorphism, it clearly is invariant under order-isomorphism. Moreover, we have the following. Theorem 20. Suppose that Φ is an order-preserving embedding of digraph G = (V, E) into digraph G(cid:48) = (V (cid:48), E(cid:48)). If G is not representable, then G(cid:48) is not realizable. The theorem is immediate, since if G(cid:48) were order-isomorphic to an RNA conflict digraph, then the induced subgraph Φ(G) of G(cid:48) must be representable, and hence G must be representable. Figure 26a depicts a nonrepresentable digraph having 4 vertices and 4 edges. By adding an edge to that figure, we obtain the digraph in Figure 26b, which is not representable. Recall that an automorphism of a directed graph G = (V, E) is the set of permutations σ on n letters, for V = {1, . . . , n}, such that G and σ(G) are isomorphic. Using a small program that we wrote to compute the automorphism group Aut(G) for any connected, directed graph G = (V, E), we found that the digraphs in Figures 25c and 26b both have the trivial automorphism group consisting only of the identity permuta- tion on 4 letters. Since the former is not representable and the latter is representable, it follows that the automorphism group of a digraph implies nothing about whether the digraph is representable. E.1.1 Example of RNA conflict digraphs Computation time for the IP algorithm 14 is dominated by the time to generate a list of all simple cycles and the time to obtain an IP solution satisfying the FVS problem (†) as well the constraints (‡) that ensure that shift moves cannot be applied if they share same base pair from s or t. This raises the question whether the FVS problem is polynomial time solvable for RNA conflict digraphs. We cannot settle this open question, but provide examples of RNA conflict digraphs that indicate the there is no reduction to known cases for which the FVS problem has been resolved to be NP-complete or polynomial time computable. Figure 21 depicts a 4-cycle digraph that is order-isomorphic to the digraph with edges 1 → 2 → 3 → 4 → 1. Figure 22a shows the complete bipartite graph K3,3. Recall that in [24], Kuratowski proved that a graph is planar if and only if it does not contain a subgraph that is a subdivision of K3,3 or the complete graph K5; i.e. does not contain an embedded copy of one of the forbidden graphs K3,3 or K5. Figure 22b depicts a copy of 48 K3,3 with directed edges, which is realized in the RNA conflict digraph shown in Figure 23. It follows from Kuratowski's theorem that RNA conflict digraphs are not planar in general. Figure 22c depicts a forbidden digraph, with the property that a flow graph (graphical representation of code in a programming language with possible goto-statements) is reducible if and only if the flow graph does not contain a copy of this forbidden digraph (or related digraph where the edges of Figure 22c may be replaced by arc-disjoint paths) [19]. Figure 24 shows an RNA conflict digraph which represents the forbidden digraph of Figure 22c. It follows that RNA conflict digraphs are not reducible flow graphs in general. Two classes of digraphs for which FVS is known to be polynomial time computable are: (1) planar digraphs [26], and (2) reducible flow graphs [34]. On the other hand, FVS is NP-complete for general digraphs [22], for tournaments [4, 1], and for Eulerian digraphs [30]. It is a simple exercise, left to the reader, to show that each of the 2(3 2) = 8 tournaments on 3 vertices can be represented by an RNA conflict digraph. Proposition 21. All tournaments on a graph having 3 vertices can be represented as RNA conflict digraphs. There are 2(n 2) many tournaments on n vertices. By applying constraint programming to each of the 26 = 64 tournaments on 4 vertices, we found a number of tournaments that are not representable as conflict digraphs. Figure 25a depicts a 4-cycle which is representable by the RNA conflict digraph represented in Figure 21. Figure 25b depicts a simple, connected digraph on 4 nodes (a cycle) which is not representable as a conflict digraph, and Figure 25c shows a tournament on 4 nodes which is not representable. The FVS problem is known to be NP-complete for all tournaments, all Eulerian digraphs and for general digraphs, and there are polynomial time algorithms for FVS for planar digraphs and for flow graphs. Ex- amples we have provided suggest that there is no straightforward application of known results to settle the question whether the FVS problem is NP-complete for the class of RNA conflict digraphs. Question 22. Is the FVS problem polynomial time computable or NP-complete for the collection of RNA conflict digraphs? Using constraint programming, we determined which connected digraphs on 4 nodes could be represented as RNA conflict digraphs. This was done by considering all partition of [1, 12] into four classes, each class corresponding to a triplet node (x, y, z) and determining the resulting edge relations defined by whether a base pair from s belonging to node v crosses a base pair from t belonging to node v(cid:48). Is there a better approach? Question 23 (Representation of arbitrary G = (V, E) as conflict digraph). Is there an efficient algorithm to determine whether the labeled digraph G = (V, E) can be realized as an RNA conflict digraph, where G = (V, E) is given as input. The following is perhaps tractable. Question 24. Is there an efficient algorithm to determine whether a given labeled digraph G = (V, E) can be realized as an RNA conflict digraph, the vertices of G are totally ordered by v1 < ··· < vn, and each vertex is labeled by one of the node types 1,. . . ,6. Even if the preceding problem has a polynomial time solution, it is not clear whether the same is true for the following slight generalizations. Question 25. Is there an efficient algorithm to determine whether the labeled digraph G = (V, E) can be realized as an RNA conflict digraph, where vertices of D are totally ordered by v1 < ··· < vn. Question 26. Is the feedback arc set (FAS) problem complete for RNA conflict digraphs? Is the problem of computing M S2 distance between arbitrary secondary structures s, t NP-complete? Since a digraph G is planar if and only if it contains neither the complete graph K5 on 5 vertices nor the complete bipartite graph K3,3, so Theorem 20 suggests the following question. Question 27. Is there a finite set of prohibited digraphs H1, . . . , Hr such that a digraph G is representable by an RNA conflict digraph if and only if there is no order-preserving embedding of Hi into G for any i = 1, . . . , r. 49
1307.2536
1
1307
2013-07-09T18:24:09
Greedy Online Bipartite Matching on Random Graphs
[ "cs.DS" ]
We study the average performance of online greedy matching algorithms on $G(n,n,p)$, the random bipartite graph with $n$ vertices on each side and edges occurring independently with probability $p=p(n)$. In the online model, vertices on one side of the graph are given up front while vertices on the other side arrive sequentially; when a vertex arrives its edges are revealed and it must be immediately matched or dropped. We begin by analyzing the \textsc{oblivious} algorithm, which tries to match each arriving vertex to a random neighbor, even if the neighbor has already been matched. The algorithm is shown to have a performance ratio of at least $1-1/e$ for all monotonic functions $p(n)$, where the performance ratio is defined asymptotically as the ratio of the expected matching size given by the algorithm to the expected maximum matching size. Next we show that the conventional \textsc{greedy} algorithm, which assigns each vertex to a random unmatched neighbor, has a performance ratio of at least 0.837 for all monotonic functions $p(n)$. Under the $G(n,n,p)$ model, the performance of \textsc{greedy} is equivalent to the performance of the well known \textsc{ranking} algorithm, so our results show that \textsc{ranking} has a performance ratio of at least 0.837. We finally consider vertex-weighted bipartite matching. Our proofs are based on simple differential equations that describe the evolution of the matching process.
cs.DS
cs
Greedy Online Bipartite Matching on Random Graphs∗ Andrew Mastin†, Patrick Jaillet‡ August 13, 2018 3 1 0 2 l u J 9 ] S D . s c [ 1 v 6 3 5 2 . 7 0 3 1 : v i X r a Abstract We study the average performance of online greedy matching algorithms on G(n, n, p), the random bipartite graph with n vertices on each side and edges occurring independently with probability p = p(n). In the online model, vertices on one side of the graph are given up front while vertices on the other side arrive sequentially; when a vertex arrives its edges are revealed and it must be immediately matched or dropped. We begin by analyzing the oblivious algorithm, which tries to match each arriving vertex to a random neighbor, even if the neighbor has already been matched. The algorithm is shown to have a performance ratio of at least 1 − 1/e for all monotonic functions p(n), where the performance ratio is defined asymptotically as the ratio of the expected matching size given by the algorithm to the expected maximum matching size. Next we show that the conventional greedy algorithm, which assigns each vertex to a random unmatched neighbor, has a performance ratio of at least 0.837 for all monotonic functions p(n). Under the G(n, n, p) model, the performance of greedy is equivalent to the performance of the well known ranking algorithm, so our results show that ranking has a performance ratio of at least 0.837. We finally consider vertex-weighted bipartite matching. Our proofs are based on simple differential equations that describe the evolution of the matching process. 1 Introduction In the online bipartite matching problem, we are given a bipartite graph G = (I, J, E) where I is a set of n bins and J is a set of n balls. Balls arrive in an online fashion; when a ball j ∈ J arrives, its edges are revealed and it must either be matched with an unmatched neighboring bin or dropped (left unmatched). Each bin may be matched to at most one ball and decisions are irrevocable. The goal is to maximize the number of matched balls. The problem has received significant attention due to applications in Internet advertising as well as under streaming models of computation, which places limits on memory utilization for processing large datasets [16, 19, 9] . From a worst-case perspective, it is well known that the greedy algorithm, which matches each ball to a random unmatched neighboring bin (if possible), always achieves a matching size that is at least as large as 1/2 of the size of the maximum matching. The ranking algorithm of Karp, Vazirani, and Vazirani picks a random permutation of bins up front and matches each ball to its unmatched neighboring bin that is ranked highest in the permutation [13]. ranking guarantees a matching size at least 1 − 1/e of the size of the maximum matching in expectation, which is the best possible worst-case guarantee. ∗Research supported in part by NSF grant 1029603 and ONR grant N00014-12-1-0033. The first author is supported in part by a NSF graduate research fellowship. †Laboratory for Information and Decision Systems, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, Cambridge, MA 02139, USA; [email protected] ‡Laboratory for Information and Decision Systems, Department of Electrical Engineering and Computer Science and Operations Research Department, Massachusetts Institute of Technology, Cambridge, MA 02139, USA; [email protected] Surprisingly, the average-case performance of these algorithms has been largely overlooked. In this paper we study the performance of greedy-type algorithms under the conventional G(n, n, p) model, where we are given a bipartite graph with n vertices on each side and where each potential edge (i, j) ∈ I × J occurs independently with probability p. We are interested in the asymptotic behavior of the matching sizes obtained by these algorithms for monotonic functions p = p(n). We will focus on functions of the form p(n) = c/n for some constant c > 0, which we will show is the region where greedy algorithms are most sensitive to p(n). We start by analyzing the oblivious algorithm, which has knowledge of a ball's edges when it arrives but does not know which neighboring bins are occupied. The algorithm picks a random neighboring bin; if the bin is unmatched, then the ball is matched, otherwise it is dropped. This rule models load balancing scenarios where a central server knows which machines can process a given job, but is not aware of the machine availability. Next we analyze greedy and ranking, showing that under the G(n, n, p) model, the performance of the two algorithms is equivalent. Finally, we extend our analysis to the vertex-weighted matching problem, where each bin has a weight and the greedy algorithm matches each ball to the available neighboring bin with largest weight. Our proofs employ differential equations that describe the evolution of the number of matched bins throughout the arrival process. The differential equations are easily obtained by calculating the expected change in number of occupied bins upon the arrival of each ball. As n → ∞, this gives a deterministic differential equation and solution. The solution is shown to closely model the stochastic behavior due to a general result of Wormald [21]. We believe that this is one of the most simple applications of Wormald's theorem. In fact, our proofs are nearly as simple as the worst-case proof for ranking of Devanur, Jain, and Kleinberg [5]. In the remainder of this section we briefly state our main results for the oblivious and greedy algorithms and discuss related work. The analysis of oblivious and greedy is given in Section 2. We extend the analysis to vertex-weighted matching in Section 3 and a conclusion is given in Section 4. 1.1 Results. Let µA(n, n, p(n)) denote the matching size (number of matched balls) obtained by some algorithm A on the graph G(n, n, p) where p = p(n); likewise define the maximum matching size as µ∗(n, n, p(n)). Define a valid function p(n) as a function that for all n > 0, is monotonic and satisfies 0 < p(n) < 1 (thus implying that 0 ≤ limn→∞ p(n) ≤ 1). We show expressions for the matching sizes obtained by the algorithms that hold asymptotically almost surely (a.a.s., meaning with probability 1 − o(1)), as well as bounds on the performance ratio. Define the performance ratio for algorithm A given p(n) as RA(p(n)) := lim n→∞ E[µA(n, n, p(n))] E[µ∗(n, n, p(n))] . (1.1) The performance ratio is essentially the analog of the competitive ratio adapted for average-case analysis. Throughout the rest of the paper, we define γ∗ = γ∗(c) as the smallest root of the equation x = c exp(−ce−x), and γ∗ = γ∗(c) = ce−γ∗ . Our results for oblivious and greedy are listed as follows. Theorem 1. Let µO(n, n, c/n) denote the matching size obtained by the oblivious algorithm on the graph G(n, n, p), where p = c/n and c > 0 is a constant. Then a.a.s., µO(n, n, c/n) n = 1 − e(e−c−1) + o(1). (1.2) Theorem 2. The performance ratio RO(p(n)) of oblivious on G(n, n, p), for all valid functions p = p(n), satisfies RO(p(n)) = 1, RO(p(n)) ≥ RO(p(n)) = 1 − 1 e , c − ce(e−c−1) 2c − (γ∗ + γ∗ + γ∗γ∗) p(n) = o(1/n), , p(n) = c/n, p(n) = ω(1/n). (1.3) Corollary 1. The performance ratio of oblivious on G(n, n, p) for all valid functions p = p(n) satisfies RO(p(n)) ≥ 1 − . (1.4) 1 e Theorem 3. Let µG(n, n, c/n) denote the matching size obtained by the greedy algorithm on the graph G(n, n, p), where p = c/n and c > 0 is a constant. Then a.a.s., µG(n, n, c/n) n = 1 − log(2 − e−c) c + o(1). (1.5) Theorem 4. The performance ratio RG(p(n)) of greedy on G(n, n, p), for all valid functions p = p(n), satisfies RG(p(n)) = 1, RG(p(n)) ≥ RG(p(n)) = 1, c − log(2 − e−c) 2c − (γ∗ + γ∗ + γ∗γ∗) p(n) = o(1/n), , p(n) = c/n, p(n) = ω(1/n). (1.6) Corollary 2. The performance ratio of greedy on G(n, n, p) for all valid functions p = p(n) satisfies RG(p(n)) ≥ 0.837. (1.7) 1.2 Related work. The online matching problem was originally analyzed by Karp, Vazirani and Vazirani, who introduced the ranking algorithm and showed that it obtains a competitive ratio of 1 − 1/e [13]. Simpler proofs of the ranking algorithm have since been found [5, 3]. A 1 − 1/e competitive algorithm is also known for vertex-weighted online bipartite matching, which was given by Aggarwal, Goel, Karande, and Mehta [1]. The use of deterministic differential equations to model random processes was first studied by Kurtz, who gave a general purpose theorem for continuous-time jump Markov processes [15]. A discrete-time theorem tailored for random graphs was given by Wormald, which we use in this paper [20, 21]. The differential equation method has been used to study a variety of graph properties including k-cores, independent sets, and greedy packing on hypergraphs [18, 20, 21]. It was also used to analyze a load balancing scenario similar to ours by Mitzenmacher [17]. Early studies of matchings on random graphs focused on determining the existence of perfect matchings; Erdos and R´enyi showed that the threshold for the existence of a perfect matching occurs when the graph is likely to have a minimum degree of one [7, 8]. One of the first studies of greedy matchings on random graphs, as well as the first to employ the differential equation method (specifically via Kurtz's theorem), was the work of Karp and Sipser [12, 15]. They considered ordinary sparse graphs, specifically the G(n, p) model1 with p = c/n. The Karp-Sipser algorithm first matches all vertices with degree one until there are no such vertices remaining, and then obtains matches by selecting random edges. This results in a matching size that is within 1 − o(1) of the maximum matching. The algorithm was studied more in depth by Aronson, Frieze, and Pittel, who gave sharper error bounds on performance [2]. Simpler greedy matching algorithms for ordinary graphs were studied by Dyer, Frieze, and Pittel [6]. Again for the G(n, p) model with p = c/n, they looked at the greedy algorithm which picks random edges, as well as what they refer to as modified greedy, which first picks a random vertex and then selects a random connected edge. They showed that as n → ∞, the matching sizes obtained by the two algorithms follow a normal distribution with mean and variance determined by c. It is interesting to note that the expected fraction of matched vertices for their modified greedy algorithm is exactly the result of our greedy algorithm with a multiplicative factor of 1/2. Indeed, modified greedy is a natural analog of greedy for ordinary graphs, although their result was obtained using a combinatorial approach completely different from our method. 2 Analysis Let the graph G(n, n, p) be generated by the following discrete random graph process. Initially at t = 0, we are given the set of bin vertices I, where I = n. At each time step t > 0, a ball vertex j ∈ J arrives and all of its neighboring edges are revealed. Each neighboring edge occurs with a probability p(n) independently of all other edges. After n steps an instance of the graph G(n, n, p) is obtained. We introduce Wormald's theorem using notation consistent with [21]. Consider a discrete-time process with the probability space Ω, which has elements (q0, q1, . . . , qT ), where each qk, 0 ≤ k ≤ T , takes values in a set S. A sequence ht = (q0, q1, . . . , qt) up to time t is referred to as the history of the process. Define a sequence of random processes over n = 1, 2, . . ., so that we have S = S(n) and qt = q(n) . Let S(n)+ denote the set of all histories ht = (q0, . . . qt), 0 ≤ t ≤ T , where qk ∈ S(n), 0 ≤ k ≤ t. The following is the general theorem of Wormald for justifying the use of differential equations on random graph processes [21]. The theorem is stated for a multidimensional process (i.e. a > 1), but we will need to go beyond one dimension only for the analysis of vertex-weighted matching. Note that in part (iii), a Lipschitz condition is satisfied for a function f (u) on the domain D if there exists a constant L > 0 satisfying t f (u) − f (v) ≤ Lu − v∞ (2.8) for all u, v ∈ D. Theorem 5. (Wormald [21]) For 1 ≤ ℓ ≤ a, where a is fixed, let y(ℓ) : S(n)+ → R and fℓ : R(a+1) → R, such that for some constant C0 and all ℓ, y(ℓ)(ht) < C0n for all ht ∈ S(n)+ for all n. Let Yℓ(t) denote the random variable for yℓ(ht). Assume the following three conditions hold, where D is some bounded connected open set containing the closure of {(0, z1, . . . , za) : P(Yℓ(0) = zℓn, 1 ≤ ℓ ≤ a) 6= 0 for some n}, (2.9) and TD is a stopping time for the minimum t such that (t/n, Y1(t)/n, . . . , Ya(t)/n) /∈ D. (i) (Boundedness hypothesis.) For some function β = β(n) ≥ 1 max 1≤ℓ≤a Yℓ(t + 1) − Yℓ(t) ≤ β, (2.10) for t < TD. 1The G(n, p) random graph has n vertices and an edge occurring between each pair of vertices independently with probability p. (ii) (Trend hypothesis.) For some function λ1 = λ1(n) = o(1), for all 1 ≤ ℓ ≤ a E[Yℓ(t + 1) − Yℓ(t)Ht] − fℓ(t/n, Y1(t)/n, . . . , Ya(t)/n) ≤ λ1 (2.11) for t < TD. (iii) (Lipschitz hypothesis.) Each function fℓ is continuous, and satisfies a Lipschitz condition, on D ∩ {(t, z1, . . . , za) : t ≥ 0}, (2.12) with the same Lipschitz constant for each ℓ. Then the following are true. (a) For (0, z1, . . . , za) ∈ D the system of differential equations ∂zℓ ∂τ = fℓ(τ, z1, . . . , za), 1 ≤ ℓ ≤ a has a unique solution in D for zℓ : R → R passing through zℓ(0) = zℓ, 1 ≤ ℓ ≤ a and which extends to points arbitrarily close to the boundary of D; (2.13) (2.14) (b) Let λ > λ1 with λ = o(1). For a sufficiently large constant C, with probability 1 − O( β λ exp (− nλ3 β3 )), Y (ℓ) t = nzℓ(t/n) + O(λn) (2.15) uniformly for 0 ≤ t ≤ σn and for each ℓ, where zℓ(τ ) is the solution in (a) with zℓ = 1 n Yℓ(0), and σ = σ(n) is the supremum of those τ to which the solution can be extended before reaching within ℓ∞-distance Cλ of the boundary of D. The stopping time TD is needed for situations where at some point the Lipschitz condition fails, as often happens near the end of some graph processes. This problem does not arise in our application. We will use the following identity to satisfy the trend hypothesis of Wormald's theorem. Lemma 1. For n > 0, c ≤ n/2, and 0 ≤ w ≤ 1, 0 ≤ e−cw −(cid:16)1 − c n(cid:17)nw ≤ c ne . (2.16) Proof. Using the inequalities 1 − x ≥ e−x−x2 for x ≤ 1/2 and 1 − x ≤ e−x for x ≥ 0, we obtain e−cw(cid:16)1 − c2w n (cid:17) ≤(cid:0)1 − c n(cid:1)nw ≤ e−cw. The result follows by rearranging terms and using cwe−cw ≤ 1/e. (cid:3) For bounding the maximum matching size, we use a result from Bollob´as and Brightwell [4]. Their result (specifically Theorem 14 in [4]) is stated in terms of the size of the largest independent set for a bipartite graph, which by Konig's theorem bounds the maximum matching size [14]. Theorem 6. (Bollob´as and Brightwell [4]) Let µ∗(n, n, c/n) denote the size of the maximum matching on the graph G(n, n, c/n) where p = c/n. Then a.a.s., γ∗ + γ∗ + γ∗γ∗ µ∗(n, n, c/n) (2.17) ≤ 2 − n + o(1), c where γ∗ is the smallest root of the equation x = c exp(−ce−x) and γ∗ = ce−γ∗ . The bound is known to be tight for c ≤ e. Remarkably, this bound differs from the expression for the maximum matching size in the G(n, p) model obtained in [2] by a factor of two. 2.1 Oblivious algorithm. The oblivious algorithm performs a "one shot" trial for each ball j, where it attempts to match j to a random neighbor. The algorithm is unaware of which bins are already matched, so an attempted match to an already occupied bin means that ball j is dropped. This is shown in Algorithm 1. We use N (j) to denote the set of neighboring bins of ball j. Algorithm 1: oblivious foreach j ∈ J do When ball j arrives, let N (j) denote the set of neighboring bins if N (j) > 0 then Select a random neighboring bin i ∈ N (j) if bin i is unmatched then Match j to i else j is dropped Intuitively, the algorithm is expected to do well on extremely sparse graphs, specifically those where balls are likely to have at most one neighbor. On the other hand, the performance on dense graphs should be suboptimal since each ball has a variety of neighboring bins that are not utilized by the algorithm. The following two lemmas confirm this behavior. Lemma 2. For all valid functions p(n) where p(n) = o(1/n), the performance of oblivous on G(n, n, p) with p = p(n) satisfies RG(p(n)) = 1. Proof. We consider the number of isolated edges in G(n, n, p), where an edge (i, j) is isolated if N (i) = {j} and N (j) = {i}. For any bin and ball pair (i, j), the probability of an isolated edge occurring between them is P((i, j) is isolated edge) = p(1 − p)(2n−2). Every isolated edge is matched by oblivious, so E[µO] ≥ n2p(1 − p)(2n−2), (2.18) (2.19) where µO is the size of the oblivious matching. The maximum matching size, denoted by µ∗, is upper bounded in expectation by the expected number of edges, n2p, so E[µO] E[µ∗] ≥ (1 − p)(2n−2) = (e−o( 1 n ))(2n−2) = e−o(1) → 1. (2.20) (cid:3) Lemma 3. For all valid functions p(n) where p(n) = ω(1/n), the performance of oblivous on G(n, n, p) with p = p(n) satisfies RG(p(n)) = 1 − 1/e. Proof. Fix a bin i. For each ball j, there is an attempted assignment of j to i with probability 1/n if j has at least one neighbor. Thus, P(no attempted match of j to i) = 1 −(cid:18) 1 − (1 − p)n n (cid:19) . (2.21) Considering all balls and using 1 − x ≤ e−x, P(no attempted match to i) ≤ (cid:18)1 −(cid:18) 1 − e−pn (cid:19)(cid:19)n = 1 − 1 − e−ω(1) !!n n n →(cid:18)1 − 1 n(cid:19)n → e−1. (2.22) Accordingly, the expected number of bins matched by oblivious is at least n(1 − 1/e). The maximum matching size is at most n, so the result follows. (cid:3) We are left to analyze the region p(n) = c/n, where we observe the transition from a performance ratio of 1 to 1 − 1/e. The proof of Theorem 1 is shown below; the proofs of Theorem 2 and Corollary 1 then follow easily. Theorem 1 can be proved using a linearity of expectations argument; we instead use the approach below to introduce the differential equation method. Proof of Theorem 1. Let Y (t) denote the number of occupied bins immediately before the tth ball arrives, where Y (1) = 0. Slightly abusing notation, we use Y (t) to denote both the random variable and instances of the random variable. Given Y (t), the tth ball is dropped if it is isolated or if its selected neighbor is already matched. Thus, P(ball t is matchedY (t)) = (1 − (1 − p)n)(cid:18)1 − Y (t) n (cid:19) = E[Y (t + 1) − Y (t)Y (t)]. Define the normalized random variable Z(τ ) = Y (nτ ) n , 0 ≤ τ ≤ 1, (2.23) (2.24) so that Z(τ ) indicates the fraction of occupied bins after nτ of the arrivals have occurred. We have E[Z(τ + 1/n) − Z(τ )Z(τ )] 1/n = (1 − (1 − p)n)(1 − Z(τ )) = (cid:16)1 −(cid:16)1 − c n(cid:17)n(cid:17) (1 − Z(τ )) = (1 − e−c)(1 − Z(τ )) + o(1). As n → ∞, we arrive at the differential equation dz(τ ) dτ = (1 − e−c)(1 − z(τ )), where z(·) is deterministic and replaces Z(·). Integrating and using z(0) = 0 gives z(τ ) = 1 − e(e−c−1)τ , 0 ≤ τ ≤ 1. (2.25) (2.26) (2.27) Applying Theorem 5, we choose the domain D defined by −ǫ < τ < 1 + ǫ and −ǫ < z < 1 + ǫ, for ǫ > 0. Clearly we have C0 = 1 and β = 1 by the nature of the matching process. Let λ1 = c/(en) for the trend hypothesis, which is satisfied according to Lemma 1. The Lipschitz hypothesis is satisfied with a Lipschitz constant L = (1 + ǫ)(1 − e−c). Setting τ = 1 and choosing λ = cn−1/4, Theorem 5 (b) gives that with probability 1 − O(n1/4e−c3n1/4 ), µO(n, n, p) = n(1 − e(e−c−1)) + O(n3/4). (2.28) The extra ǫ portion of the domain ensures that z(τ ) remains within distance Cλ of the boundary of D. (cid:3) Proof of Theorem 2. The cases of p(n) = o(1/n) and p(n) = ω(1/n) are given by Lemma 2 and Lemma 3. For the regime p = c/n, define the normalized random variables µO(n, n, c/n) , n µ∗(n, n, c/n) n . (2.29) eµO(n, n, c/n) so convergence in probability implies convergence in mean: By Theorem 1,eµO converges in probability. Additionally,eµO is bounded and thus uniformly integrable, Similarly, eµ∗ must satisfy lim n→∞ (2.31) := eµ∗(n, n, c/n) := E[eµO(n, n, c/n)] = 1 − e(e−c−1). E[eµ∗(n, n, c/n)] ≥ 2 − γ∗ + γ∗ + γ∗γ∗ (cid:3) Proof of Corollary 1. The expected maximum matching size is no greater than the expected number of non-isolated vertices on one side of the graph, so RO(c/n) ≥ 1−e(e−c−1) 1−e−c ≥ 1 − 1/e. (cid:3) (2.30) lim n→∞ . c 2.2 Greedy algorithm. The greedy algorithm is shown in Algorithm 2. Upon the arrival of each ball, greedy assigns the ball to a randomly selected neighboring bin that is unmatched. If no such bin exists, the ball is dropped. Recall that the ranking algorithm instead picks an initial ranking of bins and always assigns each ball to the neighboring unmatched bin with highest rank. We begin by showing that ranking and greedy perform equivalently on G(n, n, p). Let U (j) denote the set of unmatched neighboring bins of ball j when it arrives. Algorithm 2: greedy foreach j ∈ J do When ball j arrives, let U (j) denote the set of unmatched neighboring bins if U (j) > 0 then Match j to a random bin i ∈ U (j) else j is dropped Lemma 4. The performance of greedy and ranking are equivalent on the graph G(n, n, p). Proof. Consider the evolution of an instance of the ranking algorithm. Upon the arrival of each ball j, a match does not occur only if the bins N (j) are all occupied or if N (j) = ∅. Immediately before the edges for j are revealed, the probability of such an event depends only on the number occupied bins and is independent of the bin ranking, as edges are generated independently of the existing graph. It follows that the matches obtained by greedy and ranking are determined only as a function of the number of available bins. (cid:3) It is clear that on extremely sparse graphs, greedy should perform near optimally, as oblivious does. The greedy algorithm should also perform well on very dense graphs because many bins are available to each ball. We formalize this behavior with the following two lemmas. Lemma 5. For all valid functions p(n) where p(n) = o(1/n), the performance of greedy on G(n, n, p) with p = p(n) satisfies RG(p(n)) = 1. Proof. The proof for Lemma 2 holds. (cid:3) Lemma 6. For all valid functions p(n) where p(n) = ω(1/n), the performance of greedy on G(n, n, p) with p = p(n) satisfies RG(p(n)) = 1. Proof. We use a crude lower bound for the probability that each ball is matched. When ball t arrives, at most t − 1 bins are occupied, so P(ball t is matched) ≥ 1 − (1 − p)(n−t+1). Let µG denote the matching size obtained by greedy. Then E[µG] ≥ n − nXt=1 (1 − p)(n−t+1) = n − (1 − (1 − p)n)(1 − p) p ≥ n − 1 p . The maximum matching size is at most n, so E[µG] E[µ∗] ≥ 1 − 1 np(n) = 1 − 1 ω(1) → 1. (2.32) (2.33) (2.34) (cid:3) We now prove the result for the matching size obtained by greedy in the case p = c/n (Theorem 3) and follow with proofs of Theorem 4 and Corollary 2. Proof of Theorem 3. Again let Y (t) denote the number of occupied bins immediately before the tth arrival. Conditioning on Y (t), the tth ball cannot be assigned only if edges connecting the ball to the n − Y (t) neighboring bins are not present. The probability of a match is then P(ball t is matchedYt) = 1 − (1 − p) n (cid:17) n(cid:16)1− Y (t) = E[Y (t + 1) − Y (t)Y (t)]. (2.35) Normalizing as before, we obtain E[Z(τ + 1/n) − Z(τ )Z(τ )] 1/n The corresponding differential equation for n → ∞ is = 1 −(cid:16)1 − = 1 − e−c(1−Z(τ )) + o(1). c n(cid:17)n(1−Z(τ )) dz(τ ) dτ = 1 − e−c(1−z(τ )). (2.36) (2.37) By integration and the initial value for z(τ ), z(τ ) = 1 − log (1 + e−cτ (ec − 1)) c , 0 ≤ τ ≤ 1. (2.38) The application of Wormald's theorem is the same as the proof for oblivious but with Lipschitz constant L = cecǫ. (cid:3) Proof of Theorem 4. The proof follows the same approach as the proof of Theorem 2. (cid:3) Proof of Corollary 2. The approach for Corollary 1 can be used to show that the property holds for small c values (e.g. c < 1/2) and large c values (e.g. c > 5). For the remaining region, the exact expression for the performance ratio can be minimized numerically; the minimum is obtained at c∗ = 3.1685009 and RG(c∗) = 0.8370875. (cid:3) 3 Vertex-Weighted Matching In this section we modify the setting so that each bin i has a rank, ri ∈ {1, 2, . . . , m} for some constant m, and that matching balls to lower ranked bins is preferable. This is equivalent to allowing each bin to have one of m distinct weights wi ∈ R, where a larger weighted bin has a lower rank. The vertex- weighted greedy algorithm matches each ball to its neighboring bin with smallest rank, as shown in Algorithm 3. Algorithm 3: vertex-weighted greedy foreach j ∈ J do When ball j arrives, let U (j) denote the set of unmatched neighboring bins if U (j) > 0 then Match j to a neighboring bin i ∈ argmin i∈N (j) ri else j is dropped Let nr denote the total number of bins with rank r, wherePr nr = n, and let gr := nr/n. The result of this section is as follows. Theorem 7. Let µr weighted greedy on the graph G(n, n, p), where p = c/n and c > 0 is a constant. Then a.a.s., W(n, n, c/n) denote the number of bins with rank r that are matched by vertex- µr W(n, n, c/n) n = gr − 1 c log 1 + e−cτ (ec Pr 1 + e−cτ (ec Pr−1 k=1 gk − 1) k=1 gk − 1)! + o(1), 1 ≤ r ≤ m. (3.39) Proof. We use the notation Yr(t), 1 ≤ r ≤ m, to denote the number of rank r bins that are occupied immediately prior to the arrival of ball t. Consider the probability that a given ball t is matched to a rank two bin. This occurs if edges connecting to the n1 − Y1(t) are not present and there is at least one neighboring bin with rank two, so E[Y2(t + 1) − Y2(t)Y(t)] =(cid:18)(1 − p) n(cid:16)g1− Y1(t) n (cid:17)(cid:19)(cid:18)1 − (1 − p) n(cid:16)g2− Y2(t) n (cid:17)(cid:19) , (3.40) where Y(t) = (Y1(t), Y2(t), . . . Ya(t)). Generalizing, for 1 ≤ r ≤ m, E[Yr(t + 1) − Yr(t)Y(t)] = (cid:18)1 − (1 − p) After normalizing and substituting p = c/n, E[Zr(τ + 1/n) − Zr(τ )Z(τ )] 1/n We arrive at the following system of differential equations for n → ∞ : n(cid:16)gk− Yk (t) n (cid:17)(cid:19) . n(cid:16)gr− Yr (t) n (cid:17)(cid:19) r−1Yk=1(cid:18)(1 − p) = (cid:16)1 − e−c(gr−Zr(τ ))(cid:17) e−c Pr−1 k=1(gk−Zk(τ )) + o(1). (3.41) (3.42) It can be verified that the solution to the system of differential equations with initial conditions zr(0) = gr, 1 ≤ r ≤ m, is k=1(gk−zk(τ )), 1 ≤ r ≤ m. (3.43) dzr(τ ) dτ =(cid:16)1 − e−c(gr −zr(τ ))(cid:17) e−cPr−1 log 1 + e−cτ (ec Pr 1 + e−cτ (ec Pr−1 1 c k=1 gk − 1) k=1 gk − 1)! , zr(τ ) = gr − 0 ≤ τ ≤ 1, (3.44) for 1 ≤ r ≤ m. The application of Wormald's theorem is the same as the application of oblivious and greedy, but with Lipschitz constant L = (a − 1)(1 − e−c(1+ǫ))ce(a−1)cǫ + ceacǫ. (cid:3) 4 Conclusion The greedy algorithms perform relatively well: We have determined lower bounds on the performance of greedy matching algorithms on G(n, n, p(n)) that hold across all monotone functions p(n), and shown that a clear phase transition occurs at p(n) ∼ 1/n. In particular, p(n) ∼ 1/n is where the performance ratio of the oblivious algorithm transitions from 1 to 1 − 1/e and the performance ratio of greedy passes through its global minimum. it is interesting that oblivious, which is clearly inferior to ranking, has a minimum performance ratio that is equal to the best possible worst-case competitive ratio of any online matching algorithm (i.e. that of ranking). Likewise, the lower bound of 0.837 on the performance ratio of greedy is surprisingly high. Our analysis is tight inasmuch as the bound on the expected maximum matching size is tight (specifically Theorem 6); we conjecture that this theorem is in fact tight for all c > 0. Even if this is not the case, the lower bound on the performance of greedy cannot be any greater than 0.845, where the bound is tight for c = e. There appears to be a close relationship between matching behavior on G(n, n, p) and G(n, p), where results differ by a mere factor of two. As we have mentioned, this relationship occurs with our asymptotic result for greedy (Theorem 3) and the result of modified greedy given in [6]. If Theorem 6 is in fact tight for all c > 0, the same can be said regarding a result given in [2]. A similar observation was also made by Frieze with respect to differential equations for the Karp-Sipser algorithm on bipartite and ordinary graphs [10]. Note that it is not sufficient to simply argue that these properties hold for the mere fact that bipartite graphs have twice as many vertices; there are indeed important structural differences between ordinary and bipartite graphs. A variety of possibilities exist for further research. We have allowed the existence of isolated vertices in our analysis, which is unlikely to be realistic for many applications. This could be resolved by imposing a restriction on the minimum degree of vertices, as was done in [11]. Unbalanced bipartite graphs (i.e. with more vertices on one side) are likely to be encountered in practice -- our approach can be used in this situation, but less is known about expected maximum matching size here. Stepping away from the online scenario, one could consider multiple pass algorithms, which are highly relevant to streaming models. References [1] G. Aggarwal, G. Goel, C. Karande, and A. Mehta, Online vertex-weighted bipartite matching and single-bid budgeted allocations, in Proceedings of the Twenty-Second Annual ACM-SIAM Symposium on Discrete Algorithms, SIAM, 2011, pp. 1253 -- 1264. [2] J. Aronson, A. Frieze, and B. G. Pittel, Maximum matchings in sparse random graphs: Karp-Sipser revisited, Random Structures and Algorithms, 12 (1998), pp. 111 -- 177. [3] B. Birnbaum and C. Mathieu, On-line bipartite matching made simple, ACM SIGACT News, 39 (2008), pp. 80 -- 87. [4] B. Bollob´as and G. Brightwell, The width of random graph orders, Mathematical Scientist, 20 (1995), pp. 69 -- 90. [5] N. R. Devanur, K. Jain, and R. D. Kleinberg, Randomized primal-dual analysis of ranking for online bipartite matching, in SODA, 2013, pp. 101 -- 107. [6] M. Dyer, A. Frieze, and B. Pittel, The average performance of the greedy matching algorithm, The Annals of Applied Probability, (1993), pp. 526 -- 552. [7] P. Erdos and A. R´enyi, On random matrices, Magyar Tud. Akad. Mat. Kutat´o Int. Kozl, 8 (1964), p. 1964. [8] , On the existence of a factor of degree one of a connected random graph, Acta Mathematica Hungarica, 17 (1966), pp. 359 -- 368. [9] J. Feigenbaum, S. Kannan, A. McGregor, S. Suri, and J. Zhang, On graph problems in a semi- streaming model, Theoretical Computer Science, 348 (2005), pp. 207 -- 216. [10] A. Frieze, Perfect matchings in random bipartite graphs with minimal degree at least 2, Random Structures & Algorithms, 26 (2005), pp. 319 -- 358. [11] A. Frieze and B. Pittelt, Perfect matchings in random graphs with prescribed minimal degree, in Mathematics and Computer Science III, Springer, 2004, pp. 95 -- 132. [12] R. M. Karp and M. Sipser, Maximum matching in sparse random graphs, Foundations of Computer Science, IEEE Annual Symposium on, 0 (1981), pp. 364 -- 375. [13] R. M. Karp, U. V. Vazirani, and V. V. Vazirani, An optimal algorithm for on-line bipartite matching, in Proceedings of the twenty-second annual ACM symposium on Theory of computing, ACM, 1990, pp. 352 -- 358. [14] D. Konig, Uber graphen und ihre anwendung auf determinantentheorie und mengenlehre, Mathematische Annalen, 77 (1916), pp. 453 -- 465. [15] T. G. Kurtz, Solutions of ordinary differential equations as limits of pure jump Markov processes, Journal of Applied Probability, 7 (1970), pp. 49 -- 58. [16] A. Mehta, A. Saberi, U. Vazirani, and V. Vazirani, Adwords and generalized online matching, Journal of the ACM (JACM), 54 (2007), p. 22. [17] M. Mitzenmacher, Studying balanced allocations with differential equations, Combinatorics Probability and Computing, 8 (1999), pp. 473 -- 482. [18] B. Pittel, J. Spencer, and N. Wormald, Sudden emergence of a giant k-core in a random graph, Journal of Combinatorial Theory, Series B, 67 (1996), pp. 111 -- 151. [19] M. R. H. P. Raghavan, Computing on data streams, in External Memory Algorithms: DIMACS Workshop External Memory Algorithms and Visualization, May 20-22, 1998, vol. 50, AMS Bookstore, 1999, p. 107. [20] N. C. Wormald, Differential equations for random processes and random graphs, The annals of applied probability, (1995), pp. 1217 -- 1235. [21] , The differential equation method for random graph processes and greedy algorithms, Lectures on approximation and randomized algorithms, (1999), pp. 73 -- 155.
1305.4747
2
1305
2013-12-02T14:04:21
Easy identification of generalized common and conserved nested intervals
[ "cs.DS" ]
In this paper we explain how to easily compute gene clusters, formalized by classical or generalized nested common or conserved intervals, between a set of K genomes represented as K permutations. A b-nested common (resp. conserved) interval I of size |I| is either an interval of size 1 or a common (resp. conserved) interval that contains another b-nested common (resp. conserved) interval of size at least |I|-b. When b=1, this corresponds to the classical notion of nested interval. We exhibit two simple algorithms to output all b-nested common or conserved intervals between K permutations in O(Kn+nocc) time, where nocc is the total number of such intervals. We also explain how to count all b-nested intervals in O(Kn) time. New properties of the family of conserved intervals are proposed to do so.
cs.DS
cs
1 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 Easy identification of generalized common and conserved nested intervals Fabien de Montgolfier∗ Mathieu Raffinot∗ Irena Rusu† October 30, 2018 Abstract In this paper we explain how to easily compute gene clusters, for- malized by classical or generalized nested common or conserved intervals, between a set of K genomes represented as K permutations. A b-nested common (resp. conserved) interval I of size I is either an interval of size 1 or a common (resp. conserved) interval that contains another b-nested common (resp. conserved) interval of size at least I − b. When b = 1, this corresponds to the classical notion of nested interval. We exhibit two simple algorithms to output all b-nested common or conserved intervals between K permutations in O(Kn + nocc) time, where nocc is the total number of such intervals. We also explain how to count all b-nested inter- vals in O(Kn) time. New properties of the family of conserved intervals are proposed to do so. 1 Introduction Comparative genomics is nowadays a classical field in computational biology, and one of its typical problems is to cluster sets of orthologous genes that have virtually the same function in several genomes. A very strong paradigm is that groups of genes which remain "close" during evolution work together (see for instance Galperin and Koonin (2000), Lathe et al. (2000), Tamames (2001)). Thus, a widely used approach to obtain interesting clusters is to try to cluster genes or other biological units (for instance unique contigs of protein domains) according to their common proximity on several genomes. For this goal, many different cluster models have been proposed, like common intervals in Uno and Yagiura (2000), conserved intervals in Bergeron et al. (2004), π-patterns in Parida (2006), gene teams in B´eal et al. (2004), domain teams in Pasek et al. {fm,raffinot}@liafa.univ-paris-diderot.fr ∗LIAFA, Univ. Paris Diderot - Paris 7, 75205 Paris Cedex 13, France. †LINA, UMR 6241, Universit´e de Nantes, 44300, Nantes, France. [email protected] 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 (2005), approximate common intervals in Amir et al. (2007) and so on, con- sidering different chromosome models (permutations, signed permutations, se- quences, graphs, etc.) or different distance models (accepting gaps, distance modeled as weighted graphs, etc.) Among all those models, the first proposed, and still one of the most used in practice, is the concept of common interval on genomes represented by permu- tations. A set of genes form a common interval of K genomes if it appears as a segment on each of the K unsigned permutations that represent the genomes. The orders inside the segments might be totally different. The model of con- served interval is close to the model of common interval but considers signed permutations. Recently, nested common intervals (easily extensible to nested conserved in- tervals) were introduced in Hoberman and Durand (2005) based on real data observation by Kurzik-Dumke and Zengerle (1996). A common interval I of size I is nested if I = 1 or if it contains at least one nested common interval of size I − 1. Hoberman and Durand (2005) pointed that the nestedness assumption can strengthen the significance of detected clusters since it reduces the prob- ability of observing them randomly. An O(n2) time algorithm to compute all nested common intervals between two permutations has been presented in Blin et al. (2010) while between K permutations a recent O(Kn + nocc) algorithm is proposed in Rusu (2013), where nocc is the number of solutions. In this paper, we exhibit two simple algorithms to easily compute nested common and conserved intervals of K permutations from their natural tree representations. Also, with the same simplicity, we propose to deal with a gen- eralization of nested common intervals, called b-nested common intervals, and with its variant for conserved intervals (which are a signed version of common intervals), called b-nested conserved intervals. These new classes allow - as b grows - for a less constraint containment between the intervals in the family. Indeed, a nested interval I must contain a nested interval of size I − 1 or be a unit interval. A b-nested common (resp. conserved) interval must contain a b-nested common (resp. conserved) interval of size at least I − b or be a unit interval. Nested intervals are indead 1-nested. From a biological point of view, this is equivalent to modeling clusters with a larger variability in gene content and gene order, thus allowing algorithms to deal with annotation errors. How- ever, the study and validation of this new interval model is deferred to further applied studies. In this paper we focus on the algorithmic aspects. Given a set P of K permutations on n elements representing genomes with no duplicates, our simple algorithms for finding all b-nested common or conserved intervals of P run in O(Kn + nocc)-time and need O(n) additional space, where nocc is the number of solutions. In this way, our algorithm for common intervals performs as well as the algorithm in Rusu (2013) for the case of K permutations, and proposes an efficient approach for the new classes of b-nested intervals. Moreover, a slight modification of our approach allows us to count the num- ber of b-nested common or conserved intervals of K permutations in O(Kn) time. Efficiently counting the number of b-nested common intervals without enumerating them is very usefull when one needs to compute similarity func- 2 76 77 78 79 80 81 82 83 84 85 86 87 tions between genomes that are expressed in terms of number of intervals. See for instance Fertin and Rusu (2011). The paper is organized as follows. In Section 2 we present the main def- initions for common and conserved intervals, and precisely state the problem to solve. In Section 3 we focus on b-nested common intervals, recalling the data structure called a P Q-tree, giving a characterization of b-nested common intervals and showing how P Q-trees can be used to find all b-nested common intervals. In Section 4 we adopt a similar approach for conserved intervals, with the difference that another tree structure must be used in this case. In Section 5 we eventually conclude. 2 Generalities on common and conserved inter- vals 90 91 92 89 A permutation P on n elements is a complete linear order on the set of integers 88 {1, 2, . . . , n}. We denote Idn the identity permutation (1, 2, . . . , n). An interval of a permutation P = (p1, p2, . . . , pn) is a set of consecutive elements of the permutation P . An interval of a permutation will be denoted by giving its first and last positions, such as [i, j]. Such an interval is also said delimited by pi (left) and pj (right). An interval [i, j] = {i, i + 1, . . . , j} of the identity permutation will be simply denoted by (i..j). Definition 1 (Uno and Yagiura (2000)) Let P = {P1, P2, . . . , PK} be a set of K permutations on n elements. A common interval of P is a set of integers that is an interval in each permutation of P. 93 94 95 96 97 The set {1, 2, . . . , n} and all singletons (also called unit intervals) are com- mon intervals of any non-empty set P of permutations. Moreover, one can always assume that one of the permutations, say P1, is the identity permuta- tion Idn. For this, it is sufficient to renumber the elements of P1 so as to obtain Idn, and then to renumber all the other permutations accordingly. Then the common intervals of P are of the form (i..j) with 1 ≤ i ≤ j ≤ n. Define now a signed permutation as a permutation P whose elements have an associated sign among + and −, making each element to be respectively positive or negative. Negative elements are denoted −pi while positive elements are simply denoted pi, or +pi for emphasizing positivity. A permutation is then a signed permutation containing only positive elements. Definition 2 (Bergeron and Stoye (2006)) Let P = {P1, P2, . . . , PK} be a set of signed permutations over {1, 2, . . . , n}, with first element +1 and last element +n, for each k ∈ {1, 2, . . . , K}. Assume P1 = Idn. A conserved interval of P is either a unit interval or a common interval (a..c) of P (ignoring the signs) which is delimited, in each Pk, either by a (left) and c (right), or by −c (left) and −a (right). 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 3 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 Remark 1 In the subsequent, we assume that P = {P1, P2, . . . , PK} with P1 = Idn. Moreover, when we deal with conserved intervals, the permutations are assumed to satisfy the hypothesis in Definition 2. Now, we are ready to introduce the new classes of intervals. Definition 3 Let P = {P1, P2, . . . , PK} be a set of K permutations on n ele- ments and let b be a positive integer. A common (respectively conserved) interval of P is b-nested if either I = 1 or I strictly contains a common (resp. con- served) interval of size at least I − b. We are interested in efficient algorithms for finding and counting all b-nested common (resp. conserved) intervals of P = {P1, P2, . . . , PK}, without redun- dancy. Obviously, unit intervals are, by definition, b-nested common (resp. con- served) intervals. As a consequence, from now on and without any subsequent specification, we focus on finding b-nested common (resp. conserved) intervals of size at least 2. The following notions will be very useful in the subsequent. Definition 4 Let P = {P1, P2, . . . , PK} be a set of K permutations on n ele- ments and let b be a positive integer. A common (resp. conserved) interval of 130 P is b-small if its size does not exceed b. Otherwise, the interval is b-large. 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 Notice that all b-small intervals are b-nested, by definition and since unit intervals are b-nested. 3 On b-nested common intervals This section is divided into three parts. The first one recalls a tree structure that we associate to common intervals of permutations, the P Q-trees. The second one discusses the properties of b-nested common intervals. Finally, we give the algorithms for efficiently computing and counting the b-nested common intervals. 3.1 P Q-trees and common intervals Definition 5 Let F be a family of intervals from Idn containing the interval (1..n). A PQ-tree representing the family F is a tree T (F) satisfying: 1. its nodes are in bijection with a subset S(F) of intervals from F, the root corresponding to (1..n) 2. its arcs represent all the direct (not obtained by transitivity) inclusions between intervals in S(F) 3. each node is labeled P ou Q, and an order is defined for the children of each Q-node 4 149 150 151 152 153 154 155 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 4. an interval I of Idn belongs to F iff either it corresponds to a node, or there exists a unique Q-node z such that I is the union of intervals corresponding to successive children of z, according to the order defined for z. Note that the size of the tree is in O(S(F)), thus allowing to drastically reduce the memory space needed to store all the intervals in F. When labels P and Q are forgotten, the tree T (F) is called the inclusion tree of S(F). Given the P Q-tree representing a family F, we denote by Int(x) the interval from S(F) corresponding to a node x. We also denote, for each interval I from If I ∈ S(F), then D(I) is the set of its children. If I (cid:54)∈ S(F), then by condition 4. in Definition 5, let xl, xl+1, . . . , xr be the children of the Q-node z such that I = ∪i∈(l..r)Int(xi). Then D(I) = {xl, xl+1, . . . , xr}. 156 F, by D(I) the domain of I defined as follows. Fundamental results on P Q-trees involve closed families of intervals. Definition 6 A closed family F of intervals of the permutation Idn is a family that contains all singletons as well as the interval (1..n), and that in addition has the following property: if (i..k) and (j..l), with i ≤ j ≤ k ≤ l, belong to F, then (i..j − 1), (j..k), (k + 1..l) and (i..l) belong to F. The construction of a P Q-tree for a closed family of intervals relies on strong intervals: Definition 7 Let F be a family of closed intervals from Idn. An interval (i..j) is said to overlap another interval (k..l) if they intersect without inclusion, i.e. i < k ≤ j < l or k < i ≤ l < j. An interval I of F is strong if it does not overlap any other interval of F, and is weak otherwise. Notice that (1..n) and the unit intervals are always strong. Also, the family of strong intervals of F is laminar (that is, every two distinct intervals are either disjoint or included in each other) and, as (1..n) belongs to the family, it is possible to define for them an inclusion tree. Then it can be shown that: Theorem 1 (Landau et al. (2005)) Given a closed family F of intervals of Idn, let S(F) be the set of strong intervals from F and let T (F) be the inclusion tree of S(F). Then the P Q-tree obtained by the following rules represents the family F: 1. label with P each node x of T (F) such that ∪z∈D(cid:48)Int(z) (cid:54)∈ F for all D(cid:48) ⊂ D(Int(x)) with 2 ≤ D(cid:48) < D. 2. label with Q each node y of T (F) not labeled P , and define the order y1, y2, . . . , yr of its children such that max(Int(yi)) < min(Int(yi+1)) for all i < r. Common intervals of permutations (including those of size 1) are obviously a closed family of intervals from Idn, thus Theorem 1 applies. Moreover, the P Q-tree for common intervals (hereafter simply denoted T ) may be computed in linear time: 5 Let P = {Id9, P2, P3}, P2 = (4, 2, 3, 1, 7, 8, 9, 6, 5) P3 = (5, 6, 1, 3, 2, 4, 9, 8, 7) The P Q-tree for the set of common intervals of P is shown on the left. Figure 1: Example of PQ-tree 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 Theorem 2 Bergeron et al. (2008) The construction of the P Q-tree T of com- mon intervals of a set P of K permutations on n elements may be done in O(Kn) time. It is easy to note here that the leaves of T are the singletons. Also, the intervals Int(yi), i = 1, 2, . . . , r, associated to the children of a Q-node are contiguous, i.e. max(Int(yi)) + 1 = min(Int(yi+1)). This is due to condition 4 in the definition of a P Q-tree and to the assumption, that the reader must keep in mind, that P1 = Idn (thus all the common intervals are of the form (i..j)). An example is given in Fig. 1. 3.2 Properties of b-nested common intervals Let P = {P1, P2, . . . , PK} be a set of permutations on n elements such that P1 = Idn, and let T be the P Q-tree representing the common intervals of P. Say that a common interval I is a P -interval if it is strong and there is a P -node x with Int(x) = I. Otherwise, I is a Q-interval. With the aim of identifying the particular structure of b-nested common intervals among all common intervals, we first prove that: Lemma 1 Let I be a b-nested common interval with D(I) = {x1, x2, . . . , xr}, r ≥ 1. Then each of the intervals Int(xi), 1 ≤ i ≤ r, is either a b-small or a b-nested common interval. Proof. Assume a contrario that some Int(xi) is of size u ≥ b + 1 and is not b-nested. Let I(cid:48) ⊆ I be a b-nested common interval with the property that xi ∈ D(I(cid:48)) ⊆ D(I) and D(I(cid:48)) is minimal with this property. Now, since I(cid:48) is b- nested, we have that I(cid:48) strictly contains Int(xi) and thus I(cid:48) > 1. Then I(cid:48) must contain some b-nested common interval J with I(cid:48) > J ≥ I(cid:48)−b. Furthermore, J and Int(xi) are disjoint since Int(xi) is strong and by the minimality of I(cid:48) we have that J cannot contain Int(xi). But then I(cid:48) ≥ J + Int(xi) ≥ I(cid:48) − b + b + 1 = I(cid:48) + 1, a contradiction. 2 It is easy to see that: Remark 2 Let I, L, J be common intervals such that J ⊆ L ⊆ I and J is b-nested with J ≥ I − b. Then L is b-nested, since J ≥ I − b ≥ L − b. 6 1235 67894 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 Now, the characterization of b-nested intervals corresponding to a P -node is obtained as follows. Lemma 2 Let I be a P -interval with D(I) = {x1, x2, . . . , xr}. Then I is a b-nested common interval if and only if there is some i, 1 ≤ i ≤ r, such that Int(xi) is a b-nested common interval of size at least I − b. Proof. Since I is a P -interval, its maximal common subintervals are Int(xi), 1 ≤ i ≤ r. The "⇐" part follows directly from the definition. For the "⇒" part, assume by contradiction that the affirmation does not hold. Then none of the intervals Int(xi), 1 ≤ i ≤ r, is b-nested of size at least I − b, but since T is b-nested we deduce that some interval Int(xi) exists containing a b-nested common interval J of size at least I − b. But this is impossible according to Remark 2. 2 The structure of b-nested common intervals given by consecutive children of a Q-node is more complex. In the next lemmas we show that at most one of the intervals Int(xi) composing such an interval may be b-large (see also Fig. 2). Lemma 3 Let I be a Q-interval with D(I) = {x1, x2, . . . , xr}. Then I is a b-nested common interval if and only if Int(x1) is b-small and I − Int(x1) is a b-nested common interval, or Int(xr) is b-small and I − Int(xr) is a b-nested common interval. Proof. Recall that for a Q-interval I, the order x1, x2, . . . , xr implies that the equation max(Int(xi)) + 1 = min(Int(xi+1)) holds for all i with 1 ≤ i < r. ⇒: Since I is b-nested, it contains some b-nested interval J such that I > J ≥ I − b. Choose J as large as possible. Now, J cannot be strictly included in some non b-nested Int(xi) by Remark 2, thus D(J) = {xp, xp+1, . . . , xs} with p ≥ 1, s ≤ r, and p (cid:54)= 1 or s (cid:54)= r. Assume w.l.o.g. that p > 1. Then Int(x1) is b-small (since J ≥ I − b) and I − Int(x1) is b-nested by Remark 2 since it contains J or is equal to J. ⇐: Let j = 1 or j = r according to which proposition holds. We have that I − Int(xj) = I − Int(xj) ≥ I − b since Int(xj) ≤ b. Then I is b-nested. 2 Lemma 4 Let I be a Q-interval with D(I) = {x1, x2, . . . , xr} which is a b- nested common interval. Then at most one of the intervals Int(xi), 1 ≤ i ≤ r, is b-large, and in this case this interval is a b-nested common interval. Proof. By contradiction, assume there exist b-nested common Q-intervals that contain at least two b-large intervals of type Int(xi), and let I be a smallest inclusion. Let xu (resp. xv), with 1 ≤ u, v ≤ r, be such such interval w.r.t. Int(xv)) is b-large and u (resp. v) is minimum (resp. that Int(xu) (resp. maximum) with this property. Then u = 1 and v = r, otherwise by Lemma 3 the minimality of I is contradicted. But now Lemma 3 is contradicted, since Int(x1) and Int(xr) are both b-large. 7 Figure 2: Structure of a b-nested Q-interval. Then, at most one of the intervals Int(xi), 1 ≤ i ≤ r, is b-large. To finish the proof, assume that Int(xi) (for some fixed i), is the unique b-large interval and apply Lemma 1 to Int(xi) to deduce that Int(xi) is b-nested. 2 We are able now to prove the theorem characterizing b-nested common in- tervals. Theorem 3 Let I be a common interval of P. I is b-nested if and only if: (a) either I is a P -interval and there exists xh ∈ D(I) such that Int(xh) is a b-nested common interval of size at least I − b. (b) or I is a Q-interval with the property that all intervals Int(xi) with xi ∈ D(I) are b-small, with one possible exception which is a b-large b-nested interval. Proof. Lemma 2 proves the theorem in the case where I is a P -interval. When I is a Q-interval, Lemma 4 proves affirmation (b).2 3.3 Computing and counting all b-nested common inter- vals Consider Algorithm 1, which computes all b-nested common intervals. For a node xc, the notations min(c) and max(c) respectively indicate the minimum and the maximum value in Int(xc). Figure 3 illustrates our algorithm. Theorem 4 Algorithm 1 correctly computes all the b-nested common intervals, assuming the P Q-tree is already built, in O(n + nocc) time, where nocc is the number of b-nested common intervals in P. Proof. To show the algorithm correctness, note first that all the leaves are output in step 4, and they are b-nested common intervals. Moreover, all b- nested common intervals corresponding to P -nodes are correctly output in step 9 according to Theorem 3(a). Next, Q-intervals corresponding to a Q-node x are generated in steps 12-22 by starting with each child xc of x, and successively adding right children xd as long as condition (b) in Theorem 3 is satisfied (step 15). Let us analyze now the running time. The P Q-tree has size O(n), and the traversal considers every node x exactly once. Working once on the children of each node takes O(n). The test in line 8 considers every child of a P -node one more time, so that the O(n) time is ensured when the Q-interval generation is left apart. Now, during the generation of the Q-intervals, a node xd that belongs 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 8 b−small intervalsb−small intervalsAt most oneb−large strong nested interval integer b Input: The PQ-tree T = (V, E) of P for common intervals, a positive Output: All b-nested common intervals of P Perform a post-order traversal of T for each node x of T encountered during this traversal do if x is a leaf then output Int(x) as b-nested else let x1, x2, . . . , xp be the children of x if x is a P -node then if ∃ i such that Int(xi) is b-nested and Int(xi) ≥ Int(x) − b then output Int(x) as b-nested else endif for c ← 1 to p do large ← 0 // number of b-large intervals already included d ← c // considers all children starting with xc while d ≤ p and (Int(xd) ≤ b or Int(xd) is b-nested) and large ≤ 1 do if Int(xd) > b then large ← large + 1 endif if c < d and large ≤ 1 then output (min(c)..max(d)) as b-nested endif d ← d + 1 endwhile endfor endif endif endfor 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Algorithm 1: The b-NestedCommonSearch algorithm 292 293 294 295 296 297 298 299 300 301 302 303 to no b-nested common interval is uselessly included in some interval candidate at most once by left initial positions for the scan (beginning line 12), which is in total bounded by n since there exists a linear number of initial positions in the P Q-tree. At each iteration of the loop line 15, a unique distinct b-nested interval is output, or c = d (that happens once for each node since d is incremented at each iteration), or large = 2 (that also happens once for each node since it ends the loop). The total number of iterations is thus O(n + nocc), each iteration taking O(1). The overall running time is thus in O(n + nocc), where nocc is the total number of b-nested common intervals. 2 The previous approach can be modified to count the b-nested common in- tervals instead of enumerating them, by simply analyzing more precisely the structure of the Q-nodes. The goal is to count the b-nested common intervals in 9 Figure 3: Computing all b-nested intervals of a Q-interval, where bS (resp. bL) means b-small (resp. b-large). The algorithm considers all positions from left to right and expands the b-nested interval while it is possible. a time proportional to the number of children instead of the number of b-nested common intervals. To perform the count, we assume that the traversal is post- order, that it marks each vertex as b-nested or not, and that it computes the cardinality of each Int(xi). P -nodes. Obviously, a P -node (including the leaves) counts for 1 if the associated interval is b-nested, and for 0 otherwise. Q-nodes. To make the computation for a Q-node with children {x1, x2, . . . , xp}, the algorithm looks for the b-large b-nested intervals Int(xd) and counts 1) the b-nested common intervals containing each Int(xd), and 2) the b-nested common intervals generated by maximal sets of consecutive b-small common intervals Int(xi). To this end, the vertices xi are considered from left to right in order to identify both the b-large b-nested common intervals Int(xd), and the maximal sets of consecutive b-small common intervals Int(xi). Then: To solve 1), each encountered b-large b-nested interval Int(xd) has the fol- lowing treatment. We count the number of consecutive b-small nodes xi on its right (resp. left), denoted by r(d) (resp. l(d)). Then we compute the number of b-nested common intervals which contain child xd as l(d) ∗ (r(d) + 1) + r(d). To solve 2), for each maximal set of consecutive b-small common intervals Int(xi), assuming it has size h, we count h ∗ (h − 1)/2. One may easily decide whether the interval corresponding to the Q-node itself is b-nested or not, and compute its size. All these operations may be performed in O(k) time, where k is the number of sons of the Q-node. Example. On the example in Fig. 3, we count (from left to right): (a) for the first b-large strong child to the left: 3 ∗ (2 + 1) + 2 = 11 b-nested common intervals; (b) for the b-large second strong child: 2 ∗ (1 + 1) + 1 = 5 b-nested common intervals; (c) for the last b-large strong child: 1 ∗ (0 + 1) = 1 b-nested common intervals. We sum up to obtain 17 b-nested common intervals 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 10 non nestednestednestednestedstrong bLstrong bLstrong bLstrong bLbSbSbSbSbSbSbS 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 containing one b-large b-nested interval Int(xi). Now we add the nested intervals generated between the b-large intervals: 3 + 1 = 4. Altogether, the Q-node of Figure 3 generates 21 b-nested intervals. Complexity The time complexity of the counting procedure is obviously O(n), the size of the underlying P Q-tree. The time needed to get the PQ-tree itself given K permutations is however O(Kn), as indicated before. 4 On b-nested conserved intervals As stated before, we assume the set P of permutations has the properties re- quired in Definition 2. As conserved intervals are common intervals, one may be tempted to follow the same approach using P Q-trees. Unfortunately, the inclusion tree of strong conserved intervals does not define a P Q-tree represent- ing the family of conserved intervals, due to the fact that a conserved interval cannot be written as a disjoint union of strong conserved intervals. The result- ing ordered tree has been used in the literature Bergeron et al. (2004), but its underlying properties have not been clearly stated. We do it here, before using these properties. 4.1 Structure of conserved intervals We start by an easy property about intersection of conserved intervals: Lemma 5 Let I = (u..v) and J = (c..d) be two conserved intervals of P with u < c ≤ v < d. Then the intervals (u..c), (c..v), (v..d) and (u..d) are conserved intervals. Proof. As an element x from I fulfills u ≤ x ≤ v and an element y from J fulfills c ≤ y ≤ d then an element z from I \ J fulfills u ≤ z < c. These elements are exactly those between u and c and (u..c) is thus a conserved interval. Similarly, J \ I = (v..d).The elements from I ∩ J are all the elements not lower than v and not larger than c, so (c..v) is a conserved interval. Finally, the elements from I ∪ J are all elements greater than u and smaller than d, so (u..d) is a conserved interval. 2 The notions of strong/weak intervals and of a frontier are essential in our study. Definition 8 A conserved interval I of P is strong if it has cardinality at least two, and does not overlap other conserved intervals. Otherwise, it is weak. Notice that unit conserved intervals are not strong. Definition 9 Let I = (a..c) be a conserved interval. A set {f1, . . . , fk} of elements satisfying a = f1 < f2 < . . . < fk = c is a set of frontiers of I if (fi..fj) is a conserved interval, for all i, j with 1 ≤ i < j ≤ k. An element of I is a frontier of I if it occurs in at least one set of frontiers of I. 11 1, . . . , f(cid:48) j. 2 The two following properties are easy ones: Lemma 6 Let I = (a..c) be a conserved interval and F be a set of frontiers of I. The elements of F are either all positive or all negative. j) = (f(cid:48) 1..f(cid:48) j) and we are done. If f(cid:48) j = c, then (fi..f(cid:48) j ∈ F (cid:48), and suppose that fi < f(cid:48) Proof. By the definition of a conserved interval, its two endpoints have the same sign. By the definition of a set on frontiers, any two frontiers are the extremities of some conserved interval. 2 Lemma 7 Let I = (a..c) be a conserved interval, and let F = {f1, . . . , fk} and l} be two sets of frontiers of I. Then F ∪ F (cid:48) is also a set of F (cid:48) = {f(cid:48) frontiers of I. Proof. We show that any interval between two elements of F ∪ F (cid:48) is conserved. Let fi ∈ F and f(cid:48) j. If fi = a, then we have (fi..f(cid:48) j) = (fi..fk) and we are j (cid:54)= c, then Lemma 5 allows to conclude. The same also done. If fi (cid:54)= a and f(cid:48) proof holds if fi > f(cid:48) Let now T be the inclusion tree of strong intervals from P, in which every node x corresponds to a strong interval denoted Int(x), and node x is the parent of node y iff Int(x) is the smallest strong conserved interval strictly containing Int(y). Then T contains two types of nodes: those corresponding to strong conserved intervals with no internal frontier, and those corresponding to strong conserved intervals with at least one internal frontier. We will show that weak conserved intervals are the conserved strict subintervals of the latter ones, defined by two frontiers. Overall, we have a structure working pretty much as a P Q-tree, but which cannot be mapped to a P Q-tree. This is proved in the next theorem. served interval such that I ⊆ J. Theorem 5 Each conserved interval I of P admits a unique maximal (w.r.t. inclusion) set of frontiers denoted FI . Moreover, each conserved interval I of Given a conserved interval, denote by Container(I) the smallest strong con- 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 P satisfies one of the following properties: 392 393 394 395 396 397 398 399 400 401 402 403 1. I is strong 2. I is weak and there exists a unique strong conserved interval J of P, and two frontiers fi, fj ∈ FJ with fi < fj, such that I = (fi..fj). Moreover FI = FJ ∩ I and J = Container(I). 1, . . . , f(cid:48) Proof. Let us first prove the uniqueness of the maximal set of frontiers. By contradiction, assume two distinct maximal sets of frontiers F = {f1, . . . , fk} l} exist for a conserved interval I. Using Lemma 7, we and F (cid:48) = {f(cid:48) deduce that F ∪ F (cid:48) is a larger set of frontiers of I, a contradiction. Let us now prove that if I is not strong, then there exists a unique strong conserved interval J, and two frontiers fi, fj ∈ FJ with fi < fj, such that I = (fi..fj). 12 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 Existence of J. Let I1 = I = (a0..a1) be a weak conserved interval of P. Then there is another interval I2 overlapping it, either on its left (i.e. I2 = (a2..x2) with a2 < a0 ≤ x2 < a1) or on its right (i.e. I2 = (x2..a2) with a0 < x2 ≤ a1 < a2). According to Lemma 5, J2 = I1 ∪ I2 is a conserved interval, and F2 = {a0, a1, a2, x2} is a set of frontiers for J2 (not necessarily all distinct). If J2 is not strong then it is overlapped by another interval I3. We build an increasing sequence of intervals J1 = I1, J2, . . . , Jk, with Ji overlapped by Ii+1, and Ji+1 = Ji ∪ Ii+1, until we find a strong conserved interval Jk (the process ends since (1..n) is strong). Each time Lemma 5 ensures that Ji+1 is a conserved interval, and Fi+1 = Fi ∪ {ai+1, xi+1} is a set of frontiers for Ji+1 (where ai+1, xi+1 are the endpoins of Ii+1). But then Fk is a subset of the maximal set of frontiers FJk of Jk and the two frontiers of Jk defining I1 are a0, a1, since {a0, a1} ⊆ F2 ⊆ F3 ⊆ . . . ⊆ Fk ⊆ FJk . Uniqueness of J. Assume a contrario that two strong intervals J1 and J2 r} and such that I = (fi..fj) = exist with FJ1 = {f1, . . . , fp}, FJ2 = {f(cid:48) 1, . . . , f(cid:48) l ) with 1 ≤ i < j ≤ p and 1 ≤ k < l ≤ r. Then, clearly, fi = f(cid:48) (f(cid:48) k..f(cid:48) k and this is the left endpoint of I, whereas fj = f(cid:48) l and this is the right endpoint of I. Since J1 and J2 are both strong, they cannot overlap. Assume then w.l.o.g. that J1 is strictly included in J2, and more precisely that fp (cid:54)= f(cid:48) r (then fp < f(cid:48) r) overlaps J1 (which is forbidden) unless i = 1, in which case we have f1 = fi = f(cid:48) k and this is the left endpoint of I. Now, since I is strictly included in J, we deduce j < p and (f(cid:48) r) overlaps J1. This contradiction proves the uniqueness of the strong interval J satisfying condition 2. Let us prove that FI = FJ ∩ I. Suppose by contradiction that FI contains a frontier f not in FJ . Recall that I = (a0..a1) and a0, a1 belong to FJ . Now, for each fl ∈ FJ with fl < f , we have that (fl..f ) is a conserved interval either by Lemma 5 applied to (a0..f ) and (f1..fl) (when fl ≥ a0) or since it is the union of the two conserved intervals (fl..a0) and (a..f ) (when fl < a0). Symmetrically, (f..fl) is also a conserved interval when fl ∈ FJ , fl > f . But then FJ ∪ {f} is a set of frontiers of J larger than FJ , which contradicts the maximality of FJ . Eventually, let us prove that J = Container(I). Assume that F = {f1, f2, . . . , fk}, that I = (fi..fj) and that, by contradiction, there is a smallest strong conserved interval J(cid:48) = (a..c) which contains I. Then J(cid:48) (cid:40) J since otherwise J and J(cid:48) would overlap. W.l.o.g. assume that fj (cid:54)= c. Then (fi..fk) overlaps J(cid:48), and this contradicts the assumption that J(cid:48) is strong. 2 r due to inclusion). Now, (f(cid:48) k..f(cid:48) l ..f(cid:48) We only need three more results before dealing with b-nested conserved in- tervals. Lemma 8 Let I and J be two conserved intervals. If there exists a frontier f ∈ FI ∩ FJ , then Container(I) = Container(J). Proof. Since both Container(I) and Container(J) are strong, and since they share a common element, one contains the other. Now, suppose w.l.o.g. that Container(I) ⊆ Container(J). By contradiction, assume that Container(I) (cid:40) Container(J) and let Container(J) = (a..c). Since f ∈ FJ and that by Theorem 13 5 we have FJ = F(a..c) ∩ J, we deduce that f ∈ F(a..c) and thus (a..f ) and (f..c) are conserved intervals. Now, one of them necessarily overlaps Container(I), since at least one of a, c is not an endpoint of Container(I). But this is impos- sible. Therefore Container(I) = Container(J). 2 448 449 450 451 Lemma 9 Let I be a (weak or strong) conserved interval with frontier set FI = 452 {f1, . . . , fk} and let (a..c) ⊆ I be a conserved interval. Then exactly one of the 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 following cases occurs for the interval (a..c): 1. either there exists l such that fl ∈ (a..c), and then there exist i and j such that (a..c) = (fi..fj). 2. or (a..c) contains no frontier of FI , and then there exists i such that fi < a ≤ c < fi+1. Proof. Obviously, the two cases cannot hold simultaneously. Moreover, in case 2., the deduction is obvious. Let us focus now on the case 1. Let (a..c) contain some frontier fl ∈ FI . Consider now the two intervals (f1..fl) and (fl..fk). Then either (i) (a..c) = (f1..fk) = I, or (ii) (a..c) = (fl..fl), or (iii) l = 1 or l = k, or (iv) (a..c) overlaps (f1..fl) or (fl..fk). The two first cases are trivial, let us consider the two last cases. In case (iii) assume w.l.o.g. that l = 1 (the case l = k is symmetric). Then a = f1 since (a..c) ⊆ I. Since (a..c) contains the elements of I that are smaller or equal to c, then (c..fk) is a conserved interval. Thus {f1, c, fk} is a frontier set of I. If c (cid:54)∈ FI then according to Lemma 7 we have that {f1, c, fk} ∪ FI is a frontier-set of I contradicting the maximality of FI . We deduce that there exists j such that c = fj. Now we are done, since (a..c) = (f1..fj). 1 , . . . , f∗ h..c) we deduce that (f∗ h and then Lemma 5 for (a..f∗ p}. With h ∈ {1, 2, . . . , p}, we have either f∗ h) and (fl..c) we deduce that (fl..f∗ In case (iv), (a..c) is necessarily weak since it overlaps another conserved interval. W.l.o.g. we assume that (f1..fl) overlaps (a..c). Let us first prove that fl is also a frontier of (a..c). Indeed, assume a contrario that fl (cid:54)∈ F(a..c), and denote F(a..c) = {f∗ h < fl and by Lemma 5 for (f1..fl) and (f∗ h..fl) is conserved, or fl < f∗ h) is conserved. Then F(a..c)∪{fl} is a set of frontiers of (a..c), which contradicts the maximality of F(a..c). Now, by Lemma 8 for Container((a..c)) (whose frontier set contains fl by Theorem 5) and Container(I) we deduce that Container((a..c)) = Container(I). Thus using Theorem 5, we conclude that (a..c) = (f(cid:48) j) for some j ∈ FContainer(I). But since (a..c) ⊆ I and FI = FContainer(I) ∩ I, we are f(cid:48) i , f(cid:48) done. 2 i ..f(cid:48) The following theorem ensures that in the inclusion tree T of the strong con- served intervals of P, weak intervals are exactly the intervals extending between two frontiers of a strong interval. Moreover, each weak interval is uniquely rep- resented in such a way. In addition, the computation of the tree and of all the frontier sets is linear. Theorem 6 Let T be the inclusion tree T of strong conserved intervals of a set 489 P of permutations. Then: 490 14 1. a conserved interval I of P is weak if and only if there exists a strong inter- val J of P and two frontiers fi, fj ∈ FJ such that I = (fi..fj). Moreover, in this case J is unique. 2. for each strong conserved interval I of T with parent J in T , there is a unique conserved interval L(I) = (fi..fi+1) defined by successive frontiers in FJ such that I (cid:40) (fi..fi+1). 3. the tree T , the maximal set of frontiers FJ of each strong conserved interval J and the interval L(I) of each strong conserved interval I (cid:54)= (1..n) may be computed in global O(n) time and O(n) space. Proof. Concerning affirmation 1, the "⇒" part is deduced directly from Theo- rem 5, whereas the "⇐" part is ensured by the definition of a set of frontiers. Again by Theorem 5, we deduce the uniqueness of J. Affirmation 2 results from Lemma 9. According to affirmation 1 in this lemma, I cannot contain a frontier of J, since otherwise I would be of the form (fi..fj), with fi, fj ∈ FJ , and thus would not be strong. Thus, by affirmation 2 in Lemma 9, we deduce the existence of L(I), which is necessarily unique by the definition of the frontiers. We focus now on affirmation 3. In Bergeron and Stoye (2006), a conserved interval is called irreducible if it cannot be written as the union of smaller conserved intervals. It is easy to notice that the set of irreducible intervals of size at least two is exactly composed of the intervals (fi..fi+1), where fi, fi+1 are two consecutive frontiers of a strong conserved interval of P. Indeed, affirmation 1 shows that the only irreducible weak conserved intervals I = (fi..fj) are those for which j = i + 1, and obviously the only irreducible strong intervals I are those with FI = 2, which are of the form (f1..f2), with FI = {f1, f2}. To show affirmation 3, we notice that the number of irreducible intervals is in O(n) [Bergeron and Stoye (2006)], and that they may be computed in O(n) time and space for an arbitrary number K of permutations using generators from Rusu (2012). Knowing irreducible conserved intervals, the computation of strong intervals, of their set of frontiers, as well as that of the tree is quite easy. First, one must plot on the identity permutation the O(n) irreducible intervals of size at least two, by marking the left and right endpoint of each such irreducible interval. Notice that each element p of the permutation Idn has at most two marks, the equality occurring only when p is an internal (that is, different from an endpoint) frontier of a strong interval. We assume the right mark of p (when it exists) always precedes the element p whereas the left mark (when it exists) always follows the element p, so that a left-to-right traversal of Idn allows to close the interval with right endpoint p before opening the interval with left endpoint p. Replacing left and right marks with respectively (square) left and right brack- ets indexed by their corresponding element p on Idn, we obtain an expression E which has correctly nested brackets, since irreducible intervals may only overlap on one element. Moreover, if I and J are strong intervals such that J is the 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 15 parent of I, then I (cid:40) L(I) ⊆ J and thus these intervals are closed exactly in this order during a left-to-right traversal of the expression E. The expression E then allows, during a left-to-right traversal, to discover the strong intervals according to a post-order traversal of T , which is built on the fly. A strong conserved interval J is obtained by chaining as long as possible neighboring ir- reducible intervals, i.e. such that the right bracket of an interval is followed by the endpoint p of the interval and by the left bracket of the next interval. Its frontiers are given by the endpoints of the chained irreducible intervals. Also, since I (cid:40) L(I) for all strong intervals I, it is easy to identify L(I) since it is the interval which closes immediately after I during the traversal. 2 Example. Let P = {Id9, P2}, where P2 = (1,−3,−2, 4, 5,−8,−7,−6, 9). The strong intervals are (1..9) (with frontier set {1, 4, 5, 9}), (2..3) (with frontier set {2, 3}) and (6..8) (with frontier set {6, 7, 8}). To build T , we first plot the irreducible intervals, i.e. (1..4), (2..3), (4..5), (5..9), (6..7) and (7..8) on P1, and we obtain the expression: E = 1 [1 −3 [3 ]2 − 2 ]4 4 [4 ]5 5 [5 −8 [8 ]7 − 7 [7 ]6 − 6 ]9 9 . A left-to-right traversal of E allows to find first the interval (2..3) which is included in (1..4), and thus the node (2..3) of T is built, and a node x starting with (1..4) is created and defined as the parent of (2..3). Next, the interval (1..4) in x is continued with (4..5) (just change the interval inside the already existing node), and continued with another interval (5..t), where t is not yet known. Still, (7..8) is discovered as a subinterval of (5..t), and it may be continued with (6..7), thus creating together the interval (6..8) which is another child of x. Once this is done, we read 9 which indicates that t = 9. Thus T has three nodes, the root (1..9) (with frontier set {1, 4, 5, 9} discovered during the traversal), and its two children (2..3) (with frontier set {2, 3}) and (6..8) (with frontier set {6, 7, 8} discovered during the traversal). 4.2 Properties of b-nested conserved intervals Recall that by definition all b-small conserved intervals are b-nested conserved intervals. The characterization below of b-nested conserved intervals has some similarities with that of b-nested common intervals represented in the P Q-tree as Q-intervals (see affirmation (b) in Theorem 3). Let J be a conserved interval and let FJ = {f1, f2, . . . , fk} be its maximal set of frontiers. We say that J contains a b-gap at position l if (fl..fl+1) is (b + 1)-large. Furthermore, we say that a conserved interval (a..c) falls in the gap between fl and fl+1 of J if fl < a ≤ c < fl+1 and Container((a..c)) has the parent Container(J). In other words, J is represented in T by the node Container(J) and (a..c) is represented by the node Container((a..c)), in such a way that the former node is the parent of the latter one. A b-gap at position l is said good if it contains at least one b-nested strong conserved interval I with I ≥ (fl..fl+1) − b, or equivalently I ≥ fl+1 − fl + 1 − b. Then a good b-gap is a b-nested conserved interval. 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 16 Theorem 7 A conserved interval J of P is b-nested if and only if it contains no b-gap, or if it contains exactly one good b-gap fl..fl+1. Proof. We first prove the "⇐" part. Let J be a conserved interval with maximal set of frontiers FJ = {f1, f2, . . . , fk}. If J contains exactly one b-gap, let it be at position l. Otherwise, let us fix arbitrarily l = 1. In both cases, (fl..fl+1) is a conserved b-nested interval: either because it is b-small, or because it is a good b-gap. Now, for all j > l + 1 in increasing order, we deduce by induction that (fl..fj) is a conserved interval (by definition of the set of frontiers) containing (fl..fj−1), and thus it is b-nested. Thus (fl..fk) is a conserved b-nested interval. Similarly, we deduce by induction that (fu..fk) is a conserved b-nested interval, for all decreasing values of u = l − 1, l − 2, . . . , 1. Thus J = (f1..fk) is b-nested. Now let us prove the "⇒" part, by proving (a) that an conserved interval with two b-gaps or more is not b-nested, and (b) that if a b-nested conserved interval contains one b-gap then this b-gap is good. Proof of (a). Assume by contradiction that J with FJ = {f1, f2, . . . , fk} is conserved b-nested and contains two b-gaps at initial positions l and r (l < r). The b-nestedness of J implies the existence of a b-nested conserved interval J(cid:48) (cid:40) J such that J(cid:48) ≥ J − b. Now, J(cid:48) ∩ (fl..fl+1) ≥ 2, otherwise J(cid:48) misses at least b + 1 elements from (fl..fl+1) (which is (b + 1)-large) and thus J(cid:48) ≤ J − (b + 1), a contradiction. Similarly, J(cid:48) ∩ (fr..fr+1) ≥ 2. We deduce that J(cid:48) contains both fl+1 and fr, as well as at least one additionnal element on the left of fl+1 and one additionnal element on the right of fr. By Lemma 9 with I = J and (a..c) = J(cid:48) we have that J(cid:48) = (fu..fv) with u ≤ l and r + 1 ≤ v. Thus the existence of the b-nested interval J containing the two b-gaps implies the existence of a smaller b-nested interval J(cid:48) still containing the two b-gaps. Now assume a maximal size series J0 = J, J1 = J(cid:48), . . . of b-nested conserved intervals has been built similarly, each interval being strictly included in the previous one, all containing the two b-gaps. Such a series ends with (fl..fr+1), since otherwise (if the last interval is larger) it is possible to construct a smaller b-nested interval included in the last interval and containing (fl..fr+1). Thus (fl..fr+1) is b-nested. But this is not possible, as it cannot strictly contain another b-nested common interval of size at least (fl..fr+1) − b. As before, such an interval needs to contain the two gaps, and it is therefore not strictly included in (fl..fr+1). Proof of (b). Assume now that J with FJ = {f1, f2, . . . , fk} is conserved b- nested and has a unique b-gap situated at position l. As before, J must contain a b-nested conserved interval J(cid:48) with J(cid:48) > J− b and then J(cid:48) ∩ (fl..fl+1) ≥ 2 implying by Lemma 9 that J(cid:48) must contain (fl..fl+1). The smallest interval obtained following the same reasoning is then (fl..fl+1) itself, which must be b-nested. As this interval has no internal frontiers (otherwise FJ would not be maximal), any b-nested common interval I = (a..c) of size at least fl+1−fl +1−b it contains satisfies fl < a < c < fl+1. If I is strong then we are done, otherwise Container(I) is strong and has all the required properties. 2 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 17 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 4.3 Computing and counting all b-nested conserved inter- vals Theorem 6 allows to count and to enumerate efficiently all b-nested conserved intervals. The computation may be performed, as was the case for common intervals, in a single post-order traversal of the inclusion tree T , focusing on each strong conserved interval I of P. First compute the b-gaps of I. Mark I as b-nested if it contains no b-gap or one b-gap (fl..fl+1), with fl, fl+1 ∈ FI , that is a good one. The latter verification assumes that during the treatment of each child I(cid:48) of I, if I(cid:48) is detected as b-nested, then L(I(cid:48)) (which is an interval (fj..fj+1) with fj, fj+1 ∈ FI ) is marked as good if and only if L(I(cid:48)) is a b-gap and I(cid:48) ≥ L(I(cid:48))−b (otherwise, L(I(cid:48)) is not marked at all). Now, if I is b-nested and I (cid:54)= (1..n), the same type of mark is performed on L(I) if the conditions are fulfilled. Then, applying Algorithm 2 on each strong conserved interval I allows to enumerate all the b-nested conserved intervals generated by the frontiers of I, according to Theorem 6. Affirmation 1 in Theorem 6 ensures that each interval is output exactly once. The running time of Algorithm 2 is clearly linear in the number of intervals output plus the numbers of children of I, yielding a global O(n + nocc) time. Input: A strong conserved interval I, its frontier set FI , the children of I in T marked as nested or not Output: The conserved b-nested intervals generated by the frontiers of I for i from 1 to FI do and strictly included in I // counts the good b-gaps between fi and fj j ← i + 1 goodgaps ← 0 stop ← f alse repeat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 if fj − fj−1 > b + 1 then // Found a b-gap at j if (fj, fj+1) is a good gap and goodgaps = 0 then goodgaps ← 1 stop ← true else endif endif if not stop then output (fi..fj) end if // notice (f1..fFI) is not output j ← j + 1 until stop and (j = FI + 1 or (i = 1 and j = Fi)) endfor Algorithm 2: Conserved b-nested intervals To simply count the number of b-nested conserved intervals in I, we must 18 follow the same approach as for common intervals. Good and not good b-gaps are identified during a search among the intervals (fl..fl+1), where FI = {f1, f2, . . . , fk}. Then, for each good b-gap we compute the number l (respectively r) of successive (b + 1)-small intervals (fi..fi+1) on its left (respectively right). We count the number of b-nested conserved intervals containing the good b-gap as l ∗ (r + 1) + r. Next, for each maximal set of successive (b + 1)-small intervals (fi..fi+1) we add h ∗ (h − 1)/2 b-nested common intervals, where h is the number of (b + 1)-small intervals in the set. All these operations obvisously take O(n) time and space. 5 Conclusion In this paper we introduced the family of b-nested common intervals of K per- mutations, and showed that it may be computed in time proportional to its cardinality. This approach extends to any closed family of intervals that is represented by a P Q-tree. We also show that our approach can be applied to conserved intervals, whose structure and properties are close but still dif- ferent from those of common intervals. The interest of our generalization of common/conserved intervals for finding conserved clusters of genes should be attested by further experiments. Also, other applications may be devised, such as helping the identification of orthologs/paralogs or defining distances between genomes in an evolutionary approach. These are the close perspectives of our work. References A. Amir, L. Gasieniec, and B. Riva Shalom. Improved approximate common interval. Information Processing Letters, 103(4):142 -- 149, 2007. M.-P. B´eal, A. Bergeron, S. Corteel, and M. Raffinot. An algorithmic view of gene teams. Theoretical Computer Science, 320(2-3):395 -- 418, 2004. A. Bergeron and J. Stoye. On the similarity of sets of permutations and its applications to genome comparison. Journal of Computational Biology, 13 (7):1340 -- 1354, 2006. A. Bergeron, M. Blanchette, A. Chateau, and C. Chauve. Reconstructing ances- tral gene orders using conserved intervals. In Proceedings of WABI, volume 3240 of Lecture Notes in Computer Science, pages 14 -- 25, 2004. 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 19 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 A. Bergeron, C. Chauve, F. de Montgolfier, and M. Raffinot. Computing com- mon intervals of K permutations, with applications to modular decomposition of graphs. SIAM Journal of Discrete Mathematics, 22(3):1022 -- 1039, 2008. G. Blin, D. Faye, and J. Stoye. Finding nested common intervals efficiently. Journal of Computational Biology, 17(9):1183 -- 1194, 2010. G. Fertin and I. Rusu. Computing genomic distances: An algorithmic viewpoint. In Algorithms in Computational Molecular Biology: Techniques, Approaches and Applications, M. Elloumi, A. Y. Zomaya eds., pages 773 -- 797. Wiley Series in Bioinformatics, 2011. M. Y Galperin and E. V Koonin. Who's your neighbor? new computational approaches for functional genomics. Nature Biotechnology, 18(6):609 -- 613, 2000. R. Hoberman and D. Durand. The incompatible desiderata of gene cluster properties. In Proceedings of RECOMB-CG, volume 3678 of Lecture Notes in Computer Science, pages 73 -- 87, 2005. U. Kurzik-Dumke and A. Zengerle. Identification of a novel drosophila melanogaster gene, angel, a member of a nested gene cluster at locus 59f4,5. Biochim Biophys Acta, 1308(3):177 -- 81, 1996. G. M. Landau, L. Parida, and O. Weimann. Using P Q-trees for comparative genomics. In Proceedings of CPM, volume 3537 of Lecture Notes in Computer Science, pages 128 -- 143, 2005. W. C Lathe, B. Snel, and P. Bork. Gene context conservation of a higher order than operons. Trends in Biochemical Sciences, 25(10):474 -- 479, 2000. L. Parida. Gapped permutation patterns for comparative genomics. In Pro- ceedings of WABI, volume 4175 of Lecture Notes in Computer Science, pages 376 -- 387, 2006. S. Pasek, A. Bergeron, J. L. Risler, A. Louis, E. Ollivier, and M. Raffinot. Identification of genomic features using microsyntenies of domains: domain teams. Genome Research, 15(6):867 -- 874, June 2005. I. Rusu. New applications of interval generators to genome comparison. Journal of Discrete Algorithms, 10:123 -- 139, 2012. I. Rusu. MinMax-Profiles: A unifying view of common intervals, nested com- mon intervals and conserved intervals of K permutations. arXiv:1304.5140, submitted, 2013. J. Tamames. Evolution of gene order conservation in prokaryotes. Genome Biology, 2(6):R0020, 2001. T. Uno and M. Yagiura. Fast algorithms to enumerate all common intervals of two permutations. Algorithmica, 26:290 -- 309, 2000. 20
1812.03535
1
1812
2018-12-09T18:03:46
On balanced clustering with tree-like structures over clusters
[ "cs.DS", "cs.AI" ]
The article addresses balanced clustering problems with an additional requirement as a tree-like structure over the obtained balanced clusters. This kind of clustering problems can be useful in some applications (e.g., network design, management and routing). Various types of the initial elements are considered. Four basic greedy-like solving strategies (design framework) are considered: balancing-spanning strategy, spanning-balancing strategy, direct strategy, and design of layered structures with balancing. An extended description of the spanning-balancing strategy is presented including four solving schemes and an illustrative numerical example.
cs.DS
cs
Mark Sh. Levin ∗ 8 On balanced clustering with tree-like structures over clusters 1 0 2 c e D 9 The article addresses balanced clustering problems with an additional requirement as a tree-like struc- ture over the obtained balanced clusters. This kind of clustering problems can be useful in some applica- tions (e.g., network design, management and routing). Various types of the initial elements are considered. Four basic greedy-like solving strategies (design framework) are considered: balancing-spanning strategy, spanning-balancing strategy, direct strategy, and design of layered structures with balancing. An ex- tended description of the spanning-balancing strategy is presented including four solving schemes and an illustrative numerical example. ] S D . s c [ 1 v 5 3 5 3 0 . 2 1 8 1 : v i X r a Keywords: applications balanced clustering, combinatorial optimization, spanning tree, heuristics, networking, Contents 1 Introduction 2 Problem description and statement 3 Basic solving strategies 3.1 Balancing-spanning strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Spanning-balancing strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Direct solving strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Design of layered structures with balancing . . . . . . . . . . . . . . . . . . . . . . . . . . 4 On improvement/correction of solutions 5 Conclusion 6 Acknowledgments 1. Introduction 1 2 4 4 5 10 10 11 11 11 Balancing clustering is often a significant part of many theoretical and practical problems. In this paper, special balanced clustering problems with an additional requirement as a tree-like structure over the obtained balanced clusters are considered. This kind of clustering problems can be useful in many network applications (e.g., network design, management and routing). The global quality of the solution is examined as quality of the obtained balanced clustering solution and quality of the spanning structure over the balanced clustering solution (i.e., two-component vector). Thus, the resultant problem is targeted to find the Pareto-efficient solution(s). Balanced clustering problems are often examined for the following basic cases (e.g., [70,71]): (i) cluster size requirement, (ii) cluster weight balance requirement, and (iii) cluster element structure requirement (here several types of the initial elements are considered). In the paper, the third case above is mainly under examination. Here, the solution quality is based on multiset estimate [64,66,70,71]. The following kinds of basic spanning trees can be considered: degree balanced tree and height balanced tree. Quality of the balanced structure is a proximity between obtained spanning ∗Mark Sh. Levin: Inst. email: [email protected] for Inform. Transmission Problems, Russian Academy of Sciences; http://www.mslevin.iitp.ru; 2 structure and the basic type of balanced structure. The considered problems are illustrated by numerical examples. Four basic greedy-like solving strategies are considered: balancing-spanning strategy, spanning-balancing strategy, direct strategy, and design of layered structures with balancing. An extended description of the spanning-balancing strategy is presented including four solving schemes and an illustrative numerical example. Approaches for improvement of the obtained solutions are briefly pointed out. 2. Problem description and statement A general glance to balanced clustering problems has been presented in [70,71]. Here a special balanced clustering problem is examined when the solution involves balanced clustering solution and a spanning structure (e.g., tree) over the obtained balanced clusters (Fig. 1). ✬ Initial data: (a) element set, element attributes; element types; (b) element set with structure over the set ✫ ✩ =⇒ Design of balanced clusters and total structure ✪ =⇒ Structure over clusters ✛ ✞✝ ☎✆ ✞✝ ☎✆ ✎✍ ☞✌✎✍ ☞✌✲✛ ✎✍ ☞✌✎✍ ☞✌✲✛ Balanced clusters ❅❅■ ✛ ✠ ✻❄ ✒ ❅ ❅■ ✠ ❅❘❅ ✻❄ Quality of structure Quality of balanced clusters Fig. 1. Balanced clustering with structure over clusters Some designations are as follows (e.g., [64,66,67,69,70,71]). Let A = {a1, ..., ai, ..., an} be an initial set of items; eX = {X1, ..., Xj, ...Xk} be a clustering solution Xj1 ∩ Xj1 = 0 ∀ 1 ≤ j1 < j2 ≤ k). The where Xj ⊆ A (for simplification without intersections: following types of items are considered: type 1,..., type ξ, ...,type l. The description of cluster Xj by its element types is (vector, multiset estimate [64,66,70,71]): e(Xj) = (η1(Xj), ..., ηξ(Xj), ..., ηl(Xj)) where ηξ(Xj) is the number of elements of type ξ which are contained in cluster Xj, Pξ=1,l ηξ(Xj) = Xj. Fig. 2 depicts four types of items (elements) and several cluster examples. Here, descriptions of the clusters by element types are: e(X1) = (0, 0, 0, 4), e(X2) = (0, 0, 0, 3), e(X3) = (0, 0, 1, 3), e(X4) = (0, 0, 1, 2), e(X5) = (0, 1, 2, 1), e(X6) = (0, 1, 1, 1), e(X7) = (1, 1, 1, 1), and e(X8) = (0, 1, 2, 0). (e) cluster X5 (f) cluster X6 (g) cluster X7 (h) cluster X8 Fig. 2. Illustrative example: typical elements and clusters Some illustrative examples of the problem solutions are shown in figures: (a) clusters balanced by cluster size (about 4), tree-like structure over clusters (Fig. 3); (b) clusters balanced by cluster size (about 4) and types of elements (three elements of type 1, one element of type 2), tree-like structure over clusters (Fig. 4); (c) clusters are divided by layers, clusters are balanced at each layer (by element types, by element number), layered structure over clusters (Fig. 5); basic cluster structure by element types: bottom layer: three elements of type 4, one element of type 3; medium layer: three elements of type 3, one element of type 2; top layer: three elements of type 2, one element of type 1. Evidently, the quality of the obtained solution involves two parts: (i) quality of balanced clustering, e.g., proximity for each cluster to the specified requirements to the cluster (e.g., by element number, by total element weight, by element types) (e.g., [70,71]); (ii) quality of the structure over the balanced clusters (e.g., proximity to a specified structure as chain, tree, balanced tree, hierarchy) (e.g., [66]). (a) cluster X1 (b) cluster X2 (c) cluster X3 (d) cluster X4 ✏ ✓ ✑r r r r❅❅ ✒ ✏ ✓ ✑rt r❞ r❞ r❅❅ ✒ ✏ ✓ ✑r rr❆❆ ✁✁ ✒ ✓ ✏ ✑r❞ rtr❆❆ ✁✁ ✒ ✏ ✓ ✑r r❞ r r❅❅ ✒ ✓ ✏ ✑t❢ rt rr r❞❅❅ ✒ ✏ ✓ ✑r r❞r❆❆ ✁✁ ✒ ✓ ✏ ✑rt r❞r❞❆❆ ✁✁ ✒ Typical elements: t❢ Type 1 rt Type 2 r❞ Type 3 rr Type 4 3 ✑✑ ✑✑ ✑✑ ✑✑ ◗◗ ◗◗ ◗◗ ◗◗ ✑ ◗ ◗ ✑ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ✑ ✑ ✑ ✑ ✑ ✑ ✑ ✑ ✁✁✁✁ ❆❆❆❆ Fig. 3. Example (element numbers balance) ✏ ✏ ✓ ✓ ✑r r❞ ✑r r r r❅❅✑ r r❅❅✑ ✒ ✒ ✓ ✓ ✏ ✏ ✏ ✏ ✏ ✏ ✓ ✓ ✓ ✓ ✑r❞ r ✑r❞ rr❆❆ ✁✁ ✑r r❞ ✑r ✑r ✑r rr❆❆ ✁✁ r r r r❅❅ r r❅❅ r r❅❅ r r❅❅ ✒ ✒ ✒ ✒ ✒ ✒ ✓ ✑r❞ rr❆❆ ✁✁ ✓ ✓ rr❆❆ ✁✁ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ ✏ ✏ ✏ ✏ ✏ ✏ ✏ ✏ ✏ ✏ ✏ ✏ ✑r r❞ ✑r r❞ ✑r❞ r ✑r r❞ ✑r❞ r ✑r r ✑r ✑r r ✑r r ✑r r ✑r r r r❅❅ r r r r r r❅❅ r r r r ✒ ✒ ✒ ✒ ✒ ✒ ✒ ✒ ✒ ✒ ✒ ✒ ✘ ✛ t❢ rtt t❅❅✑ ✙ ✚ ✓ ✓ ✓ ✏ ✏ ✏ ✑rt r❞ ✑st r❞r❞❆❆ ✁✁ ✑r❞ rt r❞ r❞❅❅ r❞ r❞❅❅ ✒ ✒ ✒ ✏ ✏ ✏ ✏ ✏ ✏ ✓ ✑r❞ rr❆❆ ✁✁ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ r❅❅ ✓ ✑r r❞ ✑r❞ r ✑r ✑r r❞ r❞ ✑r❞ r r r r❅❅ r r r ✒ ✒ ✒ ✒ ✒ ✒ Fig. 4. Example (element type balance) Fig. 5. Three-layer structure ✁✁✁✁ ❆❆❆❆ ✁✁✁✁ ❆❆❆❆ ◗ ◗ ◗ ◗ ✑ ✑ ✑ ✑ ◗ ◗ ◗◗ ◗◗ ✑ ✑✑ ✑✑ Consider the evaluation of balanced clusters. Let e0 = (η0 l ) be an estimate of the required structure (by element types) for the balanced cluster. Thus, proximity between the required structure and cluster Xj is (e.g., difference by components): δ(e(Xj), e0). For simplification, the following definition can ξ . For the balance clustering solution eX, quality estimate be used: of the cluster balance can be considered as follows (for example): Qcb = maxj=1,k δ(e(Xj), e0) = Pξ=1,l ηξ(Xj) − η0 δ(e(Xj), e0). ξ , ..., η0 1 , ..., η0 The following basic typical spanning structures can be used [2,5,21,28,43,59,65,66,88]: (i) various min- imum spanning trees (i.e., by total tree weight, T m) [24,28,42,43,59], (ii) degree balanced trees (T d, Fig. 6) [17,21,85] (including k-ary trees [88], degree-bounded trees [60]), (iii) height balanced trees (T h) [1,2,25,28,43,57,59] (Fig. 7), (iv) weight balanced trees (T w) (e.g., balance of the sizes of subtrees in each node) [14,49,80], and (v) special multi-layer structures [65,66]. r❳❳❳❳❳❳ ✘✘✘✘✘✘ r r r r r r ❅❅r r ❅❅r r r r ❅❅ r r r r ❅❅ r r ❅❅ r r Fig. 6. Balanced by degree (3) tree r✏✏✏✏✏ PPPPP r✘✘✘✘✘✘ r❅❅r❍❍❍r✟✟✟ r r r r rr rr r ❅❅ r r❅❅r r ❅❅ r r r r r ❅❅ r r r r❅❅ r❅❅ rr r r Fig. 7. Balanced by height (3) tree Let T r be a required structure (e.g., the above-mentioned type of tree), T ( eX) be a spanning structure (tree) over obtained balanced clusters for clustering solution eX. Note some proximities of structures (e.g., trees) have been briefly described in [65,66]. Quality estimate of the spanning structure is: Qs = ∆(T ( eX), T r). As a result, the total quality estimate of clustering solution eX with corresponding spanning structure (tree) T ( eX) is a vector: (Qcb, Qs) = (maxj=1,k δ(e(Xj), e0), ∆(T ( eX), T r). Finally, the problem of balanced clustering with a required spanning structure can be examined as follows: Find the balanced clustering solution eX and corresponding spanning structure (tree) for the obtained clusters T ( eX) such that (Qcb, Qs) =⇒ min. Evidently, Pareto efficient solutions have to be examined here. In the case of multi-layer structures, the following evident general solving scheme can be considered: (1) dividing the initial item set into subsets (each subset corresponds to solution layer), (2) solving the problem above for each layer, (3) connection of the layers. In some cases, item dividing and spanning stages can be integrated (e.g., in maximum leaf spanning tree problem). In general, versions of the above-mentioned problem are very complicated (its subproblems belong to class of NP-hard problems). Only some simplifying versions may be polynomial solvable. Thus, composite 4 solving schemes (frameworks, strategies) can be used: combinations of subproblems as balanced clustering and spanning problem(s). Note phases of the above-mentioned solving strategies can be based on the following: (i) heuristics (e.g., greedy algorithms, approximation algorithms), (ii) enumerative methods, (iii) polynomial algorithms (for simple cases, e.g., minimum spanning tree). 3. Basic solving strategies Generally, four basic greedy-like solving strategies can be considered (Table 1.). Further, the schemes are described. Here the cluster balance requirement is mainly based on cluster element structure. Table 1. Basic solving strategies No. 1. Strategy Balancing-spanning strategy: 2. Spanning-balancing strategy: 3. 4. Direct solving strategy: Design of balanced layered structure: Stages (1) balanced clustering, (2) spanning structure (e.g., spanning tree) over clusters (1) spanning structure (e.g., spanning tree) over items, (2) balanced partitioning the spanning structure (e.g., tree partitioning) item clustering while taking into account requirements of cluster balances and spanning structure (1) dividing the item set into subsubsets corresponding to layers (selection of items/nodes for each layer), (2) balanced clustering of items at each layer while taking into account the requirement of spanning structure over the clusters, (3) connection of layers (including assignment/selection of the cluster heads for the connection/allocation) 3.1. Balancing-spanning strategy This solving strategy (strategy 1) involves two phases: Phase 1. Balanced clustering of the initial set of elements [70,71]. Phase 2. Design of a structure over the obtained balanced clusters (e.g., solving some spanning tree problem over the obtained clusters, basic spanning tree problems are pointed out in Table 2). The approach above is a basic one and is used in many network applications (e.g., design, management, routing). Table 2. Basic spanning problems/methods No. Research 1. Minimum spanning trees problems: 1.1. Basic minimum spanning tree problems 1.2. Minimum diameter spanning tree problem 1.3. Minimum spanning forest problems 1.4. Minimum spanning multi-tree problems 1.5. Leaf-constrained minimum spanning tree problem (similar to maximum leaf spanning tree problem) Spanning trees with maximum number of leafs problems: 2. Multicriteria (multi-objective) spanning tree problems: 2.1. Spanning tree problem with multiple objectives 2.2. Multi-criteria minimum spanning tree problem 2.3. Combining linear and non-linear objectives in spanning tree problems 3. 3.1. Maximum leaf spanning tree problems 3.2. Maximum leaf spanning arborescence problem 3.3. 3.4. 3.5. Connected dominating set problems (in sense of exact algorithms, the problem is equivalent to maximum leaf spanning tree problem) Balanced spanning tree problems: 4. 4.1. Balanced spanning trees problems 4.2. Height balanced spanning tree problems 4.3. Degree balanced spanning tree problems Spanning trees with many leafs problems Spanning directed trees with many leaves problem Source(s) [24,28,42,43,82] [45] [43,83] [44,51,91] [86] [48] [9,22] [32] [38,41,43,74,75,87] [33] [58,87] [4] [15,18,23,43,92] [2,21,28,43,59] [1,2,28,43,59] [17,21,85] 5 3.2. Spanning-balancing strategy The strategy (strategy 2) involves two phases: Phase 1. Design of a spanning structure over the initial set of elements (e.g., solving some spanning tree problem over the initial set of elements) (e.g., Table 2). Phase 2. Design of the balanced clusters (e.g., by condensing of the neighbor elements) while taking into account the obtained general structure. Here, structure-partitioning problem and corresponding methods can be used, e.g., tree (hierarchy)-partitioning (Table 3). Table 3. Some partitioning of trees/hierarchies approaches No. Research 1. Polynomial algorithms for partitioning a tree into single-center subtrees to minimize flat service costs Shifting algorithm techniques for the partitioning of trees 2. 3. Max-min tree partitioning 4. 5. 6. 7. 8. Minimum bounded edge-partition of a tree 9. Uniform centered partitions of trees Balanced partitioning of trees Tree partitioning problem Graph tree partition problems Partitioning hierarchically clustered complex networks (via size-constrained graph clustering) 10. Optimal hierarchical graph decompositions (for congestion minimization in network) 11. Clustering based on minimum spanning tree 12. Clustering based on minimum and maximum spanning trees 13. Tree partitions for cryptographic access control Source(s) [7] [12] [81] [61] [37] [77] [27] [35] [78] [84] [47,67] [10] [29] Further, four greedy-like solving schemes are described. The strategies are based on detection/selection of "condensing"/integration points (node(s) or edge(s) of the examined tree). The neighbor node of the "condensing" point are integrated with the point to get the resultant balanced cluster or its part (while taking into account the requirements/rules to the cluster). The following four types of the "condensing" points are considered: (1) minimum weight edge (as in agglomerative/hierarchical clustering) (Fig. 8); (2) leaf nodes: minimum weight edge from a leaf node to its neighbor node (bottom-up solving proce- dure) (Fig. 9); (3) root node, i.e., minimum weight edge from root node to its neighbor node (up-down solving proce- dure) (Fig. 10); (4) "condensing" points are obtained by using a special location procedure (Fig. 11). The solving schemes are as follows: Scheme 2.1. Detection of the minimum weight edge(s) (Fig. 8): Stage 1. Analysis of the initial tree. Detection of the minimum weight edge (a′, a′′), Usually a′ and a′′ are of different types. Stage 2. Building the integrated node: Ja′,a′′ = a′&a′′ Stage 3. Addition of the neighbor node to the integrated node J to get the required (by element structure) cluster (or quasi-cluster). Stage 4. Correction of the initial tree by deletion of the obtained cluster. Stage 5. Analysis of the new tree. Go To Stage 1 to examine the obtained tree if it exists, otherwise Go To Stage 6. Stage 6. Analysis of the resultant clustering solution. In the case of separated nodes, joining (addition) of the node(s) to the closest cluster (or general allocation of the separate nodes to clusters). Evaluation of the solution. Stage 7. Stopping. 6 Scheme 2.2. Detection of the minimum weight edge(s) for leaf node(s) (Fig. 9): Stage 1. Analysis of the initial tree. Detection of the leaf node b with minimum weight edge to its neighbor node a; it is preferred that b and a are of different types. Stage 2. Building the integrated node: Jb,a = b&a Stage 3. Addition of the neighbor node to the integrated node J to get the required (by element structure) cluster (or quasi-cluster). Stage 4. Correction of the initial tree by deletion of the obtained cluster. Stage 5. Analysis of the new tree. Go To Stage 1 to examine the obtained tree if it exists, otherwise Go To Stage 6. Stage 6. Analysis of the resultant clustering solution. In the case of separated nodes, joining (addition) of the node(s) to the closest cluster (or general allocation of the separate nodes to clusters). Evaluation of the solution. Stage 7. Stopping. Scheme 2.3. Detection of the minimum weight edge(s) for root node(s) (Fig. 10): Stage 1. Analysis of the initial tree. Detection of the neighbor node a for root r with minimum weight edge between them; it is preferred that r and a are of different types. Stage 2. Building the integrated node: Jr,a = r&a. Stage 3. Addition of the neighbor node to the integrated node J to get the required (by element structure) cluster (or quasi-cluster). Stage 4. Correction of the initial tree by deletion of the obtained cluster. Stage 5. Analysis of the new tree(s). Go To Stage 1 to examine the obtained tree if it exists, otherwise Go To Stage 6. Stage 6. Analysis of the resultant clustering solution. In the case of separated nodes, joining (addition) of the node(s) to the closest cluster (or general allocation of the separate nodes to clusters). Evaluation of the solution. Stage 7. Stopping. Scheme 2.4. Cluster centers based procedure (it is similar to c-mean clustering approach) (Fig. 11): Stage 1. Analysis of the initial tree. Detection of a set of special nodes (e.g., nodes of type 1) as cluster centers c1, ..., cγ , ..., cλ. Stage 2. Detection of cluster center cγ that have its neighbor node a (another node type is preferable) with the minimum edge weight. Stage 3. Building the integrated node: Jcγ ,a = cγ&a Stage 4. Addition of the neighbor node to the integrated node J to get the required (by element structure) cluster (or quasi-cluster). Stage 5. Correction of the initial tree by deletion of the obtained cluster. Stage 6. Analysis of the new tree(s). Go To Stage 1 to examine the obtained tree if it exists, otherwise Go To Stage 7. Stage 7. Analysis of the resultant clustering solution. In the case of separated nodes, joining (addition) of the node(s) to the closest cluster (or general allocation of the separate nodes to clusters). Evaluation of the solution. Stage 8. Stopping. It is reasonable to point out the following: Note 1. The above-mentioned solving schemes are polynomial (their complexities equal O(n2) or less). Note 2. Evidently, the described solving schemes can be transform into parallel procedures (i.e., parallel examination and usage of the "condensing" points, etc.). 7 Basic spanning tree ✑ ✑ ✑ ◗ ✑ ✛ ◗ ◗ ✑ ✑✑ ❍❍❥ ✑ ✑ ✑ Minimum weight edge ◗◗Root q❡r ✔ a′′✗ ✉ q❝ q❝ ✟✟✟ a′ ✕❅❅ ✖ ✤ ✜ Root q❡r q❝❏ ✢Minimum ✣ q❝ ✑✑ ◗◗ ✁ ✑ ✁✁✕ ✁ ❏❏a ✁ ✁ ❍❍❥ ✑ ✑ ✑ ◗ ◗ ◗ ◗ weight edge Basic spanning tree ✑ ✑ ✑ ✑ ◗ ◗ ◗ ◗ Fig. 8. Minimum weight edge Fig. 9. Leaf node with minimum weight edge Basic spanning tree ◗ ◗ ◗ ◗ ◗ ✑ ✑ ✑ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ◗ ✑ ✑ ✑✑ ✟✟✙ Minimum weight edge ❍❍❥ ✑ ✑ ✑ a ◗◗Root q❡r ✏ b✓ q❝ r ✟✟✟ r ✑❅❅ ✒ ◗◗Root q❡r c1 ✉ q❝ ✔ ✗ ✉ r ✉r rc2 ❅❅ edge✟✟✟✙ r q❝ ✕❅❅ ✖ ❍❍❥ ✑ ✑ ✑ cγ a ✑✑ ◗ ◗ ◗ ✑ Minimum ◗ weight ◗ ◗ ◗ ◗ Basic spanning tree ✑ ✑ ✑ ✑ Fig. 10. Root with minimum weight edge Fig. 11. Cluster center, minimum weight edge Now an illustrative numerical example is considered: (a) an initial element (item) set and their parameters are contained in Table 4: A = {a1, ..., ai, ..., a21}; (b) the edge weights between item pairs ai1 and ai2 (1 ≤ i1 <≤ i2 ≤ 18) are contained in Table 5; (c) a basic (obtained) minimum spanning tree structure (by edge weights/proximities) is shown in Fig. 12. Table 4. Elements and their parameters Item Item type Number of balanced cluster No. ai a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. ξ 1 2 1 1 1 1 2 3 2 3 2 1 1 1 2 3 2 3 3 Xj (in solution eX) 6 6 6 2 5 3 2 2 5 5 3 3 4 1 4 4 1 1 1 i2 : 2 2.5 3 2.8 ⋆ 4 ⋆ 3.0 ⋆ 8 i1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 6 ⋆ ⋆ 4.1 ⋆ ⋆ 7 ⋆ ⋆ ⋆ 1.0 ⋆ ⋆ 8 ⋆ ⋆ ⋆ 0.6 ⋆ ⋆ ⋆ 9 ⋆ ⋆ ⋆ ⋆ 1.3 ⋆ ⋆ ⋆ Table 5. Edge weights between items ai1 and ai2 13 5 ⋆ ⋆ ⋆ ⋆ 3.5 ⋆ ⋆ ⋆ ⋆ ⋆ 4.2 ⋆ ⋆ ⋆ ⋆ ⋆ 12 ⋆ ⋆ ⋆ ⋆ ⋆ 1.0 ⋆ ⋆ ⋆ ⋆ ⋆ 11 ⋆ ⋆ ⋆ ⋆ ⋆ 1.1 ⋆ ⋆ ⋆ ⋆ 10 ⋆ ⋆ ⋆ ⋆ 1.2 ⋆ ⋆ ⋆ ⋆ 14 ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ 15 ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ 1.1 ⋆ 16 ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ 1.3 ⋆ ⋆ 17 ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ 1.0 ⋆ ⋆ 18 ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ 0.5 ⋆ ⋆ ⋆ 19 ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ 2.0 ⋆ ⋆ ⋆ ⋆ Typical items: ✁ ✁ ✉a1q❝a2 ✉ Type 1 q❝ Type 2 ✉❅❅ a3PPPPP❍❍❍ r Type 3 ✉a6q❝ ✉a5q❝ ✉a4 r❅❅ r❅❅ r❅❅ q❝✁ ✉a13 ✉a14q❝a17 q❝a15 r❅❅ r❅❅ a18 r❍❍❍ a7 ✁ ✁ ✁ a16 a19 a10 a8 a9 a11 a12 Fig. 12. Basic spanning tree It is assumed the required structure of the balanced cluster is: node of type 1, node of type 2, node of e0 = (1, 1, 1). The basic set of leaf type 3. The corresponding estimate of the cluster structure equals nodes is: L = {a8, a9, a10, a11, a12, a15, a16, a17, a18, a19} (Table 6). Table 6. Leaf nodes and corresponding distances Leaf node ai Edge (ai, b) Edge weight w(ai, b) I. Basic leaf nodes: a8 a9 a10 a11 a12 a15 a16 a17 a18 a19 II. Additional leaf nodes: a2 a3 (a8, a4) (a9, a5) (a10, a5) (a11, a6) (a12, a6) (a15, a13) (a16, a13) (a17, a14) (a18, a14) (a19, a14) (a2, a1) (a3, a1) 0.6 1.3 1.2 1.3 1.0 1.1 1.3 1.0 0.5 2.0 2.5 2.8 9 Solving scheme 2.2 is used as follows: 1st algorithm step: Selection of the minimum weight edge: (a18, a14) (weight w(ai, b) = 0.5). Inte- gration of nodes: Ja18,a14 = a18&a14 (an initial part of cluster). Evident addition of node a17 to the integrated node to obtain a balanced (by element structure) cluster X1 = {a14, a17, a18}, estimate of the cluster structure is: e(X1) = (1, 1, 1). 2nd algorithm step: Selection of the minimum weight edge: (a8, a4) (weight w(ai, b) = 0.6). Integration of nodes: Ja8,a4 = a8&a4 (an initial part of cluster). Evident addition of node a7 to the integrated node to obtain a balanced (by element structure) cluster X2 = {a4, a7, a8}, estimate of the cluster structure is: e(X2) = (1, 1, 1). Note, a2 is an additional leaf node (addition in Table 24). 3rd algorithm step: Selection of the minimum weight edge: (a12, a6) (weight w(ai, b) = 1.0). Integration of nodes: Ja12,a6 = a12&a6 (an initial part of cluster). Evident addition of node a11 to the integrated node to obtain a balanced (by element structure) cluster X3 = {a6, a11, a12}, estimate of the cluster structure is: e(X3) = (1, 1, 1). 4th algorithm step: Selection of the minimum weight edge: (a15, a13) (weight w(ai, b) = 1.1). Inte- gration of nodes: Ja15,a13 = a15&a13 (an initial part of cluster). Evident addition of node a16 to the integrated node to obtain a balanced (by element structure) cluster X4 = {a13, a15, a16}, estimate of the cluster structure is: e(X2) = (1, 1, 1). 5th algorithm step: Selection of the minimum weight edge: (a10, a5) (weight w(ai, b) = 1.2). Integration of nodes: Ja10,a5 = a10&a5 (an initial part of cluster). Evident addition of node a9 to the integrated node to obtain a balanced (by element structure) cluster X5 = {a5, a9, a10}, estimate of the cluster structure is: e(X5) = (1, 1, 1). Note, a3 is an additional leaf node (addition in Table 24). The obtained tree is shown in Fig. 13. 6th algorithm step: Selection of the minimum weight edge: (a2, a1) (weight w(ai, b) = 2.5). Integration of nodes: Ja2,a1 = a2&a1 (an initial part of cluster). Evident addition of node a3 to the integrated node to obtain a balanced (by element structure) cluster X6 = {a1, a1, a3}, estimate of the cluster structure is: e(X5) = (2, 1, 0). Note, the obtained cluster has not the required element structure. 7th algorithm step: Extension of cluster X1 by the separated node a19: X 1 = X1&a19, e(X 1) = (1, 1, 2). Thus, the obtained clustering solution is: a2 a9 ✉a1q❝ ✉❅❅ a3 PPPPP❍❍❍ ✩ X3★ ✥ X5★ ✉a6q❝ ✉a5q❝ r❅❅ r❅❅ ✧ ✦ ✧ ✪ X1✬ ✩ ✉a14q❝a17 rPPPPP r❅❅ ✪ ✫ a19 a11 a18 a10 a12 a8 X2 ✁ ✁ ✬ ✉a4 r❅❅ q❝✁ ✫ X4★ ✥ ✉a13 q❝a15 r❅❅ ✧ ✦ a7 ✁ ✁ ✁ a16 a2 X2 eX = {X 1, X2, X3, X4, X5, X6} (Fig. 14, Table 4). ✜ X6✤ ✉a1q❝ ✉❅❅ ✢ ✣ a3 PPPPP❍❍❍ ✩ ✬ X3★ ✥ ✥ X5★ ✉a6q❝ ✉a5q❝ ✉a4 r❅❅ r❅❅ r❅❅ q❝✁ ✦ ✧ ✧ ✦ ✪ ✫ X4★ X 1✬ ✩ ✥ ✉a14q❝a17 ✉a13 rPPPPP q❝a15 r❅❅ r❅❅ ✪ ✫ ✧ ✦ ✁ ✁ a7 ✁ ✁ ✁ a16 a19 a11 a10 a18 a12 a8 a9 ✥ ✦ Fig. 13. Spanning tree (after algorithm step 5) Fig. 14. Spanning tree (after algorithm step 7) The quality of the balanced clustering can be calculated as follows [70,71] (it is assumed X1 = X 1): Qcb( eX) = max j=1,6 δ(e(Xj), e0) = max[δ(e(X1), e0)), δ(e(X6), e0)] = max[1, 2] = 2. 10 3.3. Direct solving strategy This strategy can be considered as hierarchical (agglomerative) clustering (bottom-up procedure) while taking into account special balance requirements (e.g, by cluster size, by cluster element structure). Some hierarchical clustering approaches are pointed out in Table 7. Table 7. Some hierarchical clustering studies (surveys, methods) No. Research General surveys on clustering 1. Surveys on combinatorial clustering 2. Approximate hierarchical clustering via sparsest cut and spreading metrics 3. Performance guarantees for hierarchical clustering 4. Cost function for similarity-based hierarchical clustering 5. General approach for incremental approximation and hierarchical clustering 6. Hierarchical clustering based on ordinal estimates 7. Hierarchical clustering algorithm based on the Hungarian method 8. 9. Graph-based hierarchical conceptual clustering 10. Hierarchical graph decompositions (in network) 11. Hierarchical agglomerative clustering (in wireless sensor networks) 12. Hierarchical clustering for categorical data (using a probabilistic rough set model) 13. Hierarchical clustering via joint between-within distances (extending Ward's minimum variance method) Interval competitive agglomeration clustering algorithm 14. 15. Unsupervised multidimensional hierarchical clustering Some sources [53,54] [67,69] [20] [31] [30] [73] [62,67] [46] [56] [84] [76] [72] [89] [55] [34] In [67], the procedure and numerical example of hierarchical balanced clustering (while taking into account cluster sizes) are described. Note, the procedure of hierarchical balanced clustering while taking into account cluster element struc- ture is similar to the above-mentioned procedure. On the other hand, this strategy is similar to strategy 2.2 from the previous section. 3.4. Design of layered structures with balancing Here the following evident three phase solving strategy can be considered: Phase 1. Dividing the initial set of elements to obtain several subset (each obtained element subset corresponds to a specified solution layer). Here, various procedures can be used, for example: (i) selec- tion of the elements, (ii) special spanning problems (e.g., maximum leaf node spanning tree problem, independent set problem). Phase 2. Solving a special balanced clustering problem at each layer. Phase 3. Connection of the layers (i.e., connecting the elements of different layers). A illustrative example of the balanced three layered structure is depicted in Fig. 15 (four types of items are considered). Several solving schemes for the design of layered structured (including layered networks) are described in [65,66]. Note, some multi-node cluster at top network layers can be considered as composite hubs (e.g., communication networks, transportation networks). ✛ ✑ Layer 1 ★ ✥ ✘ ✛ r❞❢ r❞❢r❞❢ r❞❢❅❅ ✙ ✚ ✦ ✧ ✬ ✩ ✔ ✔ ✔ ✗ ✗ ✗ ✕st rtrt❆❆ ✁✁ ✕st rtrt❆❆ ✁✁ ✕st rtrt❆❆ ✁✁ ✗ ❅❅ ✲✗ ✔ ✔ ✕st rtrt❆❆ ✁✁ ✕st rtrt❆❆ ✁✁ s✐r❢ ✑ ✖ ✖ ✖ ✑✑✰ r❢✁✁☛ r❢◗ ◗◗sr❢❆❆❯ ✖ ✖ ✪ ✫ ✬ ✩ ✓ ✏ ✏ ✏ ✏ ❍❍❥✓ ✓ ✓ ✑r ✑r❞ r ✑r r❞ r❞ ✑r❞ r r r❅❅ r r❅❅ r r❅❅ r❅❅ r ✒ ✒ ✒ ✒ s✐ ✲ r❢r❢✠ r❢❄ r❢❅❅❘ r❢✛r❢ ✑ ✏ ✏ ✏ ✏ ✓ r❅❅ ✓ ✓ r❅❅ ✓ ✑r r❞ ✑r❞ r ✑r r❞ ✑r❞ r ✑✑✰ r❢✁✁☛ r r r❅❅ r r❅❅ r ✒ ✒ ✒ ✒ ✫ ✪ ✑✰ ✏✏✏ ✏✏✏ ✟✟ ✁✁ ❆❆❯ ❄ Fig. 15. Example of balanced layered structure Spanning structure Spanning structure ❅❅ ❆❆ ✁✁☛ ❄ Layer 3 Layer 2 ❆❆❆❆ ✲ ✲ ❆❆❆❆ ✛ ✁✁✁✁ ❆❆❆❆ 11 4. On improvement/correction of solutions The improvement/correction procedure of preliminary obtained solution is important additional part of the solving strategies. In Table 8, the basic problem elements which are under modification operations in improvement/correction approaches are pointed out. Four basic approaches for solution improvement in combinatorial optimization are pointed out in Table 9. Table 8. Basic problem element modification operations No. Element under modification 1. Element as node/vertex (e.g., graph, network) 2. Element as edge/arc (e.g., graph, network) 3. Element group, cluster 3. Structure over elements/clusters (e.g., spanning structure over elements/clusters, i.e., tree, chain, forest, hierarchy, etc.) Operations 1.Deletion 2.Addition 3.Condencing (unification) 4.Decoupling (disintegration) 1.Deletion 2.Addition 3.Condencing (unification) 4.Decoupling (disintegration) 1.Deletion 2.Addition 3.Condencing (unification) 4.Decoupling (disintegration) 1.Augmentation 2.Decoupling (disintegration) 3.Transformation to another structure Table 9. Solution improvement/correction approaches No. Research direction 1. 2. 4. 3. 4. Improvement algorithm as part of local optimization and heuristic procedures (e.g., exchange techniques, reassignment/recoloring) Augmentation problems as modification of an initial graph/network (e.g., addition/correction of solution components as vertices or/and edges/arcs) to get the solution (i.e., graph/network) with a required property(ies), e.g., the required level of the graph/network connectivity Independence free graphs and vertex connectivity augmentation Reoptimization (small correction of an initial solution to improve its quality as improvement of the solution objective function(s)) Restructuring problems (modification of an initial solution while taking into account two criteria: minimum modification cost, minimum proximity to a next solution at the next time stage) Source(s) [3,26,28,43,50,79,90] [36,39,40,43,52] [52] [8,11,13,16] [63,68] 5. Conclusion The paper describes the author outline of heuristic solving frameworks to the design of balanced clustering solutions and spanning structures (e.g., tree) over the obtained clusters. Four basic greedy-like solving strategies are described. Examples illustrate the problems and solving procedures. Generally, the paper has a preliminary character. The material has to be extended in the future. It may be reasonable to point out some prospective research directions: (1) examination and usage of multicriteria and fuzzy problem formulations; (2) consideration of other types of spanning structures over the obtained balanced clusters (e.g., chain, forest, hierarchy); (3) study of other solving approaches (e.g., random algorithms); (4) design of a software system for implementation of the considered problems and solving schemes; (5) evaluation of the solving schemes for the considered problems on the basis of computing experiments; and (6) investigation of various realistic network applications of the described clustering problems (e.g., network design and management). 6. Acknowledgments The research was done in Institute for Information Transmission Problems of Russian Academy of Sciences and supported by the Russian Science Foundation (grant 14-50-00150, "Digital technologies and their applications"). 12 REFERENCES 1. G.M. Adelson-Velsky, E.M. Landis, An algorithm for the organization of information. Soviet Math. Doklady, 3, 1259 -- 1263, 1962. 2. A.V. Aho, J.E. Hopcroft, J.D. Ullman, Data Structures and Algorithms. Addison-Wesley, Readings, MA, 1983. 3. R.M. Aiex, M.G.C. Resende, P.M. Pardalos, G. Toraldo, GRASP with path relinking for three-index assignment. INFORMS J. on Computing, 17(2), 224 -- 247, 2005. 4. N. Alon, F. Fomin, G. Gutin, M. Krivelevich, S. Saurabh, Spanning directed trees with many leaves. SIAM J. on Discr. Math., 23(1), 466 -- 476, 2009. 5. A. Andersen, General balanced trees. J. of Algorithms, 30, 1 -- 18, 1999. 6. K. Andreev, H. Racke, Balanced graph partitioning. Theory of Comput. Syst., 39(6), 929 -- 939, 2006. 7. N. Apollonio, I. Lari, J. Puerto, F. Ricca, B. Simeone, Polynomial algorithms for partitioning a tree into single-center subtrees to minimize flat service costs. Networks, 51, 78 -- 89, 2008. 8. C. Archetti, G. Guastaroba, M.G. Speranza, Reoptimizing the rural postman problem. Comp. & Oper. Res. 40(5), 1306 -- 1313, 2013. 9. J.E.C. Arroyo, P.S. Vieira, D.S. Vianna, A GRAPS algorithm for the multi-criteria minimum spanning tree problem. Ann. of Oper. Res., 159(1), 125 -- 133, 2008. 10. T. Asano, B. Bhattacharya, M. Keil, F. Yao, Clustering algorithms based on minimum and maximum spanning trees. In: Symp. on Computational Geometry, pp. 252 -- 257, 1988. 11. G. Austello, B. Escoffer, J. Monnot, V. Paschos, Reoptimization of minimum and maximum traveling salesman's tours. J. of Discr. Algorithms 7(4), 453 -- 463, 2009. 12. R.I. Becker, Y. Perl, The shifting algorithm techniques for the partitioning of trees. Disc. Appl. Math., 62, 15 -- 34, 1995. 13. D. Bilo, H.-J. Bockenhauer, J. Hromkovic, R. Kralovic, T. Momke, P. Widmayer, A. Zych, Reopti- mization of Steiner trees. In: J. Gudmundsson (ed), Proc. of Scandinavian Workshop on Algorithm Theory SWAT'08, LNCS 5124, Springer, pp. 258 -- 269, 2008. 14. N. Blum, K. Mehlhorn, On the average number of rebalancing operations in weight-balanced trees. Theor. Comp. Sci., 11, 303 -- 320, 1980. 15. J. Blum, M. Ding, A. Thaeler, X. Cheng, Connected dominating set in sensor networks and MANETs. In: D.-Z. Du, P. Pardalos (Eds.), Handbook of Combinatorial Optimization, Springer, pp. 329 -- 369, 2005. 16. N. Boria, V.P. Paschos, Fast reoptimization for the minimum spanning tree problem. J. of Discr. Algorithms 8(3), 296 -- 310, 2010. 17. P.M. Camerini, G. Galbiati, F. Maffioli, On the complexity of finding multi-constrained spanning trees. Discr. Appl. Math., 5, 39 -- 50, 1983. 18. Y. Caro, D.B. West, R. Yuster, Connected domination and spanning trees with many leafs. SIAM J. on Discr. Math., 13(2), 202 -- 211, 2000. 19. M. Charikar, V. Chatziafratis, Approximate hierarchical clustering via sparsest cut and spreading metrics. Electr. prepr., 21 p., Sep. 29, 2016. http://arxiv.org/abs/1609.09548 [cs.DS] 20. M. Charikar, V. Chatziafratis, Approximate hierarchical clustering via sparsest cut and spreading metrics. In: SODA 2017, pp. 841 -- 854, 2017. 21. T.-S. Chen, Y.-C. Tseng, J.-P. Sheu, Balanced spanning trees in complete and incomplete star graphs. IEEE Trans. on Parallel and Distributed Systems, 7(7), 717 -- 723, 1996. 22. G. Chen, S. Chen, W. Guo, W. Chen, The multicriteria minimum spanning tree problem based genetic algorithm, Inform. Sci., 177(22), 5050 -- 5063, 2007. 23. X. Cheng, X. Huang, D. Li, W. Wu, D.-Z. Du, A polynomial-time approximation scheme for the minimum-connected dominating set in ad hoc wireless networks. Networks, 42(4), 202 -- 208, 2003. 24. D. Cheriton, R.E. Tarjan, Finding minimum spanning trees. SIAM J. Comput., 5, 724 -- 742, 1976. 25. S.A. Choudum, I. Raman, Embedding height balanced trees and Fibonacci trees in hypercubes. J. App. Math. Comput., 30, 39 -- 52, 2009. 26. R.W. Conway, W.L. Maxwell, L.W. Miller, Theory of Scheduling. Dover, 2003. 27. R. Cordone, F. Maffioli, On the complexity of graph tree partition problems. Discrete Applied Math- ematics, 134, 51-65, 2004. 28. T.H. Cormen, C.E. Leiserson, R.L. Rivest, Introduction to Algorithms. 3rd ed., MIT Press and 13 McGraw-Hill, 2009. 29. J. Crampton, N. Farley, G. Gutin, M. Jones, B. Poettering, Cryptographic Enforcement of Infor- mation Flow Policies without Public Information via Tree Partitions. Electr. prepr., 30 p., Aug. 30, 2016. http://arxiv.org/abs/1608.08386 [cs.CR] 30. S. Dasgupta, A cost function for similarity-based hierarchical clustering. In: Proc. of the 48th Annual ACM SIGART Symp. on Theory of Computing STOC 2016, pp. 118 -- 127, 2016. 31. S. Dasgupta, P.M. Long, Performance guarantees for hierarchical clustering. J. of Computer and system Sciences, 70(4), 555 -- 569, 2005. 32. M. Dell'Amico, F. Maffioli, Combining linear and non-linear objectives in spanning tree problems. J. of Combinatorial Optimization, 4(2), 253 -- 269, 2000. 33. M. Drescher, A. Vetta, An approximation algorithm for the maximum leaf spanning arborescence problem. ACM Trans. on Algorithms, 6(3), Art. 46., 2000. 34. R. Dugad, N. Ahuja, Unsupervised multidimensional hierarchical clustering. In: Proc. of the 1998 IEEE Int. Conf. on Acoustic, Speech and Signal Processing, vol. 5, pp. 2761 -- 2764, 1998. 35. S. Dye, A note on the minimum bounded edge-partition of a tree. Discr. Appl. Math., 157, 2958 -- 2963, 2009. 36. K.P. Eswaran, R.E. Tarjan, Augmentation problems. SIAM J. on Computing, 5(4), 653 -- 665, 1976. 37. A.E. Feldmann, L. Foschini, Balanced partitions of trees and applications. Algorithmica, 71(2), 354 -- 376, 2015. 38. H. Fernau, J,. Kneis, D. Kratsch, A. Langer, M. Liedloff, D. Raible, P. Rossmanith, An exact algo- rithm for the Maximum Leaf Spanning Tree problem. Theor. Comp. Sci., 412(45), 6290 -- 6302, 2011. 39. F.V. Fomin, P.A. Golovach, D.M. Thilikos, Structured connectivity augmentation. Elec. prepr., 24 p., Jun. 13, 2017. http://arxiv.org/abs/1706.04255 [cs.DS] 40. A. Frank, Connections in Combinatorial Optimization. Oxford Lectures in mathematics and its Ap- plications, vol. 38, Oxford Univ. Press, Oxford, 2011. 41. T. Fujie, An exact algorithm for the maximum leaf spanning tree problem. Comp. & Oper. Res., 30(13), 1931 -- 1944, 2003. 42. H.W. Gabow, Z. Galil, T. Spencer, R.E. Tarjan, Efficient algorithms for finding minimum spanning trees in undirected and directed graphs. Combinatorica, 6(2), 109 -- 122, 1986. 43. M.R. Garey, D.S. Johnson, Computers and Intractability. The Guide to the Theory of NP- Completeness. W.H. Freeman and Company, San Francisco, 1979. 44. L. Georgiadis, R.T. Tarjan, Dominator tree certification and independent spanning trees. Electr. prepr., 44 p., Oct. 31, 2012. http://arxiv.org/abs/1210.8303 [cs.DS] 45. B. Gfeller, Faster swap edge computation in minimum diameter spanning trees. Algorithmica, 62(1 -- 2), 169 -- 191, 2012. 46. J. Goldberger, T. Tassa, A hierarchical clustering algorithm based on the Hungarian method. Pattern Recogn. Lett., 29(11), 1632 -- 1638, 2008. 47. O. Grygorash, Y. Zhon, Z. Jorgensen, Minimum spanning tree based clustering algorithms. In: IEEE Int. Conf. on Tools with Artificial Intelligence, pp. 73 -- 81, 2006. 48. H.W. Hamaher, G. Ruhe, On spanning tree problem with multiple objectives. Ann. of Oper. Res., 52(4), 209 -- 230, 1995. 49. Y. Hirai, K. Yamamoto, Balancing weight-balanced trees. J. of Funct. Progr., 21(3), 287 -- 307, 2011. 50. S.C. Ho, W.Y. Szeto, Solving a static repositioning problem in bike-sharing systems using iterated tabu search. Transp. Res. Part E, 69, 180 -- 198, 2014. 51. A. Itai, M. Rodeh, The multitree approach to reliability in distributed networks. Information and Computation, 79(1), 43 -- 59, 1984. 52. B. Jackson, T. Jordan, Independence free graphs and vertex connectivity augmentation. J. Comb. Theory, Ser., 94, 31 -- 77, 2005. 53. A.K. Jain, R.C. Dubes, Algorithms for clustering data. Prentice Hall, Upper Saddle River, NJ, 1988. 54. A.K. Jain, M.N. Murty, P.J. Flynn, Data clustering: a review. ACM Comput. Surv. 31(3), 264 -- 323, 1999. 55. J.-T. Jeng, C.-C. Chuang, C.W. Tao, Interval competitive agglomeration clustering algorithm. ESwA, 37(9), 6567 -- 6578, 2010. 56. I. Jonyer, D.J. Cook, L.B. Holder, Graph-based hierarchical conceptual clustering. J. of Machine 14 Learning Res., 2, 19 -- 43, 2001. 57. P.L. Karlton, S.H. Fuller, R.E. Scroggs, E.B. Kaehler, Performance of height-balanced trees. Commun. of the ACM, 19(1), 23 -- 28, 1976. 58. D. Kleitman, D. West, Spanning trees with many leafs. SIAM J. on Discr. Math., 4(1), 99 -- 106, 1991. 59. D. Knuth, The Art of Computing Programming. Vol. 3: Sorting and Searching, 3rd ed., Addison- Wesley, 1997. 60. J. Konemann, A. Levin, A. Sinha, Approximating the degree-bounded minimum diameter spanning tree problem. Algorithmica, 41(2), 117 -- 129, 2005. 61. I. Lari, J. Puerto, F. Ricca, A. Scozzari, Algorithms for uniform centered partitions of trees. Electr. Notes in Disc. Math., 55, 37 -- 40, 2016. 62. M.Sh. Levin, Towards hierarchical clustering. In: V. Diekert, M. Volkov, A. Voronkov (Eds.), Proc. of Int. Conf. Computer Science in Russia CSR-2007, LNCS 4649, Springer, pp. 205 -- 215, 2007. 63. M.Sh. Levin, Restructuring in combinatorial optimization. Electr. prepr., 11 p., Feb. 8, 2011. http://arxiv.org/abs/1102.1745 [cs.DS] 64. M.Sh. Levin, Multiset estimates and combinatorial synthesis. Electr. prepr., 30 p., May 9, 2012. http://arxiv.org/abs/1205.2046 [cs.SY] 65. M.Sh. Levin, Towards design of system hierarchy (research survey). Electr. prepr., 36 p., Dec. 7, 2012. http://arxiv.org/abs/1212.1735 [math.OC] 66. M.Sh. Levin, Modular System Design and Evaluation, Sprigner, 2015. 67. M.Sh. Levin, Towards combinatorial clustering: preliminary research survey. Electr. prepr., 102 p., May 28, 2015. http://arxiv.org/abs/1505.07872 [cs.AI] 68. M.Sh. Levin, Towards integrated glance to restructuring in combinatorial optimization. Electr. prepr., 31 p., Dec. 20, 2015. http://arxiv.org/abs/1512.06427 [cs.AI] 69. M.Sh. Levin, On combinatorial clustering: literature review, methods, examples. J. of Commun. Technol. and Electronics, 60(12), 1403 -- 1428, 2015. 70. M.Sh. Levin, Towards balanced clustering - part 1 (preliminaries). Elec. prepr., 21 p., Jun. 9, 2017. http://arxiv.org/abs/1706.03065 [cs.DS] 71. M.Sh. Levin, On balanced clustering (indices, models, examples). J. of Communications Technology and Electronics, 62(12), 1506 -- 1515, 2017. 72. M. Li, S. Deng, L. Wang, S. Feng, J. Fan, Hierarchical clustering algorithm for categorical data using a probabilistic rough set model. Knowledge Based Systems, 65, 60 -- 71, 2014. 73. G. Lin, C. Nagarajan, R. Rajaraman, D.P. Williamson, A general approach for incremental approxi- mation and hierarchical clustering. SIAM J. on Computing, 39(8), 3633 -- 3669, 2010. 74. H. Lu, R. Ravi, The power of local optimization: approximation algorithms for maximum leaf span- ning tree. In: Proc. of the Annual Allerton Conf. on Communication Control and Computing, USA, vol. 30, pp. 533 -- 542, 1992. 75. H. Lu, R. Ravi, Approximating maximum leaf spanning trees in almost linear time. J. of Algorithms, 29(1), 132 -- 141, 1998. 76. C.-H. Lung, C. Zhou, Using hierarchical agglomerative clustering in wireless sensor networks: An energy-efficient and flexible approach. Ad Hoc Networks, 8, 328 -- 344, 2010. 77. S. Mamada, T. Uno, K. Makino, S. Fujishige, A tree partitioning problem arising from an evacuation problem in tree dynamic networks. J. Oper. Res. Soc. Jpn., 48, 196 -- 206, 2005. 78. H. Meyerhenke, P. Sanders, C. Schulz, Partitioning (hierarchically clustered) complex networks via size-constrained graph clustering. J. of Heuristics, 22(5), 759 -- 782, 2016. 79. S. Moran, S. Snir, Convex recoloring of strings and trees: definitions, hardness results and algorithms. J. Comput. System Sci., 74(5), 850 -- 869, 2008. 80. J. Nievergelt, E.M. Reingold, Binary search trees of bounded balance. SIAM J. on Computing, 2(1), 33 -- 43, 1973. 81. Y. Perl, S. Schach, Max-min tree partitioning. J. of the ACM, 28, 5 -- 15, 1981. 82. S. Pettie, V. Ramachandran, An optimal minimum spanning tree algorithm. J. of the ACM, 49(1), 16 -- 34, 2002. 83. S. Pettie, V. Ramachandran, A randomized time-work optimal parallel algorithm for finding a mini- mum spanning forest. SIAM J. on Computing, 31(6), 1876 -- 1895, 2002. 84. H. Racke, Optimal hierarchical graph decompositions for congestion minimization in network. In: 15 Proc. of the fourteenth Annual ACM Symp. on Theory of Computing STOC'08, pp. 255 -- 264, 2008. 85. Y. Ran, Z. Chen, S. Tang, Z. Zhang, Primal dual based algorithm for degree-balanced spanning tree problem. Appl. Math. and Computation, 316, 167 -- 173, 2018. 86. A. Singh, An artificial bee colony algorithm for the leaf-constrained minimum spanning tree problem. Applied Soft Computing, 9(2), 625 -- 631, 2009. 87. R. Solis-Oba, 2-approximation algorithm for finding a spanning tree with maximum number of leafs. In: G. Bilardi, G.F. Italiano, A. Pietracaprina, G. Pucci (Eds.), Proc. of 6th Annual Eur. Symp. on Algorihtms - ESA'98, LNCS 1461, Springer, pp. 441 -- 452, 1998. 88. J.A. Stores, An Introduction to Data Structures and Algorithms. Birkhauser, Boston, 2001. 89. G.J. Szekely, M.L. Rizzo, Hierarchical clustering via joint between-within distances: Extending Ward's minimum variance method. J. of Classification, 22(2), 151 -- 183, 2005. 90. V.S. Tanaev, V.S. Gordon, Y.M. Shafransky, Scheduling Theory. Single Stage Systems. Springer, 1994. 91. R.E. Tarian, Edge-disjoint spanning trees and depth-first search. Acta Informatica, 6(2), 171 -- 185, 1976. 92. M. Thai, F. Wang, D. Liu, S. Zhu, D. Du, Connected dominating sets in wireless networks with different transmission ranges. IEEE Trans. Mob. Comput., 6(7), 721 -- 730, 2007.
1706.01347
1
1706
2017-06-05T14:26:01
Balanced Facilities on Random Graphs
[ "cs.DS" ]
Given a graph G with n vertices and k players, each of which is placing a facility on one of the vertices of G, we define the score of the i'th player to be the number of vertices for which, among all players, the facility placed by the i'th player is the closest. A placement is balanced if all players get roughly the same score. A graph is balanced if all placements on it are balanced. Viewing balancedness as a desired property in various scenarios, in this paper we study balancedness properties of graphs, concentrating on random graphs and on expanders. We show that, while both random graphs and expanders tend to have good balancedness properties, random graphs are, in general, more balanced. In addition, we formulate and prove intractability of the combinatorial problem of deciding whether a given graph is balanced; then, building upon our analysis on random graphs and expanders, we devise two efficient algorithms which, with high probability, generate balancedness certificates. Our first algorithm is based on graph traversal, while the other relies on spectral properties.
cs.DS
cs
Balanced Facilities on Random Graphs Roee David, Nimrod Talmon Weizmann Institute of Science [email protected], [email protected] Abstract. Given a graph G with n vertices and k players, each of which is placing a facility on one of the vertices of G, we define the score of the ith player to be the number of vertices for which, among all play- ers, the facility placed by the ith player is the closest. A placement is balanced if all players get roughly the same score. A graph is balanced if all placements on it are balanced. Viewing balancedness as a desired property in various scenarios, in this paper we study balancedness prop- erties of graphs, concentrating on random graphs and on expanders. We show that, while both random graphs and expanders tend to have good balancedness properties, random graphs are, in general, more balanced. In addition, we formulate and prove intractability of the combinatorial problem of deciding whether a given graph is balanced; then, building upon our analysis on random graphs and expanders, we devise two ef- ficient algorithms which, with high probability, generate balancedness certificates. Our first algorithm is based on graph traversal, while the other relies on spectral properties. 1 Introduction Consider a game played by k players on some graph G. The players place facilities on vertices of G such that each player places one facility. For each player we define a score, defined as the number of vertices which, among all other facilities, are closest to his or her facility; ties are broken evenly, such that if there are z facilities closest to a vertex, then this vertex incurs a score increase of 1/z to each of these facilities. Such games are subject to extensive research; some prominent study areas are Voronoi games on graphs [3, 10, 20, 23] and Competitive facility location games [1, 4, 5, 13, 22], where the players try to maximize their score. In this paper, however, we concentrate on balancedness properties of such games, thus consider having the score of the players be as close to each other as possible to be desired. Indeed, in some sense, in this paper we take the point of view of the network designer by studying balancedness properties of certain graphs. To this end, we say that a placement of k facilities on a graph is z- balanced if all facilities get roughly the same score; specifically, a placement of k facilities is z-balanced if the score of each facility is at least ⌊n/k⌋ − z and at most ⌈n/k⌉ + z. We say further that a graph is z-balanced if all placements on it are z-balanced. A more formal definition is given in Section 2. Graph balancedness, besides being a natural and an interesting graph prop- erty from a combinatorial point of view, is motivated by certain scenarios, two of which we briefly mention next. As a first example, consider a computer net- work to be built; the network acts as the graph upon facilities, such as computer servers might be built. It is of interest to have a network with good balanced- ness properties, so that it will remain fair and efficient where such servers would be employed on top of it. As a second example, consider a design of a city to be built; the city topology and, for instance, its roads, act as the graph upon facilities, such as hospitals and child-care centers might be built. It is of interest to have a city with good balancedness properties, so it would be able to accom- modate the needs of its future residents. Indeed, a city with bad balancedness properties might eventually become unpleasant and socially inferior. Thus, we believe that it is worthwhile to study balancedness properties of graphs, as well as algorithms for verifying whether a given graph is balanced. Some research has been done on balancedness of facilities in graphs, including work on designing practical algorithms for finding balanced allocations [18] and work considering balancedness in a perculation-like model [6,25]. Other, different notions of balancedness in facility location games have been studied as well [17]. For an elaborate discussion on balancedness notions in facility location games, see [19]. In this paper we analyze balancedness properties of certain graphs, seeking to identify graphs which are balanced. Specifically, we concentrate on random graphs and also on expanders, showing that these graphs usually have good balancedness properties. Then, building upon our analysis on random graphs and expanders, we provide efficient algorithms for verifying whether a given graph is balanced. Initial Observations. As one of our goals is to identify graphs which have good balancedness properties, let us identify certain such graphs. As first ex- amples, observe that complete graphs and empty graphs are 0-balanced for any number of players k; indeed, the score of each player is exactly n/k, for any place- ment of k facilities on such graphs. Both complete graphs and empty graphs are vertex-transitive graphs [16], and we mention that any vertex-transitive graph is 0-balanced for two players; further, a natural generalization of vertex-transitivity to sets of k players yields graphs which are 0-balanced also for k players. Naturally, however, not all graphs have good balancedness properties. For example, consider two players playing on the path graph Pn, which is the graph with vertices V = {v1, . . . , vn} and edges E = {{vi, vi+1} : i ∈ [n − 1]}. Some placements of two facilities on the path graph Pn are balanced, for example where one facility is placed on vn/2 and the other facility is placed on vn/2+1: for n ∈ Neven, such a placement is 0-balanced, while for n ∈ Nodd, such a placement is only 1-balanced. Some placements of two facilities on the path graph Pn, however, are not balanced, for example where one facility is placed on v1 and the other facility is placed on v2: one player would have a score of 1 while the other would have a score of n − 1. This means that path graphs are not (n − 2)- 2 balanced for two players, which is, considering balancedness, "the worst it can get". Overview of the Paper. Preliminaries are provided in Section 2. Then, motivated by our desire to identify graphs which are balanced and to further understand which factors influence graph balancedness, in Section 3 we consider random graphs and study their balancedness properties. We show, in Theorem 1, that random graphs have good balancedness properties. Inspecting our proof of Theorem 1, it looks as if what causes random graphs to be balanced is the fact that they are well-connected in a uniform way; well-behaved (in the above- mentioned manner) graphs are usually referred to as expander graphs, and thus, in Section 4 we consider balancedness properties of expander graphs. Specifically, we consider spectral expander graphs (for a precise definition, see Section 2), and mention that, with high probability, a random graph is a spectral expander (see [11, 12, 14], e.g., for a proof of this fact). In Theorem 2, we show that expanders have good balancedness properties. Somewhat surprisingly, though, it turns out that, with respect to their bal- ancedness, expanders are inferior to random graphs; in particular, for some values of the average degree of these graphs, some random graphs are balanced while some expanders are not: in Theorem 3 we show an example for such expander which is not balanced. This means that, even though the expansion of random graphs influences their balancedness, it is not sufficient, and the inherent ran- domness of these graphs is also important for their balancedness. In Section 5 we consider the algorithmic problem of deciding whether a given graph is balanced. We begin that section by proving that the corresponding com- binatorial problem is intractable. Then, building upon the analysis described in Sections 3 (for random graphs) and 4 (for expander graphs), we describe, in Sections 5.1 and 5.2, two efficient algorithms which, given a graph, provide a balancedness certificate: in Section 5.1 we discuss an algorithm, based on graph traversal, which produces, in O(n2) time, a certificate that a graph is balanced; for random graphs, it produces such a certificate with high probability. In Sec- tion 5.2 we discuss a different algorithm, based on spectral analysis, which pro- duces, in O(d · n log n) (where d is the average degree), a randomized certificate that a graph is balanced; for random graphs, it produces such a certificate with high probability. We conclude the paper in Section 6 with a discussion on direc- tions for future research. 2 Preliminaries For n ∈ N, we denote the set {1, . . . , n} by [n]. General preliminaries. Given a vector v ∈ Rn we denote the ith coordinate of v by (v)i. Graph theory and neighborhoods. Given a graph G we denote by V the vertex set of the graph and by E the edge set of the graph. For a set of vertices S ⊆ V , we denote its complement by ¯S := {v ∈ V (G) : v /∈ S}. We denote the degree of a vertex v ∈ V by dv. A d-regular graph is a graph where dv = d for each 3 v ∈ V , while a roughly d-regular graph is a graph where d− o(d) ≤ dv ≤ d + o(d) for each v ∈ V . For a vertex v ∈ V we denote by N (v) the neighborhood of v, including v (that is, N (v) := {u : {u, v} ∈ E(G)} ∪ {v}). For a set S ⊆ V , N (S) denotes the neighborhood of S; that is, N (S) = ∪s∈SN (s) (indeed, with this definition, S ⊆ N (S)). The ith neighborhood of a vertex v ∈ V is Ni(v) = N (Ni−1(v)), where N1(v) = N (v). The ith gained neighborhood of a vertex v ∈ V is Ni(v) = Ni(v) \ Ni−1(v). For a set of vertices H ⊆ V , let GH denote the subgraph of G induced on the vertices of H. For S, T ⊆ V (G), EG(S, T ) denotes the number of edges between S and T in G, where, if S, T are not disjoint, then the edges in the induced subgraph of S ∩ T are counted twice. Random graphs and expanders. A graph G with n vertices is a random graph which is distributed by Gn,d, and according to Erdos-R´enyi model, if each edge is included in the graph with probability p = d n−1 , independently from every other edge. We denote the adjacency matrix of a graph G by AG. We denote AG's normalized eigenvectors by e1(G), e2(G), . . . , en(G) and the corresponding real eigenvalues by λ1(G) ≥ λ2(G) ≥, . . . ,≥ λn(G). A graph G is an (s, α) vertex expander if for every S ⊆ V (G) of size at most s it holds that the neighborhood of S is of size at least αS. A graph G is a λ-expander if max(λ2(G),λn(G)) ≤ λ. Facilities, scores, and balancedness. Given a graph G, we consider k players, denoted by P1, . . . , Pk. Each player places one facility on a vertex of G, specifically player Pi is choosing a vertex ui for placing his or her facility fi. We assume that no two players put their facilities on the same vertex. Given such placement, we define for a vertex v ∈ V the set Cv ⊆ {P1, . . . , Pk} of players whose facilities are placed closest to it; that is, Cv := {Pi : d(v, ui) ≤ d(v, uj),∀j 6= i}, where d(u, v) stands for the distance between the vertices u and v, which is defined to be ∞ whenever u and v are disconnected. We define the score of player Pi to be score(Pi) := Pv∈V ;Pi∈Cv Cv−1. A placement of k facilities on G is said to be z-balanced if ⌊n/k⌋− z ≤ score(Pi) ≤ ⌈n/k⌉+ z for all i ∈ [k]. A graph G is said to be z-balanced if any placement on it is z-balanced. 3 Random Graphs In this section we consider random graphs, generated according to Erdos-R´enyi model (see Section 2), and analyse their balancedness. In Theorem 1, we prove some good balancedness properties of such graphs. Building upon this theorem, in Section 5.1 we describe an algorithm for verifying graph balancedness. Theorem 1. Let G ∼ Gn,d be a random graph, let k = o(d), and let d = Ω(log n). Then, for any arbitrarily small constant δ > 0, with high probability, G is δn-balanced for k players. Proof. For ease of presentation, we present the proof for k = 2 players; within the proof, we explain how to generalize the proof to hold for k = o(d) players, as well as to why it does not hold for larger values of k. Moreover, we assume 4 that d = nǫ, for an arbitrarily small constant ǫ; while the proof holds also for d = Ω(log n), it is easier to explain and clearer to understand for d = nǫ, and all ingredients of the proof are present in this case. 1 The proof builds upon the observation that the number of vertices with distance i to any vertex in a Gn,d is, with high probability, roughly di. Then, there are two cases to consider. If d 6= Θ(n i ) for some i (Case 1), then we show that, with high probability, the number of vertices at distance at most i− 1 from any facility is negligible, while all vertices are at distance at most i from any facility. This means that most vertices are at the same distance from all facilities, i ) for some i (Case thus the graph is balanced in this case. Otherwise, if d = Θ(n 2), then we show that, with high probability, the number of vertices at distance at most i − 1 from any facility is cn, where 0 ≤ c ≤ 1 is some constant which is, importantly, equal for all facilities, while all vertices are at distance at most i from any facility. This means that each facility has roughly cn vertices which are the closest to it, while most remaining vertices are shared between the facilities. Specifically, let v be a vertex of G. By the Chernoff bound (Appendix, The- 1 orem 7), it follows that, with high probability it holds that n1 := N (v) = d ± O(√d). (1) Throughout the proof, we condition on the event that Equation 1 holds. Given n1 and a vertex u /∈ N (v), the probability that u is in N2(v) is n−1 )n1 . Let n2 := N2(v). Then, the following hold: p2 = 1 − (1 − d 1. If d = o(n 1 2. If d = ω(n n + ( n1d n )2 ≈ n1d 2 ) then, by Bernoulli's inequality (Appendix, Theorem 8), the quantity p2 is n1d n . Notice that we use ≈ to denote the omission of low order terms; further, when a ≈ b for some values a and b, we say that a is approximately b. It follows that EG∼Gn,d[n2] ≈ (n − d) d2 n ≈ d2. 2 ) then the quantity p2 is approximately 1. It follows that EG∼Gn,d[n2] ≈ n. 2 ) then the quantity p2 is some constant cd,2 that depends on d. n = 1 − e−c. It follows that Specifically, if d = cn1/2 then cd,2 ≈ 1 − e− EG∼Gn,d[n2] = cd,2n. n1 d 1 1 3. If d = Θ(n Applying Chernoff bound, we conclude that, with high probability it holds that n2 = E[n2] ± O(√d). (2) Throughout the proof, we condition on the event that Equation 2 holds. Let ni = Ni(v). By repeating the above arguments for 2 < i ≤ log n, we conclude that the following hold with high probability: 1. If d = o(n 2. If d = ω(n 3. If d = Θ(n 1 1 1 i ) then ni = di ± O(√di). i ) then ni = cd,in ± O(√n) some some constant cd,i. i−1 ) then Ni(v) = n − O(√n). i ) and d = o(n 1 5 Applying union bound, we conclude that ni is as stated above for every i and every vertex v in G. Next we consider two cases, differentiated by the value of d. 1 1 Case 1. Let d = ω(n i−1 ) for some i. Consider two players, placing their facilities on two arbitrary vertices, v1 and v2. By the analysis above, we have that Ni(vk) = n − Θ(di−1). Thus, it holds that i ) and also d = o(n {w : dG(w, v1) = dG(w, v2)} ≥ Ni(v1)\ Ni(v2) = n − ¯Ni(v1)[ ¯Ni(v2) ≥ n − ¯Ni(v1) − ¯Ni(v2) = n − Θ(di−1). (3) We conclude that the score each player gets is at least n/2 − Θ(di−1) and at most n/2 + Θ(di−1), which, for large enough values of n, means that in this case, all placements are δn-balanced. Remark 1. Let us briefly explain how the proof generalizes to k = Θ(d). Here, we would have obtained the following: {w : dG(w, v1) = dG(w, v2) = ... = dG(w, vk)} ≥ k \ j=1 Ni(vj ) = n − k [ j=1 ¯Ni(vj ) ¯Ni(vj) k X ≥ n − = n − kdi−1. j=1 For the graph to be, say, 0.1n-balanced, the value of k has to satisfy kdi−1 ≤ 0.1n. Since di−1 = n d , it follows that k ≤ 0.1d. 1 i ) for some i. Consider two players, placing their facilities Case 2. Let d = Θ(n on two arbitrary vertices, v1 and v2. Then, with high probability the following holds (using similar techniques, one can generalize the proof for this case to general k as well): {w : dG(w, v1) < dG(w, v2)} = i+1 X j=1 {w : dG(w, v1) < dG(w, v2) ∧ w ∈ Nj(v1)}   i−1 X Nj(v1)   + Ni(v1) \ Ni(v2) + Ni+1(v1) \ Ni+1(v2) ≤ ≤ Θ(di−1) + Ni(v1) \ Ni(v2) + Ni+1(v1) \ Ni+1(v2). j=1 6 Recall that Ni(v1) = Ni(v2) ± O(√d), and therefore it holds that: Ni(v1) \ Ni(v2) = Ni(v2) \ Ni(v1) ± O(√d), and that Ni+1(v1) \ Ni+1(v2) = Ni+1(v2) \ Ni+1(v1) ± O(√d). which, for sufficiently large values of n, is smaller than δn, as needed. It follows that the score difference between the players is Θ(di−1) + O(√d), ⊓⊔ Remark 2. Notice that some restriction on the value of k in the statement of the last theorem is needed; for example, if k > d, then d-regular graphs generally do not achieve reasonable balancedness. To see this, notice that for k = d + 1, placing one facility on an arbitrary vertex v while placing other facilities on all its d neighbors as well results in a score of 1 for the facility placed on v (as long as the graph is connected). 4 Expanders The analysis performed in the last section shows that random graphs have good balancedness properties. Moreover, taking a closer look at our proof, it looks as if the main property of random graphs which we used is that random graphs are good expanders. Namely, it is a well known fact that with high probability λ2 (G) = Θ (cid:16)√d(cid:17) (for example, see [11, 12, 14]). This motivates further studying whether expanders have good balancedness properties, which is the subject of the current section. It turns out that, in some sense, the balancedness of expanders is inferior to that of random graphs, as is apparent from the degrees restriction imposed in the statement of Theorem 2, which is backed by an example of an expander with bad balancedness properties, depicted in Figure 1 and described in the proof of Theorem 3. The structure of the next proof, which is deferred to the appendix, is some- what similar to the structure of the proof of Theorem 1, and the overall tactics is to argue that the sizes of the ith neighborhoods of most graphs are roughly similar. The main difference between the proof of the next theorem and the proof of Theorem 1 is that, while the proof of Theorem 1 uses probabilistic arguments to estimate the neighborhood sizes of various facilities, the proof of the next theorem uses expansion properties of expanders. We mention that in Section 5.2 we build upon the next theorem for devising a somewhat, a-priori surprising algorithm for verifying graph balancedness, based on spectral analysis. Theorem 2. Let G be a d-regular λ-expander graph of n vertices, let λ = O(√d), and let d = nǫ. Then, G is o(n)-balanced for k = o(d) players, as long as there is no positive integer i for which ǫ = 1 i . 7 Remark 3. We mention that Theorem 2 can be extended to graphs which are roughly-regular expanders. While in the proof of Theorem 2 we used the ex- pander mixing lemma for regular graphs, there exists a general version for the expander mixing lemma which gives, for irregular graphs, similar statements as those we used (e.g., see, [9]). Using the general form of the expander mixing lemma for roughly-regular graphs, the extension for roughly-regular expanders follows. Next we demonstrate that the restriction on ǫ in Theorem 2 is necessary (showing that it is not an artifact of our proof technique). Specifically, we show a family of expander graph whose degree regularity does not follow the aforemen- tioned restriction, and such that these graphs have bad balancedness properties. 1 Theorem 3. Let d = Θ(n i ). Then, for every positive integer i, there exist roughly d-regular λ-expander graphs with n vertices that are not o(n)-balanced. Proof. We show an example for the case where d = √n, and mention that this i ). Let G be a random graph drawn by example can be generalized for d = Θ(n the distribution Gn,√n (see Section 2). We construct the graph G′ as follows: Step 1. Add a new root vertex r as well as another √n new vertices to the Step 2. By introducing new edges, connect each new vertex to √n original Step 3. By introducing new edges, connect r to each of the √n new vertices. vertices such that no two new vertices share a common neighbor. vertex set of G. 1 First we prove that G′ is not o(n)-balanced. It follows from the proof of Theorem 1 that, with high probability, it holds for any original vertex (that is any vertex of G), that N2(v) ≈ (1− e−1)n (the addition of √n + 1 new vertices effects N2(v) by at most √n). However, N2(r) = n by construction. Thus, G′ is not o(n)-balanced; indeed, placing one facility on r while the other on original vertices results in a non o(n)-balanced placement. Next we provide an upper bound on λ(G′), to show that G′ is indeed an expander, as claimed. Naturally, we rely on the fact that random graphs are good expanders. That is, it is well known that, with high probability, it holds that λ2(G) = Θ(√d) (see, for example, [11, 12, 14]). Next we show that our modifications to G do not change its expansion too much. First, notice that in Step 1 we added √n + 1 eigenvectors to the graph, all with eigenvalue zero. To see this, for each added vertex u, consider the vector 1u that has value 1 on u's coordinate and 0 on the rest of the coordinates. Thus, after performing the modification described in Step 1 the expansion of the graph do not change. Second, consider the following inequality from perturbation theory for matri- ces that holds for any two symmetric matrices A, N ∈ Rn,n (see, for example, [7]): (4) max i:1≤i≤nλi(A + N ) − λi(A) ≤ max i:1≤i≤nλi(N ). 8 r G = Fig. 1. An expander which is not δn-balanced, as described and proved in Theorem 3. The bottom oval represents the graph G, the middle vertices are the √n new vertices, and the top vertex r is the root vertex. Namely, this inequality shows that adding a matrix N to a matrix A can change the eigenvalues of A+N by at most maxi:1≤i≤n λi(N ). Notice that we can write the adjacency matrix of G′ as AG′ = AG + AS + AS√n , where AS is added in Step 2 and AS√n is added in Step 3. Here, the graph Sm is the star graph with m + 1 vertices (recall that a star graph is a bipartite graph with m + 1 vertices where one vertex is connected to all the other vertices) and S is the disjoint union of √n copies of S√n. it holds that λi(Sm) ≤ √m, for every i ∈ [m + 1]. Hence, since S is the disjoint union of star graphs, for every i it follows that λi(AS) ≤ n Inequality 4, for every i, we have that Finally, we rely on the fact that, for star graphs Sm with m + 1 vertices, 1 4 . Applying λi(AG) − 2n 1 4 ≤ λi(AG′ ) ≤ λi(AG) + 2n 1 4 . Thus, we conclude that λ2(G′) ≤ λ2(G)+Θ(pλ2(G)). Further, the above ⊓⊔ construction gives a roughly d-regular graph; thus, the proof follows. 5 Verifying Balancedness In this section we first give some evidence that deciding a given graph's bal- ancedness is intractable (see Theorem 4). We view this result as motivating the design of algorithms which can verify, with high probability, whether a given graph is balanced. Concretely, we use the analysis described in Section 3 and Section 4 to devise two algorithms which produce certificates of balancedness: the first algorithm, described in Section 5.1, is based on graph traversal, while the second algorithm, described in Section 5.2, is based on spectral analysis, and results in better running time compared to the first algorithm. Intractability Result. Consider the following decision problem. Unbalancedness Input: A graph G, number of facilities k, and a bound s. Question: Is there a placement of k facilities on G such that the score of at least one of the players is strictly less than s? 9 Unbalancedness can be solved in O(nk+3) time, as follows. First, compute all-pairs shortest paths on G (this can be done in O(n3) time, using Floyd- Warshall algorithm, for example). Then, iterate over all (cid:0)n k(cid:1) possible placements of k facilities on G, computing the balancedness of each such placement using the all-pairs shortest paths matrix. It is natural to ask whether there are better algorithms than the simple algorithm described above. The next theorem, whose proof is deferred to the appendix, shows that this is not the case (assuming P 6= NP). Theorem 4. Unbalancedness is NP-hard. Remark 4. Taking a closer look at the proof of Theorem 4, one might notice that in the reduction from Dominating Set to Unbalancedness, the number of players k in the Unbalancedness instance is O(h), where h is the size of the dominating set in the Dominating Set instance. Since it is known that, assuming the Exponential Time Hypothesis (ETH), no algorithm running in no(k) time exists for Dominating Set [21], it follows that no algorithm running in no(k) time exists for Unbalancedness. 5.1 Graph Traversal Algorithm In this section we describe an algorithm which verifies whether a given graph is balanced. Specifically, if the algorithm accepts then it generates a certificate, such that the graph is guaranteed to be balanced. Otherwise, if the algorithm rejects, then there are no balancedness guarantees; notice that it does not mean that the graph is not balanced, as it might be the case that the graph is balanced but the algorithm is not able to produce a certificate. The algorithm runs in O(n(m+n)), where n is the number of vertices in the graph and m is the number of edges in the graph; thus, from the intractability result proved in Theorem 4, we have no reason to believe that the algorithm would produce a certificate for all graphs. Using the analysis described in the proof of Theorem 1, however, we will show that, with high probability, the algorithm is able to produce certificates for random graphs. 1 i Theorem 5. Let d be such that there is no positive integer i for which d = n and let k = c1d for some constant c1. Then, there is an algorithm running in O(n(m + n)) time which, given a random graph G ∼ Gn,d with m edges, with high probability produces a certificate of its δn-balancedness for k players where δ ≥ c1c2 and c2 is some constant. Proof. Let us denote the radius of G by r; that is, r = minv∈V maxu∈V d(u, v). The algorithm first computes the value of Ni(v) for each v ∈ V and for each i ∈ [r]; to compute these values, it is sufficient to traverse the graph once from each vertex, say, by performing a breadth-first search. Then, the algorithm accepts iff the following conditions hold: Condition 1. Nr(v) = n for each v ∈ V . 10 Condition 2. Nr−1(v) ≤ δn/k for each v ∈ V . It might be useful to think about this algorithm as generating a table T (or a matrix) of n rows and r columns, where n is the number of vertices in the graph and r is the radius of the graph. The value in the cell T [v, i] is the size of the ith neighborhood of vertex v; that is, T [v, i] := Ni(v). Given the table T , the algorithm checks, in Condition 1, that the values in the rth column (that is, in the "last" column) are all exactly n; in other words, for the given graph it holds that r = maxv∈V maxu∈V d(u, v), so each vertex reaches the whole graph on r hops. Then, in Condition 2, the algorithm checks that the values in the (r− 1)th column are at most δn/k; in other words, for the given graph it holds that each vertex reaches at most δn/k vertices in r − 1 hops. By analysis similar to that in the proof of Theorem 1, we have that if these conditions hold, indeed the graph is δn balanced. To see why, notice that com- bining both conditions, for any k players, we have that all players reach at least n − δn vertices in the rth hop, and on these vertices, all players get the same fraction of 1/k. Thus, the score of each player is at least (n − δn)/k ≥ n/k − δn and at most δn + (n − δn)/k ≤ δn + n/k. It follows that the graph is indeed δn-balanced. Taking a closer look at Case 1 in the proof of Theorem 1, it follows first that Nr(v) = n holds for every vertex v with high probability, thus Condition 1 holds. Further, for every vertex satisfies Nr−1(v) ≤ c2n/d for some constant c2 with high probability. Therefore, Nr−1(v) ≤ c2n d = c1c2n k ≤ δn k holds with high probability for every vertex v, thus Condition 2 holds. ⊓⊔ 5.2 Spectral Algorithm In this section we describe another algorithm which verifies whether a given graph is balanced. In contrast to the previous section, here we provide a proba- bilistic certificate. Specifically, we consider a randomized algorithm A with the following promise: if, for a given graph G as an input, algorithm A accepts with probability larger than 0.9, then G is balanced. We say that such an algorithm is a probabilistic certificate. Probabilistic certificates are useful since, given a graph G, one could estimate the accepted probability by repeatedly running A. Notice that there might be "false negatives", as there could be balanced graphs with low acceptance probability. What we do show next is that for a random graph G drawn from Gn,d, with high probability over the distribution Gn,d, the graph G is such that A accepts G (with probability larger than 0.9 over the random bits A uses). Algorithm A runs in O(nd) where d is the expected degree of G. Thus, following the intractability result proved in Theorem 4, we have no reason to believe that the algorithm can produce certificates for all graphs. Using the analysis of Theorem 2, however, we will show that, with high probability, the algorithm is able to produce certificates for (most of the) random graphs. 11 1 there is no positive integer i for which Theorem 6. Let d be such that i . There is an algorithm running in O(nd) time which, given a random d = n graph G ∼ Gn,d, with high probability produces a probabilistic certificate of its δ-balancedness for some δ = o(n). Proof. Let ǫ = 0.01. We say that a is an ǫ-estimation of b if it holds that a ≤ (1 + ǫ)b. Let AG denote the adjacency matrix of a graph G. Given a graph G as an input, the algorithm operates as follows. Step 1. Set d to be equal to the expected degree in G. Step 2. If the graph is not roughly-regular then reject. Step 3. Calculate an ǫ-estimation of the second largest-in-magnitude eigenvalue Step 4. If λ2 is smaller than 100√d then accept, otherwise reject. of AG and denote its value by λ2. We start with a running time analysis of the above algorithm. Clearly, Steps 1,2 and 4 can be accomplished in O(nd) time. For Step 3, we shall specify how to calculate λ2. Fortunately, the problem of calculating λ2 of a given graph is a well-studied problem which can be solved using the power method: the power method is a randomized algorithm that, using t = Ω(logn) operations of multiplying certain vectors by AG, gives with high probability (say p = 0.9) the desired ǫ-estimation of the second largest-in-magnitude eigenvalue of AG. Given any vector v, calculating AG · v can be done in O(dn) time (to see this note that G has roughly d 2 n edges, hence AG has roughly dn non zero entries). In total, Step 3 takes tnd = O(dn) time. For more details on the power method, see, e.g., [26, Lemma 8.1]. By standard calculations, one can show that random graphs are roughly- regular graphs (see definition in Section 4). Hence, with high probability G is such that it (always) passes Step 1. It is a well known fact that with high probability λ2 (G) = Θ (cid:16)√d(cid:17) (see [11, 12, 14], for example). Hence, once again, with high probability G is such that it will be accepted in Step 4 with probability p. By Theorem 2, we have that if G is a roughly-regular spectral expander, then G is δn balanced; thus, we are done. ⊓⊔ 6 Outlook We briefly discuss several directions for future research. Robustness of balanced graphs. Random graphs might be seen as noisy complete graphs, in the sense that, starting from a complete graph, each edge is removed with a certain probability (1− p). Since complete graphs are 0-balanced for any number of players k, one might understand Theorem 1 as proving that complete graphs are not only 0-balanced for any k, but are also robust to noise. It is not clear whether other families of graphs with good balancedness properties are also robust to noise. 12 Cooperative, randomized, and adversarial tie-breaking. In this paper we broke ties evenly, which has similar behavior as to breaking ties uniformly at random; that is, if z facilities are the closest to a vertex, then each of the corresponding players gets a score increase of 1/z. It is natural, and practically motivated, to study other tie-breaking schemes, such as (1) breaking ties in favor of the balancedness; (2) breaking ties at random by some distribution over the players; (3) breaking ties against balancedness. Best-case, average-case, and worst-case balancedness. In this paper we concentrated on a worst-case notion of balancedness, by defining a graph to be balanced iff each placement on it is balanced. What happens if we consider an average-case notion of balancedness, by requiring a placement on it to be balanced with high probability, or even a best-case notion of balancedness, by requiring that at least one balanced placement shall exist? We observe that some graphs are not balanced even for the best-case notion; for example, notice that any placement of two facilities on the graph depicted in Figure 3 is not 0-balanced (the figure and a proof of the claim are given in the Appendix). Acknowledgements. We thank Uriel Feige for useful discussions. References 1. Hee-Kap Ahn, Siu-Wing Cheng, Otfried Cheong, Mordecai Golin, and Rene Van Oostrum. Competitive facility location: the Voronoi game. Theoretical Com- puter Science, 310(1-3):457 -- 467, 2004. 2. Noga Alon and Fan RK Chung. Explicit construction of linear sized tolerant networks. Annals of Discrete Mathematics, 38:15 -- 19, 1988. 3. Sayan Bandyapadhyay, Aritra Banik, Sandip Das, and Hirak Sarkar. Voronoi game on graphs. Theoretical Computer Science, 562:270 -- 282, 2015. 4. Aritra Banik, Bhaswar B. Bhattacharya, and Sandip Das. Optimal strategies for the one-round discrete Voronoi game on a line. Journal of Combinatorial Opti- mization, 26(4):655 -- 669, 2013. 5. Aritra Banik, Jean-Lou De Carufel, Anil Maheshwari, and Michiel Smid. Discrete voronoi games and ǫ-nets, in two and three dimensions. Computational Geometry, 55:41 -- 58, 2016. 6. Enrico Baroni, Remco van der Hofstad, and Julia Komjathy. Fixed speed compe- tition on the configuration model with infinite variance degrees: Unequal speeds. Electronic Journal of Probability, 20, 2015. 7. Rajendra Bhatia. Matrix analysis, volume 169. 2013. 8. Herman Chernoff. A measure of asymptotic efficiency for tests of a hypothesis based on the sum of observations. The Annals of Mathematical Statistics, pages 493 -- 507, 1952. 9. Fan RK Chung. Spectral graph theory, volume 92. American Mathematical Soc., 1997. 10. Christoph Durr and Nguyen Kim Thang. Nash equilibria in Voronoi games on graphs. In Proceedings of ESA 2007, pages 17 -- 28. 2007. 11. Uriel Feige and Eran Ofek. Spectral techniques applied to sparse random graphs. Random Structures & Algorithms, 27(2):251 -- 275, 2005. 13 12. Joel Friedman, Jeff Kahn, and Endre Szemeredi. On the second eigenvalue of random regular graphs. In Proceedings of the twenty-first annual ACM symposium on Theory of computing, pages 587 -- 598. ACM, 1989. 13. Terry L. Friesz. Competitive facility location. Networks and Spatial Economics, 7(1):1 -- 2, 2007. 14. Zolt´an Furedi and J´anos Koml´os. The eigenvalues of random symmetric matrices. Combinatorica, 1(3):233 -- 241, 1981. 15. Michael R. Garey and David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. 1979. 16. Chris Godsil and Gordon F. Royle. Algebraic graph theory, volume 207. 2013. 17. Shinichi Honiden, Michael E. Houle, and Christian Sommer. Balancing graph voronoi diagrams. In Proceedings of the Sixth International Symposium on Voronoi Diagrams (ISVD 2009), pages 183 -- 191, 2009. 18. Alfredo Mar´ın. The discrete facility location problem with balanced allocation of customers. European Journal of Operational Research, 210(1):27 -- 38, 2011. 19. Michael T. Marsh and David A. Schilling. Equity measurement in facility location analysis: A review and framework. European Journal of Operational Research, 74(1):1 -- 17, 1994. 20. Marios Mavronicolas, Burkhard Monien, Vicky G. Papadopoulou, and Florian In Mathematical Foundations of Schoppmann. Voronoi games on cycle graphs. Computer Science 2008, pages 503 -- 514. Springer, 2008. 21. Mihai Patra¸scu and Ryan Williams. On the possibility of faster SAT algorithms. In Proceedings of SODA 2010, pages 1065 -- 1075, 2010. 22. Daniela Saban and Nicolas Stier-Moses. The competitive facility location problem in a duopoly: Connections to the 1-median problem. In Proceedings of WINE 2012, pages 539 -- 545, 2012. 23. Sachio Teramoto, Erik D. Demaine, and Ryuhei Uehara. Voronoi game on graphs and its complexity. In Computational Intelligence and Games, 2006 IEEE Sympo- sium on, pages 265 -- 271. IEEE, 2006. 24. Salil P. Vadhan. Pseudorandomness. Now, 2012. 25. Remco van der Hofstad and Julia Komjathy. Fixed speed competition on the configuration model with infinite variance degrees: Equal speeds. arXiv preprint arXiv:1503.09046, 2015. 26. Nisheeth K. Vishnoi. Laplacian solvers and their algorithmic applications. Theo- retical Computer Science, 8(1-2):1 -- 141, 2012. 14 A Useful Facts Theorem 7 (Chernoff [8]). Let {X1, . . . , Xn} be independent random vari- ables with 0 ≤ Xi ≤ 1, for each i. Let X = Pn i=1 Xi, µ = E[X], and σ2 = V AR(X). Then, it holds that Pr[X − µ ≥ δσ] ≤ C max{exp(−cδ2), exp(−cδσ)}, for some absolute constants c and C, for every δ ≥ 0. Theorem 8 (Bernoulli's Inequality). The following claims hold. 1. For x ≥ −1 and r > 1, it holds that (1 + x)r ≥ 1 + xr. 2. For x ∈ [−1, 1/(r − 1)) and r > 1, it holds that rx (1 + x)r ≤ 1 + . 1 − (r − 1)x Lemma 1 (Spectral to Vertex Expansion [24, Chapter 4]). Let G = (V, E) be a d-regular λ-expander graph with n vertices. Then, for every α ∈ [0, 1], it holds that G is an (αn, d )2+α ) vertex expander. 1 (1−α)( λ Lemma 2 (Expander Mixing Lemma [2]). Let G = (V, E) be a d-regular λ-expander graph with n vertices. Then, it holds that EG(S, T ) − d · S · T n ≤ λpS · T, for any two, not necessarily disjoints subsets S, T ⊆ V . B Missing Proofs We provide proofs missing from the main text. B.1 Proof of Theorem 2 Theorem 2. Let G be a d-regular λ-expander graph of n vertices, let λ = O(√d), and let d = nǫ. Then, G is o(n)-balanced for k = o(d) players, as long as there is no positive integer i for which ǫ = 1 i . Proof. The proof structure is somewhat similar to the proof of Theorem 1, and the overall tactics is to argue that the sizes of the ith neighborhoods of most graphs are roughly similar. The main difference between the current proof and the proof of Theorem 1 is that, while the proof of Theorem 1 uses probabilis- tic arguments to estimate the neighborhood sizes of various facilities, here we naturally use the expanders' expansion properties. For simplicity we present the proof for k = 2. Let v be a vertex of G. Since G is d-regular, it follows by definition that n1 := N (v) = d. Further, let n2 := N2(v), and consider the following cases. 15 1. If ǫ < 1 2 , then n2 = Ω(n1d), by Lemma 1 (which we apply by specifically taking α = 1/√n). Since the graph is d-regular, it follows that n2 = Θ(n1d). 2 , then n2 = n − o(n). This holds since, by applying the expander mixing lemma (Lemma 2), we have that 2. If ǫ > 1 Thus, d n ¯N2(v)d ≤ λq ¯N2(v)d. ¯N2(v) = Θ(( n d )2) = o(n), 3. Notice that the case where d = Θ(n and, indeed, n2 = n − o(n). statement. 1 2 ) is excluded explicitly in the theorem Let ni = Ni(v). By repeating the above arguments for 2 < i ≤ log n, we have the following: 1 1. If d = o(n 2. If d = ω(n 3. Again, the case where d = Θ(n i ) then ni = Θ(di). i ) and d = o(n 1 1 i−1 ) then Ni(v) = n − o(n). 1 i ) is excluded. Notice that ni is as above, for every i and every vertex v in G. By the assumption on ǫ it holds that ǫ > 1 i−1 for some i. Consider two players, placing their facilities on arbitrary vertices v0 and v1. It follows that i and ǫ < 1 Ni(v0) = Ni(v1) = n − Θ(di−1) and therefore {w : dG(w, v0) = dG(w, v1)} ≥ Ni(v0)\ Ni(v1) = n − ¯Ni(v0)[ ¯Ni(v0) ≥ n − ¯Ni(v0) − ¯Ni(v1) = n − Θ(di−1). (5) Using the above equation, we obtain that the score of each player is at least n/2 − Θ(di−1) and at most n/2 + Θ(di−1), which, for sufficiently large values of n, means that the graph is δn-balanced, as needed. ⊓⊔ B.2 Proof of Theorem 4 Theorem 4. Unbalancedness is NP-hard. Proof. A vertex v is dominated by a set of vertices S if it is adjacent to at least one vertex from S. A dominating set is a set of vertices which dominates all other vertices in the graph. We describe a reduction from the following NP-hard problem [15]. 16 v {vb 1 : b ∈ [n3]} v1 v4 {vb 4 : b ∈ [n3]} v2 v3 {vb 2 : b ∈ [n3]} {vb 3 : b ∈ [n3]} Fig. 2. An example of the reduction described in the proof of Theorem 4. The input graph for the Dominating Set instance is composed of the vertices v1, v2, v3, and v4, which are connected by the edges {v1, v2} and {v2, v3}. h is set to 2. The figure shows the reduced instance to Unbalancedness where a bold edge connecting an original vertex to a bag represents n3 edges, connecting the original vertex to all the corresponding bag vertices. Dominating Set Input: A graph G and a budget h. Question: Is there a dominating set of G consisting of h vertices? Given an instance of Dominating Set, we create an instance of Unbal- ancedness, as follows. Let us denote the vertices of G by v1, . . . , vn and refer to them as original vertices. For each original vertex vi (i ∈ [n]) we create n3 new i (i ∈ [n], b ∈ [n3]) and refer to them as bag vertices; we vertices, denoted by vb make each such bag a clique, that is, for each i ∈ [n], we add all edges {vb′ i , vb′′ i }, for b′ 6= b′′, b′ ∈ [n3], b′′ ∈ [n3]. We connect each original vertex vi to its own bag vertices vb i}, for b ∈ [n3]) as well as to the bag vertices of its adjacent vertices (that is, if the edge {vi, vj} is present, then j}, for b ∈ [n3]). We create a new vertex, denoted by v, we add all edges {vi, vb and connect it to all the original vertices (that is, we add the edges {v, vi}, for i ∈ [n]). We set the number k of facilities to h + 1 and the bound s to n. This finishes the polynomial-time reduction. An example of the construction is given in Figure 2. i (that is, we add all edges {vi, vb Next we prove correctness. Given a dominating set u1, . . . , uh, we place one facility on v and the other k − 1 = h facilities on the dominating set vertices u1, . . . , uh. The score of the facility placed on v is at most n + 1− h ≤ n, since it gets no score from the bag vertices and the dominating set vertices. Thus, there exist a player whose score is strictly less than s. 17 1/1 1/2 2/2 c 1/3 2/3 3/3 1/5 2/5 3/5 4/5 5/5 Fig. 3. A graph which is not 0-balanced for any placement of two facilities. For the other direction, Consider a placement of k facilities on the constructed graph such that there exists at least one player, say P1, whose score is less than s = n. We claim that P1's facility must be placed on v: if this is not the case, that is, if P1 is placing a facility on either an original vertex or a bag vertex, then it has distance one to at least one bag of n3 bag vertices; as a result, P1's score would be at least n2 > n. Following the last paragraph, we have that P1 is placing a facility on v. Notice that, roughly speaking, our goal now is to reduce the score of P1 to the minimum possible. First, we claim that no player can place a facility on a bag vertex. In contradiction, let us assume some player Pi places a facility on a bag vertex vb i , for some i ∈ [n] and b ∈ [n3]. Then, if another facility is placed on its corresponding original vertex vi, then we pick an arbitrary original vertex with no facility placed on it, and move Pi's facility to this arbitrarily-chosen original vertex. The score of P1 will not increase as a result of this move. Otherwise, if no facility is placed on the original vertex vi corresponding to the vertex vb i , then we move Pi's facility to its corresponding original vertex vi. Again, the score of P1 will not increase as a result of this move. Thus, we can assume without loss of generality that no facility is placed on a bag vertex. Thus, we have that P1 is placing a facility on v, and all other players are placing facilities on original vertices. Now, if those facilities do not form a dom- inating set, then at least one original vertex vi exists which is not adjacent to any facility. The facility placed by Pi on v will have distance of 2 to the bag vertices vb i (b ∈ [n3]) corresponding to the undominated vertex vi, and all other facilities will have distance of at least 2 to these vertices. Thus, the score of v will be at least n3/k ≥ n2 > s, therefore, we conclude that the other facilities are placed on vertices which form a dominating set. ⊓⊔ 18 B.3 Proof of Proposition 1 Proposition 1. For any placement of two facilities, the graph depicted in Fig- ure 3 is not 0-balanced. Proof. Consider the graph depicted in Figure 3, composed of a center vertex c and four branches: first branch, consisting of vertex 1/1; second branch, consist- ing of vertices 1/2, 2/2; third branch, consisting of vertices 1/3, 2/3, and 3/3, and fourth branch, consisting of vertices 1/5, 2/5, 3/5, 4/5, and 5/5. We argue that the graph depicted in Figure 3 is not balanced for any placement of two facilities on it. To this end, let us denote one facility by f1 and the other by f2, and consider the following case analysis. f1 is placed on c: in this case, the best position for f2 is 1/5, making f1's score strictly greater than that of f2. f1 and f2 are placed on the same branch: in this case, the facility which is placed closer to c has strictly larger than the other facility. f1 and f2 are placed on different branches: we split this case into two subcases. First, if both facilities are placed such that they have the same distance to c, then the facility which is placed on the longer branch wins. Second, if the facilities are placed such that one of them has smaller distance to c, then, without loss of generality, assume that the distance between f1 and c is strictly smaller than the distance between f2 and c. Then, the best placement for f2 is when it is the closest to all the vertices of the longest path, thus getting a score of 5. However, even in this case f1 has strictly larger score, specifically 7. ⊓⊔ 19
1806.03936
1
1806
2018-06-11T12:34:48
Scalable Approximation Algorithm for Graph Summarization
[ "cs.DS", "cs.DM" ]
Massive sizes of real-world graphs, such as social networks and web graph, impose serious challenges to process and perform analytics on them. These issues can be resolved by working on a small summary of the graph instead . A summary is a compressed version of the graph that removes several details, yet preserves it's essential structure. Generally, some predefined quality measure of the summary is optimized to bound the approximation error incurred by working on the summary instead of the whole graph. All known summarization algorithms are computationally prohibitive and do not scale to large graphs. In this paper we present an efficient randomized algorithm to compute graph summaries with the goal to minimize reconstruction error. We propose a novel weighted sampling scheme to sample vertices for merging that will result in the least reconstruction error. We provide analytical bounds on the running time of the algorithm and prove approximation guarantee for our score computation. Efficiency of our algorithm makes it scalable to very large graphs on which known algorithms cannot be applied. We test our algorithm on several real world graphs to empirically demonstrate the quality of summaries produced and compare to state of the art algorithms. We use the summaries to answer several structural queries about original graph and report their accuracies.
cs.DS
cs
Scalable Approximation Algorithm for Graph Summarization Maham Anwar Beg, Muhammad Ahmad, Arif Zaman, and Imdadullah Khan Department of Computer Science, School of Science and Engineering, Lahore University of Management Sciences, Pakistan {14030016,17030056,arifz,imdad.khan}@lums.edu.pk Abstract. Massive sizes of real-world graphs, such as social networks and web graph, impose serious challenges to process and perform analyt- ics on them. These issues can be resolved by working on a small summary of the graph instead . A summary is a compressed version of the graph that removes several details, yet preserves it's essential structure. Gen- erally, some predefined quality measure of the summary is optimized to bound the approximation error incurred by working on the summary instead of the whole graph. All known summarization algorithms are computationally prohibitive and do not scale to large graphs. In this paper we present an efficient randomized algorithm to compute graph summaries with the goal to minimize reconstruction error. We propose a novel weighted sampling scheme to sample vertices for merging that will result in the least reconstruction error. We provide analytical bounds on the running time of the algorithm and prove approximation guarantee for our score computation. Efficiency of our algorithm makes it scalable to very large graphs on which known algorithms cannot be applied. We test our algorithm on several real world graphs to empirically demonstrate the quality of summaries produced and compare to state of the art algo- rithms. We use the summaries to answer several structural queries about original graph and report their accuracies. 1 Introduction Analysis of large graphs is a fundamental task in data mining, with applications in diverse fields such as social networks, e-commerce, sensor networks and bioin- formatics. Generally graphs in these domains have very large sizes - millions of nodes and billions of edges are not uncommon. Massive sizes of graphs make processing, storing and performing analytics on them very challenging. These issues can be tackled by working instead on a compact version (summary) of the graph, which removes certain details yet preserves it's essential structure. Summary of a graph is represented by a 'supergraph' with weights both on edges and vertices. Each supernode of the summary, represents a subset of original vertices while it's weight represents the density of subgraph induced by that subset. Weights on edges, represent density of the bipartite graph induced by the two subsets. Quality of a summary is measured by the 'reconstruction error', a norm of the difference of actual and reconstructed adjacency matrices. Another parameter adopted to assess summaries is the accuracy in answer to queries about original graph computed from summaries only. Note that, since there are exponentially many possible summaries (number of partitions of vertex set), finding the best summary is a computationally chal- lenging task. GraSS [1] uses an agglomerative approach, where in each iteration a pair of nodes is merged until the desired number of nodes is reached. Since the size of search space at iteration t is O((cid:0)n(t) (cid:1)), where n(t) is number of supern- 2 odes at iteration t. GraSS randomly samples O(n(t)) pairs and merges the best pair (pair with the least score) among them. With the data structures of GraSS, merging and evaluating score of a pair can be done in O(∆(t)) (maximum degree of the summary in iteration t). This results in the overall worst case complexity of O(n2∆) to compute a summary with O(n) nodes. S2L[2] on the other hand uses a clustering technique for Euclidean space by considering each vertex as an N-dimensional vector. The complexity of this algorithm is O(n2t) to produce a summary of a fixed size k = O(n), where t is the number of iterations before convergence. In this paper we take the agglomerative approach to compute summary of any desired size. In every iteration a pair is chosen for merging from a ran- domly chosen sample. We derive a closed form formula for reconstruction error of the graph resulting after merging a pair. Exact computation of this score takes O(∆) time but with constant extra space per node, this can be approximated in constant time with bounded error. Furthermore, we define weight of each node that can be updated in constant time and closely estimate the contribution of a node to score of pairs containing it. We select a random sample of pairs by selecting nodes with probability proportional to their weights, resulting in sam- ples of much better quality. We establish that with these weights, logarithmic sized sample yields comparable results. The overall complexity of our algorithm comes down to O(n(log n + ∆)). Our approach of sampling vertices according to their weights form a dynamic graph (where weights are changing) may be of independent interest. We evaluate our algorithm on several benchmark real world networks and demonstrate that we significantly outperform GraSS[1] and S2L[2] both in terms of running time and quality of summaries. The remaining paper is organized as follows. Section 2 discusses previous work on graph summarization and related problems. In section 3 we formally define the problem with it's background. We present our algorithm along with it's analysis in section 4. In section 5 we report results of experimental evaluation of our algorithm on several graphs. We also provide comparisons with existing solutions both in terms of runtime and quality. 2 Related Work Graph summarization and compression is a widely studied problem and has applications in diverse domains. There are broadly two types of graph summaries (represented as supergraphs described above): lossless and lossy. The original graph can be exactly reconstructed from a lossless summary, hence the goal is to optimize the space complexity of a summary [3]. The guiding principle here is that of minimum description length MDL [4]. It states that minimum extra information should be kept to describe the summarized data. In lossless summary [5, 6], edge-corrections are stored along with each supernode and super edges to identify missing edges. [7] stores information about structures like cliques, stars, and chains formed by subgraphs as lossless summary of a graph. Lossy compression, on the other hand, compromises some detailed informa- tion to reduce the space complexity. There is a trade off between quality and size of the summary. Quality of a summary is measured by a norm of difference between original adjacency matrix and the adjacency matrix reconstructed from the summary, known as reconstruction error. [1] adopted an agglomerative ap- proach to greedily merge pairs of nodes to minimize the l1-reconstruction error. Runtime of their algorithm amounts O(n3) in the worst case. In [2], each node is considered a vector in Rn (it's row in the adjacency matrix) and point-assignment clustering methods (such as k-means) are em- ployed. Each cluster is considered a supernode and the goal is to minimize the l2-reconstruction error. The authors suggest to use dimensionality reduc- tion techniques for points in Rn. This technique does not use any structural information of the graph. In [8] social contexts and characteristics are used to summarize social networks. Summarization of edge-weighted graphs is studied in [9]. Graph compression techniques relative to a certain class of queries on labeled graphs is studied in [10]. [11] uses entropy based unified model to make a homogeneous summary for labeled graphs. Compression of web graphs and social networks is studied in [12, 13] and [14], respectively.See [15] for detailed overview of graph summarization techniques. A closely related area is that of finding clusters and communities in a graph using iterative algorithms [16], agglomerative algorithms [17] and spectral tech- niques [18]. Identification of web communities in web graphs using maximum flow/minimum cut problem is discussed in [19]. 3 Problem Definition Vi ∩ Vj = ∅ for i (cid:54)= j and(cid:83)k Given a graph G = (V, E) on n vertices, let A be it's adjacency matrix. For k ∈ Z, a summary of G, S = (VS, ES) is a weighted graph on k vertices. Let VS = {V1, . . . , Vk}, each Vi ∈ VS is referred to a supernode and represents a subset of V . More precisely, VS is a partition of V , i.e. Vi ⊂ V for 1 ≤ i ≤ k, i=1 Vi = V . Each supernode Vi is associated with two integers ni = Vi and ei = {(u, v)u, v ∈ Vi, (u, v) ∈ E}. For an edge (Vi, Vj) ∈ ES (known as superedge), let eij be the number of edges in the bipartite subgraph induced between Vi and Vj, i.e. eij = {(u, v)u ∈ Vi, v ∈ Vj, (u, v) ∈ E}. Given a summary S, the graph G is approximately reconstructed by the expected adjacency matrix, ¯A, where ¯A is a n × n matrix with  0 ei (ni 2 ) eij ninj ¯A(u, v) = if u = v if u, v ∈ Vi if u ∈ Vi, v ∈ Vj The quality of a summary S is assessed by lp-norm of element-wise difference between ¯A and A. Definition 1. (lp-Reconstruction Error (REp)): The (unnormalized) lp recon- struction error of a summary S of a graph G is REp(GS) = REp(A ¯A) = ¯A(i, j) − A(i, j)p (1)  V (cid:88) V (cid:88) i=1 j=1 1/p Note that the case p = 1 considered in [1] and p = 2 considered in [2] are closely related to each other. In this paper we use p = 1 and refer to RE1(GS) as RE(GS). A simple calculation shows that RE(GS) can be computed in the following closed form. k(cid:88) i=1 i(cid:0)ni (cid:1) + 4ei − 4e2 k(cid:88) k(cid:88) 2 i=1 j=1,j(cid:54)=i 2eij − 2e2 ij ninj (2) RE(GS) = RE(A ¯A) = Formally, we address the following problem. Problem 2. Given a graph G(V, E) and a positive integer k ≤ V , find a sum- mary S for G with k super nodes such that RE(GS) is minimized. Another measure to assess quality of a summary S of G is by the accuracy of answers of queries about structure of G based on S only. In the following we list how certain queries used in the literature are answered from S. Adjacency Queries: Given two vertices u, v ∈ V , the query whether (u, v) ∈ E is answered with ¯A(u, v). This can either be interpreted as the expected value of an edge being present between u and v or as returning a 'yes' answer based on the outcome of a biased coin. {4,5}{1,2,3}{6}e2=1e1=2e3=0V2V1V3e12=2e13=2n2=2n1=3n3=1SummaryS(VS,ES)123456GraphG(V,E)02/32/32/32/302/32/301/31/31/31/31/31/301/31/31/311/31/31/3012/32/32/3002/32/32/3000123456123456¯A answered as ¯d(v) =(cid:80)n ¯A(v, j). j=1 Degree Queries: Given a vertex v ∈ V , the query about degree of v is Eigenvector-Centrality Queries: Eigenvector-centrality of a vertex v, p(v) measures the relative importance of v [20]. For a vertex v ∈ V , this query is answered as ¯p(v) = ¯d(v) 2E . Triangle density queries: Let t(G) be the number of triangles in G. t(G) is estimated from S by counting the expected number of triangles within each super node, the expected number of triangles made with one vertex in one supernode and two in another, and that made with one vertex each from three different super nodes. More precisely, this query is answered as follows. Let πi = ei and (ni 2 ) πij = eij ninj , then ¯t(G), the estimate for t(G), is (cid:19) (cid:18)ni 3 k(cid:88) i=1 π3 i + π2 ij (cid:20)(cid:18)ni (cid:19) 2 k(cid:88) j=i+1 (cid:18)nj (cid:19) 2 (cid:21) k(cid:88) l=j+1 njπi + niπj + ninjnlπijπjlπil  . 4 Algorithm Given a graph G and an integer k our algorithm produces a summary S on k super nodes as follows. Let St−1 be the summary before iteration t with n(t− 1) super nodes, i.e. S0 = G, and let ¯At be the expected adjacency matrix of St. For 1 ≤ t ≤ n − k, we select a pair of supernodes (u, v) and merge it to get St. To select an approximately optimal pair thie weight of each node v that closely estimate the contribution of node to score of pairs (v,∗). We randomly sample nodes for each pair with probability proportional to their weights and evaluate score of the pairs. We derive a closed form formula to evaluate score of a pair. Furthermore, in is form these scores can be approximately computed very efficiently. Based on approximate score we select the best pair in the sample and merge it to get St. In what follows, we discuss implementation of each of these subroutines and their analyses. Lemma 3. A pair (u, v) of nodes in St, can be merged to get St+1 in time O(deg(u) + deg(v)). Proof. In the adjacency list format, one needs to iterate over neighbors of each u and v and record their information in a new list of the merged node. However, updating the adjacency information at each neighbor of u and v could potentially lead to traversal of all the edges. To this end, as a preprocessing step, for each (x, y), in the adjacency list of x at node y, we store a pointer to the corresponding entry in the adjacency list of y. With this constant (per edge) extra book keeping we can update the merging information at each neighbor in constant time by traversing just the list of u and v. It is easy to see that this preprocessing can be done in time O(E) once at the initialization. (cid:117)(cid:116) The next important step is to determine the goodness of a pair (a, b). This can be done by temporarily merging a and b and then evaluating (1) or (2) respectively taking O(n2) and O(n(t)). For a pair of nodes (a, b) in St−1, let Sa,b graph obtained after merging a and b. We define score of a pair (a, b) to be t be the scoret(a, b) = RE(GSt−1) − RE(GSa,b 4e2 ab nanb = − 4e2 4e2 ai nani + t ) n(t)(cid:88) a(cid:0)na (cid:1) − 4(cid:0)ea + eb + eab (cid:0)na+nb (cid:1) i=1 i(cid:54)=a 2 2 (cid:1)2 + (cid:0)na + nb 4 + − 4e2 n(t)(cid:88) (cid:1) − b(cid:0)nb (cid:16) e2 (cid:1) n(t)(cid:88) i=1 i(cid:54)=b 2 ai ni i=1 i(cid:54)=a,b 4e2 bi nbni + e2 bi ni + 2eaiebi ni (cid:17) (3) Fact 4 Since St−1 is fixed, minimizing RE(GSa,b scoret(a, b). t ) is equivalent to maximizing node a such that, Da = (cid:80)n(t) Remark 5. Except for the last summation in (3) all other terms of scoret(a, b) can be computed in constant time. Since na, nb, ea, and eb are already stored at a and b, this can be achieved by storing an extra real number Da at each super . Note that Da can be updated in constant time after merging of any two vertices x, y (cid:54)= a, i.e. after merging x, y, while traversing their neighbors for a we subtract exa/nx and eya/ny from Da and add back (ex + ey)/(nx + ny) to it. This value can be similarly updated at the merged node too. e2 ai ni i=1 i(cid:54)=a The last summation in (3), (cid:80)n(t) 2eaiebi , in essence is the inner product of (B two n(t) dimensional vectors A and B, where the ith coordinate of A is eai√ is similarly defined). Storing these vectors will take O(n(t)), moreover comput- ing score will take time O(n(t)). However, (cid:104)A,B(cid:105) = A · B can be very closely approximated with a standard application of count-min sketch [21]. i=1 i(cid:54)=a,b ni ni Theorem 6. (c.f [21] Theorem 2) For 0 < , δ < 1, let for (cid:104)A,B(cid:105) using the count-min sketch. Then be the estimate (cid:68)(cid:100)A,B(cid:69) (cid:68)(cid:100)A,B(cid:69) δ ). (cid:68)(cid:100)A,B(cid:69) ≥ (cid:104)A,B(cid:105) (cid:68)(cid:100)A,B(cid:69) – P r[ – < (cid:104)A,B(cid:105) + A1B1] ≥ 1 − δ. A,B Furthermore, the space and time complexity of computing While after a merge, the sketch can be updated in time O(log 1 is O( 1  log 1 δ ). Hence, for a pair of nodes (a, b) in St−1, scoret(a, b) can be closely approx- imated in constant time. Note that the bounds on time and space complexity, though constants are quite loose in practice. The next important issue the quadratic size of search space. This is a major hurdle to scalability to large graphs. We define weight of a node a as f (a) = − 4e2 a(cid:0)na (cid:1) − 2 n(t)(cid:88) i=1 i(cid:54)=a 4e2 ai nani w(a) = if f (a) (cid:54)= 0 otherwise (4)  −1 f (a) 0 size O(log n) outperforms a random sample of size O(n). Let W = (cid:80)n(t) We select pairs by sampling nodes according to their weights so as the pairs selected will likely have higher scores. With this weighted sampling a sample of i=1 w(i) be the sum of weights, we select a vertex w with probability w(a)/W . Weighted sampling though can be done in linear time at a given iteration. In our case it is very challenging since the population varies in each iteration; two vertices are merged into one and weights of some nodes also change. To overcome this challenge, we design special data structure D that has the following properties. Claim. D can be implemented as a binary tree such that i. it can be initially populated in O(n), ii. a node can be sampled with probability proportional to it's weight in O(log n) iii. inserting, deleting or updating a weight in D takes time O(log n). Remark 7. We designed this data structure independently, but found out that it has been known to the statistics community since 1980 [22]. We note that this technique could have many applications in sampling from dynamic graphs. Algorithm 1 is our main summarization algorithm that takes as input G, integers  and d = log 1 k (target summary size), s (sample size), w and d (where w = 1 are parameters for count-min sketch). δ Algorithm 1 : ScalableSumarization(G = (V, E), k, w, d) 1: D ← buildSamplingTree(V, W, 1, n) 2: while G has more than k vertices do sampleP airs ← GetSample(D, s) 3: scores ← ComputeApproxScore(sampleP airs) 4: bestP air ← Max(scores) 5: Merge(bestP air) 6: for each neighbor x of u, v ∈ bestP air do 7: 8: UpdateWeight(x,D) (cid:46) W [1 . . . n] is initialize as W [i] = w(vi) (cid:46) s calls to Algorithm 3 (cid:46) Uses (3) and Theorem 6 (cid:46) Lemma 3 For each vertex a we maintain a variable Da (Remark 5). Hence the weight array can be initialized in O(n) time using (4). By Claim 4, D can be populated in O(n) time. By Claim 4, Line 3 takes O(s log n) time, by Theorem 6 and (3) Line 4 takes constant time per pair, and by Lemma 3 merging can be performed in O(∆) time. Since delete and update in D takes time O(log n) and the while loop is executed n−k +1 times, total runtime of Algorithm 1 is O((n−k +1)(s log n+ ∆ log n). Generally k is O(n) (typically a fraction of n) and in our experiments we take s to be O(log n) and O(log2 n). Furthermore, since many real world graphs are very sparse, (∆ which is worst case upper bound is constant), we get that overall complexity of our algorithm is O(n log2 n) or O(n log3 n). value of the root is equal to(cid:80)n(t) Data Structure for sampling: We implement D as a balanced binary tree, where leaf corresponds to (super) node in the graph and stores weight and id of the node. Each internal node stores the sum of values of the two children. The i=1 w(i). Furthermore, at each node in the graph we store a pointer to the corresponding leaf. We give pseudocode to construct this tree in Algorithm 2 along with the structure of a tree node. By construction, it is clear that hight of the tree is (cid:100)log n(cid:101) and running time of building the tree and space requirement of D is O(n). Algorithm 2 BuildSamplingTree(A,W ,st,end) Structure TreeNode int vertexID double weight TreeNode ∗lef t TreeNode ∗right TreeNode ∗parent 1: if A[st] = A[end] then leaf ← CreateNode() 2: leaf.weight ← W [st] 3: leaf.vertexID ← A[st] 4: return leaf 5: 6: else 7: 8: 9: 10: 11: 2 12: 13: 14: 15: 16: 1, end) mid = end+st lef t ← CreateNode() lef t ← BuildSamplingTree(A, W, st, mid) right ← CreateNode() right ← BuildSamplingTree(A, W, mid + parent ← CreateNode() parent.weight ← lef t.weight + right.weight lef t.parent ← parent right.parent ← parent return parent r ∈ [0,(cid:80)n(t) The procedure to sample a vertex with probability proportional to its weight using D is given in Algorithm 3. This takes as input a uniform random number i=1 w(i)]. Since it traverses a single path from root to leaf, the runtime of this algorithm is O(log n). The update procedure is very similar, whenever weight of a node changes, we start from the corresponding leaf (using the stored pointer to leaf) and change weight of that leaf. Following the parent pointers, we update weights of internal nodes to the new sum of weights of children. Deleting a node is very similar, it amounts to updating weight of the corresponding leaf to 0. Inserting a node (the super node representing the merged nodes) is achieved by changing the weight of the first empty leaf in D. A reference to first empty node is maintained as a global variable. return node.vertexID Algorithm 3 :GetLeaf(r,node) 1: if node.lef t = NULL ∧node.right = NULL then 2: 3: if r < node.lef t.weight then 4: 5: else 6: return GetLeaf(r, node.lef t) return GetLeaf(r − node.weight, node.right) Fig. 1: Comparison between k-Gs-SamplePairs on ego-Facebook. Runtimes re- ported are at k=500. 5 Evaluation We evaluate performance of our algorithm in terms of runtime, reconstruction error and accuracies of answers to queries on standard benchmark graphs 1. We demonstrate that our algorithm substantially outperforms existing solutions, GraSS[1] and S2L[2] in terms of quality while achieving order of magnitude speed-up over them. Our Java Implementation is available at 2. We also report the accuracies in query answered based on summaries only and show that error is very small and we save a lot of time. Errors reported are normalized by V . All runtimes are in seconds. From Figure 1, it is clear that the quality of our summaries compares well with that of k-Gs-SamplePairs but with much smaller sample size. We report results for s ∈ {log n(t), 5 log n(t), log2 n(t)}, with exact score computation. In- deed with sublinear sample size O(log n(t)) and O(log2 n(t)), our reconstruction error is less than k-Gs-SamplePairs with sample size 0.01n(t). Although for n(t) significantly smaller than V , there is a small difference in size of logarithmic and linear sample, but we benefit from our logarithmic sample size for large n(t). In Table 1, we present reconstruction errors on moderately large sized graphs. Even though S2L is suitable for Euclidean errors, our algorithm still outperforms S2L because by minimizing RE we preserve the original structure of the graph. We use s = log n(t), w ∈ {50, 100} and d = 2. We also report results without ap- proximation in score computation. Note that we are able to generate summaries 1 http://snap.stanford.edu/ 2 https://bitbucket.org/M_AnwarBeg/scalablesumm/ 3 Represents score computation without approximation using Equation 3. n(t)50010001500200025003000350040004500Reconstruction Error0102030405060KGs-Sample Pairs with c=0.01. Runtime=11.16 (s)Our Algo with s=log n(t). Runtime 0.55 (s)Our Algo with s=5 log n(t). Runtime=1.29 (s)KGs-Sample Pairs with c=0.1. Runtime = 105.68 (s)Our Algo with s=log2n(t). Runtime=1.61 (s) Graph k ego-Facebook V =4,039 E=88,234 email-Enron V =36,692 E=183,831 web-Stanford V =281,903 E=1,992,636 amazon0601 V =403,394 E=2,443,408 1000 1500 10000 14000 2000 10000 2000 8000 Error RunTime w 50 100 -3 50 100 - 50 100 - 50 100 - 50 100 - 50 100 - 50 100 - 50 100 - RE 69.98 57.27 38.98 58.17 40.05 27.14 6.03 5.84 5.82 4.25 4.16 4.15 24.11 24.01 24.01 23.65 23.61 21.13 24.11 24.10 24.10 23.77 23.74 23.73 (l2)2 35.00 28.66 19.51 29.09 20.04 13.58 3.01 2.92 2.91 2.13 2.08 2.08 12.06 12.01 12.05 11.83 11.81 10.57 12.06 12.05 12.05 11.89 11.87 11.87 avg 0.83 0.94 1.01 0.82 0.83 0.87 1.95 2.14 2.21 1.69 1.77 1.81 65.97 64.41 73.48 59.87 66.21 59.34 147.3 158.03 175.29 143.83 154.34 171.00 std 0.01 0.05 0.08 0.05 0.03 0.04 0.05 0.02 0.07 0.05 0.02 0.01 0.02 0.82 0.28 0.15 0.67 0.28 3.72 1.59 5.81 3.58 1.92 5.63 S2L (l2)2 581 501 72 54 48 38 53 51 Table 1: Comparison of S2L with our algorithm using different count min sketch widths. The numbers reported here for S2L are as given by authors in [2]. with much smaller runtime on a less powerful machine, (Intel(R) Core i5 with 8.00 GB RAM and 64-bit OS) compared to one reported in [2]. Table 2 contains quality and runtime for very large graphs, on which none of the previously proposed solutions were applicable. We use s = log n(t), w ∈ {50, 100, 200} and d = 2. We get some reduction in running times by ap- proximating the score while the quality of summaries remains comparable. Note that large values of w result in increased runtime without any improvement in quality. This is so because the complexity of exact score evaluation depends on maximum degree, which in real world graphs is small. In Table 3, we tabulate answers to queries that are computed from summaries only. We report mean absolute errors in estimated degrees and eigenvector- centrality scores. For triangle density we report relative error, calculated as ¯t(G)−t(G) . In all cases query answers are very close to the true values, signifying t(G) the fact that our summaries do preserve the essential structure of the graph. 6 Conclusion In this work we devise a sampling based efficient approximation algorithm for graph summarization. We derive a closed form for measuring suitability of a pair of vertex for merging. We approximate this score with theoretical guaran- tees on error. Another major contribution of this work is the efficient weighted as-Skitter E= 1,696,415 V = 11,095,298 Time wiki-Talk E = 2,394,385 V = 4,659,565 com-Youtube E =1,157,828 V = 2,987,624 Time Time RE 25.42 24.81 24.35 23.81 23.49 21.78 20.90 20.77 21.28 18.90 18.48 18.42 15.34 13.79 13.68 13.65 avg 521.43 516.03 559.91 649.82 481.40 480.85 524.94 591.35 436.84 445.27 486.88 535.02 332.27 350.47 376.89 392.58 std 12.93 22.97 13.07 20.44 14.11 23.54 12.88 19.36 11.52 23.18 13.14 18.90 9.58 21.77 11.86 13.48 RE 7.28 7.07 6.82 6.72 5.77 5.65 5.63 5.62 5.12 5.09 5.08 5.08 4.23 4.22 4.21 4.21 avg 311.10 328.19 363.37 319.95 285.89 299.98 329.39 273.24 266.15 276.32 303.44 248.73 223.65 232.39 256.05 203.93 std 5.68 2.06 8.63 28.91 5.56 1.97 8.95 24.05 4.83 2.77 8.60 20.44 3.85 1.81 6.74 18.21 RE 9.98 9.64 9.30 9.26 7.49 7.13 7.09 7.08 5.90 5.82 5.81 5.81 3.91 3.90 3.89 3.89 avg 207.38 222.22 251.94 242.58 184.67 195.85 215.87 199.48 160.11 167.67 183.64 164.80 103.25 107.79 118.73 98.70 std 4.66 7.17 8.28 13.85 3.86 6.41 7.23 10.85 3.51 5.22 5.81 9.87 3.97 1.03 4.60 4.89 Parameters k×(103) 10 50 100 250 w 50 100 200 - 50 100 200 - 50 100 200 - 50 100 200 - Table 2: Quality in terms of RE of summary produced by our algorithm on large sized graph. sampling scheme to improve the quality of samples. This enables us to work with substantially smaller sample sizes without compromising summary quality. Our algorithm is scalable to large graphs on which previous algorithms are not applicable. Extensive evaluation on a variety of real world graphs show that our algorithm significantly outperforms existing solutions both in quality and time complexity. References 1. LeFevre, K., Terzi, E.: Grass: Graph structure summarization. In: SIAM Interna- tional Conference on Data Mining, SDM. (2010) 454–465 2. Riondato, M., Garc´ıa-Soriano, D., Bonchi, F.: Graph summarization with quality In: IEEE International Conference on Data Mining, ICDM. (2014) guarantees. 947–952 3. Storer, J.: Data compression. Elsevier (1988) 4. Rissanen, J.: Modeling by shortest data description. Automatica 14(5) (1978) 465–471 5. Navlakha, S., Rastogi, R., Shrivastava, N.: Graph summarization with bounded In: ACM International Conference on Management of Data, SIGMOD. error. (2008) 419–432 6. Khan, K., Nawaz, W., Lee, Y.: Set-based approximate approach for lossless graph summarization. Computing 97(12) (2015) 1185–1207 7. Koutra, D., Kang, U., Vreeken, J., Faloutsos, C.: VOG: summarizing and under- standing large graphs. In: SIAM International Conference on Data Mining, SDM. (2014) 91–99 8. Zhuang, H., Rahman, R., Hu, X., Guo, T., Hui, P., Aberer, K.: Data summariza- tion with social contexts. In: ACM International Conference on Information and Knowledge Management, CIKM. (2016) 397–406 ego-Facebook Eigenvector- Centrality (×10−5) Degree email-Enron Eigenvector- Centrality (×10−5) Degree k 500 Triangle w avg stdev avg stdev Density 50 22.50 29.70 6.37 100 14.95 26.58 4.24 - 12.01 12.70 3.40 -0.89 -0.76 -0.28 8.42 7.53 3.60 k 4000 Triangle w avg stdev avg stdev Density 50 2.49 8.60 0.34 100 1.94 4.26 0.26 - 1.91 3.09 0.26 -0.37 -0.19 -0.16 1.17 0.58 0.42 1000 50 17.66 25.68 5.00 100 10.67 24.19 3.02 7.62 9.41 2.16 - 1500 50 13.22 22.19 3.75 100 7.04 18.32 2.00 4.50 5.67 1.28 - 7.28 6.85 2.67 6.29 5.19 1.61 -0.84 -0.58 -0.15 -0.72 -0.41 -0.08 50 1.56 4.70 0.21 100 1.37 2.33 0.19 - 1.38 2.24 0.19 6000 50 1.15 3.10 0.16 100 1.06 1.77 0.14 - 1.04 1.52 0.14 8000 0.64 0.32 0.31 0.42 0.24 0.21 -0.18 -0.12 -0.11 -0.11 -0.08 -0.08 Table 3: Error in queries computed by summaries generated by our algorithm. Absolute average error is reported for degree and centrality query. For triangle density, relative error is reported. 9. Toivonen, H., Zhou, F., Hartikainen, A., Hinkka, A.: Compression of weighted In: ACM International Conference on Knowledge Discovery and Data graphs. Mining, SIGKDD. (2011) 965–973 10. Fan, W., Li, J., Wang, X., Wu, Y.: Query preserving graph compression. In: ACM International Conference on Management of Data, SIGMOD. (2012) 157–168 11. Liu, Z., Yu, J.X., Cheng, H.: Approximate homogeneous graph summarization. Journal of Information Processing 20(1) (2012) 77–88 12. Boldi, P., Vigna, S.: The webgraph framework I: compression techniques. In: International Conference on World Wide Web, WWW. (2004) 595–602 13. Adler, M., Mitzenmacher, M.: Towards compressing web graphs. In: Data Com- pression Conference, DCC. (2001) 203–212 14. Chierichetti, F., Kumar, R., Lattanzi, S., Mitzenmacher, M., Panconesi, A., Ragha- van, P.: On compressing social networks. In: ACM International Conference on Knowledge Discovery and Data Mining, SIGKDD. (2009) 219–228 15. Liu, Y., Dighe, A., Safavi, T., Koutra, D.: A graph summarization: A survey. arXiv preprint arXiv:1612.04883 (2016) 16. Newman, M.E., Girvan, M.: Finding and evaluating community structure in net- works. Physical review E 69(2) (2004) 026113 17. Clauset, A., Newman, M.E., Moore, C.: Finding community structure in very large networks. Physical review E 70(6) (2004) 066111 18. White, S., Smyth, P.: A spectral clustering approach to finding communities in graphs. In: SIAM International Conference on Data Mining, SDM. (2005) 274–285 19. Flake, G.W., Lawrence, S., Giles, C.L.: Efficient identification of web communi- ties. In: ACM International Conference on Knowledge Discovery and Data Mining, SIGKDD. (2000) 150–160 20. Motwani, R., Raghavan, P.: Randomized algorithms. Chapman & Hall/CRC (2010) 21. Cormode, G., Muthukrishnan, S.: An improved data stream summary: the count- min sketch and its applications. Journal of Algorithms 55(1) (2005) 58–75 22. Wong, C.K., Easton, M.C.: An efficient method for weighted sampling without replacement. SIAM Journal on Computing 9(1) (1980) 111–113
1906.07754
1
1906
2019-06-18T18:28:17
On the Constrained Least-cost Tour Problem
[ "cs.DS", "cs.AI" ]
We introduce the Constrained Least-cost Tour (CLT) problem: given an undirected graph with weight and cost functions on the edges, minimise the total cost of a tour rooted at a start vertex such that the total weight lies within a given range. CLT is related to the family of Travelling Salesman Problems with Profits, but differs by defining the weight function on edges instead of vertices, and by requiring the total weight to be within a range instead of being at least some quota. We prove CLT is $\mathcal{NP}$-hard, even in the simple case when the input graph is a path. We derive an informative lower bound by relaxing the integrality of edges and propose a heuristic motivated by this relaxation. For the case that requires the tour to be a simple cycle, we develop two heuristics which exploit Suurballe's algorithm to find low-cost, weight-feasible cycles. We demonstrate our algorithms by addressing a real-world problem that affects urban populations: finding routes that minimise air pollution exposure for walking, running and cycling in the city of London.
cs.DS
cs
On the Constrained Least-cost Tour Problem Patrick O'Hara The Alan Turing Institute [email protected] M.S. Ramanujan Dept. of Computer Science University of Warwick [email protected] Theodoros Damoulas The Alan Turing Institute Depts. of Computer Science and Statistics University of Warwick [email protected] Abstract We introduce the Constrained Least-cost Tour (CLT) problem: given an undirected graph with weight and cost functions on the edges, minimise the total cost of a tour rooted at a start vertex such that the total weight lies within a given range. CLT is related to the family of Travelling Salesman Problems with Profits, but differs by defining the weight function on edges instead of vertices, and by requiring the total weight to be within a range instead of being at least some quota. We prove CLT is NP-hard, even in the simple case when the input graph is a path. We derive an informative lower bound by relaxing the integrality of edges and propose a heuristic motivated by this relaxation. For the case that requires the tour to be a simple cycle, we develop two heuristics which exploit Suurballe's algorithm to find low-cost, weight-feasible cycles. We demonstrate our algorithms by addressing a real-world problem that affects urban populations: finding routes that minimise air pollution exposure for walking, running and cycling in the city of London. 1 Introduction Large scale graph optimisation problems are at the heart of urban science, computational sustainability [12] and human wellbeing. Examples include computing connected subgraphs to design wildlife corridors [6] and planning methods for bike sharing systems in New York [8]. With 91% of the world population exposed to particulate matter (PM2.5) concentrations that are above the annual mean World Health Organization air quality guideline levels [22], we are motivated by the interesting and challenging problem of finding running routes that minimise air pollution in a city. Consider a runner planning a route which starts and ends at the same location. The runner would like the route to be sufficiently long but they do not want to run too far. However, running without considering the air quality in the local area is a suboptimal approach. Air pollution has an adverse effect on the cardio-respiratory system, which can be exacerbated by increased inhalation during exercise [10]. Moreover, air pollution in urban environments is highly localised because factors such as transportation, industry and construction largely contribute to the poor air quality [20]. In order to minimise the exposure to air pollution, the runner could use a mobile or web application to request Preprint. Under review. Table 1: Summary of CLT and TSP-WPs. Cost on edges c : E(G) → N; weight on edges w : E(G) → N; profit on vertices p : V (G) → N; resource on vertices r : V (G) → N; threshold Z ∈ N. Problem CLT OP PC-TSP Q-TSP c yes yes yes yes w yes no no no p no yes yes yes Objective r no min{c(T )} no max{p(T )} yes min{c(T ) − p(T )} no min{c(T )} Constraints W1 ≤ w(T ) ≤ W2 c(T ) ≤ Z r(T ) ≥ Z p(T ) ≥ Z and view an appropriate route. An algorithm which computes such a running route efficiently is therefore highly desirable. With the above motivation in mind, we study the Constrained Least-cost Tour (CLT) problem. The input is an undirected graph representing the road network with edge weights (distance) and edge costs (air pollution). We are given a lower weight threshold W1 and an upper weight threshold W2. We are also given a specially annotated vertex called the origin representing the start and end location of the run. The objective is to minimise the total cost of a tour starting and ending at the origin such that the total weight of the tour is weight-feasible. A weight-feasible tour means that the total weight of the tour is at least W1 and at most W2. In the context of a running route, weight-feasible means that the route is sufficiently long (at least W1) but is not too far for the runner (at most W2). The CLT problem is most closely related to the family of Travelling Salesman Problems with Profits (TSP-WP). Table 1 summarises the similarities and differences between CLT and some TSP-WP family members. This family of TSPs does not require the tour to visit every vertex in the graph and may be rooted (tour must start and end at a given vertex) or unrooted. In a review by Feillet et al. [7], the TSP-WP family is split into three classes: Quota TSP (Q-TSP), Selective TSP (S-TSP) and Profitable Tour Problems (PTP). The Orienteering Problem (OP) [11; 13] is a well-known S-TSP and the Prize-collecting TSP (PC-TSP) [3] is an important PTP. However, the more similar TSP-WP class to the CLT probem is Q-TSP [2]. In Q-TSP, we are given an undirected graph with a profit function on the vertices, a cost function on the edges and a quota Z ∈ N. The goal of Q-TSP is to minimise the total cost of a tour such that the total collected profit is at least Z. There are three key differences between the CLT Problem and the Q-TSP. First, the profit function in Q-TSP is on the vertices of the graph whereas the weight function in the CLT Problem is on the edges of the graph. Second, there is no upper profit threshold in Q-TSP, where as the CLT Problem defines an upper weight threshold W2. Third, the limited existing literature [2] for Q-TSP assumes the triangle inequality holds on the cost function and obtains an approximation by doubling a k-Minimum Spanning Tree [9]. However, the cost function (air pollution exposure) in our real-world application does not follow this inequality. TSP-WPs such as Q-TSP may ask for a weak tour (vertex repetition is not constrained) or a strong tour (vertices are repeated at most once, thus the tour is a simple cycle). We investigate both the weak and strong variants of the CLT problem. In the remainder of this paper, we refer to the weak variant as the CLT problem, and the strong variant as the Constrained Least-cost Cycle (CLC) Problem. Our contributions are as follows. In Section 3, we prove that the CLT problem is NP-hard, even in the case when the input graph is a path. A simple reduction from the Hamiltonian Cycle problem shows that if the triangle inequality does not hold on the cost function, then the CLC problem does not have an α-approximation algorithm for any α ≥ 1 (assuming P (cid:54)= N P ). Thus, we will focus on heuristic approaches to the problem which find sufficiently good solutions in polynomial-time (Section 5). First, we introduce the Déjà Vu heuristic (DjV) to find weak tours for the CLT problem. Next, we propose Suurballe's heuristic (SH), which calls on Suurballe's algorithm [19] to find solutions to the CLC problem. Finally, we develop the Adaptive heuristic (AH) that extends SH by exploring a greater proportion of the solution space. We analyse the performance of our heuristics on two datasets by comparing them against the continuous and connectivity relaxations of the CLT and CLC problems respectively. 2 2 Problem definition Definition 1. A tour T = (v1, . . . , vn) is a sequence of vertices starting and ending at the same vertex, where every two consecutive vertices in the sequence are adjacent to each other in the graph. in tour T . We denote the total cost and weight of a tour T by c(T ) =(cid:80) w(T ) =(cid:80) In the CLT problem, we are given an undirected graph G where V (G) denotes the set of vertices and E(G) denotes the set of edges. Each edge has a weight function defined by w : E(G) → N and a cost function defined by c : E(G) → N. We are also given a vertex s(cid:63) ∈ V (G) and weight thresholds W1, W2 ∈ N where W1 ≤ W2. Let φ(T , e) denote the number of times edge e ∈ E(G) is repeated e∈T φ(T , e) · c(e) and e∈T φ(T , e) · w(e). We say a tour T is weight-feasible if and only if W1 ≤ w(T ) ≤ W2. The goal of the CLT problem is to minimise the total cost of a tour starting and ending at s(cid:63) such that the tour is weight-feasible. That is, the goal is to minimise c(T ) subject to W1 ≤ w(T ) ≤ W2 and s(cid:63) = v1 = vn. In the CLT DECISION problem, we ask if there is a tour T = (v1, . . . , vn) such that W1 ≤ w(T ) ≤ W2 and c(T ) ≤ C where C ∈ N. Finally, we define the Constrained Least-cost Cycle (CLC) problem, which has the same objective function and constraints as CLT, but adds the requirement that the tour must be a simple cycle that visits vertices at most once. 3 NP-hardness We prove that CLT DECISION is NP-hard by reducing from the unbounded subset sum problem, which is known to be NP-hard [14; 15]. For brevity, we continue to refer to this variant as SUBSET SUM. We construct an instance of CLT DECISION on a path, starting from an instance of SUBSET SUM. We show that an instance of SUBSET SUM is a YES-instance if and only if our constructed instance of CLT DECISION is a YES-instance. Definition 2. In the SUBSET SUM problem, we are given a set of n items X = {z1, . . . , zn}, a target value Z ∈ N and weight function f : X → N, and want to decide whether there is a vector (y1, . . . , yn) ∈ (N≥0)n such that Z =(cid:80) i∈[n] yi · f (zi). set w(en+1) to be (4Z + 4(cid:80) to be 4Z + 4(cid:80) Theorem 1. The Constrained Least-cost Tour problem is NP-hard, even if the input graph is a path. Proof. Let I = (X = {z1, . . . , zn}, Z, f ) be an instance of SUBSET SUM. We construct an instance of CLT DECISION as follows. Let G denote the graph on vertex set v1, . . . , vn+2 and edge set {e1, . . . , en+1} where ei has endpoints vi and vi+1 for every i ∈ [n + 1]. In other words, G is a path on n + 2 vertices. For all i ∈ [n], we define the weight function w : E(G) → N as w(ei) = f (zi) and the cost function c : E(G) → N as c(ei) = f (zi). For the last edge en+1, we i∈[n] w(ei)). We set C i∈[n] w(ei) and W2 to be any positive integer such that W1 ≤ W2. Finally, we assign s(cid:63) = v1. This completes the construction of the CLT DECISION instance. Clearly, the reduction is polynomial-time. We now argue that I is a YES-instance of SUBSET SUM if and only if the constructed instance is a YES-instance of CLT DECISION. Suppose that I is a YES-instance of SUBSET SUM and let (y1, . . . , yn) be the solution. Consider the "natural" tour T in G starting at v1, traversing every ei (i ∈ [n]) exactly 2yi + 2 times and the edge en+1 exactly twice. Then, the values of w(T ) and c(T ) are precisely the following: i∈[n] w(ei), W1 to be 2Z + 2w(en+1) + 2(cid:80) 2 · (2Z + 2(cid:80) i∈[n] w(ei))2 and c(en+1) to be 1 (cid:122) (cid:88) (cid:122) (cid:88) i∈[n] Z (cid:125)(cid:124) (cid:125)(cid:124) Z i∈[n] (cid:123) (cid:123) (cid:88) (cid:88) i∈[n] i∈[n] w(ei) + 2w(en+1) = W1. w(ei) + 2Z = C (cid:88) (cid:88) i∈[n] i∈[n] w(T ) = c(T ) = w(ei)(2yi + 2) + 2w(en+1) = 2 yif (zi) +2 c(ei)(2yi + 2) + 2c(en+1) = 2 yi · f (zi) +4 Hence, we conclude that if I is a YES-instance, then the constructed instance of CLT DECISION is a YES-instance. Conversely, suppose that the constructed instance of CLT DECISION is a YES instance. This implies a tour T in G starting at v1 such that W1 ≤ w(T ) ≤ W2 and c(T ) ≤ C. Claim 1. T traverses every edge of G at least twice and the edge en+1 exactly twice. 3 Proof. Observe that in order to prove the claim, it is sufficient to prove that T traverses en+1 exactly twice. T must traverse en+1 at least twice, since en+1 cannot be traversed once, and not traversing en+1 would contradict our assumption that c(T ) ≤ C. T must traverse en+1 at most twice, since otherwise T traverses en+1 at least four times, and we obtain c(T ) > 4 · c(en+1) and c(T ) ≤ C which is a contradiction. We now describe the solution vector (y1, . . . , yn) for the SUBSET SUM instance. Recall we have already proved that for all e ∈ E(G), φ(T , e) ≥ 2, φ(T , e) is even, and φ(T , en+1) = 2. For every i ∈ [n], define yi = 1 2 φ(T , ei)− 2. Clearly, yi ∈ N∪{0} for all i ∈ [n] as required in the description i∈[n] yi · w(zi) = Z. i∈[n] yi · w(zi) ≥ Z and use c(T ) ≤ C to of SUBSET SUM and since T traverses en+1 exactly twice, we conclude that(cid:80) Here, we use the fact that w(T ) ≥ W1 to imply that(cid:80) infer that(cid:80) i∈[n] yi · w(zi) ≤ Z. This completes the proof in the converse direction. Theorem 1 proves CLT is N P -hard when the input graph is a path, so clearly CLT is N P -hard on a general graph. The CLC problem can also be shown to be N P -hard by reducing from the Hamiltonian Cycle problem. We further note that if the cost function does not satisfy the triangle inequality, then CLC does not have an α-approximation algorithm for any α ≥ 1 (assuming P (cid:54)= N P ). 1 4 Relaxations Relaxing NP-hard problems often provides useful insights about the optimal solution to the original problem and provides a lower bound we can compare our heuristics against. In this work, we consider two relaxations. Firstly, we show that on continuous graphs, the CLT problem has a polynomial-time algorithm that finds the optimal solution. In a continuous graph each edge is viewed as infinitely many vertices of degree two with infinitesimally small edges (formally the continuous graph is the geometric realisation of the graph topology). This is equivalent to saying that the multiplicity of an edge can be any positive real value (φ(T , e) ∈ R+). Secondly, we give an integer programming formulation of CLC and relax the constraint that the solution must be connected. c and let e = (u, v) be an edge in the induced graph H∗ 4.1 Continuous relaxation Let Gc denote a continuous graph. We define the induced graph Hc over a tour Tc of Gc as follows. A vertex v is in Hc if v ∈ Tc. An edge e is in Hc if the multiplicity of the edge in Tc is greater than zero. If Hc is a path v1, . . . , vn where v1 is the origin and ei = (vi, vi+1) for each i ∈ [n − 1], then we call the edge en−1 the head of the tour, and the remaining edges the tail of the tour. We argue that in this relaxation, we may assume that the optimal tour induces a path in Gc. Lemma 1. On a continuous graph, the induced graph of the optimal tour is a path. Proof. Take an optimal tour T ∗ the least cost per unit weight among the edges in H∗ first vertex of e which is visited by T ∗ path in Gc from s(cid:63) to u. On the one hand, w(P ) may already be greater than w(T ∗ we can simply find another tour contained within P , of same weight as w(T ∗ cost as c(P ), which in turn must be at most c(T ∗ the cost of any subtour of T ∗ c which starts at s(cid:63) and visits u must still have cost at least that of P . Now, consider the tour obtained by starting at s(cid:63), traversing P and arriving at u, followed by taking e w(e) (w(T ∗ c ) − 2w(P )), followed by taking P all the way back to s(cid:63). Call this tour with multiplicity 1 D∗ c . By definition, w(D∗ Thus, we can compute an optimal solution to the continuous relaxation in polynomial-time by running Dijkstra's algorithm [5], computing the multiplicity of the head for every edge e ∈ Gc, and returning the least-cost solution. We also have a lower bound on the cost of an optimal discrete solution: Corollary 1. The cost of the optimal constrained least-cost tour T ∗ equal to the cost of the optimal constrained least-cost tour T on G. c which has c . Without loss of generality, suppose that u is the c in the traversal starting from s(cid:63). Let P denote a minimum cost c ), in which case c ) and at most the same c ). However, c ). But, w(P ) may be less than w(T ∗ c on graph Gc is less than or c ) = w(T ∗ C ). Moreover, it is straightforward to see that c(D∗ c ) ≤ c(T ∗ c ). 1See appendix for complete proofs. 4 Figure 1: Examples of tours for each heuristic. We are given an undirected graph G with unit weights and costs labelled on edges. We ask for a tour which minimises the total cost starting at s such that 5 ≤ w(T ) ≤ 7. Green vertices and solid edges are in the tour. White vertices and dotted edges are not in the tour. [Left] DjV where φ(T , ec,i) = 4 and φ(T , es,c) = 2 such that c(T ) = 8 and w(T ) = 6. [Middle] SH finds a simple cycle with c(T ) = 15 and w(T ) = 6. [Right] AH computes a simple cycle with c(T ) = 13 and w(T ) = 5. 4.2 Connectivity relaxation ij xij · c(eij) subject to W1 ≤(cid:80) graph. The objective function is to minimise(cid:80) W2 for all eij ∈ E(G). Let x(S) =(cid:80) We first turn our attention to an integer programming (IP) formulation for the CLC problem. Let eij ∈ E(G) be an edge between vertex i and j. We place the variable xij ∈ {0, 1} on the edges of the ij xij · w(eij) ≤ ij xij for a subset S ∈ E(G) and Ai ⊂ E(G) be the set of edges eij adjacent to vertex i. We add the constraints x(As) = 2 to enforce T starts and ends at the origin s(cid:63), and ∀i ∈ V (G) : 1 2 x(Ai) ∈ {0, 1} to ensure T is closed. Finally, we add the sub-tour elimination constraint [4; 16] to enforce connectivity. Optimally solving an IP that enforces connectivity is not be practical in our application of a runner requesting a route, since the user might have to wait for too long as the size of the graph and length of the requested run increase. Thus we relax the connectivity constraint and use the resulting IP as a lower bound on the optimal solution of CLC to compare our heuristic against. 5 Heuristics Our approach is to develop heuristics that run in polynomial-time and return close to optimal solutions in real-world environments. Fig. 1 shows examples for each algorithm. First, we present the Déjà Vu (DjV) heuristic for the CLT problem that exploits the continuous relaxation.2 Next, we propose Suurballe's heuristic (SH) that finds low-cost cycles for the CLC problem. Finally, we introduce the Adaptive heuristic (AH) which extends SH to explore a greater proportion of the solution space. 5.1 Déjà Vu Heuristic Our Déjà Vu (DjV) heuristic exploits the intuition that the optimal solution to CLT on a continuous graph is a good indicator of a low-cost solution to CLT on a discrete graph. DjV walks along a path to an edge with low cost, repeats this edge with some positive even multiplicity, then walks back along the same path to the origin. DjV computes the least-cost tree rooted at s(cid:63). We store the parent πv and cost lv of the least-cost path Π(s(cid:63), v) from s(cid:63) to v. For each edge e ∈ E(G), we extract Π(s(cid:63), x) where x is the endpoint of e with least lx. If 2w(Π(s(cid:63), x)) + 2w(e) ≤ W2, then the multiplicity of edge e in tour T is (cid:18) W1 − 2w(Π(s(cid:63), x)) (cid:19) φ(T , e) = f w(e) 2The repetitive nature of the low-cost edge is where the name "Déjà Vu" comes from. 5 where f rounds up to the closest positive even integer. The time-complexity of DjV is O(n log n). 5.2 Suurballe's heuristic We now propose Suurballe's heuristic (SH) which uses the fact that a pair of vertex-disjoint simple paths between two vertices u and v form a simple cycle C. Suurballe's algorithm [18; 19] solves the SHORTEST PAIRS of disjoint paths problem: given a directed, weighted graph G(cid:48), find a pair of edge-disjoint paths with minimum total cost from a source vertex s(cid:63) to a sink vertex v, for every possible sink v ∈ G(cid:48). Suurballe and Tarjan [19] give an algorithm for SHORTEST PAIRS with time complexity O(m log n). Their algorithm requires G(cid:48) to be asymmetric, that is if (x, y) is an arc in G(cid:48), then (y, x) is not in G(cid:48). To construct a directed, asymmetric graph G(cid:48) from our undirected graph G, we use the vertex splitting transformation as described by Suurballe and Tarjan. The splitting transformation also allows us to compute vertex-disjoint paths on G(cid:48) using Suurballe and Tarjan's edge-disjoint algorithm. Given G(cid:48), SH runs Suurballe's algorithm and computes the cost of the shortest pairs of vertex-disjoint paths Λ(s(cid:63), v) from s(cid:63) to every vertex v ∈ V (G(cid:48)). From Λ(s(cid:63), v), we construct a simple cycle C containing s(cid:63) and v. We return the least-cost simple cycle C that is weight-feasible (W1 ≤ w(C) ≤ W2). The time complexity of the heuristic is O(m log n) under the assumption that the number of vertices in C is much smaller than the number of edges in the graph. The weakness of SH is it only considers a small subset of the solution space to CLC. This subset covers all cycles which can be constructed by finding the least-cost pair of vertex-disjoint paths from s(cid:63) to a vertex v in the graph. 5.3 Adaptive heuristic The Adaptive heuristic (AH) extends SH by exploring a larger solution space. This space encompasses all cycles containing the origin that are formed by computing the least-cost pair of vertex-disjoint paths between every pair of vertices in the graph. Thus the solution space of SH is a subset of the solution space of AH. Psuedocode for AH is given by Algorithm 1. The time-complexity of AH is O(n · m log n) because we must compute Suurballe and Tarjan's algorithm [19] at most n = V (G) times. The increase in time-complexity is the price to pay for exploring more solutions. Algorithm 1: Adaptive heuristic for the Constrained Least-cost Cycle Problem :An undirected graph G with edge weights w : E(G) → N and edge costs c : E(G) → N; input the origin s(cid:63) ∈ V (G); lower and upper weight thresholds W1, W2 ∈ N. 1 Construct a directed, asymmetric graph G(cid:48) from the undirected graph G. 2 For every pair of vertices u, v ∈ V (G(cid:48)), compute the least-cost pair of vertex-disjoint paths ∆(u, v) between u and v. 3 From ∆(u, v), construct a simple cycle C. If s(cid:63) ∈ C, then C is a candidate solution. output :The least-cost weight-feasible simple cycle C(cid:63) from all candidate solutions C. 6 Experiments We now present the results from running our heuristics on two datasets and comparing them against our relaxations.3 DjV is compared against CR. SH and AH are compared against XR. Every algorithm is tested at 10 different weight thresholds and 10 random origins. The gap between W1 and W2 is kept constant at 250 meters for the pollution dataset and 5 units for the Crucible dataset. Experiments for the heuristics and continuous relaxation are computed on a Microsoft Azure virtual machine with four CPUs and 14GB of memory running Linux. The connectivity relaxation is computed using the IBM Decision Optimisation Cloud service with 10 cores and 60GB of memory. We set the maximum time limit for IP to solve the connectivity relaxation to one hour. We reduce the size of our input graph with two pre-processing steps. The first removes vertices which cannot be reached from s(cid:63) within W2/2. The second removes all leaves from the graph when solving the CLC problem, and so is only applied to SH, AH and XR. 3AH = adaptive heuristic, CR = continuous relaxation, XR = connectivity relaxation, SH = Suur- balle's heuristic, DjV = Déjà Vu heuristic. Code available at https://patrickohara.github.io/ CLT-problem/. 6 Figure 2: [Left] Mean total distance of running route vs mean total N O2. [Right] Time taken for each algorithm to execute. See 3 for labels. Figure 3: Results for the Crucible dataset. Labelling3 and colours same as Fig. 2. [Left] Mean total weight vs mean total cost. [Right] Time taken. Figs. 2 and 3 show the effect of increasing the weight thresholds. Figs 4 and 5 display examples of routes computed by our heuristics for the Crucible and air quality dataset respectively. Table 2 summarises the overshoot and margin of error. The overshoot of a tour T is defined as w(T ) − W1. The margin of error of a heuristic H against its relaxation R is defined as 100×(c(H)−c(R))/c(R)4. 6.1 Datasets We conduct experiments on two different datasets to show our methods work in different environments. The air quality dataset contains around 12000 vertices and 16000 edges. The Crucible dataset contains 260000 vertices and 150000 edges. These datasets are pre-procecessed as described above, thus reducing the size of the input graph before we execute our algorithms. Air quality in London: The goal is to minimise air pollution exposure of a runner in London such that the total distance of the route is within a given range. We assume people run on the London road network. Vertices in G represent road intersections and edges represent the roads. The weight of an edge is the distance of a road and the cost of an edge is the total pollution a runner is exposed to by running along the road. The air quality model of London is a non-stationary mixture of Gaussian Processes [21; 1] that predicts air quality (nitrogen dioxide) from data such as sensors, road traffic and weather. We note that our methods are not dependent on the type of model used. The output of the model is a two-dimensional grid which overlays the road network. The cost of an edge e is the mean pollution of the grid squares intersecting e in space multiplied by the weight of e. We assume the pollution (cost) is uniformly distributed along an edge. 4Further details of our pre-processing, methodology and datasets are available in Section D of the appendix. 7 Table 2: Mean overshoot (extra weight beyond W1), mean margin of error (how far away is the heuristic to the applicable lower bound). Lower bounds (relaxations) are marked by ∗. Algorithm Air Quality The Crucible Overshoot % error Overshoot % error Continuous relaxation (CR)∗ Déjà Vu heuristic (DjV) Connectivity relaxation (XR)∗ Adaptive heuristic (AH) Suurballe's heuristic (SH) 0.00 34.20 17.16 41.77 120.98 0.00 1.18 0.00 1.96 4.57 0.00 0.16 0.00 0.00 1.98 0.00 0.81 0.00 2.22 4.68 Figure 4: The Déjà Vu heuristic on the Crucible dataset for W1 = 30, W2 = 35. The colour scale represents the diversity of the environment: yellow is no diversity, dark blue is high diversity. [Left] The route taken. The origin is the large vertex at x = 304, y = 415. Solid edges in the tour are traversed exactly twice. The red edge is traversed 18 times. Dotted edges are not in the tour. The colour of a vertex represents 1 − E(v). [Right] The cost of the route whilst traversing the tour. The colour of the line at a given weight is the diversity of the edge. The Crucible: Our second application finds tours which seek a diverse variety of environment types in "The Crucible" map from the game Warcraft III [17]. The map consists of grid squares (512 by 512) belonging to one of the following five environment types (classes): normal ground (1), shallow water (2), trees (3), water (4) and out of bounds (5). An agent moving in the environment can only traverse normal ground, thus classes 2-5 trees are all defined as impassable for an agent. Let a vertex in G represents a grid square in the map. If a grid square is surrounded by a diverse variety of environment types, then the representative vertex will have high entropy. We define the entropy of a c=1 −Pc log Pc where C is the number of classes and Pc is the probability of class c appearing in a 7 by 7 grid centered on vertex v. A unit weight edge eu,v exists between vertex 2 (E(u) +E(v)). u and v if both u and v are passable. The cost of an edge is defined by c(eu,v) = 1− 1 vertex v by E(v) =(cid:80)C 6.2 Discussion CLT: DjV yields consistently low-cost tours which have error ≈ 1% on both datasets (Table 2) when compared to the CR lower bound. Fig. 4 demonstrates the algorithm traversing a path to an edge with low-cost, repeating this edge 18 times (the long, flat line on right of Fig. 4), before returning to the origin. DjV traverses every edge with even multiplicity so the total weight of every tour will be even (assuming w : E(G) → N). Thus DjV does not consider low-cost solutions with odd weight, so if W1 = W2 and W1, W2 are odd integers, then DjV will not return a solution. However, the O(n log n) time-complexity means DjV is fast (right of Figs. 2 and 3) and the algorithm works well for a general W1, W2 in practise. 8 Figure 5: Routes computed by AH [Top] and SH [Bottom] starting at the same origin (red dot) for W1 = 3.5km, W2 = 3.75km. [Left] Predicted nitrogen dioxide (N O2) over central London measured in µgm−3. The colour scale is given on the right. [Right] Air pollution exposure by running anti-clockwise around the route. CLC: AH significantly outperforms SH on both datasets because it explores a larger proportion of the solution space. SH also significantly overshoots the lower weight threshold compared to AH (Table 2), resulting in SH traversing more weight and thus (in general) more cost. However, the trade-off for lower cost solutions is the O(n · m log n) time-complexity of AH compared to the O(m log n) running time of SH. The right of Figs. 2 and 3 clearly show this difference in time, and also highlights how long it takes for the integer program (IP) to optimally solve XR. Indeed, the drop off in cost in Fig. 2 (left) for XR correlates with the point where the IP is no longer solving instances optimally because the running time is cut-off at 1 hour (Fig. 2 right). In Fig. 3 (right), the IP quickly hits the cut-off time limit because the size of the Crucible graph is bigger, so the IP only returns a bound and not the optimal solution for W1 > 20. Thus for W1 > 2500m in the pollution dataset and W1 > 20 for the Crucible dataset, the XR lower bound is actually larger than the given value, and so we are slightly over-estimating the error for AH and SH. 7 Final remarks We have introduced the Constrained Least-cost Tour problem: an NP-hard routing problem with the motivating application of finding running routes that minimise air pollution exposure in a city (see Fig. 5). We have derived relaxations and proposed heuristics for weak tours (CLT) and strong tours (CLC). Experiments on both datasets show our algorithms perform competitively when compared to our derived lower bounds. Finally, the motivating application of "running from air pollution" has a rich problem structure that we plan to further exploit; multiple pollutants, varying human sensitivities to different pollutants and uncertainty of the forecasting models. 9 Acknowledgements Patrick O'Hara and Theodoros Damoulas are funded by the Lloyds Register Foundation programme on Data Centric Engineering through the London Air Quality project. This work was furthermore supported by The Alan Turing Institute for Data Science and AI under EPSRC grant EP/N510129/1 in collaboration with the Greater London Authority. Patrick O'Hara was previously supported by the Warwick Impact Fund. We would like to thank Oliver Hamelijnck (The Alan Turing Institute) for providing the air quality predictions of London and further thank the anonamous reviewers of IJCAI for their useful feedback. References [1] V. Aglietti, T. Damoulas, and E. Bonilla. Efficient inference in multi-task cox process models. In Proceedings of the 22nd International Conference on Artificial Intelligence and Statistics, 2019. [2] B. Awerbuch, Y. Azar, A. Blum, and S. Vempala. Improved approximation guarantees for minimum-weight k-trees and prize-collecting salesmen. In Proceedings of the Twenty-seventh Annual ACM Symposium on Theory of Computing, pages 277 -- 283, 1995. [3] E. Balas. The prize collecting traveling salesman problem. Networks, 19(6):621 -- 636, 1989. [4] P. Bauer, J. Linderoth, and M. Savelsbergh. A branch and cut approach to the cardinality constrained circuit problem. Mathematical Programming, 91(2):307 -- 348, 2002. [5] E. W. Dijkstra. A note on two problems in connexion with graphs. Numer. Math., 1(1):269 -- 271, 1959. [6] B. Dilkina and C. P. Gomes. Solving connected subgraph problems in wildlife conserva- tion. In Integration of AI and OR Techniques in Constraint Programming for Combinatorial Optimization Problems, pages 102 -- 116, 2010. [7] D. Feillet, P. Dejax, and M. Gendreau. Traveling salesman problems with profits. Transportation Science, 39(2):188 -- 205, 2005. [8] D. Freund, S. G. Henderson, and D. B. Shmoys. Bike sharing. In Sharing Economy: Making Supply Meet Demand, volume 6, pages 435 -- 459. Springer International Publishing, 2019. [9] N. Garg. Saving an epsilon: A 2-approximation for the k-mst problem in graphs. In Proceedings of the Thirty-seventh Annual ACM Symposium on Theory of Computing, pages 396 -- 402, New York, NY, USA, 2005. [10] L. V. Giles and M. S. Koehle. The health effects of exercising in air pollution. Sports Medicine, 44(2):223 -- 249, 2014. [11] B. L. Golden, L. Levy, and R. Vohra. The orienteering problem. Naval Research Logistics (NRL), 34(3):307 -- 318, 1987. [12] C. P. Gomes. Computational sustainability: Computational methods for a sustainable environ- ment, economy, and society. The Bridge, 39(4):5 -- 13, 2009. [13] A. Gunawan, H. C. Lau, and P. Vansteenwegen. Orienteering problem: A survey of recent variants, solution approaches and applications. European Journal of Operational Research, 255 (2):315 -- 332, 2016. [14] R. M. Karp. Reducibility among combinatorial problems. In Proceedings of a symposium on the Complexity of Computer Computations, pages 85 -- 103, 1972. [15] H. Kellerer, U. Pferschy, and D. Pisinger. Introduction to np-completeness of knapsack problems. In Knapsack Problems, pages 483 -- 493. Springer Berlin Heidelberg, 2004. [16] G. Laporte. Generalized subtour elimination constraints and connectivity constraints. The Journal of the Operational Research Society, 37(5):509 -- 514, 1986. 10 [17] N. R. Sturtevant. Benchmarks for grid-based pathfinding. IEEE Transactions on Computational Intelligence and AI in Games, 4(2):144 -- 148, 2012. [18] J. W. Suurballe. Disjoint paths in a network. Networks, 4(2):125 -- 145, 1974. [19] J. W. Suurballe and R. Tarjan. A quick method for finding shortest pairs of disjoint paths. Networks, 14:325 -- 336, 1984. [20] S. Vardoulakis and P. Kassomenos. Sources and factors affecting pm10 levels in two european cities: Implications for local air quality management. Atmospheric Environment, 42(17):3949 -- 3963, 2008. [21] A. G. Wilson, D. A. Knowles, and Z. Ghahramani. Gaussian process regression networks. In Proceedings of the 29th International Conference on Machine Learning, pages 1139 -- 1146, 2012. [22] World Health Organization. Exposure to ambient air pollution from particulate matter, 2016. 11 A N P -hardness For completeness we give full proofs of Theorem 1, the N P -hardness of CLC and the approximation of CLC. A.1 The CLT Problem We expand upon the proof of Theorem 1 in the paper. In particular, we expand on Claim 1. Theorem. The Constrained Least-cost Tour Problem is N P -hard, even when the input graph is a path. Proof. Recall from the paper that we construct an instance of CLT DECISION from an instance I of SUBSET SUM. We argue that I is a YES-instance of SUBSET SUM if and only if the constructed instance is a YES-instance of CLT DECISION. Suppose that I is a YES-instance of SUBSET SUM and let (y1, . . . , yn) be the solution. Consider the "natural" tour T in G starting at v1. For every i ∈ [n], T traverses ei exactly 2yi + 2 times. The edge en+1 is traversed exactly twice. Thus, the value of w(T ) is precisely the following: w(T ) = w(ei)(2yi + 2) + 2w(en+1) i∈[n] (cid:88) (cid:88) (cid:122) (cid:88) i∈[n] i∈[n] = 2 = 2 yi · w(ei) + 2 (cid:125)(cid:124) Z (cid:123) yi · f (zi) +2 (cid:88) (cid:88) i∈[n] i∈[n] w(ei) + 2w(en+1) w(ei) + 2w(en+1) = W1 Similarly the value of c(T ) is: c(T ) = c(ei)(2yi + 2) + 2c(en+1) i∈[n] (cid:88) (cid:88) (cid:122) (cid:88) i∈[n] i∈[n] = 2 = 2 yi · w(ei) + 2 (cid:125)(cid:124) Z (cid:123) yi · f (zi) +2 (cid:88) (cid:88) i∈[n] i∈[n] w(ei) + 2Z + 2 w(ei) (cid:123) (cid:122) 2c(en+1) (cid:125)(cid:124) (cid:88) (cid:88) i∈[n] i∈[n] w(ei) + 2Z + 2 w(ei) = C Hence, we conclude that if I is a YES-instance, then the constructed instance of CLT DECISION is a YES-instance. Conversely, suppose that the constructed instance of CLT DECISION is a YES instance. This implies we have a tour T in G starting at v1 such that W1 ≤ w(T ) ≤ W2 and c(T ) ≤ C. Claim. T traverses every edge of G at least twice and the edge en+1 exactly twice. Proof. Observe that in order to prove the claim, it is sufficient to prove that T traverses en+1 exactly twice. This is because G is a path and any tour containing v1 and vn+2 must traverse every edge of G at least once and any tour in G containing v1 must traverse every edge of G an even number of times. Consequently, we now focus on proving that T traverses en+1 exactly twice. We first show that T traverses en+1 at least twice. Suppose not. Then, T does not traverse en+1 at all. Note that we have defined W1 such that W1 ≥ 2w(en+1) and since T is a solution for the 12 and hence greater than 4Z + 4(cid:80) instance of CLT DECISION, we know that w(T ) ≥ W1. Then, by the pigeonhole principle, there must be an edge ei ∈ {e1, . . . , en} such that the multiplicity of ei in T is greater than W1/w(ei) i∈[n] w(ei), which is precisely the value of C. This contradicts our assumption that c(T ) ≤ C. Hence we conclude that T traverses en+1 at least twice. It remains to argue that T traverses en+1 at most twice. Suppose that this is not the case and that the edge en+1 occurs at least 3 times in T . Then, it must be the case that en+1 appears at least 4 times in T . In this case, c(T ) > 4 · c(en+1) and c(T ) ≤ C, which is a contradiction since we chose c(en+1) in such a way that C = 4c(en+1). Hence we conclude that T traverses en+1 at most twice. We now describe the solution vector (y1, . . . , yn) for the SUBSET SUM instance. Recall we have already proved that for all e ∈ E(G): φ(T , e) ≥ 2 and φ(T , e) is even. For the last edge: φ(T , en+1) = 2. For every i ∈ [n], define yi = 1 2 φ(T , ei) − 2. Clearly, yi ∈ N ∪ {0} for all i ∈ [n] as required in the description of SUBSET SUM. i∈[n] yi · f (zi) = Z. Since T traverses en+1 exactly twice, we first use It remains to argue that(cid:80) the fact that w(T ) ≥ W1 to conclude that(cid:80) i∈[n] yi · f (zi) ≥ Z: 2w(en+1) + (cid:88) (cid:88) i∈[n] i∈[n] w(T ) ≥ W1 φ(T , ei) · w(ei) ≥ 2Z + 2w(en+1) + 2 2(yi + 2)w(ei) ≥ 2Z + 2 w(ei) (cid:88) i∈[n] (cid:88) i∈[n] w(ei) and use c(T ) ≤ C to infer that(cid:80) (cid:88) yi · f (zi) ≥ Z i∈[n] i∈[n] yi · w(zi) ≤ Z: c(T ) ≤ C φ(T , ei)c(ei) ≤ 4Z + 4 (cid:88) (cid:88) i∈[n] i∈[n] 2c(en+1) + (cid:88) i∈[n] 2 (cid:88) i∈[n] 2Z + 2 w(ei) + 2(yi + 2)w(ei) ≤ 4Z + 4 yi · w(ei) + 2 w(ei) ≤ 2Z + 2 (cid:88) (cid:88) i∈[n] i∈[n] yi · f (ei) ≤ Z i∈[n] (cid:88) (cid:88) (cid:88) i∈[n] i∈[n] w(ei) w(ei) w(ei) This completes the proof in the converse direction, and thus the proof of the theorem. A.2 The CLC Problem Definition. Given an undirected graph G with vertices V (G) and edges E(G), the Hamiltonian Cycle (HC) problem is to find a cycle C that visits every vertex in the graph exactly once. Given a graph G with a weight function w : E(G) → N and cost function c : E(G) → N on the edges; a start vertex s(cid:63) ∈ V (G); two weight thresholds W1, W2 ∈ N and a cost threshold C ∈ N, the CLC-DECISION problem asks is there a strong tour T starting and ending at s(cid:63) such that W1 ≤ w(T ) ≤ W2 and c(T ) = C. Theorem. The Constrained Least-cost Cycle (CLC) Problem is N P -hard. Proof. To prove CLC-DECISION is N P -hard, we find a polynomial-time reduction from HC. We note that HC is N P -complete. Let I be an instance of HC on a graph G with vertices V (G) = 13 {v1, . . . , vn} and edges E(G). We construct an instance of CLC-DECISION as follows. Let the cost and the weight of every edge be 1. Set W1 = W2 = C = n where n is the number of vertices in G. Let s(cid:63) = v1. The reduction is clearly polynomial. We prove that I is a YES-instance of HC if and only the constructed instance of CLC-DECISION is a YES-instance. Suppose I is a YES-instance. Then I is a simple cycle C that visits every vertex in the graph (including v1) exactly once. The cycle is a strong tour T that traverses exactly n edges and includes the start vertex v1. Thus the total weight of T on the constructed instance of CLC-DECISION is w(T ) = n = W1 = W2 and the total cost is c(T ) = n = C. Hence we conclude the constructed instance is a YES-instance. Now suppose the constructed instance of CLC-DECISION is a YES-instance. Then we have a strong tour T that starts at the origin v1, visits every vertex at most once, and has total weight n = W1 = W2 and total cost n = C. We need to show that T visits every vertex exactly once. Suppose otherwise. Then there must exist a vertex u that has not been visited by T , which implies T is a simple cycle on at most n − 1 vertices that has total weight and total cost of n. This is clearly not possible since edges have unit weight and unit cost. Thus we conclude that T visits every vertex exactly once and the strong tour is a Hamiltonian cycle. A.3 Approximation of CLC Definition. Let OPT be the cost of the optimal solution to a problem and α ∈ R be greater than or equal to 1. An algorithm is an α-approximation algorithm if and only if for every instance of the problem it returns a solution within a factor α of OPT. there does not exist an α- When referring to an α-approximation algorithm, we shall mean that the algorithm must run in polynomial-time. Lemma. For CLC without the triangle inequality assumption, approximation algorithm for any α ≥ 1, provided P (cid:54)= N P . Proof. Given an instance G of HC with vertices V (G) and edges E(G), construct an instance of CLC on a complete graph K as follows. For all e ∈ E(G), let c(e) = w(e) = 1 in K. For all pairs of vertices i, j ∈ V (G) for which eij /∈ E(G) and i (cid:54)= j, let c(eij) = α · n and w(eij) = 1. Let W1 = W2 = n where n is the number of vertices. Assume there exists an α-approximation algorithm (APX) for CLC. We show that such an algorithm can be used to solve HC in polynomial time. First suppose there exists a Hamiltonian cycle in G. Then the optimal solution OPT for CLC will have cost n and weight n, so c(APX) ≤ α · n. Now suppose there does not exists a Hamiltonian cycle in G. Then OPT must use one edge not in G with cost α · n. The cost of OPT will therefore be c(OP T ) ≥ n − 1 + α · n. Hence we conclude that G has a Hamiltonian cycle if and only if the cost of APX is at most α· n. B An Integer Programming Formulation of the CLC Problem Recall that xij is a 0-1 variable placed on the edges in graph G, Ai is the set of edges adjacent to vertex i, and x(S) is the sum of xij variables on edge set S ⊂ E(G). (1) (2) (3) (4) (5) (6) ∀i ∈ V (G) ∀eij ∈ E(G) (cid:88) W1 ≤ (cid:88) eij∈E(G) xij · c(eij) min s.t. xij · w(eij) ≤ W2 eij∈E(G) x(As(cid:63) ) = 2 x(Ai) ∈ {0, 1} 1 2 xij ∈ {0, 1} Subtour elimination constraints 14 There are several ways to define the subtour elimination constraint. We give one such formulation using cutsets: ∀S ∈ Φ(i, j),∀i, j ∈ V : x(S) ≥ x(Ai) + x(Aj) − 2 where Φ(i, j) is the set of minimal ij-edge cuts. That is, each cut in Φ(i, j) is a minimal set of edges that if removed would disconnect i and j in the graph. The connectivity relaxation uses the objective function (1) with contraints (2)-(5) from the IP formulation above, but relaxes constraint (6). C Suurballe's Algorithm In the CLT/CLC problem, we are given an undirected graph G with vertices V (G) and edges E(G). Edges have a weight function w : E(G) → N and a cost function c : E(G) → N. However, Suurballe's algorithm requires a directed input graph that is asymmetric, that is if (x, y) is an arc in the graph, then (y, x) is not in the graph. We construct a directed, asymmetric graph G(cid:48) from the undirected graph G as follows. For each vertex v ∈ V (G), split v into two vertices v1 and v2 and add them to V (G(cid:48)). Add a directed split arc from v1 to v2 in G(cid:48) with zero cost and zero weight. For every undirected edge eu,v adjacent to v in G, add a directed arc from v2 to u1 in G(cid:48) with the same weight and cost as eu,v in G. The construction requires O(m + n) time and space complexity. D Experiments In this section, we expand upon the pre-processsing algorithms, methodology and datasets uses for the experiments. To run our algorithms on the same datasets, please refer to our GitHub repository5. D.1 Pre-processing We use two pre-processing methods to reduce the size of the graph. The time taken for pre-processing is not included when timing the algorithms on the right of Figures 2 and 3. The first pre-processing algorithm removes vertices from the graph that cannot be reached from the origin within weight W2 2 , that is, if the weight of the shortest path from the origin to a vertex u is greater than W2 2 , then remove u from the graph (see Algorithm 2). The second removes vertices with degree one (leaves) and is given in Algorithm 3. It uses a recursive depth first search to remove leaves from the graph. Algorithm 2: Prune unreachable vertices from the graph. input :An undirected graph G with edge weights w : E(G) → N and edge costs c : E(G) → N; the origin s(cid:63) ∈ V (G); upper weight thresholds W2 ∈ N. 1 Construct a shortest path tree T rooted at s(cid:63) with respect to weight using Dijkstra's algorithm. 2 Store the parent πu and length lu of the shortest path w.r.t. weight for every vertex u. 3 For every vertex u ∈ V (G), if lu > W2 output :A pruned graph. 2 , then remove u from G. Algorithm 3: Remove leaves from the input graph. input :An undirected graph G; the origin s(cid:63) ∈ V (G). 1 Start depth first search from s(cid:63) 2 If the current vertex u has degree one, then remove u from G. 3 Recurse up the tree removing vertices with degree one. output :A graph with no leaves. 5https://patrickohara.github.io/CLT-problem/ 15 Figure 6: Snapshot from the air quality model of London. The prediction is for nitrogen dioxide (N O2). N O2 is measured in µgm−3. Yellow shows high air pollution, dark blue is low air pollution. D.2 Datasets We compare our heuristics on two different datasets to show that our methods can be applied in different contexts. The contrast between the air quality (AQ) dataset and the Crucible dataset is also interesting. Firstly, the structure of the graph in the Crucible is a grid, whereas the AQ graph is a road network. Running heuristics on different types of graphs can often highlight strengths of weaknesses, although in our experiments there were no such notable strengths or weaknesses. Secondly, the cost function on edges in the two datasets is spatially distributed in a very different way. In the Crucible, there are large areas of space where in all edges will have uniform cost. Compare this to AQ in which there are large areas of space with relatively low air pollution (cost) with localised peaks of highly polluted air. Despite these differences, our heuristics have a similar margin of error on both datasets when compared to their respective relaxations (Table 2). Air quality in London The road network of London was downloaded from the Ordnance Survey6. The air quality prediction shown in Fig. 6 are a snapshot from an AQ model of London. The model is currently under development at the Alan Turing Institute. We emphasise that our algorithms are not dependent upon the model of air quality. The road network was pruned using an SQL PostGIS query to return all roads that intersect with the prediction area of the AQ model. The Crucible Fig. 7 shows the Crucible dataset which can be downloaded from Moving AI7. The aim of the agent is to find a tour that visits a diverse range of environment types. The original dataset is shown in Fig. 7a and the diversity of environment types is shown in Fig. 7b. The agent will seek the darker areas of Fig. 7b. The darker areas show borders between different environment types, for example where the normal ground (class 1) meets trees (class 3). D.3 Additional details The heuristics and relaxations are coded using Python. Specifically, we use the networkx library to store the graph datastucture. The machines used to compute the results are given in the paper: the first was an Azure virtual machine (VM) for the heuristics and the continuous relaxation (CR); and the second was an IBM Cloud machine running the CPLEX library for the connectivity relaxation (XR). Using a more powerful machine for the XR means that the time taken to compute a result is 6https://www.ordnancesurvey.co.uk 7https://www.movingai.com/benchmarks/wc3maps512/index.html 16 (a) The original dataset showing different types of environment. Black represents impassible, blue shows water, green shows trees and white shows passible ground. (b) Areas with high diversity (dark blue) and low di- versity (yellow) of environment types. This quantity is calculated by 1 − E(v). Figure 7: Visual representation of how the diversity is computed for the Crucible dataset. Note the structure of dark areas in (b) which follows the borders between environment types in (a). not comparible to the time taken to compute a result for heuristics and CR. However, Figs. 2 and 3 [right] show that even with a more powerful machine, XR still takes substantially more time to find an solution that any of the heuristics or CR. Further, the important algorithms to compare in terms of time are the Adaptive heuristic and Suurballe's heuristic, since they are the two competing algorithms for the CLC problem. For each dataset, 10 vertices were chosen randomly from a uniform distribution. Each dataset was given 10 weight thresholds Each heuristic and each relaxation were tested for each configuration. For each solution to a relaxation, we record the total weight, total cost, number of vertices in the solution, the overshoot, number of vertices and edges in the pre-processed input graph and the time taken in seconds. In addition to the above quantities, we calculate the margin of error for each heuristic compared to the appropriate relaxation. 17
1107.2000
1
1107
2011-07-11T11:18:27
Tight Approximation Bounds for Vertex Cover on Dense k-Partite Hypergraphs
[ "cs.DS" ]
We establish almost tight upper and lower approximation bounds for the Vertex Cover problem on dense k-partite hypergraphs.
cs.DS
cs
Tight Approximation Bounds for Vertex Cover on Dense k-Partite Hypergraphs Marek Karpinski∗ Richard Schmied† Claus Viehmann‡ We establish almost tight upper and lower approximation bounds for the Vertex Cover problem on dense k-partite hypergraphs. Abstract 1 Introduction A hypergraph H = (V, E) consists of a vertex set V and a collection of hyperedges E where a hyperedge is a subset of V . H is called k-uniform if every edge in E contains exactly k vertices. A subset C of V is a vertex cover of H if every edge e ∈ E contains at least a vertex of C. The Vertex Cover problem in a k-uniform hypergraph H is the problem of com- puting a minimum cardinality vertex cover in H. It is well known that the problem is N P -hard even for k = 2 (cf. [13]). On the other hand, the simple greedy heuris- tic which chooses a maximal set of nonintersecting edges, and then outputs all vertices in those edges, gives a k-approximation algorithm for the Vertex Cover problem restricted to k-uniform hypergraphs. The best known approximation al- gorithm achieves a slightly better approximation ratio of (1 − o(1))k and is due to Halperin [11]. 1 On the intractability side, Trevisan [22] provided one of the first inapproxima- bility results for the k-uniform vertex cover problem and obtained a inapproxima- 19 assuming P 6= N P . In 2002, Holmerin [11] improved the factor bility factor of k to k1−ǫ. Dinur et al. [7, 8] gave consecutively two lower bounds, first (k − 3 − ǫ) and later on (k − 1 − ǫ). Moreover, assuming Khot's Unique Games Conjecture (UGC) [17], Khot and Regev [18] proved an inapproximability factor of k − ǫ for the Vertex Cover problem on k-uniform hypergraphs. Therefore, it implies that the currently achieved ratios are the best possible. ∗Dept. of Bonn. Email: [email protected] of Computer Science and the Hausdorff Center for Mathematics, University Supported in part by DFG grants and the Hausdorff Center grant EXC59-1. †Dept. of Computer Science, University of Bonn. Work supported by Hausdorff Doctoral Fel- lowship. Email: [email protected] ‡Dept. of Computer Science, University of Bonn. Work partially supported by Hausdorff Center for Mathematics, Bonn. Email: [email protected] 1 The Vertex Cover problem restricted to k-partite k-uniform hypergraphs, when the underlying partition is given, was studied by Lov´asz [20] who achieved a k 2 - approximation. This approximation upper bound is obtained by rounding the nat- ural LP relaxation of the problem. The above bound on the integrality gap was shown to be tight in [1]. As for the lower bounds, Guruswami and Saket [10] proved that it is NP-hard to approximate the Vertex Cover problem on k-partite k-uniform hypergraphs to within a factor of k 4 − ǫ for k ≥ 5. Assuming the Unique Games Conjecture, they also provided an inapproximability factor of k 2 − ǫ for k ≥ 3. More recently, Sachdeva and Saket [21] claimed a nearly optimal N P - hardness factor. To gain better insights on lower bounds, dense instances of many optimization problems has been intensively studied [2, 15, 16, 14]. The Vertex Cover problem has been investigated in the case of dense graphs, where the number of edges is within a constant factor of n2, by Karpinski and Zelikovsky [16], Eremeev [9], Clementi and Trevisan [6], later by Bar-Yehuda and Kehat [4] as well as Imamura and Iwama [12]. The Vertex Cover problem restricted to dense balanced k-partite k-uniform hy- pergraphs was introduced and studied in [5], where it was proved that this re- stricted version of the problem admits an approximation ratio better than k 2 if the given hypergraph is dense enough. In this paper, we give a new approximation algorithm for the Vertex Cover problem restricted to dense k-partite k-uniform hypergraphs and prove that the achieved approximation ratio is almost tight assuming the Unique Games Conjec- ture. 2 Definitions and Notations Given a natural number i ∈ N, we introduce for notational simplicity the set [i] = {1, .., i} and set [0] = ∅. Let S be a finite set with cardinality s and k ∈ [s]. We k(cid:1) = {S′ ⊆ S S′ = k}. A k-uniform hypergraph H = (V (H), E(H)) consists of a set of vertices V and a col- will use the abbreviation (cid:0)S lection E ⊆ (cid:0)V k(cid:1) of edges. For a k-uniform hypergraph H and a vertex v ∈ V (H), we define the neighborhood NH (v) of v by (cid:16)Se∈{e∈Ev∈e} e(cid:17) \ {v} and the degree dH(v) of v to be {e ∈ E v ∈ e}. We extend this notion to subsets of V (H), where S ⊆ V (H) obtains the degree dH(S) by {e ∈ E S ⊆ e}. A k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) is a k-uniform hypergraph such that V is a disjoint union of V1, .., Vk with Vi ∩ e = 1 for every e ∈ E and i ∈ [k]. In the remainder, we assume that Vi ≥ Vi+1 for all i ∈ [k − 1] and k = O(1). A balanced k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) is a k-partite k- uniform hypergraph with Vi = V k for all i ∈ [k]. We set n = V and m = E as usual. For a k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) and v ∈ Vk, we in- troduce the v-induced hypergraph H(v), where the edge set of H(v) is defined by 2 {e \ {v} v ∈ e ∈ E(H)} and the vertex set of H(v) is partitioned into Vi ∩ NH (v) with i ∈ [k − 1]. A vertex cover of a k-uniform hypergraph H = (V (H), E(H)) is a subset C of V (H) with the property that e ∩ C 6= ∅ holds for all e ∈ E(H). The Vertex Cover problem consists of finding a vertex cover of minimum size in a given k-uniform hypergraph. The Vertex Cover problem in k-partite k-uniform hypergraphs is the restricted problem, where a k-partite k-uniform hypergraph and its vertex partition is given as a part of the input. We define a k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) as ǫ-dense for an ǫ ∈ [0, 1] if the following condition holds: E(H) ≥ ǫ Yi∈[k] Vi For ℓ ∈ [k − 1], we introduce the notion of ℓ-wise ǫ-dense k-partite k-uniform hypergraphs. Given a k-partite k-uniform hypergraph H, if there exists an I ∈ (cid:0)[k] ℓ (cid:1) and an ǫ ∈ [0, 1] such that for all S with the property Vi ∩ S = 1 for all i ∈ I the condition dH(S) ≥ ǫ Yi∈[k]\I Vi holds, we define H to be ℓ-wise ǫ-dense. 3 Our Results In this paper, we give an improved approximation upper bound for the Vertex Cover problem restricted to ǫ-dense k-partite k-uniform hypergraphs. The approx- imation algorithm in [5] yields an approximation ratio of k k − (k − 2)(1 − ǫ) 1 k−ℓ for ℓ-wise ǫ-dense balanced k-partite k-uniform hypergraphs. Here, we design an algorithm with an approximation factor of k 2 + (k − 2)ǫ for the ǫ-dense case which also improves on the ℓ-wise ǫ-dense balanced case for all ℓ ∈ [k − 2] and matches their bound when ℓ = k − 1. A further advantage of this algorithm is that it applies to a larger class of hypergraphs since the considered hypergraph is not necessarily required to be balanced. As a byproduct, we obtain a constructive proof that a vertex cover of an ǫ-dense k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) is bounded from below by ǫVk, which is shown to be sharp by constructing a family of tight examples. On the other hand, we provide inapproximability results for the Vertex Cover problem restricted to ℓ-wise ǫ-dense balanced k-partite k-uniform hypergraphs un- der the Unique Games Conjecture. We also prove that this reduction yields a 3 matching lower bound if we use a conjecture on the Unique Games hardness of the Vertex Cover problem restricted to balanced k-partite k-uniform hypergraphs. This means that further restrictions such as ℓ-wise density cannot lead to improved approximation ratios and our proposed approximation algorithm is best possible assuming this conjecture. In addition, we are able to prove an inapproximability factor under P 6= N P . 4 Approximation Algorithm In this section, we give a polynomial time approximation algorithm with improved approximation factor for the Vertex Cover problem restricted to ǫ-dense k-partite k-uniform hypergraphs. We state now our main result. Theorem 1. There exists a polynomial time approximation algorithm with approxi- mation ratio k 2 + (k − 2)ǫ for the Vertex Cover problem in ǫ-dense k-partite k-uniform hypergraphs. A crucial ingredient of the proof of Theorem 1 is Lemma 1, in which we show that we can extract efficiently a large part of an optimal vertex cover of a given ǫ-dense k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)). More precisely, we obtain in this way a constructive proof that the size of a vertex cover of H is bounded from below by ǫVk. The procedure for the extraction of a part of an optimal vertex cover is given in Figure 1. We now formulate Lemma 1: Lemma 1. Let H = (V1, .., Vk, E(H)) be an ǫ-dense k-partite k-uniform hypergraph with k ≥ 1. Then, the procedure Extract(·) computes in polynomial time a collection R of subsets of V (H) such that the size of R is polynomial in V (H) and R contains a set S, which is a subset of an optimal vertex cover of H and its cardinality is at least ǫVk. As a consequence, we obtain directly: Corollary 1. Given an ǫ-dense k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) with k ≥ 1, the cardinality of an optimal vertex cover of H is bounded from below by ǫVk. Before we prove Lemma 1, we describe the main idea of the proof. Let OP T denote an optimal vertex cover of H. The procedure Extract(·) tests for the set R = {v1, .., vp} of the p heaviest vertices of Vk, if {v1, .., vu−1} ⊆ OP T and vu 6∈ OP T for every u ∈ [p]. Clearly, either R ⊆ OP T or there exists a vu such that vu 6∈ OP T . If the procedure already possesses a part of OP T denoted by Ru, then, 4 Procedure Extract(·) Input: ǫ-dense k-partite k-uniform hypergraph H = (V1, .., Vk, E) with k ≥ 1 1. IF k = 1 THEN (a) RETURN {Se∈E e} 2. ELSE: (a) Let (v1, .., vp) be the vector consisting of the first p = l heaviest vertices of Vk with dH(vi) ≥ dH(vi+1) E Ql∈[k−1] Vlm (b) R = {{v1, .., vp}} (c) FOR i = 1, .., p DO: i. Ri = {vk k ∈ [i − 1]} ii. Invoke Extract(H(vi)) with output O iii. R = R ∪ {Ri ∪ S S ∈ O} 3. RETURN R Figure 1: Procedure Extract Extract(·) tries to obtain a large part of an optimal vertex cover of the vu-induced hypergraph H(vu). Hence, we have to show that H(vu) must still be dense enough. We now give the proof of Lemma 1. Proof. The proof of Lemma 1 will be split in several parts. In particular, we show that given an ǫ-dense k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)), the procedure Extract(·) and its output R possess the following properties: 1. Extract(·) constructs R in polynomial time and the cardinality of R is O(nk). 2. There is a S ∈ R such that S is a subset of an optimal vertex cover of H. 3. For every S ∈ R, the cardinality of S is at least S ≥ ǫVk. (1.) Clearly, R is upper bounded by V1k = O(nk) and therefore, the running time of Extract(·) is O(nk). (2.) and (3.) We prove the remaining properties by induction. If we have k = 1, the set Se∈E(H) e is by definition an optimal vertex cover of H = (V1, E(H)). Since H is ǫ-dense, the cardinality of E(H) is lower bounded by ǫV1. We assume that k > 1. Let H = (V1, .., Vk, E(H)) be an ǫ-dense k-partite k-uniform hypergraph and OP T ⊆ V (H) an optimal vertex cover of H. Let (v1, .., vp) be the vector consisting of the first p = l E(H) Ql∈[k−1] Vlm heaviest vertices of Vk with dH(vi) ≥ dH(vi+1). If {v1, .., vp} is contained in OP T , we have constructed a subset of an 5 optimal vertex cover with cardinality p =   ≥ Vl ǫ Ql∈[k] Ql∈[k−1] ≥ ǫVk. Vl E(H) Vl Ql∈[k−1]   Otherwise, there is an u ∈ [p] such that Ru ⊆ OP T and vu 6∈ OP T . But this means that an optimal vertex cover of H contains an optimal vertex cover of the vu-induced (k − 1)-partite (k − 1)-uniform hypergraph H(vu) in order to cover the edges e ∈ {e ∈ E vu ∈ e}. The situation is depicted in Figure 2. vu-induced Hypergraph H(vu) Vk−1 V2 V1 v1 v2 vu−1 vu Vk Figure 2: The vu-induced (k − 1)-partite (k − 1)-uniform hypergraph H(vu) By our induction hypothesis, Extract(H(vu)) contains a set Su which is a subset of a minimum vertex cover of H(vu) and of OP T . The only claim, which remains to be proven, is that the cardinality of Su is large enough. More precisely, we show that Su can be lower bounded by ǫVk − Ru. Therefore, we need to analyze the density of the vu-induced hypergraph H(vu). The edge set of H(vu) is given by {e \ {vu} vu ∈ e ∈ E}. Thus, we have to obtain a lower bound on the degree of vu. Since {e ∈ E e ∩ Ru 6= ∅} is upper bounded by RuQl∈[k−1] Vl, the vertices in Vk \ Ru possess the average degree of at least degH(v) Pv∈Vk\Ru Vk \ Ru ≥ ≥ ≥ ǫ Ql∈[k] Vl − {e ∈ E e ∩ Ru 6= ∅} Vk \ Ru ǫ Ql∈[k] Vl − Ru Ql∈[k−1] Vk \ Ru Vl (ǫVk − Ru) Ql∈[k−1] Vk \ Ru Vl 6 (1) (2) (3) Since the heaviest vertex in Vk \ Ru must have a degree of at (ǫVk−Ru) Ql∈[k−1] Vl least , we deduce that the edge set of H(vu) denoted by Eu can be Vk\Ru lower bounded by Eu ≥ (ǫVk − Ru) Ql∈[k−1] Vk \ Ru Vl Let H(vu) be defined by (V u induction hypothesis, the size of every set contained in Extract(·) is at least i ≤ Vi for all i ∈ [k − 1]. By our 1 , .., V u k−1, Eu) with V u Eu V u l Ql∈[k−1] Vk−1 ≥ ≥ ≥ ≥ Vl V u l (ǫVk − Ru) Ql∈[k−1] Vk \ Ru Ql∈[k−1] (ǫVk − Ru) Ql∈[k−1] Vk \ Ru Ql∈[k−1] Vl Vk−1 Vk−1 Vl (ǫVk − Ru) Vk \ Ru Vk (ǫVk − Ru) Vk Vk = ǫVk − Ru (4) (5) (6) (7) In (4), we used the fact that V u i ≤ Vi for all i ∈ [k − 1]. Whereas in (5), we used our assumption Vk ≤ Vk−1. All in all, we obtain Ru ∪ Su ≥ Ru + (ǫVk − Ru) = ǫVk. (8) Clearly, this argumentation on the size of Ru ∪ Su holds for every u ∈ [p] and the proof of Lemma 1 follows. Before we state our approximation algorithm and prove Theorem 1, we show that the bound in Lemma 1 is tight. In particular, we define a family of ǫ-dense k-partite k-uniform hypergraphs H(k, l, ǫ) = (V1, .., Vk, E(Hl)) with Vi = V for all i ∈ [k], k ≥ 1, ǫ ∈ { u l u ∈ [l]} and l ≥ 1 such that Extract(·) returns a subset of an optimal vertex cover with cardinality of exactly ǫVk. k Lemma 2. The bound of Lemma 1 is tight. Proof. Let us define H(k, p, ǫ) = (V1, .., Vk, E). For a fixed p ≥ 1 and k ≥ 1, every partition Vi with i ∈ [k] consists of a set of l vertices. Let us fix a ǫ = u l with u ∈ [l]. Then, H(k, l, ǫ) contains the set V u k ⊆ Vk of u vertices such that E = {{v1, v2, .., vk} v1 ∈ V u k , v2 ∈ V2, .., vk ∈ Vk}. An example of such a hypergraph is depicted in Figure 3. Notice that H(k, l, ǫ) = (V1, .., Vk, E) is ǫ-dense, since = V u k Vk = u l = ǫ. E Vj Qj∈[k] 7 V u k Vk Vk−1 V2 V1 Figure 3: An example of a hypergraph H(k, l, ǫ) The procedure Extract(·) returns a set R, in which V u k is the k set of the p heaviest vertices of Vk. Hence, we obtain V u Vk Vk = ǫVk. On k , E(H ′)) with edge the other hand, the remaining hypergraph H ′ = (V1, .., Vk \ V u k = ∅} is already covered, since E(H ′) is by definition set E(H ′) = {e ∈ E e ∩ V u of H(k, p, ǫ) the empty set. Therefore, V u k is a vertex cover of H(k, p, ǫ) and since, according to Corollary 1, every vertex cover is bounded from below by ǫVk, V u k must be an optimal vertex cover. k is contained, since V u k = V u Next, we state our approximation algorithm for the Vertex Cover problem in ǫ-dense k-partite k-uniform hypergraphs defined in Figure 4. The approximation algorithm combines the procedure Extract(·) to generate a large enough subset of an optimal vertex cover together with the k 2 -approximation algorithm due to Lov´asz [20] applied to the remaining instance. Algorithm Approx(·) Input: ǫ-dense k-partite k-uniform hypergraph H = (V1, .., Vk, E) with k ≥ 3 1. T = {Vk} 2. invoke procedure Extract(H) with output R 3. for all S ∈ R do : (a) HS = (V (H) \ S, {e ∈ E(H) e ∩ S = ∅}) (b) obtain a ( k 2 )-approximate solution Sk for HS (c) T = T ∪ {Sk ∪ S} 4. Return the smallest set in T Figure 4: Algorithm Approx(·) 8 We now prove Theorem 1. Proof. Let H = (V1, .., Vk, E) be an ǫ-dense k-partite k-uniform hypergraph. From Lemma 1, we know that the procedure Extract(·) returns in polynomial time a collection C of subsets of V (H) such that there is a set S in C, which is contained in an optimal vertex cover of H. Moreover, we know that the size of S is lower bounded by ǫVk. Next, we analyze the approximation ratio of our approximation algorithm Approx(·). Clearly, the size of an optimal vertex cover of H is upper bounded by Vk. Let us denote by OP T ′ the size of an optimal vertex cover of the remaining hypergraph H ′ defined by removing all edges e of H with e ∩ S 6= ∅. Further- more, let S′ be the solution of the k 2 -approximation algorithm applied to H ′. The approximation ratio of Approx(·) is bounded by S + S′ S + OP T ′ ≤ S + k 2 OP T ′ S + OP T ′ ≤ ≤ ≤ ≤ ≤ ≤ k kS+kOP T ′ S+ k 2 OP T ′ k 2S+(k−2)S+kOP T ′ S+ k 2 OP T ′ k 2 + (k − 2) S 2 OP T ′ S+ k k 2 + (k − 2) S Vk k 2 + (k − 2) ǫVk Vk k 2 + (k − 2)ǫ (9) (10) (11) (12) (13) (14) In (11), we used the fact that the size of the output of Approx(·) is upper bounded by Vk. Therefore, we have S + k 2 OP T ′ ≤ Vk. In (12), we know from Lemma 1 that S ≥ ǫVk. 5 Inapproximability Results In this section, we prove hardness results for the Vertex Cover problem restricted to ℓ-wise ǫ-dense balanced k-uniform k-partite hypergraphs under the Unique Games Conjecture [17] as well as under the assumption P 6= N P . 5.1 UGC-Hardness The Unique Games-hardness result of [10] was obtained by applying the result of Kumar et al. [19], with a modification to the LP integrality gap due to Ahorani et al. [1]. More precisely, they proved the following inapproximability result: 9 Theorem 2. [10] For every δ > 0 and k ≥ 3, there exist a nδ such that given H = (V1, .., Vk, E(H)) as an instance of the Vertex Cover problem in balanced k-partite k-uniform hypergraphs with V (H) ≥ nδ, the following is UGC-hard to decide: • The size of a vertex cover of H is at least V (cid:16) 1 2(k−1) − δ(cid:17). • The size of an optimal vertex cover of H is at most V (cid:16) 1 k(k−1) + δ(cid:17). As the starting point of our reduction, we use Theorem 2 and prove the follow- ing: Theorem 3. For every δ > 0, ǫ ∈ (0, 1), ℓ ∈ [k − 1], and k ≥ 3, there exists no polynomial time approximation algorithm with an approximation ratio k 2 + 2(k−1)(k−2)ǫ k+(k−2)ǫ − δ for the Vertex Cover problem in ℓ-wise ǫ-dense k-partite k-uniform hypergraphs as- suming the Unique Games Conjecture. Proof. First, we concentrate on the ǫ-dense case and afterwards, we extend the range of ℓ. As a starting point of the reduction, we use the k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) from Theorem 2 and construct an ǫ-dense k- partite k-uniform hypergraph H ′ = (V ′ n Let us start with the description of H ′. First, we join the set Ci of k vertices to Vi for every i ∈ [k] and add all possible edges e of H ′ to E′ with the restriction C1 ∩ e 6= ∅. Thus, we obtain V ′ Now, let us analyze how the size of the optimal solution of H ′ transforms. We denote by OP T ′ an optimal vertex cover of H ′. The UGC-hard decision question from Theorem 2 transforms into the following: k for all i ∈ [k]. 1 , .., V ′ k + ǫ k, E′). i = n 1−ǫ 1−ǫ n ǫ n(cid:18) 1 2(k − 1) − δ(cid:19) + ǫ 1 − ǫ n k ≤ OP T ′ or OP T ′ ≤ n(cid:18) 1 k(k − 1) + δ(cid:19) + ǫ 1 − ǫ n k Assuming the UGC, this implies the hardness of approximating the Vertex Cover problem in ǫ-dense hypergraphs for every δ′ > 0 to within: n(cid:16) 1 n(cid:16) 1 2(k−1) − δ(cid:17) + ǫ k(k−1) + δ(cid:17) + ǫ 1−ǫ 1−ǫ 1−ǫ 2(k−1) − δ(1 − ǫ) + ǫ k(k−1) + δ(1 − ǫ) + ǫ 1−ǫ k k (1−ǫ)k 2(k−1)k + 2ǫ(k−1) (k−1)k + ǫ(k−1) 2k(k−1) k(k−1) 1−ǫ − δ′ (15) (16) n k n k = = 10 (1−ǫ)k 2(k−1)k + 2ǫ(k−1) (k−1)k + ǫ(k−1) 2k(k−1) k(k−1) 1−ǫ − δ′ = k−ǫk+2ǫk−2ǫ 2(k−1)k 1−ǫ+ǫk−ǫ (k−1)k − δ′ = = = = = k + (k − 2)ǫ 2(1 + (k − 2)ǫ) − δ′ k 2k(1+(k−2)ǫ) k+(k−2)ǫ − δ′ k 2k+2(k−2)ǫ+(2k−2)(k−2)ǫ k+(k−2)ǫ k 2 + (2k−2)(k−2)ǫ k+(k−2)ǫ k 2 + 2(k−1)(k−2)ǫ k+(k−2)ǫ − δ′ − δ′ − δ′ (17) (18) (19) (20) (21) (22) Finally, we have to verify that the constructed hypergraph H ′ is indeed ǫ-dense. Notice that H ′ can have at most (V ′ k )k edges. Therefore, we obtain the following: 1)k = ( n k + ǫ 1−ǫ n n 1−ǫ (cid:0) ǫ n 1−ǫ k(cid:1)(cid:0) n k + ǫ (cid:0) n k(cid:1)k−1 k + ǫ k(cid:1)k 1−ǫ n = n k ǫ 1−ǫ n k (cid:0)1 + ǫ 1−ǫ(cid:1) = ǫ 1−ǫ 1+ǫ−ǫ 1−ǫ = ǫ Notice that the constructed hypergraph is also ℓ-wise ǫ-dense balanced. Hence, we obtain the same inapproximability factor in this case as well. Next, we combine the former construction with a conjecture about Unique Games hardness of the Vertex Cover problem in balanced k-partite k-uniform hy- pergraphs. In particular, we postulate the following: Conjecture 1. Given a balanced k-partite k-uniform hypergraph H = (V1, .., Vk, E(H)) with k ≥ 3, let OP T denote an optimal vertex cover of H. For every δ > 0, the following is UGC-hard to decide: V (cid:18) 1 k − δ(cid:19) ≤ OP T or OP T ≤ V (cid:18) 2 k2 + δ(cid:19) Combining Conjecture 1 with the construction in Theorem 3, it yields the fol- lowing inapproximability result which matches precisely the approximation upper bound achieved by our approximation algorithm described in Section 4: Theorem 4. For every δ > 0, ǫ ∈ (0, 1), ℓ ∈ [k − 1], and k ≥ 3, there exists no polynomial time approximation algorithm with an approximation ratio k 2 + (k − 2)ǫ − δ 11 for the Vertex Cover problem in ℓ-wise ǫ-dense k-partite k-uniform hypergraphs as- suming Conjecture 1. Proof. The UGC-hard decision question from Conjecture 1 transforms into the fol- lowing: n(cid:18) 1 k − δ(cid:19) + ǫ 1 − ǫ n k ≤ OP T ′ or OP T ′ ≤ n(cid:18) 2 k2 + δ(cid:19) + ǫ 1 − ǫ n k Assuming the UGC, this implies the hardness of approximating the Vertex Cover problem in ǫ-dense k-partite k-uniform hypergraphs for every δ′ > 0 to within: 1−ǫ n(cid:0) 1 k − δ(cid:1) + ǫ n(cid:0) 2 k2 + δ(cid:1) + ǫ 1−ǫ n k n k = = = = k k n(cid:0) 1 k − δ(cid:1) (1 − ǫ) + ǫn n(cid:0) 2 k2 + δ(cid:1) (1 − ǫ) + ǫn n(cid:0) 2 k2(cid:1) (1 − ǫ) + kǫn n k k2 − δ′ k − δ′ 2(1 − ǫ) + kǫ k 2 + (k − 2)ǫ − δ′ (23) (24) (25) (26) 5.2 NP-Hardness Recently, Sachdeva and Saket proved in [21] a nearly optimal NP-hardness of the Vertex Cover problem on balanced k-uniform k-partite hypergraphs. More pre- cisely, they obtained the following inapproximability result: Theorem 5. [21] Given a balanced k-partite k-uniform hypergraph H = (V, E) with k ≥ 4, let OP T denote an optimal vertex cover of H. For every δ > 0, the following is NP-hard to decide: V (cid:18) k 2(k + 1)(2(k + 1) + 1) − δ(cid:19) ≤ OP T or V (cid:18) 1 k(2(k + 1) + 1) + δ(cid:19) ≥ OP T Combining our reduction from Theorem 2 with Theorem 5, we prove the fol- lowing inapproximability result under the assumption P 6= N P : Theorem 6. For every δ > 0, ǫ ∈ (0, 1), ℓ ∈ [k − 1], and k ≥ 4, there is no polynomial time approximation algorithm with an approximation ratio k2(1 − ǫ) + ǫ2(k + 1)(2(k + 1) + 1) 2(k + 1)[1 − ǫ + ǫ(2(k + 1) + 1)] − δ 12 for the Vertex Cover problem in ℓ-wise ǫ-dense k-partite k-uniform hypergraphs as- suming P 6= N P . Proof. The NP-hard decision question from Theorem 5 transforms into the follow- ing: n(cid:18) k 2(k + 1)(2(k + 1) + 1) n(cid:18) 1 k(2(k + 1) + 1) − δ(cid:19) + + δ(cid:19) + ǫ ǫ n k or n k 1 − ǫ 1 − ǫ ≤ OP T ′ ≥ OP T ′ Assuming N P 6= P , this implies the hardness of approximating the Vertex Cover problem in ǫ-dense hypergraphs for every δ′ > 0 to within: k(1−ǫ) 2(k+1)(2(k+1)+1) + ǫ k 1−ǫ k(2(k+1)+1) + ǫ k − δ′ = k2(1−ǫ)+ǫ2(k+1)(2(k+1)+1) k2(k+1)(2(k+1)+1) 1−ǫ+ǫ(2(k+1)+1) k(2(k+1)+1) − δ′ (27) = k2(1 − ǫ) + ǫ2(k + 1)(2(k + 1) + 1) 2(k + 1)[1 − ǫ + ǫ(2(k + 1) + 1)] − δ′ (28) 6 Further Research An interesting question remains about even tighter lower approximation bounds for our problem, perhaps connecting it more closely to the integrality gap issue of the LP of Lov´asz [20]. Acknowledgment We thank Jean Cardinal for many stimulating discussions. References [1] R. Aharoni, R. Holzman, and M. Krivelevich, On a Theorem of Lov´asz on Covers in r-Partite Hypergraphs, Combinatorica 16, pp. 149 -- 174, 1996. [2] S. Arora, D. Karger, and M. Karpinski, Polynomial Time Approximation Schemes for Dense Instances of NP-Hard Problems, Proc. 27th ACM STOC (1995), pp. 284 -- 293; see also in J. Comput. Syst. Sci. 58, pp. 193 -- 210, 1999. [3] N. Bansal and S. Khot, Inapproximability of Hypergraph Vertex Cover and Applications to Scheduling Problems, Proc. 37th ICALP (2010), LNCS 6198, pp. 250 -- 261, 2010. 13 [4] R. Bar-Yehuda and Z. Kehat, Approximating the Dense Set-Cover Problem, J. Comput. Syst. Sci. 69, pp. 547 -- 561, 2004. [5] J. Cardinal, M. Karpinski, R. Schmied, and C. Viehmann, Approximability of Vertex Cover in Dense Bipartite Hypergraphs, Research Report CS-85319, University of Bonn, 2011. [6] A. Clementi and L. Trevisan, Improved Non-Approximability Results for Minimum Vertex Cover with Density Constraints, Theor. Comput. Sci. 225, pp. 113 -- 128, 1999. [7] I. Dinur, V. Guruswami, and S. Khot Vertex Cover on k-Uniform Hyper- graphs is Hard to Approximate within Factor (k − 3 − ǫ), ECCC TR02-027, 2002. [8] I. Dinur, V. Guruswami, S. Khot, and O. Regev, A New Multilayered PCP and the Hardness of Hypergraph Vertex Cover, SIAM J. Comput. 34, pp. 1129 -- 1146, 2005. [9] A. Eremeev, On some Approximation Algorithms for Dense Vertex Cover Problem, Proc. Symp. on Operations Research (1999), pp. 48 -- 52. [10] V. Guruswami and R. Saket, On the Inapproximability of Vertex Cover on k-Partite k-Uniform Hypergraphs, Proc. 37th ICALP (2010), LNCS 6198, pp. 360 -- 371, 2010. [11] E. Halperin, Improved Approximation Algorithms for the Vertex Cover Prob- lem in Graphs and Hypergraphs SIAM J. Comput. 31, pp. 1608 -- 1623, 2002. [12] T. Imamura and K. Iwama, Approximating Vertex Cover on Dense Graphs, Proc. 16th ACM-SIAM SODA (2005), pp. 582 -- 589. [13] R. Karp, On the Computational Complexity of Combinatorial Problems, Net- works 5, pp. 45 -- 68, 1975. [14] M. Karpinski, Polynomial Time Approximation Schemes for Some Dense In- stances of NP-Hard Optimization Problems, Algorithmica 30, pp. 386 -- 397, 2001. [15] M. Karpinski, A. Rucinski, and E. Szymanska, Computational Complexity of the Perfect Matching Problem in Hypergraphs with Subcritical Density, Int. J. Found. Comput. Sci. 21, pp. 905 -- 924, 2010. [16] M. Karpinski and A. Zelikovsky, Approximating Dense Cases of Covering Problems, Proc. DIMACS Workshop on Network Design: Connectivity and Facilities Location (1997), pp. 169 -- 178; also published in ECCC TR97- 004, 1997. 14 [17] S. Khot, On the Power of Unique 2-Prover 1-Round Games, Proc. 34th ACM STOC (2002), pp. 767 -- 775. [18] S. Khot and O. Regev, Vertex Cover Might be Hard to Approximate to within 2 − ǫ, J. Comput. Syst. Sci. 74, pp. 335-349, 2008. [19] A. Kumar, R. Manokaran, M. Tulsiani, and N. Vishnoi, On LP-based approx- imability for strict CSPs, Proc. 22nd ACM-SIAM SODA (2011), pp. 1560 -- 1573. [20] L. Lov´asz, On Minimax Theorems of Combinatorics, Doctoral Thesis, Math- ematiki Lapok 26, pp. 209 -- 264, 1975. [21] S. Sachdeva and R. Saket, Nearly Optimal NP-Hardness of Vertex Cover on k-Uniform k-Partite Hypergraphs, CoRR abs/1105.4175, 2011. [22] L. Trevisan, Non-Approximability Results for Optimization Problems on Bounded Degree Instances, Proc. 33rd ACM STOC (2001), pp. 453 -- 461. 15
1903.01465
1
1903
2019-03-04T18:34:01
Lightweight merging of compressed indices based on BWT variants
[ "cs.DS" ]
In this paper we propose a flexible and lightweight technique for merging compressed indices based on variants of Burrows-Wheeler transform (BWT), thus addressing the need for algorithms that compute compressed indices over large collections using a limited amount of working memory. Merge procedures make it possible to use an incremental strategy for building large indices based on merging indices for progressively larger subcollections. Starting with a known lightweight algorithm for merging BWTs [Holt and McMillan, Bionformatics 2014], we show how to modify it in order to merge, or compute from scratch, also the Longest Common Prefix (LCP) array. We then expand our technique for merging compressed tries and circular/permuterm compressed indices, two compressed data structures for which there were hitherto no known merging algorithms.
cs.DS
cs
Lightweight merging of compressed indices based on BWT variants Lavinia Egidi University of Eastern Piedmont Alessandria, Italy Giovanni Manzini University of Eastern Piedmont Alessandria, Italy IIT-CNR Pisa, Italy Abstract In this paper we propose a flexible and lightweight technique for merging compressed indices based on variants of Burrows-Wheeler transform (BWT), thus addressing the need for algorithms that compute compressed indices over large collections using a limited amount of working memory. Merge procedures make it possible to use an incremental strategy for building large indices based on merging indices for progressively larger subcollections. Starting with a known lightweight algorithm for merging BWTs [Holt and McMillan, Bion- formatics 2014], we show how to modify it in order to merge, or compute from scratch, also the Longest Common Prefix (LCP) array. We then expand our technique for merging compressed tries and circular/permuterm compressed indices, two compressed data structures for which there were hitherto no known merging algorithms. 2012 ACM Subject Classification Theory of computation → Design and analysis of algorithms Keywords and phrases multi-string BWT, Longest Common Prefix array, XBWT, trie compres- sion, circular patterns 1 Introduction The Burrows Wheeler transform (BWT), originally introduced as a tool for data compres- sion [4], has found application in the compact representation of many different data struc- tures. After the seminal works [31] showing that the BWT can be used as a compressed full text index for a single string, many researchers have proposed variants of this transformation for string collections [5, 24], trees [9, 10], graphs [3, 27, 35], and alignments [30, 29]. See [13] for an attempt to provide a unified view of these variants. In this paper we consider the problem of constructing compressed indices for string col- lections based on BWT variants. A compressed index is obviously most useful when working with very large amounts of data. Therefore, a fundamental requirement for construction al- gorithms, in order to be of practical use, is that they are lightweight in the sense that they use a limited amount of working space, i.e. space in addition to the space used for the input and the output. Indeed, the construction of compressed indices in linear time and small working space is an active and promising area of research, see [1, 12, 28] and references therein. A natural approach when working with string collections is to build the indexing data structure incrementally, that is, for progressively larger subcollections. For example, when additional data should be added to an already large index, the incremental construction 9 1 0 2 r a M 4 ] S D . s c [ 1 v 5 6 4 1 0 . 3 0 9 1 : v i X r a 23:2 Lightweight merging of compressed indices based on BWT variants appears much more reasonable, and often works better in practice, than rebuilding the com- plete index from scratch, even when the from-scratch option has better theoretical bounds. Indeed, in [33] and [26] the authors were able to build the largest indices in their respective fields using the incremental approach. Along this path, Holt and McMillan [16, 15] proposed a simple and elegant algorithm, that we call the H&M algorithm from now on, for merging BWTs of collections of sequences. For collections of total size n, their fastest version takes O(n aveLcp01) time where aveLcp01 is the average length of the longest common prefix between suffixes in the collection. The av- erage length of the longest common prefix is O(n) in the worst case but O(log n) for random strings and for many real world datasets [22]. However, even when aveLcp01 = O(log n) the H&M algorithm is not theoretically optimal since computing the BWT from scratch takes O(n) time. Despite its theoretical shortcomings, because of its simplicity and small space usage, the H&M algorithm is competitive in practice for collections with relatively small average LCP. In addition, since the H&M algorithm accesses all data by sequential scans, it has been adapted to work on very large collections in external memory [16]. In this paper we revisit the H&M algorithm and we show that its main technique can be adapted to solve the merging problem for three different compressed indices based on the BWT. First, in Section 4 we describe a procedure to merge, in addition to the BWTs, the Longest Common Prefix (LCP) arrays of string collections. The LCP array is often used to provide additional functionalities to indices based on the BWT [31], and the issue of efficiently computing and storing LCP values has recently received much attention [14, 20]. Our algorithm has the same O(n aveLcp) complexity as the H&M algorithm. Next, in Section 5 we describe a procedure for merging compressed labelled trees (tries) as produced by the eXtended BWT transform (XBWT) [9, 10]. This result is particularly interesting since at the moment there are no time and space optimal algorithms for the computation from scratch of the XBWT. Our algorithm takes time proportional to the number of nodes in the output tree times the average node height. Finally, in Section 6 we describe algorithms for merging compressed indices for circular patterns [17], and compressed permuterm indices [11]. The time complexity of these al- gorithms is proportional to the total collection size times the average circular LCP, a notion that naturally extends the LCP to the modified lexicographic order used for circular strings. Our algorithms are based on the H&M technique specialized to the particular features of the different compressed indices given as input. They all make use of techniques to recognize blocks of the input that become irrelevant for the computation and skip them in successive iterations. Because of the skipping of irrelevant blocks we call our merging procedures Gap algorithms. Our algorithms are all lightweight in the sense that, in addition to the input and the output, they use only a few bitarrays of working space and the space for handling the irrelevant blocks. The latter amount of space can be significant for pathological inputs, but in practice we found it takes between 2% and 9% of the overall space, depending on the alphabet size. The Gap algorithms share with the H&M algorithm the feature of accessing all data by sequential scans and are therefore suitable for implementation in external memory. In [7] an external memory version of the Gap algorithm for merging BWT and LCP arrays is engineered, analyzed, and extensively tested on collections of DNA sequences. The results reported there show that the external memory version of Gap outperforms the known external memory algorithms for BWT/LCP computation when the avergae LCP of the collection is relatively small or when the strings of the input collection have widely different lengths. L. Egidi, G. Manzini 23:3 To the best of our knowledge, the problem of incrementally building compressed indices via merging has been previously addressed only in [34] and [26]. Sirén presents in [34] an algorithm that maintains a BWT-based compressed index in RAM and incrementally merges new collections to it. The algorithm is the first that makes it possible to build indices for Terabytes of data without using a specialized machine with a lot of RAM. However, Sirén's algorithm is specific for a particular compressed index (which doesn't use the LCP array), while ours can be more easily adapted to build different flavors of compressed indices as shown in this paper. In [26] the authors present a merge algorithm for colored de Bruijn graphs. Their algorithm is also inspired by the H&M algorithm and the authors report a threefold reduction in working space compared to the state of the art methods for from scratch de Bruijn graphs. Inspired by the techniques introduced in this paper, we are currently working on an improved de Bruijn graph merging algorithm [6] that also supports the construction of succinct Variable Order de Bruijn graph representations [2]. 2 Background Let t[1, n] denote a string of length n over an alphabet Σ of constant size σ. We write t[i, j] to denote the substring t[i]t[i + 1]··· t[j]. If j ≥ n we assume t[i, j] = t[i, n]. If i > j or i > n then t[i, j] is the empty string. Given two strings t and s we write t (cid:22) s (t ≺ s) to denote that t is lexicographically (strictly) smaller than s. We denote by LCP(t, s) the length of the longest common prefix between t and s. The suffix array sa[1, n] associated to t is the permutation of [1, n] giving the lexicographic order of t's suffixes, that is, for i = 1, . . . , n−1, t[sa[i], n] ≺ t[sa[i+1], n]. The longest common prefix array lcp[1, n + 1] is defined for i = 2, . . . , n by lcp[i] = LCP(t[sa[i − 1], n], t[sa[i], n]); (1) the lcp array stores the length of the longest common prefix between lexicographically con- secutive suffixes. For convenience we define lcp[1] = lcp[n + 1] = −1. We also define the maximum and average LCP as: (cid:18)X 1<i≤n (cid:19) maxLcp = max1<i≤n lcp[i], aveLcp = lcp[i] /n. (2) The Burrows-Wheeler transform bwt[1, n] of t is defined by (t[n] bwt[i] = t[sa[i] − 1] if sa[i] = 1 if sa[i] > 1. bwt is best seen as the permutation of t in which the position of t[j] coincides with the lexicographic rank of t[j + 1, n] (or of t[1, n] if j = n) in the suffix array. We call the string t[j + 1, n] context of t[j]. See Figure 1 for an example. The longest common prefix (LCP) array, and Burrows-Wheeler transform (BWT) can be generalized to the case of multiple strings. Historically, the first of such generalizations is the circular BWT [24] considered in Section 6. Here we consider the generalization proposed in [5] which is the one most used in applications. Let t0[1, n0] and t1[1, n1] be such that t0[n0] = $0 and t1[n1] = $1 where $0 < $1 are two symbols not appearing elsewhere in t0 and t1 and smaller than any other symbol. Let sa01[1, n0 + n1] denote the suffix array of the concatenation t0t1. The multi-string BWT of t0 and t1, denoted by bwt01[1, n0 + n1], is 23:4 Lightweight merging of compressed indices based on BWT variants bwt b c $0 a a b context $0 ab$0 abcab$0 b$0 bcab$0 cab$0 lcp -1 0 2 0 1 0 -1 bwt c $1 c a a a b b context $1 aabcabc$1 abc$1 abcabc$1 bc$1 bcabc$1 c$1 cabc$1 lcp -1 0 1 3 0 2 0 1 -1 id 0 1 1 0 1 0 1 0 1 0 1 1 0 1 lcp01 -1 0 0 1 2 3 5 0 1 2 4 0 1 3 -1 bwt01 b c $1 c c $0 a a a a a b b b context $0 $1 aabcabc$1 ab$0 abc$1 abcab$0 abcabc$1 b$0 bc$1 bcab$0 bcabc$1 c$1 cab$0 cabc$1 Figure 1 LCP array and BWT for t0 = abcab$0 and t1 = aabcabc$1, and multi-string BWT and corresponding LCP array for the same strings. Column id shows, for each entry of bwt01 = bc$1cc$0aaaabbb whether it comes from t0 or t1. defined by  t0[n0] t0[sa01[i] − 1] t1[n1] t1[sa01[i] − n0 − 1] if sa01[i] = 1 if 1 < sa01[i] ≤ n0 if sa01[i] = n0 + 1 if n0 + 1 < sa01[i]. bwt01[i] = In other words, bwt01[i] is the symbol preceding the i-th lexicographically larger suffix, with the exception that if sa01[i] = 1 then bwt01[i] = $0 and if sa01[i] = n0 + 1 then bwt01[i] = $1. Hence, bwt01[i] is always a character of the string (t0 or t1) containing the i-th largest suffix (see again Fig. 1). The above notion of multi-string BWT can be immediately generalized to define bwt1···k for a family of distinct strings t1, t2, . . . , tk. Essentially bwt1···k is a permutation of the symbols in t1, . . . , tk such that the position in bwt1···k of ti[j] is given by the lexicographic rank of its context ti[j + 1, ni] (or ti[1, ni] if j = ni). Given the concatenation t0t1 and its suffix array sa01[1, n0 + n1], we consider the cor- responding LCP array lcp01[1, n0 + n1 + 1] defined as in (1) (see again Fig. 1). Note that, for i = 2, . . . , n0 + n1, lcp01[i] gives the length of the longest common prefix between the contexts of bwt01[i] and bwt01[i − 1]. This definition can be immediately generalized to a family of k strings to define the LCP array lcp12···k associated to the multi-string BWT bwt12···k. 2.1 The H&M Algorithm In [16] Holt and McMillan introduced a simple and elegant algorithm, we call it the H&M algorithm, to merge multi-string BWTs1. Because it is the starting point for our results, we now briefly recall its main properties. 1 Unless explicitly stated otherwise, in the following we use H&M to refer to the algorithm from [16], and not to its variant proposed in [15]. L. Egidi, G. Manzini 23:5 Given bwt1···k and bwtk+1 k+2 ···h the H&M algorithm computes bwt1···h. The computa- tion does not explicitly need t1, . . . , th but only the (multi-string) BWTs to be merged. For simplicity of notation we describe the algorithm assuming we are merging two single-string BWTs bwt0 = bwt(t0) and bwt1 = bwt(t1); the same algorithm works in the general case with multi-string BWTs in input. Note also that the algorithm can be easily adapted to merge more than two (multi-string) BWTs at the same time. Computing bwt01 amounts to sorting the symbols of bwt0 and bwt1 according to the lexicographic order of their contexts, where the context of symbol bwt0[i] (resp. bwt1[i]) is t0[sa0[i], n0] (resp. t1[sa1[i], n1]). By construction, the symbols in bwt0 and bwt1 are already sorted by context, hence to compute bwt01 we only need to merge bwt0 and bwt1 without changing the relative order of the symbols within the two input sequences. The H&M algorithm works in successive iterations. After the h-th iteration the entries of bwt0 and bwt1 are sorted on the basis of the first h symbols of their context. More formally, the output of the h-th iteration is a binary vector Z(h) containing n0 = t0 0's and n1 = t1 1's and such that the following property holds. (cid:73) Property 1. For i = 1, . . . , n0 and j = 1, . . . n1 the i-th 0 precedes the j-th 1 in Z(h) if and only if t0[sa0[i], sa0[i] + h − 1] (cid:22) t1[sa1[j], sa1[j] + h − 1] (3) (recall that according to our notation if sa0[i] + h − 1 > n0 then t0[sa0[i], sa0[i] + h − 1] (cid:74) coincides with t0[sa0[i], n0], and similarly for t1). Following Property 1 we identify the i-th 0 in Z(h) with bwt0[i] and the j-th 1 in Z(h) with bwt1[j] so that Z(h) encodes a permutation of bwt01. Property 1 is equivalent to stating that we can logically partition Z(h) into b(h) + 1 blocks Z(h)[1, '1], Z(h)['1 + 1, '2], . . . , Z(h)['b(h) + 1, n0 + n1] (4) such that each block corresponds to a set of bwt01 symbols whose contexts are prefixed by the same length-h string (the symbols with a context shorter than h are contained in singleton blocks). Within each block the symbols of bwt0 precede those of bwt1, and the context of any symbol in block Z(h)['j +1, 'j+1] is lexicographically smaller than the context of any symbol in block Z(h)['k + 1, 'k+1] with k > j. The H&M algorithm initially sets Z(0) = 0n01n1: since the context of every bwt01 symbol is prefixed by the same length-0 string (the empty string), there is a single block containing all bwt01 symbols. At iteration h the algorithm computes Z(h+1) from Z(h) using the procedure in Figure 2. The following lemma is a restatement of Lemma 3.2 in [16] using our notation (see [8] for a proof in our notation). (cid:73) Lemma 2. For h = 0, 1, 2, . . . the bit vector Z(h) satisfies Property 1. (cid:74) Computing LCP values with the H&M algorithm 3 Our first result is to show that with a simple modification to the H&M algorithm it is possible to compute the LCP array lcp01, in addition to merging bwt0 and bwt1. Our strategy consists in keeping explicit track of the logical blocks we have defined for Z(h) and represented in (4). We maintain an integer array B[1, n0 + n1 + 1] such that at the end of iteration h it is B[i] 6= 0 if and only if a block of Z(h) starts at position i. The use of such integer array is shown in Figure 3. Note that: (i) initially we set B = 1 0n0+n1−1 1 and once 23:6 Lightweight merging of compressed indices based on BWT variants 1: Initialize array F[1, σ] 2: k0 ← 1; k1 ← 1 3: for k ← 1 to n0 + n1 do b ← Z(h−1)[k] 4: c ← bwtb[kb++] 5: if c 6= $ then 6: j ← F[c]++ 7: 8: j ← b 9: 10: 11: 12: end for end if Z(h)[j] ← b else . Init counters for bwt0 and bwt1 . Read bit b from Z(h−1) . Get symbol from bwt0 or bwt1 according to b . Get destination for b according to symbol c . Symbol $b goes to position b . Copy bit b to Z(h) Figure 2 Main loop of algorithm H&M for computing Z(h) given Z(h−1). Array F is initialized so that F [c] contains the number of occurrences of symbols smaller than c in bwt0 and bwt1 plus one. Note that the bits stored in Z(h) immediately after reading symbol c 6= $ are stored in positions from F [c] to F [c + 1] − 1 of Z(h). . Init counters for bwt0 and bwt1 . A new block of Z(h−1) is starting if B[k] 6= 0 and B[k] 6= h then id ← k . Read bit b from Z(h−1) . Get symbol from bwt0 or bwt1 according to b end if b ← Z(h−1)[k] c ← bwtb[kb++] if c 6= $ then j ← F[c]++ j ← b 1: Initialize arrays F[1, σ] and Block_id[1, σ] 2: k0 ← 1; k1 ← 1 3: for k ← 1 to n0 + n1 do 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: end for Figure 3 Main loop of the H&M algorithm modified for the computation of the lcp values. At Line 1 for each symbol c we set Block_id[c] = −1 and F [c] as in Figure 2. At the beginning of the algorithm we initialize the array B[1, n0 + n1 + 1] as B = 1 0n0+n1−1 1. . Update block id for symbol c . Check if already marked . A new block of Z(h) will start here end if Z(h)[j] ← b if Block_id[c] 6= id then . Get destination for b according to symbol c Block_id[c] ← id if B[j] = 0 then B[j] = h . Symbol $b goes to position b . Copy bit b to Z(h) else end if end if L. Egidi, G. Manzini 23:7 an entry in B becomes nonzero it is never changed, (ii) during iteration h we only write to B the value h, (iii) because of the test at Line 4 the values written during iteration h influence the algorithm only in subsequent iterations. In order to identify new blocks, we maintain an array Block_id[1, σ] such that Block_id[c] is the id of the block of Z(h−1) to which the last seen occurrence of symbol c belonged. The following lemma shows that the nonzero values of B at the end of iteration h mark the boundaries of Z(h)'s logical blocks. (cid:73) Lemma 3. For any h ≥ 0, let ', m be such that 1 ≤ ' ≤ m ≤ n0 + n1 and lcp01['] < h, min(lcp01[' + 1], . . . , lcp01[m]) ≥ h, lcp01[m + 1] < h. Then, at the end of iteration h the array B is such that B['] 6= 0, B[' + 1] = ··· = B[m] = 0, B[m + 1] 6= 0 (5) (6) and Z(h)[', m] is one of the blocks in (4). Proof. We prove the result by induction on h. For h = 0, hence before the execution of the first iteration, (5) is only valid for ' = 1 and m = n0 + n1 (recall that we defined lcp01[1] = lcp01[n0 + n1 + 1] = −1). Since initially B = 1 0n0+n1−1 1 our claim holds. Suppose now that (5) holds for some h > 0. Let s = t01[sa01['], sa01['] + h − 1]; by (5) s is a common prefix of the suffixes starting at positions sa01['], sa01[' + 1], . . . , sa01[m], and no other suffix of t01 is prefixed by s. By Property 1 the 0s and 1s in Z(h)[', m] corresponds to the same set of suffixes That is, if ' ≤ v ≤ m and Z(h)[v] is the ith 0 (resp. jth 1) of Z(h) then the suffix starting at t0[sa0[i]] (resp. t1[sa1[j]]) is prefixed by s. To prove (6) we start by showing that, if ' < m, then at the end of iteration h − 1 it is B[' + 1] = ··· = B[m] = 0. To see this observe that the range sa01[', m] is part of a (possibly) larger range sa01['0, m0] containing all suffixes prefixed by the length h − 1 prefix of s. By inductive hypothesis, at the end of iteration h − 1 it is B['0 + 1] = ··· = B[m0] = 0 which proves our claim since '0 ≤ ' and m ≤ m0. To complete the proof, we need to show that during iteration h: (i) we do not modify B['+1, m] and (ii) we write a nonzero to B['] and B[m+1] if they do not already contain a nonzero. Let c = s[0] and s0 = s[1, h − 1] so that s = cs0. Consider now the range sa01[e, f] containing the suffixes prefixed by s0. By inductive hypothesis at the end of iteration h − 1 it is B[e] 6= 0, B[e + 1] = ··· = B[f] = 0, B[f + 1] 6= 0. (7) During iteration h, the bits in Z(h)[', m] are possibly changed only when we are scanning the region Z(h−1)[e, f] and we find an entry b = Z(h−1)[k], e ≤ k ≤ f, such that the corresponding value in bwtb is c. Note that by (7) as soon as k reaches e the variable id changes and becomes different from all values stored in Block_id. Hence, at the first occurrence of symbol c the value h will be stored in B['] (Line 18) unless a nonzero is already there. Again, because of (7), during the scanning of Z(h−1)[e, f] the variable id does not change so subsequent occurrences of c will not cause a nonzero value to be written to B[' + 1, m]. Finally, as soon as we leave region Z(h−1)[e, f] and k reaches f + 1, the variable id changes again and at the next occurrence of c a nonzero value will be stored in B[m + 1]. If there are no more occurrences of c after we leave region Z(h−1)[e, f] then either sa01[m+1] is the first suffix array entry prefixed by symbol c + 1 or m + 1 = n0 + n1 + 1. In the former case B[m + 1] gets a nonzero value at iteration 1, in the latter case B[m + 1] gets a nonzero (cid:74) value when we initialize array B. 23:8 Lightweight merging of compressed indices based on BWT variants (cid:73) Corollary 4. For i = 2, . . . , n0 + n1, if lcp01[i] = ', then starting from the end of iteration ' + 1 it is B[i] = ' + 1. Proof. By Lemma 3 we know that B[i] becomes nonzero only after iteration ' + 1. Since at the end of iteration ' it is still B[i] = 0 during iteration ' + 1 B[i] gets the value ' + 1 which (cid:74) is never changed in successive iterations. The above corollary suggests the following algorithm to compute bwt01 and lcp01: repeat the procedure of Figure 3 until the iteration h in which all entries in B become nonzero. At that point Z(h) describes how bwt0 and bwt1 should be merged to get bwt01 and for i = 2, . . . , n0 + n1 lcp01[i] = B[i] − 1. The above strategy requires a number of iterations, each one taking O(n0 + n1) time, equal to the maximum of the lcp values, for an overall complexity of O((n0 + n1) maxlcp01), where maxlcp01 = maxi lcp01[i]. Note that in addition to the space for the input and the output the algorithm only uses two bit arrays (one for the current and the next Z(·)) and a constant number of counters (the arrays F and Block_id). Summing up we have the following result. (cid:73) Lemma 5. Given bwt0 and bwt1, the algorithm in Figure 3 computes bwt01 and lcp01 in O(n maxLcp) time and 2n + O(log n) bits of working space, where n = t01 and maxLcp = (cid:74) maxi lcp01[i] is the maximum LCP of t01. The Gap BWT/LCP merging Algorithm 4 The Gap algorithm, as well as its variants described in the following sections, are based on the notion of monochrome blocks. (cid:73) Definition 6. If B['] 6= 0, B[m + 1] 6= 0 and B[' + 1] = ··· = B[m] = 0, we say that block (cid:74) Z(h)[', m] is monochrome if it contains only 0's or only 1's. Since a monochrome block only contains suffixes from either t0 or t1, whose relative order is known, it does not need to be further modified. If in addition, the LCP arrays of t0 and t1 are given in input, then also LCP values inside monochrome blocks are known without further processing. This intuition is formalized by the following lemmas. (cid:73) Lemma 7. If at the end of iteration h bit vector Z(h) contains only monochrome blocks we can compute bwt01 and lcp01 in O(n0 + n1) time from bwt0, bwt1, lcp0 and lcp1. Proof. By Property 1, if we identify the i-th 0 in Z(h) with bwt0[i] and the j-th 1 with bwt1[j] the only elements which could be not correctly sorted by context are those within the same block. However, if the blocks are monochrome all elements belong to either bwt0 or bwt1 so their relative order is correct. To compute lcp01 we observe that if B[i] 6= 0 then by (the proof of) Corollary 4 it is lcp01[i] = B[i] − 1. If instead B[i] = 0 we are inside a block hence sa01[i − 1] and sa01[i] (cid:74) belong to the same string t0 or t1 and their LCP is directly available in lcp0 or lcp1. Notice that a lazy strategy of not completely processing monochrome blocks, makes it impossible to compute LCP values from scratch. In this case, in order to compute lcp01 it is necessary that the algorithm also takes lcp1 and lcp0 in input. (cid:73) Lemma 8. Suppose that, at the end of iteration h, Z(h)[', m] is a monochrome block. Then (i) for g > h, Z(g)[', m] = Z(h)[', m], and (ii) processing Z(h)[', m] during iteration h + 1 creates a set of monochrome blocks in Z(h+1). L. Egidi, G. Manzini 23:9 skip it process block if (processed block is monochrome) then 1: if (next block is irrelevant) then 2: 3: else 4: 5: 6: 7: 8: end if 9: if (last two blocks are irrelevant) then 10: 11: end if merge them mark it irrelevant end if Figure 4 Main loop of the Gap algorithm. The processing of active blocks at Line 4 is done as in Lines 7 -- 20 of Figure 3. Proof. The first part of the Lemma follows from the observation that subsequent iterations of the algorithm will only reorder the values within a block (and possibly create new sub- blocks); but if a block is monochrome the reordering will not change its actual content. For the second part, we observe that during iteration h + 1 as k goes from ' to m the algorithm writes to Z(h+1) the same value which is in Z(h)[', m]. Hence, a new monochrome block will be created for each distinct symbol encountered (in bwt0 or bwt1) as k goes through (cid:74) the range [', m]. The lemma implies that, if block Z(h)[', m] is monochrome at the end of iteration h, starting from iteration g = h + 2 processing the range [', m] will not change Z(g) with respect to Z(g−1). Indeed, by the lemma the monochrome blocks created in iteration h + 1 do not change in subsequent iterations (in a subsequent iteration a monochrome block can be split in sub-blocks, but the actual content of the bit vector does not change). The above observation suggests that, after we have processed block Z(h+1)[', m] in iteration h + 1, we can mark it as irrelevant and avoid to process it again. As the computation goes on, more and more blocks become irrelevant. Hence, at the generic iteration h instead of processing the whole Z(h−1) we process only the blocks which are still "active" and skip irrelevant blocks. Adjacent irrelevant blocks are merged so that among two active blocks there is at most one irrelevant block (the gap after which the algorithm is named). The overall structure of a single iteration is shown in Figure 4. The algorithm terminates when there are no more active blocks since this implies that all blocks have become monochrome and by Lemma 7 we are able to compute bwt01 and lcp01. We point out that at Line 2 of the Gap algorithm we cannot simply skip an irrelevant block ignoring its content. To keep the algorithm consistent we must correctly update the global variables of the main loop, i.e. the array F and the pointers k0 and k1 in Figure 3. To this end a simple approach is to store for each irrelevant block the number of occurrences oc of each symbol c ∈ Σ in it and the pair (r0, r1) providing the number of 0's and 1's in the block (recall that an irrelevant block may consist of adjacent monochrome blocks coming from different strings). When the algorithm reaches an irrelevant block, F, k0, k1 are updated setting k0 ← k0 + r0, k1 ← k1 + r1 and ∀c F[c] ← F[c] + oc. The above scheme for handling irrelevant blocks is simple and effective for most applications. However, for a large non-constant alphabet it would imply a multiplicative O(σ) slowdown. In [8, Sect. 4] we present a different scheme for large alphabets with a slowdown reduced to O(log σ). 23:10 Lightweight merging of compressed indices based on BWT variants We point out that our Gap algorithm is related to the H&M variant with O(n aveLcp) time complexity described in [15, Sect. 2.1]: Indeed, the sorting operations are essentially the same in the two algorithms. The main difference is that Gap keeps explicit track of the irrelevant blocks while H&M keeps explicit track of the active blocks (called buckets in [15]): this difference makes the non-sorting operations completely different. An advantage of working with irrelevant blocks is that they can be easily merged, while this is not the case for the active blocks in H&M. Of course, the main difference is that Gap merges simultaneously BWT and LCP values. (cid:73) Theorem 9. Given bwt0, lcp0 and bwt1, lcp1 let n = bwt0 + bwt1. The Gap algorithm i lcp01[i])/n is the average LCP of the string t01. The working space is 2n + O(log n) bits, plus the space used for handling irrelevant blocks. computes bwt01 and lcp01 in O(n aveLcp01) time, where aveLcp01 = (P of the length of all active blocks is bounded by O(P Proof. For the running time we reason as in [15] and observe that the sum, over all iterations, i lcp01[i]) = O(n aveLcp01). The time bound follows observing that at any iteration the cost of processing an active block of length ' is bounded by O(') time. For the analysis of the working space we observe for the array B we can use the space for the output LCP, hence the working space consists only in 2n bits for two instances of (cid:74) the arrays Z(·) and a constant number of counters (the arrays F and Block_id). It is unfortunately impossible to give a clean bound for the space needed for keeping track of irrelevant blocks. Our scheme uses O(1) words per block, but in the worst case we can have Θ(n) blocks. Although such worst case is rather unlikely, it is important to have some form of control on this additional space. We use the following simple heuristic: we choose a threshold τ and we keep track of an irrelevant block only if its size is at least τ. This strategy introduces a O(τ) time slowdown but ensures that there are at most n/(τ +1) irrelevant blocks simultaneously. The experiments in the next section show that in practice the space used to keep track of irrelevant blocks is less than 10% of the total. Note that also in [15] the authors faced the problem of limiting the memory used to keep track of the active blocks. They suggested the heuristic of keeping track of active blocks only after the h-th iteration (h = 20 for their dataset). 4.1 Experimental Results We have implemented the Gap algorithm in C and tested it on the collections shown in Table 1 which have documents of different size, LCP, and alphabet size. We represented LCP values with the minimum possible number of bytes for each collection: 1 byte for Illumina, 2 bytes for Pacbio and Proteins, and 4 bytes for Wiki-it. We always used 1 byte for each BWT value and n bytes to represent a pair of Z(h) arrays using 4 bits for each entry so that the tested implementation can merge simultaneously up to 16 BWTs. Referring to Table 2, we split each collection into k subcollections of size less than 2GB and we computed the multi-string SA of each subcollection using gSACA-K [23]. From the SA we computed the multi-string BWT and LCP arrays using the Φ algorithm [19] (implemented in gSACA-K). This computation used 13 bytes per input symbol. Then, we merged the subcollections BWTs and LCPs using Gap with different values of the parameter τ which determines the size of the smallest irrelevant block we keep track of. Since skipping a block takes time proportional to σ + k, regardeless of τ Gap never keeps track of blocks L. Egidi, G. Manzini 23:11 Name Pacbio Illumina Wiki-it Proteins Size GB 6.24 7.60 4.01 6.11 σ Max Len 40212 5 6 103 553975 210 26 35991 Ave Len Max LCP 1055 9567.43 102.00 102 93537 4302.84 410.22 25065 Ave LCP 17.99 27.53 61.02 100.60 Table 1 Collections used in our experiments sorted by average LCP. Columns 4 and 5 refer to the lengths of the single documents. Pacbio are NGS reads from a D.melanogaster dataset. Illumina are NGS reads from Human ERA015743 dataset. Wiki-it are pages from Italian Wikipedia. Proteins are protein sequences from Uniprot. Collections and source files are available on https: //people.unipmn.it/manzini/gap. Name Pacbio Illumina Wiki-it Proteins k 7 4 5 4 gSACA-K τ = 50 τ = 100 τ = 200 +Φ 0.46 0.48 0.41 0.59 time 0.41 0.93 -- 3.90 space 4.35 3.31 -- 4.55 time 0.46 1.02 -- 5.18 space 4.18 3.16 time 0.51 1.09 -- 3.07 7.05 4.29 space 4.09 3.08 6.55 4.15 Table 2 For each collection we report the number k of subcollections, the average running time of gSACA-K+Φ in µsecs per symbol, and the running time (µsecs) and space usage (bytes) per symbol for Gap for different values of the τ parameter. All tests were executed on a desktop with 32GB RAM and eight Intel-I7 3.40GHz CPUs, using a single CPU in each experiment. smaller than that threshold; therefore for Wiki-it we performed a single experiment where the smallest irrelevant block size was σ + k = 215. From the results in Table 2 we see that Gap's running time is indeed roughly proportional to the average LCP. For example, Pacbio and Illumina collections both consist of DNA reads but, despite Pacbio reads being longer and having a larger maximum LCP, Gap is twice as fast on them because of the smaller average LCP. Similarly, Gap is faster on Wiki-it than on Proteins despite the latter collection having a smaller alphabet and shorter documents. As expected, the parameter τ offers a time-space tradeoff for the Gap algorithm. In the space reported in Table 2, the fractional part is the peak space usage for irrelevant blocks, while the integral value is the space used by the arrays bwti, B and Z(h). For example, for Wiki-it we use n bytes for the BWTs, 4n bytes for the LCP values (the B array), n bytes for Z(h), and the remaining 0.55n bytes are mainly used for keeping track of irrelevant blocks. This is a relatively high value, about 9% of the total space, since in our current implementation the storage of a block grows linearly with the alphabet size. For DNA sequences and τ = 200 the cost of storing blocks is less than 3% of the total without a significant slowdown in the running time. For completeness, we tested the H&M implementation from [15] on the Pacbio collection. The running time was 14.57 µsecs per symbol and the space usage 2.28 bytes per symbol. These values are only partially significant for several reasons: (i) H&M computes the BWT from scratch, hence doing also the work of gSACA-K, (ii) H&M doesn't compute the LCP array, hence the lower space usage, (iii) the algorithm is implemented in Cython which makes it easier to use in a Python environment but is not as fast and space efficient as C. 23:12 Lightweight merging of compressed indices based on BWT variants id ← k 4: if B2[k] 6= 0 and B2[k] 6= 2 then 5: 6: end if 7: if B2[k] = 1 then 8: 9: end if B2 ← 3 ... 13: if B2[j] = 0 then 14: 15: end if B2[j] ← 2 . A new block of Z(h−1) is starting . Mark the block as old . Check if already marked . A new block of Z(h) will start here Figure 5 Modification of the H&M algorithm to use a two-bit array B2 instead of the integer array B. The code shows the case for h even; if h is odd, the value 2 is replaced by 1 and viceversa. 4.2 Merging only BWTs If we are not interested in LCP values but we only need to merge BWTs, we can still use Gap instead of H&M to do the computation in O(n aveLcp) time. In that case however, the use of the integer array B recording LCP values is wasteful. We can save space replacing it with an array B2[1, n0 + n1 + 1] containing two bits per entry representing four possible states called {0 , 1 , 2 , 3}. The rationale for this is that, if we are not interested in LCP values, the entries of B are only used in Line 4 of Fig. 3 where it is tested whether they are different from 0 or h. During iteration h, the values in B2 are used instead of the ones in B as follows: An entry B2[i] = 0 corresponds to B[i] = 0, an entry B2[i] = 3 corresponds to 0 < B[i] < h−1. If h is even, an entry B2[i] = 2 corresponds to B[i] = h and an entry B2[i] = 1 corresponds to B[i] = h − 1; while if h is odd the correspondence is 2 → h − 1, 1 → h. The array B2 is initialized as 3(0)n0+n1−1(3), and it is updated appropriately in lines 13 -- 14. The reason for this apparently involved scheme is that during iteration h, an entry in B2 can be modified either before or after we read it at Line 4. The resulting code is shown in Fig. 5. Using the array B2 we can still define (and skip) monochrome blocks and therefore achieve the O(n aveLcp) complexity. Notice that, by Corollary 4, the value in B2[i] changes from 0 to 2 or 1 during iteration h = lcp01[i] + 1. Hence, if every time we do such change we write to an external file the pair hi, h − 1i, when the merging is complete the file contains all the information required to compute the LCP array lcp01 even if we do not know lcp0 and lcp1. This idea has been introduced and investigated in [7]. 5 Merging compressed tries Tries [21] are a fundamental data structure for representing a collection of k distinct strings. A trie consists of a rooted tree in which each edge is labeled with a symbol in the input alphabet, and each string is represented by a path from the root to one of the leaves. To simplify the algorithms, and ensure that no string is the prefix of another one, it is customary L. Egidi, G. Manzini 23:13 Last0 0 1 0 0 1 1 1 1 1 1 1 L0 a b a b c # # c # a # Π0  a aa aca b ba ca cb Last1 0 1 0 1 1 1 1 1 1 L1 a b a b c # a # # Π1  a aa ab b ba caa Last01 0 1 0 0 1 0 1 1 1 0 1 1 1 1 1 L01 a b a b c # c # # a c # a # # Π01  a aa ab aca b ba ca caa cb Figure 6 The trie T0 containing the strings aa#, ab#, aca#, bc# (left), the trie T1 containing aac#, ab#, ba# (center) and the trie T01 containing the union of the two set of strings (right). Below each trie we show the corresponding XBWT representation. to add a special symbol # 6∈ Σ at the end of each string.2 Tries for different sets of strings are shown in Figure 6. For any trie node u we write hgt(u) to denote its height, that is the length of the path from the root to u. We define the height of the trie T as the maximum u hgt(u))/T, where T denotes the number of trie nodes. node height hgt(T) = maxu hgt(u), and the average height avehgt(T) = (P The eXtended Burrows-Wheeler Transform [10, 25, 32] is a generalization of the BWT designed to compactly represent any labeled tree T. To define xbwt(T), to each internal node w we associate the string λw obtained by concatenating the symbols in the edges in the upward path from w to the root of T. If T has n internal nodes we have n strings overall; let Π[1, n] denote the array containing such strings sorted lexicographically. Note that Π[1] is always the empty string corresponding to the root of T. For i = 1, . . . , n let L(i) denote the set of symbols labeling the edges exiting from the node corresponding to Π[i]. We define the array L as the concatenation of the arrays L(1), . . . , L(n). If T has m edges (and therefore m + 1 nodes), it is L = m and L contains n − 1 symbols from Σ and 2 In this and in the following section we purposely use a special symbol # different from $. The reason is that $ is commonly used to for sorting purposes, while # simply represents a symbol different from the ones in Σ. baacbc#a###baaba##c#baacbac##a#c### 23:14 Lightweight merging of compressed indices based on BWT variants m+1− n occurrences of #. To keep an explicit representation of the intervals L(1), . . . , L(n) within L, we define a binary array Last[1, m] such that Last[i] = 1 iff L[i] is the last symbol of some interval L(j). See Figure 6 for a complete example. In [9] it is shown that the two arrays xbwt(T) = hLast, Li are sufficient to represent T, and that if they are enriched with data structures supporting constant time rank and select operations, xbwt(T) can be used for efficient upward and downward navigation and for substring search in T. The fundamental property for efficient navigation and search is that there is an one-to-one correspondence between the symbols in L different from # and the strings in Π different from the empty string. The correspondence is order preserving in the sense that the i-th occurrence of symbol c corresponds to the i-th string in Π starting with c. For example, in Figure 6 (right) the third a in Last01 corresponds to the third string in Π01 starting with a, namely ab. Note that ab is the string associated to the node reached by following the edge associated to the third a in L01. In this section, we consider the problem of merging two distinct XBWTs. More formally, let T0 (resp. T1) denote the trie containing the set of strings t1, . . . , tk (resp. s1, . . . , sh), and let T01 denote the trie containing the strings in the union t1,. . . , tk, s1, . . . , sh (see Figure 6). Note that T01 might contain less than h + k strings: if the same string appears in both T0 and T1 it will be represented in T01 only once. Given xbwt(T0) = hLast0, L0i and xbwt(T1) = hLast1, L1i we want to compute the XBWT representation of the trie T01. We observe that if we had at our disposal the sorted string arrays Π0 and Π1, then the construction of xbwt(T01) could be done as follows: First, we merge lexicographically the strings in Π0 and Π1, then we scan the resulting sorted array of strings. During the scan if we find a string appearing only once then it corresponds to an internal node belonging to either T0 or T1; the labels on the outgoing edges can be simply copied from the appropriate range of L0 or L1. if we find two consecutive equal strings they correspond respectively to an internal node in T0 and to one in T1. The corresponding node in T01 has a set of outgoing edges equal to the union of the edges of those nodes in T0 and T1: thus, the labels in the outgoing edges are the union of the symbols in the appropriate ranges of L0 and L1. Although the arrays Π0 and Π1 are not available, by properly modifying the H&M algorithm we can compute how their elements would be interleaved by the merge operation. Let m0 = L0 = Last0, n0 = Π0, and similarly m1 = L1 = Last1, n1 = Π1. Fig. 7 shows the code for the generic h-th iteration of the H&M algorithm adapted for the XBWT. Iteration h computes a binary vector Z(h) containing n0 = t0 0's and n1 = t1 1's and such that the following property holds (compare with Property 1) (cid:73) Property 10. At the end of iteration h, for i = 2, . . . , n0 and j = 2, . . . n1 the i-th 0 precedes the j-th 1 in Z(h) if and only if Π0[i][1, h] (cid:22) Π1[j][1, h]. (8) (cid:74) In (8) Π0[i][1, h] denotes the length-h prefix of Π0[i]. If Π0[i] has length smaller than h then Π0[i][1, h] = Π0[i] (and similarly for Π1[j]). Note that Property 10 does not mention the first 0 and the first 1 in Z(h): By construction it is Π0[1] = Π1[1] =  so we know their lexicographic rank is the smallest possible. Note also that because of Step 3 in Fig. 7, the first 0 and the first 1 in Z(h) are always the first two elements of Z(h). Apart from the first two entries, during iteration h the array Z(h) is logically partitioned into σ subarrays, one for each alphabet symbol different from #. If Occ(c) denotes the number L. Egidi, G. Manzini 23:15 1: Initialize array F[1, σ] 2: k0 ← 1; k1 ← 1 3: Z(h) ← 01 4: for k ← 1 to n0 + n1 do 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: end for b ← Z(h−1)[k] repeat c ← Lb[kb] if c 6= # then j ← F[c]++ Z(h)[j] ← b end if ' ← Lastb[kb++] until ' 6= 1 . Init counters for L0 and L1 . First two entries correspond to Π0[1] = Π1[1] =  . Read bit b from Z(h−1) . Get symbol from L0 or L1 according to b . # is ignored: it is not in Π0 or Π1 . Get destination for b according to symbol c . Copy bit b to Z(h) . Check if c labels last outgoing edge Figure 7 Main loop of algorithm H&M modified to merge XBWTs. Array F is initialized so that F [c] contains the number of occurrences of symbols smaller than c in L0 and L1 plus three, to account for Π0[1] = Π1[1] =  which are smaller than any other string. of occurrences in L0 and L1 of the symbols smaller than c, then the subarray corresponding to c starts at position Occ(c) + 3. Hence, if c < c0 the subarray corresponding to c precedes the one corresponding to c0. Because of how the array F is initialized and updated, we see that every time we read a symbol c from L0 and L1 we write a value in the portion of Z(h) corresponding to c, and that each portion is filled sequentially. Armed with these observations, we are ready to establish the correctness of the algorithm in Figure. 7. (cid:73) Lemma 11. Let Z(0) = 010n0−11n1−1, and let Z(h) be obtained from Z(h−1) by the algorithm in Fig. 7. Then, for h = 0, 1, 2, . . ., the array Z(h) satisfies Property 10. Proof. We prove the result by induction. For h = 0, Π0[i][1, 0] = Π1[j][1, 0] =  so (8) is always true and Z(0) satisfies Property 10. Suppose now h > 0. To prove the "if" part, let 3 ≤ v < w ≤ n0 + n1 denote two indexes such that Z(h)[v] is the i-th 0 and Z(h)[w] is the j-th 1 in Z(h) for some 2 ≤ i ≤ n0 and 2 ≤ j ≤ n1 (it is v ≥ 3 since i ≥ 2 and Z(h)[1, 2] = 01). We need to show that (8) holds. Assume first Π0[i][1] 6= Π1[j][1]. The hypothesis v < w implies Π0[i][1] < Π1[j][1] hence (3) certainly holds. Assume now Π0[i][1] = Π1[j][1] = c. Let v0, w0 denote respectively the values of the main loop variable k in the procedure of Figure 7 when the entries Z(h)[v] and Z(h)[w] are written (hence, during the scanning of Z(h−1)). The hypotheses v < w and Π0[i][1] = Π1[j][1] imply v0 < w0. By construction Z(h−1)[v0] = 0 and Z(h−1)[w0] = 1. Say v0 is the i0-th 0 in Z(h−1) and w0 is the j0-th 1 in Z(h−1). By the inductive hypothesis on Z(h−1) we have Π0[i0][1, h − 1] (cid:22) Π1[j0][1, h − 1] (9) (we could have v0 = 1 that would imply i0 = 1; in that case we cannot apply the inductive hypothesis, but (9) still holds). By the properties of the XBWT we have Π0[i][1, h] = c Π0[i0][1, h − 1] which combined with (9) gives us (8). and Π1[j][1, h] = c Π1[j0][1, h − 1] 23:16 Lightweight merging of compressed indices based on BWT variants For the "only if" part assume (8) holds for some i ≥ 2 and j ≥ 2. We need to prove that in Z(h) the i-th 0 precedes the j-th 1. If Π0[i][1] 6= Π1[j][1] the proof is immediate. If c = Π0[i][1] = Π1[j][1] then Π0[i][2, h] (cid:22) Π1[j][2, h]. Let i0 and j0 be such that Π0[i0][1, h − 1] = Π0[i][2, h] and Π1[j0][1, h − 1] = Π1[j][2, h]. By induction, in Z(h−1) the i0-th 0 precedes the j0-th 1 (again we could have i0 = 1 and in that case we cannot apply the inductive hypothesis, but the claim still holds). During iteration h, the i-th 0 in Z(h) is written to position v when processing the i0-th 0 of Z(h−1), and the j-th 1 in Z(h) is written to position w when processing the j0-th 1 of Z(h−1). Since in Z(h−1) the i0-th 0 precedes the j0-th 1 and since v and w both belongs to the subarray of Z(h) corresponding to the symbol c, their relative order does not change and (cid:74) the i-th 0 precedes the j-th 1 as claimed. As in the original H&M algorithm we stop the merge phase after the first iteration h such that Z(h) = Z(h−1). Since in subsequent iterations we would have Z(g) = Z(h) for any g > h, we get that by Property 10, Z(h) gives the correct lexicographic merge of Π0 and Π1. Note however that the lexicographic order is not sufficient to establish whether two consecutive nodes, say Π0[i] and Π1[j] have the same upward path and therefore should be merged in a single node of T01. To this end, we consider the integer array B used in Section 2.1 to mark the starting point of each block. We have shown in Corollary 4 that at the end of the original H&M algorithm B contains the LCP values plus one. Indeed, at iteration h the algorithm sets B[k] = h since it "discovers" that the suffixes in sa01[k − 1] and sa01[k] differ in the h-th symbol (hence lcp01[k] = h − 1). If we maintain the array B in the XBWT merging algorithm, we get that at the end of the computation if the strings associated to Π0[i] and Π1[j] are identical then the entry in B corresponding to Π1[j] would be zero, since the two strings do not differ in any position. Hence, at the end of the modified H&M algorithm the array Z(h) provides the lexicographic order of the nodes, and the array B the position of the nodes of T0 and T1 with the same upward path. We conclude that with a single scan of Z(h) and B we can merge all paths and compute xbwt(T0). Finally, we observe that instead of B we can use a two-bit array B2 as in Sect. 4.2, since we are only interested in determining whether a certain entry is zero, and not in its exact value. (cid:73) Lemma 12. The modified H&M algorithm computes xbwt(T01) given xbwt(T0) and xbwt(T1) in O(T01hgt(T01)) time and 4n + O(log n) bits of working space, where n = n0 + n1. Proof. Each iteration of the merging algorithm takes O(m0 + m1) time since it consists of a scan of the arrays Z(h−1), L0, L1, Last0 and Last1. After at most hgt(T01) iterations the strings in Π0 and Π1 are lexicographically sorted and Z(h) no longer changes. The final scan of Z(h) and B2 to compute xbwt(T0) takes O(m0 + m1) time. Since T01 ≥ max(m0, m1) the overall cost is O(T01hgt(T01)) time. The working space of the algorithm, consists of B2 and of two instances of the Z(h) array (for the current and the previous iteration), in addition to O(σ) counters (recall that σ is assumed to be constant). (cid:74) As for BWT/LCP merging, we now show how to reduce the running time by skipping the portions of Z(h) that no longer change from one iteration to the next. Note that we cannot use monochrome blocks to early terminate XBWT merging. Indeed, from the previous discussion we know that if two strings Π0[i] and Π1[j] are equal, they will form a non- monochrome block that will never be split. For this reason we introduce an array C[1, n0 + n1] that, at the beginning of iteration h, keeps track of all the strings in Π0 and Π1 that have length less than h. More precisely, for L. Egidi, G. Manzini 23:17 i = 1, . . . , n0 (resp. j = 1, . . . , n1) if the i-th 0 (resp. the j-th 1) is in position k of Z(h), then C[k] = ' > 0 iff the length Π0[i] (resp. Π1[j]) is equal to ' − 1 with ' − 1 < h. As a consequence, if C[k] = 0 then the string corresponding to C[k] has length h or more. Note that by Property 10 at the beginning of iteration h the algorithm has already determined the lexicographic rank of all the strings in Π0 and Π1 of length smaller than h. Hence, the entry in Z(h)[k] will not change in successive iterations and will remain associated to the same string from Π0 or Π1. The array C is initialized as 110n0+n1−2 since at the beginning of iteration 1 it is Z(h) = 010n0−11n1−1 and indeed the only strings of length 0 are Π0[0] = Π1[0] = . During iteration h, we update C adding, immediately after Line 10 in Fig. 7, the line if C[k] = h then C[j] ← h + 1 The rationale is that if, during iteration h− 1 we found out that the string α corresponding to Z(h−1)[k] has length h − 1 (so we set C[k] = h), then the string corresponding to Z(h)[j] is cα and has therefore length h. By the above discussion we see that if at iteration h we write h + 1 to position C[j], then at iteration h + 1 we can possibly use C[j] to write h + 2 in some other position in C, but starting from iteration h + 2 it is no longer necessary to process neither C[j] nor Z(h+2)[j] since they will not affect neither C nor Z(h+3). In other words, during iteration h we can skip all ranges Z(h)[', m] such that C[', m] contains only positive values smaller than h. These ranges grown larger and larger as the algorithm proceeds and are handled in the same way as the irrelevant blocks in Gap. Finally, we observe that, using the same techniques as in Section 4.2, we can replace the integer array C with an array C2 containing only two bits per entry. (cid:73) Theorem 13. The modified Gap algorithm computes xbwt(T01) given xbwt(T0) and xbwt(T1) in O(T01avehgt(T01)) time. The working space is 6n + O(log n) bits, where n = n0 + n1, plus the space required for handling irrelevant blocks. Proof. The analysis is similar to the one in Theorem 9. Here the algorithm executes hgt(T01) iterations; however, because of irrelevant blocks, iterations have decreasing costs. To bound the overall running time, observe that the cost of each iteration is dominated by the cost of processing the entries in L0 and L1. The generic entry L0[i] corresponds to a trie node ui with upward path of length hgt(ui). Entry L0[i] is processed when the Gap algorithm reaches the entry in Z(h) corresponding to the string Π1[i0] associated to ui's parent. We know that Z(h)'s entry corresponding to Π1[i0] becomes irrelevant after iteration Π1[i0] + 1 = hgt(ui). Hence, the overall cost of processing ui is O(hgt(ui)). Summing over all entries in L0 and L1 the total cost is O(T0avehgt(T0) + T1avehgt(T1)). The thesis follows observing that (cid:74) T01avehgt(T01) ≥ max(cid:0)T0avehgt(T0),T1avehgt(T1)(cid:1). 6 Merging indices for circular patterns Another well known variant of the BWT is the multistring circular BWT which is defined by sorting the cyclic rotations of the input strings instead of their suffixes. However, to make the transformation reversible, the cyclic rotations have to be sorted according to an order relation, different from the lexicographic order, that we now quickly review. For any string t, we define the infinite form t∞ of t as the infinite length string obtained concatenating t to itself infinitely many times. Given two strings t and s we write t (cid:22)∞ s to denote that t∞ (cid:22) s∞. For example, for t = abaa and s = aba, it is t∞ = abaaabaa··· 23:18 Lightweight merging of compressed indices based on BWT variants and s∞ = abaabaaba··· so t (cid:22)∞ s. Notice that t∞ = s∞ does not necessarily imply that t = s. For example, for t = ababab and s = abab it is t∞ = s∞. The following lemma, which is a consequence of Fine and Wilf Theorem [36] and a restatement of Proposition 5 in [24], provides an upper bound to the number of comparisons required to establish whether t∞ = s∞. (cid:73) Lemma 14. If t∞ 6= s∞ then there exists an index i ≤ t + s − gcd(t,s) such that t∞[i] 6= s∞[i]. (cid:74) A string is primitive if all its cyclic rotations are distinct. The following Lemma is another well known consequence of the Fine and Wilf Theorem. (cid:73) Lemma 15. If t and s are primitive, t∞ = s∞ implies t = s. (cid:74) Let t0[1, n0], t1[1, n1] be two primitive strings and t01[1, n] their concatenation of length n = n0 + n1. For i = 1, . . . , n, let rot01(i) define the rotation of substrings t0 and t1 within t01 as follows: (t0[i, n0]t0[1, i − 1] rot01(i) = t1[i − n0, n1]t1[1, i − n0 − 1] if 0 < i ≤ n0 if n0 < i ≤ n0 + n1. For example, if t0 = abc and t1 = abbb, it is rot01(2) = bca and rot01(7) = babb. The above definition of rotations of substrings can be obviously generalized to a collection of k strings. In addition to assuming that t0 and t1 are primitive, we assume that t0 is not a rotation of t1. We define the circular Suffix Array of t0 and t1, csa01 as the permutation of [1, n] such that: rot01(csa01[i]) (cid:22)∞ rot01(csa01[i + 1]). (10) Note that because of our assumptions and Lemma 15, the inequality in (10) is always strict. Finally, the multistring circular Burrows-Wheeler Transform (cBWT) is defined as  cbwt01[i] = t0[n0] t0[csa01[i] − 1] t1[n1] t1[csa01[i] − n0 − 1] if csa01[i] = 1 if 1 < csa01[i] ≤ n0 if csa01[i] = n0 + 1 if csa01[i] > n0 + 1. The above definition given for t0 and t1 can be generalized to any number of strings. The (cid:22)∞ order and the above multistring circular BWT has been introduced in [24]. In [11] the authors uses a data structure equivalent to a circular BWT to design a compressed permuterm index for prefix/suffix queries. The crucial observation is that if we add a unique symbol # at the end of each string, the same symbol for every string, then searching β#α in a circular BWT returns all the strings prefixed by α and suffixed by β. In [17] Hon et al. use the circular BWT to design a succinct index for circular patterns. Note that Hon et al. in addition to cbwt01 use an additional data structure length01 such that length01(i) provides the length of the string tj to which the symbol cbwt01[i] belongs. Finally, a lightweight algorithm for the construction of the circular BWT has been described in [18]: for a string of length n the proposed algorithm takes O(n) time and uses O(n log σ) bits of space. the (cid:22)∞ order. For any pair of strings t, s we define if t∞ 6= s∞ t + s − gcd(t,s) otherwise. To simplify our analysis, we preliminary extend the concept of longest common prefix to (LCP(t∞, s∞) cLCP(t, s) = (11) L. Egidi, G. Manzini 23:19 Because of Lemma 14, cLCP(t, s) generalizes the standard LCP in that it provides the number of comparisons that are necessary in order to establish the (cid:22)∞ ordering between t, s. It is then natural to define for i = 2, . . . , n clcp01[i] = cLCP(rot01(csa01[i − 1]), rot01(csa01[i])) and the values maxcLcp = maxi clcp01[i], avecLcp =(cid:0)X clcp01[i](cid:1)/n. i (12) (13) that generalize the standard notions of maximum LCP and average LCP. Let cbwt0 (resp. cbwt1) denote the circular BWT for the collection of strings t1, . . . , tk (resp. s1, . . . , sh). In this section we consider the problem of computing the circular BWT cbwt01 for the union collection t1,. . . , tk, s1, . . . , sh. As we previously observed, we assume that all strings are primitive and that within each input collection no string is the rotation of another. However, we cannot rule out the possibility that some ti is the rotation of some sj. The merging algorithm should therefore recognize this occurrence and eliminate from the union one of the two strings, say sj. In practice, this means that all symbols of cbwt1 coming from sj must not be included in cbwt01. To merge cbwt0 and cbwt1 we need to merge their symbols according to their context. By construction, the context of cbwt0[i] (resp. cbwt1[j]) is rot0(csa0[i]) (resp. rot1(csa1[j])), where rot0(csa0[i]) is a cyclic rotation of the string tk to which the symbol cbwt0[i] belongs (and similarly for rot1(csa1[j])). Note however, that context must be sorted according to the ≺∞ order; hence cbwt0[i] should precede cbwt1[j] in cbwt01 iff rot0(csa0[i]) (cid:22)∞ rot1(csa1[j]). The good news is that the H&M algorithm, as described in Figure 2, when applied to cbwt0 and cbwt1 will sort each symbol according to the (cid:22)∞ order of its context. Notice that the (cid:22)∞ order induces a significant difference with respect to the merging of BWTs: indeed, since there are no $'s in cbwt0 and cbwt1 Line 9 is never executed and the destination of each symbol is always determined by its predecessor in the cyclic rotation. More formally, reasoning as in Lemma 2, it is possible to prove the following property. (cid:73) Property 16. For i = 1, . . . , n0 and j = 1, . . . n1 the i-th 0 precedes the j-th 1 in Z(h) if and only if rot0(csa0[i])∞[1, h] (cid:22) rot1(csa1[j])∞[1, h]. (14) (cid:74) Property 16 states that after iteration h the infinite strings rot0(csa0[i])∞ and rot1(csa1[j]) have been sorted according to their length h prefix. As for the original H&M algorithm, as soon as Z(h+1) = Z(h) the Z(·) array will not change in any successive iteration and the merging is complete. By Lemma 14 it is Z(h+1) = Z(h) for some h ≤ maxcLcp. Since we do not simply need to sort the context, but also recognize if some string ti is a rotation of some sj, we make use of the algorithm in Figure 3 which, in addition to Z(h), also computes the integer array B that marks the boundaries of the groups of all rotations whose infinite form have a common prefix of length h. We can prove a result analogous to Lemma 3 replacing the LCP between suffixes (lcp01) with the LCP between the infinite strings rotb(csab[i])∞ (that is clcp01). After iteration h = maxcLcp all distinct rotations have been sorted according to the (cid:22)∞ order; thus an entry B[k] = 0 denotes two rota- tions rot0(csa0[i])∞ and rot1(csa1[j])∞ which have a common prefix of length maxcLcp. By Lemma 14 it is rot0(csa0[i])∞ = rot1(csa1[j])∞ and by Lemma 15 rot0(csa0[i]) = rot1(csa1[j]). 23:20 Lightweight merging of compressed indices based on BWT variants The two rotations are therefore identical and the symbol cbwt1[j] should not be included in cbwt01. Summing up, to merge cbwt0 and cbwt1 we execute the procedure of Figure 3 until both Z(h) and B do not change. Then, we compute cbwt01 by merging cbwt0 and cbwt1 accord- ing to Z(h), discarding those symbols corresponding to zero entries in B. The number of iterations will be at most maxcLcp. In addition, since we are only interested in zero/nonzero entries, instead of B we can use a 2-bit array B2 as in Section 4.2. Reasoning as for Lemma 5, setting n = n0 + n1 we get the following result. (cid:73) Lemma 17. The modified H&M algorithm computes cbwt01 given cbwt0 and cbwt1 in O(n maxcLcp) time and 4n + O(log n) bits of working space. (cid:74) As we have done in the previous sections, we now show how to reduce the running time of the merging algorithm by avoiding to re-process the blocks of Z(h−1) that have become irrelevant for the computation of the new bitarray Z(h). Reasoning as in Section 4 we observe that monochrome blocks, i.e. blocks containing entries only from cbwt0 or cbwt1, after having been processed once, become irrelevant and can be skipped in successive iterations. Note however, that whenever rot0(csa0[i])∞ = rot1(csa1[j])∞ these two entries will always belong to the same block. To handle this case we first assume cbwt01 is to be used as a compressed index for circular patterns [17] and we later consider the case in which cbwt01 is to be used for a compressed permuterm index. 6.1 Compressed indices of circular patterns In this setting, cbwt01 is to be used as a compressed index for circular patterns and there- fore we have access to the length0 and length1 data structures providing the length of each rotation. Under this assumption we modify the Gap algorithm described in Section 4 as fol- lows: in addition to skipping monotone blocks, every time there is a size-2 non monochrome block containing, say cbwt0[i] and cbwt1[j], we mark it as quasi-irrelevant and compute 'ij = length0(i) + length1(j) − gcd(length0(i),length1(j)). As soon as this block is split or we reach iteration 'ij the block becomes irrelevant and is skipped in successive itera- tions. As in the original Gap algorithm, the computation stops when all blocks have become irrelevant. For simplicity, in the next theorem we assume that the access to the data structures length0 and length1 takes constant time. If not, and random access to the individual lengths takes O(ρ) time, the overall cost of the algorithm is increased by O((n0 + n1)ρ) since each length is computed at most once. (cid:73) Theorem 18. The modified Gap algorithm computes hcbwt01, length01i given hcbwt0, length0i and hcbwt1, length1i in O(n avecLcp) time, where n = n0 + n1. The working space is 2n + O(log n) bits plus the space required for handling (quasi-)irrelevant blocks. Proof. If rot01(csa01[k]) is different from any other rotation, by definitions (11) and (12) after at most max(clcp01[k], clcp01[k + 1]) iterations it will be in a monochrome (possibly singleton) block. If instead rot01(csa01[k]) is identical to another rotation, which can only be either rot01(csa01[k − 1]) or rot01(csa01[k + 1]), then after at most max(clcp01[k − 1], clcp01[k], clcp01[k + 1], clcp01[k + 2]) (15) iterations it will be in a size-2 non-monochrome block together with its identical rotation. In either case, the block containing rot01(csa01[k]) will become irrelevant and it will be no L. Egidi, G. Manzini 23:21 longer processed in successive iterations. Hence, the overall cost of handling rot01(csa01[k]) over all iterations is proportional to (15), and the overall cost of handling all rotations is bounded by O(n avecLcp) as claimed. Note that the final bitarray Z(h) describes also how (cid:74) length0 and length1 must be interleaved to get length01. 6.2 Compressed permuterm indices Finally, we consider the case in which cbwt01 is to be used as the core of a compressed permuterm index [11]. In this case we do not have the length0 and length1 data structures, but each string in the collection is terminated by a unique # symbol. In this case, to recognize whether a size-2 non-monochrome block contains two identical rotations, we make use of the following lemma. (cid:73) Lemma 19. Let t and s denote two strings each one containing a single occurrence of the symbol #. If for some h > 0 it is t∞[1, h] = s∞[1, h] and t∞[1, h] contains two occurrences of #, then t = s. Proof. Let δ denote the distance between the two occurrences of # in t∞[1, h]. Since t (cid:74) contains a single #, we have t = t∞[1, δ] = s∞[1, δ] = s. The above lemma suggests to design a #Gap algorithm to merge compressed permuterm indices in which the arrays Z(·) are arrays of pairs so that they keep track also of the number of # in each prefix. In the following Z(h)[k] = hb, mi means that the k-th rotation belongs to csab, and among the first h symbols of the infinite form of that rotation there are exactly m occurrences of #. Formally, for h = 0, 1, 2, . . . the array Z(h) satisfies the following property. (cid:73) Property 20. At the end of iteration h of #Gap Property 16 holds and if Z(h)[k] = hb, mi (cid:74) is the i-th b in Z(h) then rotb(csab[i])∞[1, h] contains exactly m copies of symbol #. Initially we set Z(0) = h0, 0in0h1, 0in1 which clearly satisfies Property 20. At each iteration #Gap reads Z(h−1) and updates Z(h) using Lines 7 -- 15 below instead of Lines 7 -- 14 of Figure 3: 7: hb, mi ← Z(h−1)[k] 8: c ← bwtb[kb++] ... 14: if c = # then m ← m + 1 15: Z(h)[j] ← hb, mi . Get c according to b . Update number of # Reasoning as in the previous sections, one can prove by induction that with this modification the array Z(h) computed by #Gap satisfies Property 20. In the #Gap algorithm a block becomes irrelevant when it is monochrome or it is a size-2 non-monochrome block Z(h)[k, k+ 1] such that Z(h)[k] = h0, 2i and Z(h)[k + 1] = h1, 2i. By Lemma 19 such block corresponds to two identical rotations rot0(csa0[i]) = rot1(csa1[j]) and after being processed a final time it can be ignored in successive iterations. In the practical implementation of the #Gap algorithm, instead of maintaining the pairs hb, mi, we maintain two bit arrays Z(h−1), Z(h) as in Gap, and an additional 2-bit array C containing the second component of the pairs. For such array C two bits per entry are sufficient since the values stored in each entry C[k] never decrease and they are no longer updated when they reach the value 2. (cid:73) Theorem 21. The #Gap algorithm merges two compressed permuterm indices cbwt0 and cbwt1 in O(n avecLcp) time, where n = n0 + n1. The working space is 6n + O(log n) bits plus the space required for handling irrelevant blocks. 23:22 Lightweight merging of compressed indices based on BWT variants Proof. We reason as in the proof of Theorem 18 except that if rot01(csa01[k]) = rot01(csa01[k+ 1]) we are guaranteed that the corresponding size-2 block will become irrelevant only after iteration h = 2rot01(csa01[k]) = 2 clcp01[k + 1]. Hence, the cost of handling rot01(csa01[k]) is still proportional to (15) and the overall cost of the algorithm is O(n avecLcp) time. The space usage is the same as in Theorem 18, except for the 2n additional bits for the C (cid:74) array. References 1 Djamal Belazzougui. Linear time construction of compressed text indices in compact space. In STOC, pages 148 -- 193. ACM, 2014. 2 Christina Boucher, Alexander Bowe, Travis Gagie, Simon J. Puglisi, and Kunihiko Sadakane. Variable-order de Bruijn graphs. In DCC, pages 383 -- 392. IEEE, 2015. 3 Alexander Bowe, Taku Onodera, Kunihiko Sadakane, and Tetsuo Shibuya. Succinct de Bruijn graphs. In WABI, volume 7534 of Lecture Notes in Computer Science, pages 225 -- 235. Springer, 2012. 4 M. Burrows and D. Wheeler. A block-sorting lossless data compression algorithm. Technical Report 124, Digital Equipment Corporation, 1994. 6 7 5 Anthony J. Cox, Fabio Garofalo, Giovanna Rosone, and Marinella Sciortino. Lightweight LCP construction for very large collections of strings. J. Discrete Algorithms, 37:17 -- 33, 2016. Lavinia Egidi, Felipe Alves Louza, and Giovanni Manzini. Space-efficient merging of suc- cinct de Bruijn graphs. CoRR, 2019. URL: https://arxiv.org/abs/1902.02889. Lavinia Egidi, Felipe Alves Louza, Giovanni Manzini, and Guilherme P. Telles. External memory BWT and LCP computation for sequence collections with applications. In WABI, volume 113 of LIPIcs, pages 10:1 -- 10:14. Schloss Dagstuhl - Leibniz-Zentrum fuer Inform- atik, 2018. Lavinia Egidi and Giovanni Manzini. Lightweight BWT and LCP merging via the gap algorithm. In SPIRE, volume 10508 of Lecture Notes in Computer Science, pages 176 -- 190. Springer, 2017. P. Ferragina, F. Luccio, G. Manzini, and S. Muthukrishnan. Structuring labeled trees for optimal succinctness, and beyond. In Proc. 46th IEEE Symposium on Foundations of Computer Science (FOCS), pages 184 -- 193, 2005. Paolo Ferragina, Fabrizio Luccio, Giovanni Manzini, and S. Muthukrishnan. Compressing and indexing labeled trees, with applications. J. ACM, 57(1):4:1 -- 4:33, 2009. Paolo Ferragina and Rossano Venturini. The compressed permuterm index. ACM Trans. Algorithms, 7(1):10:1 -- 10:21, 2010. J. Fuentes-Sepúlveda, G. Navarro, and Y. Nekrich. Space-efficient computation of the Burrows-Wheeler Transform. In Proc. 29th Data Compression Conference (DCC), 2019. To appear. 8 9 10 11 12 13 Travis Gagie, Giovanni Manzini, and Jouni Sirén. Wheeler graphs: A framework for bwt- 14 15 16 based data structures. Theor. Comput. Sci., 698:67 -- 78, 2017. Simon Gog and Enno Ohlebusch. Compressed suffix trees: Efficient computation and storage of LCP-values. ACM Journal of Experimental Algorithmics, 18, 2013. doi:10. 1145/2444016.2461327. James Holt and Leonard McMillan. Constructing Burrows-Wheeler transforms of large string collections via merging. In BCB, pages 464 -- 471. ACM, 2014. James Holt and Leonard McMillan. Merging of multi-string BWTs with applications. Bioinformatics, 30(24):3524 -- 3531, 2014. L. Egidi, G. Manzini 23:23 17 W.-K. Hon, C.-H. Lu, R. Shah, and S.V. Thankachan. Succinct indexes for circu- lar patterns. In Algorithms and Computation - 22nd International Symposium, ISAAC 2011, Yokohama, Japan, December 5-8, 2011. Proceedings, pages 673 -- 682, 2011. doi: 10.1007/978-3-642-25591-5_69. 18 Wing-Kai Hon, Tsung-Han Ku, Chen-Hua Lu, Rahul Shah, and Sharma V. Thankachan. Efficient algorithm for circular burrows-wheeler transform. In CPM, volume 7354 of Lecture Notes in Computer Science, pages 257 -- 268. Springer, 2012. J. Kärkkäinen, G. Manzini, and S. Puglisi. Permuted longest-common-prefix array. In Proc. 20th Symposium on Combinatorial Pattern Matching (CPM), pages 181 -- 192. Springer- Verlag, LNCS n. 5577, 2009. Juha Kärkkäinen and Dominik Kempa. LCP array construction in external memory. ACM Journal of Experimental Algorithmics, 21(1):1.7:1 -- 1.7:22, 2016. 21 D. E. Knuth. Sorting and Searching, volume 3 of The Art of Computer Programming. 20 19 Addison-Wesley, Reading, MA, USA, second edition, 1998. 23 22 Martine Léonard, Laurent Mouchard, and Mikaël Salson. On the number of elements to reorder when updating a suffix array. J. Discrete Algorithms, 11:87 -- 99, 2012. doi: 10.1016/j.jda.2011.01.002. Felipe Alves Louza, Simon Gog, and Guilherme P. Telles. Induced suffix sorting for string collections. In DCC, pages 43 -- 52. IEEE, 2016. Sabrina Mantaci, Antonio Restivo, Giovanna Rosone, and Marinella Sciortino. An extension of the Burrows-Wheeler transform. Theor. Comput. Sci., 387(3):298 -- 312, 2007. 25 Giovanni Manzini. XBWT tricks. In SPIRE, volume 9954 of Lecture Notes in Computer 24 Science, pages 80 -- 92, 2016. 26 Martin D. Muggli and Christina Boucher. Succinct de Bruijn graph construction for massive populations through space-efficient merging. bioRxiv, 2017. doi:10.1101/229641. 28 29 27 Martin D. Muggli, Alexander Bowe, Noelle R. Noyes, Paul S. Morley, Keith E. Belk, Robert Raymond, Travis Gagie, Simon J. Puglisi, and Christina Boucher. Succinct colored de Bruijn graphs. Bioinformatics, 33(20):3181 -- 3187, 2017. J. Ian Munro, Gonzalo Navarro, and Yakov Nekrich. Space-efficient construction of com- pressed indexes in deterministic linear time. In SODA, pages 408 -- 424. SIAM, 2017. Joong Chae Na, Hyunjoon Kim, Seunghwan Min, Heejin Park, Thierry Lecroq, Martine Léonard, Laurent Mouchard, and Kunsoo Park. FM-index of alignment with gaps. Theor- etical Computer Science, 710:148 -- 157, feb 2018. doi:10.1016/j.tcs.2017.02.020. Joong Chae Na, Hyunjoon Kim, Heejin Park, Thierry Lecroq, Martine Léonard, Laurent Mouchard, and Kunsoo Park. FM-index of alignment: A compressed index for similar strings. Theoretical Computer Science, 638:159 -- 170, 2016. 31 G. Navarro and V. Mäkinen. Compressed full-text indexes. ACM Computing Surveys, 30 32 33 34 35 39(1), 2007. Enno Ohlebusch, Stefan Stauss, and Uwe Baier. Trickier XBWT tricks. In SPIRE, volume 11147 of Lecture Notes in Computer Science, pages 325 -- 333. Springer, 2018. Jouni Sirén. Compressed suffix arrays for massive data. In Proc. 16th Int. Symp. on String Processing and Information Retrieval (SPIRE '09), pages 63 -- 74. Springer Verlag LNCS n. 5721, 2009. Jouni Sirén. Burrows-Wheeler transform for Terabases. In IEEE Data Compression Con- ference (DCC), pages 211 -- 220, 2016. Jouni Sirén. Indexing variation graphs. In Proc. 19th Meeting on Algorithm Engineering and Experiments (ALENEX '17), pages 13 -- 27. SIAM, 2017. 36 H.S. Wilf and N.J. Fine. Uniqueness theorem for periodic functions. Proc. Amer. Math. Soc., 16:109 -- 114, 1965.
1609.01361
1
1609
2016-09-06T01:14:30
Fourier-sparse interpolation without a frequency gap
[ "cs.DS" ]
We consider the problem of estimating a Fourier-sparse signal from noisy samples, where the sampling is done over some interval $[0, T]$ and the frequencies can be "off-grid". Previous methods for this problem required the gap between frequencies to be above 1/T, the threshold required to robustly identify individual frequencies. We show the frequency gap is not necessary to estimate the signal as a whole: for arbitrary $k$-Fourier-sparse signals under $\ell_2$ bounded noise, we show how to estimate the signal with a constant factor growth of the noise and sample complexity polynomial in $k$ and logarithmic in the bandwidth and signal-to-noise ratio. As a special case, we get an algorithm to interpolate degree $d$ polynomials from noisy measurements, using $O(d)$ samples and increasing the noise by a constant factor in $\ell_2$.
cs.DS
cs
Fourier-sparse interpolation without a frequency gap Xue Chen∗ Daniel M. Kane [email protected] The University of Texas at Austin [email protected] University of California, San Diego Eric Price Zhao Song [email protected] The University of Texas at Austin [email protected] The University of Texas at Austin September 7, 2016 Abstract We consider the problem of estimating a Fourier-sparse signal from noisy samples, where the sampling is done over some interval [0, T ] and the frequencies can be "off-grid". Previous methods for this problem required the gap between frequencies to be above 1/T , the threshold required to robustly identify individual frequencies. We show the frequency gap is not necessary to estimate the signal as a whole: for arbitrary k-Fourier-sparse signals under (cid:96)2 bounded noise, we show how to estimate the signal with a constant factor growth of the noise and sample complexity polynomial in k and logarithmic in the bandwidth and signal-to-noise ratio. As a special case, we get an algorithm to interpolate degree d polynomials from noisy mea- surements, using O(d) samples and increasing the noise by a constant factor in (cid:96)2. 6 1 0 2 p e S 6 ] S D . s c [ 1 v 1 6 3 1 0 . 9 0 6 1 : v i X r a ∗Supported by NSF Grant CCF-1526952. Contents 1 Introduction 1.1 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Our techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Proof Sketch 3 Preliminaries 3.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Facts about the Fourier transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Tools and inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Legendre polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5 Gram matrix and its determinant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Robust Polynomial Interpolation Algorithm 4.1 Constant success probability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Boosting success probability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 6 9 9 12 12 13 14 15 15 16 16 18 5 Bounding the Magnitude of a Fourier-sparse Signal in Terms of Its Average Norm 20 20 22 5.1 Bounding the maximum inside the interval . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Bounding growth outside the interval . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Hash Functions and Filter Functions 6.1 Permutation function and hash function . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Filter function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 HashToBins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Frequency Recovery 7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Analysis of GetLegal1Sample and GetEmpirical1Energy . . . . . . . . . . 7.3 A cluster of frequencies, times H, is a one-cluster signal per Definition 7.1 . . . . . . 7.4 Frequency recovery of one-cluster signals . . . . . . . . . . . . . . . . . . . . . . . . . 7.5 The full signal, after multiplying by H and convolving with G, is one-clustered. . . . 7.6 Frequency recovery of k-clustered signals . . . . . . . . . . . . . . . . . . . . . . . . . 7.7 Time and sample complexity of frequency recovery of k-clustered signals . . . . . . . 8 One-cluster Signal Recovery 8.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2 Bounding the Gram matrix determinant . . . . . . . . . . . . . . . . . . . . . . . . . 8.3 Perturbing the frequencies does not change the subspace much . . . . . . . . . . . . 8.4 Existence of nearby k-Fourier-sparse signal with frequency gap bounded away from zero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5 Approximating k-Fourier-sparse signals by polynomials . . . . . . . . . . . . . . . . . 8.6 Transferring degree-d polynomial to (d+1)-Fourier-sparse signal . . . . . . . . . . . . 23 23 23 24 25 26 27 31 32 35 39 40 41 41 42 43 45 46 47 1 49 49 50 51 52 54 58 58 61 64 64 65 66 67 67 67 68 68 68 78 79 80 84 84 9 k-cluster Signal Recovery 9.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 Heavy clusters separation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3 Approximating clusters by polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4 Main result, with constant success probability . . . . . . . . . . . . . . . . . . . . . . 9.5 Boosting the success probability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A Technical Proofs A.1 Proof of Theorem 8.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2 Proofs of Lemma 5.3 and Lemma 5.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.3 Proof of Lemma 4.3 A.4 Proof of Lemma 6.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.5 Proof of Lemma 3.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.6 Proof of Lemma 3.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B Known Facts B.1 Inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.2 Linear regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.3 Multipoint evaluation of a polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . C Analysis of Hash Functions and Filter Functions C.1 Analysis of filter function (H(t), (cid:98)H(f )) . . . . . . . . . . . . . . . . . . . . . . . . . . C.2 Analysis of filter function (G(t),(cid:98)G(f )) . . . . . . . . . . . . . . . . . . . . . . . . . . C.3 Parameters setting for filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.4 Analysis of HashToBins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D Acknowledgments E Algorithm 2 Introduction 1 In an interpolation problem, one can observe x(t) = x∗(t) + g(t), where x∗(t) is a structured signal and g(t) denotes noise, at points ti of one's choice in some interval [0, T ]. The goal is to recover an estimate (cid:101)x of x∗ (or of x). Because we can sample over a particular interval, we would like our approximation to be good on that interval, so for any function y(t) we define (cid:107)y(cid:107)2 T = y(t)2dt. 1 T (cid:90) T 0 to be the (cid:96)2 error on the sample interval. For some parameters C and δ, we would then like to get ∗ (cid:107)T ≤ C (cid:107)g(cid:107)T + δ (cid:107)x ∗ (cid:107)T (1) (cid:107)(cid:101)x − x while minimizing the number of samples and running time. Typically, we would like C to be O(1) and to have δ be very small (either zero, or exponentially small). Note that, if we do not care about changing C by O(1), then by the triangle inequality it doesn't matter whether we want to estimate Of course, to solve an interpolation problem one also needs x∗ to have structure. One common form of structure is that x∗ have a sparse Fourier representation. We say that a function x∗ is k-Fourier-sparse if it can be expressed as a sum of k complex exponentials: x∗ or x (i.e. we could replace the LHS of (1) by (cid:107)(cid:101)x − x(cid:107)T ). ∗ x (t) = vje2πifj t. k(cid:88)j=1 for some vj ∈ C and fj ∈ [−F, F ], where F is the "bandlimit". Given F , T , and k, how many samples must we take for the interpolation (1)? If we ignore sparsity and just use the bandlimit, then Nyquist sampling and Shannon-Whittaker interpolation uses F T + 1/δ samples to achieve (1). Alternatively, in the absence of noise, x∗ can be found from O(k) samples by a variety of methods, including Prony's method from 1795 or Reed-Solomon syndrome decoding [Mas69], but these methods are not robust to noise. If the signal is periodic with period T -i.e., the frequencies are multiples of 1/T -then we can use sparse discrete Fourier transform methods, which take O(k logc(F T /δ)) time and samples (e.g. [GGI+02, HIKP12a, IKP14]). If the frequencies are not multiples of 1/T (are "off the grid"), then the discrete approximation is only k/δ sparse, making the interpolation less efficient; and even this requires that the frequencies be well separated. A variety of algorithms have been designed to recover off-grid frequencies directly, but they require the minimum gap among the frequencies to be above some threshold. With frequency gap at least 1/T , we can achieve a kc approximation factor using O(F T ) samples [Moi15], and with gap above O(log2 k)/T we can get a constant approximation using O(k logc(F T /δ)) samples and time [PS15]. Having a dependence on the frequency gap is natural. If two frequencies are very close together- significantly below 1/T -then the corresponding complex exponentials will be close on [0, T ], and hard to distinguish in the presence of noise. In fact, from a lower bound in [Moi15], below 1/T frequency gap one cannot recover the frequencies in the presence of noise as small as 2−Ω(k). The lower bound proceeds by constructing two signals using significantly different frequencies that are exponentially close over [0, T ]. But if two signals are so close, do we need to distinguish them? Such a lower bound doesn't apply to the interpolation problem, it just says that you can't solve it by finding the frequencies. 3 Our question becomes: can we benefit from Fourier sparsity in a regime where we can't recover the individual frequencies? We answer in the affirmative, giving an algorithm for the interpolation using O(poly(k log(F T /δ)) ∗ (cid:107)T (cid:107)T . (cid:107)(cid:101)x − x ∗ (cid:46) (cid:107)g(cid:107)T + δ (cid:107)x samples. Our main theorem is the following: Theorem 1.1. Let x(t) = x∗(t) + g(t), where x∗ is k-Fourier-sparse signal with frequencies in [−F, F ]. Given samples of x over [0, T ] we can output (cid:101)x(t) such that with probability at least 1 − 2−Ω(k), Our algorithm uses poly(k, log(1/δ)) · log(F T ) samples and poly(k, log(1/δ)) · log2(F T ) time. The output (cid:101)x is poly(k, log(1/δ))-Fourier-sparse signal. Degree d polynomials are the special case of d-Fourier-sparse functions in the limit of fj → 0, by a Taylor expansion. This is a regime with no frequency gap, so previous sparse Fourier results would not apply but Theorem 1.1 shows that poly(d log(1/δ)) samples suffices. In fact, in this special case we can get a better polynomial bound: Theorem 1.2. For any degree d polynomial P (t) and an arbitrary function g(t), Procedure Ro- bustPolynomialLearning in Algorithm 5 takes O(d) samples from x(t) = P (t) + g(t) over [0, T ] and reports a degree d polynomial Q(t) in time O(dω) such that, with probability at least 99/100, Relative to previous work, this result avoids the need for a frequency gap, but loses a polynomial factor in the sample complexity and time. We lose polynomial factors in a number of places; some of these are for ease of exposition, but others are challenging to avoid. where ω < 2.373 is matrix multiplication exponent [Str69],[CW87],[Wil12]. (cid:107)P (t) − Q(t)(cid:107)2 T (cid:46) (cid:107)g(t)(cid:107)2 T . We also show how to reduce the failure probability to an arbitrary p > 0 with O(log(1/p)) independent repetitions, in Theorem 4.5. Although we have not seen such a result stated in the literature, our method is quite similar to one used in [CDL13]. Since d samples are necessary to interpolate a polynomial without noise, the result is within constant factors of optimal. One could apply Theorem 1.2 to approximate other functions that are well approximated by polynomials or piecewise polynomials. For example, a Gaussian of standard deviation at least σ + log(1/δ)); hence the same bound applies can be approximated by a polynomial of degree O((cid:0) T σ(cid:1)2 as the sample complexity of improper interpolation of a positive mixture of Gaussians. 1.1 Related work Sparse discrete Fourier transforms. There is a large literature on sparse discrete Fourier transforms. Results generally are divided into two categories: one category of results that carefully choose measurements that allow for sublinear recovery time, including [GGI+02, GMS05, HIKP12b, Iwe13, HIKP12a, IK14, IKP14, Kap16]. The other category of results expect randomly chosen measurements and show that a generic recovery algorithm such as (cid:96)1 minimization will work with high probability; these results often focus on proving the Restricted Isometry Property [CRT06, RV08, Bou14, HR15]. At the moment, the first category of results have better theoretical sample complexity and running time, while results in the second category have better failure probabilities and empirical performance. Our result falls in the first category. The best results here can achieve O(k log n) samples [IK14], O(k log2 n) time [HIKP12b], or within log log n factors of both [IKP14]. 4 For signals that are not periodic, the discrete Fourier transform will not be sparse: it takes k/δ frequencies to capture a 1 − δ fraction of the energy. To get a better dependence on δ, one has to consider frequencies "off the grid", i.e. that are not multiples of 1/T . Off the grid. Finding the frequencies of a signal with sparse Fourier transform off the grid has been a question of extensive study. The first algorithm was by Prony in 1795, which worked in the noiseless setting. This was refined by classical algorithms like MUSIC [Sch81] and ESPRIT [RPK86], which empirically work better with noise. Matrix pencil [BM86] is a method for computing the maximum likelihood signal under Gaussian noise and evenly spaced samples. The question remained how accurate the maximum likelihood estimate is; [Moi15] showed that it has an O(kc) approximation factor if the frequency gap is at least 1/T . Now, the above results all use F T samples, which is analogous to n in the discrete setting. This can be decreased down till O(k) by only looking at a subset of time, i.e. decreasing T ; but doing so increases the frequency gap needed for decent robustness results. A variety of works have studied how to adapt sparse Fourier techniques from the discrete setting to get sublinear sample complexity; they all rely on the minimum separation among the frequencies to be at least c/T for c ≥ 1. [TBSR13] showed that a convex program can recover the frequencies exactly in the noiseless setting, for c ≥ 4. This was improved in [CF14] to c ≥ 2 for complex signals and c ≥ 1.87 for real signals. [CF14] also gave a result for c ≥ 2 that was stable to noise, but this required the signal frequencies to be placed on a finely spaced grid. [YX15] gave a different convex relaxation that empirically requires smaller c in the noiseless setting. [DB13] used model-based compressed sensing when c = Ω(1), again without theoretical noise stability. Note that, in the noiseless setting, exact recovery can be achieved without any frequency separation using Prony's method or Berlekamp-Massey syndrome decoding [Mas69]; the benefit of the above results is that a convex program might be robust to noise, even if it has not been proven to be so. In the noisy setting, [FL12] gave an extension of Orthogonal Matching Pursuit (OMP) that can recover signals when c = Ω(k), with an approximation factor O(k), and a few other assumptions. Similarly, [BCG+14] gave a method that required c = Ω(k) and was robust to certain kinds of noise. [HK15] got the threshold down to c = O(1), in multiple dimensions, but with approximation factor O(F T kO(1)). [TBR15] shows that, under Gaussian noise and with separation c ≥ 4, a semidefinite program can optimally estimate x∗(ti) at evenly spaced sample points ti from observations x∗(ti)+g(ti). This is somewhat analogous to our setting, the differences being that (a) we want to estimate the signal over the entire interval, not just the sampled points, (b) our noise g is adversarial, so we cannot hope to reduce it-if g is also k-Fourier-sparse, we cannot distinguish x∗ and g, and of course (c) we want to avoid requiring frequency separation. when c (cid:38) log(1/δ), and the signal when c (cid:38) log(1/δ) + log2 k. In [PS15], we gave the first algorithm with O(1) approximation factor, finding the frequencies Now, all of the above results algorithms are designed to recover the frequencies; some of the ones in the noisy setting then show that this yields a good approximation to the overall signal (in the noiseless setting this is trivial). Such an approach necessitates c ≥ 1: [Moi15] gave a lower bound, showing that any algorithm finding the frequencies with approximation factor 2o(k) must require c ≥ 1. Thus, in the current literature, we go from not knowing how to get any approximation for c < 1, to getting a polynomial approximation at c = 1 and a constant approximation at c (cid:38) log2 k. In this work, we show how to get a constant factor approximation to the signal regardless of c. 5 Polynomial interpolation. Our result is a generalization of robust polynomial interpolation, and in Theorem 1.2 we construct an optimal method for polynomial interpolation as a first step toward interpolating Fourier-sparse signals. Our result here can be seen as essentially an extension of a technique shown in [CDL13]. The focus of [CDL13] is on the setting where sample points xi are chosen independently, so Θ(d log d) samples are necessary. One of their examples, however, shows essentially the same thing as our Corollary 4.2. From this, getting our theorem is not difficult. The recent work [GZ16] looks at robust polynomial interpolation in a different noise model, featuring (cid:96)∞ bounded noise with some outliers. In this setting they can get a stronger (cid:96)∞ guarantee on the output than is possible in our setting. Nyquist sampling. The classical method for learning bandlimited signals uses Nyquist sampling- i.e., samples at rate 1/F , for F T points-and interpolates them using Shannon-Nyquist interpola- tion. This doesn't require any frequency gap, but also doesn't benefit from sparsity like sparse Fourier transform-based techniques. As discussed in [PS15], on the signal x(t) = 1 it takes F T + O(1/δ) samples to get δ error on average. Our dependence is logarithmic on both those terms. 1.2 Our techniques Previous results on sparse Fourier transforms with robust recovery all required a frequency gap. So consider the opposite situation, where all the frequencies converge to zero and the coefficients are adjusted to keep the overall energy fixed. If we take a Taylor expansion of each complex exponential, then the signal will converge to a degree k polynomial. So robust polynomial interpolation is a necessary subproblem for our algorithm. Polynomial interpolation. Let P (x) be a degree d polynomial, and suppose that we can query f (x) = P (x) + g(x) over the interval [−1, 1], where g represents adversarial noise. We would like to query f at O(d) points and output a degree d polynomial Q(x) such that (cid:107)P − Q(cid:107) (cid:46) (cid:107)g(cid:107), where we define (cid:107)h(cid:107)2 :=(cid:82) 1−1 h(x)2dx. One way to do this would be to sample points S ⊂ [−1, 1] uniformly, then output the degree d polynomial Q with the smallest empirical error (cid:107)P + g − Q(cid:107)2 S := 1 S(cid:88)x∈S (P + g − Q)(x)2 (cid:46) (cid:107)g(cid:107) by Markov's inequality, the result follows. on the observed points. If (cid:107)R(cid:107)S ≈ (cid:107)R(cid:107) for all degree d polynomials R, in particular for P − Q, then since usually (cid:107)g(cid:107)S This has two problems: first, uniform sampling is poor because polynomials like Chebyshev poly- nomials can have most of their energy within O(1/d2) of the edges of the interval. This necessitates Ω(d2) uniform samples before (cid:107)R(cid:107)S ≈ (cid:107)R(cid:107) with good probability on a single polynomial. Second, the easiest method to extend from approximating one polynomial to approximating all polynomials uses a union bound over a net exponential in d, which would give an O(d3) bound. To fix this, we need to bias our sampling toward the edges of the interval and we need our sampling to not be iid. We partition [−1, 1] into O(d) intervals I1, . . . , In so that the interval containing each x has width at most O(√1 − x2), except for the O(1/d2) size regions at the edges. For any degree d polynomial R and any choice of n points xi ∈ Ii, the appropriately weighted empirical energy is close to (cid:107)R(cid:107). This takes care of both issues with uniform sampling. If the points 6 are chosen uniformly at random from within their intervals, then (cid:107)g(cid:107) is probably bounded as well, and the empirically closest degree d polynomial Q will satisfy our requirements. This result is shown in Section 4. Clusters. Many previous sparse Fourier transform algorithms start with a one-sparse recovery algorithm, then show how to separate frequencies to get a k-sparse algorithm by reducing to the one-sparse case. Without a frequency gap, we cannot hope to reduce to the one-sparse case; instead, we reduce to individual clusters of nearby frequencies. Essentially the problem is that one cannot determine all of the high-energy frequencies of a function x only by sampling it on a bounded interval, as some of the frequencies might cancel each other out on this interval. We also cannot afford to work merely with the frequencies of the truncation of x to the interval [0, T ], as the truncation operation will spread the frequencies of x over too wide a range. To fix this problem, we must do something in between the two. In particular, we instead study x·H for a judiciously chosen function H. We want H to approximate the indicator function of the interval [0, T ] and have small Fourier-support, supp((cid:98)H) ⊂ [−kc/T, kc/T ]. By using some non-trivial lemmas about the growth rate of x∗, we can show that the difference between x · H on R and the truncation of x to [0, T ] has small L2 mass, so that we can use the former as a substitute for the latter. On the other hand, the Fourier transform of x · H is the convolution (cid:98)x ∗ (cid:98)H, which has most of its mass within poly(k)/T of the frequencies of x∗. Although it is impossible to determine the individual frequencies of x∗, we can hope to identify O(k) intervals each of length poly(k)/T so that all but a small fraction of the energy of(cid:98)x is contained within these intervals. Note that many of these intervals will represent not individual frequencies of x∗, but small clusters of such frequencies. Furthermore, some frequencies of x∗ might not show up in these intervals either because they are too small, or because they cancel out other frequencies when convolved with (cid:98)H. One-cluster recovery. Given our notion of clusters, we start looking at Fourier-sparse interpola- tion in the special case of one-cluster recovery. This is a generalization of one-sparse recovery where we can have multiple frequencies, but they all lie in [f − ∆, f + ∆] for some base frequency f and bandwidth ∆ = kc/T . Because all the frequencies are close to each other, values x(a) and x(a + β) √ will tend to have ratio close to e2πif β when β is small enough. We find that β < 1 is sufficient, which lets us figure out a frequency (cid:101)f with (cid:101)f − f ≤ ∆√T ∆ = kO(1)/T . Once we have the frequency (cid:101)f, we can consider x(cid:48)(t) = x(t)e−2πi(cid:101)f . This signal is k-Fourier- exponential1, can show x∗ is δ-close to P (t)e2πi(cid:101)f for a degree d = O(kc + k log(1/δ)) polynomial P . sparse with frequencies bounded by kO(1)/T . By taking a Taylor approximation to each complex ∆ T ∆ Thus we could apply our polynomial interpolation algorithm to recover the signal. k-cluster frequency estimation. Reminiscent of algorithms such as [HIKP12a, PS15], we choose random variables σ ≈ T /kc, a ∈ [0, 1], and b ∈ [0, 1/σ] and look at v ∈ Ckc given by vi = (x · H)(σ(i − a))e −2πiσbiG(i) 1There is a catch here, that the coefficients of the exponentials are potentially unbounded, if the frequencies are arbitrarily close together. We first use Gram determinants to show that the signal is δ-close to one with frequency gap δ2−k, and coefficients at most 2k/δ. 7 defined by (j) imates an interval of length Θ( 2π an interval convolved with itself kc times, multiplied by a sinc function. where G is a filter function. That is, G has compact support (supp(G) ⊂ [−kc, kc]), and (cid:98)G approx- k ). In other words, G is the same as (cid:98)H with different parameters: We alias v down to O(k) dimensions and take the discrete Fourier transform, getting (cid:98)u. It has been implicit in previous work-and we make it explicit-that (cid:98)uj is equal to zσa for a vector z where (cid:98)G a good chance of being the only frequency preserved in (cid:98)z, and we could apply one-sparse recovery by choosing a variety of a. Without a frequency gap we can't quite say that: we pick 1/σ (cid:29) ∆ so that the entire cluster usually lands in the same bin, but then nearby clusters can also often land in the same bin. Fortunately, it is still usually true that only nearby clusters will collide. Since our 1-cluster algorithm works when the signal frequencies are nearby, we apply it to find a frequency approximation within √T /σ σ,b is a particular permutation of (cid:98)G. In particular, (cid:98)G In previous work, when σ and b were chosen randomly, each individual frequency would have (cid:98)z = ((cid:98)x ∗ (cid:98)H) · (cid:98)G σ,b has period 1/σ, and approximates σ = kO(1)/T of the cluster. an interval of size 1 σB within each period. The above algorithm recovers each individual frequency with constant probability. By repeating it O(log k) times, with high probability we find a list L of O(k) frequencies within kO(1)/T of each significant cluster. (j) σ,b (j) k-sparse recovery. Because different clusters aren't anywhere close to orthogonal, we can't simply approximate each cluster separately and add them up. Instead, given the list L of candidate frequencies, we consider the O(kd)-dimensional space of functions α(cid:101)f ,itie2πi(cid:101)f t d(cid:88)i=0 (cid:101)x(t) :=(cid:88)(cid:101)f∈L where d = O(kO(1) + log(1/δ)). We then take a bunch of random samples of x, and choose the(cid:101)x(t) minimizing the empirical error using linear regression. This regression can be made slightly faster using oblivious subspace embeddings [CW13], [NN13], [Woo14],[CNW15]. Our argument to show this works is analogous to the naive method we considered for polynomial recovery. Similarly to the one-cluster setting, using Taylor approximations and Gram determinants, we can show that this space includes a sufficiently close approximation to x. Since polynomials are the limit of sparse Fourier as frequencies tend to zero, these functions are arbitrarily close to factor larger than its average over [0, T ]. Using a net argument, this shows poly(kd) samples are sufficient to find a good approximation to the nearest function in our space. · H(cid:107)2 ≈ (cid:107)x∗ for t (cid:29) T . The difference between 1√ O(kd)-Fourier-sparse functions. Hence we know that the maximum of (cid:101)x(t) is at most a poly(kd) Growth rate of Fourier-sparse signals. We need that 1√ (cid:107)T , where H approx- imates the interval 1[0,T ]. Because H has support size kc/T , it has a transition region of size T /kc(cid:48) at the edges, and it decays as (t/T )−kc(cid:48)(cid:48) · H(cid:107)2 and (cid:107)x∗ T (cid:107)x∗ (cid:107)T involves two main components: mass in the transition region that is lost, and mass outside the sampling interval that is gained. To show the approximation, we need that x∗(t) (cid:46) (cid:101)O(k2)(cid:107)x∗ (cid:107)T within the interval and x∗(t) (cid:46) (kt/T )O(k) (cid:107)x∗ (cid:107)T outside. T (cid:107)x∗ 8 We outline the bound of max t∈[0,T ]x∗(t): if t∗ = arg max t∈[0,T ]x∗(t) in terms of its average (cid:107)x∗ (cid:107)T to bound x∗(t) within the interval. Notice that we can assume x∗(0) = max t∈[0,T ] x∗(t)2 is not 0 or T , we can rescale the two intervals [0, t∗] and [t∗, T ] to [0, T ] separately. Then we show that for any t(cid:48), there exist m = (cid:101)O(k2) and constants C1,··· , Cm such that x∗(0) =(cid:80)j∈[m] Cj · x∗(j · t(cid:48)). Then we take the integration of t(cid:48) over [0, T /m] to bound x∗(0)2 by its average. For any outside t > T , we follow this approach to show x∗(t) =(cid:80)j∈[k] Cj · x∗(tj) where tj ∈ [0, T ] and Cj ≤ poly(k) · (kt/T )O(k) for each j ∈ [k]. These results are shown in Section 5. 1.3 Organization This paper is organized as follows. We provide a brief overview about signal recovery in Section 2. We introduce some notations and tools in Section 3. Then we show our main Theorem 1.2 about polynomial interpolation in Section 4. For signals with k-sparse Fourier transform, we show two bounds on their growth rate in Section 5 and describe the hash functions and filter functions in Section 6. We provide the algorithm for frequency estimation and its proof in Section 7. In Section 8, we describe the algorithm for one-cluster recovery. In Section 9, we show the proof of Theorem 1.1. We defer several technical proofs in Appendix A. Appendix B gives a summary of several well- known facts are existing in literature. We provide the analysis of hash functions and filter functions in Appendix C. 2 Proof Sketch T (cid:46) δ(cid:107)x∗ k(cid:80)j=1 We first consider one-cluster recovery centered at zero, i.e., x∗(t) = vj · e2πifj t where every fj is in [−∆, ∆] for some small ∆ > 0. The road map is to replace x∗ by a low degree polynomial P such that (cid:107)x∗(t) − P (t)(cid:107)2 T then recover a polynomial Q to approximate P through the (cid:107)2 observation x(t) = P (t) + g(cid:48)(t) where g(cid:48)(t) = g(t) +(cid:0)x∗(t) − P (t)(cid:1). A natural way to replace x∗(t) = vje2πifj t by a low degree polynomial P (t) is the Taylor expansion. To bound the error after taking the low degree terms in the expansion by δ(cid:107)x∗ (cid:107)T , we j t approximating x∗ on [0, T ] with an extra property-any show the existence of x(cid:48)(t) = T (cid:82) T coefficient v(cid:48) 0 x(cid:48)(t)2dt. We prove the existence of x(cid:48)(t) via two more steps, both of which rely on the estimation of some Gram matrix constituted by these k signals. The first step is to show the existence of a k-Fourier-sparse signal x(cid:48)(t) with frequency gap η ≥ exp(− poly(k))·δ Lemma 2.1. There is a universal constant C1 > 0 such that, for any x∗(t) = j in x(cid:48)(t) has an upper bound in terms of (cid:107)x(cid:48) that is sufficiently close to x∗(t). k(cid:80)j=1 je2πif(cid:48) v(cid:48) vje2πifj t and any T = 1 (cid:107)2 k(cid:80)j=1 T k(cid:80)j=1 δ > 0 , there always exist η ≥ δ T · k−C1k2 and x(cid:48)(t) = je2πif(cid:48) v(cid:48) j t satisfying i(cid:54)=j f(cid:48) with min i − f(cid:48) j ≥ η and max j∈[k]{f(cid:48) ∗ ∗ (t)(cid:107)T ≤ δ(cid:107)x (t)(cid:107)T (cid:48) (t) − x (cid:107)x j − fj} ≤ kη. k(cid:80)j=1 9 We outline our approach and defer the proof to Section 8. We focus on the replacement of one frequency fk in x∗ =(cid:80)j∈[k] vje2πifj t by a new frequency fk+1 (cid:54)= fk and its error. The idea is to consider every signal e2πifj t as a vector and prove that for any vector x∗ in the linear subspace span{e2πifj tj ∈ [k]}, there exists a vector in the linear subspace span{e2πifk+1t, e2πifj tj ∈ [k − 1]} with distance at most exp(k2) · (fk − fk+1T ) · (cid:107)x∗ The second step is to lower bound (cid:107)x(cid:48) T by its coefficients through the frequency gap η in x(cid:48). (cid:107)2 (cid:107)T to x∗. Lemma 2.2. There exists a universal constant c > 0 such that for any x(t) = frequency gap η = min i(cid:54)=j fi − fj, vje2πifj t with k(cid:80)j=1 −ck2 (cid:107)x(t)(cid:107)2 T ≥ k min(cid:16)(ηT )2k, 1(cid:17) k(cid:88)j=1 vj2. j by exp(poly(k)) · δ−O(k) · (cid:107)x(cid:48) Combining Lemma 2.1 and Lemma 2.2, we bound v(cid:48) (cid:107)T for any j in x(cid:48). Now we apply the Taylor expansion on x(cid:48)(t) and keep the first d = O(∆T + coefficient v(cid:48) j · e2πif(cid:48) j t in the expansion to obtain a polynomial P (t) of poly(k) + k log 1 degree at most d. To bound the distance between P (t) and x(cid:48)(t), we observe that the error of every point t ∈ [0, T ] is at most ( 2π∆·T j, which can be upper bounded by δ(cid:107)x(cid:48)(t)(cid:107)T via the above connection. We summarize all discussion above as follows. Lemma 2.3. For any ∆ > 0 and any δ > 0, let x∗(t) =(cid:80)j∈[k] vje2πifj t where fj ≤ ∆ for each j ∈ [k]. There exists a polynomial P (t) of degree at most δ ) terms of every signal v(cid:48) )d(cid:80)j v(cid:48) d d = O(T ∆ + k3 log k + k log 1/δ) such that ∗ (cid:107)P (t) − x (t)(cid:107)2 T ≤ δ(cid:107)x ∗ (cid:107)2 T . To recover x∗(t), we observe x(t) as a degree d polynomial P (t) with noise. We use properties of the Legendre polynomials to design a method of random sampling such that we only need O(d) random samples to find a polynomial Q(t) approximating P (t). Theorem 1.2. For any degree d polynomial P (t) and an arbitrary function g(t), Procedure Ro- bustPolynomialLearning in Algorithm 5 takes O(d) samples from x(t) = P (t) + g(t) over [0, T ] and reports a degree d polynomial Q(t) in time O(dω) such that, with probability at least 99/100, where ω < 2.373 is matrix multiplication exponent [Str69],[CW87],[Wil12]. (cid:107)P (t) − Q(t)(cid:107)2 T (cid:46) (cid:107)g(t)(cid:107)2 T . We can either report the polynomial Q(t) or transfer Q(t) to a signal with d-sparse Fourier transform. We defer the technical proofs and the formal statements to Section 8 and discuss the recovery of k clusters from now on. As mentioned before, we apply the filter function (H(t), (cid:98)H(f )) on x∗ such that (cid:92)x∗ most k clusters given(cid:99)x∗ with k-sparse Fourier transform. First, we show that all frequencies in the · H constitute a good approximation of x∗ in Section 9. "heavy" clusters of (cid:92)x∗ · H has at 10 Definition 2.4. Given x∗(t) = support in frequency domain. Let Lj denote the interval of supp( k(cid:80)j=1 vje2πifj t, any N > 0, and a filter function (H, (cid:98)H) with bounded Define an equivalence relation ∼ on the frequencies fi by the transitive closure of the relation (cid:92)H · x∗(f )2df ≥ Define Ci = ∪f∈Si fi ∼ fj if Li ∩ Lj (cid:54)= ∅. Let S1, . . . , Sn be the equivalence classes under this relation. Li for each i ∈ [n]. We say Ci is a "heavy" cluster iff (cid:82)Ci T · N 2/k. Claim 2.5. Given x∗(t) = Appendix C.1 and C1,··· , Cl be the heavy clusters from Definition 2.4. For k(cid:80)j=1 vje2πifj t and any N > 0, let H be the filter function defined in (cid:92) e2πifj t · H) for each j ∈ [k]. (cid:46) N 2. vje2πifj t approximating x∗ within distance (cid:107)x(S)(t) − x∗(t)(cid:107)2 S =(cid:26)j ∈ [k](cid:12)(cid:12)(cid:12)(cid:12)fj ∈ C1 ∪ ··· Cl(cid:27) , we have x(S)(t) = (cid:80)j∈S Hence it is enough to recover x(S) for the recovery of x∗. Let ∆h denote the bandwidth of (cid:98)H. In Section 7, we choose ∆ > k · ∆h such that for any j ∈ S,(cid:82) fj +∆ (cid:92)H · x∗(f )2df ≥ T · N 2/k from the fact Ci ≤ k · ∆h. Then we prove Theorem 2.6 in Section 7, which finds O(k) frequencies to cover all heavy clusters of (cid:92)x∗ · H. k(cid:80)j=1 vje2πifj t and x(t) = x∗(t) + g(t) be our observable signal where Theorem 2.6. Let x∗(t) = T for a sufficiently small constant c. Then Procedure FrequencyRecov- (cid:107)g(t)(cid:107)2 eryKCluster returns a set L of O(k) frequencies that covers all heavy clusters of x∗, which uses poly(k, log(1/δ)) log(F T ) samples and poly(k, log(1/δ)) log2(F T ) time. In particular, for ∆ = T , with probability 1 − 2−Ω(k), for any f∗ with T + δ(cid:107)x∗(t)(cid:107)2 poly(k, log(1/δ))/T and N 2 := (cid:107)g(t)(cid:107)2 (cid:90) f∗+∆ (2) f∗−∆ T ≤ c(cid:107)x∗(t)(cid:107)2 fj−∆ T (cid:91)x · H(f )2df ≥ TN 2/k, − (cid:101)f (cid:46) ∆√∆T . ∗ f coveryKCluster in Theorem 2.6. The guarantee is that, for any fj in x(S), there exists some there exists an (cid:101)f ∈ L satisfying Let L = {(cid:101)f1,··· ,(cid:101)fl} be the list of frequencies from the output of Procedure FrequencyRe- pj ∈ [l] such that (cid:101)fpj − fj (cid:46) ∆√∆T for ∆ = poly(k, log(1/δ))/T . Hence we rewrite x(S)(t) = (cid:80)i∈[l] e2πi(cid:101)fit((cid:80)j∈S:pj =i e2πi(fj−(cid:101)fi)t). For each i ∈ [l], we apply Lemma 2.3 of one-cluster recovery on (cid:80)j∈S:pj =i e2πi(fj−(cid:101)fi)t to approximate it by a degree d polynomial Pi(t). Now we consider x(t) =(cid:80)i∈[l] e2πi(cid:101)fit · Pi(t) + g(cid:48)(cid:48)(t) where (cid:107)g(cid:48)(cid:48)(t)(cid:107)T (cid:46) (cid:107)g(t)(cid:107)T + δ(cid:107)x∗(t)(cid:107)T . To recover(cid:80)i∈[l] e2πi(cid:101)fit · Pi(t), we treat it as a vector in the linear subspace V = span(cid:26)e2πi(cid:101)fit · tj(cid:12)(cid:12)(cid:12)(cid:12)j ∈ {0,··· , d}, i ∈ [l](cid:27) with dimension at most l(d + 1) and find a vector in this linear subspace approximating it. 11 We show that for any v ∈ V , the average of poly(kd) random samples on v is enough to estimate T . In particular, any vector in this linear subspace satisfies that the maximum of it in [0, T ] has (cid:107)v(cid:107)2 an upper bound in terms of its average in [0, T ]. Then we apply the Chernoff bound to prove that poly(kd) random samples are enough for the estimation of one vector v ∈ V . Claim 2.7. For any (cid:126)u ∈ span(cid:26)e2πi(cid:101)fit · tj(cid:12)(cid:12)(cid:12)(cid:12)j ∈ {0,··· , d}, i ∈ [l](cid:27), there exists some universal con- stants C1 ≤ 4 and C2 ≤ 3 such that t∈[0,T ]{(cid:126)u(t)2} (cid:46) (ld)C1 logC2(ld) · (cid:107)(cid:126)u(cid:107)2 max T At last we use an -net to argue that poly(kd) random samples from [0, T ] are enough to interpolate x(t) by a vector v ∈ V . Because the dimension of this linear subspace is at most l(d + 1) = O(kd), there exists an -net in this linear subspace for unit vectors with size at most exp(kd). Combining the Chernoff bound on all vectors in the -net and Claim 2.7, we know that poly(kd) samples are sufficient to estimate (cid:107)v(cid:107)2 T for any vector v ∈ V . In Section 9, we show that a vector v ∈ V minimizing the distance on poly(kd) random samples is a good approximation for (cid:80)i∈[l] e2πi(cid:101)fit · Pi(t), which is a good approximation for x∗(t) from all discussion above. Theorem 1.1. Let x(t) = x∗(t) + g(t), where x∗ is k-Fourier-sparse signal with frequencies in [−F, F ]. Given samples of x over [0, T ] we can output (cid:101)x(t) such that with probability at least 1 − 2−Ω(k), Our algorithm uses poly(k, log(1/δ)) · log(F T ) samples and poly(k, log(1/δ)) · log2(F T ) time. The output (cid:101)x is poly(k, log(1/δ))-Fourier-sparse signal. (cid:46) (cid:107)g(cid:107)T + δ (cid:107)x (cid:107)(cid:101)x − x (cid:107)T . (cid:107)T ∗ ∗ 3 Preliminaries We first provide some notations in Section 3.1 and basic Fourier facts in Section 3.2. Then we review some probability inequalities in Section 3.3. At last, we introduce Legendre polynomials in Section 3.4 and review some basic properties of Gram matrix and its determinant in Section 3.5. 3.1 Notation For any function f, we define (cid:101)O(f ) to be f · logO(1)(f ). We use [n] to denote {1, 2,··· , n}. Let i denote √−1. For any Complex number z = a + ib ∈ C, where a, b ∈ R. We define z to be a − ib and z = √a2 + b2 such that z2 = zz. For any function f (t) : R → C, we use supp(f ) to denote the support of f. For convenience, we define the sinc function and the Gaussian distribution Gaussianµ,σ on R with expectation µ and variance σ2 as follows: sinc(t) = sin(πt) πt , Gaussianµ,σ(t) = − (t−µ)2 2σ2 . 1 σ√2π e For a fixed T > 0, we define the inner product of two functions x, y : [0, T ] → C as (cid:104)x, y(cid:105)T = x(t)y(t)dt. 1 T (cid:90) T 0 12 Figure 1: A picture of a Combs, rects, sincs, Gaussianµ,σ . We define the (cid:107) · (cid:107)T norm as (cid:107)x(t)(cid:107)T =(cid:112)(cid:104)x(t), x(t)(cid:105)T =(cid:115) 1 T (cid:90) T 0 x(t)2dt. 3.2 Facts about the Fourier transform In this work, we always use x(t) to denote a signal from R → C. The Fourier transform(cid:98)x(f ) of an integrable function x : R → C is defined as −2πif tdt, for any real number f. x(t)e −∞ (cid:98)x(f ) =(cid:90) +∞ x(t) =(cid:90) +∞ Similarly, x(t) is determined from(cid:98)x(f ) by the inverse transform: −∞ (cid:98)x(f )e2πif tdf, for any real number t. Let CFT denote the continuous Fourier transform, DTFT denote the discrete-time Fourier transform, DFT denote the discrete Fourier transform, and FFT denote the fast Fourier transform. For any signal x(t) and n ∈ N+, we define x∗n(t) = x(t) ∗ ··· ∗ x(t) . (cid:125) and(cid:98)x·n(f ) =(cid:98)x(f ) · ··· ·(cid:98)x(f ) (cid:125) Fact 3.1. Let δ∆(f ) denote the Dirac delta at ∆. Then (cid:123)(cid:122) n (cid:123)(cid:122) (cid:124) (cid:124) n (cid:98)δ∆(t) =(cid:90) +∞ −∞ δ∆(f )e2πif tdf = e2πit∆. 13 Combs0−s−2ss2srects−s2s2sincs−1s1sGaussianµ,σµ Fact 3.2. For any s > 0, let Combs(t) = (cid:80)j∈Z δjs(t). Then the Fourier transform of Combs(t) is The following fact says the the Fourier transform of a rectangle function is a sinc function. Fact 3.3. We use (cid:92)Combs(f ) = 1 s Comb1/s(f ). rects(t) =(cid:40)1 0 if t ≤ s 2 , otherwise. πf s = sinc(f s). Then the Fourier transform of rects(t) is (cid:91)rects(f ) = sin(πf s) The Fourier transform of a Gaussian function is another Gaussian function. √ Fact 3.4. For Gaussianµ,σ(t) = 1 (cid:92)Gaussianµ,σ(f ) = e σ − (t−µ)2 e 2σ2 2π −2πif u . Then the Fourier transform is 1 σ√2π Gaussian0,σ(cid:48)(f ) for σ (cid:48) = 1/(2πσ). Proof. From the definition of the Fourier transform, (cid:92)Gaussianµ,σ(f ) = (cid:90) +∞ −∞ 1 σ√2π − (t−µ)2 2σ2 e −2πif tdt e −∞ −2πif u(cid:90) +∞ −2πif u(cid:90) +∞ −∞ − f 2 2σ(cid:48)2 −2πif ue = e = e = e − t2 2σ2 e −2πif tdt e 1 σ√2π 1 σ√2π e − (t+2πiσ2f )2 2σ2 −2π2f 2σ2 dt where σ(cid:48) = 1/(2σπ), which is e−2πif u · σ(cid:48)√2π · Gaussian0,σ(cid:48)(f ). 3.3 Tools and inequalities From the Chernoff Bound (Lemma B.2), we show that if the maximum of a signal is bounded by d times its energy over some fixed interval, then taking more than d samples (each sample is drawn i.i.d. over that interval) suffices to approximate the energy of the signal on the interval with high probability. Lemma 3.5. Given any function x(t) : R → C with max points from 0 to T . If each point of S is chosen uniformly at random from [0, T ], we have t∈[0,T ]x(t)2 ≤ d(cid:107)x(t)(cid:107)2 T . Let S denote a set of Pr(cid:34)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) x(ti)2 − (cid:107)x(t)(cid:107)2 We provide a proof in Appendix A.5. Because d · 1 S(cid:88)i∈S 2d ) ≤ 1, we have the following inequality when the maximum of x(t)2 2 · (1 − 1 is at most d times its average. Lemma 3.6. Given any function x(t) : R → C with max T . Let S denote a set of points from 0 to T . For any point a is sampled uniformly at random from [0, T ], we have, t∈[0,T ]x(t)2 ≤ d(cid:107)x(t)(cid:107)2 −Ω(2S/d) 2d + 1 T ](cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ (cid:107)x(t)(cid:107)2 T(cid:35) ≤ e 1 a∼[0,T ](cid:20)x(a)2 ≥ Pr T(cid:21) ≥ 1 2(cid:107)x(t)(cid:107)2 1 2d . 14 3.4 Legendre polynomials We provide an brief introduction to Legendre polynomials (please see [Dun10] for a complete intro- duction). For convenience, we fix (cid:107)f (t)(cid:107)2 Definition 3.7. Let Ln(x) denote the Legendre polynomials of degree n, the solution to Legendre's differential equation: dx(cid:20)(1 − x2) 2(cid:82) 1−1 f (t)2dt in this section. Ln(x)(cid:21) + n(n + 1)Ln(x) = 0 We will the following two facts about the Legendre polynomials in this work. T = 1 d dx (3) d Fact 3.8. Ln(1) = 1 for any n ≥ 0 in the Legendre polynomials. Fact 3.9. The Legendre polynomials constitute an orthogonal basis with respect to the inner product on interval [−1, 1]: (cid:90) 1 −1 Lm(x)Ln(x)dx = 2 δmn 2n + 1 where δmn denotes the Kronecker delta, i.e., it equals to 1 if m = n and to 0 otherwise. For any polynomial P (x) of degree at most d with complex coefficients, there exists a set of coefficients from the above properties such that P (x) = αi · Li(x), where αi ∈ C,∀i ∈ {0, 1, 2,··· , d}. d(cid:88)i=0 Lemma 3.10. For any polynomial P (t) of degree at most d from R to C, for any interval [S, T ], t∈[S,T ]P (t)2 ≤ (d + 1)2 · max We provide a proof in Appendix A.6. 1 T − S(cid:90) T S P (t)2dx. 3.5 Gram matrix and its determinant We provide an brief introduction to Gramian matrices (please see [Haz01] for a complete introduc- tion). We use (cid:104)x, y(cid:105) to denote the inner product between vector x and vector y. spanned by these n vectors with coefficients in C, i.e.,(cid:40)(cid:80)i∈[n] Let (cid:126)v1,··· , (cid:126)vn be n vectors in an inner product space and span{(cid:126)v1,··· , (cid:126)vn} be the linear subspace αi(cid:126)vi∀i ∈ [n], αi ∈ C(cid:41). The Gram matrix Gramn of (cid:126)v1,··· , (cid:126)vn is an n × n matrix defined as Gramn(i, j) = (cid:104)(cid:126)vi, (cid:126)vj(cid:105) for any i ∈ [n] and j ∈ [n]. Fact 3.11. det(Gramn) is the square of the volume of the parallelotope formed by (cid:126)v1,··· , (cid:126)vn. Let Gramn−1 be the Gram matrix of (cid:126)v1,··· , (cid:126)vn−1. Let (cid:126)v subspace span{(cid:126)v1,··· , (cid:126)vn−1} and (cid:126)v⊥ product space, which is(cid:112)(cid:104)(cid:126)v, (cid:126)v(cid:105). Claim 3.12. (cid:107) n be the projection of vn onto the linear (cid:107) n. We use (cid:107)(cid:126)v(cid:107) to denote the length of (cid:126)v in the inner n = (cid:126)vn − (cid:126)v ⊥ n (cid:107)2 = (cid:107)(cid:126)v det(Gramn−1) det(Gramn) . Proof. det(Gramn) = volume2((cid:126)v1,··· , (cid:126)vn) = volume2((cid:126)v1,··· , (cid:126)vn−1) · (cid:107)(cid:126)v ⊥ n (cid:107)2 = det(Gramn) · (cid:107)(cid:126)v ⊥ n (cid:107)2. 15 4 Robust Polynomial Interpolation Algorithm In Section 4.1, we show how to learn a low degree polynomial by using linear number of samples, running polynomial time, and achieving constant success probability. In Section 4.2, we show to how boost the success probability by rerunning previous algorithm several times. 4.1 Constant success probability We show how to learn a degree-d polynomial P with n = O(d) samples and prove Theorem 1.2 in 2(cid:82) 1−1 f (t)2dt. this section. For convenience, we first fix the interval to be [−1, 1] and use (cid:107)f(cid:107)2 Lemma 4.1. Let d ∈ N and  ∈ R+, there exists an efficient algorithm to compute a partition of [−1, 1] to n = O(d/) intervals I1,··· , In such that for any degree d polynomial P (t) : R → C and any n points x1,··· , xn in the intervals I1,··· , In respectively, the function Q(t) defined by [−1,1] = 1 approximates P by Q(t) = P (xj) if t ∈ Ij (cid:107)Q − P(cid:107)[−1,1] ≤ (cid:107)P(cid:107)[−1,1]. (4) One direct corollary from the above lemma is that observing n = O(d/) points each from I1,··· , In provides a good approximation for all degree d polynomials. For any set S = {t1,··· , tm} where each ti ∈ [−1, 1] and a distribution with support {w1,··· , wm} on S where wi = 1 and wi ≥ 0 for each i ∈ [m], we define (cid:107)x(cid:107)S,w = ((cid:80)m Corollary 4.2. Let I1,··· , In be the intervals in the above lemma and wj = Ij/2 for each j ∈ [n]. For any x1,··· , xn in the intervals I1,··· , In respectively, we consider S = {x1,··· , xn} with the distribution w1,··· , wn. Then for any degree d polynomial P , we have (cid:107)P(cid:107)S,w ∈(cid:2)(1 − )(cid:107)P(cid:107)[−1,1], (1 + )(cid:107)P(cid:107)[−1,1](cid:3) . We first state the main technical lemma and finish the proof of the above lemma (we defer the i=1 wi · x(ti)2)1/2. m(cid:80)i=1 proof of Lemma 4.3 to Appendix A.3). Lemma 4.3. For any degree d polynomial P (t) : R → C with derivative P (cid:48)(t), we have, (cid:90) 1 −1 (cid:48) (1 − t2)P (t)2dt ≤ 2d2(cid:90) 1 −1 P (t)2dt. (5) √ Proof of Lemma 4.1. We set m = 10d/ and show a partition of [−1, 1] into n ≤ 20m intervals. 1−t2 m and y0 = 0. Then we choose yi = yi−1 + g(yi−1) for i ∈ N+. Let l be the We define g(t) = first index of y such that yl ≥ 1 − 9 Let jk be the first index in the sequence such that yjk ≥ 1 − 2−k. Notice that m2 . We show l (cid:46) m. j2 ≤ 3/4 √1−(3/4)2 ≤ 1.5m m and yi − yi−1 = g(yi−1) = (cid:113)1 − y2 m i−1 √1 − yi−1 m . ≥ 16 Then for all k > 2, we have jk − jk−1 ≤ 2−k √1−y(jk−1) −k/2m. ≤ 2 Therefore jk ≤(cid:0)1.5 + (2−3/2 + ··· 2−k/2)(cid:1) m and l ≤ 10m. Because yl−1 ≤ 1 − 9 m2 , for any j ∈ [l] and any x ∈ [yi−1, yi], we have the following property: m 1 − x2 m2 ≥ 1 2 · i−1) (1 − y2 m2 = (yi − yi−1)2/2. (6) Now we set n and partition [−1, 1] into I1,··· , In as follows: 1. n = 2(l + 1). 2. For j ∈ [l], I2j−1 = [yj−1, yj] and I2j = [−yj,−yj−1]. 3. I2l+1 = [yl, 1] and I2l+2 = [−1,−yl]. For B in Equation (7), notice that In−1 = In = 1 − yl ≤ 9m−2 and for j ∈ {n − 1, n} P (t) − P (xj)2 ≤ 4 max t∈[−1,1]P (t)2 ≤ 4(d + 1)2(cid:107)P(cid:107)2 [−1,1] from the properties of degree-d polynomials, i.e., Lemma 3.10. Therefore B in Equation (7) is upper bounded by 2 · 4(d + 1)2(9m−2)(cid:107)P (t)(cid:107)2 [−1,1]. From all discussion above, (cid:107)Q(t) − P (t)(cid:107)2 Now we use the above lemma to provide a faster learning algorithm for polynomials on interval [−1, 1] with noise instead of using the -nets argument. Algorithm RobustPolynomialLearn- ingFixedInterval works as follows: [−1,1] ≤ 99d2 m2 ≤ 2. 17 B A (cid:123)(cid:122) For A in Equation (7), from the Cauchy-Schwarz inequality, we have For any x1,··· , xn where xj ∈ Ij for each j ∈ [n], we rewrite the LHS of (4) as follows: n−2(cid:88)j=1(cid:90)Ij P (xj) − P (t)2 dt +(cid:90)In−1 P (xn−1) − P (t)2 dt +(cid:90)In P (xn) − P (t)2 dt (cid:124) (cid:125) (cid:124) (cid:125) n−2(cid:88)j=1(cid:90)Ij(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) n−2(cid:88)j=1(cid:90)Ij P (xj) − P (t)2 dt = (cid:90) t n−2(cid:88)j=1(cid:90)Ij P (y)2(cid:90)t /∈(xj ,y) t − xjdtdy ≤ n−2(cid:88)j=1(cid:90)Ij P (xj) − P (t)2 dt ≤(cid:90) 1 (cid:123)(cid:122) n−2(cid:88)j=1(cid:90)Ij t − xj(cid:90) t n−2(cid:88)j=1(cid:90)Ij P m2 (cid:90) 1 (y)dy(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) n−2(cid:88)j=1(cid:90)Ij P Then we swap dt with dy and use Equation (6): We use Lemma 4.3 to simplify it by (t)2 2(1 − t2) m2 (t)2 · Ij2dt ≤ −1 P (t)2dt. −1 P xj P dt ≤ dt ≤ 2d2 2 (cid:48) P xj (cid:48) (cid:48) (cid:48) . (7) (cid:48) (y)2dydt. (cid:48) (t)2 2(1 − t2) m2 dt. 1. Let  = 1/20 and I1,··· , In be the intervals for d and  in Lemma 4.1. 2. Random choose xj ∈ Ij for every j ∈ [n] and define S = {x1,··· , xn} with weight w1 = I1 2 ,··· , wn = In 2 . 3. Find the degree d polynomial Q(t) that minimizes (cid:107)P (t) − Q(t)(cid:107)S,w using Fact B.3. Lemma 4.4. For any degree d polynomial P (t) and an arbitrary function g(t), Algorithm Robust- PolynomialLearningFixedInterval takes O(d) samples from x(t) = P (t) + g(t) over [−1, 1] and reports a degree d polynomial Q(t) in time O(dω) such that, with probability at least 99/100, (cid:107)P (t) − Q(t)(cid:107)2 [−1,1] (cid:46) (cid:107)g(t)(cid:107)2 [−1,1]. Proof. Notice that n = O(d/) = O(d) and the running time depends on solving a linear regression problem( Fact B.3 ), which takes O(dω) time. It is enough to bound the distance between P and Q: (cid:107)P − Q(cid:107)[−1,1] ≤ 1.09(cid:107)P − Q(cid:107)S,w = 1.09(cid:107)x − g − Q(cid:107)S,w ≤ 1.09(cid:107)g(cid:107)S,w + 1.09(cid:107)x − Q(cid:107)S,w ≤ 1.09(cid:107)g(cid:107)S,w + 1.09(cid:107)x − P(cid:107)S,w ≤ 2.2(cid:107)g(cid:107)S,w S,w] = (cid:107)g(cid:107)2 by Corollary 4.2 by x = P + g by triangle inequality degree-d R(cid:107)R − x(cid:107)S,w Q = arg min S [(cid:107)g(cid:107)2 Because E by using Markov's inequality. [−1,1], we know that (cid:107)P − Q(cid:107)[−1,1] ≤ 2200(cid:107)g(cid:107)[−1,1] with probability ≥ .999 T ). Then (cid:107)(cid:101)f(cid:107)[−1,1] = (cid:107)f(cid:107)T from the definition. Hence we can switch any interval [0, T ] to [−1, 1] and use Lemma 4.4. Theorem 1.2. For any degree d polynomial P (t) and an arbitrary function g(t), Procedure Ro- bustPolynomialLearning in Algorithm 5 takes O(d) samples from x(t) = P (t) + g(t) over [0, T ] and reports a degree d polynomial Q(t) in time O(dω) such that, with probability at least 99/100, For any function f : [0, T ] → C, let (cid:101)f (t) = f ( 2t−T where ω < 2.373 is matrix multiplication exponent [Str69],[CW87],[Wil12]. (cid:107)P (t) − Q(t)(cid:107)2 T (cid:46) (cid:107)g(t)(cid:107)2 T . 4.2 Boosting success probability Notice that the success probability of Theorem 1.2 is only constant, and the proof technique of obtaining that result cannot be modified to 1 − 1/ poly(d) or 1 − 2−Ω(d) success probability due to using Markov's inequality. However, we can use that algorithm as a black box, and rerun it O(log(1/p)) (for any p > 0) times on fresh samples. Using the careful median analysis from [MP14] gives Theorem 4.5. For any degree d polynomial P (t), an arbitrary function g(t), and any p > 0, Pro- cedure RobustPolynomialLearning+ in Algorithm 5 takes O(d log(1/p)) samples from x(t) = P (t) + g(t) over [0, T ] and reports a degree d polynomial Q(t) in time O(dω log(1/p)) such that, with probability at least 1 − p, (cid:107)P (t) − Q(t)(cid:107)2 T where ω < 2.373 is matrix multiplication exponent. (cid:46) (cid:107)g(t)(cid:107)2 T . 18 Proof. We run algorithm RobustPolynomialLearning R rounds with O(d) independent and fresh samples per round. We will obtain R degree-d polynomials Q1(t), Q2(t),··· , QR(t). We say a polynomial Qi(t) is good if (cid:107)Qi(t)− P (t)(cid:107)2 T . Using the Chernoff bound, with probability at least 1 − 2−Ω(R), at least a 3/4 fraction of the polynomials are "good". We output polynomial Q(t) = Qj∗(t) such that (cid:46) (cid:107)g(t)(cid:107)2 T ∗ j = arg min j∈[R] (median{(cid:107)Qj(t) − Q1(t)(cid:107)2 T ,(cid:107)Qj(t) − Q2(t)(cid:107)2 T ,··· ,(cid:107)Qj(t) − QR(t)(cid:107)2 T}) (8) The Equation (8) can be solved in following straightforward way. For i (cid:54)= j, it takes O(d) time to compute (cid:107)Qj(t) − Qi(t)(cid:107)2 T . Because of the number of pairs is O(R2), thus it takes O(R2d) time write down a R × R matrix. For each column, we run linear time 1-median algorithm. This step takes O(R2) time. At the end, j∗ is index of the column that has the smallest median value. Thus, polynomial Q(t) = Qj∗(t) 1 the 0 with probability at least 1− p by choosing R = O(log(1/p)). The running time is not optimized yet. To improve the dependence on R for running time, we replace the step of solving Equation (8) by an approach that is similar to [MP14]. We choose a new set of samples S, say S = {t1, t2,··· , tn} and n = O(d). Using Fact B.4, we can compute Qi(tj) for all i, j ∈ [R] × [n] in O(Rd poly(log(d))) time. Define (9) min −(cid:101)Q(cid:107)S,w.2 In the rest of the proof, we will show that (cid:107)Q−P(cid:107)T (cid:46) (cid:107)g(cid:107)T with probability Our algorithm will output a degree-d polynomial Q which is the optimal solution of this problem, degree-d Q(cid:48)(cid:107)Q(cid:48) at least 1 − 2−Ω(R). Notice that Equation (9) implies that (cid:101)Qj − P (tj) = median and applying the proof argument of Lemma 6.1 in [MP14], we have (Qi(tj) − P (tj))2 Taking the weighted summation over all the coordinates j, we have (Qi(tj) − P (tj)). Fix a coordinate j i∈[R] i∈[R] (cid:101)Qj = median Qi(tj),∀j ∈ [n]. good i ((cid:101)Qj − P (tj))2 (cid:46) mean (cid:107)(cid:101)Q − P(cid:107)2 (cid:107)Qi − P(cid:107)2 S,w S,w (cid:46) mean good i(cid:107)Qi − P(cid:107)2 S,w (cid:46) (cid:107)Qi − P(cid:107)2 T Using Corollary 4.2, for each good i, Combining the above two inequalities gives (cid:46) mean S,w good i(cid:107)Qi − P(cid:107)2 (cid:107)(cid:101)Q − P(cid:107)2 Because Q is the optimal solution for (cid:101)Q, then (11) (cid:107)(cid:101)Q − Q(cid:107)2 Using Corollary 4.2 and for any good i, i(cid:48), (cid:107)Qi − Qi(cid:48)(cid:107)T (cid:46) (cid:107)g(cid:107)T , we can replace P by Qi(cid:48) in the Equation (10). Thus, for any Qi(cid:48) where i(cid:48) is good, (cid:46) (cid:107)g(cid:107)2 S,w (10) T T (cid:46) (cid:107)g(cid:107)2 T 2Outputting Q = arg min degree-d Q(cid:48) (cid:107)Q(cid:48) − x(cid:107)S,w is not good enough, because it only gives constant success probability. (12) S,w ≤ (cid:107)(cid:101)Q − P(cid:107)2 (cid:46) (cid:107)g(cid:107)2 (cid:107)(cid:101)Q − Qi(cid:48)(cid:107)2 S,w T 19 For any good i(cid:48), (cid:107)Qi(cid:48) − Q(cid:107)T (cid:46) (cid:107)Qi(cid:48) − Q(cid:107)S,w ≤ (cid:107)Qi(cid:48) − (cid:101)Q(cid:107)S,w + (cid:107)(cid:101)Q − Q(cid:107)S,w (cid:46) (cid:107)g(cid:107)T by Corollary 4.2 by triangle inequality by Equation (11) and (12) Thus, our algorithm takes O(dR) samples from x(t) = P (t)+g(t) over [0, T ] and reports a polynomial Q(t) in time O(Rdω) such that, with probability at least 1 − 2−Ω(R), (cid:107)P (t) − Q(t)(cid:107)2 (cid:46) (cid:107)g(t)(cid:107)2 T . Choosing R = O(log(1/p)) completes the proof. T 5 Bounding the Magnitude of a Fourier-sparse Signal in Terms of Its Average Norm The main results in this section are two upper bounds, Lemma 5.1 on max on x(t)2 for t > T , in terms of the typical signal value (cid:107)x(cid:107)2 5.1 in Section 5.1 and Lemma 5.5 in Section 5.2 T = 1 t∈[0,T ]x(t)2 and Lemma 5.5 T (cid:82) T 0 x(t)2dt. We prove Lemma 5.1 Bounding the maximum inside the interval The goal of this section is to prove Lemma 5.1. Lemma 5.1. For any k-Fourier-sparse signal x(t) : R → C and any duration T , we have max t∈[0,T ]x(t)2 (cid:46) k4 log3 k · (cid:107)x(cid:107)2 T = (cid:82) 1 T T is the Proof. Without loss of generality, we fix T = 1. Then (cid:107)x(cid:107)2 average over the interval [0, T ], if t∗ = arg max t∈[0,T ] x(t)2 is not 0 or T = 1, we can rescale the two intervals [0, t∗] and [t∗, T ] to [0, 1] and prove the desired property separately. Hence we assume x(0)2 = max Claim 5.2. For any k, there exists m = O(k2 log k) such that for any k-Fourier-sparse signal x(t), any t0 ≥ 0 and τ > 0, there always exist C1,··· , Cm ∈ C such that the following properties hold, 0 x(t)2dt. Because (cid:107)x(cid:107)2 t∈[0,T ]x(t)2 in this proof. Property I Property II Cj ≤ 11 for all j ∈ [m], x(t0) = (cid:88)j∈[m] Cj · x(t0 + j · τ ). We first use this claim to finish the proof of Lemma 5.1. We choose t0 = 0 such that ∀τ > 0, there always exist C1,··· , Cm ∈ C, and Cj · x(j · τ ). By the Cauchy-Schwarz inequality, it implies that for any τ, x(0) = (cid:88)j∈[m] x(0)2 ≤ m (cid:88)j∈[m] (cid:46) m (cid:88)j∈[m] 20 Cj2x(j · τ )2 x(j · τ )2. (13) At last, we obtain 0 0 0 0 (m x(j · τ )2)dτ x(0)2 = m(cid:90) 1/m x(0)2dτ (cid:46) m ·(cid:90) 1/m m(cid:88)j=1 m(cid:88)j=1(cid:90) 1/m x(j · τ )2dτ = m2 · j(cid:90) j/m m(cid:88)j=1 j ·(cid:90) 1 m(cid:88)j=1 ≤ m2 · (cid:46) m2 log m · (cid:107)x(cid:107)2 where the first inequality follows by Equation (13), the second inequality follows by j/m ≤ 1 and the last step follows by (cid:80)m i = O(log m). From m = O(k2 log k), we obtain x(0)2 = T ). O(k4 log3 k(cid:107)x(cid:107)2 0 x(τ )2dτ x(τ )2dτ = m2 · i=1 1 1 To prove Claim 5.2, we use the following lemmas about polynomials. We defer their proofs to Appendix A.2. Lemma 5.3. Let Q(z) be a degree k polynomial, all of whose roots are complex numbers with n,k · zl denote the residual polynomial of absolute value 1. For any integer n, let rn,k(z) =(cid:80)k−1 Then, each coefficient of rn,k is bounded: r Lemma 5.4. For any k ∈ Z and any z1,··· , zk on the unit circle of C, there always exists a degree m(cid:80)j=0 m = O(k2 log k) polynomial P (z) = n,k ≤ 2knk−1 for any l. cjzj with the following properties: rn,k(z) ≡ zn (mod Q(z)). l=0 r (l) (l) T 1 Property I Property II Property III P (zi) = 0,∀i ∈ {1,··· , k}, c0 = 1, cj ≤ 11,∀j ∈ {1,··· , m}. k(cid:80)i=1 vie2πifit, we fix t0 and τ then rewrite x(t0 +j·τ ) as a polynomial For x(t) = Proof of Claim 5.2. of bi = vi · e2πifit0 and zi = e2πifiτ for each i ∈ [k]. k(cid:88)i=1 k(cid:88)i=1 k(cid:88)i=1 x(t0 + j · τ ) = = = vie2πifi·(t0+j·τ ) vie2πifit0 · e2πifi·jτ bi · zj i . 21 Given k and z1,··· , zk, let P (z) =(cid:80)m j=0 cjzj be the degree m polynomial in Lemma 5.4. m(cid:88)j=0 cjx(t0 + jτ ) = = = cj bi k(cid:88)i=1 m(cid:88)j=0 bi · zj i cj · zj i biP (zi) m(cid:88)j=0 k(cid:88)i=1 k(cid:88)i=1 (14) where the last step follows by Property I of P (z) in Lemma 5.4. From the Property II and III of = 0, P (z), we obtain x(t0) = −(cid:80)m j=1 cjx(t0 + jτ ). 5.2 Bounding growth outside the interval Here we show signals with sparse Fourier transform cannot grow too quickly outside the interval. Lemma 5.5. Let x(t) be a k-Fourier-sparse signal. For any T > 0 and any t > T , T . We define j . aizi (mod zn ≡ (z − zi)), x(t)2 ≤ k7 · (2kt/T )2.5k · (cid:107)x(cid:107)2 T . Proof. For any t > T , let t = t0 + n · τ such that t0 ∈ [0, T /k], τ ∈ [0, T /k] and n ≤ 2kt bi = vie2πifit0, and zi = e2πifiτ such that x(t0 + n · τ ) =(cid:80)j∈[k] bjzn By Lemma 5.3, we have for any z1, z2,··· , zk and any n, k(cid:89)i=1 where ai ≤ 2k · nk,∀i ∈ {0, 1,··· , k − 1}. Thus, we obtain k(cid:88)j=1 k−1(cid:88)i=0 k(cid:88)j=1 From the fact that x(t0 + i · τ ) =(cid:80)j∈[k] bjzi k−1(cid:88)i=0 aix(t0 + i · τ ). Because (t0+i·τ ) ∈ [0, T ] for any i = 0,··· , k−1, we have x(t0+iτ )2 ≤ max from Lemma 5.1. Hence k−1(cid:88)i=0 k−1(cid:88)i=0 j, we simplify it to be x(t0 + nτ ) = x(t0 + nτ ) = k(cid:88)j=1 bjzi j = bjzn j = bj( aizi j). ai t∈[0,T ]x(t)2 (cid:46) k4 log3 k(cid:107)x(cid:107)2 T x(t0 + n · τ )2 ≤ k ai2 · x(t0 + i · τ )2 t∈[0,T ]x(t)2 n2.2k · max ≤ k ≤ k7 · (2kt/T )2.2k(cid:107)x(cid:107)2 T . k−1(cid:88)i=0 k−1(cid:88)i=0 22 Thus, we complete the proof. 6 Hash Functions and Filter Functions 6.1 Permutation function and hash function We first review the permutation function Pσ,a,b and the hash function hσ,b in [PS15], which translates discrete settings to the continuous setting. Definition 6.1. For any signal x(t) : R → C and a, b, σ ∈ R, let (Pσ,a,bx)(t) = x(cid:0)σ(t − a)(cid:1)e−2πiσbt. Lemma 6.2. (cid:92)Pσ,a,bx(σ(f − b)) = 1 σ e−2πiσaf(cid:98)x(f ) and (cid:92)Pσ,a,bx(f ) = 1 σ e−2πiσa(f /σ+b)(cid:98)x(f /σ + b) For completeness, we provide a proof of Lemma 6.2 in Appendix A.4. Definition 6.3. [PS15] Let πσ,b(f ) = 2πσ(f − b) (mod 2π) and hσ,b(f ) = round(πσ,b(f ) · B the hash function that maps frequency f ∈ [−F, F ] into bins {0,··· , B − 1}. Claim 6.4. [PS15] For any ∆ > 0, let σ be a sample uniformly at random from [ 1 2π ) be (I) If ∆ ≤ f + − f− (II) If (B−1)∆ From previous work [HIKP12b, HIKP12a, PS15], uniformly sampling from [A, 2A] for some large , then Pr[hσ,b(f +) = hσ,b(f−)] (cid:46) 1 , then Pr[hσ,b(f +) = hσ,b(f−)] = 0 ≤ f + − f− < (B−1)∆ B 2 2 B∆ , 2 B∆ ]. A ≥ (cid:101)T provides an almost uniform sample on [0,(cid:101)T ] when taken modulo over (cid:101)T . Lemma 6.5. For any (cid:101)T , and 0 ≤(cid:101),(cid:101)δ ≤ (cid:101)T , if we sample(cid:101)σ uniformly at random from [A, 2A], then 4(cid:101) A ≤ Pr(cid:104)(cid:101)σ (mod (cid:101)T ) ∈ [(cid:101)δ −(cid:101),(cid:101)δ +(cid:101) ](cid:105) ≤ 2(cid:101) (15) + A . 6.2 Filter function 2(cid:101) (cid:101)T − 2(cid:101) (cid:101)T presented in Appendix C.1 and C.2. Lemma 6.6. Given s0, s1, 0 < s3 < 1, (cid:96) > 1, 0 < δ < 1, where (cid:96) = Θ(k log(k/δ)).The filter function We state the properties of filter function (H(t), (cid:98)H(f )) and (G(t),(cid:98)G(f )), the details of proofs are (H(t), (cid:98)H(f )) has the following properties, s3. s3. )s3. 1 2 − 2 s1 1 )s3 ≤ t ≤ 2 −(cid:96),∀t > 1 2 2 s1 ) + 2) Property IV : 1 2 − 1 2 Property I : H(t) ∈ [1 − δ, 1], when t ≤ ( Property II : H(t) ∈ [0, 1], when ( Property III : H(t) ≤ s0 · (s1(t s3 − s1(cid:96) supp((cid:98)H(f )) ⊆ [− 2s3 dt < δ(cid:90) +∞ (t) · H(t) · (1 − rect1(t))(cid:12)(cid:12)2 (t) · H(t) · rect1(t)2dt ∈ [1 − , 1] ·(cid:90) +∞ −∞ x s1(cid:96) 2s3 ]. ∗ ∗ , −∞ x ∗ (t) · rect1(t)2dt. ∗ (t) · rect1(t)2dt. For any exact k-Fourier-sparse signal x∗(t), we shift the interval from [0, T ] to [−1/2, 1/2] and consider x∗(t) for t ∈ [−1/2, 1/2] to be our observation, which is also x∗(t) · rect1(t). Property V : (cid:90) +∞ −∞ (cid:12)(cid:12)x Property VI : (cid:90) +∞ −∞ x for arbitrarily small constant . 23 are presented in the bottom one, the property IV is presented in the top one. Figure 2: The filter function (H(t), (cid:98)H(f )) with a k-Fourier-sparse signal. The property I, II and III Lemma 6.7. Given B > 1, δ > 0, α > 0, we set l = Ω(log(δ/k)). The filter function (G(t),(cid:98)G(f ))[B, δ, α, l] satisfies the following properties, 2π 2B ≤ f ≤ (cid:98)G(f ) ∈ [1 − δ/k, 1], if f ≤ (1 − α) (cid:98)G(f ) ∈ [0, 1], if (1 − α) (cid:98)G(f ) ∈ [−δ/k, δ/k], if f > 2 · −B l 2 · G(t) (cid:46) poly(B, l). supp(G(t)) ⊂ [ B πα 2π 2B . ]. , πα l Property I : Property II : Property III : Property IV : Property V : max t 2π 2B 2π 2B . . 6.3 HashToBins We first define two functions G σ,b(f ), then show the result returned by Procedure HashToBins in Algorithm 6 satisfying some nice properties. The details of proofs are presented in Appendix C.4. σ,b(t) and (cid:98)G (j) (j) 24 403020100102030400.010.000.010.020.030.040.050.06Given signal (Frequency domain)cH(f)cx∗(f)f=±s1'/(2s3)4321012340.20.00.20.40.60.81.0Fourier transform (Time domain)H(t)x∗(t)t=±0.5t=±0.5s3t=±(0.5−2/s1)s3 Definition 6.8. ∀σ > 0, b and j ∈ [B]. Define, Figure 3: G and (cid:98)G. [PS15] Lemma 6.9. Let u ∈ CB be the result of HashToBins under permutation Pσ,a,b, and let j ∈ [B]. Define G (j) σ,b(t) = 1 σ (j) (cid:98)G σ,b(f ) = (cid:98)Gdis( G(t/σ)e2πit(j/B−σb)/σ j B − σf − σb) =(cid:88)i∈Z (cid:98)G(i + (cid:98)z = (cid:91)x · H · (cid:98)G (j) σ,b, z = (x · H) ∗ G (j) σ,b. j B − σf − σb) so Let vector (cid:98)u ∈ CB denote the B-dimensional DFT of u, then ∀j ∈ [B], (cid:98)u[j] = zσa. 7 Frequency Recovery The goal of this section is to prove Theorem 2.6, which is able to recover the frequencies of a signal x∗ has k-sparse Fourier transform under noise. k(cid:80)j=1 T ≤ c(cid:107)x∗(t)(cid:107)2 vje2πifj t and x(t) = x∗(t) + g(t) be our observable signal where Theorem 2.6. Let x∗(t) = T for a sufficiently small constant c. Then Procedure FrequencyRecov- (cid:107)g(t)(cid:107)2 eryKCluster returns a set L of O(k) frequencies that covers all heavy clusters of x∗, which uses poly(k, log(1/δ)) log(F T ) samples and poly(k, log(1/δ)) log2(F T ) time. In particular, for ∆ = T , with probability 1 − 2−Ω(k), for any f∗ with T + δ(cid:107)x∗(t)(cid:107)2 poly(k, log(1/δ))/T and N 2 := (cid:107)g(t)(cid:107)2 (cid:90) f∗+∆ (16) f∗−∆ there exists an (cid:101)f ∈ L satisfying f (cid:91)x · H(f )2df ≥ TN 2/k, − (cid:101)f (cid:46) ∆√∆T . ∗ 25 −(1−α)πB(1−α)πB−πBπB 7.1 Overview We give an overview of proving Theorem 2.6. Instead of starting with k-cluster recovery, we first show how to achieve one-cluster recovery. j=1 vje2πifj t where there exists f0 and ∆ such One-cluster recovery. we start with x∗(t) = (cid:80)k that fj is in [f0 − ∆, f0 + ∆] for each j ∈ [k] and consider its properties for frequency recovery. Definition 7.1 ((, ∆)-one-cluster signal). We say that a signal z(t) is an (, ∆)-one-cluster signal around f0 iff z(t) and (cid:98)z(f ) satisfy the following two properties: f0−∆ (cid:98)z(f )2df ≥ (1 − )(cid:90) +∞ : (cid:90) f0+∆ z(t)2dt ≥ (1 − )(cid:90) +∞ : (cid:90) T −∞ (cid:98)z(f )2df −∞ z(t)2dt. The main result of one-cluster recovery is to prove that the two properties in Definition 7.1 with Property II Property I provides a black-box for k-cluster recovery algorithm. a sufficiently small constant  are sufficient to return (cid:101)f0 close to f0 with high probability, which We first prove that the pair of conditions, Property I and Property II in Definition 7.1, are sufficient to obtain an estimation of e2πif0 in Section 7.2. We also provide the proof of the correctness of Procedures GetLegal1Sample and GetEmpirical1Engergy in Section 7.2. 0 and an (, ∆)-one-cluster signal z(t) around f0, Procedure GetLegal1Sample in Algorithm 3 with Lemma 7.2. For a sufficiently small constant  > 0, any f0 ∈ [−F, F ], and ∆ > 0, given (cid:98)β (cid:104) 1 any β ≤ 2(cid:98)β takes O((T ∆)3) samples to output α ∈ R satisfying z(α + β) − z(α)e2πif0β ≤ 0.08(z(α) + z(α + β)), √ ∆T ∆ with probability at least 0.6. The following lemma shows that for any (, ∆)-one-cluster signal z(t) around f0, we could use the above procedure to find a frequency (cid:101)f0 approximating f0 with high probability. Lemma 7.3. For a sufficiently small constant  > 0, any f0 ∈ [−F, F ], and ∆ > 0, given an (, ∆)- one-cluster signal z(t) around f0 , Procedure FrequencyRecovery1Cluster in Algorithm 4 returns (cid:101)f0 with (cid:101)f0 − f0 (cid:46) ∆ · √∆T with probability at least 1 − 2−Ω(k). We provide a proof of Lemma 7.3 in Section 7.4. We show z(t) = (x∗(t) + g(t)) · H(t) satisfy Properties I and II (Definition 7.1) when all frequencies in(cid:98)x∗ are in a small range in Section 7.3. Lemma 7.4. For any f0 ∈ [−F, F ], ∆(cid:48) > 0, and x∗(t) =(cid:80)k j=1 vje2πift with fj − f0 ≤ ∆(cid:48) for all j ∈ [k], let x(t) = x∗(t) + g(t) be our observable signal whose noise (cid:107)g(cid:107)2 T for a sufficiently (cid:107)2 small constant c and H(t) be the filter function defined in Section 6 with supp((cid:98)H) = ∆h. Then z = H · x is an (O(√c), ∆h + ∆(cid:48))-one-cluster signal around f0. From all discussion above, we summarize the result of frequency recovery when (cid:98)x∗ is in one cluster. Theorem 7.5. For any f0 ∈ [−F, F ], ∆(cid:48) > 0, and x∗(t) = (cid:80)k j=1 vje2πifj t with fj − f0 ≤ ∆(cid:48) for all j ∈ [k], let x(t) = x∗(t) + g(t) be our observable signal whose noise (cid:107)g(cid:107)2 T for a (cid:107)2 sufficiently small constant c and H(t) be the filter function defined in Section 6 with supp((cid:98)H) = ∆h. Then Procedure FrequencyRecovery1Cluster in Algorithm 4 with ∆ = ∆(cid:48) + ∆h takes poly(k, log(1/δ)) · log(F T ) samples, runs in poly(k, log(1/δ)) · log2(F T ) time, returns a frequency (cid:101)f0 satisfying (cid:101)f0 − f0 (cid:46) ∆√∆T with probability at least 1 − 2−Ω(k). T ≤ c(cid:107)x∗ T ≤ c(cid:107)x∗ 26 k-cluster recovery. Given any x∗(t) = (cid:80)k j=1 vje2πifj t, we plan to convolve the filter function G(t) on x(t) · H(t) and use Lemma 7.3 as a black box to find a list of frequencies that covers {f1,··· , fk}. B∆ , 2 B∆ ] for k-cluster recovery. We will cover all f∗ We fix ∆ = poly(k, log(1/δ))/T , B = Θ(k) and sample σ uniformly at random from [ 1 ∈ [−F, F ] with the following property : (cid:91)x · H(f )2df ≥ TN 2/k, (cid:90) f∗+∆ (17) ∈ [−F, F ] satisfying (17) and use j = hσ,b(f∗) to denote its index in f∗−∆ We consider one frequency f∗ [B] after hashing (σ, b). Recall that for j ∈ [B], any σ > 0 and any b, G (j) σ,b(t) = 1 σ G(t/σ)e2πit(j/B−σb)/σ such that (cid:98)G (j) σ,b(f ) =(cid:88)i∈Z (cid:98)G(i + j B − σf − σb). (j) (j) σ,b and z = (x · H) ∗ G We set(cid:98)z = (cid:91)x · H · (cid:98)G with high probability over the hashing (σ, b), (z,(cid:98)z) satisfies Property I with [f∗ Property II in Definition 7.1 such that we could use Lemma 7.3 on z to recover f∗. Lemma 7.6. Let f∗ bucket that f∗ maps to under the hash such that z = (x · H) ∗ G probability at least 0.9, z(t) is an (, ∆)-one-cluster signal around f∗ . σ,b for f∗ and j = hσ,b(f∗). In Section 7.5, we show that − ∆, f∗ + ∆] and ∈ [−F, F ] satisfy (17). For a random hashing (σ, b), let j = hσ,b(f∗) be the σ,b. With (j) (j) Combining Lemma 7.6 and Lemma 7.3, we could recover any heavy frequency f∗ satisfying (17) with probability at least 0.8. Then we repeat this procedure to guarantee that we cover all heavy frequencies and finish the proof of the main frequency recovery Theorem 2.6 in Section 7.6. σ,b and (cid:98)z = (cid:91)x · H · (cid:98)G 7.2 Analysis of GetLegal1Sample and GetEmpirical1Energy Let I = [f0 − ∆, f0 + ∆] and I = (−∞, +∞) \ I in this proof. We define (cid:0)zI (t),(cid:98)zI (f )(cid:1) and (cid:0)zI (t),(cid:98)zI (f )(cid:1) as follows: if f ∈ I if f ∈ I , (cid:98)zI (f ) =(cid:40)0 (cid:98)z(f ) if f ∈ I if f ∈ I We consider zI (t) as the "signal" to recover f0 and treat zI (t) as the "noise". We first show some 0 basic properties of zI (t). (cid:98)zI (f ) =(cid:40)(cid:98)z(f ) Claim 7.7. For zI (t), we have(cid:82) T zI (t)2dt ≥ (1 − 5√)(cid:90) +∞ (cid:90) T 0 Proof. From the definition and Property I in Definition 7.1, we know −∞ zI (t)2dt. 0 −∞ z(t)2dt. For zI (t), we have zI (t)2dt ≥ (1 − 6√)(cid:90) +∞ 0 zI (t)2dt ≤ (cid:82) +∞ −∞ z(t)2dt and (cid:90) T (cid:90) +∞ −∞ (cid:98)zI (f )2df ≤ (cid:90) +∞ −∞ (cid:98)zI (f )2df ≤ (cid:90) +∞ −∞ zI (t)2dt =(cid:90) +∞ −∞ (cid:98)z(f )2df. −∞ (cid:98)z(f )2df. and 27 z(t) = zI (t) + zI (t) (cid:90) T 0 zI (t)2dt ≤(cid:90) +∞ Notice that Property I(in Definition 7.1) indicates that On the other hand, from Property II(in Definition 7.1), we know by the Cauchy-Schwartz inequality and have (1−)(cid:90) +∞ We have(cid:82) T we bound 0 0 0 zI (t) · zI (t)dt ≤ zI (t)2dt+2(cid:90) T −∞ z(t)2dt ≤(cid:90) T zI (t)+zI (t)2dt ≤(cid:90) T 0 zI (t)2dt ≤ 2(cid:82) +∞ −∞ z(t)2dt from the above inequality. From(cid:82) T (cid:90) T −∞ z(t)2dt (cid:90) T −∞ zI (t)2dt ≤ (cid:82) +∞ −∞ z(t)2dt, inequality (18) also indicates that zI (t)2dt ≥ (1 − 6√)(cid:90) +∞ (cid:90) T √2(cid:90) +∞ zI (t)2dt ≥ (1 − 5√)(cid:90) +∞ −∞ zI (t)2dt. −∞ z(t)2dt. 0 0 Because(cid:82) +∞ zI (t)·zI (t)dt+(cid:90) T 0 0 zI (t)2dt. 0 zI (t)2dt ≤ (cid:82) +∞ −∞ (cid:98)z(f )2df, (18) One useful property of zI (t) is that its maximum can be bounded by its average on [0, T ]. Claim 7.8. ∀t ∈ [0, T ],zI (t) ≤ 2√∆T · (cid:107)zI(cid:107)T . Proof. From the definition zI (t), it is upper bounded by (cid:82) f0+∆ the other hand, f0−∆ (cid:98)zI (f )df for any t ∈ [0, T ]. On (cid:90) f0+∆ f0−∆ (cid:98)zI (f )df ≤ √2∆((cid:90) f0+∆ = √2∆((cid:90) +∞ ≤ 2√∆((cid:90) T = 2√∆T(cid:107)zI(cid:107)T . 0 f0−∆ (cid:98)zI (f )2df )1/2 −∞ zI (t)2dt)1/2 zI (t)2dt)1/2 Claim 7.9. Given (cid:98)β = in zI (t), we have that Cβ ∆·√ ∆T with a sufficiently small constant Cβ, for any two (cid:98)β-close samples ∀α ∈ [0, T ], ∀β ∈ [(cid:98)β, 2(cid:98)β], zI (α)e2πif0β − zI (α + β) ≤ 0.01 · (cid:107)zI(cid:107)T . 28 Proof. From the definition of the Fourier transform, we have zI (a + β) − zI (a)e2πif0β = (cid:12)(cid:12)(cid:12)(cid:12)(cid:90) f0+∆ f0−∆ (cid:98)zI (f )e2πi(f a+f0β)(e2πi(f−f0)β − 1)df(cid:12)(cid:12)(cid:12)(cid:12) ≤ 2 · (2π∆β) ·(cid:90) f0+∆ √2∆(cid:18)(cid:90) f0+∆ √2∆(cid:18)(cid:90) T f0−∆ (cid:98)zI (f )df f0−∆ (cid:98)zI (f )2df(cid:19) 1 zI (t)2dt(cid:19) 1 ≤ 4πβ∆ · 0 2 2 ≤ 10π(cid:98)β∆ · −2(cid:107)zI(cid:107)T . ≤ 10 by Taylor expansion by Hölder inequality by inequality (18) rest of this section. We consider how to output an α such that e2πif0β ≈ z(α + β)/z(α) with high probability in the If we can sample from zI (t), we already know zI (α)e2πif0β − zI (α + β) ≤ 0.01(cid:107)zI(cid:107)T from Claim 7.9. Then it is enough to find any α such that zI (α) ≥ 0.5(cid:107)zI(cid:107)T . From Claim 7.8, we can take O(√∆T ) samples(cid:0)zI (α), zI (α + β)(cid:1) where each α is uniformly sampled from [0, T ] such that with high probability, the sample zI (α) with the largest norm zI (α) satisfies zI (α) ≥ 0.5(cid:107)zI(cid:107)T . Then we have e2πif0β ≈ zI (α + β)/zI (α). Next, we move to z(t) = zI (t) + zI (t) and plan to output α ∈ [0, T ] with probability at least 0.5 such that zI (α) ≤ 0.1zI (α) and zI (α + β) ≤ 0.1zI (α + β). Because the "noise" zI (t) has T for a constant  and the bound √∆T in Claim 7.8 is a polynomial in k, the (cid:107)zI (t)(cid:107)2 approach for zI (t) cannot guarantee that z(α + β)/z(α) ≈ e2πif0β with probability more than 1/2. T ≥ (cid:107)zI (t)(cid:107)2 The key observation is as follows: Observation 7.10. For a sufficiently small  and (cid:107)zI(cid:107)2 on [0, T ] according to z(t)2, i.e., DT (t) = instead of the uniform distribution on [0, T ], zI (α) ≤ 0.01zI (α) with probability 0.9. T , let DT be the weighted distribution . If we sample α ∈ [0, T ] from the distribution DT T ≤ (cid:107)z(cid:107)2 z(t)2 T(cid:107)z(cid:107)2 T It follows from the fact that E α∼DT z(α)2 =(cid:90) T zI (α)2 0 zI (α)2 z(α)2 · z(α)2 T(cid:107)z(cid:107)2 T dα = (cid:82) T 0 zI (α)2dα T(cid:107)z(cid:107)2 T ≤ . In Procedure GetLegal1Sample, we collect (∆T )2 samples (in expectation)(cid:0)z(α), z(α + β)(cid:1) in Sheavy with z(α) ≥ 0.49(cid:107)z(cid:107)T and resample one α from these samples according to their norm z(α)2 + z(α + β)2. We show its correctness as follows. Because we do not know 0.5(cid:107)z(cid:107)T , we use zemp to approximate it. Claim 7.11. Procedure GetEmpirical1Energy in Algorithm 3 takes O((T ∆)2) samples to output zemp such that zemp ∈ [0.8(cid:107)z(cid:107)T , 1.2(cid:107)z(cid:107)T ] with prob. 0.9. Proof. We know z2 emp = Ei∈[Rest][z(αi)2] = Ei∈[Rest][zI (αi) + zI (αi)2]. Notice that Ei∈[Rest][zI (αi)2] is in [0.99(cid:107)zI(cid:107)T , 1.01(cid:107)zI(cid:107)T ] with prob. 0.99 from the Chernoff bound and Claim 7.8. 29 a sufficiently small  and (cid:107)zI(cid:107)2 At the same time, Eαi[zI (αi)2] = (cid:107)zI(cid:107)2 T . With prob. 0.92, Ei∈[Rest][zI (αi)2] ≤ 13(cid:107)zI(cid:107)2 At last, we bound the cross terms of zI (αi) + zI (αi)2 by the Cauchy-Schwartz inequality, T , Ei∈[Rest][zI (αi)2] ≤ 13(cid:107)zI(cid:107)2 T . T ≤ (cid:107)zI(cid:107)2 T . For [zI (αi)zI (αi) + zI (αi)zI (αi)] [zI (αi) · zI (αi)] [zI (αi)2] · E i∈[Rest] [zI (αi)2](cid:19)1/2 E i∈Rest ≤ 2 E i∈Rest ≤ 2(cid:18) E i∈[Rest] ≤ 10√(cid:107)zI(cid:107)2 T . that (cid:90)U z(t)2dt =(cid:90) T For a sufficiently small , we have Ei∈[Rest][z(αi)2]1/2 is in [0.9(cid:107)zI(cid:107)T , 1.1(cid:107)zI(cid:107)T ], which is also in [0.8(cid:107)z(cid:107)T , 1.2(cid:107)z(cid:107)T ] because of Property II. We assume zemp ∈ [0.8(cid:107)z(cid:107)T , 1.2(cid:107)z(cid:107)T ] and focus on U = {t ∈ [0, T ](cid:12)(cid:12)z(t) ≥ 0.5zemp}. Notice Let Rheavy = Sheavy. From Claim 7.8 and , E[Rheavy] ≥ Rrepeat/(T ∆). So we assume Rheavy ≥ 0.01Rrepeat/(T ∆) = 0.01(T ∆)2 in the rest of this section and think each αi ∈ Sheavy is a uniform sample from U over the randomness on Sheavy. Claim 7.12. With probability 0.95,(cid:80)i∈Sheavy z(αi + β)2) for a sufficiently small  and (cid:107)zI(cid:107)2 Proof. At first, (zI (αi)2 +zI (αi + β)2) ≤ 10−4(cid:80)i∈Sheavy T . T ≤ (cid:107)z(cid:107)2 z(t)2dt −(cid:90)[0,T ]\U z(t)2dt ≥ (1 − 0.62)(cid:90) T (z(αi)2 + z(t)2dt. 0 0 [z(t)2] = Rheavy ·(cid:82)U z(t)2dt U . [zI (t)2 + zI (t + β)2] ≤ 2(cid:82) 0 T zI (t)2dt U . t∼U E At the same time, (z(αi)2 + z(αi + β)2) ≥ Rheavy · E [zI (αi)2 + zI (αi + β)2] = Rheavy · E Sheavy (cid:88)i∈Sheavy Sheavy (cid:88)i∈Sheavy From (cid:82)U z(t)2dt ≥ 0.64(cid:82) T 0 z(t)2dt and (cid:82) 0 t∼U E T zI (t)2dt ≤ (cid:82) T 0 z(t)2dt, we get the conclusion. We assume all results in the above claims hold and prove that the sample from Sheavy is a good sample such that zI (α) is small. Claim 7.13. If we sample i ∈ Sheavy according to the weight z(αi)2 + z(αi + β)2, with prob. at least 0.9, zI (αi) + zI (αi + β) ≤ 0.05(z(αi) + z(αi + β)). 30 Proof. Similar to the proof of the key observation, we compute the expectation of zI (αi)2+zI (αi+β)2 z(αi)2+z(αi+β)2 over the sampling in Sheavy: (cid:80)j∈Sheavyz(αj)2 + z(αj + β)2 · zI (αi)2 + zI (αi + β)2 z(αi)2 + z(αi + β)2 (cid:88)i∈Sheavy z(αi)2 + z(αi + β)2 = (cid:80)i∈SheavyzI (αi)2 + zI (αi + β)2 (cid:80)i∈Sheavyz(αi)2 + z(αi + β)2 −4. ≤ 10 By Markov's inequality, when we sample i ∈ Sheavy according to the weight z(αi)2 + z(αi + β)2, zI (αi)2+zI (αi+β)2 z(αi)2+z(αi+β)2 ≤ 10−3 with probability 0.9. We have that with prob. at least 0.9, zI (αi) + zI (αi + β) ≤ 0.05(z(αi) + z(αi + β)). We assume all above claims hold and finish the proof by setting α = αi. From Claim 7.9, we know that zI (α)e2πif0β − zI (α + β) ≤ 0.01 · E t∈[0,T ] [zI (α)2]1/2 ≤ 0.03zI (α). Now we add back the noise zI (α) and zI (α + β) to get z(α)e2πif0β −z(α+β) ≤ zI (α)e2πif0β −zI (α+β)+zI (α)+zI (α+β) ≤ 0.08(z(α)+z(α+β)). 7.3 A cluster of frequencies, times H, is a one-cluster signal per Definition 7.1 The goal of this section is to prove Lemma 7.4. Without loss of generality, we assume g(t) = 0 for any t /∈ [0, T ] and notice that supp((cid:98)H ∗(cid:98)x∗) ⊆ f0 + [−∆, ∆] for ∆ = ∆(cid:48) + ∆h from the definition of (cid:98)H. From the Property VI (presented in Lemma 6.6) of (H, (cid:98)H), (t)2dt. From the first two properties of (H, (cid:98)H), we bound the energy of g · H: g(t)2dt. (cid:90) T (cid:90) +∞ −∞ H(t) · g(t)2dt ≤ (1 + c)(cid:90) T (t)2dt = (1 ± c)(cid:90) +∞ Let z(t) = (x∗(t) + g(t))H(t). We use the triangle inequality on the above two inequalities: −∞ H(t) · x x ∗ ∗ 0 0 0 0 ∗ H(t) · x z(t)2dt (cid:90) T ≥ (cid:90) T ≥ (1 − c)(cid:90) T ≥ (cid:0)1 − 5√c(cid:1)(cid:90) T ∗ x 0 0 0 (t)2dt −(cid:90) T (t)2dt − (1 + c)(cid:90) T (t)2dt, ∗ x 0 H(t) · g(t)2dt − 2(cid:90) T 0 ∗ H(t) · x (t) · H(t) · g(t)dt g(t)2dt − 2(cid:115)(1 + c)2(cid:90) T 0 g(t)2dt(cid:90) T 0 x∗(t)2dt· 31 (cid:90) +∞ −∞ z(t)2dt ≤ (1 + c)(cid:90) T ∗ ≤ (1 + 5√c)(cid:90) T x 0 0 (t)2dt + (1 + c)(cid:90) T (t)2dt. x ∗ 0 g(t)2dt + 2(cid:115)(1 + c)2(cid:90) T 0 x∗(t)2dt(cid:90) T 0 g(t)2dt where we use the Cauchy-Schwarz inequality and (cid:82) T Similarly, 0 g(t)2dt ≤ c(cid:82) T 0 x∗(t)2dt in the last step. Hence we obtain Property II(in Definition 7.1) when c is sufficiently small. Then we observe that (cid:92) (cid:90) f0+∆h f0−∆h (cid:98)z(f )2df ≥ (cid:90) f0+∆h H · (x∗ + g)2df f0−∆h ≥ (cid:90) f0+∆h (cid:91)H · g2 − 2 (cid:92)H · x∗ 2 − f0−∆h 2df −(cid:90) +∞ ≥ (cid:90) f0+∆h (cid:92)H · x∗ f0−∆h 2dt −(cid:90) +∞ = (cid:90) +∞ ∗ −∞ H · x (1 − c) − c(1 + c) − 3√c (cid:92)H · x∗ (cid:91)H · gdf (cid:91)H · g2df − 2(cid:115)(cid:90) f0+∆h f0−∆h −∞ H · g2dt − 2(cid:115)(cid:90) f0+∆h f0−∆h H · x∗ (cid:90) +∞ −∞ z(t)2dt. Thus we have Property I(in Definition 7.1) for z. 1 + 5√c −∞ · ≥ (cid:91)H · g2df −∞ 2df(cid:90) +∞ (cid:92)H · x∗ 2dt(cid:90) +∞ −∞ H · g2dt 7.4 Frequency recovery of one-cluster signals The goal of this section is prove Theorem 7.5. We first show the correctness of Procedure Lo- cate1Inner. Second, we analyze the Procedure Locate1Signal. At end, we rerun Procedure Locate1Signal and use median analysis to boost the constant success probability.3 Lemma 7.14. Let f0 ∈ region(q(cid:48)). Let β is sampled from [ st 2∆l ] and let γ denote the output of Procedure GetLegal1Sample in Algorithm 4. Then using the pair of samples z(γ + β) and z(γ), we have I. for the q(cid:48) with probability at least 1 − s, vq(cid:48) will increase by one. II. for any q such that q − q(cid:48) Proof. We replace f0 by θ in the rest of the proof. By Lemma 7.2, we have that for any (cid:98)β ≤ β ≤ 2(cid:98)β, Procedure GetLegal1Sample outputs a γ ∈ [0, T ] satisfying > 3, with probability at least 1 − 15s, vq will not increase. 4∆ , st z(γ + β) − z(γ)e2πif0β ≤ 0.1(z(γ) + z(γ + β)) with probability at least 0.6. 3The proofs in this section are identical to [HIKP12b] and [PS15]. 32 Furthermore, there exists such some constant g ∈ (0, 1) such that with probability 1 − g, (cid:107)φ(z(γ + β)) − (φ(z(γ)) − 2πβθ)(cid:107)(cid:13) (cid:46) sin −1( 1 g ), where (cid:107)x − y(cid:107)(cid:13) = min s = Θ(g−1). There exists some constant p = Θ(s), with probability at least 1 − p, z∈Zx − y + 2πz denote the "circular distance" between x and y. We can set (cid:107)o − 2πβθ(cid:107)(cid:13) < sπ/2 where o := φ(z(γ + β)/z(γ)). The above equation shows that o is a good estimate for 2πβθ with good probability. We will now show that this means the true region Qq(cid:48) gets a vote with large probability. For each q(cid:48) with θ ∈ [l− ∆l 2 + q(cid:48)−1 t ∆l, l− ∆l 2 + q(cid:48) satisfies that t ∆l] ⊂ [−F, F ], we have that θq(cid:48) = l− ∆l 2 + q(cid:48)−0.5 t ∆l θ − θq(cid:48) ≤ ∆l 2t . (Note that A is 2 . Thus, we can show the observation o is close 2∆l ≤ cT 10A 3 2 Note that we sample β uniformly at random from [(cid:98)β, 2(cid:98)β], then 2(cid:98)β = st some constant > 1), which implies that 2πβ ∆l to the true region in the following sense, (cid:107)o − 2πβθq(cid:48)(cid:107)(cid:13) ≤ (cid:107)o − 2πβθ(cid:107)(cid:13) + (cid:107)2πβθ − 2πβθq(cid:48)(cid:107)(cid:13) by triangle inequality sπ ≤ 2 ≤ sπ. + 2π(cid:107)βθ − βθq(cid:48)(cid:107)(cid:13) 2t ≤ sπ Thus, vq(cid:48) will increase in each round with probability at least 1 − s. > 3. Then θ − θq ≥ 7∆l have On the other side, consider q with q − q(cid:48) There are two cases: θ − θq ≤ ∆l First, if θ − θq ≤ ∆l 2πβθ − θq ≥ 2π sπt st 2∆lθ − θq ≥ 4∆lθ − θq = st . st and θ − θq > ∆l st . In this case, from the definition of β it follows that 7sπ 4 > 3sπ 2 . 2πβθ − θq ≤ sπt ∆l θ − θq ≤ π 2t , and (assuming β ≥ st 4∆l) we Combining the above equations implies that Pr(cid:2)2πβ(θ − θq) 2π](cid:3) = 0 Second, if θ−θq > ∆l st . We show this claim is true : Pr[2πβ(θ−θq) (mod 2π) ∈ [− 3s To prove it, we apply Lemma 6.5 by setting (cid:101)T = 2π, (cid:101)σ = 2πβ, (cid:101)δ = 0,  = 3s ∆f = θ − θq. By upper bound of Lemma 6.5, the probability is at most (mod 2π) ∈ [− 3s 4 3s 4 2π, 4 2π, 3s 4 2π]] (cid:46) s. 4 2π, A = 2π(cid:98)β, Then in either case, with probability at least 1 − 15s, we have + A∆f 4(cid:101) 2(cid:101) (cid:101)T = + 3s 2 3s (cid:98)β∆f ≤ 3s 2 + 3s st 4∆l ∆l st < 15s which implies that vq will not increase. (cid:107)2πβθq − 2πβθ(cid:107)(cid:13) > 33 3s 4 2π Lemma 7.15. Procedure Locate1Inner in Algorithm 4 uses Rloc "legal" samples, and then af- ter Procedure Locate1Signal in Algorithm 4 running Procedure Locate1Inner Dmax times, it outputs a frequency (cid:101)f0 such that with arbitrarily large constant probability. Proof. For each observation, vq(cid:48) incremented with probability at least 1 − p and vq is incremented with probability at most 15s + p for q − q(cid:48) > 3. The probabilities corresponding to different observations are independent. Then after Rloc observations, there exists some constant c < 1 2, for any q such that q − q(cid:48) (cid:101)f0 − f0 (cid:46) ∆ · > 3, √T ∆ Pr[False region gets more than half votes] = Pr[vj,q > Rloc/2] Rloc/2(cid:19)(15s + p)Rloc/2 ≤ (cid:18) Rloc ≤ cΩ(Rloc) Similarly, on the other side, Pr[True region gets less than half votes] = Pr[vj,q(cid:48) < Rloc/2] Rloc/2(cid:19)(p)Rloc/2 ≤ (cid:18) Rloc ≤ cΩ(Rloc) Taking the union bound over all the t regions, it gives with probability at least 1 − tf Ω(Rloc) we can find some region q such that q − q(cid:48) If we repeat the above procedure Dmax rounds, each round we choose the "False" region with probability at most 1 − tcΩ(Rloc). Thus, taking the union bound over all the Dmax rounds, we will report a region has size (cid:104) ∆√∆T and contains f0 with probability at least 1 − DmaxtcΩ(Rloc). The reason for not ending up with region that has size (cid:104) ∆ is, the upper bound of the sample range of β force us to choose β is at most (cid:46) T by Claim 7.9 < 3. It remains to explain how to set Dmax, t, and Rloc. At the beginning of the first round, we start with frequency interval of length 2F , at the beginning of the last round, we start with frequency interval of length t · ∆√T ∆. Each round we do a t-ary search, thus ) ≤ logt(F/∆). Dmax = logt( t∆√T ∆ 2F (∆T ) 3 2 We can set Rloc (cid:104) log1/c(t/c) and t > Dmax, e.g. t = log(F/∆). Thus, the probability becomes, 1 − DmaxtcΩ(Rloc) ≥ 1 − t2cΩ(Rloc) ≥ 1 − poly(1/t, c) which is larger than any constant probability. Using the same parameters setting in the proof of Lemma 7.15, we show the running time and sample complexity of Procedure Locate1Signal, 34 Lemma 7.16. Procedure Locate1Signal in Algorithm 4 uses O(poly(k, log(1/δ))) · log(F T ) samples and runs in O(poly(k, log(1/δ))) · log2(F T ) time. Proof. The number of "legal" observations is DmaxRloc = O(logt(F/∆) log1/c(t/c)) = O(log(F/∆)) The total number of samples is Rest + RrepeatDmaxRloc = O(T ∆h)2 + (T ∆h)3 · log(F T ) = poly(k, log(1/δ)) · log(F T ) where the first step follows by Claim 7.11 and Lemma 7.2 and the last step follows by the setting of ∆h in Appendix C.3. The running time includes two parts, one is approximately computing H(t) for all the samples, each sample takes poly(k, log(1/δ)) time according to Lemma C.8; the other is for each legal sample we need to assign vote to some regions. poly(k, log(1/δ)) · (Rest + RrepeatDmaxRloc) + DmaxRloct = poly(k, log(1/δ)) log2(F T ) Lemma 7.17 only achieves constant success probability, using median analysis we can boost the success probability, Lemma 7.17. Let (cid:101)f0 denote the frequency output by Procedure FrequencyRecovery1Cluster in Algorithm 5, then with probability at least 1 − 2−Ω(k), (cid:101)f0 − f0 (cid:46) ∆√T ∆ Proof. Because of Procedure FrequencyRecovery1Cluster taking the median of O(k) inde- pendent results by repeating algorithm Locate1Signal O(k) times. Each sample Lr is close to (cid:101)f0 with sufficiently large probability. Thus, using the Chernoff bound will output (cid:101)f0 with probability 1 − 2−Ω(k) such that (cid:101)f0 − f0 (cid:46) ∆√T ∆. Combining Lemma 7.17 with the sample complexity and running time in Lemma 7.15, we are able to finish the proof of Theorem 7.5. 7.5 The full signal, after multiplying by H and convolving with G, is one- clustered. The goal of this section is to prove Lemma 7.6. We fix f∗ ∈ [−F, F ] satisfying (17) in this section. We first define a good hashing (σ, b) of f∗ as follows. Definition 7.18. We say that a frequency f∗ is well-isolated under the hashing (σ, b) if, for j = hσ,b(f∗), we have that the signal satisfies, over the interval If∗ = (−∞,∞) \ (f∗ (cid:98)z(j) = (cid:91)x · H · (cid:98)G − ∆, f∗ + ∆), (j) σ,b (cid:90)If∗ (cid:98)z(j)(f )2df (cid:46)  · TN 2/k. 35 For convenience, we simplify z(j) by using z in the rest of this section. B∆ , 2 Either it is: Lemma 7.19. Let f∗ be any frequency. Then f∗ is well-isolated by a hashing (σ, b) with probability ≥ 0.9 given B = Θ(k) and σ ∈ [ 1 B∆ ] chosen uniformly at random. Proof. For any other frequency f(cid:48) in x∗, its contribution in (cid:98)z depends on how far it is from f∗. • Within ∆ of f∗, f(cid:48) and f∗ will be mapped into the same bucket with probability at least 0.99. • Between ∆ and 1/σ far, from Claim 6.4, f(cid:48) and f∗ will always mapped into different buckets. Hence f(cid:48) always contributes in the δ k region of Property III in Lemma 6.7 about filter function (G(t),(cid:98)G(f )), i.e., it contributes at most δ (cid:91)x · H2df. Overall it will contribute k (cid:90) x · H2dt. k ·(cid:82) f(cid:48)+∆ (cid:91)x · H2df = k ·(cid:90) f(cid:48)−∆ δ δ • More than 1/σ far, in which case they contribute in the same region with probability at most 3/B. By a union bound, it is at most 3k/B ≤ 0.01 ∈ (cid:92)x∗ a part of x∗ · H. We first consider frequency f∗ (cid:92)x∗ Without loss of generality, we assume supp((cid:91)g · H) ∩ supp((cid:92)x∗ · H) = ∅, otherwise we treat it as · H under G σ,b. Lemma 7.20. Let f∗ satisfying (cid:82) f∗+∆ · H(f )2df ≥ TN 2/k and (cid:98)z = (cid:92)x∗ · H · (cid:98)G hσ,b(f∗). If f∗ is well-isolated, then z and (cid:98)z satisfying Property I(in Definition 7.1), i.e., Proof. We first notice that z(t) = x∗(t) · H(t) ∗ G z(t)2dt ≥ (1 − )(cid:90) +∞ −∞ z(t)2dt as follows : −∞ z(t)2dt. σ,b where j = (cid:90) T f∗−∆ (j) (j) (j) 0 σ,b(t) and lower bound(cid:82) +∞ by FT (j) (j) σ,b(t)2dt σ,b(f )2df σ,b(f )2df (j) · H(f ) 2df (t) · H(t) ∗ G −∞ (cid:92)x∗ (cid:92)x∗ ∗ −∞ x (cid:90) +∞ = (cid:90) +∞ · H(f ) · (cid:98)G ≥ (cid:90) f0+∆ · H(f ) · (cid:98)G f0−∆ ≥ (1 − δ)2(cid:90) f0+∆ f0−∆ ≥ (1 − δ)2TN 2/k ≥ 0.9 (t)2dt ∗ x k(cid:90) T (cid:92)x∗ δ 0 We give an upper bound (cid:82) 0−∞ z(t)2dt +(cid:82) +∞ proof. T (19) k(cid:82) T 0 x∗(t)H(t)2dt in the rest of this z(t)2dt (cid:46)  δ 36 Consider the case t < 0, by definition of Convolution, z(j)(t) = x ∗ (t) · H(t) ∗ G (j) σ,b(t) =(cid:90) +∞ −∞ (j) σ,b(t − τ ) · (x G ∗ · H)(τ )dτ Without loss of generality, we can shift the original signal and H(t) from [0, T ] to [−T /2, T /2], by Property of H(t), we know that if s3T /2 ≤ t ≤ T /2, then H(t) ≤ 2−OΘ((cid:96)). Note that G(t) is compact and has support DB, we also assume its compact region is [−DB/2, DB/2] (Recall that D = l απ ). Thus, by definition of convolution, z(t) 1 (j) = −DBσ/2 −DBσ/2 σ,b(s) · (x · H)(t − τ )dτ G G(s/σ)e2πis(j/B−σb)/σ · (x · H)(t − τ )dτ = (cid:90) DBσ/2 σ(cid:90) DBσ/2 σ(cid:90) DBσ/2 ≤ (cid:32) 1 −DBσ/2 G(τ /σ)dτ(cid:33) ·(cid:18) max σ(cid:90) DBσ/2 −DBσ/2 G(τ /σ) · (x · H)(t − τ )dτ τ≤DBσ/2(x · H)(t − τ )(cid:19) ≤ 1 So, if t /∈ [−T /2, T /2], then t − s /∈ [−T /2 + DBσ/2, T /2 − DBσ/2]. By Property V of G(t), G(t) ≤ poly(k, log(1/δ)). Because of the parameter setting4, we have the fact [−T s3/2, T s3/2] ⊆ [−T /2 + DBσ/2, T /2 − DBσ/2] ⊆ [−T /2, T /2]. Thus, we know T (1 − s3)/2 > DBσ/2, then for any t − τ ∈ [−T /2,−T /2 + DBσ/2] ∪ [T /2 − DBσ/2, T /2] = S, then z(t)2 (cid:46)(cid:0)DBσ · σ · poly(k, log(1/δ))(cid:1)2 (cid:46) poly(k, log(1/δ)) · 2 −Θ((cid:96)) · k4 · (cid:107)x −Θ((cid:96)) · (cid:107)x (t)(cid:107)2 T . (t)(cid:107)2 · 2 1 ∗ ∗ T Thus, taking the integral over S, (cid:90)S z(t)2dt (cid:46) S · 2 −Θ((cid:96)) poly(k, log(1/δ)) · (cid:107)x ∗ (t)(cid:107)2 (cid:46) 2 −Θ((cid:96))T(cid:107)x ∗ (t) · H(t)(cid:107)2 T By property of filter function H(t), (cid:98)H(f ), we have −(cid:96)(cid:107)x (x · H)(t)2 ≤ ( t T ) ∗ (t) · H(t)(cid:107)2 T if t ≥ 3T Thus for any constant , (cid:90) −T /2 −∞ z(t)2dt +(cid:90) +∞ T /2 z(t)2dt (cid:46) 2 ∗ −(cid:96)T(cid:107)x (t) · H(t)(cid:107)2 T ≤ 0.9 · where the last inequality follows by (cid:96) (cid:38) k log(k/δ). Shifting the interval from [−T /2, T /2] to [0, T ], the same result is still holding. Combining Equation (19) and (20) completes the proof of Property II. δ k(cid:90) T /2 −T /2 x ∗ (t)2dt (20) 4We will set B to be O(k), D to be poly(k) and σ to be T / poly(k). 37 We consider frequency f∗ (cid:91)g · H under G ∈ tributed over B bins on expectation. Lemma 7.21. Given any noise g(t) : [0, T ] → C and g(t) = 0,∀t /∈ [0, T ]. We have, ∀j ∈ [B], (j) σ,b and show the energy of noise g(t) is evenly dis- (j) E −∞ g(t)H(t) ∗ G σ,b(cid:20)(cid:90) +∞ σ,b(cid:20)(cid:90) +∞ Proof. Because of Fourier Transform preserves (cid:96)2 norm, it suffices to prove B(cid:90) +∞ −∞ g(t)H(t)2dt B(cid:90) +∞ Since (cid:98)G outputs ≤ δ on other part. Thus, for any frequency f, we have σ,b(t)2dt(cid:21) (cid:46) 1 σ,b(f )2df(cid:21) (cid:46) 1 (cid:91)g · H(f )2df −∞ E (j) (j) σ,b(f ) is a periodic function and outputs at most 1 on O(1/B) fraction of the period, and Proof of Lemma 7.6. Let j = hσ,b(f∗), signal (21) − ∆, f∗ + ∆) with complement If∗ = (−∞,∞) \ If∗. From Property I of G in (j) σ,b, On the other hand, f∗ is will-isolated with probability 0.9: Hence,(cid:98)z satisfies the Property I(in Definition 7.1) of one-mountain recovery. Combining Lemma 7.20 and Lemma 7.21, we know that (x∗ σ,b always satisfies Property II(in Definition 7.1) and (cid:82) +∞ σ,b(t)2dt is less than 20TN 2/B ≤ TN 2/k with probability at least 0.95, which −∞ g(t)H(t) ∗ G indicates that z = (x∗ +g)·H ∗G σ,b satisfies Property II(in Definition 7.1) with probability 0.95. · H) ∗ G (j) (j) (j) Thus, we have which completes the proof. and region If∗ = (f∗ Lemma 6.7, we have that for all f ∈ If∗, so by (17) (j) B E E −∞ (cid:91)g · H(f ) · (cid:98)G σ,b(cid:104)(cid:98)G σ,b(f )2(cid:105) (cid:46) 1 σ,b(cid:20)(cid:90) +∞ σ,b(f )2df(cid:21) (cid:91)g · H(f ) · (cid:98)G σ,b(cid:20)(cid:90) +∞ σ,b(f )2df(cid:21) (cid:91)g · H(f )2 · (cid:98)G ≤ E −∞ = (cid:90) +∞ (cid:91)g · H(f )2 · E [(cid:98)G σ,b(f )2]df ≤ (cid:90) +∞ f (cid:20) E 2(cid:21) σ,b(f )(cid:12)(cid:12)(cid:12) σ,b(cid:12)(cid:12)(cid:12)(cid:98)G (cid:91)g · H(f )2df · max B(cid:90) +∞ (cid:91)g · H(f )2df, −∞ −∞ −∞ −∞ (cid:46) 1 σ,b (j) (j) (j) (j) (cid:98)z = (cid:91)x · H · (cid:98)G (cid:98)G σ,b(f ) (cid:38) 1 (l) (cid:90)If∗ (cid:98)z(f )2df ≥ TN 2/k. (cid:90)If∗ (cid:98)z(f )2df (cid:46) TN 2/k. 38 (22) 7.6 Frequency recovery of k-clustered signals The goal of this section is to prove that the frequencies found by Procedure FrequencyRecov- eryKCluster in Algorithm 8 have some reasonable guarantee. We first notice that Lemma 7.6 and Lemma 7.3 imply the following lemma by a union bound. Lemma 7.22. Let x∗(t) = T ≤ c(cid:107)x∗(t)(cid:107)2 T . Then Procedure OneStage for a sufficiently small constant c and define N 2 := (cid:107)g(t)(cid:107)2 returns a set L of O(k) frequencies that covers the heavy frequencies of x∗. In particular, for any f∗ with k(cid:80)j=1 vje2πifj t. We observe x(t) = x∗(t) + g(t), where (cid:107)g(t)(cid:107)2 T +δ(cid:107)x∗(t)(cid:107)2 T (cid:90) f∗+∆ there will exist an (cid:101)f ∈ L satisfying f∗ f∗−∆ (cid:91)x · H(f )2df ≥ TN 2/k, − (cid:101)f (cid:46) √T ∆ · ∆T with probability 0.99. (23) k(cid:80)j=1 f∗−∆ T ≤ c(cid:107)x∗(t)(cid:107)2 vje2πifj t and R = O(k). We observe x(t) = x∗(t) + g(t), where Lemma 7.23. Let x∗(t) = T + δ(cid:107)x∗(t)(cid:107)2 T . (cid:107)g(t)(cid:107)2 Then Algorithm MultipleStages returns a set L of O(k) frequencies that approximates the heavy frequencies of x∗. In particular, with probability 1 − 2−Ω(k), for any f∗ such that T for a sufficiently small constant c and choose N 2 := (cid:107)g(t)(cid:107)2 at most k times the threshold TN 2. (cid:91)x · H(f )2df ≥ TN 2/k, − (cid:101)f (cid:46) √T ∆∆. (cid:90) f∗+∆ there will exist an (cid:101)f ∈ L satisfying f∗ Proof. Let A ⊂ [−F, F ] denote the set of frequencies f∗ satisfying Equation (22). Let A(cid:48) denote a net of A of distance 2∆, so the intervals used in Equation (22) for each f∗ Then ⊂ [−F, F ] ∈ A(cid:48) are disjoint. because each frequency in x∗ contributes to at most two of the intervals, and the total mass of(cid:98)g is f ∈ A(cid:48) is successfully recovered in round r if there exists an (cid:101)f ∈ Lr such that f − (cid:101)f ≤ ∆a, where By Lemma 7.22, each frequency is successfully recovered with 0.8 probability in each round. Then by the Chernoff bound, with 1 − 2−Ω(k) probability, every f ∈ A(cid:48) will be successfully recovered in at least 0.6R rounds. Then, by Lemma 7.24, we output a set L of O(B) frequencies such that every f ∈ A(cid:48) is within ∆a of some (cid:101)f ∈ L. Hence every f ∈ A is within 2∆a of some (cid:101)f ∈ L. Let L1, . . . , LR be the results of R rounds of Algorithm OneStage. We say that a frequency ∆a = ∆√T ∆ (cid:46) √T ∆∆. ≤ 2k + k = 3k A (cid:48) Lemma 7.24. Let L1, . . . , LR by sets of frequencies and f∗ be any frequency. Then L = MergedStages(L1, . . . , LR) is a set of 2 frequencies satisfying (cid:80) Lr R ∗ min(cid:101)f∈L f Let ∆ = medianr∈[R] minf∈Lr f∗ − f. Proof. The algorithm is to take the union, sort, and take every R ∆ of f∗. This set forms a sequential subsequence of the sorted list of frequencies, so our output will include one. − (cid:101)f ≤ median − f. We have that at least R/2 different f ∈(cid:83)r Lr lie within 2 th entry of the sorted list. f∈Lr f min r∈[R] ∗ 39 7.7 Time and sample complexity of frequency recovery of k-clustered signals The goal of this section is to show that Procedure FrequencyRecoveryKCluster takes poly(k, log(1/δ)) log(F T ) samples, and runs in poly(k, log(1/δ)) log2(F T ) time. In order to analyze the running time and sample complexity. We need to extend the one-cluster version Procedure GetLegal1Sample and GetEmpirical1Energy (in Algorithm 3) to k-cluster version GetLegalKSample and GetEmpiricalKEnergy(in Algorithm 7)5, Lemma 7.25. Procedure GetLegalKSample in Algorithm 7 runs Procedure HashToBins Rrepeat = O((T ∆)3) times to output two vectors(cid:98)v,(cid:98)v(cid:48) (cid:98)vj −(cid:98)v holds with probability at least 0.6. (cid:48) ∈ CB such that, for each j ∈ [B], je2πifj β ≤ 0.08((cid:98)vj + (cid:98)v (cid:48) j), Using the definition of z in Definition 7.18. Claim 7.26. Procedure GetEmpiricalKEnergy in Algorithm 7 runs Procedure HashTobins RestO((T ∆)2) times to output a vector zemp ∈ RB such that, for each j ∈ [B], zj emp ∈ [0.8(cid:107)z(j)(cid:107)T , 1.2(cid:107)z(j)(cid:107)T ], holds with probability at least 0.9. Claim 7.27. Algorithm LocateKSignal in Algorithm 6 uses O(poly(k, log(1/δ))· log(F T )), and runs in O(poly(k, log(1/δ)) · log2(F T )). Proof. We first calculate the number of samples. All the samples is basically all the Fourier samples, each time needs B log(k/δ). In total it calls HashToBins O(Rest + RrepeatDmaxRloc) times where DmaxRloc = Θ(log(F T )) by similar analysis as one-cluster frequency recovery. Thus, the total number of samples is (Rest + RrepeatDmaxRloc)B log(k/δ) = poly(k, log(1/δ)) · log(F T ). Then, we analyze the running time. The expected running time includes the following parts: the first part is running Procedure HashToBins O(Rest + RrepeatDmaxRloc) times, each run takes O(B log(k/δ) + B log B) samples. For each such sample we need poly(k, log(1/δ)) time to compute H(t) according to Lemma C.8 and there are poly(k, log(1/δ)) log(F T )) many samples; the second part is updating the counter v,which takes O(DmaxRlocBt) time. Thus, in total poly(k, log(1/δ)) · O(Rest + RrepeatDmaxRloc) · O(B log(k/δ) + B log B) + O(DmaxRlocBt) = poly(k, log(1/δ)) · log2(F T ), where by similar analysis as one-cluster recovery, t = Θ(log(F T )) and DmaxRloc = Θ(log(F T )). To boost the success probability, Procedure MultipleStages reruns Procedure LocateKSig- nal O(k) times. At the end, Procedure FrequencyRecoveryKCluster combining Procedure MultipleStages and MergedStages directly, and the running time and sample complexity of MultipleStages are dominating MergedStages. Thus we have Lemma 7.28. Procedure FrequencyRecoveryKCluster in Algorithm 8 uses O(poly(k, log(1/δ))· log(F T )), and runs in O(poly(k, log(1/δ)) · log2(F T )). 5We omitted the proofs here, because the proofs are identical to the one-cluster situation. 40 8 One-cluster Signal Recovery 8.1 Overview is min frequency f0 and ∆(cid:48) > 0 and provide an algorithm to approximate it by a polynomial. In this section, we consider x∗ whose frequencies in (cid:98)x∗ are in the range [f0 − ∆(cid:48), f0 + ∆(cid:48)] for some T (cid:82) T We fix T in this section and recall that (cid:104)f (t), g(t)(cid:105)T := 1 0 f (t)g(t)dt such that (cid:107)e2πifit(cid:107)T = (cid:112)(cid:104)e2πifit, e2πifit(cid:105)T = 1. For convenience, given vje2πifj t, we say the frequency gap of this signal i(cid:54)=j fi − fj. For simplicity, we first consider frequencies clustered around 0. The main technical lemma in this section is that any signal x∗ with bounded frequencies in (cid:98)x∗ can be approximated by a low-degree Lemma 2.3. For any ∆ > 0 and any δ > 0, let x∗(t) =(cid:80)j∈[k] vje2πifj t where fj ≤ ∆ for each j ∈ [k]. There exists a polynomial P (t) of degree at most polynomial on [0, T ]. k(cid:80)j=1 d = O(T ∆ + k3 log k + k log 1/δ) such that ∗ (cid:107)P (t) − x (t)(cid:107)2 T ≤ δ(cid:107)x (cid:107)2 T . ∗ One direct corollary is that when(cid:98)x∗ are in the range [f0 + ∆(cid:48), f0 + ∆(cid:48)], we can approximate x∗ by P (t) · e2πif0t for some low degree polynomial P . We give an overview of this section first. We first show some technical tools in Section 8.2, 8.3. In Section 8.4, using those tools, we can show for any k-Fourier-sparse signal, there exists another k-Fourier-sparse signal with bounded frequency gap close to the original signal. In Section 8.5, we show that for any k-Fourier-sparse signal with bounded frequency gap, then there exists a low degree polynomial close to it. In Section 8.6, we show how to transfer low degree polynomial back to a Fourier-sparse signal. Combining all the above steps finishes the proof of Lemma 2.3. We apply Theorem 7.5 of frequency estimation on x∗ to obtain an estimation (cid:101)f0 of f0 and use Theorem 4.5 on the approximation Q(t)e2πi(cid:101)f0t of x∗ to recover the signal. We summarize this result as follows. k(cid:80)j=1 Theorem 8.1 (One-cluster Signal Recovery). Let x∗(t) = vje2πifj t where ∀j ∈ [k],fj − f0 ≤ ∆ and x(t) = x∗(t) + g(t) be our observable signal. For any δ > 0 and any T > 0, let N 2 := T + δ(cid:107)x∗ T . Procedure CFT1Culster in Algorithm 5 finds a polynomial P (t) of degree at most (cid:107)2 (cid:107)g(cid:107)2 d = O(cid:0)(T ∆h + T ∆)1.5 + k3 log k + k log 1/δ(cid:1) and a frequency (cid:101)f0 such that (cid:107)P (t) · e2πi(cid:101)f0t − x The algorithm uses O(kd)+poly(k, log(1/δ)) log(F T ) samples, run in O(kdω)+poly(k, log(1/δ)) log2(F T ) time, and succeeds with probability at least 1 − 2−Ω(k). Proof. We apply the algorithm in Theorem 7.5 to obtain an estimation (cid:101)f0 with poly(k) log(F T ) samples and poly(k) log2(F T ) running time such that (cid:101)f0 − f0 (cid:46) (∆h + ∆)(cid:112)T (∆h + ∆) holds with probability at least 1 − 2−Ω(k). Notice that fj − (cid:101)f0 ≤ fj − f0 + (cid:101)f0 − f0 (cid:46) (T (∆h + ∆))1.5. (cid:46) N 2 (t)(cid:107)2 (24) ∗ T 41 We consider x(cid:48)(t) = e−2πi(cid:101)f0tx(t) = P (t) of degree at most vje2πi(fj−(cid:101)f0)t . By Lemma 2.3, there exists a polynomial k(cid:80)j=1 such that it approximates x(cid:48) by d = O(cid:0)(T ∆h + T ∆)1.5 + k3 log k + k log 1/δ(cid:1) (cid:48) δ 4(cid:107)x 4(cid:107)x∗(t)(cid:107)T . (cid:48) (cid:107)P (t) − x (t)(cid:107)T ≤ (t)(cid:107)T = ∗ δ 4(cid:107)x (t)(cid:107)T . which indicates (cid:107)Q(t) − e−2πi(cid:101)f0t · x∗(t)(cid:107)T ≤ δ Because we can sample x(t), we can also sample e−2πi(cid:101)f0t · x(t) = Q(t) + g(cid:48)(t) for g(cid:48)(t) = e−2πi(cid:101)f0t · g(t) + (e−2πi(cid:101)f0t · x∗(t) − Q(t)). Hence we apply the algorithm in Theorem 4.5 and choose R = O(k) in that proof. Then Procedure RobustPolynomialLearning+ takes O(kd) samples and O(kdω) time to find a degree d polynomial P (t) approximating Q(t) such that (cid:107)P (t) − Q(t)(cid:107)T (cid:46) (cid:107)g holds with probability at least 1 − 2−Ω(k). It indicates Therefore we know (cid:107)e2πi(cid:101)f0t · P (t) − x∗(t)(cid:107)2 (t)(cid:107)T (cid:46) (cid:107)P (t) − Q(t)(cid:107)T + (cid:107)Q(t) − x −2πi(cid:101)f0t · x (cid:107)P (t) − e (cid:46) N 2. ∗ T (cid:48) (t)(cid:107)T , ∗ (t)(cid:107) (cid:46) δ(cid:107)x ∗ (t)(cid:107)T + (cid:107)g(t)(cid:107)T (cid:104) N . 8.2 Bounding the Gram matrix determinant We define Gram matrix for e2πif1t, e2πif2t,··· , e2πifkt and provide lower/upper bounds for its deter- minant. Definition 8.2 (Gram matrix). We define Gramf1,··· ,fk to be  (cid:104)e2πif1t, e2πif1t(cid:105)T (cid:104)e2πif2t, e2πif1t(cid:105)T (cid:104)e2πifkt, e2πif1t(cid:105)T ··· (cid:104)e2πif1t, e2πif2t(cid:105)T (cid:104)e2πif2t, e2πif2t(cid:105)T (cid:104)e2πifkt, e2πif2t(cid:105)T ··· ··· ··· ··· ··· (cid:104)e2πif1t, e2πifkt(cid:105)T (cid:104)e2πif2t, e2πifkt(cid:105)T (cid:104)e2πifkt, e2πifkt(cid:105)T ···  Note that the above matrix is a Hermitian matrix with complex entries, thus both its determinant and all eigenvalues are in R. We defer the proof of the following Theorem to Appendix A.1. Theorem 8.3. For real numbers ξ1, . . . , ξk, let Gξ1,...,ξk be the matrix whose (i, j)-entry is e2πi(ξi−ξj )tdt. (cid:90) 1 −1 Then det(Gξ1,...,ξk ) = 2 min(ξi − ξj2, 1). We use the following corollary in this section. O(k2)(cid:89)i<j 42 Corollary 8.4. There exists a universal constant α > 0 such that, for any T > 0 and real numbers f1,··· , fk, the k × k Gram matrix of e2πif1t, e2πif2t,··· , e2πifkt whose (i, j)-entry is satisfies k −αk2(cid:89)i<j Gramf1,··· ,fk (i, j) = (cid:104)e2πifit, e2πifj t(cid:105)T = min((fi − fjT )2, 1) ≤ det (Gramf1,··· ,fk ) ≤ kαk2(cid:89)i<j 0 1 T (cid:90) T e2πi(fi−fj )tdt. min((fi − fjT )2, 1). Based on Corollary 8.4, we show the coefficients of a k-Fourier-sparse signal can be upper bounded by the energy (cid:107)x(cid:107)2 T . Lemma 2.2. There exists a universal constant c > 0 such that for any x(t) = vje2πifj t with k(cid:80)j=1 frequency gap η = min i(cid:54)=j fi − fj, −ck2 (cid:107)x(t)(cid:107)2 T ≥ k min(cid:16)(ηT )2k, 1(cid:17) k(cid:88)j=1 vj2. Proof. Let (cid:126)vi denote the vector e2πifit and V = { (cid:126)v1,··· , (cid:126)vk}. Notice that (cid:107)(cid:126)vi(cid:107)2 1. For each (cid:126)vi, we define (cid:126)v span{(cid:126)v1,··· , (cid:126)vi−1, (cid:126)vi+1,··· , (cid:126)vk} and (cid:126)v⊥ definition. T = (cid:104)(cid:126)vi, (cid:126)vi(cid:105) = (cid:107) i to be the projection of (cid:126)vi into the linear subspace span{V \ (cid:126)vi} = (cid:107) i which is orthogonal to span{V \ (cid:126)vi} by the i = (cid:126)vi − (cid:126)v Therefore from the orthogonality, (cid:107)x(t)(cid:107)2 It is enough to estimate (cid:107)(cid:126)v⊥ j (cid:107)2 T ≥ max j∈[k]{vj2 · (cid:107)(cid:126)v ⊥ j (cid:107)2 T} ≥ 1 k k(cid:88)j=1 vj2 · (cid:107)(cid:126)v ⊥ j (cid:107)2 T . T from Claim 3.12: ⊥ j (cid:107)2 (cid:107)(cid:126)v T = det(Gram(V )) det(Gram(V \ (cid:126)vi)) ≥ k −2αk2(cid:89)j(cid:54)=i min ((fj − fi)T, 1)2 ≥ k −2αk2 (ηT )2k−2, where we use Corollary 8.4 to lower bound it in the last step. 8.3 Perturbing the frequencies does not change the subspace much We show that for a k-Fourier-sparse signal with unboundedly close frequency gap, there always exists another k-Fourier-sparse signal with slightly separated gap. Lemma 8.5 (Slightly Shifting one Frequency). There is a universal constant C0 > 0 such that for any x(t) = vje2πifj t and any frequency fk+1, there always exists k(cid:80)j=1 (cid:48) x (t) = (cid:48) je2πifj t + v (cid:48) k+1e2πifk+1t v k−1(cid:88)j=1 with k coefficients v(cid:48) 1, v(cid:48) (cid:48) 2,··· , v(cid:48) (cid:107)x k−1, v(cid:48) k+1 satisfying (t) − x(t)(cid:107)T ≤ kC0k2 43 · (fk − fk+1T ) · (cid:107)x(t)(cid:107)T Proof. We abuse the notation e2πifj t to denote a vector in the linear subspace. We plan to shift fk to fk+1 and define V V = {e2πif1t,··· , e2πifk−1t, e2πifkt} (cid:48) = {e2πif1t,··· , e2πifk−1t, e2πifk+1t} U = {e2πif1t,··· , e2πifk−1t} W = {e2πif1t,··· , e2πifk−1t, e2πifkt, e2πifk+1t} where f1, f2,··· , fk are original frequencies in x. The idea is to show that any vector in the linear subspace span{V } is close to some vector in the linear subspace span{V (cid:48) For convenience, we use (cid:126)u(cid:107) to denote the projection of vector e2πifkt to the linear subspace span{U} = span{e2πif1t,··· , e2πifk−1t} and (cid:126)w(cid:107) denote the projection of vector e2πifk+1t to this linear subspace span{U}. Let (cid:126)u⊥ = e2πifkt − (cid:126)u(cid:107) and (cid:126)w⊥ = e2πifk+1t − (cid:126)w(cid:107) be their orthogonal part to span{U}. ∈ span{U} = span{e2πif1t,··· , e2πifk−1t}, we rewrite the linear combination From the definition e2πifkt = (cid:126)u(cid:107) + (cid:126)u⊥ and (cid:126)u(cid:107) }. x(t) = k(cid:88)j=1 vje2πifj t = k−1(cid:88)j=1 ⊥ αje2πifj t + vk · (cid:126)u for some scalars α1,··· , αk−1. We will substitute (cid:126)u⊥ by (cid:126)w⊥ in the above linear combination and find a set of new coefficients. Let (cid:126)w⊥ = (cid:126)w1 + (cid:126)w2 where (cid:126)w1 = (cid:126)u⊥ is the projection of (cid:126)w⊥ to (cid:126)u⊥. Therefore (cid:126)w2 is the orthogonal part of the vector e2πifk+1t to span{V } = span{e2πif1t,··· , e2πifk−1t, e2πifkt}. We use (cid:104)(cid:126)u⊥, (cid:126)w⊥(cid:105) (cid:107)(cid:126)u⊥(cid:107)2 T (cid:107)(cid:126)u⊥−β· (cid:126)w⊥(cid:107)T (cid:107)(cid:126)u⊥(cid:107)T = δ and β∗ = (cid:104)(cid:126)u⊥, (cid:126)w⊥(cid:105) (cid:107) (cid:126)w⊥(cid:107)2 T is the optimal choice. Therefore we set δ = for convenience. (cid:107) (cid:126)w2(cid:107)T (cid:107) (cid:126)w⊥(cid:107)T Notice that the min β∈C k−1(cid:88)j=1 (cid:48) x (t) = βje2πifj t + vk · β ∗ ⊥ · (cid:126)w ∈ span{e2πif1t,··· , e2πifk−1t, e2πifk+1t} where the coefficients β1,··· , βk−1 guarantee that the projection of x(cid:48) onto span{U} is as same as the projection of x onto span{U}. From the choice of β∗ and the definition of x(cid:48), (cid:107)x(t) − x (cid:48) (t)(cid:107)2 ⊥ T = δ2 · vk2 · (cid:107)(cid:126)u (cid:107)2 T ≤ δ2 · (cid:107)x(t)(cid:107)2 T . 44 Eventually, we show an upper bound for δ2 from Claim 3.12. δ2 = (cid:107) (cid:126)w2(cid:107)2 (cid:107) (cid:126)w⊥ (cid:107)2 T T = = / det(GramW ) det(GramV ) det(GramW ) det(GramV ) · det(GramV (cid:48)) det(GramU ) det(GramU ) det(GramV (cid:48)) by Claim 3.12 by Corollary 8.4 k−1(cid:81)i=1 k−1(cid:81)j=1 j(cid:54)=i · j(cid:54)=i k+1(cid:81)i=1 k+1(cid:81)j=1 k(cid:81)i=1 k(cid:81)j=1 fk − fk+12T 2 j(cid:54)=i ≤ k4αk2 = k4αk2 min(fi − fjT, 1) min(fi − fjT, 1) min(fi − fjT, 1) min(fi − fjT, 1) · · k−1(cid:81)i=1 k−1(cid:81)j=1 j(cid:54)=i k−1(cid:81)i=1 min(fi − fk+12T 2, 1) Lemma 8.6. For any k frequencies f1 < f2 < ··· < fk, there exists k frequencies f(cid:48) that min i∈[k−1] i ≥ η and for all i ∈ [k], f(cid:48) i − fi ≤ kη. f(cid:48) i+1 − f(cid:48) 1,··· , f(cid:48) k such Proof. We define the new frequencies f(cid:48) {2, 3,··· , k}. 8.4 Existence of nearby k-Fourier-sparse signal with frequency gap bounded i−1 + η, fi} for i ∈ i as follows: f(cid:48) i = max{f(cid:48) 1 = f1 and f(cid:48) away from zero We combine the results in the above section to finish the proof of Lemma 2.3. We first prove that for any x∗(t) = vje2πifj t, there always exists another k-Fourier-sparse signal x(cid:48) close to k(cid:80)j=1 vje2πifj t such that the frequency gap in x(cid:48) is at least η ≥ 2− poly(k). Then we show how x∗(t) = to find a low degree polynomial P (t) approximating x(cid:48)(t). k(cid:80)j=1 Lemma 2.1. There is a universal constant C1 > 0 such that, for any x∗(t) = δ > 0 , there always exist η ≥ δ T · k−C1k2 and x(cid:48)(t) = je2πif(cid:48) v(cid:48) j t satisfying vje2πifj t and any k(cid:80)j=1 i − f(cid:48) j∈[k]{f(cid:48) j ≥ η and max i(cid:54)=j f(cid:48) with min Proof. Using Lemma 8.6 on frequencies f1,··· , fk, we obtain k new frequencies f(cid:48) their gap is at least η and maxi fi − f(cid:48) i ≤ kη. Next we use the hybrid argument to find x(cid:48). 1,··· , f(cid:48) k such that k(cid:80)j=1 ∗ ∗ (t)(cid:107)T ≤ δ(cid:107)x (t)(cid:107)T (cid:48) (t) − x (cid:107)x j − fj} ≤ kη. 45 Let x(0)(t) = x∗(t). For i = 1,··· , t, we apply Lemma 8.5 to shift fi to f(cid:48) i and obtain (i) j e2πif(cid:48) j t. v v x(i)(t) = (i) j e2πifj t + k(cid:88)j=i+1 i(cid:88)j=1 From Lemma 8.5, we know (cid:107)x(i)(t) − x(i−1)(t)(cid:107)T ≤ kC0k2 (fi − f(cid:48) (cid:107)x(0)(t)(cid:107)T ≤ (cid:107)x(i)(t)(cid:107)T ≤(cid:16)1 + kC0k2 (kηT )(cid:17)(cid:107)x(0)(t)(cid:107)T ,(cid:16)1 + 2i · kC0k2 (kηT )(cid:17)i which is between (cid:104)(cid:16)1 − i · kC0k2 (cid:16)1 − kC0k2 k−C1k2 with some C1 > C0. iT )(cid:107)x(i−1)(cid:107)T . Thus we obtain (kηT )(cid:17)i (kηT )(cid:17)(cid:107)x(0)(t)(cid:107)T(cid:105) for η ≤ 1 (cid:107)x(0)(t)(cid:107)T , 5T · At last, we set x(cid:48)(t) = x(k)(t) and bound the distance between x(cid:48)(t) and x∗(t) by (cid:107)x(k)(t) − x(0)(t)(cid:107)T ≤ (cid:107)x(i)(t) − x(i−1)(t)(cid:107)T ≤ kC0k2 k(cid:88)i=1 k(cid:88)i=1 k(cid:88)i=1 ≤ ≤ k · 2kC0k2 ∗ ≤ δ(cid:107)x (t)(cid:107)T 2kC0k2 (cid:48) iT )(cid:107)x(i−1)(t)(cid:107)T (fi − f (kηT )(cid:107)x(i−1)(t)(cid:107)T (kηT )(cid:107)x (t)(cid:107)T ∗ by triangle inequality by Lemma 8.5 by max i fi − f (cid:48) i ≤ kη where the last inequality follows by the sufficiently small η. 8.5 Approximating k-Fourier-sparse signals by polynomials For any k-Fourier-sparse signal with frequency gap bounded away from zero, we show that there exists a low degree polynomial which is close to the original k-Fourier-sparse signal in (cid:107)·(cid:107)T distance. k(cid:80)j=1 Lemma 8.7 (Existence of low degree polynomial). Let x∗(t) = vje2πifj t, where ∀j ∈ [k],fj ≤ ∆ i(cid:54)=j fi − fj ≥ η. There exists a polynomial Q(t) of degree and min such that, d = O(cid:0)T ∆ + k log 1/(ηT ) + k2 log k + k log(1/δ)(cid:1) (cid:107)Q(t) − x (t)(cid:107)2 T ≤ δ(cid:107)x (t)(cid:107)2 T (25) ∗ Proof. For each frequency fj, let Qj(t) = of e2πifj t. For any t ∈ [0, T ], we know the difference between Qj(t) and e2πifj t is at most be the first d terms in the Taylor Expansion k! (2πifj t)k ∗ d−1(cid:80)k=0 Qj(t) − e2πifj t ≤ (2πifjT )d d! ≤ ( 2πT ∆ · e d )d. 46 We define Q(t) = vjQj(t) k(cid:88)j=1 and bound the distance between Q and x∗ from the above estimation: (cid:107)Q(t) − x ∗ (t)(cid:107)2 T = = Q(t) − x ∗ (t)2dt vj(Qj(t) − e2πifj t)2dt 0 0 1 1 T (cid:90) T T (cid:90) T k(cid:88)j=1 T (cid:90) T k(cid:88)j=1 k(cid:88)j=1 vj2 · ( 1 0 ≤ 2k ≤ k vj2 · Qj(t) − e2πifj t2dt by triangle inequality 2πT ∆ · e d )2d by Taylor expansion On the other hand, from Lemma 2.2, we know ∗ (cid:107)x (t)(cid:107)2 T ≥ (ηT )2k · k vj2. −ck2(cid:88)j T ≤ δ(cid:107)x∗ Because d = 10·πe(T ∆+k log 1/(ηT )+k2 log k +k log(1/δ)) is large enough, we have k( 2πT ∆·e δ(ηT )2k · k−ck2, which indicates that (cid:107)Q(t) − x∗(t)(cid:107)2 8.6 Transferring degree-d polynomial to (d+1)-Fourier-sparse signal In this section, we show how to transfer a degree-d polynomial to (d+1)-Fourier-sparse signal. T from all discussion above. (cid:107)2 d )2d ≤ Lemma 8.8. For any degree-d polynomial Q(t) = exist γ > 0 and cjtj, any T > 0 and any  > 0, there always d(cid:80)j=0 ∗ x (t) = with some coefficients α0,··· , αd such that αie2πi(γi)t d+1(cid:88)i=1 ∀t ∈ [0, T ],x ∗ (t) − Q(t) ≤ . 47 Proof. We can rewrite x∗(t), ∗ x (t) = αie2πiγit (2πiγit)j j! (2πiγt)j αi · ij d+1(cid:88)i=1 d+1(cid:88)i=1 (cid:88)j=0 j! = = αi ∞ ∞ d+1(cid:88)i=1 d+1(cid:88)i=1 (cid:88)j=0 d(cid:88)j=0 = Q(t) + (cid:124) = j! ∞ j! (2πiγt)j (2πiγt)j d+1(cid:88)i=1 (cid:88)j=d+1 αi · ij + + αi · ij − Q(t) d+1(cid:88)i=1 (cid:123)(cid:122) (cid:125) (cid:124) Our goal is to show there exists some parameter γ and coefficients {α0, α1,··· , αd} such that the term C1 = 0 and C2 ≤ . Let's consider C1, αi · ij (cid:125) αi · ij ∞ (cid:88)j=d+1 d+1(cid:88)i=1 d(cid:88)j=0 (2πiγt)j (2πiγt)j (cid:123)(cid:122) j! j! C1 C2 . C1 = t T ( d(cid:88)j=0 )j(cid:32) (2πiγT )j j! αiij − cj(cid:33) d+1(cid:88)i=1 To guarantee C1 = 0, we need to solve a linear system with d + 1 unknown variables and d + 1 constraints, Find α1, α2,··· αd+1 d+1(cid:88)i=1 s.t. (2πiγT )j j! αiij − cj = 0,∀j ∈ {0, 1,··· , d} j = cjj!/(2πiγ)j, let α and c(cid:48) be the length-(d + 1) column vectors with αi and c(cid:48) Define c(cid:48) j. Let A ∈ Rd+1×d+1 denote the Vandermonde matrix where Ai,j = ij,∀i, j ∈ [d + 1]×{0, 1,··· , d}. Then we need to guarantee Aα = c(cid:48). Using the definition of determinant, det(A) = (cid:81)i<ji− j ≤ 2O(d2 log d). Thus σmax(A) ≤ 2O(d2 log d) and then We show how to upper bound αi, † i∈[d+1]αi ≤ (cid:107)α(cid:107)2 = (cid:107)A max (cid:48) c σmin(A) = −O(d3 log d). det(A) i=1 σi ≥ 2 (cid:81)d−1 (cid:107)2 ≤ (cid:107)A † (cid:48) (cid:107)2 · (cid:107)c (cid:107)2 ≤ 1 σmin(A) √d + 1 max 0≤j≤d cjj! (2πγT )j 48 Plugging the above equation into C2, we have ∞ ∞ ≤ C2 =(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:88)j=d+1 (cid:88)j=d+1 (cid:88)j=d+1 (cid:88)j=d+1 ≤ ≤ ∞ ∞ ≤  (2πiγt)j j! (2πγt)j j! j! j! (2πγt)j (2πγt)j αi · ij(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) d+1(cid:88)i=1 d+1(cid:88)i=1 αi · ij (d + 1)d+1 max i∈[d+1]αi (d + 1)d+2 1 σmin(A) d! (2πγT )d max 0≤j≤dcj where the last step follows by choosing sufficiently small γ (cid:46) /(cid:18)T 2Θ(d3 log d) max 0≤j≤dcj(cid:19) . 9 k-cluster Signal Recovery j=1 vje2πifj t with noise. 9.1 Overview In this section, we prove Lemma 9.1 as the main technical lemma to finish the proof of main Theorem 1.1, which shows how to learn x∗(t) =(cid:80)k Lemma 9.1. Let x∗(t) =(cid:80)k j=1 vje2πifj t and x(t) = x∗(t) + g(t) be our observation. For any δ > 0 T (cid:82) T T (cid:82) T 0 x∗(t)2dt. For ∆ = poly(k, log(1/δ))/T , Procedure and T > 0, let N 2 := 1 0 g(t)2dt + δ · 1 SignalRecoveryKCluster+ in Algorithm 8 takes l = O(k) frequencies (cid:101)f1,··· ,(cid:101)fl as input and finds l polynomials Q1,··· , Ql of degree d = O((T ∆)1.5 + k3 log k + k log 1/δ) such that (cid:101)x(t) =(cid:88)j∈[l] Qj(t)e2πi(cid:101)fj t satisfies (cid:107)(cid:101)x(t) − x The procedure succeeds with probability at least 1− 2−Ω(k), uses poly(k, log(1/δ))· log(F T ) samples, and runs in poly(k, log(1/δ)) · log2(F T ) time. (cid:46) N 2. (t)(cid:107)2 (26) ∗ T For any set W = {t1,··· , tm} where each ti ∈ [0, T ], we use (cid:107)(cid:126)v(cid:107)W =(cid:115)(cid:80)i∈W (cid:126)v(ti)2 W for any (cid:126)v : [0, T ] → C in this section. We first show that Procedure SignalRecoveryKCluster succeeds with constant probability, then prove that Procedure SignalRecoveryKCluster+ succeeds with probability at least 1 − 2−Ω(k). 49 9.2 Heavy clusters separation Recall the definition of "heavy" clusters. Definition 2.4. Given x∗(t) = support in frequency domain. Let Lj denote the interval of supp( k(cid:80)j=1 vje2πifj t, any N > 0, and a filter function (H, (cid:98)H) with bounded Define an equivalence relation ∼ on the frequencies fi by the transitive closure of the relation (cid:92)H · x∗(f )2df ≥ Define Ci = ∪f∈Si fi ∼ fj if Li ∩ Lj (cid:54)= ∅. Let S1, . . . , Sn be the equivalence classes under this relation. Li for each i ∈ [n]. We say Ci is a "heavy" cluster iff (cid:82)Ci (cid:92) e2πifj t · H) for each j ∈ [k]. T · N 2/k. By reordering Ci, we can assume {C1, C2,··· , Cl} are heavy clusters, where l ≤ n ≤ k. Claim 2.5. Given x∗(t) = Appendix C.1 and C1,··· , Cl be the heavy clusters from Definition 2.4. For k(cid:80)j=1 vje2πifj t and any N > 0, let H be the filter function defined in S =(cid:26)j ∈ [k](cid:12)(cid:12)(cid:12)(cid:12)fj ∈ C1 ∪ ··· Cl(cid:27) , (cid:46) N 2. T − x(S)(cid:107)2 vje2πifj t. Notice that (cid:107)x∗ vje2πifj t approximating x∗ within distance (cid:107)x(S)(t) − x∗(t)(cid:107)2 we have x(S)(t) = (cid:80)j∈S Proof. Let x(S)(t) = (cid:80)j∈[k]\S From the property VI of filter function (H, (cid:98)H) in Appendix C.1, we have (cid:90) +∞ −∞ x(S)(t) · H(t)2dt ≥ 0.9(cid:90) T x(S)(t)2dt = 0.9 · T(cid:107)xS(cid:107)2 T . (cid:90) +∞ −∞ x(S)(t) · H(t)2dt = (cid:90) +∞ From Definition 2.4, we have T . T = (cid:107)x(S)(cid:107)2 0 −∞ (cid:92) x(S) · H(f )2df = (cid:90)[−∞,+∞]\C1∪···∪Cl ≤ k · TN 2/k. (cid:92)x∗ · H(f )2df Overall, we have (cid:107)x(S)(cid:107)2 From the guarantee of Theorem 2.6, for any j ∈ S, min T (cid:46) N 2. focus on the recovery of x(S), which is enough to approximate x∗ from the above claim. Because we are looking for x approximating x(S) within distance O(N 2), from Lemma 2.1, we can assume there is a frequency gap η ≥ δ 10T k−O(k2) among x(S). i∈[l]fj − (cid:101)fi ≤ ∆√∆T . From now on, we 50 low degree polynomials. 9.3 Approximating clusters by polynomials In this section, we show how to approximate x(S) by x(cid:48)(t) =(cid:80)i∈[l] e2πi(cid:101)fitPi(t) where P1,··· , Pl are Claim 9.2. For any x(S)(t) =(cid:80)j∈S vje2πifj t with a frequency gap η = min (cid:101)f1,··· ,(cid:101)fl with the property ∀j ∈ S, mini∈[l] fj − (cid:101)fi ≤ ∆√∆T , let There exists x(cid:48)(t) ∈ span{V } that approximates x(S)(t) as follows: (t) − x(S)(t) ≤ δ(cid:107)x(S)(cid:107)T . d = 5π(cid:0)(T ∆)1.5 + k3 log k + log 1/δ(cid:1) and V =(cid:110)tje2πi(cid:101)fiti ∈ [l], j ∈ {0,··· , d}(cid:111) . i(cid:54)=j fi−fj and l frequencies ∀t ∈ [0, T ],x (cid:48) Proof. From Lemma 2.2, we know (cid:107)x(S)(cid:107)2 T ≥ (ηT )2k · k vj2. −ck2(cid:88)j∈S vje2πi(fj−(cid:101)fi)t . e2πi(cid:101)fi (cid:88)j∈S:pj =i For each frequency fj, we use pj to denote the index in [l] such that fj −(cid:101)fpj ≤ ∆√∆T . We rewrite (2πi(fj−(cid:101)fpj )t)i For d = 5π((T ∆)1.5 + k3 log k + log 1/δ) and each e2πi(fj−(cid:101)fpj )t, let Qj(t) =(cid:80)d−1 the first d terms in the Taylor Expansion of e2πi(fj−(cid:101)fpj )t. For any t ∈ [0, T ], we know the difference between Qj(t) and e2πi(fj−(cid:101)fpj )t is at most l(cid:88)i=1 x(S)(t) = be i=0 i! ∀t ∈ [0, T ],Qj(t) − e2πi(fj−(cid:101)fpj )t ≤ i=1 e2πi(cid:101)fit(cid:16)(cid:80)j∈S:pj =i vjQj(t)(cid:17) . From all discussion above, we know for any t ∈ [0, T ], (2πi(fj − (cid:101)fpj )T )d 8π(∆T )1.5 ≤ ( )d. d! d Let x(cid:48) =(cid:80)l (cid:48) x (t) − x(S)(t)2 ≤ (cid:88)j∈S 2 )d vj2 8π(T ∆)1.5 d vj( d ≤ k( 8π(T ∆)1.5 )2d(cid:88)j k( 8π(T ∆)1.5 (ηT )2k · k−ck2 (cid:107)x(S)(cid:107)2 ≤ ≤ δ2(cid:107)x(S)(cid:107)2 T . )2d d T We provide a property of functions in span{V } such that we can use the Chernoff bound and the -net argument on vectors in span{V }. 51 stants C1 ≤ 4 and C2 ≤ 3 such that Claim 2.7. For any (cid:126)u ∈ span(cid:26)e2πi(cid:101)fit · tj(cid:12)(cid:12)(cid:12)(cid:12)j ∈ {0,··· , d}, i ∈ [l](cid:27), there exists some universal con- ∈ span(cid:110)e2πi·(γj)t · e2πi fiti ∈ [l], j ∈ {0,··· , d + 1}(cid:111) Proof. From Lemma 8.8, we can approximate each polynomial in (cid:126)u by a linear combination of {1, e2πi·γt,··· , e2πi·(γd)t} such that we obtain u∗ for some small γ such that ∀t ∈ [0, T ],(cid:126)u(t) − u∗(t) ≤ 0.01(cid:107)(cid:126)u(cid:107)T . t∈[0,T ]{(cid:126)u(t)2} (cid:46) (ld)C1 logC2(ld) · (cid:107)(cid:126)u(cid:107)2 max T From Lemma 5.1, we know ∗ t∈[0,T ]u max For some constant C(cid:48), we have (t)2 ≤ C ·(cid:0)(ld + 1)4 · log3(ld + 1)(cid:1)(cid:107)u (cid:48)(cid:0)(kd)C1 logC2 d(cid:1)(cid:107)(cid:126)u(cid:107)2 t∈[0,T ](cid:126)u(t)2 ≤ C max T . ∗ (cid:107)2 T . 9.4 Main result, with constant success probability (cid:107)T (cid:46) δ(cid:107)x∗ (cid:107)T and Lemma 9.6, we have (cid:107)x∗ In this section, we show that the output (cid:101)x is close to x(cid:48) with high probability using the -net argument, which is enough to prove (cid:107)(cid:101)x − x(cid:107)T (cid:46) N 2 from all discussion above. Because we can prove Lemma 9.6(which is the main goal of this section), then combining (cid:107)x(cid:48) −x∗ (cid:107)T ≤ (cid:107)x(cid:48) −x(S)(cid:107)T + (cid:107)x(S) − x∗ −(cid:101)x(cid:107)T (cid:46) (cid:107)g(cid:107)T + δ(cid:107)x∗ (cid:107)T , which finishes the proof of Procedure SignalRecoveryKCluster in Algorithm 8 achieving the Equation (26) with constant success probability but not 1 − 2−Ω(k). We will boost the success probability in Section 9.5. We first provide an -net P for the unit vectors Q = {(cid:126)u ∈ span{V }(cid:12)(cid:12)(cid:107)(cid:126)u(cid:107)2 space span{V } where V =(cid:110)tj · e2πi(cid:101)fit(cid:12)(cid:12)j ∈ {0, 1,··· , d}, i ∈ [l](cid:111) from the above discussion. Notice T = 1} in the linear sub- that the dimension of span{V } is at most l(d + 1). Claim 9.3. There exists an -net P ⊂ span{V } such that 1. ∀(cid:126)u ∈ Q,∃ (cid:126)w ∈ P,(cid:107)(cid:126)u − (cid:126)w(cid:107)T ≤ . 2. P ≤(cid:16)5 l(d+1) Proof. Let P =(cid:26) (cid:48)  (cid:17)2l(d+1) (cid:48) be an 2l(d + 1) 2l(d + 1) j1 + i P .  l(d+1)-net in the unit circle of C with size at most (4 l(d+1)  2l(d + 1)   + 1)2, i.e., 2l(d + 1) ,j2 ≤  (cid:27) . Observe that the dimension of span{V } is at most l(d + 1). Then we take an orthogonal basis (cid:126)w1,··· , (cid:126)wl(d+1) in span{V } and set  j2(cid:12)(cid:12)(cid:12)(cid:12)j1, j2 ∈ Z,j1 ≤ αi (cid:126)wi(cid:12)(cid:12)∀i ∈ [l(d + 1)], αi ∈ P (cid:48) }. P = { l(d+1)(cid:88)i=1 Therefore P is an -net for Q and P ≤(cid:16)5 l(d+1)  (cid:17)2l(d+1) . 52 We first prove that W is a good estimation for all functions in the -net P. Claim 9.4. For any  > 0, there exists a universal constant C3 ≤ 5 such that for a set S of i.i.d. samples chosen uniformly at random over [0, T ] of size S ≥ 3(kd)C3 logC3 d/ ,then with probability at least 1 − k−k, for all (cid:126)w ∈ P, we have 2 (cid:107) (cid:126)w(cid:107)W ∈ [(1 − )(cid:107) (cid:126)w(cid:107)T , (1 + )(cid:107) (cid:126)w(cid:107)T ] . Proof. From Claim 2.7 and Lemma 3.5, for each (cid:126)w ∈ P, Pr(cid:2)(cid:107) (cid:126)w(t)(cid:107)W /∈(cid:2)(1 − )(cid:107) (cid:126)w(cid:107)T , (1 + )(cid:107) (cid:126)w(cid:107)T(cid:3)(cid:3) ≤ 2  )−kd log0.5 d · P ≥ 1 − d−d. least 1 − ( d − From the union bound, (cid:107) (cid:126)w(cid:107)W ∈ [(1 − )(cid:107) (cid:126)w(cid:107)T , (1 + )(cid:107) (cid:126)w(cid:107)T ] for any (cid:126)w ∈ P with probability at W2 3(kd)C1 logC2+0.5 d ≤ 2 −kd log1.5 d  . Then We prove that W is a good estimation for all functions in span{V } using the property of -nets. Claim 9.5. For any  > 0, there exists a universal constant C3 ≤ 5 such that for a set W of i.i.d. samples chosen uniformly at random over [0, T ] of size W ≥ 3(kd)C3 logC3 d/ ,then with probability at least 1 − d−d, for all u ∈ span{V }, we have 2 (cid:107)(cid:126)u(cid:107)W ∈ [(1 − 3)(cid:107)(cid:126)u(cid:107)T , (1 + 3)(cid:107)(cid:126)u(cid:107)T ] Proof. We assume that the above claim is true for any (cid:126)w ∈ P. Without loss of generality, we consider (cid:126)u ∈ Q such that (cid:107)(cid:126)u(cid:107)T = 1. Let (cid:126)w0 be the vector in P that minimizes (cid:107) (cid:126)w − (cid:126)u(cid:107)T for all (cid:126)w ∈ P, i.e., (cid:126)w0 = arg min (cid:126)w∈P (cid:107) (cid:126)w − (cid:126)u(cid:107)T . Define (cid:126)u1 = (cid:126)u − (cid:126)w0 and notice that (cid:107)(cid:126)u1(cid:107)T ≤  because P is a -net. If (cid:107)(cid:126)u1(cid:107)T = 0, then we skip the rest of this procedure. Otherwise, we define α1 = (cid:107)(cid:126)u1(cid:107)T and normalize(cid:101)u1 = (cid:126)u1/α1. Then we choose (cid:126)w1 to be the vector in P that minimizes (cid:107) (cid:126)w −(cid:101)u1(cid:107)T for all (cid:126)w ∈ P. Similarly, we set (cid:126)u2 =(cid:101)u1 − (cid:126)w1 and α2 = (cid:107)(cid:126)u2(cid:107)T . Next we repeat this process for (cid:101)u2 = (cid:126)u2/α2 and so on. The recursive definition can be summarized in the following sense, initial : For i ∈ {0, 1, 2,··· , m} : (cid:126)wi = arg min (cid:126)w∈P (cid:107) (cid:126)w −(cid:101)ui(cid:107)T , (cid:101)u0 = (cid:126)u and m = 10 log1/(ld) + 1, (cid:126)ui+1 =(cid:101)ui − (cid:126)wi and αi+1 = (cid:107)(cid:126)ui+1(cid:107)T , if αi+1 (cid:54)= 0,(cid:101)ui+1 = (cid:126)ui+1/αi+1 and continue, if αi+1 = 0, stop. Eventually, we have (cid:126)u = (cid:126)w0 + α1 (cid:126)w1 + α1α2 (cid:126)w2 + ··· +(cid:81)m j=1 αj( (cid:126)wm + (cid:126)um+1) where each αi ≤  and each (cid:126)wi is in the -net P. Notice that (cid:107)(cid:126)um+1(cid:107)T ≤ 1 and (cid:107)(cid:126)um+1(cid:107)W ≤ (ld + 1)3 · (cid:107)(cid:126)um+1(cid:107)T from Claim 2.7. We prove a lower bound for (cid:107)(cid:126)u(cid:107)W , (cid:107)(cid:126)u(cid:107)W = (cid:107) (cid:126)w0 + α1 (cid:126)w1 + α1α2 (cid:126)w2 + ··· + αj( (cid:126)wm + (cid:126)um+1)(cid:107)W m(cid:89)j=1 αj (cid:126)wm(cid:107)W − (cid:107) ≥ (cid:107) (cid:126)w0(cid:107)W − (cid:107)α1 (cid:126)w1(cid:107)W − (cid:107)α1α2 (cid:126)w2(cid:107)W − ··· − (cid:107) ≥ (1 − ) − (1 + ) − 2(1 + ) − ··· − m(1 + ) − m(cid:107)(cid:126)um+1(cid:107)W ≥ 1 −  − 1 −  − m · (ld + 1)3 ≥ 1 − 3. m(cid:89)j=1 (1 + ) αj(cid:126)um+1(cid:107)W m(cid:89)j=1 53 Similarly, we have (cid:107)(cid:126)u(cid:107)W ≤ 1 + 3. Lemma 9.6. With probability at least 0.99 over the m i.i.d samples in W , (cid:48) (cid:107)x (t) −(cid:101)x(t)(cid:107)T ≤ 2200(cid:16)(cid:107)g(t)(cid:107)T + (cid:107)x(S)(t) − x (cid:48) (t)(cid:107)T(cid:17) . Proof. Let g(cid:48)(t) = g(t) + x∗(t) − x(cid:48)(t) such that x(t) = x(cid:48)(t) + g(cid:48)(t). Then we choose  = 0.03 and bound: (cid:48) (cid:107)x (cid:48) (cid:48) (cid:48) It (cid:48) (cid:48) (cid:48) (cid:48) (t)(cid:107)W (cid:48) (t)(cid:107)W (t) = x(t) − g (t)(cid:107)W + 1.09(cid:107)g with prob. 1 − 2 ≤ 1.09(cid:107)x(t) − x = 2.18(cid:107)g (t)(cid:107)W . (cid:48) ≤ (1 + 3)(cid:107)x = 1.09(cid:107)x = 1.09(cid:107)x(t) − g −Ω(d log d) by Claim 9.5 by  = 0.03 by x (t) by triangle inequality y∈span{V }(cid:107)x − y(cid:107)W (t) = g(t) (t) −(cid:101)x(t)(cid:107)T (t) −(cid:101)x(t)(cid:107)W (t) −(cid:101)x(t)(cid:107)W (t) −(cid:101)x(t)(cid:107)W ≤ 1.09(cid:107)x(t) −(cid:101)x(t)(cid:107)W + 1.09(cid:107)g From the fact that EW [(cid:107)g(cid:48) (cid:107)W ] = (cid:107)g(cid:48) indicates (cid:107)x(cid:48)(t) −(cid:101)x(t)(cid:107)T ≤ 2200(cid:107)g(cid:48) 9.5 Boosting the success probability In order to achieve 1 − 2−Ω(k) for the main theorem, we cannot combine Procedure SignalRe- coveryKCluster with FrequencyRecoveryKCluster directly. However, using the similar proof technique in Theorem 4.5, we are able to boost the success probability by using Procedure SignalRecoveryKCluster+ in Algorithm 8. It runs Procedure SignalRecoveryKCluster R = O(k) times in parallel for independent fresh samples and report R different d-Fourier-sparse (cid:107)T with probability at least .999. (cid:107)T with probability at least 0.99 from all discussion above. by(cid:101)x = arg min (cid:48) by x(t) − x (cid:107)W ≤ 1000(cid:107)g(cid:48) (cid:107)T , (cid:107)g(cid:48) Because we can transfer a degree-d polynomial to a d-Fourier-sparse signal by Lemma 8.8, the signals(cid:101)xi(t). Then, taking m = poly(k) new locations {t1, t2,··· , tm}, and computing (cid:101)A as before and(cid:101)bj by taking the median of {(cid:101)x1(tj),··· ,(cid:101)xR(tj)}. At the end, solving the linear regression for matrix (cid:101)A and vector(cid:101)b. Thus, we complete the proof of Lemma 9.1. output of Procedure CFTKCluster in Algorithm 8 matches the main theorem, Theorem 1.1. Let x(t) = x∗(t) + g(t), where x∗ is k-Fourier-sparse signal with frequencies in [−F, F ]. Given samples of x over [0, T ] we can output (cid:101)x(t) such that with probability at least 1 − 2−Ω(k), Our algorithm uses poly(k, log(1/δ)) · log(F T ) samples and poly(k, log(1/δ)) · log2(F T ) time. The output (cid:101)x is poly(k, log(1/δ))-Fourier-sparse signal. (cid:46) (cid:107)g(cid:107)T + δ (cid:107)x (cid:107)(cid:101)x − x (cid:107)T . (cid:107)T ∗ ∗ 54 References [BCG+14] Petros Boufounos, Volkan Cevher, Anna C Gilbert, Yi Li, and Martin J Strauss. What's the frequency, Kenneth?: Sublinear Fourier sampling off the grid. In Algorithmica(A preliminary version of this paper appeared in the Proceedings of RANDOM/APPROX 2012, LNCS 7408, pp. 61-72), pages 1–28. Springer, 2014. [BM86] [Bou14] [BS12] [CDL13] [CF14] Y. Bresler and A. Macovski. Exact maximum likelihood parameter estimation of su- perimposed exponential signals in noise. IEEE Transactions on Acoustics, Speech, and Signal Processing, 34(5):1081–1089, Oct 1986. Jean Bourgain. An improved estimate in the restricted isometry problem. In Geometric Aspects of Functional Analysis, pages 65–70. Springer, 2014. Markus Blaser and Chandan Saha. Lecture 6: Multipoint evaluation of a polynomial. Max-Planck-Institut für Informatik Class Notes, Computational Number Theory and Algebra, pages 1–4, 2012. Albert Cohen, Mark A Davenport, and Dany Leviatan. On the stability and accuracy of least squares approximations. Foundations of computational mathematics, 13(5):819– 834, 2013. Emmanuel J Candès and Carlos Fernandez-Granda. Towards a mathematical theory of super-resolution. Communications on Pure and Applied Mathematics, 67(6):906–956, 2014. [Che52] Herman Chernoff. A measure of asymptotic efficiency for tests of a hypothesis based on the sum of observations. The Annals of Mathematical Statistics, 23:493–507, 1952. [CNW15] Michael B Cohen, Jelani Nelson, and David P Woodruff. Optimal approximate matrix product in terms of stable rank. arXiv preprint arXiv:1507.02268, 2015. [CRT06] [CW87] [CW13] Emmanuel J Candes, Justin K Romberg, and Terence Tao. Stable signal recovery from incomplete and inaccurate measurements. Communications on pure and applied mathematics, 59(8):1207–1223, 2006. 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, 2013. [DB13] Marco F Duarte and Richard G Baraniuk. Spectral compressive sensing. Applied and Computational Harmonic Analysis, 35(1):111–129, 2013. [Dun10] Mark Dunster. Legendre and Related Functions. Handbook of Mathematical Functions, Cambridge University Press, 2010. [FL12] Albert Fannjiang and Wenjing Liao. Coherence pattern-guided compressive sensing with unresolved grids. SIAM Journal on Imaging Sciences, 5(1):179–202, 2012. 55 [GGI+02] Anna C Gilbert, Sudipto Guha, Piotr Indyk, S Muthukrishnan, and Martin Strauss. Near-optimal sparse Fourier representations via sampling. In Proceedings of the thiry- fourth annual ACM symposium on Theory of computing, pages 152–161. ACM, 2002. [GMS05] Anna C Gilbert, S Muthukrishnan, and Martin Strauss. Improved time bounds for near-optimal sparse Fourier representations. In Optics & Photonics 2005, pages 59141A– 59141A. International Society for Optics and Photonics, 2005. [GZ16] Venkatesan Guruswami and David Zuckerman. Robust Fourier and polynomial curve fitting. In Foundations of Computer Science (FOCS), 2016 IEEE 57th Annual Sympo- sium on. IEEE, 2016. [Haz01] Michiel Hazewinkel. Gram matrix. Encyclopedia of Mathematics, Springer, 2001. [HIKP12a] Haitham Hassanieh, Piotr Indyk, Dina Katabi, and Eric Price. Nearly optimal sparse Fourier transform. In Proceedings of the forty-fourth annual ACM symposium on Theory of computing. ACM, 2012. [HIKP12b] Haitham Hassanieh, Piotr Indyk, Dina Katabi, and Eric Price. Simple and practical algorithm for sparse Fourier transform. In Proceedings of the twenty-third annual ACM- SIAM symposium on Discrete Algorithms, pages 1183–1194. SIAM, 2012. [HK15] [HR15] [IK14] [IKP14] Qingqing Huang and Sham M Kakade. Super-resolution off the grid. In Advances in Neural Information Processing Systems, pages 2647–2655, 2015. Ishay Haviv and Oded Regev. The restricted isometry property of subsampled Fourier matrices. arXiv preprint arXiv:1507.01768, 2015. Piotr Indyk and Michael Kapralov. Sample-optimal Fourier sampling in any constant dimension. In Foundations of Computer Science (FOCS), 2014 IEEE 55th Annual Symposium on, pages 514–523. IEEE, 2014. Piotr Indyk, Michael Kapralov, and Eric Price. (Nearly) Sample-optimal sparse Fourier transform. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Dis- crete Algorithms, pages 480–499. SIAM, 2014. [Iwe13] Mark A Iwen. rithms. Applied And Computational Harmonic Analysis, 34(1):57–82, 2013. Improved approximation guarantees for sublinear-time Fourier algo- [Kap16] Michael Kapralov. Sparse Fourier transform in any constant dimension with nearly- optimal sample complexity in sublinear time. In Symposium on Theory of Computing Conference, STOC'16, Cambridge, MA, USA, June 19-21, 2016, 2016. [Mas69] [Moi15] [MP14] James L Massey. Shift-register synthesis and BCH decoding. Information Theory, IEEE Transactions on, 15(1):122–127, 1969. Ankur Moitra. The threshold for super-resolution via extremal functions. In STOC, 2015. Gregory T Minton and Eric Price. Improved concentration bounds for count-sketch. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algo- rithms, pages 669–686. Society for Industrial and Applied Mathematics, 2014. 56 [NN13] [PS15] Jelani Nelson and Huy L Nguyên. OSNAP: Faster numerical linear algebra algorithms via sparser subspace embeddings. In Foundations of Computer Science (FOCS), 2013 IEEE 54th Annual Symposium on, pages 117–126. IEEE, 2013. Eric Price and Zhao Song. A robust sparse Fourier transform in the continuous setting. In Foundations of Computer Science (FOCS), 2015 IEEE 56th Annual Symposium on, pages 583–600. IEEE, 2015. [RPK86] Robert Roy, Arogyaswami Paulraj, and Thomas Kailath. Esprit–a subspace rotation approach to estimation of parameters of cisoids in noise. Acoustics, Speech and Signal Processing, IEEE Transactions on, 34(5):1340–1342, 1986. [RV08] [Sch81] [Str69] [Tar09] Mark Rudelson and Roman Vershynin. On sparse reconstruction from fourier and gaus- sian measurements. Communications on Pure and Applied Mathematics, 61(8):1025– 1045, 2008. Ralph Otto Schmidt. A signal subspace approach to multiple emitter location spectral estimation. Ph. D. Thesis, Stanford University, 1981. Volker Strassen. Gaussian elimination is not optimal. Numerische Mathematik, 13(4):354–356, 1969. Robert E. Tarjan. Lecture 10: More chernoff bounds, sampling, and the chernoff + union bound. Princeton Class Notes, Probability and Computing, pages 1–9, 2009. [TBR15] Gongguo Tang, Badri Narayan Bhaskar, and Benjamin Recht. Near minimax line spec- tral estimation. Information Theory, IEEE Transactions on, 61(1):499–512, 2015. [TBSR13] Gongguo Tang, Badri Narayan Bhaskar, Parikshit Shah, and Benjamin Recht. Com- pressed sensing off the grid. Information Theory, IEEE Transactions on, 59(11):7465– 7490, 2013. [Wil12] [Woo14] [YX15] Virginia Vassilevska Williams. Multiplying matrices faster than coppersmith-winograd. In STOC, pages 887–898. ACM, 2012. David P Woodruff. Sketching as a tool for numerical linear algebra. arXiv preprint arXiv:1411.4357, 2014. Zai Yang and Lihua Xie. Achieving high resolution for super-resolution via reweighted atomic norm minimization. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on, pages 3646–3650. IEEE, 2015. 57 A Technical Proofs A.1 Proof of Theorem 8.3 We prove the following Theorem Theorem 8.3. For real numbers ξ1, . . . , ξk, let Gξ1,...,ξk be the matrix whose (i, j)-entry is e2πi(ξi−ξj )tdt. (cid:90) 1 −1 Then First, we note by the Cauchy-Binet formula that the determinant in question is equal to det(Gξ1,...,ξk ) = 2 min(ξi − ξj2, 1). O(k2)(cid:89)i<j . . .(cid:90) 1 −1(cid:12)(cid:12)(cid:12)det([e2πiξitj ]i,j)(cid:12)(cid:12)(cid:12) (cid:90) 1 −1(cid:90) 1 −1 2 dt1dt2 . . . dtk. (27) We next need to consider the integrand in the special case when(cid:80)ξi ≤ 1/8. Lemma A.1. If ξi ∈ R and tj ∈ R,(cid:80)i ξi(maxi ti) ≤ 1/8 then  . 2)(cid:81)i<j ti − tjξi − ξj the determinant by a root of unity, and at most doubles(cid:80)i ξi(maxi ti). By continuity, it suffices to consider the ti to all be multiples of 1/N for some large integer N. By multiplying all the tj by N and all ξi by 1/N, we may assume that all of the tj are non-negative integers with t1 ≤ t2 ≤ . . . ≤ tk. Proof. Firstly, by adding a constant to all the tj we can make them non-negative. This multiplies det([e2πiξitj ]i,j) = Θ 1!2!··· k! (2π)(k Let zi = exp(2πiξi). Then our determinant is det(cid:18)(cid:104)z tj i (cid:105)i,j(cid:19) , which is equal to the Vandermonde determinant times the Schur polynomial sλ(zi) where λ is the partition λj = tj − (j − 1). Therefore, this determinant equals (cid:89)i<j (zi − zj)sλ(z1, z2, . . . , zk). The absolute value of is approximately(cid:81)i<j(2πi)(ξi − ξj), which has absolute value (2π)(k to evaluate the size of the Schur polynomial. 2)(cid:81)i<j ξi − ξj. We have left (cid:89)i<j (zi − zj) 58 By standard results, sλ is a polynomial in the zi with non-negative coefficients, and all exponents at most maxj tj in each variable. Therefore, the monomials with non-zero coefficients will all have real part at least 1/2 and absolute value 1 when evaluated at the zi. Therefore, On the other hand, by the Weyl character formula sλ(z1, . . . , zk) = Θ(sλ(1, 1, . . . , 1)). sλ(1, 1, . . . , 1) =(cid:89)i<j tj − ti j − i = (cid:81)i<j ti − tj 1!2! . . . k! . This completes the proof. Next we prove our Theorem when the ξ have small total variation. Lemma A.2. If there exists a ξ0 so that(cid:80)ξi − ξ0 < 1/8, then (k!)3(cid:81)k−1 det(Gξ1,...,ξk ) = Θ(cid:32) 23k(k−1)/2πk(k−1)(cid:81)i<j ξi − ξj2 Proof. By translating the ξi we can assume that ξ0 = 0. n=0(2n)! By the above we have (cid:33) . Θ( (2π)k(k−1)(cid:81)i<j ξi − ξj2 (1!2!··· k!)2 )(cid:90) 1 −1 . . .(cid:90) 1 −1(cid:89)i<j ti − tj2dt1 . . . dtk. We note that by the Cauchy-Binet formula the latter term is the determinant of the matrix M with Mi,j =(cid:82) 1−1 ti+jdt. This is the Graham matrix associated to the polynomials ti for 0 ≤ i ≤ k − 1. Applying Graham-Schmidt (without the renormalization step) to this set yields the basis Pnαn where αn = 2n(n!)2 n2/(2n + 1). Therefore, the integral over the ti yields is the inverse of the leading term of Pn. This polynomial has norm α2 (2n)! This completes the proof. k−1(cid:89)n=0 2n+1(n!)2 (n + 1)(2n)! . Next we extend this result to the case that all the ξ are within poly(k) of each other. Proposition A.3. If there exists a ξ0 so that ξi − ξ0 = poly(k) for all i, then Proof. We begin by proving the lower bound. We note that for 0 < x < 1, min(ξi − ξj2, 1). det(Gξ1,...,ξk ) ≥(cid:90) x −x(cid:90) x −x 2 dt1dt2 . . . dtk = xk det(Gξ1/x,ξ2/x,...,ξk/k). Taking x = 1/ poly(k), we may apply the above Lemma to compute the determinant on the right hand side, yielding an appropriate lower bound. det(Gξ1,...,ξk ) = 2 O(k2)(cid:89)i<j . . .(cid:90) 1 −1(cid:12)(cid:12)(cid:12)det([e2πiξitj ]i,j)(cid:12)(cid:12)(cid:12) 59 To prove the lower bound, we note that we can divide our ξi into clusters, Ci, where for any i, j in the same cluster ξi − ξj < 1/k and for i and j in different clusters ξi − ξj ≥ 1/k2. We then note as a property of Graham matrices that det(Gξ1,...,ξk ) ≤(cid:89)Ci det(G{ξj∈Ci}) = 2 O(k2) (cid:89)i<j, in same clusterξi − ξj2 = 2 O(k2)(cid:89)i<j ξi − ξj2. This completes the proof. Finally, we are ready to prove our Theorem. Proof. Let I(t) be the indicator function of the interval [−1, 1]. Recall that there is a function h(t) so that for any function f that is a linear combination of at most k complex exponentials that h(t)f (t)2 = Θ(I(t)f (t)2) and so that h is supported on an interval of length poly(k) < kC about the origin. Note that we can divide our ξi into clusters, C(cid:105), so that for i and j in a cluster ξi − ξj < kC+1 Let Gξ1,ξ2,...,ξ(cid:48) We claim that for any k(cid:48) be the matrix with (i, j)-entry(cid:82)R h(t)2e(2πi)(ξi−ξj )tdt. and for i and j in different clusters ξi − ξj > kC. k ≤ k that det( Gξ1,ξ2,...,ξ(cid:48) k ) = 2O(k(cid:48)) det(Gξ1,ξ2,...,ξ(cid:48) ). k This is because both are Graham determinants, one for the set of functions I(t) exp((2πi)ξjt) and the other for h(t) exp((2πi)ξjt). However since any linear combination of the former has L2 norm a constant multiple of that the same linear combination of the latter, we have that Gξ1,ξ2,...,ξ(cid:48) k = Θ(Gξ1,ξ2,...,ξ(cid:48) k ) as self-adjoint matrices. This implies the appropriate bound. Therefore, we have that det(Gξ1,...,ξk ) = 2O(k) det( Gξ1,...,ξk ). However, note that by the Fourier support of h that (cid:90)R h(t)2e(2πi)(ξi−ξj )tdt = 0 if ξi − ξj > kC, which happens if i and j are in different clusters. Therefore G is block diagonal and hence its determinant equals det( Gξ1,...,ξk ) =(cid:89)C(cid:105) det( G{ξj∈Ci}) = 2O(k)(cid:89)C(cid:105) det(G{ξj∈Ci}). However the Proposition above shows that (cid:89)C(cid:105) det(G{ξj∈Ci}) = 2 O(k2)(cid:89)i<j min(1,ξi − ξj2). This completes the proof. 60 k(cid:81)i=1 (z − zi). A.2 Proofs of Lemma 5.3 and Lemma 5.4 We fix z1,··· , zk to be complex numbers on the unit circle and use Q(z) to denote the degree-k polynomial Lemma 5.3. Let Q(z) be a degree k polynomial, all of whose roots are complex numbers with n,k · zl denote the residual polynomial of l=0 r (l) absolute value 1. For any integer n, let rn,k(z) =(cid:80)k−1 Then, each coefficient of rn,k is bounded: r Proof. By definition, rn,k(zi) = zn rn,k(z) ≡ zn (mod Q(z)). (l) n,k ≤ 2knk−1 for any l. i . From the polynomial interpolation, we have rn,k(z) = k(cid:88)i=1 (cid:81)j∈[k]\i (cid:81)j∈[k]\i i (z − zj)zn (zi − zj) . Let SymS,i be the symmetry polynomial of z1,··· , zk with degree i among subset S ⊆ [k], i.e., SymS,i = (cid:80)S(cid:48)⊆(S i)(cid:81)j∈S(cid:48) zj. Then r (l) n,k = (−1)k−1−l k(cid:88)i=1 i Sym[k]\i,k−1−l ·zn (cid:81)j∈[k]\i (zi − zj) . We omit (−1)k−1−l in the rest of proof and use induction on n, k, and l to prove r n,k ≤ 1. Base Case of n: For any n < k, from the definition, r(z) = zn and r Suppose it is true for any n < n0. We consider rl (l) bounded by 1 because z1 is on the unit circle of C. n0,k from now on. When k = 1, rn,0 = zn 1 is (l) l (cid:1)(cid:0) n n,k ≤(cid:0)k−1 k−1(cid:1). Given n0, suppose the induction hypothesis is true for any k < k0 and any l < k. For k = k0, 61 we first prove that r (k0−1) r n0,k0 (l) n0,k0 ≤(cid:0)k0−1 l (cid:1)(cid:0) n0 k0−1(cid:1) for l = k0 − 2,··· , 0. zn0 (zk0 − zj) i i = + = = zk0 (k0−1) k0(cid:81)j∈[k0]\k0 zk0 + zn0−1 (zi − zj) zn0 (zi − zj) zn0 (zi − zj) k0−1(cid:1) then prove that r n0,k0 ≤(cid:0) n0 k0(cid:88)i=1 i(cid:81)j∈[k0]\i k0−1(cid:88)i=1 i(cid:81)j∈[k0]\i k0−1(cid:88)i=1 i − zn0−1 zn0 (cid:81)j∈[k0]\i  k0−1(cid:88)i=1 i(cid:81)j∈[k0−1]\i (cid:81)j∈k0\i (zi − zj) +zk0 =  k0−1(cid:88)i=1 i(cid:81)j∈[k0−1]\i k0−2(cid:1) +(cid:0)n0−2 n0−1,k0 ≤(cid:0)n0−2 (k0−2) n0−1,k0−1 + zk0 · r (zi − zj) (k0−1) n0−1,k0 zn0−1 zn0−1 zn0−1 = + i + zk0 zn0 (zk0 − zj) zn0 (zk0 − zj) k0(cid:81)j∈k0\k0 (zi − zj) + k0(cid:81)j∈k0\k0 (zi − zj) k0(cid:88)i=1 i(cid:81)j∈k0\i k0−1(cid:1). For l < k0 − 1, we have k0−1(cid:1) =(cid:0)n0−1 zn0−1 Hence r (k0−1) n0,k0 ≤ r (l) r n0,k0 = = = = i i i (cid:48) + let l (k0−1) = k0 − 1 − l (cid:81)j∈[k0]\i = r (k0−2) n0−1,[k0−1] + r Sym[k0]\i,k0−1−l ·zn0 (cid:81)j∈[k0]\i (zi − zj) (cid:16)Sym[k0−1]\i,l(cid:48) + Sym[k0−1]\i,l(cid:48)−1 ·zk0(cid:17) zn0 (zi − zj) Sym[k0−1]\i,l(cid:48) ·(zi − zk0)zn0−1 k0(cid:88)i=1 k0−1(cid:88)i=1 k0−1(cid:88)i=1 Sym[k0−1],l(cid:48) ·zn0 (cid:81)j<k0 (zk0 − zj) k0−1(cid:88)i=1 Sym[k0−1]\i,l(cid:48) ·(zi − zk0)zn0−1 (cid:81)j∈[k0]\i (zi − zj) k0−1(cid:88)i=1 k0−1(cid:88)i=1 Sym[k0−1],l(cid:48) ·zk0zn0−1 (cid:81)j∈[k0]\i k0−2(cid:1) +(cid:0)k0−1 l−1(cid:1)(cid:0)n0−1 n0,k0 ≤(cid:0)k0−2 (l−1) n0−1,k0−1 + Sym[k0−1],k0−1−l ·zk0 · r l (cid:1)(cid:0)n0−1 (zi − zj) (k0−1) n0−1,k0 + + k0 i i i = Sym[k0−1]\i,l(cid:48) zn0−1 (cid:81)j∈[k0−1]\i (zi − zj) By induction hypothesis, r = r (l) Now we finish the proof of Lemma 5.4. k0 Sym[k0−1],l(cid:48) ·zn0 (cid:81)j<k0 (zk0 − zj) + Sym[k0−1]\i,l(cid:48) ·zk0zn0−1 (cid:81)j∈[k0]\i (zi − zj) i + Sym[k0−1]\i,l(cid:48)−1 ·zk0zn0 i + Sym[k0−1],l(cid:48) ·zk0zn0−1 i + k0 Sym[k0−1],l(cid:48) ·zn0 (cid:81)j<k0 (zk0 − zj) k0 + Sym[k0−1],l(cid:48) ·zn0 (cid:81)j<k0 (zk0 − zj) l (cid:1)(cid:0) n0 k0−1(cid:1) ≤(cid:0)k0−1 k0−1(cid:1). 62 Lemma 5.4. For any k ∈ Z and any z1,··· , zk on the unit circle of C, there always exists a degree m = O(k2 log k) polynomial P (z) = cjzj with the following properties: m(cid:80)j=0 Property I Property II Property III P (zi) = 0,∀i ∈ {1,··· , k}, c0 = 1, cj ≤ 11,∀j ∈ {1,··· , m}. Let m = 10k2 log k and P denote a set of polynomials that has degree at most m, and all the coefficients are integers chosen from {−5,··· ,−1, 0, 1,··· , 5}, i.e., αizi ∀i ∈ {0, 1,··· , m},αi ≤ 2(cid:41) . P :=(cid:40)P (z) = m(cid:88)i=0 m(cid:80)i=0 αizi with coefficient αi ≤ 10 for any i ∈ {0, 1,··· , m}, such Claim A.4. There exists P ∗(z) = that every coefficient of P ∗(z) mod Q(z) is bounded by 2−m. αirn,k(z) from the definition rn,k(z). Hence Proof. For P (z) = m(cid:80)i=0 αizi ∈ P, P (z) mod Q(z) ≡ k−1(cid:88)l=0 zl (l) αi i,kzl = r m(cid:88)i=0 P (z) mod Q(z) = m(cid:88)i=0 m(cid:80)i=0 2kik−1 ≤ 2kmk. Each coefficient in P (z) mod Q(z) is bounded by (2−m)2(cid:17)k At the same time, P = 11m. From the pigeonhole principle and(cid:16) 2kmk k−1(cid:80)i=0 P1, P2 ∈ P such that for P ∗(z) = P1(z) − P2(z), P ∗(z) mod Q(z) = γi ≤ 2−m. i,k ≤ 5 (l) i,k. αir (l) αir m(cid:80)i=0 k−1(cid:88)l=0 m(cid:80)i=0 < 11m, there exists γizi where each coefficient k−1(cid:80)i=0 Let r(z) = γizi = P ∗(z) mod Q(z) for convenience. If P ∗(0) (the constant term of P ∗) is nonzero, then P ∗(0) − r(0) ≥ 0.99 from the above lemma. Therefore the polynomial P ∗(z)−r(z) P ∗(0)−r(0) satisfies the three properties in Lemma 5.4. Otherwise, we assume zl is the first term in P ∗(z) with a non-zero coefficient. Let r−l,k(z) = z −l mod Q(z) = k(cid:88)i=1 −l i . (z − zj)z (zi − zj) (cid:81)j∈[k]\i (cid:81)j∈[k]\i For convenience, we use zS = (cid:81)i∈S . Hence r−l,k(z) = [k] where r(cid:48) is the polynomial for k units roots z[k]\1,··· , z[k]\k. So each coefficients of r is r(cid:48) l,k(z)/zl still bounded by 2klk, which is less than 2−m/2. Eventually we choose P ∗(z)/zl − r(z)· r−l,k(z) and renormalize it to satisfy the three properties zi for any subset S ⊆ [k]. Notice that z zl [k]\i zl [k] −l i = in Lemma 5.4. 63 A.3 Proof of Lemma 4.3 Lemma 4.3. For any degree d polynomial P (t) : R → C with derivative P (cid:48)(t), we have, (cid:90) 1 −1 (cid:48) (1 − t2)P (t)2dt ≤ 2d2(cid:90) 1 −1 P (t)2dt. (28) Given a degree d polynomial P (x), we rewrite P (x) as a linear combination of the Legendre polynomials: i(x) for convenience. From the definition of the Legendre polynomials in We use Fi(x) = (1 − x2)L(cid:48) the Equation (3), F (cid:48) Hence we have (cid:90) −1 1 (1 − x2)P (cid:48) (cid:48) 1 i (x) i(x). P (x) = αiLi(x). αi−F (cid:48)(cid:48) (1 − x2)P (x) · P (cid:48)(x)dx d(cid:88)i=0 i (x) = −i(i + 1) · Li(x) and F (cid:48)(cid:48) i (x) = −i(i + 1) · L(cid:48) (x)2dx = (cid:90) −1 i(i + 1) dx 1 (cid:88)i∈[d] αiFi(x) ·(cid:88)i∈[d] = (cid:90) −1 = (cid:88)i∈[d] i(i + 1)(cid:12)(cid:12)(cid:12)(cid:12) αiFi(x) ·(cid:88)i∈[d] i(i + 1) dx i (x) ·(cid:88)i∈[d] 1 (cid:88)i∈[d] + (cid:90) −1 αi · i(i + 1) · Li(x) ·(cid:88)i∈[d] 1 (cid:88)i∈[d] = (cid:90) −1 = (cid:88)i∈[d] ≤ d(d + 1)(cid:107)P(cid:107)2 αi2i(i + 1)(cid:107)Li(cid:107)2 αi−F (cid:48) F (cid:48) i (x) (cid:48) αiF 1 −1 T i (x) αi αi i(i + 1) · Li(x) i(i + 1)  dx T A.4 Proof of Lemma 6.2 Lemma 6.2. (cid:92)Pσ,a,bx(σ(f − b)) = 1 σ e−2πiσaf(cid:98)x(f ) and (cid:92)Pσ,a,bx(f ) = 1 σ e−2πiσa(f /σ+b)(cid:98)x(f /σ + b) 64 Proof. Let's compute the Fourier Transform of (Pσ,a,bx)(t), −2πif tdt x(σ(t − a))e −2πiσbte x(σt)e (cid:92)Pσ,a,bx(f ) −2πif tdt =e =e −∞ −∞ −∞ −2πiσbte (Pσ,a,b(x))(t)e x(σ(t − a))e =(cid:90) +∞ =(cid:90) +∞ −2πi(σab+f a)(cid:90) +∞ −2πi(σab+f a)(cid:90) +∞ −2πi(σab+f a)(cid:90) +∞ −2πi(σab+f a)(cid:90) +∞ −2πiaσ(f /σ+b)(cid:98)x(f /σ + b) 1 σ 1 σ 1 σ x(t)e −∞ −∞ −∞ = = e e = e x(σt)e −2πibσte −2πif σt/σdσt −2πi(b+f /σ)tdt −2πiσb(t−a)e −2πif (t−a)dt by shifting t by a −2πif tdt by replacing t − a by t by replacing tσ by t by definition of FT The first result follows immediately by replacing f /σ + b by f(cid:48), which gives Thus, we complete the proof of this Lemma. (cid:92)Pσ,a,bx(σ(f (cid:48) − b)) = 1 σ e −2πiaσf(cid:48) (cid:48) ). (cid:98)x(f A.5 Proof of Lemma 3.5 Lemma 3.5. Given any function x(t) : R → C with max points from 0 to T . If each point of S is chosen uniformly at random from [0, T ], we have t∈[0,T ]x(t)2 ≤ d(cid:107)x(t)(cid:107)2 T . Let S denote a set of 1 Pr(cid:34)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) x(ti)2 − (cid:107)x(t)(cid:107)2 S(cid:88)i∈S t∈[0,T ]x(t)2. Replacing Xi by x(ti)2 T ](cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ (cid:107)x(t)(cid:107)2 T(cid:35) ≤ e −Ω(2S/d) M and n by S in Lemma B.2, we obtain Proof. Let M denote max that > S(cid:107)x(t)(cid:107)2 T µ) Pr[X − µ > µ] ≤ 2 exp(− =⇒ Pr(cid:34)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:88)i∈S M − S(cid:107)x(t)(cid:107)2 x(ti)2 =⇒ Pr(cid:34)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) S(cid:88)i∈S =⇒ Pr(cid:34)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) S(cid:88)i∈S which is less than 2 exp(− 2 3 S/d), thus completes the proof. M (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) T(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ (cid:107)x(t)(cid:107)2 T(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ (cid:107)x(t)(cid:107)2 x(ti)2 − (cid:107)x(t)(cid:107)2 x(ti)2 − (cid:107)x(t)(cid:107)2 1 1 T M (cid:35) ≤ 2 exp(− T(cid:35) ≤ 2 exp(− T(cid:35) ≤ 2 exp(− 2 3 2 µ) 2 3 µ) 3 S(cid:107)x(t)(cid:107)2 M T ) 2 3 65 A.6 Proof of Lemma 3.10 Lemma 3.10. For any polynomial P (t) of degree at most d from R to C, for any interval [S, T ], t∈[S,T ]P (t)2 ≤ (d + 1)2 · max 1 T − S(cid:90) T S P (t)2dx. Proof. Let t∗ = arg max t∈[S,T ] P (t)2. If t∗ − S(cid:90) t∗ t∗ 1 ∈ (S, T ), then it is enough to prove that T − t∗(cid:90) T ∗ S P (x)2dx and P (t )2 ≤ (d + 1)2 1 )2 ≤ (d + 1)2 ∗ P (t on the two intervals [S, t∗] and [t∗, T ] separately. t∗ P (x)2dx Without loss of generality, we will prove the inequality for S = −1 and t∗ = T = 1. We find the T assuming P (1)2 = 1. Because the first (d + 1) Legendre polynomials provide a minimum (cid:107)P (x)(cid:107)2 basis of polynomials of degree at most d and their evaluation Ln(1) = 1 for any n, we consider: We simplify the integration of P (x)2 over [−1, 1] by the orthogonality of Legendre polynomials: min α0,α1,··· ,αd∈C αiLi(x) αi = 1. s.t. P (x) = P (1) = (cid:90) 1 −1 P (x)2dx d(cid:88)i=0 d(cid:88)i=0 αiLi(x)(cid:33) · −1(cid:32) d(cid:88)i=0 d(cid:88)j=0 d(cid:88)i=0 αi2Li(x)2 +(cid:88)i(cid:54)=j αi2 2i + 1 −1 2 by Fact 3.9 αjLj(x) dx αiαjLi(x)Lj(x)dx 2 2i+1, we simplify the optimization problem to (cid:90) 1 −1 P (x)2dx = (cid:90) 1 = (cid:90) 1 d(cid:88)i=0 = Using(cid:82) 1−1 P (x)2dx = d(cid:80)i=0αi2 min α0,α1,··· ,αd∈C s.t. From the Cauchy-Schwarz inequality, we have 2 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) d(cid:88)i=0 (d+1)2 and P (1)2 ≤ (d + 1)2 · 1 2i+1 ≥ 2 ≤(cid:32) d(cid:88)i=0 αi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) αi2 2 2 2i + 1 2 (cid:33) . 2(cid:82) 1−1 P (x)2dx. Therefore d(cid:80)i=0αi2 2i + 1 2 = 1 d(cid:88)i=0 αi2 αi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) d(cid:88)i=0 2i + 1(cid:33)(cid:32) d(cid:88)i=0 66 Algorithm 1 Linear regression algorithms 1: procedure LinearRegression(A, b,) - Fact B.3 2: x(cid:48) return x(cid:48) ← arg min x (cid:107)Ax − b(cid:107)2. 3: 4: end procedure 5: procedure LinearRegressionW(A, b, w) - Fact B.3 6: ← arg min x(cid:48) return x(cid:48) x 7: 8: end procedure d(cid:80)i=1 wi(Ax)i − bi2. B Known Facts This section provides a list of well-known facts existing in literature. Inequalities B.1 We state the Hölder's inequality for complex numbers. We will use the corresponding version p = q = 2 of Cauchy-Schwarz inequality for complex numbers. Lemma B.1 (Hölder's inequality). If S is a measurable subset of Rn with the Lebesgue measure, and f and g are measurable complex-valued functions on S, then (cid:90)S f (x)g(x)dx ≤ ((cid:90)S f (x)pdx) 1 p ((cid:90)S g(x)qdx) 1 q Lemma B.2 (Chernoff Bound [Tar09],[Che52] ). Let X1, X2,··· , Xn be independent random vari- ables. Assume that 0 ≤ Xi ≤ 1 always, for each i ∈ [n]. Let X = X1 + X2 + ··· + Xn and µ = E[X] = E[Xi]. Then for any  > 0, n(cid:80)i=1 Pr[X ≥ (1 + )µ] ≤ exp(− 2 2 +  µ) and Pr[X ≥ (1 − )µ] ≤ exp(− 2 2 µ). B.2 Linear regression Given a linear subspace span{(cid:126)v1,··· , (cid:126)vd} and n points, we always use (cid:96)2-regression to find a vector as the linear combination of (cid:126)v1,··· , (cid:126)vd that minimizes the distance of this vector to those n points. Fact B.3. Given an n × d matrix A and an n × 1 column vector b , it takes O(ndω−1) time to output an x(cid:48) such that (cid:48) x = arg min x (cid:107)Ax − b(cid:107)2. where ω is the exponent of matrix multiplication[Wil12]. Notice that weighted linear regression can be solved by linear regression solver as a black-box. 67 Algorithm 2 Multipoint evaluation of a polynomial 1: procedure MultipointEvaluation(P,{t1, t2,··· , td}) - Fact B.4 2: 3: end procedure return P (t1), P (t2),··· , P (td) B.3 Multipoint evaluation of a polynomial Given a degree-d polynomial, and n locations. The naive algorithm of computing the evaluations at those n locations takes O(nd). However, the running time can be improved to O(n poly(log d)) by using this well-known result, Fact B.4 ([BS12]). Given a degree-d polynomial P (t), and a set of d locations {t1, t2,··· , td}. There exists an algorithm that takes O(d logc d) time to output the evaluations {P (t1), P (t2),··· , P (td)}, for some constant c. C Analysis of Hash Functions and Filter Functions C.1 Analysis of filter function (H(t), (cid:98)H(f )) We construct the Filter function (H(t), (cid:98)H(f )) in this section. We fix the interval to be supp(rect1) = [−1/2, 1/2] instead of [0, T ] for convenience. We first de- fine the filter function H1(t) which preserves the energy of a k-Fourier-sparse signal x∗ on [−1/2, 1/2] to the signal H1 · x∗ on [−∞, +∞]. Definition C.1. Let s1 = Θ(k4 log4 k), (cid:96) = Ω(k log k/δ) be a even number, and s0 = C0s1√(cid:96) for some constant C0 that will normalize H1(0) = 1. Recall that rects(t) = 1 iff t ≤ s/2 and (cid:92) rects(f ) = sinc(f s) = sin(πf s) We define the filter function H1(t) and its Fourier transform (cid:98)H1(f ) as follows: πf s . ∗(cid:96) · sinc (f s2) , (cid:1)∗(cid:96) · ·(cid:96) ∗ rects2(t) (cid:98)H1(f ) = s0 · (rects1(f )) = s0 ·(cid:0) H1(t) = s0 · (sinc(s1t)) = s0 ·(cid:0) where s0 is a fixed parameter s.t. H1(0) = 1. (cid:1)·(cid:96) ∗ We provide some basic properties about our filter function. Notice that sinc(t) = sin(πt) ( sinc(0) πt is defined to be 1 ) has the following properties (shown in Figure 4): 1. ∀t ∈ R, 1 − (πt)2 3! ≤ sinc(t) ≤ 1. 2. ∀t ≤ 1.2/π, sinc(t) ≤ 1 − t2 8 . πt. 3. ∀t > 1.2/π, sinc(t) ≤ 1 68 1−s1/2s1/21−1/s21/s21−1/s11/s11−s2/2s2/2 Proof. We use the above properties for the sinc function to prove the upper bound: (sinc(s1t))(cid:96)dt (cid:104) 1 √ . (cid:96) s1 πs1 πs1− 1.2 Claim C.2. (cid:82) 1.2 (cid:90) + 1.2 πs1 − 1.2 πs1 Figure 4: The Property of sinc(t). (sinc(s1t))(cid:96)dt = = ≤ ≤ 0 1 2 −1.2/π s1(cid:90) +1.2/π s1(cid:32)(cid:90) √8/(cid:96) (cid:112)8/(cid:96) + (cid:112)8/(cid:96) + 2 s1 2 s1 (cid:46) 1 s1√(cid:96) . (sinc(t))(cid:96)dt 8/(cid:96) −1 1.2/π√ √8/(cid:96) (sinc(t))(cid:96)dt(cid:33) (sinc t)(cid:96)dt +(cid:90) 1.2/π (1 − x2/8)(cid:96)dx (cid:88)i=1 (cid:90) (i+1)√8/(cid:96) −i2 (cid:88)i=1 (cid:112)8/(cid:96) · 2 i√8/(cid:96) 1.2/π√ −1 8/(cid:96) We prove the lower bound: (cid:90) 1.2 πs1 − 1.2 πs1 (sinc(s1t))(cid:96)dt = 0 2 s1(cid:32)(cid:90) √8/(cid:96) s1(cid:32)(cid:90) √8/(cid:96) 2 0 (sinc(t))(cid:96)dt(cid:33) √8/(cid:96) (sinc t)(cid:96)dt +(cid:90) 1.2/π )(cid:96)dt(cid:33) (1 − π2t2 6 ≥ (cid:38) 1 s1√(cid:96) . We bound the integration outside [− 1.2 Claim C.3. (cid:82) +∞ (sinc(s1t))(cid:96)dt = O(1.2−(cid:96)). Claim C.4. There exists a universal constant C0 and s0 = C0s1√(cid:96) such that H1(0) = 1. From these two claims, we have the existence of s0. ] from the last property of the sinc function. , 1.2 πs1 1.2 πs1 πs1 69 1−11sinc(t)1−t281πt s0 · sinc (s1(τ ))(cid:96) dτ and the light green area from all discussion above. s1 (cid:96) 1/2−2/s1 (1/2−2/s1) sinc(s1t)(cid:96)dt (cid:104) 1 √ s0 · sinc (s1(τ ))(cid:96) dτ. Lemma C.5. Given s0, s1, s2, (cid:96), where s2 Figure 5: The light red area represents (cid:82) (1/2−2/s1)−t represents(cid:82) 1/2−2/s1+t Proof. Because (cid:96) is a large even number,(cid:82)rect1−2/s1 We show several useful properties about the Filter functions(cid:0)H1(t),(cid:99)H1(f )(cid:1). filter function (H1(t), (cid:98)H1(f ))[s0, s1, s2, (cid:96)] has the following properties, , 1], if t ≤ 1 s1 ≤ t ≤ 2π−(cid:96) s0 Property I : H1(t) ∈ [1 − s1 · (cid:96) − 1 Property II : H1(t) ∈ [0, 1], if s2 2 − Property III : H1(t) ≤ s0s2(cid:0)(s1t − s1 + 2)2 + 1(cid:1)−(cid:96) s2 2 − 1 s1 . 1 2 ,∀t > 1 2 Property IV : supp((cid:98)H1(f )) ⊆ [− s1(cid:96) 2 , s1(cid:96) 2 ] 2 + 1 s1 ≤ 1/2 and s0 = C0s1√(cid:96) for some constant C0. The Proof of Property I. bound for H1(t) by showing for any t > 0, H1(0) − H1(t) > 0 always holds , First, H1(0) = 1 follows by definition of s0, then we can prove the upper 70 64202460.20.00.20.40.60.81.0(sinc(t))'64202460.20.00.20.40.60.81.0(sinc(t))' By definition of sinc function, we know that sinc(s1t)(cid:96) reaches 0 at all the points { 1 s1 By definition of s1, we know that 1 s1 (cid:28) 1 2 − 1 s1 . For any t > 0, H1(0) − H1(t) = (cid:90) s0 · sinc (s1(τ ))(cid:96) · rect1−2/s1(0 − τ )dτ −(cid:90) s0 · sinc (s1(τ ))(cid:96) · rect1−2/s1(t − τ )dτ = (cid:90) 1/2−2/s1 = (cid:90) −(1/2−2/s1)+t s0 · sinc (s1(τ ))(cid:96) dτ −(cid:90) 1/2−2/s1+t s0 · sinc (s1(τ ))(cid:96) dτ −(cid:90) 1/2−2/s1+t s0 · sinc (s1(τ ))(cid:96) dτ s0 · sinc (s1(τ ))(cid:96) dτ −(1/2−2/s1)+t −(1/2−2/s1) −(1/2−2/s1) 1/2−2/s1 +i 2 s1i ∈ N}. shown in Figure 5 ≥ 0, where the last inequality follows by choosing s1 to be an integer. Thus, we prove an upper bound for H1(t). Third, we show the lower bound for H1(t), s0 · sinc(s1τ ) s0 · sinc(s1τ ) ·(cid:96) rects2(t − τ )dτ ·(cid:96)dτ −∞ H1(t) = (cid:90) +∞ = (cid:90) t+ s2 = 1 −(cid:90) +∞ t− s2 t+ s2 2 2 2 s0 · sinc(s1τ ) ·(cid:96)dτ s0 · sinc(s1τ ) ·(cid:96)dτ 2 −∞ −(cid:90) t− s2 (cid:124) (cid:125) B (cid:123)(cid:122) (cid:125) (cid:124) A (cid:123)(cid:122) Thus, as long as we can upper bound the term A and B, then we will have a lower bound for the H1(t), for any t ≤ s2 2 − 1 s1 . t+ s2 2 A = (cid:90) +∞ ≤ (cid:90) +∞ ≤ (cid:90) +∞ 1 s1 s0 · sinc(s1τ ) ·(cid:96)dτ ·(cid:96)dτ s0 · sinc(s1τ ) −(cid:96)dτ 1 s1 s0 · (s1πτ ) −(cid:96) 1 (cid:96) − 1 −(cid:96) 1 (cid:96) − 1 Similarly, we can bound the term B in the same way. = s0 · (s1π) s0 s1 · (π) = −(cid:96)+1 (1/s1) In the proof of Property I, we already show that ∀t, H1(t) ≤ 1. Thus, the Proof of Property II. upper bound of Property II is also holding. The lower bound follows by both sinc(s1t)·(cid:96) and rects2(t) are always nonnegative, thus the convolution of these two functions has to be nonnegative. 71 Proof of Property III. Let's prove the case when t > 1, since H1(t) is symmetric, then the case t < −1 will also hold. By definition of (H1(t), (cid:98)H1(f )), we have sinc(s1(t − τ )) ·(cid:96) rects2(τ )dτ −∞ H1(t) = s0 ·(cid:90) +∞ = s0 ·(cid:90) s2 = s0 ·(cid:90) s2 − s2 − s2 2 2 2 2 sinc(s1(t − τ )) sinc(s1(τ − t)) ·(cid:96)dτ ·(cid:96)dτ We'd like to choose a middle point τ0, and then separated the interval into two parts, one is [− s2 and the other is [τ0, s2 2 ]. To choose a reasonable τ0, we need to use the following simple facts, 2 , τ0] −(cid:96) if x ≥ 1.2 ( ( sin(x) x sin(x) x )(cid:96) ≤ x )(cid:96) ≤ (1 − x2 8 )(cid:96) if x < 1.2 Thus, πs1(τ0 − t) = 1.2, which implies that τ + s1 and s2, we know τ s1 ≥ s2 the H1(t), 2 − 1.2 − 0 > 1 2 − 1 > 1 πs1 . By relationship between 0 = t + 1.2 πs1 2 . Thus, we can use the case x < 1.2 to upper bound or τ − 0 = t− 1.2 πs1 ·(cid:96) sinc(s1(τ − t)) (s1π(τ − t))2 )(cid:96) 8 H1(t) ≤ s0 · s2 · max τ∈[−s2/2,s2/2] )(cid:96) max ≤ s0 · s2 (1 − τ∈[−s2/2,s2/2] (s1π( s2 2 − t))2 8 2 −t))2 s2 = s0 · s2(1 − ≤ s0 · s2 · (e ≤ s0 · s2 · (e(s1(t−s2/2))2 ≤ s0 · s2 · (1 + (s1(t − s2/2))2) −(cid:96) ≤ s0 · (1 + (s1(t − s2/2))2) − (s1π( )(cid:96) −(cid:96) ) 8 −(cid:96) −x by 1 − x ≤ e by 1 < π2/8 by 1 + x ≤ ex by s1 ≤ 1. Thus, we complete the proof. 2 ]. 2 , s1(cid:96) Proof of Property IV. Because of the support of rects1(f ) is s1, then the support of (rects1(f ))∗(cid:96) = s1(cid:96). Since (cid:98)H1(f ) is defined to be the (rects1(f ))∗(cid:96) multiplied by sinc(f s2), thus supp((cid:98)H1(f )) ⊆ [− s1(cid:96) Definition C.6. Given any 0 < s3 < 1, 0 < δ < 1, we define (H(t), (cid:98)H(f )) to be the filter function (H1(t),(cid:99)H1(f )) by doing the following operations • Setting (cid:96) = Θ(k log(k/δ)), 72 • Setting s2 = 1 − 2 • Shrinking by a factor s3 in time domain, s1 , H(t) = H1(t/s3) (29) (30) (cid:98)H(f ) = s3(cid:99)H1(s3f ) ∆h = supp((cid:98)H(f )) = s1 · (cid:96) s3 domain and use We call the "heavy cluster" around a frequency f0 to be the support of δf0(f )∗ (cid:98)H(f ) in the frequency (31) to denote the width of the cluster. Lemma 6.6. Given s0, s1, 0 < s3 < 1, (cid:96) > 1, 0 < δ < 1, where (cid:96) = Θ(k log(k/δ)).The filter function We show several useful properties about the Filter functions(cid:0)H(t), (cid:98)H(f )(cid:1). (H(t), (cid:98)H(f )) has the following properties, Property I : H(t) ∈ [1 − δ, 1], when t ≤ ( Property II : H(t) ∈ [0, 1], when ( Property III : H(t) ≤ s0 · (s1(t s3 − s1(cid:96) supp((cid:98)H(f )) ⊆ [− 2s3 1 2 − 1 2 Property IV : s1(cid:96) 2s3 ) + 2) 2 s1 ]. , )s3. 1 2 − 2 s1 1 )s3 ≤ t ≤ 2 −(cid:96),∀t > 1 2 s3. s3. For any exact k-Fourier-sparse signal x∗(t), we shift the interval from [0, T ] to [−1/2, 1/2] and consider x∗(t) for t ∈ [−1/2, 1/2] to be our observation, which is also x∗(t) · rect1(t). Property V : (cid:90) +∞ −∞ (cid:12)(cid:12)x Property VI : (cid:90) +∞ −∞ x for arbitrarily small constant . ∗ ∗ dt < δ(cid:90) +∞ (t) · H(t) · (1 − rect1(t))(cid:12)(cid:12)2 (t) · H(t) · rect1(t)2dt ∈ [1 − , 1] ·(cid:90) +∞ −∞ x ∗ −∞ x (t) · rect1(t)2dt. ∗ (t) · rect1(t)2dt. The Property I, II, III and IV follow by filter function H(t), (cid:98)H(f ) inheriting H1(t), (cid:98)H1(f ). Proof of Property V. ∀t /∈ [−1/2, 1/2], we have, ∗ ∗ ∗ x ≤ x ≤ x (t) · H(t)2 (t)2 · H(t)2 (t)2 · (s1(t − 1/2) + 2) ≤ k7 · (2kt)2.5k ·(cid:90) +∞ ≤ tO(k log k) ·(cid:90) +∞ ∗ −∞ x −∞ x ∗ −(cid:96) (t) · rect1(t)2dt · (s1(t s3 − (t) · rect1(t)2dt · (s1(t 1 s3 − 2 73 by Property III of H1(t) by Lemma 5.5 −(cid:96) ) + 2) 1 2 ) + 2) −(cid:96)/2. (32) Figure 6: (cid:92)H · x∗(f ) and H · x∗(t). Thus taking the integral finishes the proof because (cid:96) (cid:38) k log(k/δ). −∞ x Proof of Property VI. LHS, (cid:90) +∞ Second, as mentioned early, we need to prove the general case when s3 = 1 − 1/ poly(k). Define interval S = [−s3( 1 )], by definition, S ⊂ [−1/2, 1/2]. Then define S = [−1/2, 1/2]\S, 2− 1 which is [−1/2,−s3( 1 2 − 1 (t) · H(t)2dt ≥ (1 − δ)2(cid:90)S x First, because of for any t, H1(t) ≤ 1, thus we prove the upper bound for (t) · H(t) · rect1(t)2dt ≤(cid:90) +∞ ∗ 2− 1 )) ∪ (s3( 1 (cid:90)S x ∗ ), 1/2]. By Property I, we have (t) · 1 · rect1(t)2dt. ∗ (t)2dt ∗ −∞ x (33) ), s3( 1 s1 s1 2 − 1 s1 s1 74 403020100102030400.010.000.010.020.030.040.050.06Given signal (Frequency domain)cH(f)cx∗(f)dH·x∗(f)f=±s1'/(2s3)4321012340.20.00.20.40.60.81.0Fourier transform (Time domain)H(t)x∗(t)H·x∗(t)t=±0.5t=±0.5s3t=±(0.5−2/s1)s3 Then we can show ∗ (cid:90)S x (t)2dt t∈[−1/2,1/2]x ≤ S · max ∗ ≤ (1 − s3(1 − 2 s1 2 (cid:46) (cid:90) 1 − 1 2 ∗ x (t)2dt (t)2 2 )) · (cid:101)O(k4)(cid:90) 1 − 1 2 ∗ x (t)2dt by min( Combining Equations (33) and (34) gives a lower bound for LHS, (t) · H(t) · rect1(t)2dt ∗ ∗ ∗ −∞ x (cid:90) +∞ ≥ (cid:90)S x (t)H(t)2dt ≥ (1 − 2δ)(cid:90)S x ≥ (1 − 2δ)(cid:90)S∪S x ≥ (1 − 2δ)(cid:90)S∪S x ≥ (1 − 2δ − )(cid:90) 1 ≥ (1 − 2)(cid:90) +∞ −∞ x − 1 2 ∗ x ∗ ∗ (t)2dt (t)2dt − (1 − 2δ)(cid:90)S x ∗ (t)2dt (t)2dt − (1 − 2δ)(cid:90)S∪S x (t)2dt ∗ ∗ 2 (t)2dt (t) · rect1(t)2dt by Lemma 5.1 1 1 − s3 , s1) ≥ (cid:101)O(k4) (34) by Equation (33) by Equation (34) by  (cid:29) δ Remark C.7. To match (H(t), (cid:98)H(f )) on [−1/2, 1/2] with signal x(t) on [0, T ], we will scale the time domain from [−1/2, 1/2] to [−T /2, T /2] and shift it to [0, T ]. For example, the rectangle function in Property V and VI will be replaced by rectT (t − T /2). For the parameters s0, s1, s3, δ, (cid:96) in the definition of H, we always treat them as numbers. We assume T has seconds as unit and ∆h has Hz as unit . For example, in time domain, the Property I becomes that given T > 0, H(t) ∈ [1 − δ, 1] if t − T 2 ≤ ( 1 2 − 1 s1 )s3 · T In frequency domain, the Property IV becomes supp((cid:98)H(f )) ⊆ [− ∆h 2 , ∆h 2 ], where ∆h = s1(cid:96) s3T . (35) Lemma C.8. Let H(t) denote the function defined in Definition C.6. For any t ∈ [− 1 exists an algorithm that takes O(s1 + (cid:96) log(s1) + log(1/)) time to output a value (cid:101)H(t) such that 2 , 1 2 ], there (1 − )H(t) ≤ (cid:101)H(t) ≤ (1 + )H(t). 75 Figure 7: Property VI of filter function H(t), the light green area represents RHS(without scalar) of Property VI of filter H, the light red area represents LHS of Property VI of filter H, the light yellow area represents the difference. Property VI says the light yellow area is only a small constant fraction of the light green area. 76 403020100102030400.010.000.010.020.030.040.050.06Given signal (Frequency domain)cH(f)cx∗(f)dH·x∗(f)f=±s1'/(2s3)4321012340.100.050.000.050.100.15Fourier transform (Time domain)H(t)x∗(t)t=±0.54321012340.100.050.000.050.100.15Fourier transform (Time domain)H(t)x∗(t)H·x∗(t)t=±0.54321012340.100.050.000.050.100.15Fourier transform (Time domain)H(t)x∗(t)H·x∗(t)t=±0.5 Proof. We will show that using a low degree polynomial with sufficiently large degree is able to approximate the sinc function. By definition of filter function, ·(cid:96) rects2(t − τ )dτ )(cid:96)dτ s0 s0 2 ( τ = = = s0 2 ( −∞ πs1τ 2 )πs1 2 )πs1 2 )πs1 t− s2 )(cid:96)dτ (t− s2 sin(τ ) sinc(s1τ ) sin(πs1τ ) H(t) = s0 ·(cid:90) +∞ = s0 ·(cid:90) t+ s2 πs1(cid:90) (t+ s2 πs1(cid:90) (t+ s2 πs1(cid:90) (t+ s2 where the last step follows by setting A =(cid:80)d 2 )πs1 and I− = (t− s2 (A + B)(cid:96)dτ ≤(cid:90) I + (1 − )(cid:90) I + 2 )πs1 (cid:32) ∞ (cid:88)i=0 O(s1). The goal is to show that Denote I + = (t+ s2 (A + B)(cid:96)dτ (−1)i (t− s2 (t− s2 2 )πs1 2 )πs1 I− I− τ 2i (2i + 1)!(cid:33)(cid:96) dτ by Taylor expansion i=0(−1)i τ 2i (2i+1)!, and B =(cid:80)∞ 2 )πs1. Because of t ∈ [−1/2, 1/2], then max(I +,I− i=d+1(−1)i τ 2i (2i+1)!. ) = A(cid:96)dτ ≤ (1 + )(cid:90) I + I− (A + B)(cid:96)dτ j(cid:19)(A + B)(cid:96)−j(−B)jdτ j(cid:19)A + B(cid:96)−jBjdτ j(cid:19)A + B(cid:96)−jdτ · max τ∈[I−,I +]Bj Let's prove an upper first, I− I− I− I− (A + B)(cid:96)dτ + (A + B)(cid:96)dτ + (A + B)(cid:96)dτ + (A + B − B)(cid:96)dτ I− (cid:18)(cid:96) (cid:96)(cid:88)j=1(cid:90) I + I− (cid:18)(cid:96) (cid:96)(cid:88)j=1(cid:90) I + I− (cid:18)(cid:96) (cid:96)(cid:88)j=1(cid:90) I + (A + B)(cid:96)dτ + (cid:96)2(cid:96) · max τ∈[I−,I +]B −Θ((cid:96)) (cid:90) I + =(cid:90) I + ≤(cid:90) I + ≤(cid:90) I + ≤(cid:90) I + ≤(cid:90) I + ≤(1 + )(cid:90) I + Claim C.9. Let B(τ ) =(cid:80)+∞ (A + B)(cid:96)dτ +  · (s1) i=d+1(−1) (A + B)(cid:96)dτ I− I− I− by H(t) ≤ 1 and Bj ≤ B by Claim C.9 by Claim C.10 where all the steps by setting d (cid:38) s1+(cid:96) log(s1)+log(1/). Similarly, we can prove a lower bound. τ 2i (2i+1)!, if d (cid:38) τ +(cid:96) log(s1)+log(1/) then B(τ ) ≤ (1/s1)O((cid:96)). 77 Proof. We first show, for any i ≥ d + 1, τ 2i (2i + 1)! τ 2i e((2i + 1)/e)2i+1 −2i ≤ ≤ 2 ≤ (1/s1)O((cid:96)) by e(n/e)n ≤ n! by i (cid:38) τ by i (cid:38) (cid:96) log(s1) + log(1/) Second, we can show that +∞ (cid:88)i=d+1 (−1) τ 2i (2i + 1)! (cid:46) τ 2(d+1) (2(d + 1) + 1)! ≤ (1/s1)O((cid:96)) Thus, we complete the proof. Claim C.10. mint∈[−1/2,1/2] H(t) ≥ (s1)−Ω((cid:96)). Proof. By the property of H(t), min 1 2 s3<t≤ 1 2 H(t) = mint≤ 1 2 H(t) Thus, it suffices to prove a lower bound on H(t) for any t such that 1 symmetric property, we only need to prove a lower bound for one side. Let's consider t ∈ [ 1 2 s3 < t ≤ 1 2. Because of 2 s3, 1/2], 2 )πs1 2 )πs1 2 )πs1 s0 (t− s2 πs1(cid:90) (t+ s2 πs1(cid:90) (t+ s2 s0 (t+ s2 4 )πs1 s0 πs1 · Θ((t + −Ω((cid:96)) ( ( sin(τ ) τ )(cid:96)dτ sin(τ ) τ )(cid:96)dτ )s1) · 1 2 · π · Θ((t + s2 2 −(cid:96) )πs1) s2 2 H(t) ≥ ≥ ≥ ≥ (s1) C.2 Analysis of filter function (G(t),(cid:98)G(f )) We construct (G(t),(cid:98)G(f )) in a similar way of (H1(t),(cid:99)H1(f )) by switching the time domain and the frequency domain of (H1(t),(cid:99)H1(f )) and modify the parameters for the permutation hashing Pσ,a,b. Definition C.11. Given B > 1, δ > 0, α > 0, we construct G(t),(cid:98)G(f ) by doing the following operations, 2B , • s2 = π απ , • s1 = B • (cid:96) = l = Θ(log(k/δ)). 78 Figure 8: Parameters for s1, s3 and (cid:96). Then G(t),(cid:98)G(f ) becomes (απ) = b0 · (rect B G(t) = b0 · (rects1(t)) (t)) ∗l · sinc(ts2) ∗l · sinc(t ·l ∗ rects2(f ) ·l ∗ rect π where the scalar b0 = Θ(s1√l) = Θ(B√l/α) satisfying (cid:98)G(0) = 1. Lemma 6.7. Given B > 1, δ > 0, α > 0, we set l = Ω(log(δ/k)). The filter function (G(t),(cid:98)G(f ))[B, δ, α, l] (cid:98)G(f ) = b0 · (sinc(s1f )) satisfies the following properties, = b0 · (sinc( π 2B B απ (f ). f )) ), 2B Property I : Property II : Property III : Property IV : 2π 2B 2π 2B . . 2π 2B ≤ f ≤ (cid:98)G(f ) ∈ [1 − δ/k, 1], if f ≤ (1 − α) (cid:98)G(f ) ∈ [0, 1], if (1 − α) (cid:98)G(f ) ∈ [−δ/k, δ/k], if f > 2 · −B l 2 · G(t) (cid:46) poly(B, l). supp(G(t)) ⊂ [ 2π 2B B πα πα ]. l . , t Property V : max Proof. The first five Properties follows from Lemma 6.6 directly. C.3 Parameters setting for filters One-cluster Recovery. In section C.1, by Equation (34) in the proof of Property VI of filter function (H(t), (cid:98)H(f )), we In one-cluster, we donot need filter function (G(t),(cid:98)G(f )). 1 1−s3 need min( , s1) ≥ (cid:101)O(k4). 79 1log0.5(1/δ)log1(1/δ)log1.5(1/δ)log2(1/δ)polylog(1/δ)1−1/k41−1/k5kk4k5k6s3's1∆h set (cid:96) (cid:38) k log(k/δ). In section C.1, by Equation (32) in the proof of Property V of filter function (H(t), (cid:98)H(f )), we ∆h is determined by the parameters of filter (H(t), (cid:98)H(f )) in Equation (35): ∆h (cid:104) s1(cid:96) C.1. Combining the setting of s1, s3 (cid:96), we should set ∆h ≥ (cid:101)O(k5 log(1/δ))/T . k-cluster Recovery. Note that in the k-cluster recovery, we need to use filter function (G(t),(cid:98)G(f )). We choose l = log(k/δ), α (cid:104) 1, B (cid:104) k , and D = l/α. By proof of Property II of z in Lemma 7.20 from section 7.6, we need T (1 − s3) > σBl. By the same reason in one-cluster recovery, 1− s3 ≤ 1(cid:101)O(k4) . Combining T (1− s3) > σBl and 1− s3 ≤ 1(cid:101)O(k4) , (cid:101)O(k4) Because in our algorithm, we will sample σ from [ 1 B∆h Equation (36) we have ]. Thus, plugging σ = Θ( 1 B∆h s3T in section we obtain , 2 B∆h > σBl T (36) ) in which implies another lower bound for ∆h, T > l ∆h (cid:101)O(k4) ∆h ≥ (cid:101)O(k4)l/T Combining the above bound with previous lower bound in one-cluster recovery, we get ∆h ≥ (cid:101)O(k4 log(1/δ))/T + (cid:101)O(k5 log(1/δ))/T = (cid:101)O(k5 log(1/δ))/T For s1 and (cid:96), we still choose the same setting as before, s1 (cid:104) (cid:101)O(k4) and (cid:96) (cid:104) O(k log(k/δ)). C.4 Analysis of HashToBins In this section, we explain the correctness of Procedure HashToBins in Algorithm 6. Before giving the proof of that algorithm, we show how to connect CFT, DTFT and DFT. Lemma C.12. For any signal W : R → C, let A : Z → C and B : [n] → C be defined as follows: A[i] = W (i),∀i ∈ Z and B[i] =(cid:88)j∈Z A[i + jn],∀i ∈ [n]. Then we consider the Fourier transform on W, A, and B: CFT DTFT DFT (cid:99)W : R → C, (cid:98)A : [0, 1] → C, (cid:98)B : [n] → C. ∀i ∈ [n], (cid:98)B[i] =(cid:88)j∈Z(cid:99)W (i/n + j). We have: ∀f ∈ [0, 1), (cid:98)A(f ) =(cid:88)j∈Z(cid:99)W (f + j); 80 Proof. Recall that Combs(t) = (cid:80)j∈Z δjs(t). First, we show (cid:98)A(f ) = (cid:80)j∈Z e2πijf A[j] equals to (cid:80)j∈Z(cid:99)W (f + j): by A[j] = W (j) e2πif jW (j) · Comb1(j)dj Next, we prove that ∀i ∈ [n], (cid:98)B[i] = (cid:98)A(i/n), 2πi n ij −∞ e2πijf W [j] (cid:98)A(f ) = (cid:88)j∈Z = (cid:90) +∞ = (cid:92)W · Comb1(f ) (cid:92)Comb1)(f ) = ((cid:99)W ∗ = (cid:88)j∈Z(cid:99)W (f + j). n(cid:88)j=1 n(cid:88)j=1 ((cid:88)k∈Z n(cid:88)j=1(cid:88)k∈Z = (cid:88)j∈Z A[j]e2πij i A[j + kn]e B[j]e = = A[j + kn])e (cid:98)B[i] = 2πi n i(j+kn) n = (cid:98)A(i/n) 2πi n ij by B[j] =(cid:88)k∈Z (37) by DFT A[j + kn] by e 2πi n ·ikn = 1 by DTFT. (38) Combining Equation (38) and Equation (37), we obtain that (cid:98)B[j] = (cid:98)A(j/n) =(cid:80)i∈Z(cid:99)W (j/n + i) for all j ∈ [n]. Claim C.13. Let u ∈ CB and V ∈ CBD such that for any j ∈ B, u[j] = (cid:80)i∈[D] V [j + (i− 1)B]. Then Proof. We prove it through the definition of the Fourier transform: (cid:98)u[j] = (cid:98)V [jD],∀j ∈ [B]. 2πi BD ·i·(jD) V [i] · e by definition of DFT V [i + kB]e 2πi B ·(i+kB)·j by replacing i by i + kB D(cid:88)k=1 2πi (cid:98)V [jD] = = = = BD(cid:88)i=1 B(cid:88)i=1 B(cid:88)i=1 B(cid:88)i=1 V [i + (k − 1)B] e e B ·j·i D(cid:88)k=1 B ·j·iu[i] =(cid:98)u[j] 2πi 81 by e2πijk = 1 by definition of DFT on u (j) Figure 9: (cid:98)G 2B ), 1 σ (2π(i + j 2π σ,b(f ) where the top one is j = 0 and the bottom one is j = 1, Ai,j = [ 1 σ (2π(i + j B ) − B ) + 2π 2B )], Bi,j = [ 1 σ (2π(i + j B ) − 2π(1−α) 2B ), 1 σ (2π(i + j B ) + 2π(1−α) 2B )] We use Definition 6.1 and Lemma 6.2 to generalize Lemma C.12, W(cid:0)(j + in)σ − σa(cid:1), then ∀j ∈ [n], + i)/σ(cid:19) · Corollary C.14. If for all j ∈ [n], B[j] = (cid:80)i∈Z (cid:98)B[j] =(cid:88)i∈Z(cid:99)W(cid:18)( W(cid:0)(j + in)σ − σa(cid:1)e−2πiσb(j+in), then ∀j ∈ [n], (cid:98)B[j] =(cid:88)i∈Z(cid:99)W(cid:18)( If for all j ∈ [n], B[j] = (cid:80)i∈Z + i)/σ + b(cid:19) · n +i)a−2πiσab. −2πi( j e −2πi( j e n +i)a. j n j n 1 σ 1 σ Remark C.15 (Samples of HashToBins). Procedure HashToBins in Algorithm 6 takes BD samples in x(t): x(σ(1 − a)), x(σ(2 − a)),··· , x(σ(BD − a)). To analyze our algorithm, we use filter function (G(t),(cid:98)G(f )) and Combs(t) = (cid:80)j∈Z the discretization of G. δsj(t) to define 82 bG(0)σ,b(f)A−2,0B−2,0A−1,0B−1,0A0,0B0,0A1,0B1,0A2,0B2,01/σ1/(Bσ)bG(1)σ,b(f)A−2,1B−2,1A−1,1B−1,1A0,1B0,1A1,1B1,1A2,1B2,11/σ1/(Bσ) Definition C.16. Define the discretization of G(t) and (cid:98)G(f ), 1 s Gdis(t) = G(t) · Combs(t) ((cid:98)G ∗ Comb1/s)(f ) (cid:98)Gdis(f ) = = ((cid:98)G ∗ Comb1)(f ) = (cid:0) where supp(G(t)) = lB Definition 6.8. ∀σ > 0, b and j ∈ [B]. Define, πα, D = l (cid:1) ∗ πα, s = supp(G(t))/(BD) = l/(παD) = 1. Lemma 6.9. Let u ∈ CB be the result of HashToBins under permutation Pσ,a,b, and let j ∈ [B]. Define G (j) σ,b(t) = 1 σ (j) (cid:98)G σ,b(f ) = (cid:98)Gdis( G(t/σ)e2πit(j/B−σb)/σ j B − σf − σb) =(cid:88)i∈Z (cid:98)G(i + (cid:98)z = (cid:91)x · H · (cid:98)G (j) σ,b, z = (x · H) ∗ G (j) σ,b. j B − σf − σb) so Let vector (cid:98)u ∈ CB denote the B-dimensional DFT of u, then ∀j ∈ [B], Proof. Recall B is the number of hash bins. B · D is the number of samples in time signal. Let W (t) = x · H(t), define vector y ∈ CBD, then ∀j ∈ [BD], define y[j] = W (σ(j − a))e2πiσbj the discretization of G(t), where G(cid:48)[i] = G(i). Then, ∀j ∈ [B], B/α(t) · sinc(t/B), then supp(G(t)) = lB Recall G(t) denote the rect∗l (cid:98)u[j] = zσa. α . Let vector G(cid:48) ∈ CBD is u[j] = (cid:88)i∈[D] V [j + iB] where V [j] = y[j] · G(cid:48)[j] and G(cid:48)[j] is the value at the jth nonzero point of Gdis(t). Applying Claim C.13 with the definition of u[j] and V [j + iB], gives(cid:98)u[j] = (cid:98)V [jD],∀j ∈ [B]. Because of u is the result of HashToBins(x · H, Pσ,a,b, G) and supp(G(t)) = BD(choosing D = l/α), then u[j] =(cid:88)i∈Z W (σ(j + iB − a))e −2πiσb(j+iB)G(j + iB) Then we define G(cid:48)(cid:48)(t) = G(t/σ + a)e−2πibσ(t/σ+a) and Y (t) = W (t) · G(cid:48)(cid:48)(t), then immediately, we have (cid:48)(cid:48) (cid:98)G (f ) = σ(cid:98)G(σ(f − b))e2πiaσf 83 and (cid:98)Y (f ) =(cid:99)W (f ) ∗ (cid:98)G (cid:48)(cid:48) (f ) −(1−α)πB(1−α)πB−πBπB0−1−212 Thus, we can rewrite u[j] in the following sense, W (σ(j + iB − a))e (cid:48)(cid:48) W (σ(j + iB − a))G Y (σ(j + iB − a)) −2πiσb(j+iB)G(j + iB) (σ(j + iB − a)) (cid:48)(cid:48) by G (t) = G(t/σ + a)e −2πibσ(t/σ+a) (cid:48)(cid:48) by Y (t) = W (t) · G (t) u[j] Then = (cid:88)i∈Z = (cid:88)i∈Z = (cid:88)i∈Z (cid:98)u[j] = (cid:88)i∈Z (cid:98)Y (( = (cid:88)i∈Z(cid:90) +∞ = (cid:88)i∈Z(cid:90) +∞ = (cid:90) +∞ = (cid:90) +∞ j B by Corollary C.14 B +i)a + i)/σ) · (cid:48)(cid:48) −2πi( j 1 σ · e j/B + i ( σ (cid:48)(cid:48) (f ) − s) · 1 σ · e −2πi·(j/B+i)ads −2πiaσsds −2πi·(−σs)ads By definition C.16, (cid:48)(cid:48) by (cid:98)G j B − σs − σb)e by (cid:98)Y (f ) =(cid:99)W (f ) ∗ (cid:98)G (f ) = σ(cid:98)G(σ(f − b))e2πiaσf by (cid:98)Gdis(f ) =(cid:88)i∈Z (cid:98)G(f + i) −∞ (cid:99)W (s) · (cid:98)G −∞ (cid:99)W (s) · (cid:98)G(j/B + i − σs − σb) · e −∞ (cid:99)W (s) ·(cid:88)i∈Z (cid:98)G((j/B + i) − σs − σb)e2πiaσsds −∞ (cid:99)W (s) · (cid:98)Gdis( (cid:98)G σ,b = (cid:98)Gdis( By definition of(cid:98)z, we have (cid:98)z(s) = (cid:91)x · H(s) · (cid:98)G(j)(s) =(cid:99)W (s) · (cid:98)G(j)(s) Then(cid:98)u[j] is the (aσ)th inverse Fourier coefficients of(cid:98)z, basically, Thus, we can conclude first computing vector u ∈ CB. Getting vector(cid:98)u ∈ CB by using the Discrete Fourier transform(cid:98)u = DFT(u). This procedure allows us to sample from time domain to implicitly access the time signal's Fourier transform (cid:98)z. If z is one-cluster in frequency domain, then apply B − σs − σb) =(cid:88)i∈Z (cid:98)G(i + (cid:98)u[j] = zaσ = z(aσ) one-cluster recovery algorithm. j B − σs − σb) (j) j D Acknowledgments The authors would to like thank Aaron Sidford and David Woodruff for useful discussions. E Algorithm This section lists the pseudocode of our algorithms. 84 Rest ← (T ∆)2 for i = 1 → Rest do Choose αi ∈ [0, T ] uniformly at random zemp ← zemp + z(αi)2 zemp ←(cid:112)zemp/Rest Algorithm 3 1: procedure GetEmpirical1Energy(z, T, ∆) - Claim 7.11 2: 3: 4: 5: 6: 7: return zemp 8: 9: end procedure 10: procedure GetLegal1Sample(z, ∆, T, β, zemp) - Lemma 7.2 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: end procedure end for for i ∈ Sheavy do w(i) ← z(αi)2 + z(αi + β)2 end for α ← αi with probability w(i)/(cid:80)j∈Sheavy Rrepeat ← (T ∆)3, Sheavy ← ∅ for i = 1 → Rrepeat do Choose αi ∈ [0, T ] uniformly at random if z(αi) ≥ 0.5 · zemp then end if Sheavy ← Sheavy ∪ i end for return α w(j) for i ∈ Sheavy 85 Set t (cid:104) log(F T ), t(cid:48) = t/4, Dmax (cid:104) logt(cid:48)(F T ), Rloc (cid:104) log1/c(tc), L(1) = 2F for i ∈ [Dmax] do Algorithm 4 1: procedure Locate1Signal(z, T, F, ∆, zemp) - Lemma 7.15 2: 3: 4: 5: 6: 7: 8: 9: end for 10: return L(i) 11: 12: end procedure l (cid:104) 2F/(t(cid:48))i−1∆, s (cid:104) c, (cid:98)β = ts if (cid:98)β (cid:38) T /(T ∆)3/2 then L(i) ← Locate1Inner(z, ∆, T,(cid:98)β, zemp, L(i−1)) end if break else 2∆l 2πσβ (φ(x(γ)/x(γ + β)) + 2πsi) Let vq ← 0 for q ∈ [t] while r = 1 → Rloc do 13: procedure Locate1Inner(z, ∆, T,(cid:98)β, zemp,(cid:101)L) Choose β ∈ [ 1 2(cid:98)β,(cid:98)β] uniformly at random γ ← GetLegal1Sample(z, ∆, T, β, zemp) for i ∈ [m] do si ∈ [β((cid:101)L − ∆l/2), β((cid:101)L + ∆l/2)] ∩ Z+, θi = 1 Let θi belong to region(q) Then add a vote to region(q) and its two neighbors, i.e., region(q−1) and region(q +1) 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: end procedure 27: procedure FrequencyRecovery1Cluster(z, T, F, ∆) - Theorem 7.5 28: 29: 30: 31: 32: 33: end procedure zemp ← GetEmpirical1Energy(z, T, ∆) for r = 1 → O(k) do Lr ← Locate1Signal(z, T, F, ∆, zemp) end for return L∗ end for end while q∗ j ← {qvq > Rloc 2 } return L ← center of region(q∗ ← median r∈[O(k)] Lr j ) 86 Algorithm 5 Main algorithm for one-cluster recovery 1: procedure CFT1Culster(x, H, T, F ) - Theorem 8.1 2: 3: 4: 5: end procedure 6: procedure GenerateIntervals(d) 7: 8: (cid:101)f0 ← FrequencyRecovery1Cluster(x, H, T, F ) (cid:101)x ← SignalRecovery1Cluster((cid:101)f0, poly(k)∆h) return(cid:101)x n ← y0 ← i ← 0, m ← Θ(d) while yi ≤ 1 − 9 m2 do √1−y2 m , In+1 ← [yi, yi+1], In+2 ← [−yi+1,−yi] yi+1 ← yi + i ← i + 1, n ← n + 2 i (n, I) ← GenerateIntervals(d) for j = 1 → n do 9: 10: end while 11: In+1 ← [yi, 1], In+2 ← [−yi,−1], n ← n + 2 12: return n, I 13: 14: end procedure 15: procedure RobustPolynomialLearning(x, d, T ) - Theorem 1.2 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: end procedure 27: procedure RobustPolynomialLearning+(x, d, T ) - Theorem 4.5 - a.k.a. SignalRe- wj ← Ij/2 Choose tj from Ij uniformly at random zj ← x(T · tj +1 2 ) j, for each (j, i) ∈ [n] × {0, 1,··· , d} (cid:101)Aj,i ← ti α ← LinearRegressionW((cid:101)A,(cid:101)b = z, w) Q(t) ←(cid:80)d return (cid:101)Q(t) = Q(T · t+1 end for i=0 αiti 2 ) covery1Cluster 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: Qi ← RobustPolynomialLearning(x, d, T ) R ← Θ(d) (n, I) ← GenerateIntervals(d) wj ← Ij/2, for each j ∈ [n] for i = 1 → R do end for Choose tj from Ij uniformly at random, for each j ∈ [n] for i = 1 → R do Qi(t1), Qi(t2),··· , Qi(tn) ← MultipointEvaluation(Qi,{t1, t2,··· , tn}) end for (cid:101)Qj ← median i∈[R] j, for each (j, i) ∈ [n] × {0, 1,··· , d} (cid:101)Aj,i ← ti α ← LinearRegressionW((cid:101)A,(cid:101)b = (cid:101)Q, w) return Q(t) ←(cid:80)d Qi(tj), for each j ∈ [n] i=0 αiti 39: 40: 41: 42: end procedure 87 Set t (cid:104) log(F T ), t(cid:48) = t/4, Dmax (cid:104) logt(cid:48)(F T ), Rloc (cid:104) log1/c(tc), L(1) = 2F for i ∈ [Dmax] do Algorithm 6 1: procedure LocateKSignal(x, H, G, T, ∆, σ, b, zemp) - Clain 7.27 2: 3: 4: 5: 6: 7: 8: 9: end for 10: return L(i) 11: 12: end procedure ∆l (cid:104) 2F/(t(cid:48))i−1, s (cid:104) c, (cid:98)β = ts if σ(cid:98)β (cid:38) T /(T ∆)3/2 then L(i) ← LocateKInner(x, H, G, T, ∆, σ, b, zemp(cid:98)β, U, L(i−1)) end if break else 2σ∆l Let vj,q ← 0 for (j, q) ∈ [B] × [t] for r = 1 → Rloc do 13: procedure LocateKInner(x, H, G, T, ∆, σ, b, zemp(cid:98)β, U,(cid:101)L) Choose β ∈ [ 1 ← GetLegalKSample(x, H, G, T, ∆, σ, β, zemp) for j ∈ [B] do for i ∈ [m] do θj,i = 1 fj,i = θj,i + b (mod F ) suppose fj,i belongs to region(j, q), add a vote to both region(j, q) and two neighbors nearby that region, e.g. 2(cid:98)β,(cid:98)β] uniformly at random 2πσβ (φ((cid:98)u[j]/(cid:98)u(cid:48)[j]) + 2πsi), si ∈ [σβ((cid:101)Lj − ∆l/2), σβ((cid:101)Lj + ∆l/2)] ∩ Z+ 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: (cid:98)u,(cid:98)u(cid:48) region(j, q − 1) and region(j, q + 1) end for end for end for return L end for for j ∈ [B] do q∗ j ← {qvj,q > Rloc 2 } Lj ← center of region(j, q∗ 24: 25: 26: 27: 28: 29: 30: 31: 32: end procedure 33: procedure HashToBins(x, H, G, Pσ,a,b) - Lemma 6.9 34: 35: 36: 37: end procedure Compute u[j] =(cid:80)i∈D v[j + iB] (cid:98)u ← FFT(u) return(cid:98)u j ) 88 zj emp/Rest Rest ← (T ∆)2 for i = 1 → Rest do Algorithm 7 1: procedure GetEmpiricalKEnergy(x, H, G, T, ∆, σ, b) - Claim 7.26 2: 3: 4: 5: 6: 7: 8: 9: 10: Choose α ∈ [0, T ] uniformly at random for j = 1 → B do end for (cid:98)u ← HashToBins(x, H, G, Pσ,α,b) emp + (cid:98)uj2 zj emp ← zj Rrepeat ← (T ∆)3. Sj heavy ← ∅,∀j ∈ [B] for i = 1 → Rrepeat do Choose α ∈ [0, T ] uniformly at random (cid:98)ui ← HashToBins(x, H, G, Pσ,α,b) (cid:48)i ← HashToBins(x, H, G, Pσ,α+β,b) (cid:98)u for j = 1 → B do j ≥ 0.5 · zj if (cid:98)ui Sheavy,j ← Sj end for for j = 1 → B do emp ←(cid:113)zj 11: end for 12: return zemp. 13: 14: end procedure 15: procedure GetLegalKSample(x, H, G, T, ∆, β, zemp) - Lemma 7.25 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: end procedure 36: procedure OneStage(x, H, G, σ, b) - Lemma 7.22 zemp ← GetEmpiricalKEnergy(x, H, G, T, ∆, σ, b) 37: L ← LocateKSignal(x, H, G, T, ∆, σ, b, zemp) 38: 39: end procedure end for for j = 1 → B do for i ∈ Sj w(i) ← (cid:98)ui j2 + (cid:98)u end for j ) with probability w(i)/(cid:80)i(cid:48)∈Sj ((cid:98)vj,(cid:98)v(cid:48) j) ← ((cid:98)ui j,(cid:98)u return(cid:98)v,(cid:98)v(cid:48) ∈ CB emp then heavy ∪ i heavy do end for end for end if (cid:48)i j 2 (cid:48)i w(i(cid:48)) for i ∈ Sj heavy heavy 89 Algorithm 8 Main algorithm for k-cluster recovery 1: procedure CFTKCluster(x, H, G, T, F ) 2: 3: 4: 5: end procedure 6: procedure FrequencyRecoveryKCluster(x, H, G) - Theorem 2.6 7: 8: {(cid:101)f1,··· ,(cid:101)fl} ← FrequencyRecoveryKCluster(x, H, G, T, F ) (cid:101)x ← SignalRecoveryKCluster+((cid:101)f1,··· ,(cid:101)fl, ∆ = poly(k, log(1/δ))/T, T ) return(cid:101)x as our hypothesis Choose σ ∈ [ 1 Choose b ∈ [0, 2π(cid:98)F/∆h(cid:99)] Lr ← OneStage(x, H, G, σ, b) ← MergedStages(L1, L2,··· , LR) 9: 10: 11: 12: 13: end procedure ] uniformly at random ] uniformly at random for r ∈ [R] do end for L∗ B∆h B∆h (σB) 2 , 14: procedure SignalRecoveryKCluster((cid:101)f1,··· ,(cid:101)fl, ∆, T ) j · e2πi(cid:101)fi2 tj for each (i1, i2) ∈ {0,··· , d} × [l] d ← 5π((∆T )1.5 + k3 log k + k log 1/δ) m ← O((kd)C3 · logC3 d) for a constant C3 = 5 for j = 1 → m do Sample tj from [0, T ] uniformly at random (cid:101)Aj,i1·l+i2 ← ti1 (cid:101)bj ← x(tj) α ← LinearRegression((cid:101)A,(cid:101)b) αi1·l+i2ti1 · e2πi(cid:101)fi2 t l(cid:80)i2=1 d(cid:80)i1=0 return(cid:101)x(t) ← end for 24: end procedure 25: procedure SignalRecoveryKCluster+((cid:101)f1,··· ,(cid:101)fl, ∆, T ) - Theorem 9.1 15: 16: 17: 18: 19: 20: 21: 22: 23: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: Sample tj from [0, T ] uniformly at random R ← Θ(k) d ← 5π((∆T )1.5 + k3 log k + k log 1/δ) m ← O((kd)C3 · logC3 d) for a constant C3 = 5 for i = 1 → R do (cid:101)xi(t) ← SignalRecoveryKCluster((cid:101)f1,··· ,(cid:101)fl, ∆, T ) end for for j = 1 → m do j · e2πi(cid:101)fi2 tj for each (i1, i2) ∈ {0,··· , d} × [l] (cid:101)Aj,i1·l+i2 ← ti1 (cid:101)bj ← median i∈[R] (cid:101)xi(tj) α ← LinearRegression((cid:101)A,(cid:101)b) αi1·l+i2ti1 · e2πi(cid:101)fi2 t l(cid:80)i2=1 d(cid:80)i1=0 return(cid:101)x(t) ← end for 39: end procedure 90
0910.3123
2
0910
2010-02-19T09:19:42
Wee LCP
[ "cs.DS" ]
We prove that longest common prefix (LCP) information can be stored in much less space than previously known. More precisely, we show that in the presence of the text and the suffix array, o(n) additional bits are sufficient to answer LCP-queries asymptotically in the same time that is needed to retrieve an entry from the suffix array. This yields the smallest compressed suffix tree with sub-logarithmic navigation time.
cs.DS
cs
Wee LCP Johannes Fischer Karlsruhe Institute of Technology, 76128 Karlsruhe, Germany [email protected] Abstract. We prove that longest common prefix (LCP) information can be stored in much less space than previously known. More precisely, we show that in the presence of the text and the suffix array, o(n) additional bits are sufficient to answer LCP-queries asymptotically in the same time that is needed to retrieve an entry from the suffix array. This yields the smallest compressed suffix tree with sub- logarithmic navigation time. 1 Introduction Augmenting the suffix-array [7,15] with an additional array holding the lengths of longest common prefixes drastically increases its functionality [15,1,2]. Stored as a plain array, this so-called LCP- array occupies n(cid:100)log n(cid:101) bits for a text of length n. Sadakane [21] shows that less space is actually needed, namely 2n + o(n) bits if the suffix array is available at lookup time (see Sect. 2.3 for more details). Due to the 2n-bit term, this data structure is nevertheless incompressible, even for highly regular texts. As a simple example, suppose the text consists of only a's. Then the suffix array can be compressed to almost negligible space [20,9,3], while Sadakane's LCP-array cannot. Text regularity is usually measured in k-th order empirical entropy Hk [16]. We have 0 ≤ Hk ≤ log σ for a text on an alphabet of size σ, with Hk being "small" for compressible texts. In Sect. 3 of this article, we prove that the LCP-array can be stored in O or nHk + o(n) bits (depending on how the text itself is stored), while giving access to an arbitrary LCP-value in time O(logδ n) (arbitrary constant 0 < δ < 1). This should be compared to other compressed or sampled variants of the LCP-array. We are aware of three such methods: 1. Russo et al. [19] achieve nHk + o(n) space, but retrieval time at least O(log1+ n), hence super- log log n n (cid:16) (cid:17) logarithmic (arbitrary constant 0 <  < 1). 2. Fischer et al. [5] achieve nHk(log 1 Hk + O(1)) bits, with retrieval time O(logβ n), again for any constant 0 < β < 1. Although the space vanishes if Hk does, it is worse than our data structure. 3. Karkkainen et al. [12, Lemma 3] also employ the idea of "sampling" the LCP-array, but achieve only amortized time bounds. Allowing the same space as for our data structure (O( log log n ) bits on top of the suffix array and the text), one would have to choose q = log n log log n in their scheme, yielding super-logarithmic O(log n log log n) amortized retrieval time. n Finally, in Sect. 4, we apply our new representation of the LCP-array to suffix trees. This yields the first compressed suffix tree with O(nHk) bits of space and sub-logarithmic navigation-time for almost all operations. 2 Definitions and Previous Results This section sketches some known data structures that we are going to make use of. Throughout this article, we use the standard word-RAM model of computation, in which we have a computer with word-width w, where log n = O(w). Fundamental arithmetic operations (addition, shifts, multiplication, . . . ) on w-bit wide words can be computed in O(1) time. Fig. 1. Illustration to the succinct representation of the LCP-array. 2.1 Rank and Select on Binary Strings Consider a bit-string S[1, n] of length n. We define the fundamental rank - and select-operations on S as follows: rank1(S, i) gives the number of 1's in the prefix S[1, i], and select1(S, i) gives the position of the i'th 1 in S, reading S from left to right (1 ≤ i ≤ n). Operations rank0(S, i) and select0(S, i) are defined similarly for 0-bits. There are data structures of size O( n log log n ) bits in addition to S that support O(1)-rank- and select-operations, respectively [11,6]. For an easily accessible exposition of these techniques, we refer the reader to the survey by Navarro and Makinen [18, Sect. 6.1]. log n 2.2 Suffix- and LCP-Arrays The suffix array [7,15] for a given text T of length n is an array A[1, n] of integers s.t. TA[i]..n < TA[i+1]..n for all 1 ≤ i < n; i.e., A describes the lexicographic order of T 's suffixes by "enumerating" them from the lexicographically smallest to the largest. It follows from this definition that A is a permutation of the numbers [1, n]. Take, for example, the string T = CACAACCAC$. Then A = [10, 4, 8, 2, 5, 9, 3, 7, 1, 6]. Note that the suffix array is actually a "left-to-right" (i.e., alphabetical) enumeration of the leaves in the suffix tree [10, Part II] for T $. As A stores n integers from the range [1, n], it takes n words (or n(cid:100)log n(cid:101) bits) to store A in uncompressed form. However, there are also different variants of compressed suffix arrays; see again the survey by Navarro and Makinen [18] for an overview of this field. In all cases, the time to access an arbitrary entry A[i] rises to ω(1); we denote this time by tA. All current compressed suffix arrays have tA = Ω(log n) in the worst case (arbitrary constant 0 <  ≤ 1), and there are indeed ones that achieve this time [9]. In the same way as suffix arrays store the leaves of the corresponding suffix tree, the LCP-array captures information on the heights of the internal nodes as follows. Array H[1, n] is defined such that H[i] holds the length of the longest common prefix of the lexicographically (i − 1)'st and i'th smallest suffixes. In symbols, H[i] = max{k : TA[i−1]..A[i−1]+k−1 = TA[i]..A[i]+k−1} for all 1 < i ≤ n, and H[1] = 0. For T = CACAACCAC$, H = [0, 0, 1, 2, 2, 0, 1, 2, 3, 1]. Kasai et al. [13] gave an algorithm to compute H in O(n) time, and Manzini [17] adapted this algorithm to work in-place.1 2.3 2n + o(n)-Bit Representation of the LCP-Array Let us now come to the description of the succinct representation of the LCP-array due to Sadakane [21]. The key to his result is the fact that the LCP-values cannot decrease too much if listed in 1 Makinen [14, Fig. 3] gives another algorithm to compute H almost in-place. 2 T=CACAACCAC$A=10482593716H=0012201231I=44447799910S=00001111000110011101 the order of the inverse suffix array A−1 (defined by A−1[i] = j iff A[j] = i), a fact first proved by Kasai et al. [13, Thm. 1]: Proposition 1. For all i > 1, H[A−1[i]] ≥ H[A−1[i − 1]] − 1. (cid:117)(cid:116) Because H[A−1[i]] ≤ n− i + 1 (the LCP-value cannot be longer than the length of the suffix!), this implies that H[A−1[1]] + 1, H[A−1[2]] + 2, . . . , H[A−1[n]] + n is an increasing sequence of integers in the range [1, n]. Now this list can be encoded differentially: for all i = 1, 2, . . . , n, subsequently write the difference I[i] := H[A−1[i]] − H[A−1[i − 1]] + 1 of neighboring elements in unary code 0I[i]1 into a bit-vector S, where we assume H[A−1[−1]] = 0. Here, 0x denotes the juxtaposition of x zeros. See also Fig. 1. Combining this with the fact that the LCP-values are all less than n, it is obvious that there are at most n zeros and exactly n ones in S. Further, if we prepare S for constant-time rank0- and select1-queries, we can retrieve an entry from H by H[i] = rank0(S, select1(S, A[i])) − A[i] . (1) This is because the select1-statement gives the position where the encoding for H[A[i]] ends in H, and the rank0-statement counts the sum of the I[j]'s for 1 ≤ j ≤ A[i]. So subtracting the value A[i], which has been "artificially" added to the LCP-array, yields the correct value. See Fig. 1 for an example. Because rank0(H, select1(H, x)) = select1(H, x) − x, we can rewrite (1) to H[i] = select1(S, A[i]) − 2A[i] , (2) such that only one select-call has to be invoked. This leads to Proposition 2 (Succinct representation of LCP-arrays). The LCP-array for a text of length n can be stored in 2n + O( n log log n ) bits in addition to the suffix array, while being able to access its elements in time O(tA). (cid:117)(cid:116) log n 3 Less Space, Same Time The solution from Sect. 2.3 is admittedly elegant, but certainly leaves room for further improve- ments. Because the bit-vector S stores the LCP-values in text order, we first have to convert the position in A to the corresponding position in the text. Hence, the lookup time to H is dominated by tA, the time needed to retrieve an element from from the compressed suffix array. Intuitively, this means that we could take up to O(tA) time to answer the select-query, without slowing down the whole lookup asymptotically. Although this is not exactly what we do, keeping this idea in mind is helpful for the proof of the following theorem. n Theorem 1. Let T be a text of length n with O(1)-access to its characters. Then the LCP-array for T can be stored in O( log log n ) = o(n) bits in addition to T and to the suffix array, while being able to access its elements in O(tA + logδ n) time (arbitrary constant 0 < δ ≤ 1). Proof. We build on the solution from Sect. 2.3. Let j = A[i]. From (2), we compute H[i] as select1(S, j) − 2j. Computing A[i] takes time tA. Thus, if we could answer the select-query in the log log n ) additional bits), we were done. We now describe a data structure same time (using O( that achieves essentially this. Our description follows in most parts the solution due to Navarro n 3 Fig. 2. Illustration to the proof of Thm. 1. We know from the value of a that the first m = max(a−2j, 0) characters of Tj...n and Tj(cid:48)...n match (here with common prefix α). At most s = logδ n further characters will match (here β), until reaching a mismatch character x <lex y. and Makinen [18, Sect. 6.1], except that it does not store sequence S and the lookup-table on the deepest level. We divide the range of arguments for select1 into subranges of size κ = (cid:98)log2 n(cid:99), and store in log n ) bits, and divides N [i] the answer to select1(S, iκ). This table N [1,(cid:100) n S into blocks of different size, each containing κ 1's (apart from the last). κ(cid:101)] needs O( n κ log n) = O( n O (n/ log n) bits. Short blocks contain κ 1-bits and span at most κ2 positions in S. We divide again their range A block is called long if it spans more than κ2 = Θ(log4 n) positions in S, and short otherwise. For the long blocks, we store the answers to all select1-queries explicitly in a table P . Because κ2 × κ × log n(cid:1) = O(n/ log4 n × log2 n × log n) = λ × log κ(cid:1) = O (n/ log log n) bits. λ(cid:101)] needs O(cid:0) n there are at most κ2 long blocks, P requires O(cid:0) n of arguments into sub-ranges of size λ = (cid:98)log2 κ(cid:99) = Θ(log2 log n). In N(cid:48)[i], we store the answer to select1(S, iλ), this time only relative to the beginning of the block where i occurs. Because the values in N(cid:48) are in the range [1, κ2], table N(cid:48)[1,(cid:100) n Table N(cid:48) divides the blocks into miniblocks, each containing λ 1-bits. Miniblocks are called long if they span more than s = logδ n bits, and short otherwise. For long miniblocks, we store again the answers to all select-queries explicitly in a table P (cid:48), relative to the beginning of the corresponding block. Because the miniblocks are contained in short blocks of length ≤ κ2, the answer to such a select-query takes O(log κ) bits of space. Thus, the total space for P (cid:48) is O(n/s × λ × log κ) = O bits. This concludes the description of our data structure (cid:16) n log3 log n (cid:17) logδ n for select. To answer a query select1(S, j), let a = select1(S,(cid:98)j/λ(cid:99)λ) be the beginning of j's mini-block in S. Likewise, compute the beginning of the next mini-block as b = select1(S,(cid:98)j/λ(cid:99)λ + λ). Now if b − a > s, then the mini-block where i occurs is long, and we can look up the answer using our precomputed tables N , N(cid:48), P , and P (cid:48). Otherwise, we return the value a as an approximation to the actual value of select1(S, j). We now use the text T to compute H[i] in additional O(logδ n) time. To this end, let j(cid:48) = A[i−1] (see also Fig. 2). The unknown value H[i] equals the length of the longest common prefix of suffixes Tj...n and Tj(cid:48)...n, so we need to compare these suffixes. However, we do not have to compare letters from scratch, because we already know that the first m = max(a− 2j, 0) characters of these suffixes match. So we start the comparison at Tj+m and Tj(cid:48)+m, and compare as long as they match. Because b − a ≤ s = logδ n, we will reach a mismatch after at most s character comparisons. Hence, the additional time for the character comparisons is O(logδ n). (cid:117)(cid:116) 4 T=A=···ii−1αjj0βαβ···yx·········m≤sS=11s················ab (cid:16) n(k log σ+log log n) (cid:17) log log n If the text is not available for O(1) access, we have two options. First, we can always compress it with recent methods [22,4,8] to nHk + o(n) space (which is within the space of all compressed suffix arrays), while still guaranteeing O(1) random access to its characters: + n Corollary 1. The LCP-array for a text of length n can be stored in nHk+O bits in addition to the suffix array (simultaneously over all k ∈ o(logσ n) for alphabet size σ), while being able to access its elements in time O(tA + logδ n) (arbitrary constant 0 < δ ≤ 1). (cid:117)(cid:116) The second option is to use the compressed suffix array itself to retrieve characters in O(tA) time. This is either already provided by the compressed suffix array [20], or can be simulated [5]. This leads to logσ n Corollary 2. Let A be a compressed suffix array for a text of length n with access time tA = O(log n). Then the LCP-array can be stored in o(n) bits in addition to the suffix array, while being able to access its elements in time O(log+δ n) (arbitrary constant 0 < δ ≤ 1). (cid:117)(cid:116) Note in particular that all known compressed suffix arrays have worst-case lookup time Θ(log n) at the very best, so the requirements on tA in Cor. 2 are no restriction on its applicability. Further, by choosing  and δ such that  + δ < 1, the time to access the LCP-values remains sub-logarithmic. 3.1 Improved Retrieval Time Additional time could be saved in Thm. 1 and Cor. 1 by noting that a chunk of logσ n text characters can be processed in O(1) time in the RAM-model for alphabet size σ. Hence, when comparing the at most s = logδ n characters from suffixes Tj+m...n and Tj(cid:48)+m...n (end of the proof of Thm. 1), this could be done by processing at most s/ logσ n = log σ logδ−1 n such chunks. This is especially , the retrieval time interesting if the alphabet size is small; in particular, if σ = O becomes constant. 2(log1−δ n)(cid:17) (cid:16) The same improvement is possible for Karkkainen et al.'s solution [12], resulting in O(q log σ/ log n) amortized retrieval time in their scheme. 4 A Small Entropy-Bounded Compressed Suffix Tree The data structure from Thm. 1 is particularly appealing in the context of compressed suffix trees. Fischer et al. [5] give a compressed suffix tree that has sub-logarithmic time for almost all navigational operations. It is based on the compressed suffix array due to Grossi et al. [9], a compressed LCP-array, and data structures for range minimum- and previous/next smaller value- queries (RMQ and PNSV). Its size is nHk(2 log 1  + O(1)) + o(n) bits, where the "ugly" Hk nHk(log 1 + O(1))-term comes from a compressed form of the LCP-array. If we replace this data Hk structure with our new representation, we get (using Cor. 2 for simplicity): + 1 Theorem 2. A suffix tree can be stored in (1 + 1  )nHk + o(n) bits such that all operations can be computed in sub-logarithmic time (except level ancestor queries, which have an additional O(log n) penalty). Proof. The space can be split into (1 + 1  )nHk + o(n) bits from the compressed suffix array [9], additional o(n) bits from the LCP-array of Cor. 2, plus o(n) bits for the RMQ- and PNSV-queries. (cid:117)(cid:116) The time bounds are obtained from the third column of Table 1 in [5]. 5 Other trade-offs than those in Thm. 2 are possible, e.g., by taking different suffix arrays, or by preferring the LCP-array from Cor. 1 over that of Cor. 2. Acknowledgments The author wishes to express his gratitude towards the anonymous reviewers, whose insightful comments helped to improve the present material substantially. References 1. M. I. Abouelhoda, S. Kurtz, and E. Ohlebusch. Replacing suffix trees with enhanced suffix arrays. J. Discrete Algorithms, 2(1):53 -- 86, 2004. 2. R. Cole, T. Kopelowitz, and M. Lewenstein. Suffix trays and suffix trists: Structures for faster text indexing. In Proc. ICALP (Part I), volume 4051 of LNCS, pages 358 -- 369. Springer, 2006. 3. P. Ferragina and G. Manzini. Indexing compressed text. J. ACM, 52(4):552 -- 581, 2005. 4. P. Ferragina and R. Venturini. A simple storage scheme for strings achieving entropy bounds. Theor. Comput. Sci., 372(1):115 -- 121, 2007. 5. J. Fischer, V. Makinen, and G. Navarro. Faster entropy-bounded compressed suffix trees. Theor. Comput. Sci., 410(51):5354 -- 5364, 2009. 6. A. Golynski. Optimal lower bounds for rank and select indexes. Theor. Comput. Sci., 387(3):348 -- 359, 2007. 7. G. H. Gonnet, R. A. Baeza-Yates, and T. Snider. New indices for text: PAT trees and PAT arrays. In W. B. Frakes and R. A. Baeza-Yates, editors, Information Retrieval: Data Structures and Algorithms, chapter 3, pages 66 -- 82. Prentice-Hall, 1992. 8. R. Gonz´alez and G. Navarro. Statistical encoding of succinct data structures. In Proc. CPM, volume 4009 of LNCS, pages 294 -- 305. Springer, 2006. 9. R. Grossi, A. Gupta, and J. S. Vitter. High-order entropy-compressed text indexes. In Proc. SODA, pages 841 -- 850. ACM/SIAM, 2003. 10. D. Gusfield. Algorithms on Strings, Trees, and Sequences. Cambridge University Press, 1997. 11. G. Jacobson. Space-efficient static trees and graphs. In Proc. FOCS, pages 549 -- 554. IEEE Computer Society, 1989. 12. J. Karkkainen, G. Manzini, and S. J. Puglisi. Permuted longest-common-prefix array. In Proc. CPM, volume 5577 of LNCS, pages 181 -- 192. Springer, 2009. 13. T. Kasai, G. Lee, H. Arimura, S. Arikawa, and K. Park. Linear-time longest-common-prefix computation in suffix arrays and its applications. In Proc. CPM, volume 2089 of LNCS, pages 181 -- 192. Springer, 2001. 14. V. Makinen. Compact suffix array -- a space efficient full-text index. Fundamenta Informaticae, 56(1-2):191 -- 210, 2003. Special Issue - Computing Patterns in Strings. 15. U. Manber and E. W. Myers. Suffix arrays: A new method for on-line string searches. SIAM J. Comput., 22(5):935 -- 948, 1993. 16. G. Manzini. An analysis of the Burrows-Wheeler transform. J. ACM, 48(3):407 -- 430, 2001. 17. G. Manzini. Two space saving tricks for linear time lcp array computation. In Proc. Scandinavian Workshop on Algorithm Theory (SWAT), volume 3111 of LNCS, pages 372 -- 383. Springer, 2004. 18. G. Navarro and V. Makinen. Compressed full-text indexes. ACM Computing Surveys, 39(1):Article No. 2, 2007. 19. L. M. S. Russo, G. Navarro, and A. L. Oliveira. Fully-compressed suffix trees. In Proc. LATIN, volume 4957 of LNCS, pages 362 -- 373. Springer, 2008. 20. K. Sadakane. New text indexing functionalities of the compressed suffix arrays. J. Algorithms, 48(2):294 -- 313, 2003. 21. K. Sadakane. Compressed suffix trees with full functionality. Theory of Computing Systems, 41(4):589 -- 607, 2007. 22. K. Sadakane and R. Grossi. Squeezing succinct data structures into entropy bounds. In Proc. SODA, pages 1230 -- 1239. ACM/SIAM, 2006. 6
1803.03839
1
1803
2018-03-10T17:08:51
Efficient Enumeration of Bipartite Subgraphs in Graphs
[ "cs.DS" ]
Subgraph enumeration problems ask to output all subgraphs of an input graph that belongs to the specified graph class or satisfy the given constraint. These problems have been widely studied in theoretical computer science. As far, many efficient enumeration algorithms for the fundamental substructures such as spanning trees, cycles, and paths, have been developed. This paper addresses the enumeration problem of bipartite subgraphs. Even though bipartite graphs are quite fundamental and have numerous applications in both theory and application, its enumeration algorithms have not been intensively studied, to the best of our knowledge. We propose the first non-trivial algorithms for enumerating all bipartite subgraphs in a given graph. As the main results, we develop two efficient algorithms: the one enumerates all bipartite induced subgraphs of a graph with degeneracy $k$ in $O(k)$ time per solution. The other enumerates all bipartite subgraphs in $O(1)$ time per solution.
cs.DS
cs
Efficient Enumeration of Bipartite Subgraphs in Graphs Kunihiro Wasa1 and Takeaki Uno1 National Institute of Informatics, Tokyo, Japan {wasa, uno}@nii.ac.jp Abstract. Subgraph enumeration problems ask to output all subgraphs of an input graph that belongs to the specified graph class or satisfy the given constraint. These problems have been widely studied in theoreti- cal computer science. As far, many efficient enumeration algorithms for the fundamental substructures such as spanning trees, cycles, and paths, have been developed. This paper addresses the enumeration problem of bipartite subgraphs. Even though bipartite graphs are quite fundamen- tal and have numerous applications in both theory and application, its enumeration algorithms have not been intensively studied, to the best of our knowledge. We propose the first non-trivial algorithms for enumer- ating all bipartite subgraphs in a given graph. As the main results, we develop two efficient algorithms: the one enumerates all bipartite induced subgraphs of a graph with degeneracy k in O (k) time per solution. The other enumerates all bipartite subgraphs in O (1) time per solution. Keywords: Graph algorithms, subgraph enumeration, bipartite graphs, constant delay, binary partition method, degeneracy 1 Introduction A subgraph enumeration problem is, for given a graph G and a constraint R, to output all subgraphs of G that satisfy R once for each and without duplication. An example is to enumerate all the trees in the given graph, and all the subgraphs whose minimum degree is at least k. The complexity and polynomiality of the subgraph enumeration have been intensively studied in theoretical computer science in the terms of both output size sensitivity and input size sensitivity. Compared to optimization approach, enumeration has an advantage on exploring and investigating all possibilities and all aspects of the data, thus is widely studied in a practical point of view, e.g. Bioinformatics [1], machine learning [18], and data mining [22,26]. We say that an enumeration algorithm is efficient if the algorithm is output sensitive [11]. Especially, we say that A runs in polynomial amortized time, if the total running time of an enumeration algorithm A is O (N · poly(n)) time, where N is the number of solutions, n is the size of input, and poly is a polynomial function. That is, A enumerates all solutions in poly(n) time per solution. Such algorithms have been considered to be efficient, and one of our research goals is to develop efficient enumeration algorithms. As far, 8 1 0 2 r a M 0 1 ] S D . s c [ 1 v 9 3 8 3 0 . 3 0 8 1 : v i X r a there have been studied enumeration algorithms for many fundamental graph structures such as spanning trees [17,19], st-paths [7,17], cycles [2,8,17], maximal cliques [3,6,15], minimal dominating sets [12], and so on. See the comprehensive list in [23] of this area. Recently, Uno [21] developed a technique for a fine-grained analysis of enumeration algorithms. Bipartite graph is a well-known fundamental graph structure. A bipartite graph is a graph containing no cycle of odd length, that is, whose vertex set can be partitioned into two disjoint independent sets. Bipartite graphs widely appears in real-world graphs such as itemset mining [22, 26], chemical infor- mation [13], Bioinformatics [27], and so on. Further, enumeration problems for matchings [9, 10, 20] and bicqliue [4, 15] in bipartite graphs are well studied. However, to the best of our knowledge, there has been proposed no non-trivial enumeration algorithm for bipartite subgraphs. In this paper, we propose efficient enumeration algorithms for bipartite in- duced subgraphs and bipartite subgraphs. For enumerating both substructures, we employ a simple binary partition method, and develop a data structure for efficiently updating the candidates that are called child generators. Intuitively speaking, child generators are vertices or edges such that adding them to a cur- rent solution generates another solution. For bipartite induced subgraph, we look at the degeneracy [14] of a graph. The degeneracy of a graph is the upper bound of the minimum degree of any its subgraph, so the graph is sparse when the degeneracy is small. It is a widely considered as a sparsity measure [3, 5, 24, 25]. There are several graph classes have constant degeneracies, e.g., forests, grid graphs, planar graphs, bounded treewidth graphs, H-minor free graphs with some fixed H, and so on [14]. In addition, Real-world graphs such as road net- works, social networks, and internet networks are said to often have small degen- eracies, or do so after removing a small part of vertices. Our algorithm utilizes a good ordering on the vertices called a degeneracy ordering [16], that achieves O (k) amortized time per solution, where k is the degeneracy of an input graph. This implies that when we restrict the class of input graphs, such as planar graphs, the algorithm runs in constant time per solution and is optimal in the sense of time complexity. Next, for developing an algorithm for bipartite induced subgraph, we show that we can avoid redundant edge additions and removal to obtain a solution from another solution. As a main result, we give an optimal enumeration algorithm, that is, the algorithm runs in constant time per solution. These algorithms are quite simple, but by giving non trivial analysis, we show the algorithms are efficient. These are the first non-trivial efficient enumeration algorithms for bipartite subgraphs. 2 Preliminaries Let G = (V, E) be an undirected graph with vertex set V = {1, . . . , n} and edge set E = {(e1, . . . , em} ⊆ V × V . An edge is denoted by e = (u, v). We say that u and v are endpoints of e = (u, v), and u is adjacent to v if (u, v) ∈ E. When the graph is undirected, (u, v) = (v, u). Two edges are said to be adjacent to each other if a vertex is an end point of both edges. The set of neighbors of v is the set of vertices that are adjacent to v and is denoted by N (v). For any vertex subset S of V , E[S] = E ∩ (S × S), that is, E[S] is the set of edges whose both endpoints are in S. For any edge subset F of E, V [F ] = {v ∈ V ∃e ∈ F (v ∈ e)}, that is, V [F ] is the collection of endpoints of edges in F . The induced graph of G by S is(S, E[S]) and is denoted by G[S]. G[F ] = (V [F ], F ) is a subgraph of G by F . We denote by G \ S = G[V \ S]. Since G[S] (resp. G[F ]) is uniquely determined by S (resp. F ), we identify S with G[S] (resp. F with G[F ]) if no confusion arises. We say that a sequence π = (v = w1, . . . , w(cid:96) = u) of vertices in V is a path of G between v and u if for each i = 1, . . . , (cid:96) − 1, (wi, wi+1) ∈ E, and each vertex in π appears exactly once. We denote by the length of a path the number of edges in the path. π is a cycle if v = u and the length of π is at least three. The distance dist (u, v) between u and v is the We say G is connected if there is a path between any pair of vertices in G. G is bipartite if G has no cycle with odd length. For a vertex subset S ⊆ V (resp. an edge subset F ⊆ E) such that G[S] (resp. G[F ]) is bipartite, we say S (resp. F ) a bipartite vertex set (resp. a bipartite edge set). For any bipartite vertex set S, if G[S] is connected, we say S a connected bipartite vertex set. We also say a bipartite edge set F is a connected bipartite edge set if G[F ] is connected. Let BV (G) and BE (G) be the collection of connected bipartite vertex sets and connected bipartite edge sets, respectively. We call BV (G) (resp. BE (G)) the solution space for Problem 1 (resp. for Problem 2). Since we only focus on connected ones, we simply call a connected bipartite vertex (resp. edge) set a bipartite vertex (resp. edge) set. In what follows, we assume that G is connected and simple. We now define the enumeration problems of this paper as follows: Problem 1 (Bipartite induced subgraph enumeration). For given a graph G, out- put all vertex sets in BV (G) without duplication. Problem 2 (Bipartite subgraph enumeration). For given a graph G, output all subgraphs in BE (G) without duplication. 3 Enumeration of Bipartite Induced Subgraphs In this paper, we propose two enumeration algorithms for Problem 1 and Prob- lem 2, and this section describes the algorithm for Problem 1. The pseudocode of the algorithm is described in Algorithm 1. We employ binary partition method for constructing the algorithms. The algorithm outputs the minimal solution to be output, and partition the set of remaining solutions to be output into two or more disjoint subsets. Then, the algorithm recursively solve the problems for each subset, by generating recursive calls. We call this dividing step excluding recursive calls (Line 11 in Algorithm 1) an iteration. For any pair X and Y of iterations, X is the parent of Y if Y is called from X and Y is a child of X if X is the parent of Y . Algorithm 1: Enumeration algorithm based on binary method 1 Procedure Main(G = (V, E)) 2 foreach v ∈ V do Rec(G,{v} , N (v)); G ← G \ {v}; 4 5 Subprocedure Rec(G, S, C (S, G)) 6 output(S); while C (S, G) (cid:54)= ∅ do 3 7 8 9 10 11 u ← the smallest child generator in C (S, G); C (S, G) ← C (S, G) \ {u}; S(cid:48) ← S ∪ {u}; Rec(G, S(cid:48), ComputeChildGen(C (S, G) , u, G)); G ← G \ {u}; 12 13 Subprocedure ComputeChildGen(C (S, G) , u, G) 14 C (S ∪ {u} , G) ← C (S, G) \ (CL (S, G) ∩ N (u)); C (S ∪ {u} , G) ← C (S, G) \ (CR (S, G) ∩ N (u)); if u ∈ CL (S, G) then else if u ∈ CR (S, G) then C (S ∪ {u} , G) ← C (S ∪ {u} , G) ∪ Γ (S, u, G); return C (S ∪ {v} , G); 15 16 17 18 19 Fig. 1. Example of the partitioning the solution space. Algorithm 1 recursively parti- tions the solution space BV (G, S) into smaller disjoint solution spaces, according to C (S, G) = {u1, . . . , u(cid:96)}. For any bipartite vertex set S, we say that S(cid:48) is a child of S if there exists a vertex u such that S(cid:48) = S ∪ {u}. A vertex v /∈ S is a child generator of S for G if S ∪ {v} is a bipartite vertex set in G. That is, the proposed algorithm enumerates all bipartite vertex sets by recursively adding a child generator to a current bipartite vertex set S. We denote by C (S, G) the set of child gen- erators of S in G. Suppose that r be the smallest vertex in S. Let L (S) = {u ∈ S dist (u, r) mod 2 = 0} and R (S) = {u ∈ S dist (u, r) mod 2 = 1}. For any vertex v in G, any descendant iteration of Rec(G,{v} , N (v)) does not output a bipartite vertex set including vertices less than v. Hence, no vertex will never move to the other side in any descendant bipartite vertex set. Let CL (S, G) = {u ∈ C (S, G) u ∈ L (S ∪ {u})} and CR (S, G) = {u ∈ C (S, G) u ∈ R (S ∪ {u})}. Note that C (S, G) = CL (S, G) (cid:116) CR (S, G), where A (cid:116) B is the disjoint union of bipartite vertex sets which include S. Note that BV (G) = BV (G,∅). From of A and B. We denote by BV (G, S) = (cid:8)S(cid:48) ∈ BV (G)(cid:12)(cid:12) S ⊆ S(cid:48)(cid:9) the collection now on, we fix a graph G and a bipartite vertex set S of G. By the following lemma, the algorithm divides BV (G, S) according to C (S, G) (Fig. 1). For an edge u ∈ C (S, G), we define G(S,≥ u) by G \ {v ∈ C (S, G) v < u}. Lemma 1. BV (G(S,≥ u), S ∪ {u})∩BV (G(S,≥ v), S ∪ {v}) = ∅ for any u (cid:54)= v of C (S, G). Proof. Without loss of generality, we can assume that u < v. Suppose that S(cid:48) is a bipartite vertex set in BV (G(S,≥ u), S ∪ {u})∩BV (G(S,≥ v), S ∪ {v}). This implies that S(cid:48) includes both u and v. However, G(S,≥ v) does not contain u. Thus, S(cid:48) /∈ BV (G(S,≥ v), S ∪ {v}), and this contradicts the assumption. Hence, (cid:117)(cid:116) the statement holds. u∈C (S,G) BV (G(S,≥ u), S ∪ {u}). Lemma 2. BV (G, S) = {S} ∪(cid:70)(cid:96) Proof. If S(cid:48) ∈ {S} ∪(cid:70)(cid:96) u∈C (S,G) BV (G(S,≥ u), S ∪ {u}), then S(cid:48) is obviously in BV (G, S). We assume that S(cid:48) ∈ BV (G, S) and S(cid:48) (cid:41) S. This implies that S(cid:48) includes one of child generators in C (S, G). Let v be the smallest child generator in C (S, G) such that v belongs to S(cid:48). Hence, S(cid:48) ⊆ V (G(S,≥ v)). Therefore, S(cid:48) ∈ BV (G(S,≥ v), S) and the statement holds. (cid:117)(cid:116) Next, we consider the correctness of ComputeChildGen. For brevity, we in- troduce some notations: Let u be a child generator in C (S, G). Γ (S, u, G) = {w ∈ N (u) w /∈ N [S]} is the set of vertices that are adjacent to only u in S∪{u}. Note that C (S, G)∩Γ (S, u, G) = ∅. ∆(S, G, u) = CL (S, G)∩N [u] if u ∈ CL (S, G); ∆(S, G, u) = CR (S, G)∩N [u] if u ∈ CR (S, G). Intuitively, Γ (S, u, G) and ∆(S, G, u) are the set of vertices that are added to and removed from C (S, G) to compute C (S ∪ {u} , G(G,≥ u)), respectively. The following lemma shows the sufficient and necessary conditions for computing C (S ∪ {u} , G(G,≥ u)). Lemma 3. C (S ∪ {u} , G(S,≥ u)) = ((C (S, G) \ ∆(S, G, u)) (cid:116) Γ (S, u, G))\{v ∈ C (S, G) v < u} . Proof. We let C∗ = ((C (S, G) \ ∆(S, G, u)) (cid:116) Γ (S, u, G))\{v ∈ C (S, G) v < u}. Suppose that x ∈ C (S ∪ {u} , G(S,≥ u)). Without loss of generality, we can as- sume that u ∈ CL (S, G). From the definition of G(S,≥ u), x /∈ {v ∈ C (S, G) v < u}. If x /∈ N [S], then since x can be added to S ∪ {u}, x is adjacent to only one vertex u in S ∪ {u}. Hence, x ∈ Γ (S, u, G). If x ∈ N [S], then since x ∈ C (S ∪ {u} , G(S,≥ u)), x ∈ C (S, G). Moreover, if x is in CL (S, G) ∩ N (u), then S ∪ {u, x} has an odd cycle. Hence, the statement holds. Suppose that x ∈ C∗. Without loss of generality, we can assume that u ∈ CL (S, G). Since x ∈ C (S, G)(cid:116)Γ (S, u, G), S(cid:48) = S∪{u, x} is connected. Suppose that S(cid:48) has an odd cycle Co. Since S ∪ {u} is bipartite, Co must contain x. This implies that x has neighbors both in L (S(cid:48)) and R (S(cid:48)). If x ∈ Γ (S, u, G), then x has exactly one neighbor in S(cid:48) since u ∈ L (S ∪ {u}). Hence, x ∈ C (S, G). This implies that either (I) N (x) ∩ (S ∪ {x}) ⊆ L (S) or (II) N (x) ∩ (S ∪ {x}) ⊆ R (S). If (I) holds, then x has neighbors only in L (S ∪ {u}) on S(cid:48) since u ∈ CL (S, G) and x ∈ CR (S, G). If (II) holds, then then x has neighbors only in R (S ∪ {u}) on S(cid:48) since x /∈ N (u). Both cases contradict that x in Co. Hence, x ∈ C (S ∪ {u} , G(S,≥ u)) and the statement holds. (cid:117)(cid:116) Fig. 2. An example of a degeneracy ordering of G. The degeneracy of G is two even though there is a vertex with degree six. The right-hand side shows a degenerate ordering of G. In the figure, if a vertex u is larger than a vertex v, then u is placed at the right v. Each vertex has at most two larger neighbors. From the above discussion, we can show the correctness of our algorithm. Lemma 4. Algorithm 1 correctly enumerates all bipartite vertex sets in G. Proof. From Line 7 to 12, the algorithm divides the solution space according to C (S, G) as shown in Lemma 2. In addition, from Lemma 3, ComputeChildGen correctly computes the sets of child generators of S(cid:48) where S(cid:48) is a child of S. (cid:117)(cid:116) Hence, the statement holds. 3.1 Update of child generators In this section, we consider the time complexity for the maintenance of the sets of child generators. If we naıvely use Lemma 3 for ComputeChildGen, we can not achieve O (k) amortized time per solution. To overcome this, we use a degeneracy ordering on vertices. G is a k-degenerate graph [14] if for any induced graph S of G, S has a vertex whose degree is at most k (Fig. 2). The degeneracy of G is the smallest k such that G is k-degenerate. Every k-degenerate graph G has a degeneracy ordering on V . The definition of a degeneracy ordering is that for any vertex v in G, the number of neighbors of v that are larger than v is at most k. By recursively removing a vertex with the minimum degree, we can obtain this ordering in linear time [16]. Note that there are many degeneracy orderings for a graph. In what follows, we pick one of degeneracy orderings of G and then fix it as the vertex ordering of G. For any two vertices u, v in G, we write u < v if u is smaller than v in the ordering. We can easily see that if u is the smallest child generator, then u has at most k neighbors in G[C (S, G)] since G[C (S, G)] is k-degenerate. Therefore, Lemma 3 implies that we can compute the child generators of S ∪ {u} by removing at most k vertices and adding some vertices that generate some grandchildren of S. Next, we define the three types of neighbors of a vertex v in S, larger neigh- bors, visited smaller neighbors, and unvisited smaller neighbors: For any vertex u ∈ N (v), (1) u is a larger neighbor of v if v < u, (2) u is a visited smaller neighbor of v if u ∈ N [S] and u < v, and (3) u is an unvisited smaller neigh- bor otherwise (Fig. 3). Intuitively, u is a visited smaller neighbor if one of its neighbor is already picked in some ancestor iteration of X which receives S. We (cid:18)(cid:19)(cid:20)(cid:21)(cid:22)(cid:23)(cid:24)(cid:25)(cid:26)(cid:18)(cid:17)(cid:18)(cid:19)(cid:20)(cid:21)(cid:22)(cid:23)(cid:24)(cid:25)(cid:26)(cid:18)(cid:17) Fig. 3. Three types of neighbors of v. Here, VSN (v, S) = {u1, u2, u3}, USN (v, S) = {u4, u5}, and LN (v, S) = {u6, . . . , u9}. All of vertices in VSN (v, S) are adjacent to some vertices in S. Thus, for any S ⊆ S(cid:48), if ui is in VSN (v, S), then ui is also in VSN (v, S(cid:48)). In addition, Algorithm 1 also stores VSNC (v, S) and VSNC (v, S). denote by LN (v, S), VSN (v, S), and USN (v, S) the sets of larger neighbors, visited smaller neighbors, and unvisited smaller neighbors of v, respectively. In addition, the algorithm divides VSN (v, S) into two disjoint parts VSNC (v, S) and VSNC (v, S); VSNC (v, S) ⊆ C (S, G) and VSNC (v, S) ∩ C (S, G) = ∅. We omit S if no confusion arises. We now consider the data structure for the algorithm. For each vertex v, the algorithm stores LN (v), VSNC (v), VSNC (v), and USN (v) in doubly linked lists. C (S, G) is also stored in a doubly linked list and sorted by the degeneracy ordering. The algorithm needs O (m) = O (kn) space for storing these data struc- tures. The algorithm also records the modification when an iteration X calls a child iteration Y . Let SX (resp. SY ) be bipartite vertex sets received by X (resp. Y ). Note that for each neighbor w of a vertex v, if w moves from USN (v, SX ) to VSN (v, SY ), then w will never moves from the list in any descendant of Y . Moreover, when w moves to VSN (v, SY ), w becomes a child generator of Y , and thus, w ∈ VSNC (v, SY ). Initially, for all smaller neighbors of v is in USN (v,∅). In addition, v will be never added to the set in any descendant of S if v is not a child generator of S. Hence, the algorithm totally needs O (m) space for storing the modification history. When the algorithm backtracks to X from Y , the algo- rithm can completely restore the data structure in the same complexity as the transition from X to Y . Now, we consider the time complexity for the transition from X to Y . Suppose that when we remove a vertex v from C (S, G) or add v to S, for each larger neighbor w of v, we give a flag which represents w is not a child generator of the child of S. This can be done in O (k) time per vertex because of the degeneracy. The next technical lemma shows the number of the larger neighbors which are checked for updating the set of child generators. Lemma 5. S has at most one larger neighbor of v for any vertex v in C (S, G). Proof. Suppose that two or more neighbors of v are in S. Let x and y be two of them such that y is added after x, and S(cid:48) ⊆ S be an ancestor bipartite vertex set of S for some graph G(cid:48) such that x ∈ S(cid:48) and y /∈ S(cid:48). Without loss of generality, we can assume that v and y are child generators of S(cid:48). We can also assume that v is added after y. Then, from Lemma 3, When y is added to S(cid:48), v is not in G(G(cid:48),≥ y) since v < y. This contradicts, and thus, the statement holds. (cid:117)(cid:116) Lemma 6. Let u and v be two vertices in C (S, G) such that u < v and (cid:64)w ∈ C (S, G) (u < w < v). C (S ∪ {v} , G(S,≥ v)) can be computed from C (S ∪ {u} , G(S,≥ u)) in O (k C (S ∪ {u} , G(S,≥ u)) + k C (S ∪ {v} , G(S,≥ v))) time. Proof. From Lemma 3, only the neighbors of v or u may be added to or removed from C (S ∪ {u} , G(S,≥ u)) to obtain C (S ∪ {v} , G(S,≥ v)). Let w be a vertex in LN (v). We consider the following cases: (L.1) w ∈ C (S ∪ {u} , G(S,≥ u)) ∩ C (S ∪ {v} , G(S,≥ v)) or w /∈ C (S ∪ {u} , G(S,≥ u)) ∪ C (S ∪ {v} , G(S,≥ v)). In this case, there is nothing to do. (L.2) w ∈ C (S ∪ {u} , G(S,≥ u))\C (S ∪ {v} , G(S,≥ v)). For each larger neighbor x of w, we need to move w from VSNC (x, S ∪ {u}) to VSNC (x, S ∪ {v}). The number such x is at most k C (S ∪ {u} , G(S,≥ u)). (L.3) w ∈ C (S ∪ {v} , G(S,≥ v))\C (S ∪ {u} , G(S,≥ u)). For each larger neigh- bor x of w, we need to move w from VSNC (x, S ∪ {u}) to VSNC (x, S ∪ {v}). The number of such x is at most k C (S ∪ {v} , G(S,≥ v)). Note that for each vertex, at most one larger its neighbor is in S from Lemma 5. Thus, the above three conditions can be checked in constant time for each w by checking whether or not w is in the same partition as v. Therefore, the larger part can be done in O (k + k C (S ∪ {u} , G(S,≥ u)) + k C (S ∪ {v} , G(S,≥ v))) time. Next, let w be a vertex in VSNC (v, S). From Lemma 3, such w does not belongs to C (S ∪ {v} , G(S,≥ v)). Moreover, since u and v are consecutive on C (S, G), such w is also not in C (S ∪ {u} , G(S,≥ u)). Thus, this case can be done in constant time by skipping such vertices. For each vertex w in VSNC (v, S), w can not be added to both S ∪ {u} and S ∪ {v}. Hence, we skip them. In addi- tion, we need to remove v from G(S,≥ u). This takes O (k) time since we only need to update larger neighbors of v. The same procedure needs for updating (cid:117)(cid:116) the neighbors of u. Hence, the statement holds. Roughly speaking, by ignoring neighbors of u or v such that they can not be added to both S ∪ {u} and S ∪ {v}, we can compute C (S ∪ {v} , G(S,≥ v)) from C (S ∪ {u} , G(S,≥ u)), efficiently. In addition, other neighbors have corre- sponding bipartite vertex sets with size S + 2, that is, grandchildren of S. This implies that we can amortize the cost for these neighbors as follows. Lemma 7. Let u be a vertex in C (S, G) and T (S, u) be the computation time for C (S ∪ {u} , G(S,≥ u)). The total computation time for all the sets of child gen- u∈C (S,G) k C (S ∪ {u} , G(S,≥ u))(cid:17) erators of S's children and recording the modification history is(cid:80) O(cid:16) k C (S, G) +(cid:80) for children of S except for S∪{u∗} in O(cid:16)(cid:80) time. u∈C (S,G) T (S, u) = Proof. From Lemma 3, we need O (k C (S, G) + k C (S ∪ {u∗} , G(S,≥ u∗))) time for computing C (S ∪ {u∗} , G(S,≥ u∗)), where u∗ is the smallest child gen- erator in C (S, G). From Lemma 6, we can compute all the sets of child generators u∈C (S,G) k C (S ∪ {u} , G(S,≥ u))(cid:17) time in total. Moreover, recording the modification history can be done in the (cid:117)(cid:116) same time complexity in above. Hence, the statement holds. solutions in O(cid:0)k(cid:12)(cid:12)BV (G)(cid:12)(cid:12)(cid:1) total time, that is, O (k) time per solution with Theorem 1. Given a graph G with degeneracy k, Algorithm 1 enumerates all O (m) = O (kn) space and preprocessing time. Proof. From Lemma 7, we can see the larger neighbors of u are always checked. Thus, Line 12 can be done in O (k) time since the algorithm does not need to re- move edges whose endpoints are u and a smaller neighbor of u. Moreover, Line 9 can be done in O (1) time. In addition, in the preprocessing, we need to initialize the data structure and compute the degeneracy ordering. The both need O (kn) time and space since the number of edges is at most kn. From Lemma 7 and the u∈C (S,G) T (S, u) above this discussion, the algorithm runs in O(cid:16)(cid:80) (cid:16)C (S, G) +(cid:80) time. Now, O(cid:16)(cid:80) O(cid:0)(cid:12)(cid:12)BV (G)(cid:12)(cid:12)(cid:1). Hence, the statement holds. u∈C (S,G) C (S ∪ {u} , G(S,≥ u))(cid:17)(cid:17) S∈BV (G) (cid:17) = (cid:117)(cid:116) (cid:80) S∈BV (G) Corollary 1. All bipartite induced subgraphs in graphs with constant degener- acy, such as planar graphs, can be listed in O (1) time per solution with O (n) space and preprocessing time. 4 Enumeration of Bipartite Subgraphs In this section, we describe our algorithm for Problem 2. For a graph G and a bipartite edge set F of G, let B(G, F ) be the set of edges e of G such that F ∪ {e} is not bipartite, i.e., F ∪ {e} has an odd cycle that includes e. BE (G(F ) \ B(G, F ), F ). For an edge e of G, we define N(cid:48) (G, e) = {f ∈ E \ {e} f is adjacent to e}, Let BE (G, F ) = (cid:8)F (cid:48) ∈ BE (G)(cid:12)(cid:12) F ⊆ F (cid:48)(cid:9). We can see that BE (G(F ), F ) = N(cid:48) (G, F ) =(cid:83) e∈F N(cid:48) (e)\F , and we also define G(F,≥ e) by G\{f ∈ N(cid:48) (G, F ) f < e}. The framework of the algorithm is the same as the algorithm for Problem 1. The algorithm starts from the empty edge set, and add edges recursively so that the edge sets generated are always connected and bipartite, and no duplication occurs. For given a graph G and a bipartite edge set F of G, the algorithm first removes edges of B(G, F ) from G, and outputs F as a solution. Then for each e ∈ N(cid:48) (G, F ), the algorithm generates the problems of enumerating all bipartite subgraphs that include F ∪ {e} but no edge f < e, f ∈ N(cid:48) (G, F ), that is, bipartite subgraphs in G(F,≥ e) that includes F ∪{e}. Before generating the recursive call, the algorithm computes the edges of B(G(F,≥ e), F ∪ {e}) and removes them from G(F,≥ e) so that the computation of the iteration will be accelerated. The correctness of our strategy for the enumeration is as follows. Lemma 8. BE (G(F,≥ e), F ∪ {e}) ∩ BE (G(F,≥ f ), F ∪ {f}) = ∅ for any e (cid:54)= f of N(cid:48) (G, F ). is a bipartite edge set in BE (G(F,≥ e), F ∪ {e}) ∩ Proof. Suppose that F (cid:48) BE (G(F,≥ f ), F ∪ {f}). This implies F (cid:48) includes ei and ej. However, Gj does not include ei, and thus this contradicts the assumption. Note that the addition of an edge of N(cid:48) (G, F ) never results non-bipartite since we removed all edges of (cid:117)(cid:116) B(G, F ) from G. Algorithm 2: Enumeration algorithm for bipartite edges sets 1 Procedure Main(G = (V, E)) 2 foreach e ∈ E do // Pick the smallest edge in E. 3 4 Rec(G,{e} , N (e)); G ← G \ {e}; 5 Subprocedure Rec(G, F, N(cid:48) (F, G)) 6 7 8 9 10 11 12 13 output(F ); while N(cid:48) (F, G) (cid:54)= ∅ do e ← the smallest child generator in N(cid:48) (F ) G; F (cid:48) ← F ∪ {e}; G(cid:48) ← G(F,≥ e) \ E(B(G(F,≥ e), F (cid:48))); N(cid:48) (G(cid:48), F (cid:48)) ← (N(cid:48) (G, F ) ∪ N+(G, F, e)) \ (N−(G, F, e) ∪ {f ∈ E f ≤ e}); Rec(G(cid:48), F (cid:48), N(cid:48) (G(cid:48), F (cid:48))); N(cid:48) (F, G) ← N(cid:48) (F, G) \ {e}; Lemma 9. BE (G, F ) = {F} ∪(cid:70) e∈N(cid:48)(G,F ) BE (G(F,≥ e), F ∪ {e}), Proof. Let F (cid:48), F ⊂ F (cid:48) be a bipartite edge set in BE (G, F ), and e be the smallest edge among F (cid:48) ∩ N(cid:48) (G, F ). e always exists since F (cid:48) is connected. We can see that F (cid:48) ∈ BE (G(F,≥ e), F ∪ {e}), thus the statement holds. (cid:117)(cid:116) For the efficient computation, our algorithm always keep N(cid:48) (G, F ) in the memory and update and pass it to the recursive calls. For the efficient update of N(cid:48) (G, F ), we keep the graph G \ F in the memory since edges of F never be added to N(cid:48) (G, F ), until the completion of the iteration. We also put a label of "1" or "2" to each vertex in V (F ) and update so that each edge of F connects vertices of different labels, that is always possible since F is bipartite. For a vertex v of G that is not in V (F ), let N1(G, F, v) (resp., N2(G, F, v)) be the set of edges f of N (v) \ F such that the endpoint of f other than v has label "1" (resp., "2"). We also keep and update N1(G, F, v) and N2(G, F, v). For an edge (u, v) ∈ N(cid:48) (G, F ) such that u /∈ V (F ), we define N+(G, F, (u, v)) by N1(G, F, v) and N−(G, F, (u, v)) by N2(G, F, v) if the label of v is "1", and N+(G, F, (u, v)) by N2(G, F, v) and N−(G, F, (u, v)) by N1(G, F, v) otherwise. We define N1(G, F, (u, v)) and N2(G, F, (u, v)) by the empty set if both u and v are in V (F ) For an edge e ∈ N(cid:48) (G, F ), let F (cid:48) = F ∪ {e} and G(cid:48) be the graph obtained from G(F,≥ e) by removing edges of B(G(F,≥ e), F (cid:48)). Lemma 10. Suppose that B(G, F ) = ∅ and e = (u, v). Then, B(G(cid:48), F (cid:48)) = N−(G, F, v). Proof. Since B(G, F ) = ∅, any edge f in B(G(cid:48), F (cid:48)) must share one of its endpoint with e, and the endpoint is adjacent to no edge of F . Further, the edge is not included in F . The addition of f to F generates an odd cycles if and only if the (cid:117)(cid:116) label of both endpoints of f are the same. Therefore the statement holds. The following lemma shows that the computation of N(cid:48) (G(cid:48), F (cid:48)) from N(cid:48) (G, F ) can be also done in O (N+(G, F, e) + 1) time. Lemma 11. N(cid:48) (G(cid:48), F (cid:48)) = (N(cid:48) (G, F ) ∪ N+(G, F, e))\(N−(G, F, e) ∪ {f ∈ E f ≤ e}) . Proof. We first prove N(cid:48) (G(cid:48), F (cid:48)) ⊆ (N(cid:48) (G, F ) ∪ N+(G, F, e))\(N−(G, F, e) ∪ {f ∈ E f ≤ e}). Let f be an edge in N(cid:48) (G(cid:48), F (cid:48)). Then, f is in either N(cid:48) (G, F ) or N+(G, F, e). From the definition of G(F,≥ e) and B(G(cid:48), F (cid:48)), f is not in B(G(cid:48), F (cid:48)). Fur- ther, f > e from f ∈ G(cid:48). This implies that f ∈ (N(cid:48) (G, F ) ∪ N+(G, F, e)) \ (N−(G, F, e) ∪ {f ∈ E f ≤ e}). We next prove (N(cid:48) (G, F ) ∪ N+(G, F, e))\ (N−(G, F, e) ∪ {f ∈ E f ≤ e}) ⊇ N(cid:48) (G(cid:48), F (cid:48)) . Suppose that f ∈ (N(cid:48) (G, F ) ∪ N+(G, F, e))\(N−(G, F, e) ∪ {f ∈ E f ≤ e}). Then, f is not in F (cid:48), and adjacent to an edge of F (cid:48). Further, f > e and the ad- dition of f to F (cid:48) generates no odd cycle. Thus, f ∈ N(cid:48) (G(cid:48), F (cid:48)). (cid:117)(cid:116) When we generate G(F,≥ e) for each e ∈ N(cid:48) (G, F ) one by one in increasing order, the total computation time is O (N(cid:48) (G, F )). Computation of G(cid:48)\F (cid:48) is at most the time to compute G(cid:48). From this together with these lemmas, we can see that an iteration of the algorithm spends O(cid:16)N(cid:48) (G, F ) +(cid:80) e∈N(cid:48)(G,F ) N+(G, F, e)(cid:17) time. The following lemma bound this complexity in another way. Let Ge is the graph obtained from G(F ∪ {e} ,≥ e) by removing edges of B(G(F ∪ {e} ,≥ e), F ∪ {e}). Lemma 12. Suppose that e(cid:48) is next to e in the edge ordering in N(cid:48) (G, F ). The computation of N(cid:48) (Ge(cid:48), F ∪ {e(cid:48)}) from N(cid:48) (Ge, F ∪ {e}) can be done in O (N(cid:48) (Ge(cid:48), F ∪ {e(cid:48)}) + N(cid:48) (Ge, F ∪ {e})) time. Proof. The computation is to recover N(cid:48) (G, F )\{f ∈ E f ≤ e} from N(cid:48) (Ge, F ∪ {e}) and construct N(cid:48) (Ge(cid:48), F ∪ {e(cid:48)}) from it. From Lemma 11, its time is linear in N+(G, F, e) \ {f ∈ E f ≤ e}+N−(G, F, e) \ {f ∈ E f ≤ e}+N+(G, F, e(cid:48)) \ {f ∈ E f ≤ e}+ N−(G, F, e(cid:48)) \ {f ∈ E f ≤ e}. We see that N+(G, F, e) \ {f ∈ E f ≤ e} ⊆ N(cid:48) (Ge, F ∪ {e}), and N+(G, F, e(cid:48))\{f ∈ E f ≤ e(cid:48)} ⊆ N(cid:48) (Ge(cid:48), F ∪ {e(cid:48)}). When N−(G, F, e) (cid:54)= N−(G, F, e(cid:48)), we have N−(G, F, e)∩N−(G, F, e(cid:48)) = ∅, thus N−(G, F, e)\ {f ∈ E f ≤ e} ⊆ N(cid:48) (Ge(cid:48), F ∪ {e(cid:48)}), and N−(G, F, e(cid:48))\{f ∈ E f ≤ e(cid:48)} ⊆ N(cid:48) (Ge, F ∪ {e}) thus the statement holds. When N−(G, F, e) = N−(G, F, e(cid:48)), they are canceled out and no need of taking care in the computation, thus the statement also holds. (cid:117)(cid:116) Lemma 13. For any iteration inputting G and F such that B(G, F ) = ∅, its computation time is at most proportional to one plus the number of its children and the grandchildren. Proof. For the first recursive call with respect to an edge e, we pay computation time of O (N(cid:48) (G, F ) + N(cid:48) (Ge, F ∪ {e})). For the remaining recursive calls, as we see in Lemma 12, the computation time is linear in the number of grandchil- dren generated in the recursive call, and that generated just before. Thus, the (cid:117)(cid:116) statement holds. Sine any iteration requires at most O (V + E) space. When the iteration generates a recursive call, the graphs and variants that the iteration is using has to be recovered, just after the termination of the recursive call. This can be done just keeping the vertices and edges that are removed to make the input graph of the recursive call. Thus, the total accumulated space spent by all its ancestors is at most O (V + E). Therefore, we obtain the following theorem. O(cid:0)(cid:12)(cid:12)BE (G)(cid:12)(cid:12)(cid:1) total time, that is, O (1) time per solution with O (V + E) space. Theorem 2. All bipartite subgraphs in a graph G = (V, E) can be listed in References 1. N. K. Ahmed, J. Neville, R. A. Rossi, and N. Duffield. Efficient graphlet counting for large networks. In ICDM 2015, pages 1–10, 2015. 2. E. Birmel´e, R. Ferreira, R. Grossi, A. Marino, N. Pisanti, R. Rizzi, and G. Saco- moto. Optimal Listing of Cycles and st-Paths in Undirected Graphs. In SODA 2012, pages 1884–1896, 2012. 3. A. Conte, R. Grossi, A. Marino, and L. Versari. Sublinear-Space Bounded-Delay Enumeration for Massive Network Analytics: Maximal Cliques. In ICALP 2016, volume 55 of LIPIcs, pages 148:1–148:15, 2016. 4. V. M. Dias, C. M. de Figueiredo, and J. L. Szwarcfiter. Generating bicliques of a graph in lexicographic order. Theor. Comput. Sci., 337(1-3):240–248, 2005. 5. D. Eppstein, M. Loffler, and D. Strash. Listing all maximal cliques in sparse graphs in near-optimal time. In ISAAC 2010, volume 6506 of LNCS, pages 403–414, 2010. 6. D. Eppstein and D. Strash. Listing All Maximal Cliques in Large Sparse Real-world Graphs. In SEA 2011, LNCS 6630, pages 364–375, 2011. 7. R. Ferreira, R. Grossi, and R. Rizzi. Output-sensitive listing of bounded-size trees in undirected graphs. In ESA 2011, volume 6942 of LNCS, pages 275–286, 2011. 8. R. Ferreira, R. Grossi, R. Rizzi, G. Sacomoto, and S. Marie-France. Amortized O(v)-delay algorithm for listing chordless cycles in undirected graphs. In ESA 2014, volume 8737 of LNCS, pages 418–429, 2014. 9. K. Fukuda and T. Matsui. Finding all the perfect matchings in bipartite graphs. Appl. Math. Lett., 7(1):15–18, jan 1994. 10. A. G´ely, L. Nourine, and B. Sadi. Enumeration aspects of maximal cliques and bicliques. Discrete Appl. Math., 157(7):1447–1459, apr 2009. 11. D. S. Johnson, M. Yannakakis, and C. H. Papadimitriou. On generating all maxi- mal independent sets. Inform. Process. Lett., 27(3):119–123, 1988. 12. M. Kant´e, V. Limouzy, A. Mary, and L. Nourine. Enumeration of Minimal Domi- nating Sets and Variants. In FCT 2011, LNCS 6914, pages 298–309, 2011. 13. S. Koichi, M. Arisaka, H. Koshino, A. Aoki, S. Iwata, T. Uno, and H. Satoh. Chem- ical structure elucidation from 13c nmr chemical shifts: Efficient data processing using bipartite matching and maximal clique algorithms. J. Chem. Inf. Model., 54(4):1027–1035, 2014. 14. D. R. Lick and A. T. White. k-degenerate graphs. Canadian J. Math., 22(5):1082– 1096, 1970. 15. K. Makino and T. Uno. New algorithms for enumerating all maximal cliques. In SWAT 2004, volume 3111 of LNCS, pages 260–272, 2004. 16. D. W. Matula and L. L. Beck. Smallest-last ordering and clustering and graph coloring algorithms. J. ACM, 30(3):417–427, 1983. 17. R. C. Read and R. E. Tarjan. Bounds on backtrack algorithms for listing cycles, paths, and spanning trees. Networks, 5(3):237–252, 1975. 18. S. Ruggieri. Enumerating distinct decision trees. In ICML 2017, volume 70 of Proceedings of Machine Learning Research, pages 2960–2968, 2017. 19. A. Shioura, A. Tamura, and T. Uno. An Optimal Algorithm for Scanning All Spanning Trees of Undirected Graphs. SIAM J. Comput., 26(3):678–692, 1997. 20. T. Uno. Algorithms for enumerating all perfect, maximum and maximal matchings in bipartite graphs. In ISAAC 1997, volume 1350 of LNCS, pages 92–101, 1997. 21. T. Uno. Constant time enumeration by amortization. In WADS 2015, volume 9214 of LNCS, pages 593–605, 2015. 22. T. Uno, M. Kiyomi, and H. Arimura. LCM ver. 2: Efficient mining algorithms for frequent/closed/maximal itemsets. In FIMI '04, 2004. 23. K. Wasa. Enumeration of enumeration algorithms. CoRR, abs/1605.05102, 2016. 24. K. Wasa, H. Arimura, and T. Uno. Efficient Enumeration of Induced Subtrees in a K-Degenerate Graph. In ISAAC 2014, volume 6506 of LNCS, pages 94–102, 2014. 25. Y. Xu, J. Cheng, and A. W.-C. Fu. Distributed Maximal Clique Computation and Management. IEEE T. Serv. Comput., 9(1):1–1, 2015. 26. M. J. Zaki. Scalable algorithms for association mining. IEEE T. Knowl. Data. En., 12(3):372–390, 2000. 27. Y. Zhang, C. A. Phillips, G. L. Rogers, E. J. Baker, E. J. Chesler, and M. A. Langston. On finding bicliques in bipartite graphs: a novel algorithm and its application to the integration of diverse biological data types. BMC Bioinformatics, 15(1):110, 2014.
1802.05662
1
1802
2018-02-15T16:57:36
List Heaps
[ "cs.DS" ]
This paper presents a simple extension of the binary heap, the List Heap. We use List Heaps to demonstrate the idea of adaptive heaps: heaps whose performance is a function of both the size of the problem instance and the disorder of the problem instance. We focus on the presortedness of the input sequence as a measure of disorder for the problem instance. A number of practical applications that rely on heaps deal with input that is not random. Even random input contains presorted subsequences. Devising heaps that exploit this structure may provide a means for improving practical performance. We present some basic empirical tests to support this claim. Additionally, adaptive heaps may provide an interesting direction for theoretical investigation.
cs.DS
cs
List Heaps Andrew Frohmader∗ February 2018 Abstract This paper presents a simple extension of the binary heap, the List Heap. We use List Heaps to demonstrate the idea of adaptive heaps: heaps whose performance is a function of both the size of the problem instance and the disorder of the problem instance. We focus on the pre- sortedness of the input sequence as a measure of disorder for the problem instance. A number of practical applications that rely on heaps deal with input that is not random. Even random input contains presorted subse- quences. Devising heaps that exploit this structure may provide a means for improving practical performance. We present some basic empirical tests to support this claim. Additionally, adaptive heaps may provide an interesting direction for theoretical investigation. 1 Introduction A heap is a data structure which holds a finite set of items. Each item is associated with a key drawn from a totally ordered set. Heaps support the following operations: make heap (h): insert (h, x, k): find min (h): delete min (h): decrease key (h, x, k): delete (h, x): meld (h1, h2): Create and return a new, empty heap h Insert item x with key k into heap h and return a reference to where x is stored in h Return a reference to where the item with the minimum key is stored in heap h Delete the item with the minimum key from heap h and return it Decrease the key of item x in heap h to k Delete item x from heap h Return a heap formed by taking the union of heaps h1 and h2 The binary heap was introduced by Williams in 1964 [14]. Its simplicity and speed have made it and its generalization, the d-array heap, a popular choice in ∗[email protected] 1 practice. It supports insert, delete min, and decrease key in O(log n) time. It can be used to sort n items in O(n log n), which matches the worst-case lower bound for a comparison sort. Vuillemin's introduction of the binomial queue in 1978 [13], added meld to the list of operations supported in O(log n). In 1984, Fibonacci heaps [8], an extension of the binomial queue, achieved O(1) amortized time for insert, decrease key, and meld. The decrease key result was particularly important in that it improved the worst-case bounds for a number of well-known graph algorithms. More recently, a few structures have achieved worst-case O(1) time for decrease key and meld, see [2] or [4]. While this work has produced interesting and important theoretical results, it has failed to yield a structure that consistently outperforms the original binary heap and its variants in practice [9]. In this paper, we return to the binary heap and develop a simple extension, the List Heap. This straightforward extension can be given adaptive operations: operations whose performance depends not only on the problem size, but also on the level of presortedness (disorder) in the problem instance. A bit of work has gone into developing the theory of adaptive sorting algorithms, see [7], but to our knowledge, this work has not migrated into the related work on heap data structures, [3]. We believe that adaptive heaps may provide an interesting angle for theoretical investigation. Additionally, they may provide a means of improving the empirical performance of current heap variants. The List Heap is a first step in this direction. List Heaps support decrease key, insert, and delete min in O(log k), where k is the number of lists in the List Heap. As we will show, the number of lists in a List Heap is a function of both the size of the problem instance and the disorder of the problem instance. We returned to the binary heap because of its simplicity and ubiquity, but this was not without costs. List Heaps lose the O(1) insert, decrease key, and meld of more sophisticated structures. 1.1 Preliminaries Here we present notational conventions and definitions used through the re- mainder of this paper. Let X = hx1, ..., xni be a sequence of n distinct elements xi from some totally ordered set. If x1 < x2 < ... < xn, X is monotonically in- creasing or just increasing. If x1 > x2 > ... > xn, X is monotonically decreasing or just decreasing. A sequence is monotonic if it is either increasing or decreas- ing. The head of a sequence X is x1, the tail is xn. If A is a set, then A is its cardinality. If X is a sequence, then X is its length. For two sequences X = hx1, ..., xni and Y = hy1, ..., ymi, their concatenation XY is the sequence hx1, ..., xn, y1, ..., ymi. If the sequence X contains no elements, we write X = ∅. A sequence obtained by deleting zero or more elements from X is called a subsequence of X. A subsequence Y = hxi, ..., xji of X is consecutive if the indices i, ..., j are consecutive integers. Let Y = hxi, ..., xji and Z = hxk, ..., xli be subsequences of X. The inter- section of Y and Z, Y ∩ Z, is the subsequence of X obtained by deleting from X all xh not in both Y and Z for 1 ≤ h ≤ n. Similarly, the union of Y and Z, 2 Y ∪ Z, is the subsequence of X obtained by deleting from X all xh not in either Y or Z for 1 ≤ h ≤ n. Y and Z are disjoint if Y ∩ Z = ∅. Let P = {X1, ..., Xk} be a set of disjoint subsequences of X, if the union of all subsequences in P equals X, then P is a partition of X. 1.2 Adaptive Sorting This section gives a very brief review of adaptive sorting. Heaps solve a gen- eralized sorting problem, so adaptive sorting provides some intuition for why adaptive heaps might be useful. For a more detailed survey of adaptive sorting, see [7] or [11]. Consider the sorting problem: take as input some arbitrary sequence X = hx1, ..., xni of elements from a totally ordered set and return a permutation of the sequence that is in increasing sorted order. Comparison based sorting has a well-know worst-case lower bound of Ω(n log n) [5]. However, it is clear that this lower bound must not always hold. What if our input sequence is already sorted? What if only one element is out of place? What if it is the concatenation of two sorted subsequences? The lower bound can be refined if we account for the disorder in the input sequence. The main achievements of the adaptive sorting literature are: proposing a variety of measures of disorder, proving new lower bounds with respect to these measures, developing sorting algorithms whose performance matches these new lower bounds, and developing a partial order on the set of measures. We stop here and again direct the reader to [7] or [11] for more information. 1.3 Outline of Paper The remainder of the paper is organized as follows. Section 2 discusses why adaptive heaps might be worth developing. Section 3 presents List Heaps - their structure and operations. Section 4 presents the results of a series of brief empirical tests suggesting List Heaps may have promise in practice. Section 5 summarizes results obtained. 2 Adaptive Heaps This section presents a few reasons for developing adaptive heaps. We use the term adaptive heap loosely throughout this paper to refer to a heap whose performance is some function of the level of presortedness (disor- der) of the input sequence. There are clearly complications we are glossing over, the largest of which is how to deal with decrease key. Further, heap problem instances can have disorder of different types, not just related to the presorted- ness of the input sequence. A starting point to formalize these notions is the adaptive sorting literature. It is fairly easy to extend the results of adaptive sorting to arbitrary sequences of insert and delete min; decrease key may prove more challenging. 3 Why build a heap whose performance adapts to the presortedness of the input sequence? Just as the lower bound for sorting can be restated as a function of the presortedness of the input sequence, the lower bound for an arbitrary heap problem can be restated as a function of the disorder of the problem instance. As delete min is the only operation for which O(1) performance is not available, the disorder of the problem directly impacts the bound on delete min. Thus, we can restate the bound on delete min as O(log k) where k is some measure of disorder less than or equal to the number of elements in the heap. Then, intuitively, the bound on delete min ranges from O(1) for sorted input to O(log n) for random input. The bounds on algorithms which rely on heaps, such as Dijkstra's shortest path algorithm [15], can similarly be adjusted to reflect disorder. For example, we can restate the Dijkstra bound as O(n log k + m) where n is the number of vertices, m is the number of edges, and k is a measure of disorder with k ≤ n. The discussion above suggests that heap-based applications that have input sequences with some level of presortedness could benefit from adaptivity. What is less obvious is that even heap-based applications that have random input sequence can benefit from adaptivity. Here, the benefit is not in asymptotic performance, but in constant factors. Let X be a random sequence of n elements. As n → ∞, the minimum number of increasing subsequences into which X can be partitioned is approximately 2√n subsequences [1]. As we will show in Section 3.3, we can create an extension of the binary heap that is adaptive to the minimum number of increasing subsequences. Thus, where a binary heap constructed from X performs roughly 2 log n comparisons to delete min in the worst-case, an adaptive heap constructed from X can perform delete min in worst-case log n comparisons - cutting the constant factor in half. 3 List Heaps This section introduces the List Heap. The List Heap structure closely mirrors that of the binary heap. The hope is that this similarity makes the changes required to add adaptivity to heaps clear. Additionally, we believe adaptive variants of the binary heap have the greatest potential to be immediately useful in practice. However, binary heaps are flawed as a choice in that decrease key and insert take O(log n) time while O(1) implementations of these operations are clearly possible. Thus the List Heap cannot be optimal on all problem instances. We tolerate this flaw and show that we can construct a heap whose performance is a function of a number of measures of disorder. In particular, we will focus on developing heaps that are adaptive to runs, SU S, and Enc (defined later). These measures of disorder partition the input into monotonic subsequences which are particularly simple for a heap to use. This paper focuses only on insert, delete min, and decrease key and assumes all keys are unique. We first consider the structure of the heap. Next, we outline operations that are adaptive with respect to runs. Finally, we present operations that are adaptive with respect to SU S and Enc. 4 3.1 Structure A List Heap h is an array of circular doubly linked lists of nodes, h = hl1, ..., lki. Each node has a unique key associated with it. Throughout this paper we will refer to the node x and its key interchangeably. We use the notation x(i,j) to refer to the jth node in list li. List Heaps must maintain two invariants. 1. For any list li in heap h, the nodes of li are in increasing sorted order by key value, li = hx(i,1), ..., x(i,j)i, with x(i,1) < x(i,2) < ... < x(i,j). 2. The lists are arranged in heap order in the array, that is l⌊i/2⌋ < li where we define li < lj if x(i,1) < x(j,1). With the invariants above, we can view a List Heap as a standard binary heap of elements: each binary heap element is a list and the key for each list is the key of its head node. With this structure, the minimum node is x(1,1) - the head node of list l1. We will refer to l1 as the root list of the heap. 0 1 2 3 4 5 6 7 l1 l2 l3 l4 l5 l6 l7 1 4 2 5 6 11 7 3 14 8 13 10 16 15 9 12 Figure 1: The List Heap Structure The sorted linked lists are the key feature of the List Heap. They enable us to capture some of the existing order in the input sequence. As a result, List Heaps can be given operations that are adaptive with respect to some measures of disorder. 3.2 A Runs Adaptive List Heap In this section, we present operations for a List Heap that is adaptive with respect to runs, abbreviated RA List Heap. We show that the performance of each heap operation is a function of the number of lists in the heap and that the insert operation partitions the sequence of inserted elements into L lists where L is less than or equal to the number of runs in the sequence. 5 Definition 1. A run is a consecutive decreasing subsequence of maximum length. A subsequence Xi = hxj , ..., xki of X is a run if and only if j, ..., k are consecutive integers and xj−1 < xj > ... > xk < xk+1. The total number of runs in a sequence gives a measure of disorder. For example, consider the following random sequence, h3, 15, 14, 4, 9, 13, 5, 12, 10, 6, 1, 11, 8, 16, 2, 7i. This sequence of sixteen elements can be partitioned into eight runs, h3i,h15, 14, 4i,h9i,h13, 5i,h12, 10, 6, 1i,h11, 8i,h16, 2i,h7i. (1) (2) A decreasing sequence will consist of just one run, an increasing sequence of n elements will contain n runs, each with only one element. We now outline operations for the RA List Heap. 3.2.1 Insert To insert a new item x into heap h = hl1, ..., lki, do the following. If x is less than the head node of lk, (recall that we denote this x < lk), set i = k. Otherwise, set i = k + 1. Then, while x < l⌊i/2⌋, set i = ⌊i/2⌋ and repeat. Once the loop terminates, append x to the front of list li. Note that i might equal k + 1 in which case a new empty list lk+1 will need to be created before x is appended. Figure 1 shows the RA List Heap generated by inserting the random sequence (1) into an empty heap. 3.2.2 Delete Min To perform delete min on heap h, remove the head node x(1,1) from the root list l1 and set x(1,1) to the return value of the function. If l1 is now empty, replace it with the last list in the heap lk. If l1 is not empty, there is no need to swap it with lk. Either way, at this point l1 might be out of heap order. Restore heap order by calling heapify down. This is identical to the heapify operation of the binary heap except that it manipulates entire lists instead of individual nodes. To heapify down on a list li, compare li with its two children, l2i and l2i+1. If li is less than both children, do nothing. Otherwise, swap li with its smallest child and repeat. 3.2.3 Decrease Key To perform decrease key on a node x(i,j), set x(i,j)'s key to the new value. Now there are two cases. 1. If x(i,j) is a head node, that is if x(i,j) = x(i,1), decreasing x(i,1)'s key maintains the sorted order of the list li but may destroy the heap order of the array. Call heapify up to restore the heap order. To heapify up a 6 list li, compare li to its parent l⌊i/2⌋. If li < l⌊i/2⌋ swap the lists. Recurse until heap order is restored. 2. If x(i,j) is not a head node, li may no longer be sorted. If x(i,j) is less than its left sibling x(i,j−1), then the list li is out of sorted order. Remove x(i,j) from li and reinsert x(i,j) into the List Heap using the insert routine. 3.2.4 Analysis It is clear from their descriptions that each of these functions run in O(log k) time, where k is the number of lists in the RA List Heap. Theorem 1. A sequence of consecutive insert operations partitions the inserted elements into L lists where L is less than or equal to the minimum number of runs in the input sequence. Proof. Say the consecutive sequence of elements inserted into heap h = hl1, ...lki is X = hx1, ..., xi, xi+1, ...i. We must show that if xi > xi+1, then xi+1 is appended to an existing list. There are a couple of cases to consider. 1. If xi < lk, xi is appended to lk or one of lk's ancestors. Now, xi+1 < xi so xi+1 < lk and xi+1 is also appended to lk or one of lk's ancestors. 2. If xi > lk, xi is appended to lk+1 or one of its ancestors. If xi is appended to lk+1, the new list lk+1 must be created. Now, xi+1 is compared first to lk+1. Since xi+1 < xi, xi+1 < lk+1, thus xi+1 is appended to lk+1 or one of lk+1's ancestors. If instead xi was appended to an ancestor of lk+1, lk+1 was not created. Then xi+1 is compared first to lk. If xi+1 > lk, xi+1 is compared to the ancestors of lk+1. Since xi was appended to an ancestor of lk+1, xi+1 must be less than one of the ancestors, so xi+1 is appended to an existing list. 3.3 An Enc Adaptive List Heap In this section we present operations for a List Heap that is adaptive with respect to runs, SU S, and Enc. We will abbreviate this EA List Heap. SU S is due to Levcopoulos and Petersson [10], Enc was proposed by Skiena [12]. Definition 2. SU S (Shuffled UpSubsequences) is the minimum number of in- creasing subsequences into which a sequence X can be partitioned. This differs from runs in that the subsequences are increasing and they are not required to be consecutive. For example, the sequence (1) can be partitioned into the following seven increasing subsequences, h3, 15, 16i,h14i,h4, 9, 13i,h5, 12i,h10, 11i,h6, 8i,h1, 2, 7i. (3) This is, in fact, an optimal partition, so SU S for the sequence (1) is seven. 7 Definition 3. An encroaching set is an ordered set of increasing sequences hE1, ..., Eki such that the head(Ei) < head(Ei+1) and tail(Ei) > tail(Ei+1) for 1 ≤ i < k. Thus, the increasing sequences nest or encroach upon one another. Skiena describes an encroaching set by an algorithm, melsort, that builds them. Given an input sequence Y = hy1, ..., yni that is a permutation of an ordered set, build the encroaching set E = hE1, ..., Eki as follows. If the item yi fits on either end of one of the increasing sequences Ej, put it there. Otherwise, form a new sequence Ek+1. Place each item on the oldest Ej upon which it fits. We note that this strategy bears a lot of similarities to Patience Sorting, see [1]. The encroaching set for our example sequence (1) is, h1, 3, 15, 16i,h2, 4, 14i,h5, 9, 13i,h6, 10, 12i,h7, 8, 11i. (4) Thus, Enc for the sequence (1) is five. For adaptive sorting, an Enc optimal algorithm is also SU S optimal and runs optimal [11]. Therefore, we focus on developing a heap which is adaptive to Enc, thereby also achieving adaptivity with respect to SU S and runs. Again, we emphasize that this paper treats the notation of adaptivity infor- mally. In order to achieve some level of adaptivity with respect to Enc, we only need to alter our insert function. The decrease key and delete min functions can remain the same as above. 3.3.1 Insert The insert function attempts to build an encroaching set. We adapt Skiena's strategy to the dynamic context of heaps where there is not a fixed input sequence. Let y be a new item to insert and h = hl1, ..., lki be the heap. In this context, lj is roughly equal to Ej of the encroaching list set. There are three cases. 1. Try to insert y at the front of a list in h. Use binary search on the lists to find the list that has y < li and minimizes y − li. Note, the lists are maintained in heap order, not sorted order. As a result, this binary search may only be an approximate heuristic. Moreover, the binary search may have failed to consider li's direct parent. Appending y to the front of li without checking li's parent could destroy heap order. Thus, we must also compare y to li's ancestors. If y < l⌊i/2⌋, set i = ⌊i/2⌋ and repeat. If we find an li, we are done. Otherwise, we move on to Case 2. 2. Try to insert y at the tail of a list in h. Use binary search on the tail nodes to find the list li that has tail(li) < y and minimizes y − tail(li). If no li is found, go to Case 3. 3. Create a new list lk+1 with the new node as its only element and insert the list after lk in the array. 8 3.3.2 Analysis It is easy to see that the insert routine described above runs in O(log k), where k is the number of lists in the EA List Heap. Theorem 2. A sequence of n consecutive inserts to an empty EA List Heap h partitions the input into an optimal encroaching set. Proof. Simply observe that the insert function reduces to the list creation phase of melsort if the heap starts empty. The only algorithmic difference between the insert routine above and Skiena's melsort is the addition of the heap order check. Corollary 2.1. Given an empty EA List Heap h, perform n consecutive insert operations of elements with uniformly random keys. Then, as n grows large, the expected worst-case number of comparisons to delete the minimum item from h is less than or equal to half the the number of comparisons required by a binary heap. Proof. By Theorem 2, h = hl1, ..., lki where the lists li form an optimal encroach- ing set. As mentioned above, an Enc optimal partition is also SU S optimal, [11], so k is less than or equal to SU S. Now, as n → ∞, SU S → 2√n. [1] Thus, k approaches something less than or equal to 2√n. The worst-case number of comparisons for delete min on a standard binary heap is 2⌈log n − 1⌉. For the Enc Adaptive List Heap, the worst-case number of comparisons is less than or equal to 2⌈log k − 1⌉ ≤ 2⌈log (2√n) − 1⌉ = ⌈log n⌉. As n → ∞, the binary heap bound approaches 2⌈log n⌉. 4 Empirical Results We implemented both the RA List Heap and the EA List Heap for testing purposes, but made no attempts to optimize the code. The results of a series of brief empirical tests against a similarly unoptimized binary heap are presented below. The tests were performed using a codebase written in C and workloads from the 5th DIMACS challenge [6] (with modifications) and a simple sorting routine. The results presented below are raw wallclock times divided by the minimum time attained by any heap. Thus, 1.00 is the minimum wallclock time and k is k times the minimum. Sorted Sorting Random Sorting Random Dijkstra RA List Heap EA List Heap Binary Heap 1.00 1.15 12.62 2.29 1.00 2.52 1.00 1.10 1.22 Table 1: Normalized Wallclock Times Sorted Sorting refers to the task of inserting an n-element decreasing sorted sequence into the heap, followed by n consecutive calls to delete min. Random 9 sorting refers to the task of inserting an n-element random sequence into the heap, followed by n consecutive calls to delete min. The results presented for sorting are for n = 10 million. Random Dijkstra refers to Dijkstra workloads from DIMACS. The results presented for Dijkstra are from a strongly connected randomly generated network with 2 million nodes and 8 million edges. These test results suggest that some variant of the List Heap may be useful in practice. We stress that the results presented above were derived from very simplistic testing. They are merely suggestive that List Heaps may have poten- tial in practice. They are in no way the final word on the empirical performance of the List Heap. 5 Conclusion This paper introduced adaptive heaps - heaps whose performance is a function of both the size of the problem instance and the disorder of the problem instance. We introduced the List Heap as a generic structure that can be endowed with adaptive operations. Finally, we presented operations for the List Heap that are adaptive with respect to a number of measures of disorder on the input sequence. The discussion within this paper has been relatively informal and the List Heap introduced is far from theoretically optimal. If there is interest in this topic, there are a number of directions from here. Additional empirical testing of the List Heap is needed. We presented two insert functions for the List Heap, but there are clearly more (d-array, increasing/decreasing runs, etc.). The optimal choice likely depends on the intended application. If decrease key is not needed, List Heaps could be implemented entirely with arrays. On the theory side, the List Heap and discussion of adaptivity included in this paper leaves much to be desired. We are working on formalizing some notions of adaptivity and have developed a variant of the Fibonacci Heap that is closer to optimal from a theoretical perspective. Modification to other existing heap variants may provide even better results. References [1] David Aldous and Persi Diaconis. Longest increasing subsequences: From patience sorting to the baik-deift-johansson theorem. Bull. Amer. Math. Soc, 36:413 -- 432, 1999. [2] Gerth Stølting Brodal. Worst-case efficient priority queues. In Proceedings of the Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '96, pages 52 -- 58, Philadelphia, PA, USA, 1996. Society for Industrial and Applied Mathematics. [3] Gerth Stølting Brodal. A Survey on Priority Queues, pages 150 -- 163. Springer Berlin Heidelberg, Berlin, Heidelberg, 2013. 10 [4] Gerth Stølting Brodal, George Lagogiannis, and Robert E. Tarjan. Strict fibonacci heaps. In Proceedings of the Forty-fourth Annual ACM Sympo- sium on Theory of Computing, STOC '12, pages 1177 -- 1184, New York, NY, USA, 2012. ACM. [5] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Introduction to Algorithms, Third Edition. The MIT Press, 3rd Stein. edition, 2009. [6] DIMACS. Dimacs 5th challenge: Priority queues. https://app.cs.amherst.edu/ ccmcgeoch/challenge5/. [7] Vladmir Estivill-Castro and Derick Wood. A survey of adaptive sorting algorithms. ACM Comput. Surv., 24(4):441 -- 476, December 1992. [8] Michael L. Fredman and Robert Endre Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM, 34(3):596 -- 615, July 1987. [9] Daniel H. Larkin, Siddhartha Sen, and Robert E. Tarjan. A back-to-basics empirical study of priority queues. In Proceedings of the Meeting on Algo- rithm Engineering & Expermiments, pages 61 -- 72, Philadelphia, PA, USA, 2014. Society for Industrial and Applied Mathematics. [10] C. Levcopoulos and O. Petersson. Sorting shuffled monotone sequences. Information and Computation, 112(1):37 -- 50, 1994. [11] Ola Petersson and Alistair Moffat. A framework for adaptive sorting. Dis- crete Applied Mathematics, 59(2):153 -- 179, 1995. [12] Steven S. Skiena. Encroaching lists as a measure of presortedness. BIT Numerical Mathematics, 28(4):775 -- 784, Dec 1988. [13] Jean Vuillemin. A data structure for manipulating priority queues. Com- mun. ACM, 21(4):309 -- 315, April 1978. [14] John William Joseph Williams. Algorithm 232 - heapsort. Commun. ACM, 7(6):347 -- 349, June 1964. [15] Edsger Wybe. Dijkstra. A note on two problems in connexion with graphs. 1:269 -- 271, 12 1959. 11
1604.00922
1
1604
2016-04-04T15:55:07
Recognition of unipolar and generalised split graphs
[ "cs.DS" ]
A graph is unipolar if it can be partitioned into a clique and a disjoint union of cliques, and a graph is a generalised split graph if it or its complement is unipolar. A unipolar partition of a graph can be used to find efficiently the clique number, the stability number, the chromatic number, and to solve other problems that are hard for general graphs. We present the first $O(n^2)$ time algorithm for recognition of $n$-vertex unipolar and generalised split graphs, improving on previous $O(n^3)$ time algorithms.
cs.DS
cs
Recognition of unipolar and generalised split graphs Colin McDiarmid Nikola Yolov [email protected] [email protected] November 30, 2017 Abstract A graph is unipolar if it can be partitioned into a clique and a disjoint union of cliques, and a graph is a generalised split graph if it or its com- plement is unipolar. A unipolar partition of a graph can be used to find efficiently the clique number, the stability number, the chromatic number, and to solve other problems that are hard for general graphs. We present the first O(n2) time algorithm for recognition of n-vertex unipolar and generalised split graphs, improving on previous O(n3) time algorithms. 1 Introduction 1.1 Definition and motivation A graph is unipolar if for some k ≥ 0 its vertices admit a partition into k + 1 cliques {Ci}k i=0 so that there are no edges between Ci and Cj for 1 ≤ i < j ≤ k. A graph G is a generalised split graph if either G or its complement G is unipolar. All generalised split graphs are perfect; and Promel and Steger [PS92] show that almost all perfect graphs are generalised split graphs. Perfect graphs can be recognised in polynomial time [CLV03] and [CCL+05], and there are many NP-hard problems which are solvable in polynomial time for perfect graphs, including the stable set problem, the clique problem, the colouring problem, the clique covering problem and their weighted versions [GLS84]. If the input graph is restricted to be a generalised split graph, then there are much more efficient algorithms for the problems above [EW14]. In this paper we address the problem of efficiently recognising generalised split graphs, and finding a witnessing partition. Previous recognition algorithms for unipolar graphs include [TC85] which achieves O(n3) running time, [CH12] with O(n2m) time and [EW14] with O(nm+ nm′) time, where n and m are respectively the number of vertices and edges of the input graph, and m′ is the number of edges added after a triangulation of the input graph. Note that almost all unipolar graphs and almost all generalised split graphs have (1 + o(1))n2/4 edges [MY16]. Further, by testing whether G 1 or G is unipolar, each of the mentioned algorithms above recognises generalised split graphs in O(n3) time. The algorithm in this paper has running time O(n2). This leads to polynomial-time algorithms for the problems mentioned above (stable set, clique, colouring and so on) which have O(n2.5) expected running time for a random perfect graph Rn and an exponentially small probability of exceeding this time bound. Here we assume that Rn is sampled uniformly from the perfect graphs on vertex set [n] = {1, 2, . . . n}. 1.2 Notation We use V (G), E(G), v(G) and e(G) to denote V , E, V and E for a graph G = (V, E). We let N (v) denote the neighbourhood of a vertex v, and let N +(v) denote N (v) ∪ {v}, also called the closed neighbourhood of v. If G = (V, E) and S ⊆ V , then G[S] denotes the subgraph induced by S. Let GS+ be the set of all unipolar graphs and let GS be the set of all generalised split graphs. Fix G = (V, E) ∈ GS+. If V0, V1 ⊆ V with V0 ∩ V1 = ∅ and V0 ∪ V1 = V are such that V0 is a clique and V1 is a disjoint union of cliques, then the ordered pair (V0, V1) will be called a unipolar representation of G or just a representation of G. For each unipolar representation R = (V0, V1) we call V0 the central clique of R, and we call the maximal cliques of V1 the side cliques of R. A graph is unipolar iff it has a unipolar representation. Definition 1.1. Let R = (V0, V1) be a unipolar representation of a graph G. A partition B of V (G) is a block decomposition of G with respect to R if the intersection of each part of B with V1 is either a side clique or ∅. 1.3 Plan of the paper Assume that G is an input graph throughout. The algorithm for recognising unipolar graphs has three stages. In the first stage a sufficiently large max- imal independent set is found. The second stage constructs a partition B of V (G), such that B is a block decomposition for some unipolar representation if G ∈ GS +. The third stage generates a 2-CNF formula which is satisfiable iff B is a block decomposition for some unipolar representation. The formula is con- structed in such a way that a satisfying assignment of the variables corresponds to a representation of G, and the algorithm returns either a representation of G, or reports G /∈ GS +. We describe the third stage first (in §2) as it is short and includes a nat- ural transformation to 2-SAT. In §3 we discuss the first stage of finding large independent sets. In §4 we present the second stage when we seek to build a block decomposition. Finally, in §5, we briefly discuss random perfect graphs and algorithms for them using the algorithm described above. 1.4 Data Structures The most commonly used data type for this algorithm is the set. We assume that the operation A∩ B takes O(min(A,B)) time, A ∪ B takes O(A + B) 2 time, A\ B takes O(A) time and a ∈ A takes O(1) time. These properties can be achieved by using hashtables to implement sets. Functions will always be of the form f : [m] → A for some m, where [m] = {1, 2, . . . m}. Therefore functions can be implemented with simple arrays, hence the lookup and assignment operations are assumed to require O(1) time. 2 Verification of Block Decomposition 2.1 2-SAT Let x1, . . . , xn be n boolean variables. A 2-clause is an expression of the form y1 ∨ y2, where each yj is a variable, xi, or the negation of a variable, ¬xi. There are 4n2 possible 2-clauses. The problem of deciding whether or not a formula of the form ψ = ∃x1∃x2 . . .∃xn(c1 ∧ c2 ∧ . . .∧ cm), where each cj is a 2-clause, is satisfiable is called 2-SAT. The problem 2-SAT is solvable in O(n + m) time – [EIS76] and [APT79], where n is the number of variables and m is the number of clauses in the input formula. 2.2 Transformation to 2-SAT Let G = (V, E) be a graph with vertex set V = [n]. In this subsection we show how to test if a partition of V is a block decomposition for some unipolar representation, in which case we must have G ∈ GS +. Let B be the partition of V we want to test. From each block of B, we seek to pick out some vertices to form the central clique V0 of a representation, with the remaining vertices in the blocks forming the side cliques. Suppose that B = m, and B is represented by a surjective function f : V → [m], so that B = {f −1[i] : i ∈ [m]}. Let {xv : v ∈ V } be Boolean variables. We use the procedure verify to construct a formula ψ(x1, . . . xn), so that each satisfying assignment of {xv} corresponds to a representation of G. Procedure verify(G, f ): ψ := ∃x1∃x2 . . .∃xn for {u, v} ∈ V (2) do if uv ∈ E then if f (u) = f (v) then do nothing else ψ := ψ ∧ (xu ∨ xv) end if else if f (u) = f (v) then else ψ := ψ ∧ (xu ∨ xv) ∧ (¬xu ∨ ¬xv) ψ := ψ ∧ (¬xu ∨ ¬xv) end if 3 end if end for return 2-SAT(ψ) There is an exception: the first time a clause is added to ψ it should be added without the preceding sign for conjunction. The following lemma is easy to check. Lemma 2.1. The formula ψ is satisfiable iff B is a block decomposition for some representation. Indeed an assignment Φ : {xv : v ∈ V } → {0, 1} satisfies ψ if and only if R = (V0, V1) is a representation of G and B is a block decomposition of G with respect to R, where Vi = {v ∈ V : Φ(v) = 1 − i}. Proof. Suppose Φ is a satisfying assignment and let V0, V1 be as above. If u and v are both in V0, then uv ∈ E, since otherwise Φ contains a clause ¬xu ∨ ¬xv. If u and v are in V1, then either uv ∈ E and f (u) = f (v) or uv 6∈ E and f (u) 6= f (v), because in the other two cases φ contains the clause xu ∨ xv. This means that the vertices in V1 are grouped into cliques by their value of f . For the other direction, it is sufficient to verify that each generated clause is satisfied, which is a routine check. At most a constant number of operations are performed per pair {u, v}, so O(n2) time is spent preparing ψ. The formula ψ can have at most 2 clauses per pair {u, v}, so the length of ψ is also O(n2), and since 2-SAT can be solved in linear time, the total time for this step is O(n2). 3 Independent Set 3.1 Maximum Independent Set of a Unipolar Graph Let α(G) be the maximum size of an independent set in a graph G. Let G ∈ GS + and let R be a unipolar representation of G. Observe that for any representation R of G, the number s(R, G) of side cliques satisfies s(R, G) ≤ α(G) ≤ s(R, G) + 1. We deduce that for every two representations R1 and R2 of G we have s(R1, G) − s(R2, G) ≤ 1. If for example G is Kn or its complement, then the number s(R, G) depends on R. However, this is not necessarily the case for all graphs, see Figure 1. It can be shown that the number of n-vertex unipolar graphs with a unique representation is (1 − e−Θ(n))GS + n, and that the number of n-vertex unipolar graphs G with a unique representation R and such that s(G, R) = α(G) is (1 − O(e−nδ 3.2 It is well known that calculating α(G) for a general graph is NP-hard. For G ∈ GS + let s(G) = maxR s(R, G), where the maximum is over all representations R of G. For G /∈ GS+ set s(G) = 0. In this section we see how to find a maximal independent set I, such that if G ∈ GS+, then I ≥ s(G) (≥ α(G) − 1). n for a constant δ > 0 [MY16]. ))GS + Independent Set Algorithm 4 Figure 1: For the graph G1 on the left, s(R, G1) = α(G1) for all representations R, and the graph G2 on the right, s(R, G2) = α(G1) + 1 for all representations R. The idea is to start with G and with I = ∅; and as long as the remaining graph has two non-adjacent vertices, say v1 and v2, pick r = 1 or 2 of these vertices to add to I, and delete from G the closed neighbourhood of the added vertices. We do this in such a way that a given representation R of G yields a representation with r less side cliques, or (only when r = 2) with one less side clique and the central clique removed. Procedure indep(G): I := ∅, U := V (G) while U 6= ∅ do else if G[U ] is complete then pick an arbitrary u ∈ U return I ∪ {u}. pick u1, u2 ∈ U , so that u1u2 /∈ E(G). U1 := (N +(u1) \ N +(u2)) ∩ U U2 := (N +(u2) \ N +(u1)) ∩ U if G[U1] is complete then if G[U2] is complete then else I := I ∪ {u1, u2} U := U \ (N +(u1) ∪ N +(u2)) I := I ∪ {u1} U := U \ N +(u1) end if else if G[U2] is complete then else I := I ∪ {u2} U := U \ N +(u2) I := I ∪ {u1, u2} U := U \ (N +(u1) ∪ N +(u2)) end if end if end if end while 5 return I Observe that the main body of the indep(G) procedure is a while loop. An alternative way of seeing the algorithm is that instead of the loop there is a recursive call to indep(G[U ]) at the end of the iteration and the procedure returns the union of the vertices found during this iteration and the recursively retrieved set. A recursive interpretation is clearer to work with for inductive proofs. 3.3 Correctness Lemma 3.1. Procedure indep(G) always returns a maximal independent set I. Proof. This is easy to see, since each vertex deleted from U is adjacent to a vertex put in I. Lemma 3.2. If indep(G) returns I, then I ≥ s(G). Proof. If G /∈ GS+, then the statement holds, because s(G) = 0. From now on assume that G ∈ GS +. We argue by induction on v(G). It is trivial to see that the lemma holds for v(G) = 1. Let v(G) > 1 and assume that the lemma holds for smaller graphs. If G is complete, then I = 1 = s(G). Fix an arbitrary unipolar representation R of G. We show that I ≥ s(R, G). If G is not complete, then the procedure selects two non-adjacent vertices u and v. The vertices u and v are either in different side cliques or one of them is in the central clique and the other is in a side clique. We start with the case when u and v are contained in side cliques. After inspecting their neighbourhoods, the algorithm removes from U either one or both of them along with their neighbourhood. Suppose that it removes r of them, where r is 1 or 2. Let G′ and R′ be the graph and the representation induced by the remaining vertices. By the induction hypothesis, if I ′ is the recursively retrieved set, then I ′ ≥ s(R′, G′). Let I be the independent set returned at the end of the algorithm, so that I ′ + r = I. Both u and v see all the vertices in their corresponding side clique, and see no vertices from different side cliques, so after removing r of them with their neighbours, the number of side cliques in the representation decreases by precisely r, and hence s(R, G) = s(R′, G′) + r. Now I = I ′ + r ≥ s(R′, G′) + r = s(R, G). Now w.l.o.g. assume that u belongs to a side clique and v belongs to the central clique. Then N +(u) contains the side clique of u and perhaps parts of the central clique. Therefore, N +(u) \ N +(v) is a subset of the side clique of u, and hence it is a clique. If N +(v) \ N +(u) is a not clique, then the algorithm continues recursively with G[V \N +(u)]; and using the same arguments as above with r = 1, we guarantee correct behaviour. Now assume that N +(v)\ N +(u) is a clique. Then N +(v)\ N +(u) can intersect at most one side clique, because the vertices in different side cliques are not adjacent. In this case N +(v) ∪ N +(u) completely covers the side clique of u, completely covers the central clique, and it may intersect one additional side clique. Hence s(R, G) = s(R′, G′) + 1 or s(R, G) = s(R′, G′) + 2, where G′ and R′ are the induced graph and 6 representation after the removal of N +(v) ∪ N +(u). If I ′ is the recursively obtained independent set, from the induction hypothesis we deduce that I = I′ + 2 ≥ s(R′, G′) + 2 ≥ s(R, G). 3.4 Time Complexity In this form the algorithm takes more than O(n2) time, because checking whether an induced subgraph is complete is slow. However, we can maintain a set of vertices, C, which we have seen to induce a complete graph. We will create an efficient procedure to check if a subgraph is complete, and to return some additional information to be used for future calls if the subgraph is not complete. Procedure antiedge(G, U, C): C ′ := C for v ∈ U \ C do if C ′ \ N +(v) = ∅ then else C ′ := C ′ ∪ {v} let u ∈ C ′ \ N +(v) return (uv, C ′) end if end for return (F alse, C ′). The following lemma summarises the behaviour of antiedge. Lemma 3.3. Let C ⊆ U and suppose that G[C] is complete. If G[U ] is complete, then antiedge(G, U, C) returns (F alse, U ); if not, then it returns (uv, C ′) such that 1. uv ∈ C ′ × (U \ C ′) − E(G) i.e. u ∈ C ′, v ∈ U \ C ′, uv /∈ E(G) 2. C ⊆ C ′ ⊆ U 3. G[C ′] is complete Proof. Easy checking. Procedure indep(G): I := ∅; U := V (G) e := F alse; C := ∅ (e, C) := antiedge(G, U, C) while U 6= ∅ do if e = F alse then pick an arbitrary u ∈ U return I ∪ {u}. Assume that e = u1u2; u1, u2 ∈ U else 7 U1 := (N +(u1) \ N +(u2)) ∩ U U2 := (N +(u2) \ N +(u1)) ∩ U (e1, C1) := antiedge(G, U1, C ∩ U1) (e2, C2) := antiedge(G, U2, C ∩ U2) if e1 = F alse then if e2 = F alse then I := I ∪ {u1, u2} U := U \ (N +(u1) ∪ N +(u2)) (e, C) := antiedge(G, U,∅) I := I ∪ {u1} U := U \ N +(u1) C := C2; e := e2 else end if else if e2 = F alse then I := I ∪ {u2} U := U \ N +(u2) C := C1; e := e1 else I := I ∪ {u1, u2} U := U \ (N +(u1) ∪ N +(u2)) (e, C) := antiedge(G, U,∅) end if end if end if end while return I Lemma 3.4. Let U and C be the sets stored in the respective variables at the beginning of an iteration of the main loop of the modified indep, and let U ′ and C ′ be the sets stored at the beginning of the next iteration, if the algorithm does not terminate meanwhile. The following loop invariants hold: (I1) G[C] is complete and C ⊆ U , (I2) U ′ \ C ′ ⊆ U \ C. A loop invariant is a condition which is true at the beginning of each iteration of a loop. Proof. Observe that the initial values of U and C, which are V and ∅ respec- tively, guarantee by Lemma 3.3 that the values after the call to antiedge satisfy condition (I1). Therefore (I1) holds for the first iteration. Concerning future iterations, observe that (I1) guarantees the precondition of Lemma 3.3, which it turn guarantees (I1) for the next iteration. We deduce that (I1) does indeed give a loop invariant. By proving this we have proved that the preconditions of Lemma 3.3 are always met; and so we can use Lemma 3.3 throughout. 8 If e = F alse, then there is no next iteration, hence condition (I2) is auto- matically correct. Now assume that e = u1u2. Depending on e1 and e2 there are two cases for how many vertices are excluded. Case 1: one vertex is excluded. W.l.o.g. assume that u1 is excluded, so U ′ = U \ N +(u1), C ∩ U2 ⊆ C ′ and C ⊆ N +(u1) ∪ N +(u2). Then U ′ \ C ′ ⊆ U ′ \ (C ∩ U2) = (U \ N +(u1)) \ (C ∩ (N +(u2) \ N +(u1)) ∩ U ) = U \ [N +(u1) ∪ (C ∩ (N +(u2) \ N +(u1)))] = U \ [N +(u1) ∪ C] ⊆ U \ C. Case 2: two vertices are excluded. Now U ′ = U \ (N +(u1) ∪ N +(u2)), and U ′ \ C ′ ⊆ U ′ ⊆ U \ C. We have shown that condition (I2) holds at the start of the next iteration, and so it gives a loop invariant as claimed. A vertex v is absorbed if it is processed during the loop of antiedge and then appended to the result set, C ′. Corollary 3.5. A vertex can be absorbed once at most. Proof. Let U, C, U ′ and C ′ be as before. Observe that if, during the iteration, vertex v is absorbed in a call to antiedge, then v ∈ U \ C and v /∈ U ′ \ C ′. The Corollary now follows from the second invariant in Lemma 3.4. Lemma 3.6. The procedure indep(G) using antiedge takes O(n2) time. Proof. The total running time of each iteration of the main loop of indep(G) besides calling antiedge is O(n). The set U decreases by at least one vertex on each iteration, so the time spent outside of antiedge is O(n2). From Corollary 3.5 at most n vertices are absorbed and O(n) steps are performed each time, so in total O(n2) time is spent in all calls to antiedge for absorbing vertices. Assume that v is processed in antiedge for the first time, but it is not absorbed and it is tested against a set C1. Since v is not absorbed, we may assume that antiedge has returned the pair of vertices vu. At least one of u and v is removed (along with its neighbourhood) from U and moved to I. If v is removed from U , then no more time can be spent on it in antiedge, hence the total time spent on v in antiedge is O(n). Now assume that u is removed. We have that C1 ⊆ N +(u) and each vertex in N +(u) is removed from U . Hence, if v is processed again in antiedge, it will be tested against a set C2 with C1 ∩ C2 = ∅, and therefore C1 + C2 = C1 ∪ C2 = O(n). As we saw before, if v is absorbed or removed from U , then it cannot be processed again in antiedge; and thus the running time spent on v is again O(n). If v is not removed from U , then C2 is removed from U . Hence, if v is processed again in antiedge, v 9 will be tested against a set C3 with C1 + C2 + C3 = C1 ∪ C2 ∪ C3 = O(n), and so on. Thus, we see that over all these tests, each vertex is tested at most once for adjacency to v, and so the total time spent on v is O(n). 4 Building Blocks and Recognition 4.1 Block Creation Algorithm In this subsection we present a short algorithm for creating a partition of V (G) using an independent set I and then checking if this partition is a block decom- position using the procedure verify from Section 2. Procedure test(G, I): U := V (G); t := 0; f := ∅ for i ∈ I do for v ∈ N +(i) ∩ U do f (v) := t end for U := U \ N +(i) t := t + 1 end for for v ∈ U do f (v) := t end for return verify(G, f ) Lemma 4.1. Suppose that I ⊆ V (G) is an independent set with I ≥ s(G) − 1 and V0 ∩ I = ∅ for some unipolar representation R = (V0, V1) of G. Then test(G, I) returns T rue. Proof. On each step of the main loop a vertex from i ∈ I is selected. Since V0 ∩ I = ∅, the vertex i is a part of some side clique, say C. Now C ∩ N +(j) = ∅ for each j ∈ I \ {i}, so C ⊆ U . Also C ⊆ N +(i), and hence C ⊆ N +(i) ∩ U . Vertex i does not see vertices from other side cliques, so N +(i) ∩ U is correctly marked as a separate block. If there is an unrepresented side clique, say C, then none of the previously created blocks can claim any vertex from it, and hence C ⊆ U . We have shown that when the main loop ends, either U ∩ V1 = ∅ or U ∩ V1 is a side clique; so U is correctly marked as a separate block. The set U also contains all remaining vertices, so f is partition of V into blocks, and hence verify(G, f ) will return T rue. Since I ≥ s(G) − 1, at most one side clique is not represented in I. 4.2 Block Decomposition Algorithm By Lemma and 3.1 and 3.2, indep(G) returns a maximal independent set I of size at least s(G). Thus, Lemma 4.1 suggests a naive algorithm for recognition 10 for GS + – try test(G, I \ i) for each i ∈ I and return T rue if any attempt succeeds. The proposed algorithm is correct, since I ∩ V0 ≤ 1. The running time is O(In2) = O(n3), while we aim for O(n2). However, with relatively little effort we can localise I ∩ V0 to at most 2 candidates from I. Procedure blocks(G, I): C := I for v ∈ V (G) do if N +(v) ∩ I = 2 then C := C ∩ N +(v) end if end for if C = 1 then else if C = 2 then return test(G, I \ C) Assume that C = {c1, c2} return test(G, I \ {c1}) ∨ test(G, I \ {c2}) return test(G, I) else end if Procedure recognise(G): return blocks(G, indep(G)) 4.3 Correctness Lemma 4.2. The procedure recognise(G) returns T rue iff G ∈ GS +. Proof. First assume that G ∈ GS + and let R = (V0, V1) be an arbitrary repre- sentation of G. Let I = indep(G). By Lemma 3.2, I ≥ s(G) ≥ s(R, G). Since V0 is a clique and I is an independent set, we have V0 ∩ I ≤ 1. Case 1: V0 ∩ I = ∅. Observe that blocks returns test(G, I ′), where I ′ is either I or I \ {v} for some v ∈ I, hence I ′ ≥ I − 1 ≥ s(G) − 1; I ′ ⊆ I ⊆ V1, so test(G, I ′) = T rue from Lemma 4.1. Case 2: V0 ∩ I = {c}. Blocks starts by calculating the set C, where C = I if there is no v ∈ V with N +(v) ∩ I = 2, and otherwise C = \{N +(v) ∩ I : v ∈ V (G),N +(v) ∩ I = 2}. Assume that N +(v) ∩ I = 2 for some v ∈ V . If v ∈ V0, then c ∈ N +(v), because V0 is a clique. If v ∈ V1, then N +(v) can intersect at most one vertex from I ∩ V1 and at most one vertex from I ∩ V0 = {c} and since N +(v)∩ I = 2, we have c ∈ N +(v). For each v ∈ V if N +(v) ∩ I = 2, then c ∈ N +(v) ∩ I, so c belongs to their intersection. If no v ∈ V exists with N +(v) ∩ I = 2, then C = I, but c ∈ I, so again c ∈ C. We deduce that if V0 ∩ I = {c}, then c ∈ C and C > 0. 11 If C = 1 or C = 2 then test(G, I \ {i}) is tested individually for each vertex i ∈ C, but c ∈ C and test(G, I \ {c}) = T rue by Lemma 4.1. If C > 2, then there is no v ∈ V with N +(v)∩ I = 2. Either I = s(R, G) or I = s(R, G)+1, so either all side cliques are represented by vertices of I, or at most one is not represented, say S. We can handle both cases simultaneously by saying that S = ∅ in the former case. We have that I is a maximal independent set, but no vertex of I \ {c} can see a vertex of S, because they belong to different side cliques, so c is connected to all vertices of S and therefore {c} ∪ S is a clique. Let T = N (c) ∩ (V1 \ S). Then N +(v) ∩ I = 2 for each v ∈ T , but no such vertex exists by assumption, so T = ∅. Now N (c) ∩ V1 = S, and V1 is a union of disjoint cliques, so V1 ∪ {c} is also a union of disjoint cliques. Hence R′ = (V0 \ {c}, V1 ∪ {c}) is a representation of G, so from Lemma 4.1 test(G, I) = T rue. On the contrary, if G /∈ GS +, then there is no representation for G, hence test cannot generate a block decomposition of G, and therefore test will return F alse. 4.4 Time Complexity Lemma 4.3. recognise(G) takes O(n2) time. Proof. The procedure test loops over a subset of V and intersects two subsets of V , so the time for each step is bounded by O(n), and since the number of steps is O(n), O(n2) time is spent in the loop. Then it performs one more operation in O(n) time, so the total time spent for preparation is O(n2). Then test calls verify, which takes O(n2) time, so the total running time of test is O(n2). While building C, blocks handles O(n) sets with size O(n), so it spends O(n2) time in the first stage. Depending on the size of C, blocks calls test once or twice, but in both cases it takes O(n2) time, so the total running time of blocks is O(n2). The total time spent for recognition is the time spent for blocks plus the time spent for indep, and since both are O(n2), the total running time for recognition is O(n2). 5 Algorithms for random perfect graphs Grotschel, Lov´asz, and Schrijver [GLS84] show that the stable set problem, the clique problem, the colouring problem, the clique covering problem and their weighted versions are computable in polynomial time for perfect graphs. The algorithms rely on the Lov´asz sandwich theorem, which states that for every graph G we have ω(G) ≤ ϑ(G) ≤ χ(G), where ϑ(G) is the Lov´asz number. The Lov´asz number can be approximated via the ellipsoid method in polynomial time, and for perfect graphs we know that ω(G) = χ(G), hence ϑ(G) is an integer and its precise value can be found. Therefore χ(G) and ω(G) can be found in polynomial time for perfect graphs, though these are NP-hard problems for general graphs. Further, α(G) and χ(G) (the clique covering number) can be 12 computed from the complement of G (which is perfect). The weighted versions of these parameters can be found in a similar way using the weighted version of the Lov´asz number, ϑw(G). These results tell us more about computational complexity than algorithm design in practice. On the other hand, the problems above are much more easily solvable for generalised split graphs. We know that the vast majority of the n- vertex perfect graphs are generalised split graphs [PS92]. One can first test if the input perfect graph is a generalised split graph using the algorithm in this paper and if so, apply a more efficient solution. Eschen and Wang [EW14] show that, given a generalised split graph G with n vertices together with a unipolar representation of G or G, we can efficiently solve each of the following four problems: find a maximum clique, find a max- imum independent set, find a minimum colouring, and find a minimum clique cover. It is sufficient to show that this is the case when G is unipolar, as otherwise we can solve the complementary problem in the complement of G. Finding a maximum size stable set and minimum clique cover in a unipolar graph is equivalent to determining whether there exists a vertex in the central clique such that no side clique is contained in its neighbourhood, which is trivial and can be done very efficiently. Suppose there are k side cliques. If there is such a vertex v, then a maximum size stable set (of size k + 1) consists of v and from each side clique a vertex not adjacent to v, and a minimum size clique cover is formed by the central clique and the k side cliques. If not, then a maximum size stable set (of size k) consists of a vertex from each side clique, and a minimum clique cover is formed by extending the k side cliques to maximal cliques (which then cover C0). Let us focus on finding a maximum clique and minimum colouring of a unipo- lar graph G with a representation R. If R contains k side cliques, C1, . . . Ck, then ω(G) = χ(G) = max{ω(G[C0 ∪ Ci])}k i=1 = max{χ(G[C0 ∪ Ci])}k i=1, where C0 is the central clique. Therefore, in order to find a maximum clique or a minimum colouring, it is sufficient to solve the corresponding problem in each of the co-bipartite graphs induced by the central clique and a side clique. The vertices outside a clique in a co-bipartite graph form a cover in the com- plementary bipartite graph, and the vertices coloured with the same colour in a proper colouring of a co-bipartite graph form a matching in the complementary bipartite graph. By Konig's theorem it is easy to find a minimum cover using a given maximum matching, and therefore finding a maximum clique and a minimum colouring in a co-bipartite graph is equivalent to finding a maximum matching in the complementary bipartite graph. For colourings, we explicitly find a minimum colouring in each co-bipartite graph G[C0∪Ci], and such colour- ings can be fitted together using no more colours, since C0 is a clique cutset. Assume that G[C0 ∪ Ci] contains ni vertices and mi edges, so each ni ≤ n and Pi mi ≤ C0(n − C0) ≤ n2/4. We could use the Hopcroft–Karp algo- 13 rithm for maximum matching in O((E + V )pV ) time to find time bound Pi O((mi + ni)√ni) = O((n + m)√n) = O(n2.5). The approach of Eschen and Wang [EW14] is very similar, and they give more details, but unfortunately there is a mistake with their analysis, and a cor- rected version of their analysis yields O(n3.5/ log n) time, instead of the claimed O(n2.5/ log n). In order to see the mistake consider the case when the input graph is a split graph with an equitable partition. Given a random perfect graph Rn, we run our recognition algorithm in time O(n2). If we have a generalised split graph, with a representation, we solve each of our four optimisation problems in time O(n2.5), if not, which happens with probability e−Ω(n), we run the methods from [GLS84]. This simple idea yields a polynomial-time algorithm for each problem with low expected running time, and indeed the probability that the time bound is exceeded is exponentially small. References [APT79] Bengt Aspvall, Michael F. Plass, and Robert Endre Tarjan. A linear- time algorithm for testing the truth of certain quantified boolean formulas. Inf. Process. Lett., 8(3):121–123, 1979. [CCL+05] Maria Chudnovsky, G´erard Cornu´ejols, Xinming Liu, Paul Seymour, and Kristina Vuskovi´c. Recognizing Berge graphs. Combinatorica, 25(2):143–186, 2005. [CH12] Ross Churchley and Jing Huang. Solving partition problems with colour-bipartitions. Graphs and Combinatorics, pages 1–12, 2012. [CLV03] G´erard Cornu´ejols, Xinming Liu, and Kristina Vuskovi´c. A poly- nomial algorithm for recognizing perfect graphs. In Foundations of Computer Science, 2003. Proceedings. 44th Annual IEEE Symposium on, pages 20–27. IEEE, 2003. [EIS76] [EW14] S. Even, A. Itai, and A. Shamir. On the complexity of timetable and multicommodity flow problems. SIAM Journal on Computing, 5(4):691–703, 1976. Elaine M. Eschen and Xiaoqiang Wang. Algorithms for unipolar and generalized split graphs. Discrete Appl. Math., 162:195–201, January 2014. [GLS84] Martin Grotschel, Laszlo Lov´asz, and Alexander Schrijver. Poly- nomial algorithms for perfect graphs. North-Holland Mathematics Studies, 88:325–356, 1984. [MY16] Colin McDiarmid and Nikola Yolov. Random perfect graphs. preparation, 2016+. In 14 [PS92] [TC85] Hans Jurgen Promel and Angelika Steger. Almost all Berge graphs are perfect. Combinatorics, Probability and Computing, 1(01):53–79, 1992. RI Tyshkevich and AA Chernyak. Algorithms for the canonical de- composition of a graph and recognizing polarity. Izvestia Akad. Nauk BSSR, ser. Fiz.-Mat. Nauk, 6:16–23, 1985. 15
1504.04470
2
1504
2016-12-31T03:10:31
Unit Interval Editing is Fixed-Parameter Tractable
[ "cs.DS" ]
Given a graph~$G$ and integers $k_1$, $k_2$, and~$k_3$, the unit interval editing problem asks whether $G$ can be transformed into a unit interval graph by at most $k_1$ vertex deletions, $k_2$ edge deletions, and $k_3$ edge additions. We give an algorithm solving this problem in time $2^{O(k\log k)}\cdot (n+m)$, where $k := k_1 + k_2 + k_3$, and $n, m$ denote respectively the numbers of vertices and edges of $G$. Therefore, it is fixed-parameter tractable parameterized by the total number of allowed operations. Our algorithm implies the fixed-parameter tractability of the unit interval edge deletion problem, for which we also present a more efficient algorithm running in time $O(4^k \cdot (n + m))$. Another result is an $O(6^k \cdot (n + m))$-time algorithm for the unit interval vertex deletion problem, significantly improving the algorithm of van 't Hof and Villanger, which runs in time $O(6^k \cdot n^6)$.
cs.DS
cs
Unit Interval Editing is Fixed-Parameter Tractable Yixin Cao∗ Abstract Given a graph G and integers k1, k2, and k3, the unit interval editing problem asks whether G can be transformed into a unit interval graph by at most k1 vertex deletions, k2 edge deletions, and k3 edge additions. We give an algorithm solving this problem in time 2O(k log k) · (n + m), where k := k1 + k2 + k3, and n, m denote respectively the numbers of vertices and edges of G. Therefore, it is fixed-parameter tractable parameterized by the total number of allowed operations. Our algorithm implies the fixed-parameter tractability of the unit interval edge deletion problem, for which we also present a more efficient algorithm running in time O(4k · (n + m)). Another result is an O(6k · (n + m))-time algorithm for the unit interval vertex deletion problem, significantly improving the algorithm of van 't Hof and Villanger, which runs in time O(6k · n6). 1 Introduction A graph is a unit interval graph if its vertices can be assigned to unit-length intervals on the real line such that there is an edge between two vertices if and only if their corresponding intervals intersect. Most important applications of unit interval graphs were found in computational biology [5, 16, 18], where data are mainly obtained by unreliable experimental methods. Therefore, the graph representing the raw data is very unlikely to be a unit interval graph, and an important step before understanding the data is to find and fix the hidden errors. For this purpose various graph modification problems have been formulated: Given a graph G on n vertices and m edges, is there a set of at most k modifications that make G a unit interval graph. In particular, edge additions, also called completion, and edge deletions are used to fix false negatives and false positives respectively, while vertex deletions can be viewed as the elimination of outliers. We have thus three variants, which are all known to be NP-complete [21, 30, 16]. These modification problems to unit interval graphs have been well studied in the framework of parameterized computation, where the parameter is usually the number of modifications. Recall that a graph problem, with a nonnegative parameter k, is fixed-parameter tractable (FPT) if there is an algorithm solving it in time f(k) · (n + m)O(1), where f is a computable function depending only on k [12]. The problems unit interval completion and unit interval vertex deletion have been shown to be FPT by Kaplan et al. [18] and van Bevern et al. [3] respectively. In contrast, however, the parameterized complexity of the edge deletion version remained open to date, which we settle here. Indeed, we devise single-exponential linear-time parameterized algorithms for both deletion versions. Theorem 1.1. The problems unit interval vertex deletion and unit interval edge deletion can be solved in time O(6k · (n + m)) and O(4k · (n + m)) respectively. Our algorithm for unit interval vertex deletion significantly improves the currently best parameterized algorithm for it, which takes O(6k · n6) time [17]. Another algorithmic result of van 't Hof and Villanger [17] is an O(n7)-time 6-approximation algorithm for the problem, which we improve to the following. Theorem 1.2. There is an O(nm + n2)-time approximation algorithm of approximation ratio 6 for the minimization version of the unit interval vertex deletion problem. The structures and recognition of unit interval graphs have been well studied and well understood [11]. It is known that a graph is a unit interval graph if and only if it contains no claw, S3, S3, (as depicted in Fig. 1,) or any hole (i.e., an induced cycle on at least four vertices) [26, 29]. Unit interval graphs are thus a subclass of chordal graphs, which are those graphs containing no holes. Modification problems ∗Department of Computing, Hong Kong Polytechnic University, Hong Kong, China. [email protected]. Supported in part by the Hong Kong Research Grants Council (RGC) under grant 252026/15E, the National Natural Science Foundation of China (NSFC) under grants 61572414 and 61420106009, the Hong Kong Polytechnic University (PolyU) under grant 4-ZZEZ, and the European Research Council (ERC) under grant 280152. 1 (a) claw (b) S3 (c) S3 (d) W5 (e) C∗5 = W5 (f) C6 Figure 1: Small forbidden induced graphs. to chordal graphs and unit interval graphs are among the earliest studied problems in parameterized computation, and their study had been closely related. For example, the algorithm of Kaplan et al. [18] for unit interval completion is a natural spin-off of their algorithm for chordal completion, or more specifically, the combinatorial result of all minimal ways to fill holes in. A better analysis was shortly done by Cai [7], who also made explicit the use of bounded-depth search in disposing of finite forbidden induced subgraphs. This observation and the parameterized algorithm of Marx [24] for the chordal vertex deletion problem immediately imply the fixed-parameter tractability of the unit interval vertex deletion problem: One may break first all induced claws, S3's, and S3's, and then call Marx's algorithm. Here we are using the hereditary property of unit interval graphs, -- recall that a graph class is hereditary if it is closed under taking induced subgraphs. However, neither approach can be adapted to the edge deletion version in a simple way. Compared to completion that needs to add Ω((cid:96)) edges to fill a C(cid:96) (i.e., a hole of length (cid:96)) in, an arbitrarily large hole can be fixed by a single edge deletion. On the other hand, the deletion of vertices leaves an induced subgraph, which allows us to focus on holes once all claws, S3's, and S3's have been eliminated; however, the deletion of edges to fix holes of a {claw, S3, S3}-free graph may introduce new claws, S3's, and/or S3's. Therefore, although a parameterized algorithm for the chordal edge deletion problem has also been presented by Marx [24], there is no obvious way to use it to solve the unit interval edge deletion problem. Direct algorithms for unit interval vertex deletion were later discovered by van Bevern et al. [3] and van 't Hof and Villanger [17], both using a two-phase approach. The first phase of their algorithms breaks all forbidden induced subgraphs on at most six vertices. Note that this differentiates from the aforementioned simple approach in that it breaks not only claws, S3's, and S3's, but all C(cid:96)'s with (cid:96) (cid:54) 6. Although this phase is conceptually intuitive, it is rather nontrivial to efficiently carry it out, and the simple brute-force way introduces an n6 factor to the running time. Their approaches diverse completely in the second phase. Van Bevern et al. [3] used a complicated iterative compression procedure that has a very high time complexity, while van 't Hof and Villanger [17] showed that after the first phase, the problem is linear-time solvable. The main observation of van 't Hof and Villanger [17] is that a connected {claw, S3, S3, C4, C5, C6}-free graph is a proper circular-arc graph, whose definition is postponed to Section 2. In the conference presentation where Villanger first announced the result, it was claimed that this settles the edge deletion version as well. However, the claimed result has not been materialized: It appears neither in the conference version [28] (which has a single author) nor in the significantly revised and extended journal version [17]. Unfortunately, this unsubstantiated claim did get circulated. Although the algorithm of van 't Hof and Villanger [17] is nice and simple, its self-contained proof is excruciatingly complex. We revisit the relation between unit interval graphs and some subclasses of proper circular-arc graphs, and study it in a structured way. In particular, we observe that unit interval graphs are precisely those graphs that are both chordal graphs and proper Helly circular-arc graphs. As a matter of fact, unit interval graphs can also be viewed as "unit Helly interval graphs" or "proper Helly interval graphs," thereby making a natural subclass of proper Helly circular-arc graphs. The full containment relations are summarized in Fig. 2; the reader unfamiliar with some graph classes in this figure may turn to the appendix for a brief overview. These observations inspire us to show that a connected {claw, S3, S3, C4, C5}-free graph is a proper Helly circular-arc graph. It is easy to adapt the linear-time certifying recognition algorithms for proper Helly circular-arc graphs [22, 9] to detect an induced claw, S3, S3, C4, or C5 if one exists. Once all of them have been completely eliminated and the graph is a proper Helly circular-arc graph, it is easy to solve the unit interval vertex deletion problem in linear time. Likewise, using the structural properties of proper Helly circular-arc graphs, we can derive a linear-time algorithm for unit interval edge deletion on them. It is then straightforward to use simple branching to develop the parameterized algorithms stated in Theorem 1.1, though some nontrivial analysis is required to obtain the time bound for unit interval edge deletion. Van Bevern et al. [3] showed that the unit interval vertex deletion problem remains NP-hard on 2 u3u1v3u2v2v1v3v1u1u2v2u3 Figure 2: Containment relation of related graph classes. Normal Helly circular-arc ∩ Chordal = Interval. Proper Helly circular-arc ∩ Chordal = Unit Helly circular-arc ∩ Chordal = Unit interval. {claw, S3, S3}-free graphs. After deriving a polynomial-time algorithm for the problem on {claw, S3, S3, C4, C5, C6}-free graphs, van 't Hof and Villanger [17] asked for its complexity on {claw, S3, S3, C4}- free graphs. (It is somewhat intriguing that they did not mention the {claw, S3, S3, C4, C5}-free graphs.) Note that a {claw, S3, S3, C4}-free graph is not necessarily a proper (Helly) circular-arc graph, evidenced by the W5 (Fig. 1d). We answer this question by characterizing connected {claw, S3, S3, C4}-free graphs that are not proper Helly circular-arc graphs. We show that such a graph must be like a W5: If we keep only one vertex from each twin class (all vertices in a twin class have the same closed neighborhood) of the original graph, then we obtain a W5. It is then routine to solve the problem in linear time. Theorem 1.3. The problems unit interval vertex deletion and unit interval edge deletion can be solved in O(n + m) time on {claw, S3, S3, C4}-free graphs. We remark that the techniques we developed in previous work [8] can also be used to derive Theorems 1.1 and 1.2. Those techniques, designed for interval graphs, are nevertheless far more complicated than necessary when applied to unit interval graphs. The approach we used in the current work, i.e., based on structural properties of proper Helly circular-arc graphs, is tailored for unit interval graphs, hence simpler and more natural. Another benefit of this approach is that it enables us to devise a parameterized algorithm for the general modification problem to unit interval graphs, which allows all three types of operations. This formulation generalizes all the three single-type modifications, and is also natural from the viewpoint of the aforementioned applications for de-noising data, where different types of errors are commonly found coexisting. Indeed, the assumption that the input data contain only a single type of errors is somewhat counterintuitive. Formally, given a graph G, the unit interval editing problem asks whether there are a set V− of at most k1 vertices, a set E− of at most k2 edges, and a set E+ of at most k3 non-edges, such that the deletion of V− and E− and the addition of E+ make G a unit interval graph. We show that it is FPT, parameterized by the total number of allowed operations, k := k1 + k2 + k3. Theorem 1.4. The unit interval editing problem can be solved in time 2O(k log k) · (n + m). By and large, our algorithm for unit interval editing again uses the two-phase approach. However, we are not able to show that it can be solved in polynomial time on proper Helly circular-arc graphs. Therefore, in the first phase, we use brute force to remove not only claws, S3's, S3's, and C4's, also all holes of length at most k3 + 3. The high exponential factor in the running time is due to purely this phase. After that, every hole has length at least k3 + 4, and has to be fixed by deleting a vertex or edge. We manage to show that an inclusion-wise minimal solution of this reduced graph does not add edges, and the problem can then be solved in linear time. The study of general modification problems was initiated by Cai [7], who observed that the problem is FPT if the objective graph class has a finite number of minimal forbidden induced subgraphs. More challenging is thus to devise parameterized algorithms for those graph classes whose minimal forbidden induced subgraphs are infinite. Prior to this paper, the only known nontrivial graph class on which the general modification problem is FPT is the chordal graphs [10]. Theorem 1.4 extends this territory by including another well-studied graph class. As a corollary, Theorem 1.4 implies the fixed-parameter tractability of the unit interval edge editing problem, which allows both edge operations but not vertex deletions [6]. To see this we can simply try every combination of k2 and k3 as long as k2 + k3 does not exceed the given bound. 3 NormalHellyCircular-arcChordalProperHellyCircular-arcIntervalUnitHellyCircular-arcUnitinterval=Properinterval Organization. The rest of the paper is organized as follows. Section 2 presents combinatorial and algorithmic results on {claw, S3, S3, C4}-free graphs. Sections 3 and 4 present the algorithms for unit interval vertex deletion and unit interval edge deletion respectively (Theorems 1.1 -- 1.3). Section 5 extends them to solve the general editing problem (Theorem 1.4). Section 6 closes this paper by discussing some possible improvement and new directions. The appendix provides a brief overview of related graph classes as well as their characterizations by forbidden induced subgraphs. 2 {Claw, S3, S3, C4}-free graphs All graphs discussed in this paper are undirected and simple. A graph G is given by its vertex set V(G) and edge set E(G), whose cardinalities will be denoted by n and m respectively. All input graphs in this paper are assumed to be nontrivial (n > 1) and connected, hence n = O(m). For (cid:96) (cid:62) 4, we use C(cid:96) to denote a hole on (cid:96) vertices; if we add a new vertex to a C(cid:96) and make it adjacent to no or all vertices in the hole, then we end with a C∗(cid:96) or W(cid:96), respectively. For a hole H, we have V(H) = E(H), denoted by H. The complement graph G of a graph G is defined on the same vertex set V(G), where a pair of vertices u and v is adjacent if and only if uv (cid:54)∈ E(G); e.g., W5 = C∗5, and depicted in Fig. 1f is the complement of C6. An interval graph is the intersection graph of a set of intervals on the real line. A natural way to extend interval graphs is to use arcs and a circle in the place of intervals and the real line, and the intersection graph of arcs on a circle is a circular-arc graph. The set of intervals or arcs is called an interval model or arc model respectively, and it can be specified by their 2n endpoints. In this paper, all intervals and arcs are closed, and no distinct intervals or arcs are allowed to share an endpoint in the same model; these restrictions do not sacrifice any generality. In a unit interval model or a unit arc model, every interval or arc has length one. An interval or arc model is proper if no interval or arc in it properly contains another interval or arc. A graph is a unit interval graph, proper interval graph, unit circular-arc graph, or proper circular-arc graph if it has a unit interval model, proper interval model, unit arc model, or proper arc model, respectively. The forbidden induced subgraphs of unit interval graphs have been long known. Theorem 2.1 ([29]). A graph is a unit interval graph if and only if it contains no claw, S3, S3, or any hole. Clearly, any (unit/proper) interval model can be viewed as a (unit/proper) arc model leaving some point uncovered, and hence all (unit/proper) interval graphs are always (unit/proper) circular-arc graphs. A unit interval/arc model is necessarily proper, but the other way does not hold true in general. A well-known result states that a proper interval model can always be made unit, and thus these two graph classes coincide [26, 29].1 This fact will be heavily used in the present paper; e.g., most of our proofs consist in modifying a proper arc model into a proper interval model, which represents the desired unit interval graph. On the other hand, it is easy to check that the S3 is a proper circular-arc graph but not a unit circular-arc graph. Therefore, the class of unit circular-arc graphs is a proper subclass of proper circular-arc graphs. An arc model is Helly if every set of pairwise intersecting arcs has a common intersection. A circular-arc graph is proper Helly if it has an arc model that is both proper and Helly. Theorem 2.2 ([27, 22, 9]). A graph is a proper Helly circular-arc graph if and only if it contains no claw, S3, S3, W4, W5, C6, or C∗(cid:96) for (cid:96) (cid:62) 4. The following is immediate from Theorems 2.1 and 2.2. Corollary 2.3. If a proper Helly circular-arc graph is chordal, then it is a unit interval graph. From Theorems 2.1 and 2.2 one can also derive the following combinatorial result. But since we will prove a stronger result in Theorem 2.5 that implies it, we omit its proof here. Proposition 2.4. Every connected {claw, S3, S3, C4, C5}-free graph is a proper Helly circular-arc graph. Note that in Proposition 2.4, as well as most combinatorial statements to follow, we need the graph to be connected. Circular-arc graphs are not closed under taking disjoint unions. If a (proper Helly) circular-arc graph is not chordal, then it is necessarily connected. In other words, a disconnected (proper) circular-arc graph must be a (unit) interval graph. 1The reason we choose "unit" over "proper" in the title of this paper is twofold. On the one hand, the applications we are interested in are more naturally represented by unit intervals. On the other hand, we want to avoid the use of "proper interval subgraphs," which is ambiguous. 4 Proposition 2.4 can be turned into an algorithmic statement. We say that a recognition algorithm (for a graph class) is certifying if it provides a minimal forbidden induced subgraph of the input graph G when G is determined to be not in this class. Linear-time certifying algorithms for recognizing proper Helly circular-arc graphs have been reported by Lin et al. [22] and Cao et al. [9], from which one can derive a linear-time algorithm for detecting an induced claw, S3, S3, C4, or C5 from a graph that is not a proper Helly circular-arc graph. This would suffice for us to develop most of our main results. Even so, we would take pain to prove slightly stronger results (than Proposition 2.4) on F-free graphs, where F denotes the set {claw, S3, S3, C4}. The purpose is threefold. First, they enable us to answer the question asked by van 't Hof and Villanger [17], i.e., the complexity of unit interval vertex deletion on F-free graphs, thereby more accurately delimiting the complexity border of the problem. Second, as we will see, the disposal of C5's would otherwise dominate the second phase of our algorithm for unit interval edge deletion, so excluding them enables us to obtain better exponential dependency on k in the running time. Third, the combinatorial characterization might be of its own interest. A (true) twin class of a graph G is an inclusion-wise maximal set of vertices in which all have the same closed neighborhood. A graph is called a fat W5 if it has precisely six twin classes and it becomes a W5 after we remove all but one vertices from each twin class.2 By definition, vertices in each twin class induce a clique. The five cliques corresponding to hole in the W5 is the fat hole, and the other clique is the hub, of this fat W5. Theorem 2.5. Let G be a connected graph. (1) If G is F-free, then it is either a fat W5 or a proper Helly circular-arc graph. (2) In O(m) time we can either detect an induced subgraph of G in F, partition V(G) into six cliques constituting a fat W5, or build a proper and Helly arc model for G. Proof. We prove only assertion (2) using the algorithm described in Fig. 3, and its correctness implies assertion (1). The algorithm starts by calling the certifying algorithm of Cao et al. [9] for recognizing proper Helly circular-arc graphs (step 0). It enters one of steps 1 -- 4, or 6 based on the outcome of step 0. Here the subscripts of vertices in a hole C(cid:96) should be understood to be modulo (cid:96). If the condition of any of steps 1 -- 4 is satisfied, then either a proper and Helly arc model or a subgraph in F is returned. The correctness of steps 1 -- 3 is straightforward. Step 4.1 can find the path because G is connected; possibly v = x, which is irrelevant in steps 4.2 -- 4.4. Note also that (cid:96) > 4 in step 4. By Theorem 2.2, the algorithm passes steps 1 -- 4 only when the outcome of step 0 is a W5; let H be its hole and let v be the other vertex. Steps 5 -- 7 either detect an induced subgraph of G in F or partition V(G) into six cliques constituting a fat W5. Step 6 scans vertices not in the W5 one by one, and proceeds based on the adjacency between x and H. In step 6.1, H and x make a C∗5, which means that we can proceed exactly the same as step 4. Note that the situation of step 6.4 is satisfied if x is adjacent to four vertices of H. If none of the steps 6.1 to 6.5 applies, then x has precisely three neighbors in H and they have to be consecutive. This is handled by step 6.6. Steps 0 and 4 take O(m) time. Steps 1, 2, 3, 5, and 7 need only O(1) time. If the condition in step 6.1 is true, then it takes O(m) time but it always terminates the algorithm after applying it. Otherwise, step 6.1 is never called, and the rest of step 6 scans the adjacency list of each vertex once, and hence takes O(m) time in total. Therefore, the total running time of the algorithm is O(m). This concludes the proof. Implied by Theorem 2.5, a connected {claw, S3, S3, C4, W5}-free graph is a proper Helly circular-arc graph, which in turns implies Proposition 2.4. At this point a natural question appealing to us is the relation between connected {claw, S3, S3, C4, C5}-free graphs and unit Helly circular-arc graphs. Recall that the class of unit interval graphs is a subclass of unit Helly circular-arc graphs, on which we have a similar statement as Corollary 2.3, i.e., a unit Helly circular-arc graph that is chordal is a unit interval graph. However, a connected {claw, S3, S3, C4, C5}-free graph that is not a unit Helly circular-arc graph can be constructed as follows: Starting from a C(cid:96) with (cid:96) (cid:62) 6, for each edge hihi+1 in the hole add a new vertex vi and two new edges vihi, vihi+1. (This is actually the CI((cid:96), 1) graph defined by Tucker [27]; see also [22].) Therefore, Proposition 2.4 and Theorem 2.5 are the best we can expect in this sense. 2Interestingly, in the study of proper circular-arc graphs that are chordal, Bang-Jensen and Hell [1] showed that if a connected {claw, S3, C4, C5}-free graph contains an S3, then it must be a fat S3, which is defined analogously as a fat W5. 5 Algorithm recognize-F-free(G) Input: a connected graph G. Output: a proper and Helly arc model, a subgraph in F, or six cliques making a fat W5. call the recognition algorithm for proper Helly circular-arc graphs [9]; if a proper and Helly arc model A is found then return it; if a claw, S3, or S3 is found then return it; if a W4, C∗4, or C6 is found then return a C4 contained in it; if a C∗(cid:96) with hole H and isolated vertex v is found then use breadth-first search to find a shortest path v··· xyhi from v to H; if y has a single neighbor hi in H then return claw {hi, y, hi−1, hi+1}; if y has only two neighbors on H that are consecutive, say, {hi, hi+1} then return claw {y, x, hj, hj(cid:48) }, where hj, hj(cid:48) are two nonadjacent vertices in N[y] ∩ H; return S3 {x, y, hi−1, hi, hi+1, hi+2}; 4.4. \\ The outcome of step 0 must be a W5; let it be H and v. All subscripts of hi and Ki are modulo 5. 5. K0 ← {h0};K1 ← {h1};K2 ← {h2}; K3 ← {h3};K4 ← {h4};Kv ← {v}; 6. 6.1. 6.2. 6.3. if x is not adjacent to H then similar as step 4 (H and x make a C∗5); if x has a single neighbor hi in H then return claw {hi, x, hi−1, hi+1}; if x is only adjacent to hi, hi+1 in H then for each vertex x not in the W5 do if xv ∈ E(G) then return claw {v, hi−1, hi+2, x}; else return S3 {x, hi, hi+1, hi−1, v, hi+2}; 0. 1. 2. 3. 4. 4.1. 4.2. 4.3. 6.4. 6.5. 6.6. 7. else if x is adjacent to hi−1, hi+1 but not hi then return xhi−1hihi+1 as a C4; if x is adjacent to all vertices in H then if xy (cid:54)∈ E(G) for some y ∈ Kv or Ki then return xhi−1yhi+1 as a C4; else add x to Kv; if xy (cid:54)∈ E(G) for some y ∈ Ki or Kv then return xhi−1yhi+1 as a C4; if xy (cid:54)∈ E(G) for some y ∈ Ki−1 then return claw {v, y, hi+2, x}; if xy (cid:54)∈ E(G) for some y ∈ Ki+1 then return claw {v, hi−2, y, x}; if xy ∈ E(G) for some y ∈ Ki−2 then return xhi+1hi+2y as a C4; if xy ∈ E(G) for some y ∈ Ki+2 then return xhi−1hi−2y as a C4; else add x to Ki; \\x is adjacent to all vertices in the six cliques. \\ Hereafter N(x) ∩ H = 3; let them be hi−1, hi, hi+1. \\Kv, Ki−1, Ki, Ki+1 ⊆ N(x) and Ki−2, Ki+2 ∩ N(x) = ∅. return the six cliques. Figure 3: Recognizing F-free graphs. Note that a C4 is a proper Helly circular-arc graph. Thus, the algorithm of Theorem 2.5 is not yet a certifying algorithm for recognizing F-free graphs. To detect an induced C4 from a proper Helly circular- arc graph, we need to exploit its arc model. If a proper Helly circular-arc graph G is not chordal, then the set of arcs for vertices in a hole necessarily covers the circle, and it is minimal. Interestingly, the converse holds true as well -- note that this is not true for chordal graphs. Proposition 2.6. [22, 9] Let G be a proper Helly circular-arc graph. If G is not chordal, then at least four arcs are needed to cover the whole circle in any arc model for G. Proposition 2.6 forbids among others two arcs from having two-part intersection.3 Corollary 2.7. Let G be a proper Helly circular-arc graph that is not chordal and let A be an arc model for G. A set of arcs inclusion-wise minimally covers the circle in A if and only if the vertices represented by them induce a hole of G. Therefore, to find a shortest hole from a proper Helly circular-arc graph, we may work on an arc model of it, and find a minimum set of arcs covering the circle in the model. This is another important step of our algorithm for the unit interval editing problem. It has the detection of C4's as a special case, because a C4, if existent, must be the shortest hole of the graph. 3A model having no such intersection is called normal; see the appendix for more discussion. 6 Lemma 2.8. There is an O(m)-time algorithm for finding a shortest hole of a proper Helly circular-arc graph. Before proving Lemma 2.8, we need to introduce some notation. In an interval model, the interval I(v) for vertex v is given by [lp(v), rp(v)], where lp(v) and rp(v) are its left and right endpoints respectively. It always holds lp(v) < rp(v). In an arc model, the arc A(v) for vertex v is given by [ccp(v), cp(v)], where ccp(v) and cp(v) are its counterclockwise and clockwise endpoints respectively. All points in an arc model are assumed to be nonnegative; in particular, they are between 0 (inclusive) and (cid:96) (exclusive), where (cid:96) is the perimeter of the circle. We point out that possibly ccp(v) > cp(v); such an arc A(v) necessarily passes through the point 0. Note that rotating all arcs in the model does not change the intersections among them. Thus we can always assume that a particular arc contains or avoids the point 0. We say that an arc model (for an n-vertex circular-arc graph) is canonical if the perimeter of the circle is 2n, and every endpoint is a different integer in {0, 1, . . . , 2n − 1}. Given an arc model, we can make it canonical in linear time: We sort all 2n endpoints by radix sort, and replace them by their indices in the order. Let G be a non-chordal graph and let A be a proper and Helly arc model for G. Each point α in an interval model I or arc model A defines a clique, denoted by KI(α) or KA(α) respectively, which is the set of vertices whose intervals or arcs contain α. There are at most 2n distinct cliques defined as such. If the model is Helly, then they include all maximal cliques of this graph [15]. Since the set of endpoints is finite, for any point ρ in an interval or arc model, we can find a small positive value  such that there is no endpoint in [ρ − , ρ) ∪ (ρ, ρ + ], -- in other words, there is an endpoint in [ρ − , ρ + ] if and only if ρ itself is an endpoint. Note that the value of  should be understood as a function, depending on the interval/arc model as well as the point ρ, instead of a constant. If uv ∈ E(G), then exactly one of ccp(v) and cp(v) is contained in A(u) (Proposition 2.6). Thus, we can define a "left-right relation" for each pair of intersecting arcs, which can be understood from the viewpoint of an observer placed at the center of the model. We say that arc A(v) intersects arc A(u) from the left when cp(v) ∈ A(u), denoted by v → u. Any set of arcs whose union is an arc not covering the circle (the corresponding vertices induce a connected unit interval graph) can be ordered in a unique way such that vi → vi+1 for all i. From it we can find the leftmost (most counterclockwise) and rightmost (most clockwise) arcs. For any vertex v, let h(v) denote the length of the shortest holes through v, which is defined to be +∞ if no hole of G contains v. The following is important for the proof of Lemma 2.8. Lemma 2.9. Let A be a proper and Helly arc model for a non-chordal graph G. Let v1, v2, . . . , vp be a sequence of vertices such that for each i = 2, . . . , p, the arc A(vi) is the rightmost of all arcs containing cp(vi−1). If v1 is contained in some hole and viv1 (cid:54)∈ E(G) for all 2 < i (cid:54) p, then there is a hole of length h(v1) containing v1, v2, . . . , vp as consecutive vertices on it. Proof. Suppose that there is no such a hole, then there exists a smallest number i with 2 (cid:54) i (cid:54) p such that no hole of length h(v1) contains v1, v2, . . . , vi. By assumption, there is a hole v1 ··· vi−1uiui+1 ··· uh(v1) of length h(v1) with ui (cid:54)= vi; let it be H. In case that i = 2, we assume that H is given in the way that v1 → u2. By Corollary 2.7, the set of arcs for H cover the circle in A. Since vi−1 → ui and by the assumption on vi, the arc A(vi) covers [cp(vi−1), ccp(ui+1)] (note that i < h(v1) as otherwise vi → v1). Therefore, the arcs for V(H) \ {ui} ∪ {vi} cover the circle as well. By Corollary 2.7, a subset of these vertices induces a hole; since vi is not adjacent to v1 from the left, this subset has to contain v1. But a hole containing v1 cannot be shorter than H, and hence it contains v1, . . . , vi, a contradiction. Therefore, such an i does not exist, and there is a hole of length h(v1) containing v1, v2, . . . , vp. Since vj and vj+1 are adjacent for all 1 (cid:54) j (cid:54) p − 1, vertices v1, v2, . . . , vp have to be consecutive on this hole. Let α be any fixed point in a proper and Helly arc model. According to Corollary 2.7, every hole needs to visit some vertex in KA(α). Therefore, to find a shortest hole in G, it suffices to find a hole of length min{h(x) : x ∈ KA(α)}. Proof of Lemma 2.8. The algorithm described in Fig. 4 finds a hole of length min{h(x) : x ∈ KA(cp(v) + 0.5)}. Step 1 creates KA(cp(v) + 0.5) arrays, each starting with a distinct vertex in KA(cp(v) + 0.5), and they are ordered such that their (counter)clockwise endpoints are increasing. The main job of this algorithm is done in step 3. During this step, w is the new vertex to be processed, and U is the current array. Each new vertex is added to at most one array, while each array is either dropped or extended. We use ⊥ as a dummy vertex, which means that no new vertex has been met after the last one has been put into the previous array. Step 3.1 records the last scanned arc. Once the clockwise endpoint of the last vertex z of the current array U is met, w is appended to U (step 3.4); note that A(w) is the most 7 Algorithm shortest-hole(G, A) Input: a proper and Helly arc model A for a non-chordal graph G. Output: a shortest hole of G. for i = 1, . . . , cp(v) − 1 do if i is ccp(x) then create a new array {x}; for i = cp(v) + 1, . . . , 2n − 1 do 0. make A canonical where 0 is ccp(v) for some v; 1. 1.1. \\ these arrays are circularly linked so that the next of the last array is the first one. 2. w ← ⊥; U ← the first array; 3. z ← the last vertex of U; 3.0. if i is ccp(x) then w ← x; continue†; 3.1. if i (cid:54)= cp(z) then continue; 3.2. if w = ⊥ then delete U; U ← the next array of U; 3.3. if w (cid:54)= ⊥ then append w to U; w ← ⊥; U ← the next array of U; 3.4. 4. 4.1. 5. †: i.e., ignore the rest of this iteration of the for-loop and proceed to the next iteration. for each U till the last array do return U ∪ {v}. if the first and last vertices of U are adjacent then return U; \\U is the last array. Figure 4: Finding a shortest hole in a proper Helly circular-arc graph. clockwise arc that contains cp(z). On the other hand, if w = ⊥, then we drop this array from further consideration (step 3.3). If after step 3, one of the arrays already induces a hole (i.e., the first and last vertices are adjacent), then it is returned in step 4.1. Otherwise, U does not induces a hole, and step 5 returns the hole induced by U and v. min{h(x) : x ∈ KA(cp(v) + 0.5)}. The following hold for each array U: (1) For any pair of consecutive vertices u, w of U, the arc A(w) is the rightmost of all arcs containing We now verify the correctness of the algorithm. It suffices to show that the length of the found hole is cp(u). (2) At the end of the algorithm, if U is not dropped, then 0 < cp(z) < cp(v), where z is the last vertex of U. Let v1, v2, . . . , vp be the vertices in U. From (1) and (2) it can be inferred that for 1 < i < p, the vertex vi is adjacent to only vi−1, vi+1 in U, while v1 and vp may or may not be adjacent. If v1vp ∈ E(G), then vertices in U induce a hole of G; otherwise U ∪ {v} induces a hole of G. By Lemma 2.9, this hole has length h(v1). Some of the KA(cp(v) + 0.5) arrays created in step 1 may be dropped in step 3. Note that step 3 processes arrays in a circular order starting from the first one, and each array is either deleted (step 3.3) or extended by adding one vertex (step 3.4). (3) At any moment of the algorithm, the sizes of any two arrays differ by at most one. In particular, at the end of step 3, if the current array U is not the first, then U, as well as all the succeeding arrays, has one less element than its predecessor(s). This ensures that the hole returned in step 4.1 or 5 is the shortest among all the holes decided by the remaining arrays after step 3. It remains to argue that for any array U deleted in step 3.3, the found hole is not longer than h(x), where x is the first vertex of U. All status in the following is referred at the moment before U is deleted (i.e., before step 3.3 that deletes U). Let z be the last vertex of U. Let U(cid:48) be the array that is immediately preceding U, and let z(cid:48) be its last vertex. Note that there is no arc with a counterclockwise endpoint between cp(z(cid:48)) and cp(z), as otherwise w (cid:54)= ⊥ and U would not be deleted. Therefore, any arc intersecting A(z) from the right also intersects A(z(cid:48)) from the right. By Lemma 2.9, there is a hole H that has length h(x) and contains U ∪ {z(cid:48)}. We find a hole through U(cid:48) of the same length as follows. If U is not the first array, then U(cid:48) = U + 1, and we replace U ∪ {z(cid:48)} by U(cid:48). Otherwise, U(cid:48) = U, and we replace U ∪ {z(cid:48)} by {v} ∪ U(cid:48). It is easy to verify that after this replacement, H remains a hole of the same length. 8 We now analyze the running time of the algorithm. Each of the 2n endpoints is scanned once, and each vertex belongs to at most one array. Using a linked list to store an array, the addition of a new vertex can be implemented in constant time. Using a circularly linked list to organize the arrays, we can find the next array or delete the current one in constant time. With the (endpoints of) all arcs given, the adjacency between any pair of vertices can be checked in constant time, and thus step 4 takes O(n) time. It follows that the algorithm can be implemented in O(m) time. 3 Vertex deletion We say that a set V− of vertices is a hole cover of G if G − V− is chordal. The hole covers of proper Helly circular-arc graphs are characterized by the following lemma. Lemma 3.1. Let A be a proper and Helly arc model for a non-chordal graph G. A set V− ⊆ V(G) is a hole cover of G if and only if it contains KA(α) for some point α in A. Proof. For any vertex set V−, the subgraph G − V− is also a proper Helly circular-arc graph, and the set of arcs {A(v) : v ∈ V(G) \ V−} is a proper and Helly arc model for G − V−. For the "if" direction, we may rotate A to make α = 0, and then setting I(v) = A(v) for each v ∈ V(G) \ V− gives a proper interval model for G − V−. For the "only if" direction, note that if there is no α with KA(α) ⊆ V−, then we can find v∈X A(v) covers the whole circle in A. According a minimal set X of vertices from V(G) \ V− such that(cid:83) to Corollary 2.7, X induces a hole of G, which remains in G − V−. Noting that any "local" part of a proper and Helly arc model "behaves similarly" as an interval model, Lemma 3.1 is an easy extension of the clique separator property of interval graphs [14]. On the other hand, to get a unit interval graph out of a fat W5, it suffices to delete a smallest clique from the fat hole. Therefore, Theorem 2.5 and Lemma 3.1 imply the following linear-time algorithm. Corollary 3.2. The unit interval vertex deletion problem can be solved in O(m) time (1) on proper Helly circular-arc graphs and (2) on F-free graphs. We are now ready to prove the main results of this section. Theorem 3.3. There are an O(6k · m)-time parameterized algorithm for the unit interval vertex deletion problem and an O(nm)-time approximation algorithm of approximation ratio 6 for its minimization version. Proof. Let (G, k) be an instance of unit interval vertex deletion; we may assume that G is not a unit interval graph and k > 0. The parameterized algorithm calls first Theorem 2.5(2) to decide whether it has an induced subgraph in F, and then based on the outcome, it solves the problem by making recursive calls to itself, or calling the algorithm of Corollary 3.2. If an induced subgraph F in F is found, it calls itself V(F) times, each with a new instance (G − v, k − 1) for some v ∈ V(F); since we need to delete at least one vertex from V(F), the original instance (G, k) is a yes-instance if and only if at least one of the instances (G − v, k − 1) is a yes-instance. Otherwise, G is F-free and the algorithm calls Corollary 3.2 to solve it. The correctness of the algorithm follows from discussion above and Corollary 3.2. On each subgraph in F, which has at most 6 vertices, at most 6 recursive calls are made, all with parameter value k − 1. By Theorem 2.5, each recursive call is made in O(m) time; each call of Corollary 3.2 takes O(m) time. Therefore, the total running time is O(6k · m). The approximation algorithm is adapted from the parameterized algorithm as follows. For the subgraph F found by Theorem 2.5, we delete all its vertices. We continue the process until the remaining graph is F-free, and then we call Corollary 3.2 to solve it optimally. Each subgraph in F has 4 or 6 vertices, and thus at most n/4 such subgraphs can be detected and deleted, each taking O(m) time, hence O(nm) in total. Corollary 3.2 takes another O(m) time. The total running time is thus O(nm) + O(m) = O(nm), and the approximation ratio is clearly 6. 4 Edge deletion Inspired by Lemma 3.1, one may expect a similarly nice characterization -- being "local" to some point in an arc model for G -- for a minimal set of edges whose deletion from a proper Helly circular-arc graph G makes it chordal. This is nevertheless not the case; as shown in Fig. 5, they may behave in a very strange or pathological way. 9 Figure 5: The set of all 30 edges (both solid and dashed) spans a proper Helly circular-arc graph. After the set of 19 dashed edges deleted (we rely on the reader to verify its minimality), the re- maining graph on the 11 solid edges is a unit interval graph. Note that four edges would suffice, e.g., {u2u3, u2v3, v2u3, v2v3}. Recall that v → u means arc A(v) intersecting arc A(u) from the left, or cp(v) ∈ A(u). For each point α in a proper and Helly arc model A, we can define the following set of edges: −→ E A(α) = {vu : v ∈ KA(α), u (cid:54)∈ KA(α), v → u}. (1) −→ E A(α) as {vu : v (cid:54)∈ KA(β), u ∈ KA(β), v → u}, where β := max{cp(x) : x ∈ One may symmetrically view KA(α)} + . It is easy to verify that the following gives a proper interval model for G − −→ E A(0): (cid:14) I(v) := [ccp(v), cp(v) + (cid:96)] [ccp(v), cp(v)] if v ∈ KA(0), otherwise, where (cid:96) is the perimeter of the circle in A; see Fig. 6. For an arbitrary point α, the model G − be given analogously, e.g., we may rotate the model first to make α = 0. (2) −→ E A(α) can (a) An arc model for G. (b) The interval model for G − −→E A(α) given by (2). Figure 6: Illustration for Proposition 4.1. Proposition 4.1. Let A be a proper and Helly arc model for a non-chordal graph G. For any point α in A, the subgraph G − −→ E A(α) is a unit interval graph. The other direction is more involved and very challenging. A unit interval graph G is called a spanning unit interval subgraph of G if V(G) = V(G) and E(G) ⊆ E(G); it is called maximum if it has the largest number of edges among all spanning unit interval subgraphs of G. To prove that all maximum spanning unit interval subgraphs have a certain property, we use the following argument by contradiction. Given a spanning unit interval subgraph G not having the property, we locally modify a unit interval model I for G to a proper interval model I(cid:48) such that the represented graph G(cid:48) satisfies E(G(cid:48)) ⊆ E(G) and E(G(cid:48)) > E(G). Recall that we always select  in a way that there cannot be any endpoint in [ρ − , ρ) ∪ (ρ, ρ + ], and thus an arc covering ρ +  or ρ −  must contain ρ. Lemma 4.2. Let A be a proper and Helly arc model for a non-chordal graph G. For any maximum spanning unit interval subgraph G of G, the deleted edges, E(G) \ E(G), are −→ E A(ρ) for some point ρ in A. Proof. Let I be a unit interval model for G, and let E− = E(G) \ E(G), i.e., the set of deleted edges from G. We find first a vertex v satisfying at least one of the following conditions. (C1) The sets NG[v] and KA(ccp(v) − ) are disjoint and all edges between them are in E−. (C2) The sets NG[v] and KA(cp(v) + ) are disjoint and all edges between them are in E−. Recall that a vertex u ∈ KA(ccp(v) − ) if and only if u → v, and a vertex w ∈ KA(cp(v) + ) if and only if v → w; see Fig. 7a. These two conditions imply NG[v] ⊆ KA(cp(v)) and NG[v] ⊆ KA(ccp(v)) 10 u1u2u3u4u5u6v1v2v3v4v5v6α(0)β0' (b) (d) (c) (e) Figure 7: Illustration for the proof of Lemma 4.2. respectively: All edges between v itself, which belongs to NG[v], and KA(ccp(v) − ) or KA(cp(v) + ) are in E−. Let I(v0) be the leftmost interval in I. Note that by Proposition 2.6, arcs for NG[v0] cannot cover the whole circle. If NG[v0] is a separate component in G, then we can take v to be the vertex from NG[v0] with the leftmost arc; it satisfies condition (C1). Otherwise, let I(u) be the last interval containing rp(v0) and let I(u(cid:48)) be the next interval (i.e., I(u(cid:48)) is the leftmost interval that does not intersect I(v0)). See Fig. 7b. Intervals I(u) and I(u(cid:48)) intersect (NG[v0] is not isolated), but v0u(cid:48) (cid:54)∈ E(G) because G is maximum: Moving I(v0) to the right to intersect I(u(cid:48)) would otherwise make a unit interval model that represents a subgraph of G having one more edge than G. • If u(cid:48) → u, then u(cid:48) → u → v0. We argue by contradiction that there cannot be vertices v(cid:48) ∈ KA(cp(v0) + ) and w (cid:54)∈ NG(v0) with uv(cid:48), v(cid:48)w ∈ E(G). If uv(cid:48) ∈ E(G) ⊆ E(G), then by the position of A(v0), we must have u → v(cid:48) and v0 → v(cid:48). Then v0u(cid:48) (cid:54)∈ E(G) excludes the possibility u(cid:48) → v(cid:48); on the other hand, v(cid:48) → u(cid:48) is excluded by Proposition 2.6: The arcs for u(cid:48), u, v(cid:48) cannot cover the whole circle. Therefore, v(cid:48)u(cid:48) (cid:54)∈ E(G), and likewise uw (cid:54)∈ E(G). They cannot be in E(G) either, but this is impossible; See Fig. 7b. Let v be the vertex in NG[v0] such that A(v) is the rightmost; it satisfies condition (C2). • If u → u(cid:48), then v0 → u → u(cid:48). Similarly as above, the vertex v in NG[v0] such that A(v) is the leftmost satisfies condition (C1). Noting that conditions (C1) and (C2) are symmetric, we assume that the vertex v found above satisfies condition (C2), and a symmetric argument would apply to condition (C1). Note that by the selection of v, which has the leftmost arc among NG[v0], we have NG[v] ⊆ NG[v(cid:48)] for every v(cid:48) satisfying lp(v(cid:48)) < lp(v); thus setting their intervals to be [lp(v) + , rp(v) + ] would produce another unit interval model for G. In the rest of the proof we may assume without loss of generality that I(v) is the first interval in I. Since the model A is proper and Helly, no arc in A can contain both ccp(v) and cp(v) + . In other −→ E A(ccp(v)) comprises precisely edges between −→ E A(ccp(v)). If KA(ccp(v)) is not adjacent to KA(cp(v) + ) −→ E A(ccp(v)) ⊆ E−, and they have to be equal. In this case the proof is complete: ρ = ccp(v). words, KA(ccp(v)) and KA(cp(v) + ) are disjoint, and them; see Fig. 7a. By Proposition 4.1, E− (cid:54) in G, then We are hence focused on edges between KA(ccp(v)) and KA(cp(v) + ). Claim 1. Let u ∈ KA(ccp(v)). If u is adjacent to KA(cp(v) + ) in G, then I(u) does not intersect the intervals for NG[v]. 11 uvwcp(v)+ccp(v)(a)v0vuu0v0wvu0uwy0yvuww0lp(u)rp(u)vuwu0w0lp(w0)rp(u0) Proof. Recall that uv /∈ E(G) by condition (C2) and the fact that u is adjacent to KA(cp(v) + ) in G. Let u(cid:48) be the vertex in NG[v] with the rightmost interval, and let I(y) be the leftmost interval not intersecting I(v). Note that vy (cid:54)∈ E(G): Otherwise moving I(v) to the right to intersect I(y) would make a unit interval model that represents a subgraph of G with one more edge than G. Suppose to the contrary of this claim that I(u) intersects some interval for NG[v], then it intersects I(u(cid:48)). See Fig. 7c. Since v satisfies condition (C2) and by Proposition 2.6, u(cid:48) → v and y → u, u(cid:48). Let w be the vertex in KA(cp(v) + ) that has the leftmost interval. Since v satisfies condition (C2), lp(w) > rp(u(cid:48)); by the assumption that u is adjacent to KA(cp(v) + ) in G, we have lp(w) < rp(u). By Proposition 2.6, yw (cid:54)∈ E(G). Let A(y(cid:48)) be the leftmost arc such that y(cid:48) ∈ KA(ccp(u)) and I(y(cid:48)) lies in (rp(v), lp(w)); this vertex exists because y itself is a candidate for it. Again by Proposition 2.6, y(cid:48)w (cid:54)∈ E(G). Let X denote the set of vertices x with lp(x) < lp(w). We make a new interval model by resetting intervals for these vertices. Since every vertex in X is adjacent to at least one of u and u(cid:48), by Proposition 2.6, the union of arcs for X do not cover the circle in A. These arcs can thus be viewed as a proper interval model for G[X]. The new intervals for X, adapted from these arcs, are formally specified as follows. The left endpoint of each x ∈ X is set as lp(cid:48)(x) = lp(w) − (ccp(w) − ccp(x)). For each vertex x ∈ X \ NG(w), we set I(cid:48)(x) = [lp(w) − (ccp(w) − ccp(x)), lp(w) − (ccp(w) − cp(x))]. By the selection of w, we have x → w for all x ∈ X ∩ NG(w). Arcs for X ∩ NG(w) are thus pairwise intersecting; by Proposition 2.6, they cannot cover the whole circle. We can thus number vertices in X ∩ NG(w) as u1, . . . , up such that ui → ui+1 for each i = 1, . . . , p − 1. Their right endpoints are set as (cid:8) (cid:8) (cid:9) (cid:9) rp(cid:48)(u1) = max rp(cid:48)(ui) = max lp(w) + , rp(u1) rp(cid:48)(ui−1) + , rp(ui) , and for i = 2, . . . , p. Let I(cid:48) denote the resulting new interval model. To see that I(cid:48) is proper, note that (a) no new interval can contain or be contained by an interval I(z) for z ∈ V(G) \ X; and (b) the left and right endpoints of the intervals for X have the same ordering as the counterclockwise and clockwise endpoints of the arcs {A(x) : x ∈ X}, hence necessarily proper. Let G(cid:48) denote the proper interval graph represented by I(cid:48). We want to argue that E(G) ⊂ E(G(cid:48)) ⊆ E(G), which would contradict that G is a maximum unit interval subgraph of G, and conclude the proof of this claim. By construction, G(cid:48) − X is the same as G − X, while G(cid:48)[X] is the same as G[X]. Thus, we focus on edges between X and V(G) \ X, which are all incident to X ∩ NG(w). For each i = 1, . . . , p, we have rp(cid:48)(ui) (cid:62) rp(ui), and thus E(G) ⊆ E(G(cid:48)); on the other hand, they are not equal because uv ∈ E(G(cid:48))\E(G). We show by induction that for every i = 1, . . . , p, the edges incident to ui in G(cid:48) is a subset of G. The base case is clear: NG(cid:48) (u1) \ X is either {w} or NG(u1) \ X. For the inductive step, if rp(cid:48)(ui) = rp(ui), then NG(cid:48) (ui) \ X = NG(ui) \ X ⊆ NG(ui); otherwise, NG(cid:48) (ui) \ X ⊆ NG(ui−1) \ X, which is a subset of NG(ui) because ui−1 → ui. This verifies E(G(cid:48)) ⊆ E(G). (cid:121) We consider then edges deleted from each vertex in KA(ccp(v)), i.e., edges in E− that is incident to KA(ccp(v)). Claim 2. Let u ∈ KA(ccp(v)). If u is adjacent to KA(cp(v) + ) in G, then there are strictly more edges incident to u in E− than in −→ E A(ccp(v)) (i.e., between u and KA(cp(v) + ).). −→ E A(ccp(v)). In Proof. The vertices in NG(u) consists of three parts, NG[v], those in KA(cp(v) + ), and others. By Claim 1, −→ edges between u and all vertices in NG[v] are in E−; they are not in E A(ccp(v)). All edges between u −→ E A(ccp(v)) there is no edge between u and the other vertices. and KA(cp(v) + ) are in Therefore, to show the claim, it suffices to show NG[u] ∩ KA(cp(v) + ) (cid:54) NG(v) < NG[v]. Let uw be an edge of G with w ∈ KA(cp(v) + ). Since v satisfies condition (C2), both uv and vw are in E−. We show only the case that I(w) intersects I(u) from the right; a similar argument works for the other case: Note that all the intervals used below are disjoint from I(v). Consider first that there exists another vertex w(cid:48) ∈ KA(cp(v) + ) with interval I(w(cid:48)) intersecting I(u) from the left. See Fig. 7d. Any interval that intersects I(u) necessarily intersects at least one of I(w) and I(w(cid:48)), and thus by Proposition 2.6, its vertex must be in NG(v). As a result, setting I(v) to [lp(u) − , rp(u) − ] gives another proper interval model and it represents a subgraph of G. Since G is maximum, we can conclude NG[u] (cid:54) NG(v) < NG[v]. In this case the proof of this claim is concluded. In the second case there is no vertex in KA(cp(v) + ) whose interval intersects I(u) from the left. Note that every interval intersecting [lp(w), rp(u)] represents a vertex in NG[v]. Let w(cid:48) be vertex in 12 KA(cp(v)) ∩ KI(rp(u)) that has the leftmost interval, and let u(cid:48) be vertex in KA(ccp(v)) ∩ KI(lp(w)) that has the rightmost interval; these two vertices exist because u and w are candidates for them, respectively. See Fig. 7e. There cannot be any vertex whose interval contains [lp(w(cid:48)), rp(u(cid:48))]: Such a vertex, if it exists, is in NG(v), but then it contradicts the selection of u(cid:48) and w(cid:48). Also by the selection of u(cid:48) and w(cid:48), no interval contains [lp(w(cid:48)) − , rp(u(cid:48)) + ]. Thus, setting I(v) to [lp(w(cid:48)) − , rp(u(cid:48)) + ] gives another proper interval model and it represents a subgraph of G. Since G is maximum, we can conclude NG[u] ∩ KA(cp(v) + ) (cid:54) NG(v) < NG[v]. (cid:121) Therefore, for every vertex u ∈ KA(ccp(v)), there are no less edges incident to u in E− than in −→ E A(ccp(v)). Moreover, as there is at least one vertex in KA(ccp(v)) adjacent to KA(cp(v)+) in G, (noting −→ that no edge in E A(ccp(v)), contradicting that G is a maximum unit interval subgraph of G. −→ E A(ccp(v)) is incident to two vertices in KA(ccp(v)),) it follows that E− > It is worth stressing that a thinnest place in an arc model with respect to edges is not necessarily a thinnest place with respect to vertices; see Fig. 8 for an example. There is a linear number of different places to check, and thus the edge deletion problem can also be solved in linear time on proper Helly circular-arc graphs. The problem is also simple on fat W5's. Figure 8: The thinnest points for vertices and edges are α and β respectively: KA(α) = 2 < KA(β) = 3; while −→ E A(α) = 8 > −→ E A(β) = 6. Theorem 4.3. The unit interval edge deletion problem can be solved in O(m) time (1) on proper Helly circular-arc graphs and (2) on F-free graphs. Proof. For (1), we may assume that the input graph G is not an unit interval graph; according to Corollary 2.3, it is not chordal. We build a proper and Helly arc model A for G; without loss of generality, assume that it is canonical. According to Lemma 4.2, the problem reduces to finding a point α in A such −→ E A(α) is minimized. It suffices to consider the 2n points i + 0.5 for i ∈ {0, . . . , 2n − 1}. We calculate that −→ −→ E A(0.5), and then for i = 1, . . . , 2n − 1, we deduce first E A(i − 0.5) as follows. If i is a −→ clockwise endpoint of some arc, then E A(i − 0.5). Otherwise, i = ccp(v) for some vertex −→ E A(i − 0.5) is the set of edges incident to v. In particular, v, then the difference between −→ −→ {uv : u → v} = E A(i − 0.5) \ E A(i − 0.5). Note that −→ the initial value E A(0.5) can be calculated in O(m) time, and then each vertex and its adjacency list is scanned exactly once. It follows that the total running time is O(m). −→ E A(i + 0.5) and −→ E A(i + 0.5), while {uv : v → u} = −→ E A(i + 0.5) \ −→ E A(i + 0.5) from −→ E A(i + 0.5) = For (2), we may assume that the input graph G is connected, as otherwise we work on its components one by one. According to Theorem 2.5(1), G is either a proper Helly circular-arc graph or a fat W5. The former case has been considered above, and now assume G is a fat W5. Let K0, . . . , K4 be the five cliques in the fat hole, and let K5 be the hub. We may look for a maximum spanning unit interval subgraph G of G such that NG[u] = NG[v] for any pair of vertices u, v in Ki, where i ∈ {0, . . . , 5}. We now argue the existence of such a subgraph. By definition, NG[u] = NG[v]. Let G(cid:48) be a maximum spanning unit interval subgraph of G where NG(cid:48) [u] (cid:54)= NG(cid:48) [v], and assume without loss of generality, NG(cid:48) [u] (cid:62) NG(cid:48) [v]. We may change the deleted edges that are incident to v to make another subgraph where v has the same neighbors as NG(cid:48) [u]; this graph is clearly a unit interval graph and has no less edges than G(cid:48). This operation can be applied to any pair of u, v in the same twin class, and it will not violate an earlier pair. Repeating it we will finally end with a desired maximum spanning unit interval subgraph. Therefore, there is always some i ∈ {0, . . . , 4} (all subscripts are modulo 5) such that deleting all edges between cliques Ki and Ki+1 together with edges between one of them and K5 leaves a maximum spanning unit interval subgraph. Once the sizes of all six cliques have been calculated, which can be done in O(m) time, the minimum set of edges can be decided in constant time. Therefore, the total running time is O(m). The proof is now complete. 13 βα Indeed, it is not hard to see that in the proof of Theorems 4.3(2), every maximum spanning unit interval subgraph of a fat W5 keeps its six twin classes, but we are satisfied with the weaker statement that is sufficient for our algorithm. Theorems 4.3 and 2.5 already imply a branching algorithm for the unit interval edge deletion problem running in time O(9k · m). Here the constant 9 is decided by the S3, which has 9 edges. However, a closer look at it tells us that deleting any single edge from an S3 introduces either a claw or a C4, which forces us to delete some other edge(s). The disposal of an S3 is similar. The labels for an S3 and a S3 used in the following proof are as given in Fig. 1. Proposition 4.4. Let G be a spanning unit interval subgraph of a graph G, and let F = E(G) \ E(G). (1) For an S3 of G, there must be some i = 1, 2, 3 such that F contains at least two edges from the triangle involving ui. (2) For an S3 of G, the set F contains either an edge uivi for some i = 1, 2, 3, or at least two edges from the triangle u1u2u3. Proof. (1) We consider the intervals for v1, v2, and v3 in a unit interval model I for G. If v1v2v3 remains a triangle of G, then the interval I(v1) ∪ I(v2) ∪ I(v3) has length less than 2, and it has to be disjoint from I(ui) for at least one i ∈ {1, 2, 3}. In other words, both edges incident to this ui are in F. Otherwise, v1v2v3 is not a triangle of G. Assume without loss of generality lp(v1) < lp(v2) < lp(v3). Then v1v3 (cid:54)∈ E(G) and u2 cannot be adjacent to both v1 and v3. Therefore, at least two edges from the triangle u2v1v3 are in F; other cases are symmetric. (2) If F contains none of the three edges v1u1, v2u2, and v3u3, then it contains at least two edges from the triangle u1u2u3: Otherwise there is a claw. This observation and a refined analysis will yield the running time claimed in Theorem 1.1. The algorithm goes similarly as the parameterized algorithm for unit interval vertex deletion used in the proof of Theorem 3.3. Theorem 4.5. The unit interval edge deletion problem can be solved in time O(4k · m). Proof. The algorithm calls first Theorem 2.5(2) to decide whether there exists an induced subgraph in F, and then based on the outcome, it solves the problem by making recursive calls to itself, or calling the algorithm of Theorem 4.3. When a claw or C4 is found, the algorithm makes respectively 3 or 4 calls to itself, each with a new instance with parameter value k − 1 (deleting one edge from the claw or C4). For an S3, the algorithm branches on deleting two edges from a triangle involving a vertex ui with i = 1, 2, 3. Since there are three such triangles, and each has three options, the algorithm makes 9 calls to itself, all with parameter value k − 2. For an S3, the algorithm makes 6 calls to itself, of which 3 with parameter value k − 1 (deleting edge viui for i = 1, 2, 3), and another 3 with parameter value k − 2 (deleting two edges from the triangle v1v2v3). To verify the correctness of the algorithm, it suffices to show that for any spanning unit interval subgraph G of G, there is at least one recursive call that generates a graph G(cid:48) satisfying E(G) ⊆ E(G(cid:48)) ⊆ E(G). This is obvious when the recursive calls are made on a claws or C4. It follows from Proposition 4.4 when the recursive calls are made on an S3 or S3. With standard technique, it is easy to verify that O(4k) recursive calls are made, each in O(m) time. Moreover, the algorithm for Theorem 4.3 is called O(4k) times. It follows that the total running time of the algorithm is O(4k · m). What dominates the branching step is the disposal of C4's. With the technique the author developed in [23], one may (slightly) improve the running time to O(ck · m) for some constant c < 4. To avoid blurring the focus of the present paper, we omit the details. 5 General editing Let V− ⊆ V(G), and let E− and E+ be a set of edges and a set of non-edges of G − V− respectively. We say that (V−, E−, E+) is an editing set of G if the deletion of E− from and the addition of E+ to G − V− create a unit interval graph. Its size is defined to be the 3-tuple (V−, E−, E+), and we say that it is smaller than (k1, k2, k3) if all of V− (cid:54) k1 and E− (cid:54) k2 and E+ (cid:54) k3 hold true and at least one inequality is strict. The unit interval editing problem is formally defined as follows. 14 Input: A graph G and three nonnegative integers k1, k2, and k3. Task: Either construct an editing set (V−, E−, E+) of G that has size at most (k1, k2, k3), or report that no such set exists. We remark that it is necessary to impose the quotas for different modifications in the stated, though cumbersome, way. Since vertex deletions are clearly preferable to both edge operations, the problem would be computationally equivalent to unit interval vertex deletion if we have a single budget on the total number of operations. By and large, our algorithm for the unit interval editing problem also uses the same two-phase approach as the previous algorithms. The main discrepancy lies in the first phase, when we are not satisfied with a proper Helly circular-arc graph or an F-free graph. In particular, we also want to dispose of all holes C(cid:96) with (cid:96) (cid:54) k3 + 3, which are precisely those holes fixable by merely adding edges (recall that at least (cid:96) − 3 edges are needed to fill a C(cid:96) in). In the very special cases where k3 = 0 or 1, a fat W5 is F ∪ {C(cid:96) : (cid:96) (cid:54) k3 + 3}-free. It is not hard to solve fat W5's, but to make the rest more focused and also simplify the presentation, we also exclude these cases by disposing of all C5's in the first phase. A graph is called reduced if it contains no claw, S3, S3, C4, C5, or C(cid:96) with (cid:96) (cid:54) k3 + 3. By Proposition 2.4, a reduced graph G is a proper Helly circular-arc graph. Hence, if G happens to be chordal, then it must be a unit interval graph (Corollary 2.3), and we terminate the algorithm. Otherwise, our algorithm enters the second phase. Now that G is reduced, every minimal forbidden induced subgraph is a hole C(cid:96) with (cid:96) > k3 + 3, which can only be fixed by deleting vertices and/or edges. Here we again exploit a proper and Helly arc model A for G. According to Lemma 3.1, if there exists some point ρ in the model such that KA(ρ) (cid:54) k1, then it suffices to delete all vertices in KA(ρ), which results in a subgraph that is a unit interval graph. Therefore, we may assume hereafter that no such point exists, then G remains reduced and non-chordal after at most k1 vertex deletions. As a result, we have to delete edges as well. Consider an (inclusion-wise minimal) editing set (V−, E−, E+) to a reduced graph G. It is easy to verify that (∅, E−, E+) is an (inclusion-wise minimal) editing set of the reduced graph G − V−. In particular, E− needs to intersect all holes of G − V−. We use A − V− as a shorthand for {A(v) ∈ A : v (cid:54)∈ V−}, an arc model for G − V− that is proper and Helly. One may want to use Lemma 4.2 to find a minimum set E− −→ of edges (i.e., E A−V− (α) for some point α) to finish the task. However, Lemma 4.2 has not ruled out the possibility that we delete less edges to break all long holes, and subsequently add edges to fix the incurred subgraphs in {claw, S3, S3, C4, C5, C(cid:96)} with (cid:96) (cid:54) k3 + 3. So we need the following lemma. Lemma 5.1. Let (V−, E−, E+) be an inclusion-wise minimal editing set of a reduced graph G. If E+ (cid:54) k3, then E+ = ∅. Proof. We may assume without loss of generality V− = ∅, as otherwise it suffices to consider the inclusion- wise minimal editing set (∅, E−, E+) to the still reduced graph G − V−. Let A be a proper and Helly arc model for G. Let E(cid:48)− be an inclusion-wise minimal subset of E− such that for every hole in G − E(cid:48)−, the union of arcs for its vertices does not cover the circle of A. We argue the existence of E(cid:48)− by showing that E− itself satisfies this condition. Suppose for contradiction that there exists in G − E− a hole whose arcs cover the circle of A. Then we can find a minimal subset of them that covers the circle of A. By Corollary 2.7, this subset has at least k3 + 4 vertices, and thus the length of the hole in G − E− is at least k3 + 4. But then it cannot be fixed by the addition of the at most k3 edges from E+. Now for the harder part, we argue that G := G − E(cid:48)− is already a unit interval graph. Together with the inclusion-wise minimality, it would imply E− = E(cid:48)− and E+ = ∅. Suppose for contradiction that G[X] is a claw, S3, S3, or a hole for some X ⊆ V(G). We find three vertices u, v, w ∈ X such that uw ∈ E(cid:48)− and uv, vw ∈ E(G) as follows. By Corollary 2.7 and the fact that G is {C4, C5}-free, at least six arcs are required to cover the circle. As a result, if the arcs for a set Y of at most six vertices covers the circle, then G[Y] must be a C6, and its subgraph G[Y] cannot be a claw, S3, or v∈X A(v) cannot cover the whole circle when G[X] is a claw, S3, or S3. On the other hand, from the selection of E(cid:48)−, this is also true when G[X] is a hole. Thus, G[X] is a unit interval graph, and we can find two vertices x, z from X having xz ∈ E(cid:48)−. We find a shortest x-z path in G[X]. If the path has more than one inner vertex, then it makes a hole together with xz; as G[X] is a unit interval graph, this would imply that there exists an inner vertex y of this path such that xy ∈ E(cid:48)− or yz ∈ E(cid:48)−. We consider then the new pair x, y or y, z accordingly. Note that their distance in G[X] is smaller than xz, and hence repeating this argument (at most X − 3 times) will end with two vertices with distance precisely 2 in G[X]. They are the desired u and w, while any common neighbor of them in G[X] can be v. By the minimality of E(cid:48)−, in G + uw there exists a hole H such that arcs for its vertices cover the circle in A. This hole H necessarily passes uw, and we denote it by x1x2 ··· x(cid:96)−1x(cid:96), where x1 = u and x(cid:96) = w. S3. Therefore,(cid:83) 15 Note that A(u) intersects A(w), and since A is proper and Helly, A(u), A(v), A(w) cannot cover the circle; moreover, it cannot happen that A(v) intersects all the arcs A(xi) for 1 < i < (cid:96) simultaneously. From x1x2 ··· x(cid:96)−1x(cid:96) we can find p and q such that 1 (cid:54) p < p + 1 < q (cid:54) (cid:96) and vxp, vxq ∈ E(G) but vxi (cid:54)∈ E(G) for every p < i < q. Here possibly p = 1 and/or q = (cid:96). Then vxp ··· xq makes a hole of G, and the union of its arcs covers the circle, contradicting the definition of E(cid:48)−. This concludes the proof. Therefore, a yes-instance on a reduced graph always has a solution that does not add any edge. By Lemma 4.2, for any editing set (V−, E−,∅), we can always find some point α in the model and use −→ E A−V− (α) to replace E−. After that, we can use the vertices "close" to this point to replace V−. Therefore, the problem again boils down to find some "weak point" in the arc model. This observation is formalized in the following lemma. We point out that this result is stronger than required by the linear-time algorithm, and we present in the current form for its own interest (see Section 6 for more discussions). Lemma 5.2. Given a proper Helly circular-arc graph G and a nonnegative integer p, we can calculate in O(m) time the minimum number q such that G has an editing set of size (p, q, 0). In the same time we can find such an editing set. (ρ) as Eρ − −,∅) by taking the p vertices in KA(ρ) with the most clockwise arcs as V ρ −→ E A−V∗− (α) from G − V∗− makes it a unit interval graph and E(cid:48)− Proof. We may assume that G is not chordal; otherwise, by Corollary 2.3, G is a unit interval graph and the problem becomes trivial because an empty set will suffice. Let us fix a proper and Helly arc model A for G. The lemma follows from Lemma 3.1 when there is some point ρ satisfying KA(ρ) (cid:54) p. Hence, we may assume that no such point exists, and for any subset V− of at most p vertices, G − V− remains a proper Helly circular-arc graph and is non-chordal. Hence, q > 0. For each point ρ in A, we can define an editing set (V ρ − and −→ −. We argue first that the minimum cardinality of this edge set, taken among all points in E A−V ρ A is the desired number q. See Fig. 9. Let (V∗−, E∗−,∅) be an editing set of G with size (p, q, 0). According to Lemma 4.2, there is a point α (cid:54) E∗− . such that the deletion of E(cid:48)− := We now consider the original model A. Note that a vertex in V∗− is in either KA(α) or {v (cid:54)∈ KA(α) : u → v, u ∈ KA(α)}; otherwise replacing this vertex by any end of an edge in E∗−, and removing this edge from E∗− gives an editing set of size (p, q − 1, 0). Let V− comprise the V∗− ∩ KA(α) vertices of KA(α) whose \ KA(α) vertices whose arcs are immediately arcs are the most clockwise in them, as well as the first V∗− = q and (V−, E−,∅) is also to the right of α. And let E− := an editing set of G (Lemma 4.1). Note that arcs for V− are consecutive in A. Let v be the vertex in V− with the most clockwise arc, and then ccp(v) +  is the desired point ρ. We give now the O(m)-time algorithm for finding the desired point, for which we assume that A is canonical. It suffices to consider the 2n points i + 0.5 for i ∈ {0, . . . , 2n − 1}. We calculate first the V0.5 − and E0.5 − . For i = 1, . . . , 2n − 1, we deduce the new from V i−0.5 and Ei−0.5 sets V i+0.5 as follows. If i is a clockwise endpoint of some arc, then − − = Ei−0.5 V i+0.5 = V i−0.5 and Ei+0.5 . Otherwise, i = ccp(v) for some vertex v, then we enqueue v, and − − dequeue u. We set V i+0.5 to be the vertices in the queue, whose size remains p. The different edges = {ux : u → x, x (cid:54)∈ between Ei+0.5 and Ei−0.5 are those incident to u and v. In particular, Ei+0.5 V i+0.5 − and E0.5 − can be − − − found in O(m) time, and then each vertex and its adjacency is scanned exactly once. The total running time is O(m). This concludes the proof. −→ E A−V− (α). It is easy to verify that E− (cid:54) E∗− − , and maintain a queue that is initially set to be V0.5 }. Note that the initial sets V0.5 and Ei+0.5 − − \ Ei+0.5 = {xv : x → v, x (cid:54)∈ V i−0.5 − }, while Ei−0.5 \ Ei−0.5 − − − − − −, Eρ − − Illustration for Figure 9: the proof of Lemma 5.2. Here p = 2 and q = 3. Then V α − consists of the two thick arcs, and Eα = 3. − Moving from point α to β (= α + 1) gives Eβ − + 4 − 2 = 5. = Eα − Again, one should note that in the general case (when both p, q > 0), the point identified by Lemma 5.2 may not be the thinnest point for vertices or the thinnest point for edges, as specified by respectively 16 vuαβ Lemmas 3.1 and 4.2. Indeed, for different values of p, the thinnest points found by Lemma 5.2 may be different. The mixed hole covers consists of both vertices and edges, and thus the combinatorial characterization given in Lemma 5.2 extends Lemmas 3.1 and 4.2. The algorithm used in the proof is similar as that of Theorem 4.3. Recall that a reduced graph is a proper Helly circular-arc graph. Thus, Lemmas 5.1 and 5.2 have the following consequence: It suffices to call the algorithm with p = k1, and returns the found editing set if q (cid:54) k2, or "NO" otherwise. Corollary 5.3. The unit interval editing problem can be solved in O(m) time on reduced graphs. Putting together these steps, the fixed-parameter tractability of unit interval editing follows. Note that to fill a hole, we need to add an edge whose ends have distance 2. Proof of Theorem 1.4. We start by calling Theorem 2.5. If a subgraph in F or W5 is detected, then we branch on all possible ways of destroying it or the contained C5. Otherwise, we have in our disposal a proper and Helly arc model for G, and we call Lemma 2.8 to find a shortest hole C(cid:96). If (cid:96) (cid:54) k3 + 3, then we either delete one of its (cid:96) vertices and (cid:96) edges, or add one of (cid:96) edges hihi+2 (the subscripts are modulo (cid:96)). One of the three parameters decreases by 1. We repeat these two steps until some parameter becomes negative, then we terminate the algorithm by returning "NO"; or the graph is reduced, and then call the algorithm of Corollary 5.3 to solve it. The correctness of this algorithm follows from Lemma 2.8 and Corollary 5.3. In the disposal of a subgraph of F, at most 21 recursive calls are made, while 3(cid:96) for a C(cid:96), each having a parameter k − 1. Therefore, the total number of instances (with reduced graphs) made in the algorithm is O((3k3 +21)k). It follows that the total running time of the algorithm is 2O(k log k)· m. It is worth mentioning that Lemma 5.2 actually implies a linear-time algorithm for the unit interval deletion problem (which allows k1 vertex deletions and k2 edge deletions) on the proper Helly circular-arc graphs and an O(10k1+k2 · m)-time algorithm for it on general graphs. The constant 10 can be even smaller if we notice that (1) the problem is also easy on fat W5's, and (2) the worst cases for vertex deletions (S3's and S3's) and edge deletions (C4's) are different. 6 Concluding remarks All aforementioned algorithms exploit the characterization of unit interval graphs by forbidden induced subgraphs [29]. Very recently, Bliznets et al. [4] used a different approach to produce a subexponential- time parameterized algorithm for unit interval completion (whose polynomial factor is however not linear). Using a parameter-preserving reduction from vertex cover [21], one can show that the vertex deletion version cannot be solved in 2o(k) · nO(1) time, unless the Exponent Time Hypothesis fails [7]. Now that the edge deletion version is FPT as well, one may want to ask to which side it belongs. The evidence we now have is in favor of the hard side: In all related graph classes, the edge deletion versions seem to be harder than their vertex deletion counterparts. As said, it is not hard to slightly improve the constant c in the running time O(ck · m), but a significant improvement would need some new observation(s). More interesting would be to fathom their limits. In particular, can the deletion problems be solved in time O(2k · m)? Polynomial kernels for unit interval completion [2] and unit interval vertex deletion [13] have been known for a while. Using the approximation algorithm of Theorem 1.2, we [19] recently developed an O(k4)-vertex kernel for unit interval vertex deletion, improving from the O(k53) one of Fomin et al. [13]. We conjecture that the unit interval edge deletion problem also has a small polynomial kernel. The algorithm for unit interval editing is the second nontrivial FPT algorithm for the general editing problem. The main ingredient of our algorithm is the characterization of the mixed deletion of vertices and edges to break holes. A similar study has been conducted in the algorithm for the chordal editing problem [10]. In contrast to that, Lemmas 5.1 and 5.2 are somewhat stronger. For example, we have shown that once small forbidden subgraphs have been all fixed, no edge additions are further needed. Together with Marx, we had conjectured that this is also true for the chordal editing problem, but we failed to find a proof. Very little study had been done on the mixed deletion of vertices and edges [25]. We hope that our work will trigger more studies on this direction, which will further deepen our understanding of various graph classes. We point out that although we start by breaking small forbidden induced subgraphs, our major proof technique is instead manipulating (proper/unit) interval models. The technique of combining 17 (a) F1 (b) F2 (c) F3 (d) † (e) ‡ (f) K2,3 (g) F4 (h) F5 (i) F6 (j) F7 (k) F8 (l) F9 Figure 10: Forbidden induced graphs. Figure 11: Forbidden induced subgraphs and containment relations of related graph classes ((cid:96) (cid:62) 4) (constructive) interval models and (destructive) forbidden induced subgraphs is worth further study on related problems. Appendix For the convenience of the reader, we collect related graph classes and their containment relations in Fig. 11, which is adapted from Lin et al. [22] (note that some of these graph classes are not used in the present paper). The CI(n, k) graphs are defined by Tucker [27]; see also [22]. Other subgraphs that have not been introduced in the main text are depicted in Fig. 10. The relations in Fig. 11 can be viewed both from the intersection models, arcs or intervals, and forbidden induced subgraphs, every minimal forbidden induced subgraph of a super-class being a (not necessarily minimal) forbidden induced subgraph of its subclass. For example, Proposition 2.6 and Corollary 2.7 are actually properties of normal Helly circular-arc graphs. For a normal Helly circular-arc graph that is not chordal, every arc model has to be normal and Helly [22, 9]. This is also true for the subclass of proper Helly circular-arc graphs, but an arc model for a proper Helly circular-arc graph may not be proper. A word of caution is worth on the definition of proper Helly circular-arc graphs. One graph might admit two arc models, one being proper and the other Helly, but no arc model that is both proper and 18 Circular-arcNormalcircular-arcHellycircular-arcPropercircular-arcclawS3W5F1F2F6F7S∗3C∗'C2'C∗2'−1NormalHellycircular-arcF2F3F8F9K2,3C6F4F5†‡C∗'W'ChordalC'Unitcircular-arcProperHellycircular-arcIntervalUnitHellycircular-arcUnitinterval=ProperintervalC'{CI(n,k):n>3k}{CI(n,k):n>2k}W4S3W4clawC'F2F3†‡claw Helly, e.g., the S3 and the W4. Therefore, the class of proper Helly circular-arc graphs does not contain all those graphs being both proper circular-arc graphs and Helly circular-arc graphs, but a proper subclass of it. A similar remark applies to normal Helly circular-arc graphs. For the three classes at the top of Fig. 11, their characterizations by minimal forbidden induced subgraphs are still open. At the third level, the minimal forbidden induced subgraphs for proper circular- arc graphs and normal Helly circular-arc graphs are completely determined by Tucker [27] and Cao et al. [9]. For all the classes at lower levels, their forbidden induced subgraphs with respect to its immediate super-classes are given. From them we are able to derive all the minimal forbidden induced subgraphs for each of these classes. For example, the characterization of unit interval graphs (Theorem 2.1) follows from the characteri- zation of interval graphs and that we can find a claw in an F2, an F3, a † that is not an S3, or a ‡ that is not an S3. Likewise, the minimal forbidden induced subgraphs of proper Helly circular-arc graphs stated in Theorem 2.2 can be derived from those of proper circular-arc graphs and by Corollary 5 of [22]: A proper circular-arc graph that is not a proper Helly circular-arc graph must contain a W4 or S3. Clearly, S∗3 contains an S3. To see that each of F1, F2, F6, F7, and C2(cid:96), C∗2(cid:96)−1 for (cid:96) (cid:62) 4 contain a W4, it is equivalent to check that each of F1, F2, F6, F7, and C2(cid:96), C∗2(cid:96)−1 for (cid:96) (cid:62) 4 contains a W4, i.e., two non-incident edges and another independent vertex v. This can be directly read from Fig. 10 for F1, F2, F6, F7. Let h1, h2, . . . denote the vertices in the hole of C2(cid:96) and C∗2(cid:96)−1. Then edges h1h2 and h4h5 are non-incident. In a C∗7, the vertex not in the hole can be the v, while in all other holes longer than 7, the vertex h7 can be the v. References [1] Jørgen Bang-Jensen and Pavol Hell. On chordal proper circular arc graphs. Discrete Mathematics, 128(1):395 -- 398, 1994. doi:10.1016/0012-365X(94)90130-9. [2] St´ephane Bessy and Anthony Perez. Polynomial kernels for proper interval completion and related problems. Information and Computation, 231:89 -- 108, 2013. doi:10.1016/j.ic.2013.08.006. [3] Ren´e van Bevern, Christian Komusiewicz, Hannes Moser, and Rolf Niedermeier. Measuring indifference: Unit interval vertex deletion. In Dimitrios M. Thilikos, editor, Graph-Theoretic Concepts in Computer Science (WG), volume 6410 of LNCS, pages 232 -- 243. Springer, 2010. doi:10.1007/978-3-642-16926-7_22. [4] Ivan Bliznets, Fedor V. Fomin, Marcin Pilipczuk, and Michał Pilipczuk. A subexponential parameterized algorithm for proper interval completion. SIAM Journal on Discrete Mathematics, 29(4):1961 -- 1987, 2015. A preliminary version appeared in ESA 2014. doi:10.1137/140988565. [5] Hans L. Bodlaender and Babette van Antwerpen-de Fluiter. On intervalizing k-colored graphs for DNA physical mapping. Discrete Applied Mathematics, 71(1-3):55 -- 77, 1996. A preliminary version appeared in ICALP 1995. doi:10.1016/S0166-218X(96)00057-1. [6] Pablo Burzyn, Flavia Bonomo, and Guillermo Dur´an. NP-completeness results for edge modification problems. Discrete Applied Mathematics, 154(13):1824 -- 1844, 2006. doi:10.1016/j.dam.2006.03.031. [7] Leizhen Cai. Fixed-parameter tractability of graph modification problems for hereditary properties. Information Processing Letters, 58(4):171 -- 176, 1996. doi:10.1016/0020-0190(96)00050-6. [8] Yixin Cao. Linear recognition of almost interval graphs. In Krauthgamer [20], pages 1096 -- 1115. Full version available at arXiv:1403.1515. doi:10.1137/1.9781611974331.ch77. [9] Yixin Cao, Luciano N. Grippo, and Mart´ın D. Safe. Forbidden induced subgraphs of normal Helly circular-arc graphs: Characterization and detection. Discrete Applied Mathematics, 216:67 -- 83, 2017. doi:10.1016/j.dam. 2015.08.023. [10] Yixin Cao and D´aniel Marx. Chordal editing is fixed-parameter tractable. Algorithmica, 75(1):118 -- 137, 2016. A preliminary version appeared in STACS 2014. doi:10.1007/s00453-015-0014-x. [11] Xiaotie Deng, Pavol Hell, and Jing Huang. Linear-time representation algorithms for proper circular-arc graphs and proper interval graphs. SIAM Journal on Computing, 25(2):390 -- 403, 1996. doi:10.1137/ S0097539792269095. [12] Rodney G. Downey and Michael R. Fellows. Fundamentals of Parameterized Complexity. Undergraduate texts in computer science. Springer, 2013. doi:10.1007/978-1-4471-5559-1. [13] Fedor V. Fomin, Saket Saurabh, and Yngve Villanger. A polynomial kernel for proper interval vertex deletion. SIAM Journal on Discrete Mathematics, 27(4):1964 -- 1976, 2013. A preliminary version appeared in ESA 2012. doi:10.1137/12089051X. [14] Delbert R. Fulkerson and Oliver A. Gross. Incidence matrices and interval graphs. Pacific Journal of Mathematics, 15(3):835 -- 855, 1965. doi:10.2140/pjm.1965.15.835. 19 [15] Fanica Gavril. Algorithms on circular-arc graphs. Networks, 4:357 -- 369, 1974. doi:10.1002/net.3230040407. [16] Paul W. Goldberg, Martin C. Golumbic, Haim Kaplan, and Ron Shamir. Four strikes against physical mapping of DNA. Journal of Computational Biology, 2(1):139 -- 152, 1995. doi:10.1089/cmb.1995.2.139. [17] Pim van 't Hof and Yngve Villanger. Proper interval vertex deletion. Algorithmica, 65(4):845 -- 867, 2013. doi:10.1007/s00453-012-9661-3. [18] Haim Kaplan, Ron Shamir, and Robert Endre Tarjan. Tractability of parameterized completion problems on chordal, strongly chordal, and proper interval graphs. SIAM Journal on Computing, 28(5):1906 -- 1922, 1999. A preliminary version appeared in FOCS 1994. doi:10.1137/S0097539796303044. [19] Yuping Ke, Yixin Cao, Xiating Ouyang, and Jianxin Wang. Unit interval vertex deletion: Fewer vertices are relevant. arXiv:1607.01162, 2016. [20] Robert Krauthgamer, editor. Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA). SIAM, 2016. doi:10.1137/1.9781611974331. [21] John M. Lewis and Mihalis Yannakakis. The node-deletion problem for hereditary properties is NP-complete. Journal of Computer and System Sciences, 20(2):219 -- 230, 1980. Preliminary versions independently presented in STOC 1978. doi:10.1016/0022-0000(80)90060-4. [22] Min Chih Lin, Francisco J. Soulignac, and Jayme L. Szwarcfiter. Normal Helly circular-arc graphs and its subclasses. Discrete Applied Mathematics, 161(7-8):1037 -- 1059, 2013. doi:10.1016/j.dam.2012.11.005. [23] Yunlong Liu, Jianxin Wang, Jie You, Jianer Chen, and Yixin Cao. Edge deletion problems: Branching facilitated by modular decomposition. Theoretical Computer Science, 573:63 -- 70, 2015. doi:10.1016/j.tcs.2015.01.049. [24] D´aniel Marx. Chordal deletion is fixed-parameter tractable. Algorithmica, 57(4):747 -- 768, 2010. A preliminary version appeared in WG 2006. doi:10.1007/s00453-008-9233-8. [25] D´aniel Marx, Barry O'Sullivan, and Igor Razgon. Finding small separators in linear time via treewidth reduction. ACM Transactions on Algorithms, 9(4):30.1 -- 30.35, 2013. A preliminary version appeared in STACS 2010. doi:10.1145/2500119. [26] Fred S. Roberts. Indifference graphs. In Frank Harary, editor, Proof Techniques in Graph Theory (Proc. Second Ann Arbor Graph Theory Conf., 1968), pages 139 -- 146. Academic Press, New York, 1969. [27] Alan C. Tucker. Structure theorems for some circular-arc graphs. Discrete Mathematics, 7(1-2):167 -- 195, 1974. doi:10.1016/S0012-365X(74)80027-0. [28] Yngve Villanger. Proper interval vertex deletion. In Venkatesh Raman and Saket Saurabh, editors, Parameterized and Exact Computation - IPEC 2010, volume 6478 of LNCS, pages 228 -- 238. Springer, 2010. doi:10.1007/ 978-3-642-17493-3_22. [29] Gerd Wegner. Eigenschaften der Nerven homologisch-einfacher Familien im Rn. PhD thesis, Universitat Gottingen, 1967. [30] Mihalis Yannakakis. Computing the minimum fill-in is NP-complete. SIAM Journal on Algebraic and Discrete Methods, 2(1):77 -- 79, 1981. doi:10.1137/0602010. 20
1711.01692
1
1711
2017-11-06T01:31:19
Routing Symmetric Demands in Directed Minor-Free Graphs with Constant Congestion
[ "cs.DS" ]
The problem of routing in graphs using node-disjoint paths has received a lot of attention and a polylogarithmic approximation algorithm with constant congestion is known for undirected graphs [Chuzhoy and Li 2016] and [Chekuri and Ene 2013]. However, the problem is hard to approximate within polynomial factors on directed graphs, for any constant congestion [Chuzhoy, Kim and Li 2016]. Recently, [Chekuri, Ene and Pilipczuk 2016] have obtained a polylogarithmic approximation with constant congestion on directed planar graphs, for the special case of symmetric demands. We extend their result by obtaining a polylogarithmic approximation with constant congestion on arbitrary directed minor-free graphs, for the case of symmetric demands.
cs.DS
cs
Routing Symmetric Demands in Directed Minor-Free Graphs with Constant Congestion Timothy Carpenter∗ Ario Salmasi† Anastasios Sidiropoulos‡ November 3, 2017 Abstract The problem of routing in graphs using node-disjoint paths has received a lot of attention and a polylogarithmic approximation algorithm with constant congestion is known for undirected graphs [Chuzhoy and Li 2016] and [Chekuri and Ene 2013]. However, the problem is hard to approximate within polynomial factors on directed graphs, for any constant congestion [Chuzhoy, Kim and Li 2016]. Recently, [Chekuri, Ene and Pilipczuk 2016] have obtained a polylogarithmic approximation with constant congestion on directed planar graphs, for the special case of symmetric demands. We extend their result by obtaining a polylogarithmic approximation with constant congestion on arbitrary directed minor-free graphs, for the case of symmetric demands. ∗Dept. of Computer Science & Engineering, The Ohio State University, [email protected]. †Dept. of Computer Science & Engineering, The Ohio State University, [email protected]. ‡Dept. of Computer Science, University of Illinois at Chicago, [email protected]. 7 1 0 2 v o N 6 ] S D . s c [ 1 v 2 9 6 1 0 . 1 1 7 1 : v i X r a 1 Introduction Routing in graphs along disjoint paths is a fundamental problem with numerous applications in various domains [1, 2, 3, 22, 23]. Disjoint path problems have been well-studied in both the directed and undirected setting, and it is known that the directed formulations of these problems are generally more difficult to approximate [14, 11]. The recent work of [5, 6] has brought to light a more tractable formulation of the directed version of these problems by considering routing symmetric demand pairs with constant congestion. Two of the most well-known and studied disjoint path problems are the node-disjoint paths problem (NDP) and the edge-disjoint paths problems (EDP). In these problems, the goal is to connect a set of node pairs through node- or edge-disjoint paths in an undirected graph. It is known that the decision version of NDP is NP-complete [19], and it has been shown to be fixed both EDP and NDP on n-node graphs, the state of the art is an Op? parameter tractable [25]. But there remain gaps in our understanding of their approximability. For nq-approximation [9], [21]. For planar graphs, a slightly better bound of Opn9{19q-approximation is known [13]. Even for the case ´? ¯ of the grid, only a Opn1{4q-approximation for NDP is known [12]. For hardness of approximation, logpnq it is known that both NDP and EDP are 2 -hard to approximate, unless all problems in NP have algorithms with running time nlogpnq [14]. Progress has been made on relaxed versions of these problems. One such relaxation is the all-or- nothing flow problem (ANF), where a subset M1 Ď M is routed if there is a feasible multicommodity flow routing one unit of flow for each pair in M1. Poly-logarithmic approximations are known for ANF [8, 7]. Another relaxation is to allow some small constant congestion on the nodes or edges. For this relaxation, poly-logarithmic approximations have been obtained for EDP with congestion 2 [15], and for NDP with congestion Op1q [4]. Ω It is natural to extend the study of disjoint path problems to directed graphs. However, these problems are known to be significantly harder on directed graphs. Even the case of ANF with con- stant congestion c allowed has an nΩp1{cq inapproximability bound [11]. However, a more tractable case is found by considering symmetric demand pairs. The study of maximum throughput routing problems in directed graphs with symmetric demand pairs began in [5]. In this setting the graph G is directed, and routing a source-destination pair psi, tiq requires finding a path from si to ti and a path from ti to si. We let Sym-Dir-ANF be the analogue of ANF, and Sym-Dir-NDP be the analogue of NDP in this setting. A poly-logarithmic approximation for Sym-Dir-ANF is obtained in [5]. Subsequently, in [6] a randomized poly-logarithmic approximation with constant congestion on planar graphs for Sym-Dir-NDP is obtained. 1.1 Our contribution We consider the problem of routing symmetric demands along node-disjoint paths in directed graphs. We refer to this problem as Sym-Dir-NDP. Letting G " pV, Eq be a directed graph with unit node capacities and M " tps1, t1q, . . . ,psk, tkqu Ď V V be a set of source-destination pairs, we say that pG,Mq is an instance of Sym-Dir-NDP. Routing a pair psi, tiq requires finding a path from si to ti, and from ti to si. A solution to an instance of Sym-Dir-NDP is a routing strategy maximizing the number of pairs routed through disjoint paths. Our contribution generalizes the result from [6] from the class of directed planar graphs to arbitrary directed minor-free graphs. We now formally state our results and briefly highlight the methods used. Our main result is the 1 following. ´ ¯ Theorem 3.5. Let G be a H-minor free graph. There is a polynomial time randomized algorithm that, with high probability, achieves an Ω -approximation with congestion 5 for Sym- Dir-NDP instances in G, where h is an integer dependent only on H. ? h log5{2pnq 1 h7 The approximation algorithm in this theorem is obtained by extending the algorithm of [6]. For an instance pG,tps1, t1q, . . . ,psk, tkquq of Sym-Dir-NDP, we say the set T " ts1, . . . , skuYtt1, . . . , tku is the set of terminals. Speaking broadly, the algorithm obtained in Theorem 3.5 consists of the following steps. 1. Using a multicommodity flow based LP relaxation and the well-linked decomposition of [6], reduce to an instance in which the terminals T are α-well-linked for a fixed constant α. 2. Find a large routing structure connected to large proportion of the terminals. 3. Use the routing structure to connect a large number of the source-destination pairs. From here on, we shall refer to the routing structure as the crossbar. The reduction we use in Step 1 allows us to reduce an instance of Sym-Dir-NDP to an instance on an Eulerian graph of small maximum degree, and where the terminals are α-well-linked. This comes at the cost of then having a randomized algorithm for the original instance. This reduction comes from [6], and while there it is used for planar graphs, we were fortunate in that it can also be used for general graphs. The routing scheme of Step 3 is also thanks to [6], and relies on similar crossbar construction. Our main contribution to this line of research is in finding an appropriate crossbar construction for Step 2. To build our crossbar, we would ideally find a "flat" grid minor so that some constant fraction of the terminal pairs can be routed along node-disjoint paths to the interface of the grid minor (a "flat" grid minor is one in which the grid minor is connected with the rest of the graph only through the outer face). Then we would have the following sets of node-disjoint paths along which to route the terminal pairs: the paths from the terminals to the interface, the paths from terminals to terminals implied by the node-well-linked property of the terminals, the concentric cycles of the grid minor, and the paths connecting the outermost and innermost cycles of the grid minor. From these, just as in [6] we can construct a routing scheme with congestion 5. To find a suitable flat grid minor, we combine results of [10] and [27] to show that flat grid minors of a suitable size can be found. We then show that if for the flat grid minor produced we cannot route a large enough fraction of the terminals to the interface then there exists some vertex which can be eliminated from the graph without destroying a potential solution to the problem. Thus, we find and test flat grid minors until one suitable to be used in the crossbar is found. 1.2 Organization In Section 2, we introduce the definitions and notion we will use throughout the paper. After that, in Section 3 we present Theorem 3.2, our main technical result, and Theorem 3.5, our main result. Sections 4, 5, 6.1, and 6.2 provide the details of the proofs of Theorems 3.2 and 3.5. The proof of Lemma 5.4 has been deferred to A, due to its length and technical nature. 2 Notation and Preliminaries We now introduce some notation and definitions that are used throughout the paper. 2 Directed and undirected graphs. From any directed graph G we can obtain an undirected graph GUN as follows. We set V pGUNq " V pGq and EpGUNq " ttu, vu : pu, vq P EpGq _ pv, uq P EpGqu. We refer to GUN as the underlying undirected graph of G. Flat subgraphs. We say that a planar subgraph H of an undirected graph G is flat if there exists a planar drawing Φ of H such that for any tu, vu P EpHq, with u P V pHq and v P V pGqzV pHq, we have that u is on the outer face of Φ. Well-linked sets. Let G be a directed (resp. undirected) graph. A set X Ď V pGq is node-well linked in G if for any two disjoint subsets Y, Z Ă X of equal size, there exist Y node-disjoint directed (resp. undirected) paths from Y to Z, such that each vertex in Y is the start of exactly one path, and each vertex in Z is the end of exactly one path. For some α P p0, 1q, we say that X is α-node well-linked if for any two disjoint subsets Y, Z Ă X of equal size, there exist Y directed (resp. undirected) paths from Y to Z such that no vertex is in more than 1{α of these paths; In other words, we allow a node congestion of 1{α for these paths. Directed and undirected treewidth For a directed graph G, we will denote by dtwpGq the directed treewidth of G, and we will denote by twpGUNq the (undirected) treewidth of GUN. Directed undirected is a global connectivity measure introduced in [18, 24], and just as undirected treewidth is defined by the minimum size tree decomposition, directed treewidth is defined by the minimum size of what is termed an aboreal decomposition. Instead of providing the full definitions of directed and undirected treewidth here, we only ask the reader to make a note of the following two important facts: • If G is an Eulerian directed graph with max degree ∆, then twpGUNq ď dtwpGq " Op∆ twpGUNqq [18]. • If a directed graph G contains an α-well-linked set X, then dtwpGq " ΩpαXq [24]. Clique-sums. Let G1 and G2 be two graphs. A clique-sum of G1 and G2 is any graph that is obtained by identifying a clique in G1 with a clique of the same size in G2, and then possibly removing some edges in the resulting shared clique. An h-clique-sum or h-sum for short, is a clique-sum where the identified cliques have at most h vertices. Nearly-embeddable and minor-free graphs. We say that a graph is pa, g, k, pq-nearly embed- dable if it is obtained from a graph of Euler genus g by adding a apices and k vortices of pathwidth p. We say that a graph is h-nearly embeddable if it is pa, g, k, pq-nearly embeddable for some a, g, k, p ď h. The following is implicit in [26]. Theorem 2.1 (Robertson and Seymour [26]). Let H be any graph. Every H-minor-free graph can be obtained by at most h-sums of graphs that are h-nearly embeddable graphs, where h is a non-negative integer dependent on H. 3 3 The Algorithm for Minor-Free Graphs We first use the following result of [6] to reduce the problem to the case of Eulerian graphs with small degrees. Note that this result is stated for planar graphs in [6], but the proof does not use planarity, and thus can be stated for general graphs. Lemma 3.1 (Chekuri, Ene & Pilipczuk [6]). Suppose that there is a polynomial time algorithm for Ωp1q-node-well-linked instances of Sym-Dir-NDP in directed Eulerian graphs of maximum degree ∆ that achieves a βp∆q-approximation with congestion c. Then there is a polynomial time random- ized algorithm that, with high probability, achieves a βpOplog2 kqq Oplog6 kq-approximation with congestion c for arbitrary instances of Sym-Dir-NDP in directed graphs, where k is the number of pairs in the instance. Now we describe how to construct the crossbar in minor-free graphs, assuming that we are given a m m flat grid minor Γ, for some large enough m, and a family of λm node-disjoint paths connecting the set of terminals and the interface of Γ, for some constant λ. The following is our main technical result, which is similar to the one in [6] for planar graphs. The proof is deferred to Section 4. Theorem 3.2. Let G be a directed minor-free graph of maximum in-degree of at most ∆. Let X be an α-node-well-linked set in G with X " Ω , where β is dependent on the structure of G. Suppose that we can find a m m flat grid minor Γ of GUN, and a family of λm node-disjoint paths connecting X and the interface of Γ in GUN, for some 0 ă λ ď 1. ´ ´ direction, sets Y `, Y ´ P X with Y ` " Y ´ " Ω paths such that one of the following holds. (1) None of the cycles enclose any vertex of Y `YY ´, the family P` consists of Y ` node-disjoint paths from Y ` to the innermost cycle, and the family P´ consists of Y ´ node-disjoint paths from the innermost cycle to Y ´. ¯ . Let m " Ω ¯ ¯ concentric directed cycles going in the same , and families P` and P´ of node-disjoint One can in polynomial time find a set of Ω α2X β∆2 ´ αX β∆ ´ ¯ αX β ∆2 α (2) All cycles enclose Y `YY ´, the family P` consists of Y ` node-disjoint paths from Y ` to the outermost cycle, and the family P´ consists of Y ´ node-disjoint paths from the outermost cycle to Y ´. ´ ¯ In order to obtain such a crossbar, we need to find a flat grid minor of large enough size. The following Lemma provides us the desired flat grid minor, and the proof is deferred to Section 6.2. Lemma 3.3. Let H be any graph and let G be an H-minor-free directed graph with treewidth t. One can in polynomial time find a r r flat grid minor Γ in GUN, with r " Ω , and a family of r node-disjoint paths connecting X and the interface of Γ, where h is an integer ¯ ´ dependent only on the structure of H. Once we obtain a crossbar as described above, we can route a large subset of terminal pairs. ? h log5{2pnq h7 t Lemma 3.4. Given the crossbar described in Theorem 3.2, one can get an O -approximation algorithm with congestion 5 for Sym-Dir-NDP in instances for which the input graph is minor-free and Eulerian with maximum in-degree ∆, the set of terminals is α-node-well-linked for some α ď 1, and β is dependent on the structure of G. ∆2 βα3 4 Proof. By applying the same routing scheme as in the one in [6], we get the desired result. Now we are ready to state the main result of this paper. ´ ¯ Theorem 3.5. Let G be a H-minor free graph. There is a polynomial time randomized algo- rithm that, with high probability, achieves an Ω -approximation with congestion 5 for Sym-Dir-NDP instances in G, where h is an integer dependent only on H. ? h log5{2pnq h7 1 Proof. This is immediate by Lemmas 3.1, 3.3, 3.4, and Theorem 3.2. 4 The Crossbar Construction ´ ¯ In this section we discuss the construction of the crossbar stated in Theorem 3.2. Before we give the proof of this Theorem we establish some auxiliary facts. Throughout this subsection, we assume that we are given the input of Theorem 3.2. Lemma 4.1. One can in polynomial time find an integer r " Ω and a sequence of node- disjoint concentric undirected cycles C1, C2, . . . , Cr in GUN, with C1 being the outermost and Cr being the innermost cycle. Proof. Let Γ be a flat m m grid minor of GUN, as given in the input of Theorem 3.2. By losing a constant factor, we can construct a flat sub-divided r r wall in GUN, with r " Ω . Let t be the treewidth of GUN. Since X is α-node-well-linked in G, X is also α-node-well-linked in GUN. Thus, t " ΩpαXq. Let C1 be the outermost cycle of Γ, and for each i P t2, . . . , ru, let Ci be the outermost cycle of Γz Y1ďjăi V pCiq. αX β αX β ´ ¯ As in [6], for a vertex set Q Ď V pGUNq, a vertex v R Q, and an integer (cid:96) ě 2∆, we say that a vertex set S is a pv, Q, (cid:96)q-isle if v P S, GUNrSs is connected, S X Q " H, and NGUNpSq ď (cid:96). We set isles Sout and Sin by choosing an arbitrary vertex vout in C1, and an arbitrary vertex vin in Cr. Letting (cid:96) " tr{p4∆ ` 2qu, then Sout is the pvout, X, (cid:96)q-isle and Sin is the pvin, X, (cid:96)q-isle obtained. We also need that Sout and Sin are separated by many cycles. For this, we use the following Lemma of [6], the proof of which is slightly modified. Lemma 4.2. The isle Sout does not contain any vertex that is enclosed by C(cid:96)`1, and the isle Sin does not contain any vertex that is not strictly enclosed by Cr´(cid:96). Proof. The proofs for Sin and Sout are symmetrical, so we focus on the case of Sout. Assume that Sout contains a vertex enclosed by C(cid:96)`1, and we will find a contradiction. Since vout P Sout, Sout is connected in GUN, and Γ is a flat wall, it must be that Sout contains a vertex from every cycle Ci, 1 ď i ď (cid:96) ` 1. Since NGUNpSoutq ď (cid:96), for some 1 ď i ď (cid:96) ` 1 we have that V pCiq is completely contained in Sout. However, there are r ą (cid:96) vertex-disjoint paths in GUN connecting Ci with X. Thus, either Sout X X ‰ H or NGUNpSoutq ą (cid:96), both of which are contradictions. We are almost ready to prove the main result of this section. We will make use of the following Lemma, which is implicit in [6]. Note that sets S1in and S1out, the concentric cycles C1 1, . . . , C1 r1, and integers r1 and ∆1 in the next Lemma are defined for a planar graph G1 as described in [6]. 5 1, . . . , C1 Lemma 4.3. Let G1 be an Eulerian, planar directed graph, with sets S1in, S1out separated by con- r1, and let (cid:96)1 " tr1{p4∆1` 2qu, where ∆1 is the the maximum in-degree of G1. centric cycles C1 Then one can in polynomial time find r(cid:96)1{2s node-disjoint directed concentric cycles, all going in the same direction (all clockwise or all counter-clockwise), such that all vertices of S1in are strictly enclosed by the innermost cycle, and all vertices of S1out are not enclosed by the outermost cycle, or vice versa, with the roles of S1in and S1out swapped. We will use Lemma 4.3 to find concentric cycles in minor-free graphs. We first generalize the notion of enclosed for flat grids in non-planar graphs. Let H be a directed graph with a flat grid minor η. Let uout an arbitrary vertex not contained in η. Let C be some cycle contained within η. We say a vertex u is enclosed by C if all paths in H UN from u to uout intersect C. We now find the desired concentric cycles in G. Lemma 4.4. One can in polynomial time find r(cid:96){2s node-disjoint directed concentric cycles, all going in the same direction (all clockwise or all counter-clockwise), such that all vertices of Sin are enclosed by the innermost cycle, and all vertices of Sout are not enclosed by the outermost cycle, or vice versa, with the roles of Sin and Sout swapped. Proof. We proceed by creating G1 from G as follows. Let Z " tv P V pGq : v P V pC1q or v is not in the component of GzV pC1q containing C2u . Let G1 " G{Z, i.e. G1 is the graph created by identifying all vertices in Z to a single vertex z. Since G is Eulerian, G1 is also Eulerian. Furthermore, we can delete any self-loops on z, and G1 is still Eulerian. Since C1, . . . , Cr are contained within a flat grid minor of G, G1 is therefore a planar graph. The only impediment to directly applying Lemma 4.3 is that the in-degree δ of z might be greater than ∆. We can eliminate this by replacing z with a path P of length δ, with edges directed both ways between adjacent vertices. We then connect the vertices formerly connected to z to vertices in P , maintaining the planarity of G1. Then, to restore G1 as an Eulerian graph, for the vertices in P with an imbalance between in- and out-degree we can create a new edge (See Figure 1). Figure 1: Maintaining a Eulerian graph with bounded degree. After these modifications, G1 is an Eulerian, planar digraph with maximum in-degree ∆. Let in " Sin and S1 S1 out to out " pSout X V pG1qq Y tzu. We now apply Lemma 4.3 using G1, S1 in, and S1 6 in are strictly enclosed by the innermost cycle, and all vertices of S1 find r(cid:96){2s node-disjoint directed concentric cycles, all going in the same direction, and all vertices of S1 out are not enclosed by the outermost cycle. Clearly, each of these cycles exists in G, all vertices of Sin are strictly enclosed by the innermost cycle, and all vertices of Sout are not enclosed by the outermost cycle. We are now ready to obtain the proof of Theorem 3.2. Proof of Theorem 3.2. By Lemma 4.4, we can finish the construction of the crossbar with the same argument as in [6]. 5 Graphs of Bounded Genus In this section we describe an algorithm to construct a flat grid minor Γ of large enough size in ¯ graphs of bounded genus. The following is implicit in the work of Chekuri and Sidiropoulos [10]. Lemma 5.1. Let G be an undirected graph of Euler genus g ě 1, with treewidth t ě 1. There is a polynomial time algorithm that computes a r1 r1-grid as a minor, with r1 " Ω . Furthermore, the algorithm does not require a drawing of G as part of the input. g3 log5{2 n ´ t ? g. With some minor modifications, we can use this result to obtain the following. We need to find a flat grid a minor for our purpose. Thomassen in [27] shows that if a graph of genus g contains a m m-grid as a minor, then it contains a k k flat grid minor, where m ą 100k Lemma 5.2. Let G be an undirected graph of Euler genus g ě 1, and let H be a m m grid g be an integer. Then one can compute a k k flat grid minor of G in minor of G. Let k ă m ? 100 polynomial time. Proof. We follow a similar approach as in [27]. We need to construct a family of pairwise disjoint subgraphs Q1, Q2, , Q2g`2 of H, satisfying the following conditions. 1. Each Qi is a k k sub-grid of H. 2. For any i, j with 1 ď i ă j ď 2g ` 2, we have the following. If xi and xj are on the outer cycles of Qi and Qj respectively, and they have neighbors yi P V pHqzV pQiq and yj P V pHqzV pQjq respectively, then H has a path Pij from xi to xj such that V pPijqX " txi, xju. V pQrq 2g`2Ť g, this can be easily done as shown in Figure 2, which completes the Since we have m ą 100k proof. ¯ Lemma 5.3. Let G be an undirected graph of Euler genus g ě 1, with treewidth t ě 1. There exists a polynomial time algorithm that computes a r r-grid as a minor, with r " Ω . Moreover, the algorithm does not require a drawing of G as part of the input. g log5{2 n g3? ? r"1 ´ t Proof. This is immediate by Lemmas 5.1 and 5.2. Note that computing a large grid minor in the graph is not enough. We need to make sure that a large number of terminals can reach the interface of the grid minor. The following Lemma will provide for us the desired grid minor. The proof of this Lemma is deferred to Appendix A. 7 Figure 2: Decomposition of the grid minor Lemma 5.4. Let F be some minor-closed family of graphs, let α ď 1, and β ą 0. Suppose that there exists a polynomial-time algorithm which given, some G1 P F and some α-node-well-lined set X1 in G1, outputs some r1 r1 flat grid minor Γ1 in G1, for some r1 " ΩpαX1{βq. Then there exists a polynomial-time algorithm which, given some G P F and some α-node-well-lined set X in G, outputs some r r flat grid minor Γ in G, for some integer r " ΩpαX{βq, and a family of λr node-disjoint paths in G connecting X to the interface of Γ, for some constant 0 ă λ ă 1. Lemma 5.5. Let G be an undirected graph of genus g, and let α ď 1. Let X be an α-node-well- linked set in G. One can, in polynomial time, find some r r flat grid minor Γ in G, for some αX integer r " Ω , and a family of λr node-disjoint paths connecting X and the interface g log5{2 n of Γ, for some 0 ă λ ď 1. Proof. This is immediate by combining Lemmas 5.3 and 5.4. g3? ´ ¯ Now by Lemmas 3.1, 3.4, and 5.5 we get the following result. ´ ¯ Theorem 5.6. Let G be a graph of genus g. There is a polynomial time randomized algo- rithm that, with high probability, achieves an Ω -approximation with congestion 5 1 g3? g log5{2pnq for Sym-Dir-NDP instances in G, where h is an integer dependent only on H. 6 Minor Free Graphs In this section we present the flat grid minor construction for minor-free graphs. We first consider the problem on nearly embeddable graphs, and when we extend our solution to arbitrary minor-free graphs by dealing with sums of constant size. 6.1 Nearly Embeddable Graphs In this subsection we work on nearly embeddable graphs. First we reduce the problem to the case of zero apices. 8 Lemma 6.1 (Reduction to p0, g, k, pq-nearly embeddable graphs). Suppose that there is a poly- nomial time algorithm for Sym-Dir-NDP in p0, g, k, pq-nearly embeddable graphs that achieves a β-approximation with congestion c. Then there is a polynomial time algorithm for Sym-Dir-NDP in pa, g, k, pq-nearly embeddable graphs that achieves a β{a-approximation with congestion c. Proof. Let G be an pa, g, k, pq-nearly embeddable graph, and suppose that we are given a Sym-Dir-NDP instance M " ts1t1, , smtmu in G. Let A Ď V pGq be the set of apices in G. Let G1 " GzA. Clearly, G1 is a p0, g, k, pq-nearly embeddable graph. Let M1 Ď M be the subset of source-terminal pairs that do not intersect A. M1 forms a Sym-Dir-NDP instance in G1, and thus we can get a β-approximation solution S1 with congestion c. Since M ď M1 ` a, we have that S1 is a β{a-approximation solution with congestion c for M in G, as desired. Next we provide an algorithm for Sym-Dir-NDP in p0, g, k, pq-nearly embeddable graphs. Let G be an p0, g, k, pq-nearly embeddable graph, and let S be the bounded genus subgraph of G on the surface; that is S is obtained from G by deleting all vortices. Let X Ď V pGq be the set of terminals. Note that using Lemma 3.1 we can reduce the problem to the case where X is α-well-linked for some α ď 1. The following is implicit in [16]. Lemma 6.2 (Demaine and Hajiaghayi [16]). Let t ě 1 be the treewidth of GUN, and let t1 be the treewidth of SUN. Then we have t1 ě t ´ Lemma 6.3. One can in polynomial time find a r r flat grid minor Γ in GUN,with r " Ω pp`kq3 . ¯ . t g3? gpp`kq3 log5{2 n ´ Proof. By Lemma 6.2 we have that the treewidth of SUN is at least genus g, and thus by Lemma 5.3 we get the desired result. Lemma 6.4. One can in polynomial time find some rr flat grid minor Γ in GUN, for some integer r " Ω , and a family of r node-disjoint paths connecting X and the interface of Γ. pp`kq3 . SUN is a graph of Euler gpp`kq3 log5{2 n g3? ¯ t t Proof. This is immediate by Lemmas 6.3 and 5.4. Now by combining Lemmas 3.1, 3.2, 6.4, the crossbar construction and routing scheme in Section 4, we get the following result. Lemma 6.5. Let G be a p0, g, k, pq-nearly embeddable graph. There is a polynomial time random- -approximation with ized algorithm that, with high probability, achieves an Ω 1 g3? gpp`kq3 log5{2 n ´ ¯ ´ congestion 5 for Sym-Dir-NDP instances in G, where h is an integer dependent only on H. Theorem 6.6. Let G be a pa, g, k, pq-nearly embeddable graph. There is a polynomial time ran- -approximation domized algorithm that, with high probability, achieves an Ω 1 ag3? gpp`kq3 log5{2 n with congestion 5 for Sym-Dir-NDP instances in G, where h is an integer dependent only on H. Proof. This follows immediately by Lemmas 6.5 and 6.1. 9 ¯ 6.2 Dealing with h-sums In this subsection we are going to prove Lemma 3.3. Let G be a minor-free graph, with treewidth t. Let X Ď V pGq be the set of terminals. The following is implicit in [17]. Lemma 6.7 ([17]). Let G1, G2 be two undirected graphs, and let G3 be an h-sum of G1 and G2 for some integer h ą 0. Let t1, t2, and t3 be the treewidth of G1, G2, and G3 respectively. Then we have t3 ď maxtt1, t2u. We are now ready to prove our result for computing flat grid minors in minor-free graphs. Proof of Lemma 3.3. By using Theorem 2.1, we get a decomposition of GUN into h-sums of h- nearly-embeddable graphs. By Lemma 6.7, we have that at least one summand G1 has treewidth at least t. Now G1 is a h-nearly-embeddable graph with treewidth t, and thus by Lemma 6.4 we get the desired flat grid minor. References [1] Alok Aggarwal, Amotz Bar-Noy, Don Coppersmith, Rajiv Ramaswami, Baruch Schieber, and Madhu Sudan. Efficient routing and scheduling algorithms for optical networks. In Proceedings of the Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '94, pages 412 -- 423, Philadelphia, PA, USA, 1994. Society for Industrial and Applied Mathematics. [2] B. Awerbuch, R. Gawlick, T. Leighton, and Y. Rabani. On-line admission control and circuit routing for high performance computing and communication. In Proceedings of the 35th Annual Symposium on Foundations of Computer Science, SFCS '94, pages 412 -- 423, Washington, DC, USA, 1994. IEEE Computer Society. [3] Andrei Z. Broder, Alan M. Frieze, and Eli Upfal. Existence and construction of edge-disjoint paths on expander graphs. SIAM Journal on Computing, 23(5):976 -- 989, 1994. [4] Chandra Chekuri and Alina Ene. Poly-logarithmic approximation for maximum node disjoint In Proceedings of the Twenty-fourth Annual ACM-SIAM paths with constant congestion. Symposium on Discrete Algorithms, SODA '13, pages 326 -- 341, Philadelphia, PA, USA, 2013. Society for Industrial and Applied Mathematics. [5] Chandra Chekuri and Alina Ene. The all-or-nothing flow problem in directed graphs with symmetric demand pairs. Mathematical Programming, 154(1):249 -- 272, Dec 2015. [6] Chandra Chekuri, Alina Ene, and Marcin Pilipczuk. Constant congestion routing of symmetric demands in planar directed graphs. In LIPIcs-Leibniz International Proceedings in Informatics, volume 55. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2016. [7] Chandra Chekuri, Sanjeev Khanna, and F. Bruce Shepherd. The all-or-nothing multicommod- ity flow problem. In Proceedings of the Thirty-sixth Annual ACM Symposium on Theory of Computing, STOC '04, pages 156 -- 165, New York, NY, USA, 2004. ACM. [8] Chandra Chekuri, Sanjeev Khanna, and F. Bruce Shepherd. Multicommodity flow, well-linked terminals, and routing problems. In Proceedings of the Thirty-seventh Annual ACM Symposium on Theory of Computing, STOC '05, pages 183 -- 192, New York, NY, USA, 2005. ACM. 10 [9] Chandra Chekuri, Sanjeev Khanna, and F. Bruce Shepherd. An op? nq approximation and integrality gap for disjoint paths and unsplittable flow. Theory of Computing, 2:2006, 2006. [10] Chandra Chekuri and Anastasios Sidiropoulos. Approximation algorithms for euler genus and In Foundations of Computer Science (FOCS), 2013 IEEE 54th Annual related problems. Symposium on, pages 167 -- 176. IEEE, 2013. [11] Julia Chuzhoy, Venkatesan Guruswami, Sanjeev Khanna, and Kunal Talwar. Hardness of routing with congestion in directed graphs. In Proceedings of the Thirty-ninth Annual ACM Symposium on Theory of Computing, STOC '07, pages 165 -- 178, New York, NY, USA, 2007. ACM. [12] Julia Chuzhoy and David H. K. Kim. On Approximating Node-Disjoint Paths in Grids. In Naveen Garg, Klaus Jansen, Anup Rao, and Jos´e D. P. Rolim, editors, Approxima- tion, Randomization, and Combinatorial Optimization. Algorithms and Techniques (AP- PROX/RANDOM 2015), volume 40 of Leibniz International Proceedings in Informatics (LIPIcs), pages 187 -- 211, Dagstuhl, Germany, 2015. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik. [13] Julia Chuzhoy, David H. K. Kim, and Shi Li. Improved approximation for node-disjoint paths in planar graphs. CoRR, abs/1603.05520, 2016. [14] Julia Chuzhoy, David H. K. Kim, and Rachit Nimavat. New hardness results for routing on disjoint paths. CoRR, abs/1611.05429, 2016. [15] Julia Chuzhoy and Shi Li. A polylogarithimic approximation algorithm for edge-disjoint paths with congestion 2. CoRR, abs/1208.1272, 2012. [16] Erik D Demaine and MohammadTaghi Hajiaghayi. Linearity of grid minors in treewidth with applications through bidimensionality. Combinatorica, 28(1):19 -- 36, 2008. [17] Erik D Demaine, MohammadTaghi Hajiaghayi, Naomi Nishimura, Prabhakar Ragde, and Dimitrios M Thilikos. Approximation algorithms for classes of graphs excluding single-crossing graphs as minors. Journal of Computer and System Sciences, 69(2):166 -- 195, 2004. [18] Thor Johnson, Neil Robertson, P.D. Seymour, and Robin Thomas. Directed tree-width. Jour- nal of Combinatorial Theory, Series B, 82(1):138 -- 154, 2001. [19] R M Karp. On the complexity of combinatorial problems. Networks, 5:45 -- 68, 1975. [20] Ken-ichi Kawarabayashi and Anastasios Sidiropoulos. Polylogarithmic approximation for min- imum planarization (almost). In Foundations of Computer Science (FOCS), 2017 IEEE 58th Annual Symposium on, pages 779 -- 788. IEEE, 2017. [21] Stavros G. Kolliopoulos and Clifford Stein. Approximating disjoint-path problems using greedy algorithms and packing integer programs (extended abstract). pages 153 -- 168. Springer-Verlag, 1998. [22] D. Peleg and E. Upfal. Constructing disjoint paths on expander graphs. Combinatorica, 9(3):289 -- 313, Sep 1989. 11 [23] Prabhakar Raghavan and Eli Upfal. Efficient routing in all-optical networks. In Proceedings of the Twenty-sixth Annual ACM Symposium on Theory of Computing, STOC '94, pages 134 -- 143, New York, NY, USA, 1994. ACM. [24] B. Reed. Introducing directed tree width. Electronic Notes in Discrete Mathematics, 3(Supple- ment C):222 -- 229, 1999. 6th Twente Workshop on Graphs and Combinatorial Optimization. [25] N. Robertson and P.D. Seymour. Graph minors. xiii. the disjoint paths problem. Journal of Combinatorial Theory, Series B, 63(1):65 -- 110, 1995. [26] Neil Robertson and Paul D Seymour. Graph minors. xvi. excluding a non-planar graph. Journal of Combinatorial Theory, Series B, 89(1):43 -- 76, 2003. [27] Carsten Thomassen. A simpler proof of the excluded minor theorem for higher surfaces. Journal of Combinatorial Theory, Series B, 70(2):306 -- 311, 1997. 12 Figure 3: The connected components of GzC in Γ1 0 A Missing Proofs λr0 0 r1 0 sub-grid Γ1 0 " Opr0q and Γ1 0 of Γ0 such that r1 Proof of Lemma 5.4. Let t be the treewidth of G. Since X is α-node-well-linked in G, we have that t " ΩpαXq. Let Γ0 be an r1 r1 flat grid minor in G, for some r1 " ΩpαX{βq. If there is a family of λr0 node-disjoint paths connecting X and the the interface of Γ0, then we are done. Otherwise, we will find an irrelevant vertex; that is a vertex v P V pGq such that deleting v from G does not affect the well-linkedness of X. Therefore, we can delete v from G, and recursively call the process for finding flat grid minors, until we get the desired one. Suppose that there is not a family of λr0 node-disjoint paths connecting X and the interface of Γ0. First we find a r1 0 contains at most α terminals. For any minor H of G, and for every v P V pHq, let ηpvq Ď V pGq be the subset of vertices in G corresponding to v. Let also XH " X X ηpHq. Since there is not a family of λr0 node-disjoint paths connecting X and the interface of Γ0, we can find a cut C Ď EpGq in G, separating XΓ0 and the interface of Γ0, with C ă λr0. Now let A1, A2, . . . , Am be the connected components of GzC that contain vertices of XΓ0 (See Figure 3). We may assume w.l.o.g. that V pA1q ě V pA2q ě . . . ě V pAmq. Now let Y, Z Ă X be two disjoint subsets of X of equal size such that XA1 Ă Y and XAi Ă Z for any i P t2, 3, . . . , mu. Since X is α-node-well-linked, there exist a family P of Y paths from Y to Z such that no vertex is in more than 1{α of these paths. However, we have XA1 Ă Y and XAi Ă Z for any i P t2, 3, . . . , mu, and thus we have V pXA2q Y . . . Y V pXAmq ď C 1 0 of Γ0 such α number of terminals in ηpΓ1 0q. that Γ1 0, then we are done. Otherwise, we find an irrelevant vertex. We use a similar technique as in [20]. Let Γ2 0 be the 0 r2 0{4 rows and columns of Γ1 r2 0 sub-grid of Γ1 0. By the construction, we know that Γ2 0 is a power of 2, and thus r2 0 into 0u, let vi,j be the vertex in the i'th row and smaller sub-grids as follows. For every i, j P t1, 2, . . . , r2 0 obtained by deleting the first and last r1 α terminals. We may assume w.l.o.g. that r1 0 is a power of 2 as well. We construct a hierarchical partitioning of Γ2 0 does not intersect XA1, and moreover there are at most λr0 If there is a family of λr1 α ă λr0 α . Therefore, we can find a r0 4 sub-grid Γ1 0 node-disjoint paths connecting X and the interface of Γ1 4 r0 0 contains at most λr0 13 j'th column of Γ2 0. For any i, j, h P t1, 2, . . . , r2 0u, let 0uď Hi,j,h " minti`h,r2 0uď mintj`h,r2 a"maxt1,i´h´1u b"maxt1,j´h´1u tva,bu. We also define (cid:96)pHi,j,hq = 2h. For every q P t0, 1, . . . , log r2 q q sub-grids as follows. Let 0u, we define two partitions of Γ2 0 into 0{2q`1ď r2 j"0 0{2q`1ď 0{2q`1ď i"0 r2 Hq,1 " r2 0{2q`1ď Hq,2 " r2 tHpi2q`1, j2q`1, 2qqu, and tHpi2q`1 ` 2q, j2q`1 ` 2q, 2qqu. j"0 i"0 2Ť 0Ť Let H " log r2 q"0 0q be the number of terminals in ηpΓ2 0q be the interface of Γ2 i"1 0. We say that some v P V pΓ2 0. We count the number of vertices in Γ2 Hq,i. For every H P H, let wpHq be the number of terminals in ηpHq. Let also wpΓ2 0q. We say that some H P H is dense if wpHq ě (cid:96)pHq{100. Let δpΓ2 0q is good if v is not contained in any dense H P H, and there is no terminals in ηpvq. First we show that there exists a good vertex in Γ2 0 that are contained in at least one dense H P H. Let Hq,j P H for some q P t0, . . . , log r2 0u and j P t1, 2u, and let H P Hq,j. H is dense if and only if wpHq ě (cid:96)pHq{100 " 2q`1{100. We know that wpΓ2 0{10000, and thus if 0{100, and thus 2q`1 ą r2 0 ´ i. Let H1 P Hq,1. We have that q ă log r2 (cid:96)pH1q " 2q`1 " r2 100 " 1002i´1 . Note that we have wpΓ2 0{10000, and therefore there can be at most 2i´1{100 dense H1 P Hq,1. With a similar argument, we can show that there can be at most 2i´1{100 dense H1 P Hq,2. Now we have 0{100, then there are no dense H P Hq,j. Now suppose that 2q`1 ď r2 0 ´ 7. Let i P t8, . . . , log r2 0{2i´1. In order for H1 to be dense it must be that wpH1q ě (cid:96)pHq 0u, and let q " log r2 0q ď r2 0q ď r2 r2 0 ď HPH:H is dense H 2 2i´1 100 0 ď 2 log r2 0ÿ r2 0ÿ 2i´1 i"8 log r2 " pr2 0q2 i"8 ă pr2 0q2 vertices in Γ2 50 50 . 1 2i´1 This means that there exist at least 49pr2 0q2 0 that are not contained in any dense H P H, and since there are at most r2 0q, there must exist a good vertex 0q be a in Γ2 good vertex. 0u and i P t1, 2u, let Hq,i P Hq,i be a sub-grid that contains v. By the construction, for every q P t0, 1, . . . , log r2 0u, 0, as desired. Furthermore, this vertex can be found in polynomial time. Let v P V pΓ2 We claim that vertices in ηpvq are irrelevant. For every q P t0, 1, . . . , log r2 0{10000 terminals in ηpΓ2 50 14 pv, δpHq,1qq ě 2q´1 or dΓ2 0q (See Figure 4). pv, δpHq,2qq ě 2q´1. Let Bq P tHq,1, Hq,2u be we have that either dΓ2 pv, δpBqqq ě 2q´1. For every q P t1, . . . , log r2 0u, let Cq " BqzBq´1, and let also such that dΓ2 0`1 " V pΓ1 0qzV pΓ2 Clog r2 Let Y, Z Ă X be two disjoint subsets of X of equal size. Since X is α-node well-linked, we know that there exist a family P of Y paths from Y to Z such that no vertex is in more than 1{α of these paths. If none of these paths use v, then we are done. Otherwise, we try to re-route these paths to obtain a new family P1 of paths, such that no path is using v, and no vertex is in more than 1{α of the paths in P1. First we look at the paths P P P with both endpoints outside of Γ1 0; that is the endpoints of P do not belong to ηpΓ1 0q. Let P Ď P be the set of all such paths. We re-route 0q. Note that by the construction, at most λr1 them in a way such that they do not intersect ηpΓ2 0q. For these paths, we can re-route their intersection with ηpΓ1 0q of paths in P can intersect ηpΓ1 0qzηpΓ2 in ηpΓ1 0q, and thus they will not intersect ηpΓ2 0q. Now let P Ď P be the set of paths with 0q. Let P " pa1, a2, . . . , apq P P, one endpoint outside of ηpΓ1 where a1 R ηpΓ1 0q; that is f P t1, 2, . . . , pu is the minimum number such that af P ηpΓ1 0q. Let P1 " paf , . . . , apq. We replace P with P1 in P. Note that again there are at most λr1 0 such paths in P. Now we are only dealing 0q. For all such paths, we use an inductive argument to with paths with both endpoints in ηpΓ1 re-route them. For any i, j P t1, 2, . . . , log r2 0 ` 1u, let Pi,j Ď P be the paths with one endpoint in ηpCiq, and the other endpoint in ηpCjq. By the construction, for any i P t1, 2, . . . , log r2 0 ` 1u, we know that there are at most 2i{20 terminals in ηpCiq, and thus Pi,i ď 2i{20. For all such paths, we can re-route them such that they stay inside Ci. We start with Plog r2 0`1, and re-route 0`1. Again, by the construction, we have all these paths such that they only use vertices in Clog r2 0`1,j, similar to the paths in P, we can Plog r2 0q. Let af P V pPq be the first intersection of P and ηpΓ1 0Ť 0{10. For all P P log r2 j"1 0q, and one endpoint inside of ηpΓ1 ď r2 0q and ap P ηpΓ1 that Plog r2 0`1,j log r2 0Ť j"1 0`1,log r2 0 Figure 4: Sets Cq 0 0 0 replace them with paths with one endpoint on the boundary of Clog r2 , and recursively follow the 0 15 0Ť log r2 j"1 ¸ Cj ¯ same argument for paths with both endpoints in η and so on. Therefore, by applying the same re-routing pattern, we can get a new set of paths P1 such that no path uses vertex v, as desired. Now let G1 " Gzv. Since v is an irrelevant vertex in G, we have that X is α-node-well-linked in G1, and thus we have that the treewidth of G1 is ΩpαXq. Therefore, we can find a r1 1 r1 1 flat grid minor Γ1 in G1, for some r1 1 node-disjoint paths connecting X and the interface of Γ1, we are done. Otherwise, we recursively follow the same approach to find an irrelevant vertex v1 in G1, and let G2 " G1zv1 and so on. This recursive call stops in Opnq steps, because for each i ě 1, Gi is a graph of treewidth αX. Therefore, for some j ě 1, we can find a rj rj flat grid minor Γj of Gj, for some rj " Ω , such that there exists a family of λrj node-disjoint paths connecting X and the interface of Γj. Note that Γj is also a flat grid minor of G, and this completes the proof. If there exists a family of λr1 1 " Ω αX β αX β . ´ ´ ¯ 16
1811.07464
1
1811
2018-11-19T02:22:48
Towards Nearly-linear Time Algorithms for Submodular Maximization with a Matroid Constraint
[ "cs.DS" ]
We consider fast algorithms for monotone submodular maximization subject to a matroid constraint. We assume that the matroid is given as input in an explicit form, and the goal is to obtain the best possible running times for important matroids. We develop a new algorithm for a \emph{general matroid constraint} with a $1 - 1/e - \epsilon$ approximation that achieves a fast running time provided we have a fast data structure for maintaining a maximum weight base in the matroid through a sequence of decrease weight operations. We construct such data structures for graphic matroids and partition matroids, and we obtain the \emph{first algorithms} for these classes of matroids that achieve a nearly-optimal, $1 - 1/e - \epsilon$ approximation, using a nearly-linear number of function evaluations and arithmetic operations.
cs.DS
cs
Towards Nearly-linear Time Algorithms for Submodular Maximization with a Matroid Constraint Alina Ene∗ Huy L. Nguyên† Abstract We consider fast algorithms for monotone submodular maximization subject to a matroid constraint. We assume that the matroid is given as input in an explicit form, and the goal is to obtain the best possible running times for important matroids. We develop a new algorithm for a general matroid constraint with a 1 − 1/e −  approximation that achieves a fast running time provided we have a fast data structure for maintaining a maximum weight base in the matroid through a sequence of decrease weight operations. We construct such data structures for graphic matroids and partition matroids, and we obtain the first algorithms for these classes of matroids that achieve a nearly-optimal, 1 − 1/e −  approximation, using a nearly-linear number of function evaluations and arithmetic operations. Introduction 1 In this paper, we consider fast algorithms for monotone submodular maximization subject to a matroid constraint. Submodular maximization is a central problem in combinatorial optimization that captures several problems of interest, such as maximum coverage, facility location, and welfare maximization. The study of this problem dates back to the seminal work of Nemhauser, Wolsey and Fisher from the 1970's [21, 22, 12]. Nemhauser et al. introduced a very natural Greedy algorithm for the problem that iteratively builds a solution by selecting the item with the largest marginal gain on top of previously selected items, and they showed that this algorithm achieves a 1 − 1/e approximation for a cardinality constraint and a 1/2 approximation for a general matroid constraint. The maximum coverage problem is a special case of monotone submodular maximization with a cardinality constraint and it is 1 − 1/e hard to approximate [10], and thus the former result is optimal. Therefore the main question that was left open by the work of Nemhauser et al. is whether one can obtain an optimal, 1 − 1/e approximation, for a general matroid constraint. In a celebrated line of work [6, 24], Calinescu et al. developed a framework based on continuous optimization and rounding that led to an optimal 1 − 1/e approximation for the problem. The ap- proach is to turn the discrete optimization problem of maximizing a submodular function f subject to a matroid constraint into a continuous optimization problem where the goal is to maximize the multilinear extension F of f (a continuous function that extends f) subject to the matroid polytope (a convex polytope whose vertices are the feasible integral solutions). The continuous optimization problem can be solved approximately within a 1 − 1/e factor using a continuous Greedy algorithm ∗Department of Computer Science, Boston University, [email protected]. †College of Computer and Information Science, Northeastern University, [email protected]. [24] and the resulting fractional solution can be rounded to an integral solution without any loss [1, 6, 8]. The resulting algorithm achieves the optimal 1 − 1/e approximation in polynomial time. Unfortunately, a significant drawback of this approach is that it leads to very high running times. Obtaining fast running times is a fundamental direction both in theory and in practice, due to the numerous applications of submodular maximization in machine learning, data mining, and economics [19, 18, 14, 17, 9]. This direction has received considerable attention [2, 11, 3, 20, 5, 7], but it remains a significant challenge for almost all matroid constraints. Before discussing these challenges, let us first address the important questions on how the input is represented and how we measure running time. The algorithms in this paper as well as prior work assume that the submodular function is represented as a value oracle that takes as input a set S and returns f(S). For all these algorithms, the number of calls to the value oracle for f dominates the running time of the algorithm (up to a logarithmic factor), and thus we assume for simplicity that each call takes constant time. The algorithms fall into two categories with respect to how the matroid is represented: the independence oracle algorithms assume that the matroid is represented using an oracle that takes as input a set S and returns whether S is feasible (independent); the representable matroid algorithms assume that the matroid is given as input in an explicit form. The representable matroid algorithms can be used for only a subclass of matroids, namely those that can be represented as a linear matroid over vectors in some field1, but this class includes all the practically-relevant matroids: the uniform, partition, laminar, graphical, and general linear matroids. The oracle algorithms apply to all matroids, but they are unlikely to lead to the fastest possible running times: even an ideal algorithm that makes only O(k) independence calls has a running time that is Ω(k2) in the independence oracle model, even if the matroid is a representable matroid such as a partition or a graphic matroid. Thus there have always been parallel lines of research for representable matroids and general matroids. This work falls in the first category, i.e., we assume that the matroid is given as input in an explicit form, and the goal is to obtain the best possible running times. Note that, although all the representable matroids are linear matroids, it is necessary to consider each class separately, since they have very different running times to even verify if a given solution is feasible: for simple explicit matroids such as a partition or a graphic matroid, checking whether a solution is feasible takes O(n) time, where n is the size of the ground set of the matroid; for general explicit matroids represented using vectors in some field, checking whether a solution is feasible takes O(kω) time, where k is the rank of the matroid and ω is the exponent for fast matrix multiplication. Since in many practical settings only nearly-linear running times are feasible, an important question to address is: For which matroid constraints can we obtain a 1 − 1/e −  approximation in nearly-linear time? Prior to this work, the only example of such a constraint was a cardinality constraint. For a partition matroid constraint, the fastest running time is Ω(n3/2) in the worst case [5]. For a graphical matroid constraint, no faster algorithms are known than a general matroid, and the running time is Ω(n2). Obtaining a best-possible, nearly-linear running time has been very challenging even for these classes of matroids for the following reasons: 1In a linear matroid, the ground set is a collection of n vectors and a subset of the vectors is feasible (independent) if the vectors are linearly independent. 2 • The continuous optimization is a significant time bottleneck. The continuous optimization problem of maximizing the multilinear extension subject to the matroid polytope is an integral component in all algorithms that achieve a nearly-optimal approximation guarantee. However, the multilinear extension is expensive to evaluate even approximately. To achieve the nearly- optimal approximation guarantees, the evaluation error needs to be very small and in a lot of cases, the error needs to be O(n−1) times the function value. As a result, a single evaluation of the multilinear extension requires Ω(n) evaluations of f. Thus, even a very efficient algorithm with O(n) queries to the multilinear extension would require Ω(n2) running time. • Rounding the fractional solution is a significant time bottleneck as well. Consider a matroid constraint of rank k. The fastest known rounding algorithm is the swap rounding, which requires k swap operations: in each operation, the algorithm has two bases B1 and B2 and needs to find x ∈ B1, y ∈ B2 such that B1 \ {x} ∪ {y} and B2 \ {y} ∪ {x} are bases. The typical implementation is to pick some x ∈ B1 and try all y in B2, which requires us to check independence for k solutions. Thus, overall, the rounding algorithm checks independence for Ω(k2) solutions. Furthermore, each feasibility check takes Ω(k) time just to read the input. Thus a generic rounding for a matroid takes Ω(k3) time. Thus, in order to achieve a fast overall running time, one needs fast algorithms for both the con- tinuous optimization and the rounding. In this work, we provide such algorithms for partition and graphic matroids, and we obtain the first algorithms with nearly-linear running times. At the heart of our approach is a general, nearly-linear time reduction that reduces the submodular maximiza- tion problem to two data structure problems: maintain an approximately maximum weight base in the matroid through a sequence of decrease-weight operations, and maintain an independent set in the matroid that allows us to check whether an element can be feasibly added. This reduction applies to any representable matroid, and thus it opens the possibility of obtaining faster running times for other classes of matroids. 1.1 Our contributions We now give a more precise description of our contributions. We develop a new algorithm for maximizing the multilinear extension subject to a general matroid constraint with a 1 − 1/e −  approximation that achieves a fast running time provided we have fast data structures with the following functionality: • A maximum weight base data structure: each element has a weight, and the goal is to maintain an approximately maximum weight base in the matroid through a sequence of operations, where each operation can only decrease the weight of a single element; • An independent set data structure that maintains an independent set in the matroid and supports two operations: add an element to the independent set, and check whether an element can be added to the independent set while maintaining independence. Theorem 1. Let f be a monotone submodular function and let M be a matroid on a ground set of size n. Let F be the multilinear extension of f and P(M) be the matroid polytope of M. Suppose that we have a data structure for maintaining a maximum weight base and independent set as described above. There is an algorithm for the problem maxx∈P (M) F(x) that achieves a 1− 1/e−  3 approximation using O(n poly(log n, 1/)) calls to the value oracle for f, data structure operations, and additional arithmetic operations. Using our continuous optimization algorithm and additional results, we obtain the first nearly- linear time algorithms for both the discrete and continuous problem with a graphic and a partition matroid constraint. In the graphic matroid case, the maximum weight base data structure is a dynamic maximum weight spanning tree (MST) data structure and the independent data structure is a dynamic connectivity data structure (e.g., union-find), and we can use existing data structures that guarantee a poly-logarithmic amortized time per operation [16, 13, 23]. For a partition matroid, we provide in this paper data structures with a constant amortized time per operation. We also address the rounding step and provide a nearly-linear time algorithm for rounding a fractional solution in a graphic matroid. A nearly-linear time rounding algorithm for a partition matroid was provided in [5]. Theorem 2. There is an algorithm for maximizing a monotone submodular function subject to a generalized partition matroid constraint that achieves a 1 − 1/e −  approximation using O(n poly(1/, log n)) function evaluations and arithmetic operations. Theorem 3. There is an algorithm for maximizing a monotone submodular function subject to a graphic matroid constraint that achieves a 1 − 1/e −  approximation using O(n poly(1/, log n)) function evaluations and arithmetic operations. Previously, the best running time for a partition matroid was Ω(n3/2 poly(1/, log n)) in the worst case [5]. The previous best running time for a graphic matroid is the same as the general matroid case, which is Ω(n2 poly(1/, log n)) in the worst case [3]. The submodular maximization problem with a partition matroid constraint also captures the submodular welfare maximization problem: We have a set N of m items and k players, and each player i has a valuation function vi : 2N → R≥0 that is submodular and monotone. The goal is to i=1 vi(Si). We can reduce the submodular welfare problem to the submodular maximization problem with a partition matroid constraint as follows [24]. We make k copies of each item, one for each player. We introduce a partition matroid constraint to ensure that we select at most one copy of each item, and a find a partition of the items into k sets S1, . . . , Sk that maximizesPk submodular function f(S) =Pk i=1 vi(Si), where Si is the set of items whose i-th copy is in S. Using this reduction, we obtain a fast algorithm for the submodular welfare maximization problem as well. The size of the ground set of the resulting objective is m·k, where m is the number of items and k is the number of players, and thus the algorithm is nearly-linear in n = m · k. Note that, even in the case of modular valuation functions, n is the size of the input to the submodular welfare problem, since we need to specify the valuation of every player for every item. Theorem 4. There is a 1− 1/e−  approximation algorithm for submodular welfare maximization using O(n poly(1/, log n)) function evaluations and arithmetic operations. We conclude with a formal statement of the contributions made in this paper on which the results above are based. Theorem 5. There is a dynamic data structure for maintaining a maximum weight base in a partition matroid through a sequence of decrease weight operations with an O(1) amortized time per operation. 4 Theorem 6. There is a randomized algorithm based on swap rounding for the graphic matroid polytope that takes as input a point x represented as a convex combination of bases and rounds it to an integral solution S such that E[f(S)] ≥ F(x). The running time of the algorithm is O(nt log2 n), where t is the number of bases in the convex combination of x. weight base when the value is measured in the modular approximation f0(S) =P 1.2 Technical overview The starting point of our approach is the work [5]. They observed that the running time of the continuous algorithm using the multilinear extension of [3] depends on the value of the maximum e∈S f(e). It is clear that this approximation is at least the original function and it can be much larger. They observed that the running time is proportional to the ratio between the maximum weight base when weights are measured using the modular approximation compared with the optimal solution when weights are measured using the original function. On the other hand, in the greedy algorithm, the gain in every greedy step is proportional to the maximum weight base when weights are measured using the modular approximation. Thus, the discrete greedy algorithm makes fast progress precisely when the continuous algorithm is slow and vice versa. Therefore, one can start with the discrete greedy algorithm and switch to the continuous algorithm when the maximum weight solution is small even when weights are measured using the modular approximation. Our algorithm consists of two key components: (1) a fast dynamic data structure for maintaining an approximate maximum weight base through a sequence of greedy steps, and (2) an algorithm that makes only a small number of queries to the data structure. Even if fast dynamic data structures are available, previous algorithms including that of [5] cannot achieve a fast time, since they require Ω(nk) queries to the data structure: the algorithm of [5] maintains the marginal gain for every element in the current base and it updates them after each greedy step; since each greedy step changes the marginal gain of every element in the base, this approach necessitates Ω(k) data structure queries per greedy step. Our new approach uses random sampling to ensure that the number of queries to the data structure is nearly-linear. After each greedy step, our algorithm randomly samples elements from the base to check and update the marginal gains. Because of sampling, it can only ensure that at least 1/2 of the elements in every value range have good estimates of their values. However, this is sufficient for maintaining an approximate maximum weight base. The benefit is that the running time becomes much faster: the number of checks that do not result in updates is small and if we make sure that an update only happens when the marginal gain change by a factor 1 −  then the total number of updates is at most O(n log n/). Thus we obtain an algorithm with only a nearly-linear number of data structure queries and additional running time for any matroid constraint. Our approach reduces the algorithmic problem to the data structure problem of maintaining an approximate maximum weight base through a sequence of value updates. In fact, the updates are only decrement in the values and thus can utilize even the decremental data structures as opposed to fully dynamic ones. In the case of a partition matroid constraint, one can develop a simple ad- hoc solution. In the case of a graphic matroid, one can use classical data structures for maintaining minimum spanning trees [16]. In both cases, fast rounding algorithms are also needed. The work [5] gives an algorithm for the partition matroid. We give an algorithm for the graphic matroid based on swap rounding and classical dynamic graph data structures. To obtain fast running time, in each rounding step, 5 instead of swapping a generic pair, we choose a pair involving a leaf of the spanning tree. 1.3 Basic definitions and notation Submodular functions. Let f : 2V → R+ be a set function on a finite ground set V of size n := V . The function is submodular if f(A) + f(B) ≥ f(A ∩ B) + f(A ∪ B) for all subsets A, B ⊆ V . The function is monotone if f(A) ≤ f(B) for all subsets A ⊆ B ⊆ V . We assume that the function f is given as a value oracle that takes as input any set S ⊆ V and returns f(S). We let F : [0, 1]V → R+ denote the multilinear extension f. For every x ∈ [0, 1]V , we have F(x) = X f(S)Y S⊆V (1 − xe) = E[R(x)], Y e /∈S xe e∈S all i ∈ [h]. We let k = Ph where R(x) is a random set that includes each element e ∈ V independently with probability xe. Matroids. A matroid M = (V,I) on a ground set V is a collection I of subsets of V , called independent sets, that satisfy certain properties. In this paper, we consider matroids that are given to the input to the algorithm. Of particular interest are the partition and graphic matroids. A generalized partition matroid is defined as follows. We are given a partition V1, V2, . . . , Vh of V into disjoint subsets and budgets k1, k2, . . . , kh. A set S is independent (S ∈ I) if S ∩ Vi ≤ ki for i=1 ki denote the rank of the matroid. A graphic matroid is defined as follows. We are given a graph on k + 1 vertices and n edges. The independent sets of the matroid are the forests of this graph. Additional notation. Given a set S ∈ I, we let fS denote the function fS : 2V \S → R≥0 such that fS(S0) = f(S0 ∪ S) − f(S) for all S0 ⊆ V \ S. We let M/S = (V \ S,I0) denote the matroid obtained by contracting S in M, i.e., S0 ∈ I0 iff S0 ∪ S ∈ I. We let P(M) denote the matroid polytope of M: P(M) is the convex hull of the indicator vectors of the bases of M, where a base is an independent set of maximum size. Constant factor approximation to f(OPT). Our algorithm needs a O(1) approximation to f(OPT). Such an approximation can be computed very efficiently, see for instance [5]. 1.4 Paper organization In Section 2, we describe our algorithm for the continuous optimization problem of maximizing the multilinear extension subject to a general matroid constraint, with the properties stated in Theo- rem 1. As discussed in the introduction, our algorithm uses certain data structures to achieve a fast running time. In Section 3, we show how to obtain these data structures for partition and graphic matroids; as discussed in the introduction, the independent set data structures are readily available, and we describe the maximum weight base data structures in Section 3. The results of Section 2 and 3 give nearly-linear time algorithms for the continuous problem of maximizing the multilinear extension subject to a partition and graphic matroid constraint. To obtain a fast algorithm for the discrete problem, we also need a fast algorithm to round the fractional solution. Buchbinder et al. [5] give a nearly-linear time rounding algorithm for a partition matroid. In Section 4, we give a nearly-linear time rounding algorithm for a graphic matroid, and prove Theorem 6. These results together give Theorems 2 and 3. 6 Algorithm 1 Algorithm for the continuous problem maxx∈P (M) F(x) for a general matroid 1: procedure ContinuousMatroid(f,M, ) c0 = Θ(1/), where the Θ hides a sufficiently large absolute constant 2: S = LazySamplingGreedy(f,M, ) 3: x = ContinuousGreedy(fS,M/S, c0, ) 4: return 1S ∨ x 5: 6: end procedure hh x ∨ y is the vector (x ∨ y)i = max{xi, yi} for all i ii 2 The algorithm for the continuous optimization problem In this section, we describe and analyze our algorithm for the continuous problem maxx∈P (M) F(x) for a general matroid M, and prove Theorem 1. The algorithm is given in Algorithm 1 and it combines the continuous Greedy algorithm of [3] with a discrete Greedy algorithm that we provide in this paper, building on [5]. The continuous Greedy algorithm. The algorithm used on line 4 is the algorithm of [3]. To obtain a fast running time, we use an independent set data structure to maintain the independent sets constructed by the algorithm. The data structure needs to support two operations: add an element to the independent set, and check whether an element can be added to the independent set while maintaining independence. For a partition matroid, such a data structure with O(1) time per operation is trivial to obtain. For a graphic matroid, we can use a union-find data structure [13, 23] with a O(log∗ k) amortized time per operation. It follows from the work of [3] and [5] that the algorithm has the following properties. queries to the value oracle of f and additional arithmetic operations. Moreover, if maxS∈IP Lemma 7 ([3], [5]). When run with values c and δ as input, the ContinuousGreedy(f,M, c, δ) algorithm uses O(n ln(n/δ)/δ2) independent set data structure operations, and O(cn ln2(n/δ)/δ4) c · f(OPT), where OPT ∈ argmaxS∈I f(S), the solution x returned by the algorithm satisfies F(x) ≥ (1 − 1 e∈S f(e) ≤ e − δ)f(OPT). The discrete Greedy algorithm is given in Algorithm 2. The algorithm works for any matroid constraint for which we can provide a fast data structure for maintaining a maximum weight base. We now describe the properties we require from this data structure. We show how to implement a data structure with these properties in Section 3 for a graphic matroid and a partition matroid. The dynamic maximum weight base data structure. Algorithm 2 makes use of a data structure for maintaining the maximum weight base in the matroid, where each element has a weight and the weights are updated through a sequence of updates that can only decrease the weights. The data structure needs to support the following operation: UpdateBase decreases the weight of an element and it updates the base to a maximum weight base for the updated weights. The data structures that we provide in Section 3 for a graphic and a partition matroid support this operation in O(poly(log k)) amortized time. We note here that the data structure maintains a maximum weight base of the original matroid M, and not the contracted matroid M/S obtained after picking a set S of elements. This suffices for us, since the discrete Greedy algorithm that we use will not change the weight of an element after it was added to the solution S. Due to this invariant, we can show that the maximum weight base B of M that the data structure maintains has the property that S ⊆ B at all times, and B \ S 7 Algorithm 2 LazySamplingGreedy(f,M, ) 1: M = Θ(f(OPT)), c = Θ(1/), N = 2 ln(k/)/ 2: hh maintain cached (rounded) marginal values ii 3: For each e ∈ V , let w(e) = (1 − )N M if f({e}) ≤ (1 − )N M and w(e) = (1 − )j−1M if 4: hh maintain a base B of maximum w(· ) value in a data structure that supports f({e}) ∈ ((1 − )jM, (1 − )j−1M] the UpdateBase operation ii end if Sample an element e uniformly at random from B S ← S ∪ {e} Remove e from the buckets of B for refreshing purpose so that w(e) is now fixed hh Spot check and update values in all buckets ii Exit the while loop and continue to iteration j + 1 end if Sample e uniformly at random from B(j) Let v(e) = f(S ∪ {e}) − f(S) be the current marginal value of e if v(e) < (1 − )jM then 5: B = argmaxS∈IP 8: W =P e∈S w(e) return S 6: hh maintain a partition of B into buckets ii 7: B(j) = {e ∈ B : w(e) = (1 − )j−1M} for each j ∈ [N] e∈B w(e) 9: hh main loop ii 10: S = ∅ 11: for t = 1, 2, . . . , k do Call RefreshValues 12: if W ≤ 4cM then 13: 14: 15: 16: 17: 18: 19: end for 1: procedure RefreshValues 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: end procedure T = 0 UpdateBase(e, j, v(e)) T ← T + 1 T = 0 while T < 4 log2 n do if B(j) is empty then for j = 1 to N do else end if end while end for 8 is a maximum weight base in M/S. This follows from the observation that, if an element e is in the maximum weight base B and the only changes to the weights are such that the weight of e remains unchanged and the weights of elements other than e are decreased, then e remains in the new maximum weight base. The discrete Greedy algorithm. The algorithm (Algorithm 2) is based on the random residual Greedy algorithm of [4]. The latter algorithm constructs a solution S over k iterations. In each iteration, the algorithm assigns a linear weight to each element that is equal to the marginal gain f(S ∪ {e}) − f(S) on top of the current solution, and it finds a maximum weight base B in M/S. The algorithm then samples an element of B uniformly at random and adds it to the solution. As discussed in Section 1.2, the key difficulty for obtaining a fast running time is maintaining the maximum weight base. Our algorithm uses the following approach for maintaining an approximate maximum weight base. The algorithm maintains the marginal value of each element (rounded to the next highest power of (1 − )), and it updates it in a lazy manner; at every point, w(e) denotes the cached (rounded) marginal value of the element, and it may be stale. The algorithm maintains the base B using the data structure discussed above that supports the UpdateBase operation. Additionally, the elements of B \ S are stored into buckets corresponding to geometrically decreasing marginal values. More precisely, there are N = O(log(k/)/) buckets B(1), B(2), . . . , B(N). The j-th bucket B(j) contains all of the elements of B with marginal values in the range ((1− )jM, (1− )j−1M], where M is a value such that f(OPT) ≤ M ≤ O(1)f(OPT) (we assume that the algorithm knows such a value M, as it can be obtained in nearly-linear time, see e.g. Lemma 3.3 in [5]). The remaining elements of B that do not appear in any of the N buckets have marginal values at most (1 − )N M; these elements have negligible total marginal gain, and they can be safely ignored. In order to achieve a fast running time, after each Greedy step, the algorithm uses sampling to (partially) update the base B, the cached marginal values, and the buckets. This is achieved by the procedure RefreshValues, which works as follows. RefreshValues considers each of the buckets in turn. The algorithm updates the bucket B(j) by spot checking O(log n) elements sampled uniformly at random from the bucket. For each sampled element e, the algorithm computes its current marginal value and, if it has decreased below the range of its bucket, it moves the element to the correct buckets and call UpdateBase to maintain the invariant that B is a maximum weight base. When the algorithm finds an element whose bucket has changed, it resets to 0 the count for the number of samples taken from the bucket. Thus the algorithm keeps sampling from the bucket until Θ(log n) consecutive sampled elements do not change their bucket. The sampling step ensures that, with high probability, in each bucket at least half of the elements are in the correct bucket. (We remark that, instead of resetting the sample count to 0, it suffices to decrease the count by 1, i.e., the count is the total number of samples whose bucket was correct minus the number of samples whose bucket was incorrect. The algorithm then stops when this tally reaches Θ(log n). This leads to an improvement in the running time, but we omit it in favor of a simpler analysis.) After running RefreshValues, the algorithm samples an element e uniformly at random from B \ S and adds it to S. The algorithm then removes e from the buckets; this ensures that the weight of e will remain unchanged for the remainder of the algorithm. Next, we analyze the algorithm and show the approximation and running time guarantees stated in Theorem 1. 9 2.1 Analysis of the running time Here we analyze the running time of the algorithm Algorithm 1. Lemma 8. The ContinuousGreedy algorithm uses O(n ln2(n/)/5) calls to the value oracle of f and arithmetic operations, and O(n ln(n/)/) independent set data structure operations. Proof. Since we run the ContinuousGreedy algorithm with c = O(1/) and δ = , the lemma follows from Lemma 7. Lemma 9. The LazySamplingGreedy algorithm uses O(kN log n) calls to the value oracle of f and maximum weight data structure operations, and O(n + kN log n) additional arithmetic operations. Proof. The running time of LazySamplingGreedy is dominated by RefreshValues. Consider the RefreshValues subroutine. Each iteration of the while loop of RefreshValues uses O(1) function evaluations and makes one call to the dynamic maximum base data structure. We divide the work performed updating a given bucket j into epochs, where an epoch is a sequence of con- secutive iterations of the while loop starting with T = 0 and ending when either T is reset to 0 on line 11 -- an intermediate epoch -- or T reaches 4 log2 n -- a final epoch. Since each epoch has O(log n) iterations, it runs in O(log n) amortized time and O(log n) function evaluations. Every intermediate epoch moves an element e to a lower bucket, and we charge the total work done by the epoch to the element e. Since an element e can be charged only N times, we can upper bound the numbers of update base operations and function evaluations of the intermediate epochs across the entire run of LazySamplingGreedy by O(nN log n). The number of final epochs is at most kN and thus their numbers of update base operations and function evaluations is O(kN log n). 2.2 Analysis of the approximation guarantee Here we show that Algorithm 1 achieves a 1 − 1/e −  approximation. The following lemma shows that, with high probability over the random choices of Refresh- We first analyze the LazySamplingGreedy algorithm. We start with some convenient defi- nitions. Consider some point in the execution of the LazySamplingGreedy algorithm. Consider a bucket B(j). At this point, each element e ∈ B(j) is in the correct bucket iff its current marginal value f(S ∪{e})− f(S) lies in the interval ((1− )jM, (1− )j−1M] (its cached marginal value w(e) lies in that interval, but it might be stale). We say that the bucket B(j) is good if at least half of the elements in B(j) are in the correct bucket, and we say that the bucket is bad otherwise. Values, each run of RefreshValues ensures that every bucket B(j) with j ∈ [N] is good. Lemma 10. Consider an iteration in which LazySamplingGreedy calls RefreshValues. When RefreshValues terminates, the probability that the buckets {B(j) : j ∈ [N]} are all good is at least 1 − 1/n2. Proof. We will show that the probability that a given bucket is bad is at most 5 log n/n3; the claim then follows by the union bound, since there are N ≤ n/(5 log n) buckets. Consider a bucket B(j), where j ∈ [N], and suppose that the bucket is bad at the end of RefreshValues. We analyze the probability the bucket is bad because the algorithm runs until iteration t, which is the last time the algorithm finds an element in B(j) in the wrong bucket, and for 4 log n iterations after t, it always find elements in the right bucket even though only 1/2 of B(j) are in the right bucket. Since at 10 most half of the elements of B(j) are in the correct bucket and the samples are independent, this event happens with probability at most (1/2)4 log2 n = 1/n4. By the union bound over all choices of t = 1, 2, . . . , 5n log n, the failure probability for bucket B(j) is at most 5 log n/n3. Since LazySamplingGreedy performs at most k ≤ n iterations, it follows by the union bound that all of the buckets {B(j) : j ∈ [N]} are all good throughout the algorithm with probability at least 1 − 1/n2. For the remainder of the analysis, we condition on this event. Additionally, we fix an event specifying the random choices made by RefreshValues and we implicitly condition all probabilities and expectations on this event. Let us now show that B is a suitable approximation for the maximum weight base in M/S with weights given by the current marginal values f(S ∪ {e}) − f(S). Lemma 11. Suppose that every bucket of B is good throughout the algorithm. Let v(e) = f(S ∪ {e}) − f(S) denote the current marginal values. We have (1) w(S0) ≥ v(S0) for every S0 ⊆ V ; (2) w(B) ≥ w(S0) for every S0 ⊆ V ; (3) v(B) ≥ 1− 2 Proof. The first property follows from the fact that, by submodularity, the weights w(·) are upper bounds on the marginal values. the maximum weight base in M/S with respect to the weights w(·). Let us now show the third property. Consider the following partition of B into sets B1, B2, and B3, where: B1 is the set of all elements e ∈ B such that e is in one of the buckets {B(j) : j ∈ [N]} and moreover e is in the correct bucket (note that (1 − )w(e) ≤ v(e) ≤ w(e) for every e ∈ B1); B2 is the set of all elements e ∈ B such that e is in one of the buckets {B(j) : j ∈ [N]} but e is not in the correct bucket (i.e., (1 − )N M < w(e) but v(e) < (1 − )w(e)); B3 is the set of all elements e ∈ B such that w(e) < (1 − )N M ≤ (/k)2M. The second property follows from the fact that the algorithm maintains the invariant that B is · w(B) − 2 k · M. Since B3 ≤ k, we have w(B3) ≤ B3 · (cid:18)  (cid:19)2 k M ≤ 2 M. k Since all of the buckets are good, it follows that the total w(·) weight of the elements that are in the correct bucket is at least 1 2 · w(B \ B3). Indeed, we have NX (1 − )j−1MB1 ∩ B(j) ≥ NX j=1 (1 − )j−1M B(j) 2 = w(B \ B3) 2 . j=1 w(B1) = w(B1 ∩ B(j)) = NX j=1 Finally, since v(e) ≥ (1 − )w(e) for every e ∈ B1, we have v(B) ≥ v(B1) ≥ (1 − )w(B1) ≥ 1 −  2 w(B \ B3) ≥ 1 −  2 w(B) − 2 k M. 11 Now we turn to the analysis of the main for loop of LazySamplingGreedy (lines 11 -- 19). Let T be a random variable equal to the number of iterations where the algorithm executes line 17. We define sets {St : t ∈ {0, 1, . . . , k}} and {OPTt : t ∈ {0, 1, . . . , k}} as follows. Let S0 = ∅ and OPT0 = OPT. Consider an iteration t ≤ T and suppose that St−1 and OPTt−1 have already been defined and they satisfy St−1 ∪ OPTt−1 ∈ I and St−1 + OPTt−1 = k. Consider a bijection π : B → OPTt−1 so that OPTt−1 \ {π(e)} ∪ {e} is a base of M/St−1 for all e ∈ B (it is well-known that such a bijection exists). Let et be the element sampled on line 17 and ot = π(et). We define St = St−1 ∪ {et} and OPTt = OPTt−1 \ {ot}. Note that St ∪ OPTt ∈ I. In each iteration t, the gain in the Greedy solution value is f(St) − f(St−1), and the loss in the optimal solution value is f(OPTt−1) − f(OPTt) (when we add an element to St−1, we remove an element from OPTt−1 so that St ∪ OPTt remains a feasible solution). The following lemma relates the two values in expectation. Lemma 12. For every t ∈ [k], if all of the buckets B(j) are good, we have E[f(St) − f(St−1)] ≥ c · E[f(OPTt−1) − f(OPTt)]. Proof. Consider an iteration t ∈ [k]. If t > T, the inequality is trivially satisfied, since both expectations are equal to 0. Therefore we may assume that t ≤ T and thus St = St−1 ∪ {et} and OPTt = OPTt−1 \ {ot}. Let us now fix an event Rt−1 specifying the random choices for the first t − 1 iterations, i.e., the random elements e1, . . . , et−1 and o1, . . . , ot−1. In the following, all the probabilities and ex- pectations are implicitly conditioned on Rt−1. Note that, once Rt−1 is fixed, St−1 and OPTt−1 are deterministic. Let us first lower bound E[f(St−1 ∪ {et}) − f(St−1)]. Let wt, Bt, and Wt denote w, B, and W right after executing RefreshValues in iteration t. Note that, since Rt−1 and the random choices of RefreshValues are fixed, wt, Bt, and Wt are deterministic. correct bucket, for every j ∈ [N]. Let B0 are in the correct bucket, and let B00 not in any bucket. For every e ∈ B0 are in the t be the subset of Bt consisting of all of the elements that t be the subset of Bt consisting of all of the elements that are Recall that all of the buckets of Bt are good, i.e., at least half of the elements of B (j) t t, we have f(St−1 ∪ {e}) − f(St−1) ≥ (1 − )wt(e). For every e ∈ B00 t , we have f(St−1 ∪ {e}) − f(St−1) ≤ wt(e) = (1 − )N M ≤ (/k)2M, and therefore wt(B00 t ) ≤ 2 k M. Since all of the buckets are good and Wt > 4cM (the algorithm did not terminate on line 14), we 12 have X e∈B0 t wt(e) = j=1 t ∩ B wt(B0 NX (j) t ) = NX (1 − )j−1MB0 ≥ NX j=1 2 = wt(Bt \ B00 B t ) (1 − )j−1M 2c − 2 2 − 2 2c − 2 2k 2k 2k j=1 ≥ Wt M ≥ M ≥ ! (j) t 2 t ∩ B (j) t ! f(OPT). By combining these observations, we obtain t] Pr[et ∈ B0 t] t] · B0 t Bt E[f(St−1 ∪ {et}) − f(St−1)] ≥ E[f(St−1 ∪ {et}) − f(St−1)et ∈ B0 = E[f(St−1 ∪ {et}) − f(St−1)et ∈ B0 t] · B0 t ≥ (1 − )E[wt(et)et ∈ B0 Bt t t · B0 t) · 1 = (1 − )wt(B0 (cid:17) B0 Bt ≥ (1 − )(cid:16)2c − 2 f(OPT) 2k Bt Bt f(OPT) ≥ c Let us now upper bound E[f(OPTt−1) − f(OPTt)]. Recall that et is chosen randomly from B and thus, ot is chosen uniformly at random from OPTt−1 (since π is a bijection). Hence (f(OPTt−1) − f(OPTt−1 \ {o})) · 1 OPTt−1 Now consider an arbitrary ordering o1, o2, . . . , om of OPTt−1. We have E[f(OPTt−1) − f(OPTt−1 \ {ot})] = X mX ≥ mX f(OPTt−1) − f(∅) = j=1 o∈OPTt−1 (f({o1, . . . , oj}) − f({o1, . . . , oj−1})) (f(OPTt−1) − f(OPTt−1 \ {oj}), j=1 where the inequality follows from submodularity: the marginal gain of oj on top of OPTt−1 \ {oj} is at most its marginal gain on top of {o1, . . . , oj−1} ⊆ OPTt−1 \ {oj}. Therefore E[f(OPTt−1) − f(OPTt−1 \ {ot})] ≤ f(OPTt−1) OPTt−1 ≤ f(OPT) OPTt−1 . To recap, we have shown that E[f(St−1 ∪ {et}) − f(St−1)] ≥ c · f(OPT) Bt and E[f(OPTt−1) − f(OPTt−1 \ {ot})] ≤ f(OPT) OPTt−1 . 13 Since Bt = OPTt−1, we have E[f(St−1 ∪ {et}) − f(St−1)] ≥ c · E[f(OPTt−1) − f(OPTt−1 \ {ot})]. Since the above inequality holds conditioned on every given event Rt−1, it holds unconditionally, and the lemma follows. By combining Lemmas 11 and 12, we obtain: Lemma 13. If all of the buckets B(j) are good, the LazySamplingGreedy algorithm (Algo- rithm 2) returns a set S ∈ I with the following properties. e∈S0 fS(e) ≤ 4cM = O(1/)f(OPT). (1) maxS0 : S0∪S∈IP (2) There is a random subset OPT0 ⊆ OPT depending on S with the following properties: S ∪ c · E[f(S)] ≥(cid:16)1 − 1 c (cid:17) f(OPT). OPT0 ∈ I and E[f(OPT0)] ≥ f(OPT) − 1 Proof. The first property follows from Lemma 11 and the stopping condition of LazySampling- Greedy. Indeed, let v(e) = fS(e) and A ∈ argmaxS0 : S0∪S∈I v(S0). When the algorithm stops, we have w(B) ≤ 4cM. Additionally, by Lemma 11, we have v(A) ≤ w(A) ≤ w(B) ≤ 4cM = O(1/)f(OPT). Now consider the second property. Let OPT0 = OPTk. By Lemma 12, E[f(S)] = kX t=1 E[f(St) − f(St−1)] ≥ c · kX t=1 E[f(OPTt−1) − f(OPTt)] = c(f(OPT) − E[f(OPT0)]). The second property now follows by rearranging the inequality above. By combining Lemmas 7 and 13, we obtain: Lemma 14. The ContinuousMatroid algorithm (Algorithm 1) returns a solution 1S∨x ∈ P(M) such that F(1S ∨ x) ≥ (1 − 1/e − O())f(OPT) with constant probability. Proof. Note that, in order to apply Lemma 7, we need the following condition to hold: max fS(e) ≤ c0fS(OPT00), S0 : S0∪S∈I where OPT00 ∈ argmaxS0 : S0∪S∈I fS(S0). Using Lemma 13, we can show that the above condition holds with constant probability as follows. Let OPT0 be the set guaranteed by Lemma 13. We have fS(OPT0) ≤ fS(OPT00) and f(S ∪ OPT0) ≥ f(OPT0). Therefore e∈S0 X fS(OPT00) ≥ fS(OPT0) ≥ f(OPT0) − f(S). By Lemma 13, we have E[f(OPT) − f(OPT0)] ≤ f(OPT)/c. Therefore, by the Markov in- equality, with probability at least 2/3, we have f(OPT) − f(OPT0) ≤ 3f(OPT)/c. Consider two 14 cases. First, if f(S) ≥ (1 − 1/e)f(OPT) then the algorithm can simply return S. Second, if f(S) < (1 − 1/e)f(OPT) then fS(OPT00)) ≥ f(OPT0) − f(S) ≥ (1/e − 3/c)f(OPT). Therefore, fS(e) ≤ O(cfS(OPT00)) ≤ c0fS(OPT00). Thus the conditions of Lemma 7 are satisfied and thus the continuous Greedy algorithm returns a solution x ∈ P(M/S) such that X e∈S0 max S0 : S0∪S∈I F(1S ∨ x) − f(S) ≥ ≥ ≥ (cid:18) (cid:18) (cid:18) e 1 − 1 1 − 1 1 − 1 e e (cid:19) (cid:19)(cid:18) (f(OPT0) − f(S)) −  1 − 3 (cid:19) −  f(OPT) − f(S). − 2 (cid:19) c f(OPT) − f(S) 3 Dynamic maximum weight base data structures In this section, we describe the data structures for maintaining a maximum weight base in a partition or a graphic matroid. The weights of the elements can only decrease and the data structure needs to support the operation UpdateBase that decreases the weight of an element and it updates the base to a maximum weight base with respect to the new weights. 3.1 The data structure for a graphic matroid For a graphic matroid, UpdateBase is an update operation for a dynamic maximum weight spanning tree data structure. We can use the deterministic data structure by [16], which can handle each update in O((log k)4) amortized time. Because the weights are only decreased, it suffices to use their decremental data structure instead of the fully dynamic one. 3.2 The data structure for a partition matroid For a partition matroid, UpdateBase simply needs to replaces e in the base with an element e0 in its part with maximum weight. As we discuss below, the data structures representing the buckets allow us to implement the replacement in O(1) amortized time. In each of the parts Vi of the matroid, we maintain the partition of elements into buckets where contains all of the elements of Vi with marginal values in the range ((1 − )jM, (1 − bucket V )j−1M]. The buckets of B and the parts Vi are represented as doubly linked lists (each item has (j) a pointer to the previous and next items in the list). The list representing each of the buckets V i \ B(j). This (j) has the elements of B(j) at the front and there is a pointer to the first element of V i representation allows us to perform each of the following operations in constant time: (j) i • We can remove an element from the list. • We can add e to V as follows. If e ∈ B, we insert e at the end of the prefix storing B(j) using the pointer to the first element after B(j). If e /∈ B, we insert e at the end of the list. (j) i 15 hh Update w(e) to v(e) from (1 − )j−1M ii Let i be the part containing e (e ∈ Vi) (j) Remove e from B, B(j), and V i if v(e) > (1 − )N M then Algorithm 3 Update the maximum weight base for a partition matroid. 1: procedure UpdateBase(e, j, v(e)) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: end procedure end if Find e00 ∈ argmaxe0∈Vi\B w(e0) Let j00 be such that w(e00) = (1 − )j00−1M Add e00 to B and to B(j00) if j00 6= N + 1 W = W − (1 − )j−1M + (1 − )j00−1M Let j0 be such that v(e) ∈ ((1 − )j0 w(e) = (1 − )j0−1M Add e to V w(e) = (1 − )N M M, (1 − )j0−1M] (j0) i else • We can add e to B or B(j) by inserting it at the end of the list. (j) i Additionally, we can find an element e∗ ∈ argmaxe∈Vi\B w(e) in constant amortized time as follows. A slower approach is to scan the buckets V in increasing order (from j = 1 to j = N) to find the \ B(j) is non-empty, and return the first element after B(j) (recall that first bucket for which V (j) B(j) is at the front of V after B(j)). This can and we have a pointer to the first element of V i be improved using the following observation: the maximum weight base contains from each part Vi the elements of Vi with maximum weight, and thus these elements appear in consecutive buckets. Therefore, for each part Vi, we can maintain a pointer to the first bucket V that is partially full, i.e., V \ B(j) is non-empty. (j) i (j) i (j) i (j) i independent set with maximum cardinality). x represented as a convex combination x = Pt 4 Swap rounding for a graphic matroid In this section, we give a fast implementation of the swap rounding algorithm of Chekuri et al. [8] for a matroid polytope, shown in Algorithm 4. The rounding algorithm takes as input a point i=1 βi1Bi, where Bi is a base of M (a base is an In this section, we show that, when M is a graphical matroid, we can implement the swap rounding algorithm so that it runs in O(nt log2 n) time, where n is the rank of the matroid (the number of vertices in the graph) and t is the number of bases in the convex combination of x. The overall running time of SwapRound is the time of t − 1 calls to MergeBase. In the following, we show that we can implement the MergeBase subroutine so that it runs in O(n log2 n) time. Data structure for representing a spanning tree. In a graphical matroid, each base is a spanning tree. To obtain a fast implementation of MergeBase, we will represent each spanning tree using the following data structure. Consider a spanning tree T. For each vertex v of T, we 16 Algorithm 4 The swap rounding algorithm for a matroid polytope from [8] 1: procedure SwapRound(x =Pt i=1 βi1Bi) end for Return Ct C1 ← B1 γ1 ← β1 for i = 1 to t − 1 do Ci+1 ← MergeBases(γi, Ci, βi+1, Bi+1) γi+1 ← γi + βi+1 2: 3: 4: 5: 6: 7: 8: 9: end procedure 10: procedure MergeBases(β1, B1, β2, B2) 11: 12: 13: 14: 15: 16: 17: 18: 19: end procedure while B1 6= B2 do end while Return B1 Pick i ∈ B1 \ B2 and find j ∈ B2 \ B1 such that B1 − i + j ∈ I and B2 − j + i ∈ I With probability B2 ← B2 − j + i B1 ← B1 − i + j Else β1+β2 β1 use a gadget that is a red-black tree with deg(v) copies of v, each copy is connected to one edge of v in the original tree (see Figure 1). Figure 1: Representing a vertex of degree d using a red-black tree with d nodes. Let T 0 be the tree obtained from T by replacing each node by the gadget described above. We store the adjacency list of T 0 and an Eulerian tour of T 0 represented using the Euler tour data structure of Henzinger and King [15]. The Euler tour data structure represents any forest in such a way that each of the following operations takes O(log n) amortized time per operation: • link(T1, T2, e): connect two trees T1 and T2 of the forest into a single tree T = T1 ∪ T2 ∪ {e}, where e is an edge connecting T1 and T2; 17 • cut(T, e): split T into two trees by removing the edge e; • same-tree(u, v): return whether u and v are in the same tree of the forest. To summarize, the data structure representing a spanning tree T has the following components: • The red-black trees representing the gadgets of each node (Figure 1). • The adjacency list of the tree T 0 obtained from T by expanding each node by its gadget. • The Euler tour data structure representing the expanded tree T 0. The reason for using a red-black tree for the gadget is that each insertion and deletion involves O(1) rotations, leading to only O(1) link-cut operations to update the Euler tour data structure. We now describe how to implement the operations needed for merging two spanning trees. At the beginning of the MergeBase(T1, T2, β1, β2), we contract in T1 and T2 each edge that is in both trees. This can be accomplished similarly to the swap-and-contract operation described below (there is no swap, only the contraction). We can upper bound the running time of all of the contractions by O(n log2 n) using the same analysis as the one given below for swap-and- contract. We then proceed with the swap and update operations. such that T1 6= T2: The data structure will support the following two operations for two spanning trees T1 and T2 • find-swap(T1, T2) finds a pair (e, f) of edges such that e ∈ T1\T2 and f ∈ T2, and T1\{e}∪{f} and T2 \ {f} ∪ {e} are spanning trees. • swap-and-contract(T, T 0, e, e0) implements the update T ← T\{e}∪{e0} as follows: update the data structure representing T to remove e and add e0, and update the data structures representing T and T 0 to contract e0 in both trees. The following claims upper bound the time to perform the swap-and-contract operation. Claim 15. We can implement the update T ← T \ {e} ∪ {e0} in O(log n) amortized time. Proof. Removing edge e = (u, v) requires a cut operation on the Eulerian tour data structure representing T at the location of e, and a deletion of e from the red-black trees of vertices u and v. Each insertion and deletion in a red-black tree has O(log n) time and O(1) rotations. Therefore the total time for removing e is O(log n). Adding edge e0 = (x, y) requires an insertion of e0 to the red-black trees of vertices x and y, and a link operation on the Eulerian tour at the location of e0. Each of these operations takes O(log n) time so the total time for adding e0 is O(log n). Claim 16. We can contract an edge e = (u, v) in T in O(deg(v) log n) amortized time. Proof. To contract an edge (u, v), we meld the red-black tree of v into the red-black tree of u: we break up the red-black tree of v into individual nodes, and we insert them one by one into the red- black tree of u. This requires deg(v)−1 insert operations in the red-black tree of u, and each insert operation has an O(log n) amortized cost. Therefore the amortized cost is O(deg(v) log n). 18 We next discuss how to implement the find-swap operation. The key idea is to use an edge e adjacent to a leaf in T1 as opposed to an arbitrary edge. It is straightforward to maintain the degrees of the vertices in the tree in a such a way that we can retrieve a leaf node in O(1) time. Let v be a leaf node in T1 and let e = (v, u) be its incident edge. We can find the edge f ∈ T2 (the swapping partner of the leaf edge e) as follows. (a) T1 (b) T2 Figure 2: v is a leaf in T1. The swapping partner of the edge (v, u) in T1 is the unique edge (v, w) in T2 such that w is on the path between u and v in T2 Figure 3: To check if v is connected to u via one of the edges on the left half of v's red-black tree, we can remove the edge between v1 and v2 and check if v1 and u are still connected. Notice that the swapping partner of (v, u) must be an edge (v, w) where w is on the path between v and u in T2 (Figure 2). We can find the vertex w by performing a binary search in the red-black tree of v in T2 as follows. In the following, by the tree T2 we mean the expanded tree where each vertex is replaced by its red-black tree gadget. We start at the root of the red-black tree of v in T2. We want to find v by searching in the appropriate subtree of the red black tree (either the subtree rooted at the left child or the subtree comprised of the root together with the subtree rooted at the right child). To this end, we remove the edge connecting the root and its left child from T2 using a cut operation (Figure 3). This splits the red-black tree of v into two parts and also splits T2 into the two subtrees. Each subtree of T2 has a copy of v, where v in the first subtree has i edges of v and the copy of v in the second subtree has the remaining deg(v) − i edges. In each subtree, we check whether v is connected to u in that subtree by performing a same-tree(v, u) operation on the subtree. After performing the check, we know in which of the two subtrees v is connected to u: if it is the first subtree, (v, w) is one of the first i edges adjacent to v; otherwise, 19 vuvwuv1xyzv2 (v, w) is one of the remaining deg(v)− i. We add the edge that we removed back to T2 using a link operation, and recursively search in the subtree in which v and u are connected. Since the red-black tree has depth O(log n), we can find w using O(log n) operations. Thus the overall amortized cost for finding w is O(log2 n). the find-swap operations is O(n log2 n). By using the potential O(log n)P Running time of MergeBase. In a single iteration of MergeBase, we perform a find- swap operation and a swap-and-contract operation. The number of find-swap operations is at most n and each operation takes O(log2 n) amortized time, and thus the overall running time of x∈V deg(x) log deg(x), we can show that the overall running time of the swap-and-contract operations is O(n log2 n) as well. Thus the running time of MergeBase is O(n log2 n). Running time of SwapRounding. To round a convex combination of t spanning trees, we perform t − 1 calls to MergeBase, and thus the running time is O(tn log2 n). References [1] A. Ageev and M. Sviridenko. Pipage rounding: A new method of constructing algorithms with proven performance guarantee. Journal of Combinatorial Optimization, 8(3):307 -- 328, 2004. [2] Y. Azar and I. Gamzu. Efficient submodular function maximization under linear packing constraints. In International Colloquium on Automata, Languages and Programming (ICALP), 2012. [3] A. Badanidiyuru and J. Vondrák. Fast algorithms for maximizing submodular functions. In ACM-SIAM Symposium on Discrete Algorithms (SODA), 2014. [4] N. Buchbinder, M. Feldman, J. Naor, and R. Schwartz. Submodular maximization with car- dinality constraints. In ACM-SIAM Symposium on Discrete Algorithms (SODA), 2014. [5] N. Buchbinder, M. Feldman, and R. Schwartz. Comparing apples and oranges: Query trade-off in submodular maximization. Math. Oper. Res., 42(2):308 -- 329, 2017. [6] G. Calinescu, C. Chekuri, M. Pál, and J. Vondrák. Maximizing a submodular set function subject to a matroid constraint. SIAM Journal on Computing, 40(6):1740 -- 1766, 2011. [7] C. Chekuri, T. S. Jayram, and J. Vondrák. On multiplicative weight updates for concave and submodular function maximization. In Conference on Innovations in Theoretical Computer Science (ITCS), 2015. [8] C. Chekuri, J. Vondrák, and R. Zenklusen. Dependent randomized rounding via exchange properties of combinatorial structures. In IEEE Foundations of Computer Science (FOCS), pages 575 -- 584. IEEE Computer Society, 2010. [9] S. Dughmi, T. Roughgarden, and M. Sundararajan. Revenue submodularity. Theory of Com- puting, 8(1):95 -- 119, 2012. [10] U. Feige. A threshold of ln n for approximating set cover. J. ACM, 45:634 -- 652, 1998. 20 [11] Y. Filmus and J. Ward. Monotone submodular maximization over a matroid via non-oblivious local search. SIAM Journal on Computing, 43(2):514 -- 542, 2014. [12] M. L. Fisher, G. L. Nemhauser, and L. A. Wolsey. An analysis of approximations for maxi- mizing submodular set functions -- ii. Mathematical Programming Studies, 8:73 -- 87, 1978. [13] B. A. Galler and M. J. Fisher. An improved equivalence algorithm. Communications of the ACM, 7(5):301 -- 303, 1964. [14] R. Gomes and A. Krause. Budgeted nonparametric learning from data streams. In Interna- tional Conference on Machine Learning (ICML), pages 391 -- 398, 2010. [15] M. R. Henzinger and V. King. Randomized dynamic graph algorithms with polylogarithmic time per operation. In Proceedings of the Twenty-seventh Annual ACM Symposium on Theory of Computing, STOC '95, pages 519 -- 527, New York, NY, USA, 1995. ACM. [16] J. Holm, K. De Lichtenberg, and M. Thorup. Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. Journal of the ACM (JACM), 48(4):723 -- 760, 2001. [17] D. Kempe, J. M. Kleinberg, and É. Tardos. Maximizing the spread of influence through a social network. In ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pages 137 -- 146, 2003. [18] A. Krause, A. P. Singh, and C. Guestrin. Near-optimal sensor placements in gaussian processes: Theory, efficient algorithms and empirical studies. Journal of Machine Learning Research, 9:235 -- 284, 2008. [19] H. Lin and J. A. Bilmes. Multi-document summarization via budgeted maximization of sub- In Human Language Technologies: Conference of the North American modular functions. Chapter of the Association of Computational Linguistics, pages 912 -- 920, 2010. [20] B. Mirzasoleiman, A. Badanidiyuru, A. Karbasi, J. Vondrák, and A. Krause. Lazier than lazy greedy. In AAAI Conference on Artificial Intelligence (AAAI), 2015. [21] G. L. Nemhauser and L. A. Wolsey. Best algorithms for approximating the maximum of a submodular set function. Mathematics of Operations Research, 3(3):177 -- 188, 1978. [22] G. L. Nemhauser, L. A. Wolsey, and M. L. Fisher. An analysis of approximations for maxi- mizing submodular set functions -- i. Mathematical Programming, 14(1):265 -- 294, 1978. [23] R. E. Tarjan. Efficiency of a good but not linear set union algorithm. Journal of the ACM (JACM), 22(2):215 -- 225, 1975. [24] J. Vondrák. Optimal approximation for the submodular welfare problem in the value oracle model. In ACM Symposium on Theory of Computing (STOC), 2008. 21
1903.06570
1
1903
2019-03-15T14:26:59
scaleBF: A High Scalable Membership Filter using 3D Bloom Filter
[ "cs.DS", "cs.DB" ]
Bloom Filter is extensively deployed data structure in various applications and research domain since its inception. Bloom Filter is able to reduce the space consumption in an order of magnitude. Thus, Bloom Filter is used to keep information of a very large scale data. There are numerous variants of Bloom Filters available, however, scalability is a serious dilemma of Bloom Filter for years. To solve this dilemma, there are also diverse variants of Bloom Filter. However, the time complexity and space complexity become the key issue again. In this paper, we present a novel Bloom Filter to address the scalability issue without compromising the performance, called scaleBF. scaleBF deploys many 3D Bloom Filter to filter the set of items. In this paper, we theoretically compare the contemporary Bloom Filter for scalability and scaleBF outperforms in terms of time complexity.
cs.DS
cs
(IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 9, No. 12, 2018 scaleBF: A High Scalable Membership Filter using 3D Bloom Filter Ripon Patgiri, Sanbuzima Nayak, and Samir Kumar Borgohain Dept of Computer Science & Engineering National Institute of Technology Silchar Assam-788010, India Email: [email protected], [email protected], [email protected] 9 1 0 2 r a M 5 1 ] S D . s c [ 1 v 0 7 5 6 0 . 3 0 9 1 : v i X r a Abstract -- Bloom Filter is extensively deployed data structure in various applications and research domain since its inception. Bloom Filter is able to reduce the space consumption in an order of magnitude. Thus, Bloom Filter is used to keep information of a very large scale data. There are numerous variants of Bloom Filters available, however, scalability is a serious dilemma of Bloom Filter for years. To solve this dilemma, there are also diverse variants of Bloom Filter. However, the time complexity and space complexity become the key issue again. In this paper, we present a novel Bloom Filter to address the scalability issue without compromising the performance, called scaleBF. scaleBF deploys many 3D Bloom Filter to filter the set of items. In this paper, we theoretically compare the contemporary Bloom Filter for scalability and scaleBF outperforms in terms of time complexity. Keywords -- Bloom Filter; Membership Filter; Scalable Bloom Filter, Duplicate Key Filter; Hashing; Data Structure, Membership Query. I. INTRODUCTION Burton Howard Bloom introduces a data structure on approximate membership query in 1970 [1], hence, it is named as Bloom Filter. Bloom Filter is an extensively experimented to enhance a systems performance since its inception. Moreover, Bloom Filter is also applied numerous areas, namely, Big Data, Cloud Computing, Networking, Security [2], Database, IoT, Bioinformatics, Biometrics, and Dis- tributed system. However, Bloom Filter is inap- plicable in hard real-time system, and password management system [3] due to accuracy issues. Applications of Bloom Filter take the lion's share in Computer Networking which includes Named Data Networking (NDN), Content-Centric Network- ing (CCN), Software-defined Network (SDN), Do- main Name System (DNS), and Computer Security. The Bloom Filter reduces space consumption in an order of magnitude as compared to a conventional hash algorithm. However, Bloom Filter cannot stand itself. Bloom Filter is used as enhancer of a system. For example, BigTable uses Bloom Filter to reduce the number of disk accesses which improves the performance drastically [4]. Similarly, in Cassandra [5]. A. Motivation Several variants of Bloom Filters have been developed to address some issues [6]. However, most of the Bloom Filters are developed to address scalability issue. Guanlin Lu et al. [7] proposes a Forest-structured Bloom Filter (FBF). The FBF is a combination of RAM and flash memory. Similarly, Debnath et al. [8] develops a very high scalable Bloom Filter based on RAM and flash memory. BloomStore is also another highly scalable Bloom Filter [9]. However, these solutions are hierarchical, and thus, lookup and insertion cost is very high. It takes O(logn) time complexity in insertion and lookup operations as demonstrated in Table I. B. Contribution To address scalability issues, we propose a novel scalable Bloom Filter, called scaleBF. scaleBF is a very simple data structure yet powerful. scaleBF increases its scalability without compromising the performance. scaleBF takes O(1) time complexity in lookup and insertion operations, which is compared in Table I. scaleBF uses chaining hash data struc- ture for implementing the scalability. Also, scaleBF 548 P a g e www.ijacsa.thesai.org (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 9, No. 12, 2018 TABLE I. COMPARISON OF VARIOUS SCALABLE BLOOM FILTER Name BloomFlash [8] Types Hierarchical Insertion Logarithmic Lookup Logarithmic Scalability High FBF [7] Hierarchical Logarithmic Logarithmic BloomStore [9] Linear Chaining Constant Constant TB2F [10] Bloofi [11] scaleBF Hierarchical Hierarchical 3D Logarithmic Logarithmic Constant Logarithmic Logarithmic Constant High High Medium Medium High & & & Platform RAM Flash RAM Flash RAM Flash RAM RAM RAM Algorithm Serial Serial Parallel Parallel Serial Serial deploys 3DBF [12] to inherit the performance and low memory consumption. II. SCALEBF: THE PROPOSED SYSTEM A. 3D Bloom Filter (3DBF) The 3-Dimensional Bloom Filter (3DBF) is sim- ilar to conventional Bloom Filter except array struc- ture [12]. The 3DBF uses 3D arrays and it is a static Bloom Filter in nature. The static Bloom Filter does not change the size at run time. Also, static Bloom Filter does not readjust with ever growing data. However, a new 3DBF is created to address the scalability issue. Fig. 1. 3DBF architecture Table I depicts the most scalable Bloom Fil- ters. BloomFlash [8], and FBF [7] uses hierarchical structures to indexed the Bloom Filters. BloomStore [9] uses linear chain data structure (not open hash- ing data structure) to store the Bloom Filters in Flash memory. Moreover, BloomStore is designed to perform parallel lookup operation. On the con- trary, scaleBF uses chaining hash data structures to achieve higher scalability without compromising the performances. TB2F [10] deploys tree-bitmaps and Bloom Filter, and used for name lookup in Content- Centric Network (CCN). The input is split into a T- segment of fixed size and a B-Segment of variable size. The T-segment key is inserted into bitmap-trie, and the B-segment is inserted into Bloom Filter. However, maintaining trie data structure is costly in terms of space as well as time. On the other hand, Bloofi [11] uses tree structured Bloom Filter which cuases costly in insertion and lookup. The scalability of BloomFlash [8], FBF [7], BloomStore [9], scaleBF is higher than TB2F and Bloofi [11]. C. Organization The article is organized as follows- Section II presents the proposed system, called scaleBF. The architecture of scaleBF is demonstrated in Section II. Section III presents a theoretical analysis on scaleBF. Also, every aspect of scaleBF is analyzed in Section III. Article discusses cons of scaleBF in Section IV. Finally, the article is concluded in Section V. Figure 1 depicts the architecture of 3DBF. The 3D Bloom Filter uses four modulus operator using prime numbers instead of hashing a key into k different places. These modulus reduces the false positive probability. Thus, 3DBF is independent from number of hash functions k. Let, BX,Y,Z bet the 3DBF where X, Y and Z be the dimension of the filter. The dimensions are prime numbers, otherwise, false positive increases. Let, Bi,j,k be a cell of the 3DBF. The cell stores long int which occupies 64 − bits. Let us insert a key κ. The 3DBF uses Murmur hashing [13] to generate a hash- 549 P a g e www.ijacsa.thesai.org 3DBFXYZInsert(key, X, Y, Z) (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 9, No. 12, 2018 C. Lookup operation in scaleBF Figure 3 depicts the lookup operations of the scaleBF. A key is hashed into particular chain and lookup all Bloom Filters sequentially. As a com- parison, three 3DBF is searched. If the first three Bloom Filter returns true, then the key is member of Bloom Filter. Otherwise, move forward to the next three 3DBF, and so on. III. ANALYSIS There is no significant difference between 3DBF and conventional Bloom Filter analysis of number bits consumed, except k = 1 in 3DBF. Therefore, scaleBF is analyzed through the conventional Bloom Filter. Let, m be the size of Bloom Filter, n be the number of entries, and k = 1 be the number of hash function, then the probability of a bit to be '0' is Therefore, probability of total bit to be '1' is (cid:18) (cid:19)n (cid:19)n(cid:19) 1 − 1 m (cid:18) (cid:18) 1 − 1 − 1 m value of input item κ. Let, h be the generated hash- value by Murmur hashing. Now, i = h%X, j = h%Y, k = h%Z, and ρ = h%63, where ρ is the bit position of the cell Bi,j,k. 3DBF sets a bit using Equation (1)- Bi,j,k ← Bi,j,k OR (1 << ρ) (1) where OR is bitwise OR operator. Equation (1) is in- voked to insert an input item into 3DBF. The lookup operation requires similar calculation. Equation (2) is invoked to perform the lookup operation in a 3DBF. F lag ← (Bi,j,k ⊕ (1 << ρ))AN D(1 << ρ) (2) If F lag is assigned by '1', then 3DBF returns true, otherwise, it returns false. Each item requires a single bit in 3DBF as disclosed in Equation (1), and each cell has 63 − bits. Therefore, 3DBF consumes the lowest memory as compared to other variants of Bloom Filter. Moreover, 3DBF features detection of the fullness of the filter. 3DBF defines the criticality factor to consider whether the filter is full or not [12]. B. Insertion operation in scaleBF scaleBF deploys chaining mechanism of conven- tional hashing data structure for highly scalable. scaleBF deploys many 3DBFs. 1) Insertion of Bloom Filter: A Bloom Filter is formed by three 3DBFs. Each Bloom Filter is formed by three 3DBF. However, Bloom Filter can be formed by augmenting more 3DBF, but we have chosen three for simpler illustration. Each key is inserted into three 3DBF. Let, η be the chain size, and input item κ to be inserted. There are η chains in scaleBF. A new Bloom Filter (three 3DBF) is inserted into the chain if the Bloom Filter (three 3DBF) in particular chain is full. 2) Insertion of a Key: Insertion of the key is performed using Equation (1) and hashes the key into the particular chain. If a Bloom Filter (three 3DBF) size is full, then move to the last Bloom Filter (three 3DBF). Insert the key using Equation (1). A key is hashed into particular slot of the chain. There are many Bloom Filters in the particular slot linked with each other as shown in Figure 2. If first three Bloom Filter is full, then create and link three 3DBF as demonstrated in the figure. Since, scaleBF uses 3DBF, thus, m = X × Y × Z × 63. F. Grandi [14] present a new way to calculate the false positive probability using δ−transf ormation. Let, X be the random variable to represent the total number of '1' in the Bloom Filter, then (cid:18) (cid:18) 1 − 1 − 1 m (cid:19)n(cid:19) E[X] = m The probability of false positive is conditioned to a number by X = x, then P r(F PX = x) = (cid:16) x (cid:17) m Therefore, false positive probability is F P P = P r(F PX = x)P r(X = x) m(cid:88) x=0 F P P = m(cid:88) (cid:16) x (cid:17) m x=0 www.ijacsa.thesai.org f (x) 550 P a g e (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 9, No. 12, 2018 Fig. 2. Insertion of an input item and increment of filter size using conventional chaining in scaleBF. where f (x) is probability mass function of X. F. Grandi [14] applies δ−transf ormation to calculate f (x) and presents F P P as follows- m(cid:88) (cid:16) x (cid:17)(cid:18)m (cid:19) x(cid:88) m x x=0 j=0 (−1)j (cid:18)x (cid:19)(cid:18)x − j (cid:19)n j m (3) F P P = www.ijacsa.thesai.org Equation 3 is calculation of false positive probability of a 3DBF. scaleBF deploys three 3DBF. Therefore, the false positive probability of a Bloom Filter having three 3DBF is (cid:32) m(cid:88) 3(cid:89) (cid:16) x (cid:17)(cid:18)m (cid:19) x(cid:88) (cid:18)x (cid:19)(cid:18)x − j (cid:19)n(cid:33) (−1)j F P P = p=1 x=0 m x j=0 j m (4) 551 P a g e ...KeyH1()H2()H3() (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 9, No. 12, 2018 Fig. 3. Lookup of an input item in scaleBF. Let, there are n Bloom Filter (three 3DBF each), and their false positive probabilities are F P Pi, where i = 1, 2, 3, . . . , n. From Equation (4), the average false positive probability of scaleBF is (cid:80)m i=1 F P Pi n F P Pavg = (5) Equation (5) presents the false positive probability of scaleBF. A. Scalability Scalability is the key barrier to the modern Bloom Filter. There are numerous Bloom Filter that addresses the scalability issue. However, scalable Bloom Filters are developed based on reordering, hierarchical and forest structure. scaleBF uses sim- ple hashing scheme to enhance the scalability of Bloom Filter. The chaining is the most used hashing data structure. However, chaining has linear search 552 P a g e www.ijacsa.thesai.org ...KeyH1()H1()H2()H2()H3()H3() (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 9, No. 12, 2018 in the worst case, i.e., O(n) time complexity. In other words, all keys are hashed into single chain location. However, it is once in a blue moon in real- world. Besides, most of the chain remains unused. Therefore, the chaining size must be a prime number to avoid the above situation. Undoubtedly, the scalability is achieved using chaining data structure in scaleBF. The RAM size of the system also plays a vital role in scaleBF. 3DBF allocates memory dynamically which requires few memory blocks be contiguous to satisfy the request by the most modern programming language. Therefore, there is less worry about the unavailabil- ity of memory blocks. However, scaleBF does not guarantee the availability of the memory. Let, P be the slot size and Q be the number of chains to be stored in chaining. The load factor P , where P is a prime number, and Q is the α = Q total Bloom Filter to be inserted. Therefore, Q = mi 3 (6) T(cid:88) i=1 (cid:80)T P where mi is the size of ith 3DBF. Then, the load factor becomes The total available bits in scaleBF are mi 3 i=1 P α = τ × X × Y × Z ×(cid:16)(cid:80)T mi 3 i=1 (cid:17) (7) (8) where τ is the threshold that depends on the require- ments, X, Y , and Z are the dimensions. The τ is calculated by 1, 2, 3, . . . , β and β be the number of bits per cell in a 3DBF [12]. For high accuracy, τ is set to 1. However, τ = β defines that false positive is insignificance. B. Time and Space Complexity The time complexity is also a key barrier in the scalable Bloom Filter. Hierarchical Bloom Filter or Forest Structured Bloom Filter takes O(logn) time complexity in lookup and insertion operation. Other variants of scalable Bloom Filters also decrease the performance. scaleBF uses O(1) time complexity to lookup and insertion operation on an average case. However, the worst case time complexity is O(n) and it is impractical. Let, a key κ to be inserted into scaleBF. The κ is hashed into a particular slot of chain and insert into the key κ in desired Bloom Filter (three 3DBF). If the first Bloom Filter is full, then move to the next and so on. Let, the maximum, the size of a particular chain is C. scaleBF uses prime number P to evenly distribute the keys as disclosed in Equation (7). Thus, the size of C is small. Let us, there are 70% slots empty even if prime number P . That is, 30% slots are filled. Then, each slot has at least 30% of Q which is also very small. However, the P is a prime number, and thus, the distribution is fair enough to fill each slot. Thus, C is very small and the total time complexity is O(1) on an average. Similarly, lookup cost also O(1) on an average case. C. Performance scaleBF also inherits the performance of 3DBF [12]. The insertion and lookup cost depends on the cost of Equation (1) and (2). Equation (1) and (2) uses Murmur hashing [13], which is known as a very fast string hashing. The computational complexity of Murmur hashing is O(1), since, the length of a string is constant and small. Therefore, the Equation (1) and (2) also cost O(1) time complexity. 3DBF enhances the performance by reducing the total number of complex arithmetic operations. Thus, scaleBF increase its scalability without compromis- ing the performance. IV. DISCUSSION scaleBF provides impressively very high scala- bility. However, the initial cost of memory con- sumption can be high. For instance, insert a key which mapped to the slot 3 of chaining, and creates new three 3DBF. Another insertion key also triggers creation of new three 3DBF which is mapped into a slot, say 2. Thus, the initial cost of memory is high. However, scaleBF is ideal for very large scale membership filtering. Moreover, scaleBF also ideal solution of large memory allocation due to dynamic memory allocation system. scaleBF also depends on the size of 3DBF. www.ijacsa.thesai.org 553 P a g e (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 9, No. 12, 2018 V. CONCLUSION Deduplication requires very high scalable Bloom Filter, since, deduplication processes trillions of keys. Moreover, there are diverse applications of high scalable Bloom Filter, for instance, DNA As- sembly. In this paper, we have presented a very high scalable Bloom Filter without comprising the per- formances. In addition, scaleBF also provides inser- tion and lookup cost of O(1). scaleBF outperforms Bloofi [11], BloomFlash [8], FBF [7], and TB2F [10] in terms of computational time complexity while maintaining higher scalability. However, the scaleBF does not support deletion of an item. Thus, there is no false negative. Interestingly, scaleBF can be applied many research areas to boost up the performance and scalability, and its applicability not limited to NDN, but also Big Data, Cloud Computing, Database, Distriubuted System, IoT, and Computer Networking. REFERENCES [1] B. H. Bloom, "Space/time trade-offs in hash coding with allowable errors," Commun. ACM, vol. 13, no. 7, pp. 422 -- 426, 1970. [2] R. Patgiri, S. Nayak, and S. K. Borgohain, "Preventing ddos using bloom filter: A survey," EAI Endorsed Transactions on Scalable Information Systems, 2018. [3] A. Broder and M. Mitzenmacher, "Network applications of bloom filters: A survey," Internet mathematics, vol. 1, no. 4, pp. 485 -- 509, 2004. [4] F. Chang, J. Dean, S. Ghemawat, W. C. Hsieh, D. A. Wallach, M. Burrows, T. Chandra, A. Fikes, and R. E. Gruber, "Bigtable: A distributed storage system for structured data," ACM Trans. Comput. Syst., vol. 26, no. 2, pp. 4:1 -- 4:26, 2008. [5] A. Lakshman and P. Malik, "Cassandra: A decentralized struc- tured storage system," SIGOPS Oper. Syst. Rev., vol. 44, no. 2, pp. 35 -- 40, 2010. [6] R. Patgiri, S. Nayak, and S. K. Borgohain, "Shed more light on bloom filter's variants," in Proceedings of the 2018 Interna- tional Conference on Information and Knowledge Engineering. CSREA Press, 2018, pp. 14 -- 21. [7] G. Lu, B. Debnath, and D. H. C. Du, "A forest-structured bloom filter with flash memory," in 2011 IEEE 27th Symposium on Mass Storage Systems and Technologies (MSST), 2011, pp. 1 -- 6. [8] B. Debnath, S. Sengupta, J. Li, D. J. Lilja, and D. H. C. Du, "Bloomflash: Bloom filter on flash-based storage," in 2011 31st International Conference on Distributed Computing Systems, 2011, pp. 635 -- 644. [9] G. Lu, Y. J. Nam, and D. H. C. Du, "Bloomstore: Bloom- filter based memory-efficient key-value store for indexing of data deduplication on flash," in 2012 IEEE 28th Symposium on Mass Storage Systems and Technologies (MSST), 2012, pp. 1 -- 11. [10] W. Quan, C. Xu, A. V. Vasilakos, J. Guan, H. Zhang, and L. A. Grieco, "Tb2f: Tree-bitmap and bloom-filter for a scalable and efficient name lookup in content-centric networking," in 2014 IFIP Networking Conference(IFIP NETWORKING), vol. 00, 2014, pp. 1 -- 9. [11] A. Crainiceanu and D. Lemire, "Bloofi: Multidimensional bloom filters," Information Systems, vol. 54, pp. 311 -- 324, 2015. [12] R. Patgiri, S. Nayak, and S. K. Borgohain, "rDBF: A r- dimensional bloom filter for massive scale membership query," Journal of Network and Computer Applications, vol. Personal communication. [13] A. Appleby, "Murmurhash," Retrieved on August 2018 from https://sites.google.com/site/murmurhash/, 2018. [14] F. Grandi, "On the analysis of bloom filters," Information Processing Letters, vol. 129, pp. 35 -- 39, 2018. www.ijacsa.thesai.org 554 P a g e
1804.09393
1
1804
2018-04-25T07:15:29
A quasi linear-time b-Matching algorithm on distance-hereditary graphs and bounded split-width graphs
[ "cs.DS" ]
We present a quasi linear-time algorithm for Maximum Matching on distance-hereditary graphs and some of their generalizations. This improves on [Dragan, WG'97], who proposed such an algorithm for the subclass of (tent,hexahedron)-free distance-hereditary graphs. Furthermore, our result is derived from a more general one that is obtained for b-Matching. In the (unit cost) b-Matching problem, we are given a graph G = (V, E) together with a nonnegative integer capacity b v for every vertex v $\in$ V. The objective is to assign nonnegative integer weights (x e) e$\in$E so that: for every v $\in$ V the sum of the weights of its incident edges does not exceed b v , and e$\in$E x e is maximized. We present the first algorithm for solving b-Matching on cographs, distance-hereditary graphs and some of their generalizations in quasi linear time. For that, we use a decomposition algorithm that outputs for any graph G a collection of subgraphs of G with no edge-cutsets inducing a complete bipartite subgraph (a.k.a., splits). The latter collection is sometimes called a split decomposition of G. Furthermore, there exists a generic method in order to design graph algorithms based on split decomposition [Rao, DAM'08]. However, this technique only applies to "localized" problems: for which a "best" partial solution for any given subgraph in a split decomposition can be computed almost independently from the remaining of the graph. Such framework does not apply to matching problems since an augmenting path may cross the subgraphs arbitrarily. We introduce a new technique that somehow captures all the partial solutions for a given union of subgraphs in a split decomposition, in a compact and amenable way for algorithms - assuming some piecewise linear assumption holds on the value of such solutions. The latter assumption is shown to hold for b-Matching. Doing so, we prove that solving b-Matching on any pair G, b can be reduced in quasi linear-time to solving this problem on a collection of smaller graphs: that are obtained from the subgraphs in any split decomposition of G by replacing every vertex with a constant-size module. In particular, if G has a split decomposition where all subgraphs have order at most a fixed k, then we can solve b-Matching for G, b in O((k log 2 k)$\times$(m+n)$\times$log ||b|| 1)-time. This answers an open question of [Coudert et al., SODA'18].
cs.DS
cs
A quasi linear-time b-Matching algorithm on distance-hereditary graphs and bounded split-width graphs ∗ Guillaume Ducoffe1,2 and Alexandru Popa1,3 1National Institute for Research and Development in Informatics, Romania 2The Research Institute of the University of Bucharest ICUB, Romania 3University of Bucharest, Faculty of Mathematics and Computer Science Abstract We present a quasi linear-time algorithm for Maximum Matching on distance-hereditary graphs and some of their generalizations. This improves on [Dragan, WG'97], who proposed such an algorithm for the subclass of (tent,hexahedron)-free distance-hereditary graphs. Furthermore, our result is derived from a more general one that is obtained for b-Matching. In the (unit cost) b-Matching problem, we are given a graph G = (V, E) together with a nonnegative integer capacity bv for every vertex v ∈ V . The objective is to assign nonnegative integer weights (xe)e∈E so that: for every v ∈ V the sum of the weights of its incident edges does not exceed bv, e∈E xe is maximized. We present the first algorithm for solving b-Matching on cographs, and(cid:80) distance-hereditary graphs and some of their generalizations in quasi linear time. For that, we use a decomposition algorithm that outputs for any graph G a collection of subgraphs of G with no edge-cutsets inducing a complete bipartite subgraph (a.k.a., splits). The latter collection is sometimes called a split decomposition of G. Furthermore, there exists a generic method in order to design graph algorithms based on split decomposition [Rao, DAM'08]. However, this technique only applies to "localized" problems: for which a "best" partial solution for any given subgraph in a split decomposition can be computed almost independently from the remaining of the graph. Such framework does not apply to matching problems since an augmenting path may cross the subgraphs arbitrarily. We introduce a new technique that somehow captures all the partial solutions for a given union of subgraphs in a split decomposition, in a compact and amenable way for algorithms -- assuming some piecewise linear assumption holds on the value of such solutions. The latter assumption is shown to hold for b-Matching. Doing so, we prove that solving b-Matching on any pair G, b can be reduced in quasi linear-time to solving this problem on a collection of smaller graphs: that are obtained from the subgraphs in any split decomposition of G by replacing every vertex with a constant-size module. In particular, if G has a split decomposition where all subgraphs have order at most a fixed k, then we can solve b-Matching for G, b in O((k log2 k)·(m+n)·log b1)-time. This answers an open question of [Coudert et al., SODA'18]. Keywords: maximum matching; b-matching; FPT in P; split decomposition; distance-hereditary graphs. ∗This work was supported by the Institutional research programme PN 1819 "Advanced IT resources to sup- port digital transformation processes in the economy and society - RESINFO-TD" (2018), project PN 1819-01- 01"Modeling, simulation, optimization of complex systems and decision support in new areas of IT&C research", funded by the Ministry of Research and Innovation, Romania. 1 1 Introduction The Maximum Matching problem takes as input a graph G = (V, E) and it asks for a subset F of pairwise disjoint edges of maximum cardinality. This is a fundamental problem with a wide variety of applications [6, 12, 36, 42]. Hence, the computational complexity of Maximum Matching has been extensively studied in the literature. In particular, this was the first problem shown to be √ solvable in polynomial-time [17]. Currently, the best-known algorithms for Maximum Match- ing run in O(m n)-time on n-vertex m-edge graphs [40]. Such superlinear running times can be prohibitive for some applications. In order to overcome the superlinear barrier, we initiated in [9] the complexity study of Maximum Matching on bounded clique-width graph classes (the latter research direction being also motivated by the recent linear-time algorithm for Maximum Match- ing on bounded treewidth graphs, see [20, 33]). As a new attempt in this direction, our initial motivation for this paper was to design a quasi linear-time algorithm for Maximum Matching on distance-hereditary graphs and some classes of graphs that are defined via the so-called split- decomposition. We succeeded in our initial goal and, in fact, we prove a more general result. All graphs studied in what follows have bounded clique-width [43]. 1.1 Related work There is a long line of work whose aim is to find more efficiently solvable special cases for Maximum Matching (e.g., see [7, 11, 14, 22, 21, 29, 31, 35, 38, 34, 47, 49, 48]). In particular, there exist linear-time algorithms for computing a maximum matching on trees, cographs [47] and subclasses of distance-hereditary graphs [14] 1. Furthermore, a natural follow-up of such investigations is to study whether the techniques used in every case can also be applied to larger classes of graphs. This has be done, especially, for the Split & Match technique introduced in [47] for cographs (e.g., see [9, 22, 21] where the latter technique has been applied to other graph classes). We also consider this above aspect in our work, as we seek for a Maximum Matching algorithm on distance-hereditary graphs that can be easily generalized to larger classes of graphs that we define in what follows. Fully Polynomial Parameterized Algorithms. More precisely, we seek for parameterized algorithms (FPT). Formally, given a graph invariant denoted π (e.g., maximum degree, treewidth, etc.), we address the question whether there exists a Maximum Matching algorithm running in time O(kc · (n + m) · logO(1)(n)), for some constant c, on every graph G such that π(G) ≤ k 2. Note that such an algorithm runs in quasi linear time for any constant k, and that it is faster than the state-of-the art algorithm for Maximum Matching whenever k = O(n 2c−ε), for some ε > 0. This kind of FPT algorithms for polynomial problems have attracted recent attention [1, 3, 9, 19, 20, 27, 32, 33, 39] -- although some examples can be found earlier in the literature [49, 48]. We stress that Maximum Matching has been proposed in [39] as the "drosophila" of the study of these FPT algorithms in P. We continue advancing in this research direction. 1 1We stress that the work in [14] is focused on a generic method in order to compute maximum matchings. In particular, the complexity of Maximum Matching on general distance-hereditary graphs is not considered. 2The polynomial dependency in k is overlooked by some authors [39], who accept any functional dependency in the parameter. Since Maximum Matching is already known to be polynomial-time solvable, we find it more natural to consider this restricted setting. 2 In general, the parameters that are considered in this type of study represent the closeness of a graph to some class where the problem at hands can be easily solved (distance from triviality). In particular, Maximum Matching can be solved in O(k2 · n log n)-time on graphs with treewidth at most k [20, 33], and in O(k4 · n + m)-time on graphs with modular-width at most k [9]. The latter two parameters somewhat represent the closeness of a graph, respectively, to a tree or to a cograph. In this work, we study the parameter split-width, that is a measure of how close a graph is to a distance-hereditary graph [43]. Distance-hereditary graphs are a natural superclass of both cographs and trees and they have already been well studied in the literature [2, 15, 26, 28, 30]. Our work subsumes the one of [9] with modular-width -- that is an upper-bound on split-width -- but it is uncomparable with the work of [20, 33] with treewidth. Split Decomposition. Bounded split-width graphs can be defined in terms of split decomposi- tion. A split is a join that is also an edge-cut. By using pairwise non crossing splits, termed "strong splits", we can decompose any graph into degenerate and prime subgraphs, that can be organized in a treelike manner. The latter is termed split decomposition [10], and it is our main algorithmic tool for this paper. The split-width of a graph is the largest order of a non degenerate subgraph in some canonical split decomposition. In particular, distance-hereditary graphs are exactly the graphs with split-width at most two [28]. Many NP-hard problems can be solved in polynomial time on bounded split-width graphs (e.g., see [43]). In particular we have that clique-width is upper-bounded by split-width, and so, any FPT algorithm parameterized by clique-width can be transformed into a FPT algorithm parameterized by split-width (the converse is not true). Recently we designed FPT algorithms for polynomial problems when parameterized by split-width [9]. It turns out that many "hard" problems in P such as Diameter, for which a conditional superlinear lower-bound has been proved [44], can be solved in O(kO(1)· n + m)-time on graphs with split-width at most k. However, we left this open for Maximum Matching. Indeed, as we detail next the standard design method for FPT algorithms based on split decomposition does not apply to matching problems. Our main contribution in [9] was a Maximum Matching algorithm based on the more restricted modular decomposition. As our main contribution in this paper, we present an algorithm that is based on split decomposition in order to solve some generalization of Maximum Matching -- thereby answering positively to the open question from [9]. Our techniques are quite different than those used in [9]. 1.2 Contributions In order to discuss the difficulties we had to face on, we start giving an overview of the FPT algorithms that are based on split decomposition. • We first need to define a weighted variant of the problem that needs to be solved for every component of the decomposition separately (possibly more than once). This is because there are additional vertices in a split component, i.e., not in the original graph, that substitute the other remaining components; intuitively, the weight of such additional vertex encodes a partial solution for the union of split components it has substituted. • Then, we take advantage of the treelike structure of split decomposition in order to solve the weighted problem, for every split component sequentially, using dynamic programming. Roughly, this part of the algorithm is based on a "split decomposition tree" where the nodes 3 are the split components and the edges represent the splits between them. Starting from the leaves of that tree (resp. from the root), we perform a tree traversal. For every split component, we can precompute its vertex-weights from the partial solutions we obtained for its children (resp., for its father) in the split decomposition tree. incident edges does not exceed bv, and (cid:80) In our case, a natural weighted variant for Maximum Matching is the more gen- Our approach. eral unit-cost b-Matching problem [18]. Roughly, b-Matching differs from Maximum Matching in that a vertex can be matched to more than one edge, and an edge can be put in the match- ing more than once. In more details, every vertex v is assigned some input capacity bv, and the goal is to compute edge-weights (xe)e∈E so that: for every v ∈ V the sum of the weights of its e∈E xe is maximized. The particular case of Maximum Matching is obtained by setting bv = 1 for every vertex v. Interestingly, b-Matching has already attracted attention on its own, e.g., in auction theory [41, 45]. However. we want to stress that solving b-Matching is a much more ambitious task than "just" solving Maximum Matching. In particular, Maximum Flow on general graphs is computationally equivalent to b-Matching on bipartite graphs [37]. The corresponding reductions preserve the treewidth of the graph -- up to a constant-factor -- and so, solving b-Matching in quasi linear-time on bounded-treewidth graphs would already be an impressive achievement on its own. On general graphs, the best-known algorithms for b-Matching run in O(nm log2 n)-time [23, 24]. Our main technical difficulty is how to precompute efficiently, for every component of the decomposition, the specific instances of b-Matching that need to be solved . To see that, consider the bipartition (U, W ) that results from the removal of a split. In order to compute the b-Matching instances on side U , we should be able after processing the other side W to determine the number of edges of the split that are matched in a final solution. Guessing such number looks computationally challenging. We avoid doing so by storing a partial solution for every possible number of split edges that can be matched. However, this simple approach suffers from several limitations. For instance, we need a very compact encoding for partial solutions for otherwise we could not achieve a quasi linear-time complexity. Somehow, we also need to consider the partial solutions for all the splits that are incident to the same component all at once. Results. We prove a simple combinatorial lemma that essentially states that the cardinality of a maximum b-matching in a graph grows as a piecewise linear function in the capacity bw of any fixed vertex w (we think of w as a vertex substituting a union of split components). Then, we derive from our combinatorial lemma a variant of some reduction rule for Maximum Matching that we first introduced in the more restricted case of modular decomposition [9]. Roughly, in any given split component Ci, we consider all the vertices w substituting a union of other components. The latter vertices are in one-to-one correspondance with the strong splits that are incident to the component. We expand every such vertex w to a module that contains O(1) vertices for every straight-line section of the corresponding piecewise-linear function. Altogether combined, this allows us to reduce the solving of b-Matching on the original graph G to solving b-Matching on supergraphs of every its split components. Furthermore, we prove with the help of a dichotomic search that we only need to consider O(log b1) supergraphs for every split component, where v∈V bv, and the respective orders of these above supergraphs can only be three times Overall, our main result is that b-Matching can be solved in O((k log2 k) · (m + n) · log b1)- more than the respective orders of the split components. b1 = (cid:80) 4 time on graphs with split-width at most k (Theorem 1). It implies that Maximum Matching can be solved in O((k log2 k)· (m + n)· log n)-time on graphs with split-width at most k. Since distance- hereditary graphs have split-width at most two, we so obtain the first known quasi linear-time algorithms for Maximum Matching and b-Matching on distance-hereditary graphs. Further- more, since cographs are a subclass of distance-hereditary graphs, we also obtain the first known quasi linear-time algorithm for b-Matching on cographs. We expect our approach to be useful in a broader context, e.g. for other matching and flow problems. We introduce the required terminology and basic results in Section 2. Then, Section 3 is devoted to a combinatorial lemma that is the key technical tool in our subsequent analysis. In Section 4, we present our algorithm for b-Matching on bounded split-width graphs. We conclude in Section 5 with some open questions. 2 Preliminaries We use standard graph terminology from [5, 13]. Graphs in this study are finite, simple (hence without loops or multiple edges), and connected -- unless stated otherwise. Furthermore we make the standard assumption that graphs are encoded as adjacency lists. Given a graph G = (V, E) and a vertex v ∈ V , we denote its neighbourhood by NG(v) = {u ∈ V {u, v} ∈ E} and the set of its incident edges by Ev(G) = {{u, v} u ∈ NG(v)}. When G is clear from the context we write N (v) and Ev instead of NG(v) and Ev(G). Split-width We mostly follow the presentation we gave in [9]. We start defining what a simple decomposition of a graph is. For that, let a split in a graph G = (V, E) be a partition V = U ∪ W such that: min{U,W} ≥ 2; and there is a complete join between the vertices of NG(U ) and NG(W ). A simple decomposition of G takes as input a split (U, W ), and it outputs the two subgraphs GU = G[U ∪ {w}] and GW = G[W ∪ {u}] with u ∈ NG(W ), w ∈ NG(U ) being chosen arbitrarily. The vertices u, w are termed split marker vertices. A split decomposition of G is obtained by applying recursively some sequence of simple decompositions (e.g., see Fig. 1). We name split components the subgraphs in a given split decomposition of G. Figure 1: A graph and its split decomposition. It is often desirable to apply simple decompositions until all the subgraphs obtained cannot be further decomposed. In the literature there are two cases of "indecomposable" graphs. Degenerate graphs are such that every bipartition of their vertex-set is a split. They are exactly the complete graphs and the stars [10]. A graph is prime for split decomposition if it has no split. We can define the following two types of split decomposition: 5 abcdefghicdefghiabcompletestarstarstarprime • Canonical split decomposition. Every graph has a canonical split decomposition where all the subgraphs obtained are either degenerate or prime and the number of subgraphs is minimized. Furthermore, the canonical split decomposition of a given graph can be computed in linear-time [8]. • Minimal split decomposition. A split-decomposition is minimal if all the subgraphs obtained are prime. A minimal split-decomposition can be computed from the canonical split-decomposition in linear-time [10], that consists in performing simple decompositions on every split component that induces either a star or a complete graph of order at least four, until all such components have been replaced by a collection of triangles and paths of length three. Doing so, we avoid handling with the particular cases of stars and complete graphs in our algorithms. The set of prime graphs in any minimal split decomposition is unique up to isomorphism [10]. For instance, the split decomposition of Fig. 1 is both minimal and canonical. Definition 1. The split-width of G, denoted by sw(G), is the minimum k ≥ 2 such that any prime subgraph in the canonical split decomposition of G has order at most k. We refer to [43] for some algorithmic applications of split decomposition. In particular, graphs with split-width at most two are exactly the distance-hereditary graphs, a.k.a the graphs whose all connected induced subgraphs are distance-preserving [2, 28]. Distance-hereditary graphs contain many interesting subclasses of their own such as cographs (a.k.a., P4-free graphs) and 3-leaf powers, see [28]. Furthermore, we can observe that every component in a minimal split decomposition of G has order at most max{3, sw(G)}. Split decomposition tree. A split decomposition tree of G is a tree T where the nodes are in bijective correspondance with the subgraphs of a given split decomposition of G, and the edges of T are in bijective correspondance with the simple decompositions used for their computation. More precisely: • If the considered split decomposition is reduced to G then T is reduced to a single node; • Otherwise, let (U, W ) be a split of G and let GU = (U ∪ {w}, EU ), GW = (W ∪ {u}, EW ) be the corresponding subgraphs of G. We construct the split decomposition trees TU , TW for GU and GW , respectively. Furthermore, the split marker vertices u and w are contained in a unique split component of GW and GU , respectively. We obtain T from TU and TW by adding an edge between the two nodes that correspond to these subgraphs. The split decomposition tree of the canonical split decomposition, resp. of a minimal split decomposition, can be constructed in linear-time [43]. Matching problems A matching in a graph is a set of edges with pairwise disjoint end vertices. We consider the problem of computing a matching of maximum cardinality. 6 Problem 1 (Maximum Matching). Input: A graph G = (V, E). Output: A matching of G with maximum cardinality. √ The Maximum Matching problem can be solved in O(m n)-time (see [25] for a simplified presentation). We do not use this result directly in our paper. However, we do use in our analysis the notion of augmenting paths, that is a cornerstone of most matching algorithms. Formally, let G = (V, E) be a graph and F ⊆ E be a matching of G. A vertex is termed matched if it is incident to an edge of F , and exposed otherwise. An F -augmenting path is a path where the two ends are exposed, all edges {v2i, v2i+1} are in F and all edges {v2j−1, v2j} are not in F . We can observe that, given an F -augmenting path P = (v1, v2, . . . , v2(cid:96)), the matching E(P )∆F (obtained by replacing the edges {v2i, v2i+1} with the edges {v2j−1, v2j}) has larger cardinality than F . Lemma 1 (Berge, [4]). A matching F in G = (V, E) is maximum if and only if there is no F -augmenting path. It is folklore that the proof of Berge's lemma also implies the existence of many vertex-disjoint augmenting paths for small matchings. We will use the following result in our analysis: Lemma 2 (Hopcroft-Karp, [31]). Let F1, F2 be matchings in G = (V, E). If F1 = r, F2 = s and s > r, then there exist at least s − r vertex-disjoint F1-augmenting paths. b-Matching. More generally given a graph G = (V, E), let b : V → N assign a nonnegative integer capacity bv for every vertex v ∈ V . A b-matching is an assignment of nonnegative integer xe ≤ bv. We define the x-degree xe. Furthermore, the cardinality of a b-matching is defined as edge-weights (xe)e∈E such that, for every v ∈ V , we have(cid:80) of vertex v as degx(v) = (cid:80) x1 =(cid:80) e∈E xe. We will consider the following graph problem: e∈Ev e∈Ev Problem 2 (b-Matching). Input: A graph G = (V, E); an assignment function b : V → N. Output: A b-matching of G with maximum cardinality. For technical reasons, we will also need to consider at some point the following variant of b- Matching. Let c : E → N assign a cost to every edge. The cost of a given b-matching x is defined as c · x =(cid:80) e∈E cexe. Problem 3 (Maximum-Cost b-Matching). Input: A graph G = (V, E); assignment functions b : V → N and c : E → N. Output: A maximum-cardinality b-matching of G where the cost is maximized. Lemma 3 ( [23, 24]). For every G = (V, E) and b : V → N, c : E → N, we can solve Maximum- Cost b-Matching in O(nm log2 n)-time. In particular, we can solve b-Matching in O(nm log2 n)-time. 7 There is a nonefficient (quasi polynomial) reduction from b-Matching to Maximum Matching that we will use in our analysis (e.g., see [46]). More precisely, let G, b be any instance of b- Matching. The "expanded graph" Gb is obtained from G and b as follows. For every v ∈ V , we add the nonadjacent vertices v1, v2, . . . , vbv in Gb. Then, for every {u, v} ∈ E, we add the edges {ui, vj} in Gb, for every 1 ≤ i ≤ bu and for every 1 ≤ j ≤ bv. It is easy to transform any b-matching of G into an ordinary matching of Gb, and vice-versa. 3 Changing the capacity of one vertex We first consider an auxiliary problem on b-matching that can be of independent interest. Let G = (V, E) be a graph, let w ∈ V and let b : V \ w → N be a partial assignment. We denote µ(t) the maximum cardinality of a b-matching of G provided we set to t the capacity of vertex w. Clearly, µ is nondecreasing in t. Our main result in this section is that the function µ is essentially piecewise linear (Proposition 1). We start introducing some useful lemmata. Lemma 4. µ(t + 1) − µ(t) ≤ 1. Proof. Consider the two expanded graphs Gb,t and Gb,t+1 that are obtained after setting the capac- ity of w to, respectively, t and t + 1. Let Ft be any maximum matching of Gb,t. By the hypothesis, Ft = µ(t). Furthermore, since Gb,t+1 can be obtained from Gb,t by adding a new vertex wt+1 (that is a false twin of w1, w2, . . . , wt), Ft is also a matching of Gb,t+1. Suppose that Ft is not maximum in Gb,t+1, i.e., µ(t + 1) = µ(t) + r, for some r ≥ 1. By Hopcroft-Karp lemma (Lemma 2) there are r Ft-augmenting paths in Gb,t+1 that are vertex-disjoint. Furthermore, since Ft is maximum in Gb,t, every such path must contain wt+1, and so, r = 1. Lemma 5. If µ(t + 2) = µ(t) then we have µ(t + i) = µ(t) for every i ≥ 0. Proof. By contradiction, let i0 be the least integer i ≥ 3 such that µ(t + i) > µ(t). By Lemma 4 we have µ(t + i0) ≤ µ(t + i0 − 1) + 1 = µ(t) + 1, therefore µ(t + i0) = µ(t) + 1. Consider the two expanded graphs Gb,t and Gb,t+i0 that are obtained after setting the capacity of w to, respectively, t and t + i0. Let Ft be any maximum matching of Gb,t. By the hypothesis, Ft = µ(t). Furthermore, since Gb,t+i0 can be obtained from Gb,t by adding the new vertices wt+1, . . . , wt+i0 (that are false twins of w1, w2, . . . , wt), Ft is also a matching of Gb,t+i0. However Ft is not maximum in Gb,t+i0 since we have µ(t + i0) = µ(t) + 1. By Berge lemma (Lemma 1) there exists an Ft-augmenting path P in Gb,t+i0. Furthermore, since Ft is maximum in Gb,t, P must contain a vertex amongst wt+1, . . . , wt+i0. Note that the latter vertices are all exposed, and so, an Ft-augmenting path can only contain at most two of them. Furthermore, since wt+1, . . . , wt+i0 are pairwise false twins, we can assume w.l.o.g. that P has wt+1 as an end. In the same way, in case P has its two ends amongst wt+1, . . . , wt+i0 then we can assume w.l.o.g. that the two ends of P are exactly wt+1, wt+2. It implies either µ(t) < µ(t+1) ≤ µ(t+2) or µ(t) = µ(t+1) < µ(t+2). In both cases, µ(t+2) > µ(t), that is a contradiction. Lemma 6. If µ(t + 1) = µ(t) then we have µ(t + 3) = µ(t + 2). Proof. If µ(t + 2) = µ(t) then the result follows from Lemma 5 directly. Thus, we assume from now on that µ(t + 2) > µ(t). By Lemma 4 we have µ(t + 2) ≤ µ(t + 1) + 1 = µ(t) + 1, therefore µ(t + 2) = µ(t) + 1. Suppose by contradiction µ(t + 3) > µ(t + 2). Again by Lemma 4 we get 8 µ(t + 3) = µ(t + 2) + 1, therefore µ(t + 3) = µ(t) + 2. Consider the two expanded graphs Gb,t and Gb,t+3 that are obtained after setting the capacity of w to, respectively, t and t + 3. Let Ft be any maximum matching of Gb,t. By the hypothesis, Ft = µ(t). Furthermore, since Gb,t+3 can be obtained from Gb,t by adding the three new vertices wt+1, wt+2, wt+3 (that are false twins of w1, w2, . . . , wt), Ft is also a matching of Gb,t+3. However Ft is not maximum in Gb,t+3 since we have µ(t + 3) = µ(t) + 2. By Hopcroft-Karp lemma (Lemma 2) there exist 2 Ft-augmenting paths in Gb,t+3 that are vertex-disjoint. Furthermore, since Ft is maximum in Gb,t, every such path must contain a vertex amongst wt+1, wt+2, wt+3. Note that the latter vertices are all exposed, and so, an Ft-augmenting path can only contain at most two of them. In particular, there is at least one of these two Ft-augmenting paths, denoted by P , that only contains a single vertex amongst wt+1, wt+2, wt+3. W.l.o.g., since wt+1, wt+2, wt+3 are pairwise false twins, we can assume that wt+1 is an end of P . However, it implies that P is also an Ft-augmenting path in Gb,t+1, and so, that µ(t + 1) > µ(t), that is a contradiction. We are now ready to prove the main result of this section: Proposition 1. There exist integers c1, c2 such that: µ(0) + t if t ≤ c1 µ(t) = µ(c1) + (cid:98)(t − c1)/2(cid:99) = µ(0) + c1 + (cid:98)(t − c1)/2(cid:99) if c1 < t ≤ c1 + 2c2 µ(c1 + 2c2) = µ(0) + c1 + c2 otherwise. Furthermore, the triple (µ(0), c1, c2) can be computed in O(nm log2 n log b1)-time. Figure 2: An example with (µ(0), c1, c2) = (1, 1, 1). Vertices are labeled with their capacity. Thin and bold edges have respective weights 0 and 1. trivially, the function µ must stay constant whenever t ≥(cid:80) bound tmax ≤(cid:80) Proof. Let c1 be the maximum integer t such that µ(t) = µ(0) + t. This value is well-defined since, v∈NG(w) bv. Furthermore, by Lemma 4 we have µ(t) = µ(0)+t for every 0 ≤ t ≤ c1. Then, let tmax be the least integer t such that, for every i ≥ 0 we have µ(tmax+i) = µ(tmax). Again, this value is well-defined since we have the trivial upper- v∈NG(w) bv. Furthermore, since µ is strictly increasing on [0; c1], we have tmax ≥ c1. Let c(cid:48) 2 = 2c2 is even. For that, we need to observe that µ(c1) = µ(c1 +1) by maximality of c1. By Lemma 6 we get µ(c1 +2i) = µ(c1 +2i+1) for every i ≥ 0, thereby proving the claim. Moreover, for every 0 ≤ i < c2 we have by Lemma 5 µ(c1 + 2i) < µ(c1 + 2(i + 1)) (since otherwise tmax ≤ c1+2i). By Lemma 6 we have µ(c1+2i) = µ(c1+2i+1). Finally, by Lemma 4 we get µ(c1 + 2(i + 1)) ≤ µ(c1 + 2i + 1) + 1 = µ(c1 + 2i) + 1, therefore µ(c1 + 2(i + 1)) = µ(c1 + 2i) + 1. Altogether combined, it implies that µ(c1 + 2i) = µ(c1 + 2i + 1) = µ(c1) + i for every 0 ≤ i ≤ c2, that proves the first part of our result. 2 = tmax − c1. We claim that c(cid:48) 9 1110111111121113 1 > c1 such that µ(c(cid:48) 1 = 1, at every step we multiply the current value of c(cid:48) We can compute µ(0) with any b-Matching algorithm after we set the capacity of w to 0. Furthermore, the value of c1 can be computed within O(log c1) calls to a b-Matching algorithm, as follows. Starting from c(cid:48) 1 by 2 until we reach a value c(cid:48) 1. Then, we perform a dichotomic search between 0 and c(cid:48) 1 in order to find the largest value c1 such that µ(c1) = µ(0) + c1. Once c1 is known, we can use a v∈NG(w) bv = O(b1), we are left with O(log b1) calls to any b-Matching algorithm. Therefore, by Lemma 3, we can compute the triple (µ(0), c1, c2) in O(nm log2 n log b1)-time. similar approach in order to compute c2. Overall, since c1 + 2c2 = tmax ≤(cid:80) 1) < µ(0) + c(cid:48) 4 The algorithm We present in this section a quasi linear-time algorithm for computing a maximum-cardinality b- matching on any bounded split-width graph (Theorem 1). Given a graph G, our algorithm takes as input the split decomposition tree T of any minimal split decomposition of G. We root T in an arbitrary component C1. Then, starting from the leaves, we compute by dynamic programming on T the cardinality of an optimal solution. This first part of the algorithm is involved, and it uses the results of Section 3. It is based on a new reduction rule that we introduce in Definition 2. Finally, starting from the root component C1, we compute a maximum-cardinality b-matching of G, b by reverse dynamic programming on T . This second part of the algorithm is simpler than the first one, but we need to carefully upper-bound its time complexity. In particular, we also need to ensure that some additional property holds for the b-matchings we compute at every component. Reduction rule Definition 2. Let G = (V, E), b be any instance of b-Matching. For any split (U, W ) of G let C = NG(W ) ⊆ U, D = NG(U ) ⊆ W . Furthermore, let GU = (U ∪{w}, EU ), GW = (W ∪{u}, EW ) be the corresponding subgraphs of G. We define the pairs GU , bU and HW , bW as follows: Figure 3: The reduction of Definition 2. • For every v ∈ U we set bU 1 , cU Let the triple (µU (0), cU v = bv; the capacity of the split marker vertex w is left unspecified. 2 ) be as defined in Proposition 1 w.r.t. GU , bU and w. • The auxiliary graph HW is obtained from GW by replacing the split marker vertex u by a module Mu = {u1, u2, u3}, NHW (Mu) = NGW (u) = D; we also add an edge between u2, u3 (cf. Fig. 3). For every v ∈ W we set bW v = bv; we set bW 1 , bW u3 = cU 2 . u1 = cU u2 = bW We will show throughout this section that our gadget somewhat encodes all the partial solutions for side U . For that, we start proving the following lemma: 10 DuDuuu321 2 − µU (0). Lemma 7. Let x be a b-matching for G, b. There exists a b-matching xW for HW , bW such that xW1 ≥ x1 + cU Proof. See Fig. 4 for an illustration. Let us define bU e∈C×D xe. As an intermediate step, we can construct a b-matching xU of the pair GU , bU as follows. First we keep all the edge-weights xe = xU v(cid:48)∈D x{v,v(cid:48)}. We deduce from this transformation that: e , for every e ∈ E(U ). Then, for every v ∈ C we set xU{v,w} = (cid:80) w =(cid:80) (cid:88) e∈E(U )∪(C×D) xU1 = xe ≤ µU (bU w). degyU (w) =(cid:80) In particular, let yU be a b-matching of GU , bU of optimal cardinality µU (bU e is minimized. By Proposition 1, we have d ≤ cU e∈Ew(GU ) yU w) and such that d = 1 + 2cU 2 . We obtain a b-matching xW for the pair HW , bW as follows: Figure 4: The construction of xW . Vertices with capacity greater than 1 are labeled with their capacity. Thin and bold edges have respective weights 0 and 1. • We keep all the edge-weights xe = xW e , for every e ∈ E(W ). Doing so, we get an initial b-matching of cardinality x1 − xU1 ≥ x1 − µU (bU w); • Then, in order to define xW (cid:80) v∈C x{v,v(cid:48)} for every v(cid:48) ∈ D. By construction, the capacities on side D sum to bU e , for every edge e that is incident to u1, we make a simple reduction to a flow problem. Namely, consider a star with leaves D and central node the split marker vertex u. The star is node-capacitated, with the capacity being set to: min{d, cU 1 } for u; and w ≥ d. So, 1 } units of flow from D to u. Furthermore, we define xW{u1,v(cid:48)}, we can send exactly min{d, cU for every v(cid:48) ∈ D, as the value of the flow passing through the arc (v(cid:48), u). Doing so, we get a partial solution of cardinality ≥ x1 − µU (bU w) + min{d, cU 1 }. • We end up defining the weights of the edges that are incident to u2 or u3. There are two cases: -- Case d ≤ cU setting xW{u2,u3} = cU 2 . 1 . By Proposition 1, µU (bU w) − d = µU (0). We complete the b-matching by 1 . By Proposition 1 and the minimality of d, we have that d − cU 2 and µU (bU 1 = 2d(cid:48) is -- Case d > cU even, d(cid:48) ≤ cU 1 = µU (0) + d(cid:48). We make two other reductions to a flow problem, on the same star as before but with different node capacities. More precisely, we set the capacity of u to d(cid:48), while for every v(cid:48) ∈ D, we decrease its original capacity by w) − cU 11 xxUyUxW2244 1 ≥ d − cU 1 ≥ 2d(cid:48). w − cU xW{u1,v(cid:48)}. By construction, the capacities on side D now sum to bU So, we can send exactly d(cid:48) units of flow from D to u. Furthermore, we define xW{u2,v(cid:48)}, for every v(cid:48) ∈ D, as the value of the flow passing through the arc (v(cid:48), u). Then, we again decrease the node capacity for every v(cid:48) ∈ D, by exactly xW{u2,v(cid:48)}. We send d(cid:48) more units of flow from D to u. For every v(cid:48) ∈ D, we define xW{u3,v(cid:48)} as the that(cid:80) additional amount of flow being sent through the arc (v(cid:48), u). Note that, doing so, we get 2 − d(cid:48). In total, 2 + d(cid:48). Therefore in both cases, the resulting b-matching has cardinality at least x1 + cU v(cid:48)∈D xW{u3,v(cid:48)} = d(cid:48). Finally, we set xW{u2,u3} = cU 2 − d(cid:48)) = cU the cardinality of the b-matching has so increased by 2d(cid:48) + (cU v(cid:48)∈D xW{u2,v(cid:48)} =(cid:80) 2 − µU (0). In fact, the converse of Lemma 7 also holds: if xW is a b-matching for HW , bW then there exists a b-matching x for the pair G, b such that x1 ≥ xW1−cU 2 +µU (0) (Proposition 2). We postpone the proof of the converse inequality since, in order to prove it, we first need to prove intermediate lemmata that will be also used in the proof of Theorem 1. b-matchings with additional properties We consider an intermediate modification problem on the b-matchings of some "auxiliary graphs" that we define next. Let Ci be a split component in a given split decomposition of G. The subgraph Ci is obtained from a sequence of simple decompositions. For a given subsequence of the above simple decompositions (to be defined later) we apply the reduction rule of Definition 2. Doing so, we obtain a pair Hi, bi with Hi being a supergraph of Ci obtained by replacing some split marker vertices uit, 1 ≤ t ≤ l, by the modules Mit = {u1 are adjacent and they have the same capacity. }. We recall that u2 , u3 it , u2 it , u3 it it it We seek for a maximum-cardinality b-matching xi for the pair Hi, bi such that the following properties hold for every 1 ≤ t ≤ l: it it it ). }. ,u3 it ) < c1 it ) = xi{u2 ) = degxi(u3 it • (symmetry) degxi(u2 • (saturation) if degxi(u1 We prove next that for every fixed t, any xi can be processed in O(Euit then, degxi(u2 it (Ci))-time so that both the saturation property and the symmetry property hold for Mit. However, ensuring that these two above properties hold simultaneously for every t happens to be trickier. Lemma 8. In O(V (Hi) · E(Hi) · log2 V (Hi))-time, we can compute a maximum-cardinality b-matching xi for the pair Hi, bi such that both the saturation property and the symmetry property hold for every Mit, 1 ≤ t ≤ l. Proof. Let xi be some initial maximum-cardinality b-matching (to be defined later). While there exists a t such that the saturation property or the symmetry property does not hold for Mit, we keep repeating the following rules until none of them can be applied: 12 it ) < c1 it • Rule 1. Suppose degxi(u1 and there exists v(cid:48) ∈ NHi(Mit) such that xi{u2 ,v(cid:48)} > 0). Then, we increase xi{u1 ,v(cid:48)} > 0 ,v(cid:48)} as much as we can, that is by exactly ,v(cid:48)} ,v(cid:48)}) by exactly the same amount. By repeating this step until it is no more (resp., xi{u3 min{c1 (resp., xi{u3 possible to do so, we ensure that the saturation property holds for Mit. ,v(cid:48)}}), and we decrease xi{u2 ,v(cid:48)}} (resp., min{c1 − degxi(u1 − degxi(u1 ), xi{u3 ), xi{u2 it it it it it it it it it it it )+1 (the case degxi(u3 it ) > degxi(u2 it ,v(cid:48)} > xi{u3 ,v(cid:48)}. We increase xi{u3 )+1 is symmetrical ,v(cid:48)} as much as it (cid:27) it • Rule 2. Suppose degxi(u2 (cid:23) to this one). Let v(cid:48) ∈ NHi(Mit) such that xi{u2 (cid:26)(cid:22) degxi (u2 ) > degxi(u3 it )−degxi (u3 it ) it we can, that is by min ,v(cid:48)} by exactly the same amount. By repeating this step until it is no more possible to do so, we ensure that degxi(u2 ) − degxi(u3 , while we decrease xi{u3 ) ≤ 1. , xi{u3 ,v(cid:48)} it it it it 2 it it • Rule 3. Suppose degxi(u2 to this one). Let v(cid:48) ∈ NHi(Mit) such that xi{u2 unit; similarly, we increase xi{u2 property holds for Mit. ) = degxi(u3 it ,u3 it it it )+1 (the case degxi(u3 it ,v(cid:48)}. We decrease xi{u2 )+1 is symmetrical ,v(cid:48)} by one } by one unit. Doing so, we ensure that the symmetry ) = degxi(u2 it ,v(cid:48)} > xi{u3 it it it Overall, we only need to scan O(1) times the set NHi(Mit), and so, we can ensure that both the saturation property and the symmetry property hold for Mit in O(NHi(Mit))-time. However, doing so, we may break the saturation property or the symmetry property for some other t(cid:48) (cid:54)= t (e.g., see Fig. 5). Therefore, if we start from an arbitrary xi, the above procedure may take quasi polynomial time in order to converge. Figure 5: An example where the naive processing stage requires O(b1)-time. it , u3 it In order to overcome this above issue, we assign costs on the edges. All the edges of Hi have unit cost, except the edges {u2 }, for every 1 ≤ t ≤ l, to which we assign cost 2. We compute a maximum-cardinality b-matching xi for the pair Hi, bHi that is of maximum cost. By Lemma 3, this can be done in time O(V (Hi)E(Hi) log2 V (Hi)). Then, we apply the same procedure on xi as described above. We claim that there is at most one loop for every t. Indeed, let 1 ≤ t ≤ l be arbitrary. We observe that Rules 1 and 2 do not change the cost of the b-matching. Furthermore, for every v(cid:48) ∈ NHi(Mit), Rules 1 and 2 do not change the xi-degree of v(cid:48). Hence, we can only break the saturation property or the symmetry property for some other t(cid:48) (cid:54)= t by applying Rule 3. However, Rule 3 increases the cost of xi, and so, since xi is supposed to be of maximum cost, this rule will 13 aaaa1a-1aa-1a111a-1a-1a-1a-111111 takes time O((cid:80)l never be applied. Therefore, the claim is proved. Overall, it implies that the postprocessing of xi t=1 NHi(Mit)), that is in O(E(Hi)). Merging the partial solutions together Finally, before we can describe our main algorithm (Theorem 1) we need to consider the inter- mediate problem of merging two partial solutions (that have been obtained, respectively, for the two subgraphs outputted by a simple decomposition). For that, we introduce the following data structure for storing a b-matching: Lemma 9. For every G = (V, E) there exists a data structure that can be initialized in O(m)-time, and such that the following properties hold: • (Access) An edge-weight assignment (xe)e∈E is stored. Initially, all the edge-weights are set to 0. For every e ∈ E, we can read and modify xe in constant-time. • (Split) Furthermore, let (U, W ) be a split of G and let GU = (U ∪ {w}, EU ), GW = (W ∪ {u}, EW ) be the corresponding subgraphs of G. In O(1)-time, we can modify the data structure so that it can store separate edge-weight assignments for GU and GW (initially set to (xe)e∈EU and (xe)e∈EW ). • (Merge) Conversely, let (U, W ) be a split of G and let GU = (U ∪ {w}, EU ), GW = (W ∪ {u}, EW ) be the corresponding subgraphs of G. Suppose that two separate assignments e )e∈EW are stored in the data structure. In O(1)-time, we can modify the (xU data structure so that it stores the following edge-weight assignment for G: e )e∈EU and (xW  xe = e if e ∈ EU \ EW xU if e ∈ EW \ EU xW e max{xU undefined otherwise. e , xW e } if e ∈ EU ∩ EW Proof. Every edge e ∈ E has a pointer to its corresponding weight xe (initially set to 0). Now, con- sider any split (U, W ) of G and let GU = (U ∪{w}, EU ), GW = (W ∪{u}, EW ) be the corresponding subgraphs of G. Observe that EU , EW intersect in exactly one edge eU,W = {u, w}. So, in order to perform a split of the data structure, it suffices to split the pointer of eU,W in two new pointers, that are initially pointing to two distinct copies of the value xe. Note that for every pointer newly introduced, we need to keep track of the corresponding split (U, W ) and of the corresponding side (i.e., U or W ). Conversely, in order to merge the respective data structures obtained for GU and GW , it suffices to extract the values xU (on which the two new pointers introduced after the split are pointing to) and to set the original value xeU,W to max{xU and xW , xW }. eU,W eU,W eU,W eU,W Let (U, W ) be a split of G and let GU = (U ∪ {w}, EU ), GW = (W ∪ {u}, EW ) be the cor- responding subgraphs of G. Consider some partial solutions xU and xW obtained, respectively, for the pairs GU , bU and GW , bW (for some capacity functions bU , bW to be defined later in the description of our main algorithm). We reduce the merging stage to a flow problem on a complete bipartite subgraph (induced by the split) with node-capacities. We detail this next. 14 v ≤ bv for Lemma 10. Suppose that bU (resp., bW ) satisfies bU every v ∈ W ). Let xU , xW a b-matching for, respectively, the pairs GU , bU and GW , bW such that degxU (w) = degxW (u) = d. v ≤ bv for every v ∈ U (resp., bW Furthermore, for any graph H let ϕ(H) = E(H) + 4· (sc(H)− 1), with sc(H) being the number of split components in any minimal split decomposition of H 3. Then, in at most O(ϕ(G) − ϕ(GU ) − ϕ(GW ))-time, we can obtain a valid b-matching x for the pair G, b such that x1 = xU1 + xW1 − d. Proof. There are two cases. First, suppose C = NG(W ) = {u} (the case D = NG(U ) = {w} is symmetrical to this one). The split marker vertex w is pendant in GU , with its unique neighbour being u (so, in particular, xU{u,w} = d). In order to compute x, we set xU{u,w} to 0 and then we merge xU , xW . By Lemma 9 this takes constant-time. Furthermore, since E − EU − EW = CD − C − D = −1, and sc(G) = sc(GU ) + sc(GW ), we get ϕ(G) − ϕ(GU ) − ϕ(GW ) = 3 > 0. Therefore, from now on we assume that C ≥ 2 and D ≥ 2. For every v ∈ C we assign In the same way, for every v(cid:48) ∈ D we a capacity cv = xU{v,w} and then we set xU{v,w} to 0. It takes O(C + D)-time. Then, assign a capacity cv(cid:48) = xW{v(cid:48),u} and then we set xW{v(cid:48),u} to 0. let us merge xU , xW in order to initialize x. By Lemma 9 this takes constant-time. While there exist a v ∈ C and a v(cid:48) ∈ D such that cv > 0, cv(cid:48) > 0 we pick one such pair v, v(cid:48) and we set: x{v,v(cid:48)} = min{cv, cv(cid:48)}; cv = cv − x{v,v(cid:48)}; cv(cid:48) = cv(cid:48) − x{v,v(cid:48)}. Since for every loop, the capacity of at least one vertex drops to 0, it takes total time O(C+D). Furthermore, since C ≥ 2 and D ≥ 2 we have E − EU − EW = CD − (C + D) ≥ 2(C + D) − 4 − (C + D) ≥ C + D − 4. As a result, ϕ(G) − ϕ(GU ) − ϕ(GW ) ≥ C + D − 4 + 4 ≥ Ω(C + D). Overall, since there are at most n− 2 components in any minimal split decomposition of G [43], the merging stages take total time O(ϕ(G)) = O(n + m). Main result Our main result can be seen as an algorithmic proof of the following equality: Proposition 2. Let G = (V, E), b, let (U, W ) be a split of G and let HW , bW be as defined in Defi- nition 2. Given a maximum-cardinality b-matching x for the pair G, b and a maximum-cardinality b-matching xW for the pair HW , bW we have: x1 = xW1 + µU (0) − cU 2 Proof. We have xW1 ≥ x1−µU (0)+cU 2 by Lemma 7. In order to prove the converse inequality, partition xW1 as follows: µW = (cid:80) we can assume w.l.o.g. that xW satisfies both the saturation property and the symmetry property w.r.t. the module Mu (otherwise, by Lemma 8, we can process xW so that it is the case). We 2 = degxW (u2) − xW{u2,u3} = degxW (u3) − xW{u2,u3} ≤ cU 2 . Since we assume that xW satisfies both the saturation property and the symmetry property w.r.t. Mu, we have c(cid:48) 1 . Furthermore, we observe that u2 and u3 must be saturated (otherwise, we could increase the cardinality of the b-matching by setting xW{u2,u3} = cU 1 = degxW (u1) ≤ cU 2 > 0 only if c(cid:48) 1 and c(cid:48) e∈E(W ) xW e , c(cid:48) 1 = cU 2 − c(cid:48) xW1 = µW + c(cid:48) 2). Therefore, we get: 1 + 2c(cid:48) 2 − c(cid:48) 2 + (cU 2) = µW + c(cid:48) 1 + c(cid:48) 2 + cU 2 . 15 Figure 6: The construction of x(cid:48). Vertices with capacity greater than 1 are labeled with their capacity. Thin and bold edges have respective weights 0 and 1. w = c(cid:48) 1 + 2c(cid:48) u = bU 2. Then, we proceed as follows (see Fig. 6 for an illustration). We define bW • We transform xW into a b-matching for the pair GW , bW by setting xW{u,v(cid:48)} = xW{u1,v(cid:48)} + xW{u2,v(cid:48)} + xW{u3,v(cid:48)} for every v(cid:48) ∈ NGW (u) = D. Note that we have degxW (u) = bW u = c(cid:48) 1 + 2c(cid:48) 2. 2 − c(cid:48) Furthermore, the cardinality of the b-matching has decreased by xW{u2,u3} = cU 2. • Let xU be a b-matching for the pair GU , bU of maximum cardinality µU (c(cid:48) 1 + 2c(cid:48) 2 ≤ cU 1 + c(cid:48) 2). Since 2 , the following can be deduced from Proposition 1: 2; and the split marker vertex w is saturated in xU , 1 , c(cid:48) 1 ≤ cU c(cid:48) xU1 = µU (c(cid:48) 1 + 2c(cid:48) i.e., degxU (w) = bU 2 > 0 only if c(cid:48) w = c(cid:48) 1 , and c(cid:48) 2) = µU (0) + c(cid:48) 1 = cU 1 + 2c(cid:48) 2. G, b by applying Lemma 10. Doing so, we get x1 ≥ x(cid:48)1 = xU1 +(cid:0)xW1 − (cU Finally, since we have degxW (u) = degxU (w) = c(cid:48) 2 + c(cid:48) (c(cid:48) 1 + 2c(cid:48) Finally, we now prove the main result in this paper. 2, we can define a b-matching x(cid:48) for the pair 2) = xW1 + µU (0) − cU 2 . 2 + xW1 − (cU 1 + 2c(cid:48) 1 + c(cid:48) 2) = µU (0) + c(cid:48) 2)(cid:1) − 2 − c(cid:48) 1 + c(cid:48) Theorem 1. For every pair G = (V, E), b with sw(G) ≤ k, we can solve b-Matching in O((k log2 k)· (m + n) · log b1)-time. Proof. Let C1, C2, . . . , Cs, s = sc(G) be the split components in any minimal split decomposition of G. Furthermore, let T be the corresponding split decomposition tree. It can be computed in linear-time [43]. We root T in C1. For every 1 ≤ i ≤ s, let Ti be the subtree of T that is rooted in Ci. If i > 1 then let Cp(i) be its parent in T . By construction of T , the edge {Cp(i), Ci} ∈ E(T ) corresponds to a split (Ui, Wi) of G, where V (Ci) ∩ V ⊆ Ui. Let GUi = (Ui ∪ {wi}, EUi), GWi = (Wi ∪ {ui}, EWi) be the corresponding subgraphs of G. As we observed in [9], Ti is a split decomposition tree of GUi, T \ Ti is a split decomposition tree of GWi. Our algorithm proceeds in two main steps, with each step corresponding to a different traversal of the tree T . First, let G1 = G and let Gi = GUi for every i > 1. Let b1 = b and, for every i > 1 let bi be the restriction of b to Ui. We note that for any i > 1, bi does not assign any capacity to the split marker vertex wi. Up to adding a dummy isolated vertex w1 to G1, we assume that this above property holds for any i. Then, for any i, we compute the triple (µi(0), ci 2) w.r.t. Gi, bi and wi (as defined in Proposition 1). 1, ci 3We recall that the set of prime graphs in any minimal split decomposition is unique up to isomorphism [43]. 16 xW22saturation of u221symmetrization22xU4x In order to do so, we proceed by dynamic programming on the tree T , as follows. Let Ci1, Ci2, . . . , Cil be the children of Ci in T . Every edge {Ci, Cit} ∈ E(T ), 1 ≤ t ≤ l corresponds to a split (Uit, Wit) of Gi, where V (Cit)∩ V (Gi) ⊆ Uit. We name wit ∈ V (Cit), uit ∈ V (Ci) the vertices 1 , cit added after the simple decomposition. Furthermore, let (µit(0), cit 2 ) be the triple corresponding to Git, bit and wit (obtained by dynamic programming). We apply the reduction rule of Definition 2 -- i.e., we replace the split marker vertex uit by the module Mit = {u1 has ca- 2 . Doing so for every 1 ≤ t ≤ l, have equal capacity cit pacity cit we obtain a pair Hi, bHi where Hi is a supergraph of Ci such that: V (Hi) ≤ 3V (Ci) ≤ max{3k, 9} and E(Hi) ≤ 9E(Ci)+V (Ci). Let us compute the triple (µHi(0), ci 2) corresponding to Hi, bHi and wi. By Proposition 1 it can be done in time O(V (Hi)E(Hi) log2 V (Hi) log b1), that is in O((k log2 k) · (E(Ci) + V (Ci)) log b1). 1 and the two adjacent vertices u2 it } where u1 , u3 it , u3 it , u2 it 1, ci it it Finally, by applying Proposition 2 for every split (Uit, Wit) we have: l(cid:88) Overall, this step takes total time O((k log2 k) ·(cid:80) µi(0) = µHi(0) + t=1 (µit(0) − cit 2 ). i(E(Ci) + V (Ci)) · log b1) = O((k log2 k) · (n + m)· log b1). Furthermore, since G1 = G, we have computed the maximum cardinality µ1(0) of any b-matching of G. Second, we compute a b-matching for the pair G, b that is of maximum cardinality µ1(0), by reverse dynamic programming on T . More precisely, for any i let bi wi be a fixed capacity for the split marker vertex wi (if i = 1 then we set b1 wi is obtained by reverse dynamic programming). In what follows, we compute a maximum-cardinality b-matching for the pair Gi, bi. For that we set bHi w1 = 0; otherwise, for i > 1, bi wi = bi wi. • We compute a maximum-cardinality xi for the pair Hi, bHi such that both the saturation property and the symmetry property hold for every 1 ≤ t ≤ l. By Lemma 8, it can be done in time O(V (Hi)E(Hi) log2 V (Hi)), that is in O((k log2 k) · (E(Ci) + V (Ci))). • For every 1 ≤ t ≤ l, let us define bi uit = degxi(u1 it ). We merge Mit into the to uit, and we update } + }. Doing so, we transform xi into a b-matching for Ci, bi where all vertices ui1, ui2, . . . , uil original split marker vertex uit. Furthermore, we assign the capacity bi the b-matching xi such that, for every v ∈ NHi(Mit), we have xi{v,uit} = xi{v,u1 xi{v,u3 are saturated. This transformation has decreased the cardinality of the solution by: } + xi{v,u2 ) + 2 · degxi(u2 uit it it it it l(cid:88) t=1 } ≤ l(cid:88) t=1 xi{u2 it ,u3 it cit 2 . = bi • For every 1 ≤ t ≤ l we set bit wit uit and then we compute a maximum-cardinality b-matching xit for the pair Git, bit. Since the symmetry and saturation properties hold, we can deduce from Proposition 1 that wit is saturated. • By applying the routine of Lemma 10 for every incident split (Uit, Wit) we merge xi with all the xit's until we obtain a b-matching for Gi, bi. It takes time O(ϕ(Gi) −(cid:80)l t=1 ϕ(Git)). 17 Overall, this second step of the algorithm takes total time O(ϕ(G)) +O((k log2 k)·(cid:80) Finally, the above b-matching is of maximum cardinality, that follows from Proposition 2 (applied for every incident split). i(E(Ci) + V (Ci))) = O((k log2 k) · (n + m)). Corollary 2. For every graph G = (V, E) with sw(G) ≤ k, we can solve Maximum Matching in O((k log2 k) · (m + n) · log n)-time. 5 Open questions We presented an algorithm for solving b-Matching on distance-hereditary graphs, and more gen- erally on any graph with bounded split-width. It would be interesting to extend our technique in order to solve the more general Maximum-Cost b-Matching problem. In particular, this would imply a quasi linear-time algorithm for Maximum-Weight Matching on bounded split-width graphs. Our main difficulty for handling with this more general case is that edges in a differ- ent split can now have pairwise different costs. We do not know how to encode this additional information within our gadgets in a compact manner. Finally, we stress that, as a byproduct of our main result, we obtained an O((n + m) log n)- time Maximum Matching algorithm on graphs with bounded split-width. We ask whether there exists a linear-time algorithm for this problem. In a companion paper [16], we prove with a completely different approach that Maximum Matching can be solved in O(n + m)-time on distance-hereditary graphs. However, it is not clear to us whether similar techniques can be used for bounded split-width graphs in general. References [1] A. Abboud, V. Vassilevska Williams, and J. Wang. Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse graphs. In SODA'16, pages 377 -- 391. SIAM, 2016. [2] H.-J. Bandelt and H. Mulder. Distance-hereditary graphs. J. of Combinatorial Theory, Series B, 41(2):182 -- 208, 1986. [3] M. Bentert, T. Fluschnik, A. Nichterlein, and R. Niedermeier. Parameterized aspects of triangle enumer- ation. In International Symposium on Fundamentals of Computation Theory, pages 96 -- 110. Springer, 2017. [4] C. Berge. Two theorems in graph theory. Proceedings of the National Academy of Sciences, 43(9):842 -- 844, 1957. [5] J. A. Bondy and U. S. R. Murty. Graph theory. Grad. Texts in Math., 2008. [6] H. Bunke. Graph matching: Theoretical foundations, algorithms, and applications. In Proc. Vision Interface, volume 2000, pages 82 -- 88, 2000. [7] M. Chang. Algorithms for maximum matching and minimum fill-in on chordal bipartite graphs. In International Symposium on Algorithms and Computation, pages 146 -- 155. Springer, 1996. [8] P. Charbit, F. De Montgolfier, and M. Raffinot. Linear time split decomposition revisited. 26(2):499 -- 514, 2012. [9] D. Coudert, G. Ducoffe, and A. Popa. Fully polynomial FPT algorithms for some classes of bounded clique-width graphs. In SODA'18, pages 2765 -- 2784. SIAM, 2018. 18 [10] W. Cunningham. Decomposition of directed graphs. SIAM Journal on Algebraic Discrete Methods, 3(2):214 -- 228, 1982. [11] E. Dahlhaus and M. Karpinski. Matching and multidimensional matching in chordal and strongly chordal graphs. Discrete Applied Mathematics, 84(1-3):79 -- 91, 1998. [12] E. Dekel and S. Sahni. A parallel matching algorithm for convex bipartite graphs and applications to scheduling. Journal of Parallel and Distributed Computing, 1(2):185 -- 205, 1984. [13] R. Diestel. Graph Theory. Grad. Texts in Math. Springer, 2010. 4th edition. [14] F. Dragan. On greedy matching ordering and greedy matchable graphs. In WG'97, volume 1335 of LNCS, pages 184 -- 198. Springer, 1997. [15] F. Dragan and F. Nicolai. LexBFS-orderings of distance-hereditary graphs with application to the diametral pair problem. Discrete Applied Mathematics, 98(3):191 -- 207, 2000. [16] G. Ducoffe and A. Popa. The use of a pruned modular decomposition for maximum matching algo- rithms on some graph classes. Manuscript in preparation. [17] J. Edmonds. Paths, trees, and flowers. Canadian Journal of mathematics, 17(3):449 -- 467, 1965. [18] J. Edmonds and E. Johnson. Matching: A well-solved class of integer linear programs. In Combinatorial structures and their applications. Citeseer, 1970. [19] T. Fluschnik, C. Komusiewicz, G. Mertzios, A. Nichterlein, R. Niedermeier, and N. Talmon. When can In Workshop on Algorithms and Data Structures, graph hyperbolicity be computed in linear time? pages 397 -- 408. Springer, 2017. [20] F. Fomin, D. Lokshtanov, M. Pilipczuk, S. Saurabh, and M. Wrochna. Fully polynomial-time parame- terized computations for graphs and matrices of low treewidth. In SODA'17, pages 1419 -- 1432. SIAM, 2017. [21] J.-L. Fouquet, V. Giakoumakis, and J.-M. Vanherpe. Bipartite graphs totally decomposable by canonical decomposition. International J. of Foundations of Computer Science, 10(04):513 -- 533, 1999. [22] J.-L. Fouquet, I. Parfenoff, and H. Thuillier. An O(n)-time algorithm for maximum matching in P4-tidy graphs. Information processing letters, 62(6):281 -- 287, 1997. [23] H. Gabow. An efficient reduction technique for degree-constrained subgraph and bidirected network flow problems. In STOC'83, pages 448 -- 456. ACM, 1983. [24] H. Gabow. Data structures for weighted matching and extensions to b-matching and f -factors. Technical report, 2016. arXiv preprint arXiv:1611.07541. [25] H. Gabow. The weighted matching approach to maximum cardinality matching. Fundamenta Infor- maticae, 154(1-4):109 -- 130, 2017. [26] C. Gavoille and C. Paul. Distance labeling scheme and split decomposition. Discrete Mathematics, 273(1):115 -- 130, 2003. [27] A. C. Giannopoulou, G. B. Mertzios, and R. Niedermeier. Polynomial fixed-parameter algorithms: A case study for longest path on interval graphs. Theoretical Computer Science, 689:67 -- 95, 2017. [28] E. Gioan and C. Paul. Split decomposition and graph-labelled trees: characterizations and fully dynamic algorithms for totally decomposable graphs. Discrete Applied Mathematics, 160(6):708 -- 733, 2012. [29] F. Glover. Maximum matching in a convex bipartite graph. Naval Research Logistics (NRL), 14(3):313 -- 316, 1967. [30] M. Golumbic and U. Rotics. On the clique-width of some perfect graph classes. International J. of Foundations of Computer Science, 11(03):423 -- 443, 2000. 19 [31] J. Hopcroft and R. Karp. An n5/2 algorithm for maximum matchings in bipartite graphs. SIAM Journal on computing, 2(4):225 -- 231, 1973. [32] T. Husfeldt. Computing graph distances parameterized by treewidth and diameter. In IPEC'16, vol- ume 63. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2016. [33] Y. Iwata, T. Ogasawara, and N. Ohsaka. On the power of tree-depth for fully polynomial FPT algo- rithms. In STACS'18, 2018. [34] R. Karp and M. Sipser. Maximum matching in sparse random graphs. In FOCS'81, pages 364 -- 375. IEEE, 1981. [35] Y. Liang and C. Rhee. Finding a maximum matching in a circular-arc graph. Information processing letters, 45(4):185 -- 190, 1993. [36] L. Lov´asz and M. Plummer. Matching theory, volume 367. American Mathematical Soc., 2009. [37] A. Madry. Navigating central path with electrical flows: From flows to matchings, and back. In FOCS, pages 253 -- 262. IEEE, 2013. [38] G. Mertzios, A. Nichterlein, and R. Niedermeier. Linear-time algorithm for maximum-cardinality match- ing on cocomparability graphs. Technical report, 2017. arXiv preprint arXiv:1703.05598. [39] G. Mertzios, A. Nichterlein, and R. Niedermeier. The power of linear-time data reduction for maximum matching. In MFCS'17, pages 46:1 -- 46:14, 2017. √ [40] S. Micali and V. Vazirani. An O( V E) algorithm for finding maximum matching in general graphs. In FOCS'80, pages 17 -- 27. IEEE, 1980. [41] M. Penn and M. Tennenholtz. Constrained multi-object auctions and b-matching. Information Pro- cessing Letters, 75(1-2):29 -- 34, 2000. [42] W. Pulleyblank. Matchings and extensions. Handbook of combinatorics, 1:179 -- 232, 1995. [43] M. Rao. Solving some NP-complete problems using split decomposition. Discrete Applied Mathematics, 156(14):2768 -- 2780, 2008. [44] L. Roditty and V. Vassilevska Williams. Fast approximation algorithms for the diameter and radius of sparse graphs. In STOC'13, pages 515 -- 524. ACM, 2013. [45] M. Tennenholtz. Tractable combinatorial auctions and b-matching. Artificial Intelligence, 140(1-2):231 -- 243, 2002. [46] W. Tutte. A short proof of the factor theorem for finite graphs. Canad. J. Math, 6(1954):347 -- 352, 1954. [47] M.-S. Yu and C.-H. Yang. An O(n)-time algorithm for maximum matching on cographs. Information processing letters, 47(2):89 -- 93, 1993. [48] R. Yuster. Maximum matching in regular and almost regular graphs. Algorithmica, 66(1):87 -- 92, 2013. [49] R. Yuster and U. Zwick. Maximum matching in graphs with an excluded minor. In Proceedings of the eighteenth annual ACM-SIAM Symposium on Discrete Algorithms, pages 108 -- 117. Society for Industrial and Applied Mathematics, 2007. 20
1604.00845
1
1604
2016-04-04T13:19:57
Sparse Fourier Transform in Any Constant Dimension with Nearly-Optimal Sample Complexity in Sublinear Time
[ "cs.DS" ]
We consider the problem of computing a $k$-sparse approximation to the Fourier transform of a length $N$ signal. Our main result is a randomized algorithm for computing such an approximation (i.e. achieving the $\ell_2/\ell_2$ sparse recovery guarantees using Fourier measurements) using $O_d(k\log N\log\log N)$ samples of the signal in time domain that runs in time $O_d(k\log^{d+3} N)$, where $d\geq 1$ is the dimensionality of the Fourier transform. The sample complexity matches the lower bound of $\Omega(k\log (N/k))$ for non-adaptive algorithms due to \cite{DIPW} for any $k\leq N^{1-\delta}$ for a constant $\delta>0$ up to an $O(\log\log N)$ factor. Prior to our work a result with comparable sample complexity $k\log N \log^{O(1)}\log N$ and sublinear runtime was known for the Fourier transform on the line \cite{IKP}, but for any dimension $d\geq 2$ previously known techniques either suffered from a polylogarithmic factor loss in sample complexity or required $\Omega(N)$ runtime.
cs.DS
cs
Sparse Fourier Transform in Any Constant Dimension with Nearly-Optimal Sample Complexity in Sublinear Time Michael Kapralov EPFL June 20, 2018 Abstract We consider the problem of computing a k-sparse approximation to the Fourier transform of a length N signal. Our main result is a randomized algorithm for computing such an approximation (i.e. achieving the ℓ2/ℓ2 sparse recovery guarantees using Fourier measurements) using Od(k log N log log N ) samples of the signal in time domain that runs in time Od(k logd+3 N ), where d ≥ 1 is the dimensionality of the Fourier transform. The sample complexity matches the lower bound of Ω(k log(N/k)) for non-adaptive algorithms due to [DIPW10] for any k ≤ N 1−δ for a constant δ > 0 up to an O(log log N ) factor. Prior to our work a result with comparable sample complexity k log N logO(1) log N and sublinear runtime was known for the Fourier transform on the line [IKP14], but for any dimension d ≥ 2 previously known techniques either suffered from a poly(log N ) factor loss in sample complexity or required Ω(N ) runtime. 6 1 0 2 r p A 4 ] S D . s c [ 1 v 5 4 8 0 0 . 4 0 6 1 : v i X r a 2 5 9 13 13 19 20 23 25 26 26 32 35 36 36 38 42 42 43 44 46 48 50 . . . . . . . . . . . Contents 1 Introduction 2 Preliminaries 3 The algorithm and proof overview 4 Organization 5 Analysis of LOCATESIGNAL: main definitions and basic claims 6 Analysis of LOCATESIGNAL: bounding ℓ1 norm of undiscovered elements . . . . . . . . . . . . . . . . . . 6.1 Bounding noise from heavy hitters . . . 6.2 Bounding effect of tail noise . . . . . . 6.3 Putting it together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Analysis of REDUCEL1NORM and SPARSEFFT 7.1 Analysis of REDUCEL1NORM . . . . . . . . . . 7.2 Analysis of SNR reduction loop in SPARSEFFT . 7.3 Analysis of SPARSEFFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 ℓ∞/ℓ2 guarantees and constant SNR case 8.1 . . . . . 8.2 Recovery at constant SNR . ℓ∞/ℓ2 guarantees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Utilities 9.1 Properties of ESTIMATEVALUES . . . . 9.2 Properties of HASHTOBINS . . . . . . 9.3 Lemmas on quantiles and the median estimator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Semi-equispaced Fourier Transform 11 Acknowledgements A Omitted proofs 1 1 Introduction The Discrete Fourier Transform (DFT) is a fundamental mathematical concept that allows to represent a discrete signal of length N as a linear combination of N pure harmonics, or frequencies. The development of a fast algorithm for Discrete Fourier Transform, known as FFT (Fast Fourier Transform) in 1965 revolutionized digital signal processing, earning FFT a place in the top 10 most important algorithms of the twentieth century [Cip00]. Fast Fourier Transform (FFT) computes the DFT of a length N signal in time O(N log N ), and finding a faster algorithm for DFT is a major open problem in theoretical computer science. While FFT applies to general signals, many of the applications of FFT (e.g. image and video compression schemes such as JPEG and MPEG) rely on the fact that the Fourier spectrum of signals that arise in practice can often be approximated very well by only a few of the top Fourier coefficients, i.e. practical signals are often (approximately) sparse in the Fourier basis. Besides applications in signal processing, the Fourier sparsity property of real world signal plays and im- portant role in medical imaging, where the cost of measuring a signal, i.e. sample complexity, is often a major bottleneck. For example, an MRI machine effectively measures the Fourier transform of a signal x represent- ing the object being scanned, and the reconstruction problem is exactly the problem of inverting the Fourier transformbx of x approximately given a set of measurements. Minimizing the sample complexity of acquiring a signal using Fourier measurements thus translates directly to reduction in the time the patient spends in the MRI machine [LDSP08] while a scan is being taken. In applications to Computed Tomography (CT) reduction in measurement cost leads to reduction in the radiation dose that a patient receives [Sid11]. Because of this strong practical motivation, the problem of computing a good approximation to the FFT of a Fourier sparse signal fast and using few measurements in time domain has been the subject of much attention several communities. In the area of compressive sensing [Don06, CT06], where one studies the task of recovering (approximately) sparse signals from linear measurements, Fourier measurements have been one of the key settings of interest. In particular, the seminal work of [CT06, RV08] has shown that length N signals with at most k nonzero Fourier coefficients can be recovered using only k logO(1) N samples in time domain. The recovery algorithms are based on linear programming and run in time polynomial in N. A different line of research on the Sparse Fourier Transform (Sparse FFT), initiated in the fields of computational complexity and learning theory, has been focused on developing algorithms whose sample complexity and running time scale with the sparsity as opposed to the length of the input signal. Many such algorithms have been proposed in the literature, including [GL89, KM91, Man92, GGI+02, AGS03, GMS05, Iwe10, Aka10, HIKP12b, HIKP12a, BCG+12, HAKI12, PR13, HKPV13, IKP14]. These works show that, for a wide range of signals, both the time complexity and the number of signal samples taken can be significantly sub-linear in N, often of the form k logO(1) N. In this paper we consider the problem of computing a sparse approximation to a signal x ∈ CN given access sparse FFT literature on this problem are summarized in Fig. 1. We focus on algorithms that work for worst- case signals and recover k-sparse approximations satisfying the so-called ℓ2/ℓ2 approximation guarantee. In to its Fourier transformbx ∈ CN .1 The best known results obtained in both compressive sensing literature and this case, the goal of an algorithm is as follows: given m samples of the Fourier transformbx of a signal x, and the sparsity parameter k, output x′ satisfying kx − x′k2 ≤ C min k-sparse y kx − yk2, (1) The algorithms are randomized2 and succeed with at least constant probability. Higher dimensional Fourier transform. While significant attention in the sublinear Sparse FFT literature has been devoted to the basic case of Fourier transform on the line (i.e. one-dimensional signals), the spars- 1Note that the problem of reconstructing a signal from Fourier measurements is equivalent to the problem of computing the Fourier transform of a signal x whose spectrum is approximately sparse, as the DFT and its inverse are only different by a conjugation. 2Some of the algorithms [CT06, RV08, CGV12] can in fact be made deterministic, but at the cost of satisfying a somewhat weaker ℓ2/ℓ1 guarantee. 2 Reference Time Samples C [CT06, RV08, CGV12] [Bou14, HR16] [CP10] [HIKP12a] [IKP14] [IK14] [DIPW10] O(k log2(k) log(N )) N × m linear program N × m linear program O(k log(N ) log(N/k)) O(k log(N ) log(N/k)) k log2(N ) logO(1) log N k log(N ) logO(1) log N O(k log N ) N logO(1) N O(k log N ) Ω(k log(N/k)) O(1) (log N )O(1) any any any O(1) Dimension d > 1? yes yes no no yes lower bound Figure 1: Bounds for the algorithms that recover k-sparse Fourier approximations. All algorithms produce an output satisfying Equation 1 with probability of success that is at least constant. The forth column specifies constraints on approximation factor C. For example, C = O(1) means that the algorithm can only handle constant C as opposed to any C > 1. The last column specifies whether the sample complexity bounds are unchanged, up to factors that depend on dimension d only, for higher dimensional DFT. est signals often occur in applications involving higher-dimensional DFTs. Although a reduction from DFT on a two-dimensional grid with relatively prime side lengths p × q to a one-dimensional DFT of length pq is possible [GMS05, Iwe12]), the reduction does not apply to the most common case when the side lengths of the grid are equal to the same powers of two. It turns out that most sublinear Sparse FFT techniques de- veloped for the one-dimensional DFT do not extend well to the higher dimensional setting, suffering from at least a polylogaritmic loss in sample complexity. Specifically, the only prior sublinear time algorithm that applies to general m × m grids is due to to [GMS05], has O(k logc N ) sample and time complexity for a rather large value of c. If N is a power of 2, a two-dimensional adaptation of the [HIKP12a] algorithm (out- lined in [GHI+13]) has roughly O(k log3 N ) time and sample complexity, and an adaptation of [IKP14] has O(k log2 N (log log N )O(1)) sample complexity. In general dimension d ≥ 1 both of these algorithms have sample complexity Ω(k logd N ). Thus, none of the results obtained so far was able to guarantee sparse recovery from high dimensional (any d ≥ 2) Fourier measurements without suffering at least a polylogarithmic loss in sample complexity, while at the same time achieving sublinear runtime. Our results. In this paper we give an algorithm that achieves the ℓ2/ℓ2 sparse recovery guarantees (1) with d-dimensional Fourier measurements that uses Od(k log N log log N ) samples of the signal and has the running time of Od(k logd+3 N ). This is the first sublinear time algorithm that comes within a poly(log log N ) factor of the sample complexity lower bound of Ω(k log(N/k)) due to [DIPW10] for any dimension higher than one. Sparse Fourier Transform overview. The overall outline of our algorithm follows the framework of [GMS05, HIKP12a, IKP14, IK14], which adapt the methods of [CCFC02, GLPS10] from arbitrary linear measurements to Fourier measurements. The idea is to take, multiple times, a set of B = O(k) linear measurements of the form uj = Xi:h(i)=j sixi for random hash functions h : [N ] → [B] and random sign changes si with si = 1. This corresponds to hashing to B buckets. With such ideal linear measurements, O(log(N/k)) hashes suffice for sparse recovery, giving an O(k log(N/k)) sample complexity. The sparse Fourier transform algorithms approximate u using linear combinations of Fourier samples. Specifically, the coefficients of x are first permuted via a random affine permutation of the input space. Then the coefficients are partitioned into buckets. This step uses the"filtering" process that approximately partitions the 3 range of x into intervals (or, in higher dimension, squares, or ℓ∞ balls) with N/B coefficients each, where each interval corresponds to one bucket. Overall, this ensures that most of the large coefficients are "isolated", i.e., are hashed to unique buckets, as well as that the contributions from the "tail" of the signal x to those buckets is not much greater than the average (the tail of the signal defined as Errk(x) = mink−sparse y x − y2). This allows one to mimic the iterative recovery algorithm described for linear measurements above. However, there are several difficulties in making this work using an optimal number of samples. This enables the algorithm to identify the locations of the dominant coefficients and estimate their values, producing a sparse estimate χ of x. To improve this estimate, we repeat the process on x − χ by subtracting the influence of χ during hashing, thereby refining the approximation of x constructed. After a few iterations of this refinement process the algorithm obtains a good sparse approximation χ of x. A major hurdle in implementing this strategy is that any filter that has been constructed in the literature so far is imprecise in that coefficients contribute ("leak"') to buckets other than the one they are technically mapped into. This contribution, however, is limited and can be controlled by the quality of the filter. The details of filter choice have played a crucial role in recent developments in Sparse FFT algorithms. For example, the best known runtime for one-dimensional Sparse FFT, due to [HIKP12b], was obtained by constructing filters that (almost) precisely mimic the ideal hash process, allowing for a very fast implementation of the process in dimension one. The price to pay for the precision of the filter, however, is that each hashing becomes a logd N factor more costly in terms of sample complexity and runtime than in the idealized case. At the other extreme, the algorithm of [GMS05] uses much less precise filters, which only lead to a C d loss of sample complexity in higher dimensions d, for a constant C > 0. Unfortunately, because of the imprecision of the filters the iterative improvement process becomes quite noisy, requiring Ω(log N ) iterations of the refinement process above. As [GMS05] use fresh randomness for each such iteration, this results in an Ω(log N ) factor loss in sample complexity. The result of [IKP14] uses a hybrid strategy, effectively interpolating between [HIKP12b] and [GMS05]. This gives the near optimal O(k log N logO(1) log N ) sample complexity in dimension one (i.e. Fourier transform on the line), but still suffers from a logd−1 N loss in dimension d. Techniques of [IK14]. The first algorithm to achieve optimal sample complexity was recently introduced in [IK14]. The algorithms uses an approach inspired by [GMS05] (and hence uses 'crude' filters that do not lose much in sample complexity), but introduces a key innovation enabling optimal sample complexity: the algorithm does not use fresh hash functions in every repetition of the refinement process. Instead, O(log N ) hash functions are chosen at the beginning of the process, such that each large coefficient is isolated by most of those functions with high probability. The same hash functions are then used throughout the execution of the algorithm. As every hash function required a separate set of samples to construct the buckets, reusing the hash functions makes sample complexity independent of the number of iterations, leading to the optimal bound. While a natural idea, reusing hash functions creates a major difficulty: if the algorithm identified a non- existent large coefficient (i.e. a false positive) by mistake and added it to χ, this coefficient would be present in the difference vector x − χ (i.e. residual signal) and would need to be corrected later. As the spurious coefficient depends on the measurements, the 'isolation' properties required for recovery need not hold for it as its position is determined by the hash functions themselves, and the algorithm might not be able to correct the mistake. This hurdle was overcome in [IK14] by ensuring that no large coefficients are created spuriously throughout the execution process. This is a nontrivial property to achieve, as the hashing process is quite noisy due to use of the 'crude' filters to reduce the number of samples (because the filters are quite simple, the bucketing process suffers from substantial leakage). The solution was to recover the large coefficients in decreasing order of their magnitude. Specifically, in each step, the algorithm recovered coefficients with magnitude that exceeded a specific threshold (that decreases at an exponential rate). With this approach the ℓ∞ norm of the residual signal decreases by a constant factor in every round, resulting in the even stronger ℓ∞/ℓ2 sparse recovery guarantees in the end. The price to pay for this strong guarantee was the need for a very strong primitive for locating dominant elements in the residual signal: a primitive was needed that would make mistakes with at most inverse polynomial probability. This was achieved by essentially brute-force decoding 4 over all potential elements in [N ]: the algorithm loops over all elements i ∈ [N ] and for each i tests, using the O(log N ) measurements taken, whether i is a dominant element in the residual signal. This resulted in Ω(N ) runtime. Our techniques. In this paper we show how to make the aforementioned algorithm run in sub-linear time, at the price of a slightly increased sampling complexity of Od(k log N log log N ). To achieve a sub- linear runtime, we need to replace the loop over all N coefficients by a location primitive (similar to that in prior works) that identifies the position of any large coefficient that is isolated in a bucket in logO(1) N time per bucket, i.e. without resorting to brute force enumeration over the domain of size N. Unfortunately, the identification step alone increases the sampling complexity by O(log N ) per hash function, so unlike [IK14], here we cannot repeat this process using O(log N ) hash functions to ensure that each large coefficient is isolated by one of those functions. Instead, we can only afford O(log log N ) hash functions overall, which means that 1/ logO(1) N fraction of large coefficients will not be isolated in most hashings. This immediately precludes the possibility of using the initial samples to achieve ℓ∞ norm reduction as in [IK14]. Another problem, however, is that the weaker location primitive that we use may generate spurious coefficients at every step of the recovery process. These spurious coefficients, together with the 1/ logO(1) N fraction of non-isolated elements, contaminate the recovery process and essentially render the original samples useless after a small number of refinement steps. To overcome these hurdles, instead of the ℓ∞ reduction process of [IK14] we use a weaker invariant on the reduction of mass in the 'heavy' elements of the signal throughout our iterative process. Specifically, instead of reduction of ℓ∞ norm of the residual as in [IK14] we give a procedure for reducing the ℓ1 norm of the 'head' of the signal. To overcome the contamination coming from non-isolated as well as spuriously created coefficients, we achieve ℓ1 norm reduction by alternating two procedures. The first procedure uses the O(log log N ) hash functions to reduce the ℓ1 norm of 'well-hashed' elements in the signal, and the second uses a simple sparse recovery primitive to reduce the ℓ∞ norm of offending coefficients when the first procedure gets stuck. This can be viewed as a signal-to-noise ratio (SNR) reduction step similar in spirit the one achieved in [IKP14]. The SNR reduction phase is insufficient for achieving the ℓ2/ℓ2 sparse recovery guarantee, and hence we need to run a cleanup phase at the end, when the signal to noise ratio is constant. It has been observed before (in [IKP14]) that if the signal to noise ratio is constant, then recovery can be done using standard techniques with optimal sample complexity. The crucial difference between [IKP14] and our setting is, however, that we only have bounds on ℓ1-SNR as opposed to ℓ2-SNR In [IKP14]. It turns out, however, that this is not a problem -- we give a stronger analysis of the corresponding primitive from [IKP14], showing that ℓ1-SNR bound is sufficient. Related work on continuous Sparse FFT. Recently [BCG+12] and [PS15] gave algorithms for the related problem of computing Sparse FFT in the continuous setting. These results are not directly comparable to ours, and suffer from a polylogarithmic inefficiency in sample complexity bounds. 2 Preliminaries For a positive even integer a we will use the notation [a] = {− a 2 − 1}. We will consider signals of length N = nd, where n is a power of 2 and d ≥ 1 is the dimension. We use the notation ω = e2πi/n for the root of unity of order n. The d-dimensional forward and inverse Fourier transforms are given by 2 + 1, . . . ,−1, 0, 1, . . . , a 2 ,− a ω−iT jxi and xj = ωiT j xi (2) xj = 1 √N Xi∈[n]d 1 √N Xi∈[n]d respectively, where j ∈ [n]d. We will denote the forward Fourier transform by F and Note that we use the orthonormal version of the Fourier transform. We assume that the input signal has entries of polynomial precision and range. Thus, we have x2 = x2 for all x ∈ CN (Parseval's identity). Given access to samples 5 ofbx, we recover a signal z such that x − z2 ≤ (1 + ǫ) min k− sparse y x − y2 We will use pseudorandom spectrum permutations, which we now define. We write Md×d for the set of d × d matrices over Zn with odd determinant. For Σ ∈ Md×d, q ∈ [n]d and i ∈ [n]d let πΣ,q(i) = Σ(i − q) mod n. Since Σ ∈ Md×d, this is a permutation. Our algorithm will use π to hash heavy hitters into B buckets, where we will choose B ≈ k. We will often omit the subscript Σ, q and simply write π(i) when Σ, q is fixed or clear from context. For i, j ∈ [n]d we let oi(j) = π(j) − (n/b)h(i) be the "offset" of j ∈ [n]d relative to i ∈ [n]d (note that this definition is different from the one in [IK14]). We will always have B = bd, where b is a power of 2. Definition 2.1. Suppose that Σ−1 exists mod n. For a, q ∈ [n]d we define the permutation PΣ,a,q by (PΣ,a,q x)i = xΣT (i−a)ωiT Σq. Lemma 2.2. F−1(PΣ,a,q x)πΣ,q(i) = xiωaT Σi The proof is given in [IK14] and we do not repeat it here. Define Errk(x) = min k−sparse y x − y2 and µ2 = Err2 k(x)/k. (3) In this paper, we assume knowledge of µ (a constant factor upper bound on µ suffices). We also assume that the signal to noise ration is bounded by a polynomial, namely that R∗ := x∞/µ ≤ N O(1). We use the notation B∞r (x) to denote the ℓ∞ ball of radius r around x: B∞r (x) = {y ∈ [n]d : x − y∞ ≤ r}, where x − y∞ = maxs∈d xs − ys◦, and xs − ys◦ is the circular distance on Zn. We will also use the notation f . g to denote f = O(g). For a real number a we write a+ to denote the positive part of a, i.e. a+ = a if a ≥ 0 and a+ = 0 otherwise. We will use the filter G, G constructed in [IK14]. The filter is defined by a parameter F ≥ 1 that governs its decay properties. The filter satisfies supp G ⊆ [−F · b, F · b]d and Lemma 2.3 (Lemma 3.1 in [IK14]). One has (1) Gj ∈ [ (2) Gj ≤(cid:16) 2b and for all j ∈ [n]d as long as b ≥ 3 and (3) Gj ∈ [0, 1] for all j as long as F is even. Remark 2.4. Property (3) was not stated explicitly in Lemma 3.1 of [IK14], but follows directly from their construction. (2π)F ·d , 1] for all j ∈ [n]d such that j∞ ≤ n 1 2 1+(b/n)j∞(cid:17)F The properties above imply that most of the mass of the filter is concentrated in a square of side O(n/b), approximating the "ideal" filter (whose value would be equal to 1 for entries within the square and equal to 0 outside of it). Note that for each i ∈ [n]d one has Goi(i) ≥ (2π)d·F . We refer to the parameter F as the sharpness of the filter. Our hash functions are not pairwise independent, but possess a property that still makes hashing using our filters efficient: Lemma 2.5 (Lemma 3.2 in [IK14]). Let i, j ∈ [n]d. Let Σ be uniformly random with odd determinant. Then for all t ≥ 0 one has Pr[Σ(i − j)∞ ≤ t] ≤ 2(2t/n)d. 1 Pseudorandom spectrum permutations combined with a filter G give us the ability to 'hash' the elements of the input signal into a number of buckets (denoted by B). We formalize this using the notion of a hashing. A hashing is a tuple consisting of a pseudorandom spectrum permutation π, target number of buckets B and a sharpness parameter F of our filter, denoted by H = (π, B, F ). Formally, H is a function that maps a signal x to B signals, each corresponding to a hash bucket, allowing us to solve the k-sparse recovery problem on input x by reducing it to 1-sparse recovery problems on the bucketed signals. We give the formal definition below. 6 Definition 2.6 (Hashing H = (π, B, F )). For a permutation π = (Σ, q), parameters b > 1, B = bd and F , a hashing H := (π, B, F ) is a function mapping a signal x ∈ C[n]d to B signals H(x) = (us)s∈[b]d, where us ∈ C[n]d for each s ∈ [b]d, such that for each i ∈ [n]d us,i = Xj∈[n]d Gπ(j)−(n/b)·sxjωiT Σj ∈ C, where G is a filter with B buckets and sharpness F constructed in Lemma 2.3. For a hashing H = (π, B, F ), π = (Σ, q) we sometimes write PH,a, a ∈ [n]d to denote PΣ,a,q. We will consider hashings of the input signal x, as well as the residual signal x − χ, where Definition 2.7 (Measurement m = m(x, H, a)). For a signal x ∈ C[n]d, a hashing H = (π, B, F ) and a parameter a ∈ [n]d, a measurement m = m(x, H, a) ∈ C[b]d is the B-dimensional complex valued vector of evaluations of a hashing H(x) at a ∈ C[n]d, i.e. length B, indexed by [b]d and given by evaluating the hashing H at a ∈ [n]d, i.e. for s ∈ [b]d ms = Xj∈[n]d Gπ(j)−(n/b)·sxjωaT Σj, where G is a filter with B buckets and sharpness F constructed in Lemma 2.3. Definition 2.8. For any x ∈ C[n]d and any hashing H = (π, B, G) define the vector µ2 for every i ∈ [n]d H,i(x) := G−1 µ2 oi(i) Xj∈[n]d\{i} xj2Goi(j)2. H,·(x) ∈ R[n]d by letting We access the signal x in Fourier domain via the function HASHTOBINS(x, χ, (H, a)), which evaluates the hashing H of residual signal x − χ at point a ∈ [n]d, i.e. computes the measurement m(x, H, a) (the computation is done with polynomial precision). One can view this function as "hashing" x into B bins by convolving it with the filter G constructed above and subsampling appropriately. The pseudocode for this function is given in section 9.2. In what follows we will use the following properties of HASHTOBINS: Lemma 2.9. There exists a constant C > 0 such that for any dimension d ≥ 1, any integer B ≥ 1, any x, χ ∈ C[n]d , x′ := x− χ, if Σ ∈ Md×d, a, q ∈ [n]d are selected uniformly at random, the following conditions hold. Let π = (Σ, q), H = (π, B, G), where G is the filter with B buckets and sharpness F constructed in Lemma 2.3, and let u = HASHTOBINS(x, χ, (H, a)). Then if F ≥ 2d, F = Θ(d), for any i ∈ [n]d (1) For any H one has maxa∈[n]d G−1 oi(i)ω−aT Σiuh(i) − x′i ≤ G−1 EH[G−1 oi(i) ·Pj∈S\{i} Goi(j)x′j] ≤ (2π)d·F · C dx′1/B + N−Ω(c); H,i(x′)] ≤ (2π)2d·F · C dkx′k2 2/B, (2) EH[µ2 oi(i) ·Pj∈S\{i} Goi(j)x′j. Furthermore, Furthermore, (3) for any hashing H, if a is chosen uniformly at random from [n]d, one has Ea[G−1 oi(i)ω−aT Σiuh(i) − x′i2] ≤ µ2 H,i(x′) + N−Ω(c). Here c > 0 is an absolute constant that can be chosen arbitrarily large at the expense of a factor of cO(d) in runtime. 7 The proof of Lemma 2.9 is given in Appendix A. We will need several definitions and lemmas from [IK14], which we state here. We sometimes need slight modifications of the corresponding statements from [IK14], in which case we provide proofs in Appendix A. Throughout this paper the main object of our analysis is a properly defined set S ⊆ [n]d that contains the 'large' coefficients of the input vector x. Below we state our definitions and auxiliary lemmas without specifying the identity of this set, and then use specific instantiations of S to analyze outer primitives such as REDUCEL1NORM, REDUCEINFNORM and RECOVERATCONST- SNR. This is convenient because the analysis of all of these primitives can then use the same basic claims about estimation and location primitives. The definition of S given in (4) above is the one we use for analyzing REDUCEL1NORM and the SNR reduction loop. Analysis of REDUCEINFNORM (section 8.1) and RECOV- ERATCONSTANTSNR (section 8.2) use different instantiations of S, but these are local to the corresponding sections, and hence the definition in (4) is the best one to have in mind for the rest of this section. First, we need the definition of an element i ∈ [n]d being isolated under a hashing H = (π, B, F ). Intu- itively, an element i ∈ S is isolated under hashing H with respect to set S if not too many other elements S are hashed too close to i. Formally, we have Definition 2.10 (Isolated element). Let H = (π, B, F ), where π = (Σ, q), Σ ∈ Md×d, q ∈ [n]d. We say that an element i ∈ [n]d is isolated under hashing H at scale t if π(S \ {i}) ∩ B∞(n/b)·h(i)((n/b) · 2t) ≤ (2π)−d·F · αd/22(t+1)d · 2t. We say that i is simply isolated under hashing H if it is isolated under H at all scales t ≥ 0. The following lemma shows that any element i ∈ S is likely to be isolated under a random permutation π: Lemma 2.11. For any integer k ≥ 1 and any S ⊆ [n]d,S ≤ 2k, if B ≥ (2π)4d·F ·k/αd for α ∈ (0, 1) smaller than an absolute constant, F ≥ 2d, and a hashing H = (π, B, F ) is chosen randomly (i.e. Σ ∈ Md×d, q ∈ [n]d are chosen uniformly at random, and π = (Σ, q)), then each i ∈ [n]d is isolated under permutation π with probability at least 1 − 1 2√α. The proof of the lemma is very similar to Lemma 5.4 in [IK14] (the only difference is that the ℓ∞ ball is centered at the point that i hashes to in Lemma 2.11, whereas it was centered at π(i) in Lemma 5.4 of [IK14]) and is given in Appendix A for completeness. As every element i ∈ S is likely to be isolated under one random hashing, it is very likely to be isolated under a large fraction of hashings H1, . . . , Hrmax: Lemma 2.12. For any integer k ≥ 1, and any S ⊆ [n]d,S ≤ 2k, if B ≥ (2π)4d·F · k/αd for α ∈ (0, 1) smaller than an absolute constant, F ≥ 2d, Hr = (πr, B, F ), r = 1, . . . , rmax a sequence of random hashings, then every i ∈ [n]d is isolated with respect to S under at least (1 − √α)rmax hashings Hr, r = 1, . . . , rmax with probability at least 1 − 2−Ω(√αrmax). Proof. Follows by an application of Chernoff bounds and Lemma 2.11. It is convenient for our location primitive (LOCATESIGNAL, see Algorithm 1) to sample the signal at pairs of locations chosen randomly (but in a correlated fashion). The two points are then combined into one in a linear fashion. We now define notation for this common operation on pairs of numbers in [n]d. Note that we are viewing pairs in [n]d× [n]d as vectors in dimension 2, and the ⋆ operation below is just the dot product over this two dimensional space. However, since our input space is already endowed with a dot product (for i, j ∈ [n]d we denote their dot product by iT j), having special notation here will help avoid confusion. 8 Operations on vectors in [n]d. For a pair of vectors (α1, β1), (α2, β2) ∈ [n]d× [n]d we let (α1, β1) ⋆ (α2, β2) denote the vector γ ∈ [n]d such that γi = (α1)i · (α2)i + (β1)i · (β2)i for all i ∈ [d]. Note that for any a, b, c ∈ [n]d × [n]d one has a ⋆ b + a ⋆ c = a ⋆ (b + c), where addition for elements of [n]d × [n]d is componentwise. We write 1 ∈ [n]d for the all ones vector in dimension d, and 0 ∈ [n]d for the zero vector. For a set A ⊆ [n]d × [n]d and a vector (α, β) ∈ [n]d × [n]d we denote A ⋆ (α, β) := {a ⋆ (α, β) : a ∈ A}. Definition 2.13 (Balanced set of points). For an integer ∆ ≥ 2 we say that a (multi)set Z ⊆ [n]d is ∆-balanced in coordinate s ∈ [1 : d] if for every r = 1, . . . , ∆− 1 at least 49/100 fraction of elements in the set {ωr·zs ∆ }z∈Z belong to the left halfplane {u ∈ C : Re(u) ≤ 0} in the complex plane, where ω∆ = e2πi/∆ is the ∆-th root of unity. Note that if ∆ divides n, then for any fixed value of r the point ωr·zs ∆ is uniformly distributed over the ∆′-th roots of unity for some ∆′ between 2 and ∆ for every r = 1, . . . , ∆ − 1 when zs is uniformly random in [n]. Thus for r 6= 0 we expect at least half the points to lie in the halfplane {u ∈ C : Re(u) ≤ 0}. A set Z is balanced if it does not deviate from expected behavior too much. The following claim is immediate via standard concentration bounds: Claim 2.14. There exists a constant C > 0 such that for any ∆ a power of two, ∆ = logO(1) n, and n a power of 2 the following holds if ∆ < n. If elements of a (multi)set A ⊆ [n]d × [n]d of size C log log N are chosen uniformly at random with replacement from [n]d × [n]d, then with probability at least 1 − 1/ log4 N one has that for every s ∈ [1 : d] the set A ⋆ (0, es) is ∆-balanced in coordinate s. Since we only use one value of ∆ in the paper (see line 8 in Algorithm 1), we will usually say that a set is simply 'balanced' to denote the ∆-balanced property for this value of ∆. 3 The algorithm and proof overview In this section we state our algorithm and give an outline of the analysis. The formal proofs are then presented in the rest of the paper (the organization of the rest of the paper is presented in section 4). Our algorithm (Algorithm 2), at a high level, proceeds as follows. algorithm selects O(log log N ) hashings Hr = (πr, B, F ), r = 1, . . . , O(log log N ), where πr are selected uniformly at random, and for each r selects a set Ar ⊆ [n]d×[n]d of size O(log log N ) that determines locations Measuring bx. The algorithms starts by taking measurements of the signal in lines 5-16. Note that the to access in frequency domain. The signalbx is accessed via the function HASHTOBINS (see Lemma 2.9 above for its properties. The function HASHTOBINS accesses filtered versions ofbx shifted by elements of a randomly selected set (the number of shifts is O(log N/ log log N )). These shifts are useful for locating 'heavy' elements from the output of HASHTOBINS. Note that since each hashing takes O(B) = O(k) samples, the total sample complexity of the measurement step is O(k log N log log N ). This is the dominant contribution to sample complexity, but it is not the only one. The other contribution of O(k log N log log N ) comes from invocations of ESTIMATEVALUES from our ℓ1-SNR reduction loop (see below). The loop goes over O(log R∗) = O(log N ) iterations, and in each iteration ESTIMATEVALUES uses O(log log N ) fresh hash functions to keep the number of false positives and estimation error small. The location algorithm is Algorithm 1. Our main tool for bounding performance of LOCATESIGNAL is Theorem 3.1, stated below. Theorem 3.1 applies to the following setting. Fix a set S ⊆ [n]d and a set of hashings H1, . . . , Hrmax that encode signal measurement patterns, and let S∗ ⊆ S denote the set of elements 9 of S that are not isolated with respect to most of these hashings. Theorem 3.1 shows that for any signal x and partially recovered signal χ, if L denotes the output list of an invocation of LOCATESIGNAL on the pair (x, χ) with measurements given by H1, . . . , Hrmax and a set of random shifts, then the ℓ1 norm of elements of the residual (x − χ)S that are not discovered by LOCATESIGNAL can be bounded by a function of the amount of ℓ1 mass of the residual that fell outside of the 'good' set S \ S∗, plus the 'noise level' µ ≥ x[n]d\S∞ times k. If we think of applying Theorem 3.1 iteratively, we intuitively get that the fixed set of measurements given by hashings H1, . . . , Hr allows us to always reduce the ℓ1 norm of the residual x′ = x − χ on the 'good' set S \ S∗ to about the amount of mass that is located outside of this good set(this is exactly how we use LOCATESIGNAL in our signal to noise ratio reduction loop below). In section 6 we prove Theorem 3.1. For any constant C′ > 0 there exist absolute constants C1, C2, C3 > 0 such that for any x, χ ∈ CN , x′ = x−χ, any integer k ≥ 1 and any S ⊆ [n]d such that x[n]d\S∞ ≤ C′µ, where µ = x[n]d\[k]2/√k, the following conditions hold if x′∞/µ = N O(1). Let πr = (Σr, qr), r = 1, . . . , rmax denote permutations, and let Hr = (πr, B, F ), F ≥ 2d, F = Θ(d), where B ≥ (2π)4d·F k/αd for α ∈ (0, 1) smaller than a constant. Let S∗ ⊆ S denote the set of elements that are not isolated with respect to at least a √α fraction of hashings {Hr}. Then if additionally for every s ∈ [1 : d] the sets Ar ⋆ (1, es) are balanced in coordinate s (as per Definition 2.13) for all r = 1, . . . , rmax, and rmax, cmax ≥ (C1/√α) log log N , then L := satisfies LOCATESIGNAL(cid:16)χ, k,{m(bx, Hr, a ⋆ (1, w))}rmax rmax[r=1 x′S\S ∗\L1 ≤ (C2α)d/2x′S1 + C d2 r=1,a∈Ar ,w∈W(cid:17) 3 (χ[n]d\S1 + x′S ∗1) + 4µS. Reducing signal to noise ratio. Once the samples have been taken, the algorithm proceeds to the signal to noise (SNR) reduction loop (lines 17-23). The objective of this loop is to reduce the mass of the top (about k) elements in the residual signal to roughly the noise level µ · k (once this is done, we run a 'cleanup' primitive, referred to as RECOVERATCONSTANTSNR, to complete the recovery process -- see below). Specifically, we define the set S of 'head elements' in the original signal x as S = {i ∈ [n]d : xi > µ}, (4) where µ2 = Err2 k(x)/k is the average tail noise level. Note that we have S ≤ 2k. Indeed, if S > 2k, more than k elements of S belong to the tail, amounting to more than µ2 · k = Err2 k(x) tail mass. Ideally, we would like this loop to construct and approximation χ(T ) to x supported only on S such that (x−χ(T ))S1 = O(µk), i.e. the ℓ1-SNR of the residual signal on the set S of heavy elements is reduced to a constant. As some false positives will unfortunately occur throughout the execution of our algorithm due to the weaker sublinear time location and estimation primitives that we use, our SNR reduction loop is to construct an approximation χ(T ) to x with the somewhat weaker properties that (x − χ(T ))S1 + χ(T )[n]d\S = O(µk) and χ(T )0 ≪ k. (5) Thus, we reduce the ℓ1-SNR on the set S of 'head' elements to a constant, and at the same time not introduce too many spurious coefficients (i.e. false positives) outside S, and these coefficients do not contribute much ℓ1 mass. The SNR reduction loop itself consists of repeated alternating invocations of two primitives, namely REDUCEL1NORM and REDUCEINFNORM. Of these two the former can be viewed as performing most of the reduction, and REDUCEINFNORM is naturally viewed as performing a 'cleanup' phase to fix inefficiencies of REDUCEL1NORM that are due to the small number of hash functions (only O(log log N ) as opposed to 10 O(log N ) in [IK14]) that we are allowed to use, as well as some mistakes that our sublinear runtime location and estimation primitives used in REDUCEL1NORM might make. Algorithm 1 Location primitive: given a set of measurements corresponding to a single hash function, returns a list of elements in [n]d, one per each hash bucket 1: procedure LOCATESIGNAL(χ, H,{m(bx, H, a ⋆ (1, w)}a∈A,w∈W ) Let x′ := x − χ. Compute {m(bx′, H, a ⋆ (1, w)}a∈A,w∈W using Corollary 10.2 and HASHTOBINS. L ← ∅ for j ∈ [b]d do ⊲ Loop over all hash buckets, indexed by j ∈ [b]d f ← 0d for s = 1 to d do ⊲ Recovering each of d coordinates separately ⊲ H = (π, B, F ), B = bd 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 2 log2 log2 n⌋ ∆ ← 2⌊ 1 for g = 1 to log∆ n − 1 do ∆ (cid:12)(cid:12)(cid:12)(cid:12)ω−r·βs (α, β) ∈ A 12: 13: 14: 15: 16: 17: 18: end procedure end for return L end for end for L ← L ∪ {Σ−1f} w ← n∆−g · es If there exists a unique r ∈ [0 : ∆ − 1] such that · ω−(n·∆−gfs)·βs · mj ( bx′,H,a⋆(1,w)) then f ← f + ∆g−1 · r · es else return FAIL mj( bx′,H,a⋆(1,0)) − 1(cid:12)(cid:12)(cid:12)(cid:12) < 1/3 for at least 3/5 fraction of a = ⊲ Note that w ∈ W ⊲ Add recovered element to output list 1 REDUCEL1NORM is presented as Algorithm 3 below. The algorithm performs O(log log N ) rounds of the following process: first, run LOCATESIGNAL on the current residual signal, then estimate values of the elements that belong to the list L output by LOCATESIGNAL, and only keep those that are above a certain threshold (see threshold 10000 2−tν + 4µ in the call the ESTIMATEVALUES in line 9 of Algorithm 3). This thresholding operation is crucial, and allows us to control the number of false positives. In fact, this is very similar to the approach of [IK14] of recovering elements starting from the largest. The only difference is that (a) our 'reliability threshold' is dictated by the ℓ1 norm of the residual rather than the ℓ∞ norm, as in [IK14], and (b) some false positives can still occur due to our weaker estimation primitives. Our main tool for formally stating the effect of REDUCEL1NORM is Lemma 3.2 below. Intuitively, the lemma shows that REDUCEL1NORM reduces the ℓ1 norm of the head elements of the input signal x − χ by a polylogarthmic factor, and does not introduce too many new spurious elements (false positives) in the process. The introduced spurious elements, if any, do not contribute much ℓ1 mass to the head of the signal. Formally, we show in section 7.1 Lemma 3.2. For any x ∈ CN , any integer k ≥ 1, B ≥ (2π)4d·F · k/αd for α ∈ (0, 1] smaller than an absolute constant and F ≥ 2d, F = Θ(d) the following conditions hold for the set S := {i ∈ [n]d : xi > µ}, where µ2 := x[n]d\[k]2 For any sequence of hashings Hr = (πr, B, F ), r = 1, . . . , rmax, if S∗ ⊆ S denotes the set of elements of S that are not isolated with respect to at least a √α fraction of the hashings Hr, r = 1, . . . , rmax, then for any χ ∈ C[n]d, x′ := x − χ, if ν ≥ (log4 N )µ is a parameter such that A (x − χ)S1 ≤ (ν + 20µ)k; B χ[n]d\S0 ≤ 1 2/k. Suppose that x∞/µ = N O(1). log19 N k; 11 C (x − χ)S ∗1 + χ[n]d\S1 ≤ ν the following conditions hold. log4 N k, If parameters rmax, cmax are chosen to be at least (C1/√α) log log N , where C1 is the constant from Theorem 3.1 and measurements are taken as in Algorithm 2, then the output χ′ of the call satisfies REDUCEL1NORM(χ, k,{m(bx, Hr, a ⋆ (1, w))}rmax r=1,a∈Ar ,w∈W , 4µ(log4 n)T−t, µ) log4 N νk + 20µk 1. (x′ − χ′)S1 ≤ 1 2. (χ + χ′)[n]d\S0 ≤ χ[n]d\S0 + 1 3. (x′ − χ′)S ∗1 + (χ + χ′)[n]d\S1 ≤ x′S ∗1 + χ[n]d\S1 + 1 (ℓ1 norm of head elements is reduced by ≈ log4 N factor) k (few spurious coefficients are introduced) log20 N log20 N νk (ℓ1 norm of spurious coefficients does not grow fast) with probability at least 1 − 1/ log2 N over the randomness used to take measurements m and by calls to ES- TIMATEVALUES. The number of samples used is bounded by 2O(d2)k(log log N )2, and the runtime is bounded by 2O(d2)k logd+2 N . Equipped with Lemma 3.2 as well as its counterpart Lemma 8.1 that bounds the performance of REDU- CEINFNORM (see section 8.1) we are able to prove that the SNR reduction loop indeed achieves its cause, namely (5). Formally, we prove in section 7.2 Theorem 3.3. For any x ∈ CN , any integer k ≥ 1, if µ2 = Err2 following conditions hold for the set S := {i ∈ [n]d : xi > µ} ⊆ [n]d. k(x)/k and R∗ ≥ x∞/µ = N O(1), the Then the SNR reduction loop of Algorithm 2 (lines 19-25) returns χ(T ) such that (x − χ(T ))S1 . µ χ(T ) χ(T ) [n]d\S1 . µ [n]d\S0 . log19 N 1 (ℓ1-SNR on head elements is constant) (spurious elements contribute little in ℓ1 norm) k (small number of spurious elements have been introduced) with probability at least 1 − 1/ log N over the internal randomness used by Algorithm 2. The sample complexity is 2O(d2)k log N (log log N ). The runtime is bounded by 2O(d2)k logd+3 N . Recovery at constant ℓ1-SNR. Once (5) has been achieved, we run the RECOVERATCONSTANTSNR primitive (Algorithm 5) on the residual signal. Adding the correction χ′ that it outputs to the output χ(T ) of the SNR reduction loop gives the final output of the algorithm. We prove in section 8.2 Lemma 3.4. For any ǫ > 0, x, χ ∈ CN , x′ = x − χ and any integer k ≥ 1 if x′[2k]1 ≤ O(x[n]d\[k]2√k) 2, the following conditions hold. If x∞/µ = N O(1), then the output χ′ of and x′[n]d\[2k]2 RECOVERATCONSTANTSNR(x, χ, 2k, ǫ) satisfies 2 ≤ x[n]d\[k]2 x′ − χ′2 2 ≤ (1 + O(ǫ))x[n]d\[k]2 2 with at least 99/100 probability over its internal randomness. The sample complexity is 2O(d2) 1 the runtime complexity is at most 2O(d2) 1 ǫ k logd+1 N. ǫ k log N , and 12 We give the intuition behind the proof here, as the argument is somewhat more delicate than the analysis of RECOVERATCONSTSNR in [IKP14], due to the ℓ1-SNR, rather than ℓ2-SNR assumption. Specifically, if instead of (x − χ)[2k]1 ≤ O(µk) we had (x − χ)[2k]2 2 ≤ O(µ2k), then it would be essentially sufficient to note that after a single hashing into about k/(ǫα) buckets for a constant α ∈ (0, 1), every element i ∈ [2k] is recovered with probability at least 1 − O(ǫα), say, as it is enough to (on average) recover all but about an ǫ fraction of coefficients. This would not be sufficient here since we only have a bound on the ℓ1 norm of the residual, and hence some elements can contribute much more ℓ2 norm than others. However, we are able to show that the probability that an element of the residual signal x′i is not recovered is bounded by O( αǫµ2 i2 + αǫµ ), x′ x′ i where the first term corresponds to contribution of tail noise and the second corresponds to the head elements. This bound implies that the total expected ℓ2 2 mass in the elements that are not recovered is upper bounded by i2 + αǫµ x′ x′ i Finally, putting the results above together, we prove in section 7.3 ) ≤ O(ǫµ2k + ǫµPi∈[2k] x′i) = O(ǫµ2k), giving the result. Pi∈[2k] x′i2 · O( αǫµ2 Theorem 3.5. For any ǫ > 0, x ∈ C[n]d and any integer k ≥ 1, if R∗ ≥ x∞/µ = N O(1), µ2 = 2/k) and α > 0 is smaller than an absolute constant, SPARSEFFT(x, k, ǫ, R∗, µ) solves the O(x[n]d\[k]2 ℓ2/ℓ2 sparse recovery problem using 2O(d2)(k log N log log N + 1 ǫ k logd+3 N time with at least 98/100 success probability. ǫ k log N ) samples and 2O(d2) 1 4 Organization The rest of the paper is organized as follows. In section 5 we set up notation necessary for the analysis of LOCATESIGNAL, and specifically for a proof of Theorem 3.1, as well as prove some basic claims. In section 6 we prove Theorem 3.1. In section 7 we prove performance guarantees for REDUCEL1NORM (Lemma 3.2), then combine them with Lemma 8.1 to prove that the main loop in Algorithm 2 reduces ℓ1 norm of the head elements. We then conclude with a proof of correctness for Algorithm 2. Section 8.1 is devoted to analyzing the REDUCEINFNORM procedure, and section 8.2 is devoted to analyzing the RECOVERATCONSTANTSNR procedure. Some useful lemmas are gathered in section 9, and section 10 describes the algorithm for semieq- uispaced Fourier transform that we use to update our samples with the residual signal. Appendix A contains proofs omitted from the main body of the paper. 5 Analysis of LOCATESIGNAL: main definitions and basic claims In this section we state our main signal location primitive, LOCATESIGNAL (Algorithm 1). Given a sequence of measurements m(bx, Hr, a ⋆ (1, w))}a∈Ar ,w∈W , r = 1, . . . , rmax a signalbx ∈ C[n]d and a partially recovered signal χ ∈ C[n]d, LOCATESIGNAL outputs a list of locations L ⊆ [n]d that, as we show below in Theorem 3.1 (see section 6), contains the elements of x that contribute most of its ℓ1 mass. An important feature of LO- CATESIGNAL is that it is an entirely deterministic procedure, giving recovery guarantees for any signal x and any partially recovered signal χ. As Theorem 3.1 shows, however, these guarantees are strongest when most of the mass of the residual x − χ resides on elements in [n]d that are isolated with respect to most hashings H1, . . . , Hrmax used for measurements. This flexibility is crucial for our analysis, and is exactly what allows us to reuse measurements and thereby achieve near-optimal sample complexity. In the rest of this section we first state Algorithm 1, and then derive useful characterization of elements i of the input signal (x − χ)i that are successfully located by LOCATESIGNAL. The main result of this section is Corollary 5.2. This comes down to bounding, for a given input signal x and partially recovered signal χ, the expected ℓ1 norm of the noise contributed to the process of locating heavy hitters in a call to LOCATESIG- NAL(bx, χ, H,{m(bx, H, a ⋆ (1, w))}a∈A,w∈W ) by (a) the tail of the original signal x (tail noise etail) and (b) 13 Algorithm 2 SPARSEFFT(x, k, ǫ, R∗, µ) 1: procedure SPARSEFFT(x, k, ǫ, R∗, µ) 2: 3: 4: 5: 6: ⊲ in Cn. 2 log2 log2 n⌋ s=1 n∆−g · es ⊲ 0d is the zero vector in dimension d χ(0) ← 0 T ← log(log4 N ) R∗ F ← 2d B ← (2π)4d·F · k/αd, α > 0 sufficiently small constant rmax ← (C/√α) log log N, cmax ← (C/√α) log log N for a sufficiently large constant C > 0 W ← {0d}, ∆ ← 2⌊ 1 for g = 1 to ⌈log∆ n⌉ do W ← W ∪Sd end for G ← filter with B buckets and sharpness F , as per Lemma 2.3 for r = 1 to rmax do ⊲ Samples that will be used for location Choose Σr ∈ Md×d, qr ∈ [n]d uniformly at random, let πr := (Σr, qr) and let Hr := (πr, B, F ) Let Ar ← C log log N elements of [n]d × [n]d sampled uniformly at random with replacement for w ∈ W do end for m(bx, Hr, a ⋆ (1, w)) ← HASHTOBINS(x, 0, (Hr, a ⋆ (1, w))) for all a ∈ Ar, w ∈ W , 4µ(log4 n)T−t, µ(cid:17) χ′ ← REDUCEL1NORM(cid:16)χ(t), k,{m(bx, Hr, a ⋆ (1, w))}rmax ⊲ Reduce ℓ1 norm of dominant elements in the residual signal ⊲ Threshold end for for t = 0, 1, . . . , T − 1 do ⊲ es is the unit vector in direction s r=1,a∈Ar ,w∈W 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: end procedure ν′ ← (log4 N )(4µ(log4 N )T−(t+1) + 20µ) χ′′ ← REDUCEINFNORM(x, χ(t) + χ′, 4k/(log4 N ), ν′, ν′) χ(t+1) ← χ(t) + χ′ + χ′′ end for χ′ ← RECOVERATCONSTANTSNR(x, χ(T ), 2k, ǫ) return χ(T ) + χ′ ⊲ Reduce ℓ∞ norm of spurious elements introduced by REDUCEL1NOM , ν, µ(cid:17) , ν, µ) r=1,a∈Ar ,w∈W r=1,a∈Ar ,w∈W ⊲ in Cn 2: 3: 4: 5: χ(0) ← 0 B ← (2π)4d·F · k/αd for t = 0 to log2(log4 N ) do Algorithm 3 REDUCEL1NORM(cid:16)bx, χ, k, χ(t), k,{m(bx, Hr, a ⋆ (1, w))}rmax 1: procedure REDUCEL1NORM(bx, χ, k, χ(t), k,{m(bx, Hr, a ⋆ (1, w))}rmax Lr ← LOCATESIGNAL(cid:16)χ + χ(t), k,{m(bx, Hr, a ⋆ (1, w))}rmax L ←Srmax χ′ ← ESTIMATEVALUES(bx, χ + χ(t), L, 4k, 1, χ(t+1) ← χ(t) + χ′ for r = 1 to rmax do r=1 Lr end for 6: 7: 8: 9: 10: 11: 12: 13: end procedure end for return χ + χ(T ) r=1,a∈Ar ,w∈W(cid:17) 1 1000 ν2−t + 4µ, C(log log N + d2 + log(B/k))) 14 the heavy hitters and false positives (heavy hitter noise ehead). It is useful to note that unlike in [IK14], we cannot expect the tail of the signal to not change, but rather need to control this change. In what follows we derive useful conditions under which an element i ∈ [n]d is identified by LOCATES- IGNAL. Let S ⊆ [n]d be any set of size at most 2k, and let µ be such that x[n]d\S ≤ µ. Note that this fits the definition of S given in (4) (but other instantiations are possible, and will be used later in section 8.2). Consider a call to LOCATESIGNAL(χ, H,{m(bx, H, a ⋆ (1, w)}a∈A,w∈W ). For each a ∈ A and fixed w ∈ W we let z := a ⋆ (1, w) ∈ [n]d to simplify notation. The measurement vectors m := m(bx′, H, z) computed in LOCATESIGNAL satisfy, for every i ∈ S, (by Lemma 9.2) Goi(j)x′jωzT Σj + ∆h(i),z, mh(i) = Xj∈[n]d where ∆ corresponds to polynomially small estimation noise due to approximate computation of the Fourier transform, and the filter Goi(j) is the filter corresponding to hashing H. In particular, for each hashing H and parameter a ∈ [n]d one has: oi(i)mh(i)ω−zT Σi = x′i + G−1 G−1 Goi(j)x′jωzT Σ(j−i) + G−1 oi(i)∆h(i),zω−zT Σi oi(i) Xj∈[n]d\{i} It is useful to represent the residual signal x as a sum of three terms: x′ = (x − χ)S − χ[n]d\S + x[n]d\S, where the first term is the residual signal coming from the 'heavy' elements in S, the second corresponds to false positives, or spurious elements discovered and erroneously subtracted by the algorithm, and the third corresponds to the tail of the signal. Similarly, we bound the noise contributed by the first two (head elements and false positives) and the third (tail noise) parts of the residual signal to the location process separately. For each i ∈ S we write oi(i)mh(i)ω−zT Σi = x′i G−1 Goi(j)x′jωzT Σ(j−i) − Xj∈[n]d\S Goi(j)xjωzT Σ(j−i) Goi(j)χjωzT Σ(j−i) (head elements and false positives) (tail noise) oi(i) · Xj∈S\{i} oi(i) · Xj∈[n]d\S oi(i) · ∆h(i)ω−zT Σi. + G−1 + G−1 + G−1 (6) Noise from heavy hitters. The first term in (6) corresponds to noise from (x − χ)S\{i} − χ[n]d\(S\{i}), i.e. noise from heavy hitters and false positives. For every i ∈ S, hashing H we let ehead i (H, x, χ) := G−1 Goi(j)yj, where y = (x − χ)S − χ[n]d\S. (7) oi(i) · Xj∈S\{i} i We thus get that ehead (H, x, χ) upper bounds the absolute value of the first error term in (6). Note that G ≥ 0 by Lemma 2.3 as long as F is even, which is the setting that we are in. If ehead (H, x, χ) is large, LOCATESIGNAL may not be able to locate i using measurements of the residual signal x− χ taken with hashing H. However, the noise in other hashings may be smaller, allowing recovery. In order to reflect this fact we define, for a sequence of hashings H1, . . . , Hr and a signal y ∈ C[n]d i ehead i ({Hr}, x, χ) := quant1/5 r ehead i (Hr, x, χ), (8) 15 With this definition in place etail several values of a ∈ Ar ⊆ [n]d × [n]d to perform location, a more robust version of etail To that effect we let for any Z ⊆ [n]d (we will later use Z = Ar ⋆ (1, w) for various w ∈ W) i (H, z, x) upper bounds the second term in (6). As our algorithm uses (H, z) will be useful. etail i (H,Z, x) := quant1/5 . (10) etail i (H, z, x) :=(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i G−1 oi(i) · Xj∈[n]d\S . Goi(j)xjωzT Σ(j−i)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Goi(j)xjωzT Σ(j−i)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) G−1 oi(i) · Xj∈[n]d\S z∈Z(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) where for a list of reals u1, . . . , us and a number f ∈ (0, 1) we let quantf (u1, . . . , us) denote the ⌈f · s⌉-th largest element of u1, . . . , us. Tail noise. To capture the second term in (6) (corresponding to tail noise), we define, for any i ∈ S, z ∈ [n]d, w ∈ W, permutation π = (Σ, q) and hashing H = (π, B, F ) (9) The definition of etail Note that the algorithm first selects sets Ar ⊆ [n]d×[n]d, and then access the signal at locations Ar⋆(1, w), w ∈ W. (H,A⋆(1, w), x) for a fixed w ∈ W allows us to capture the amount of noise that our measurements that use H suffer from for locating a specific set of bits of Σi. Since the algorithm requires all w ∈ W to be not too noisy in order to succeed (see precondition 2 of Lemma 5.1), it is convenient to introduce notation that captures this. We define i etail i (H,A, x) := 40µH,i(x) + Xw∈W(cid:12)(cid:12)(cid:12)etail i (H,A ⋆ (1, w), x) − 40µH,i(x)(cid:12)(cid:12)(cid:12)+ (11) where for any η ∈ R one has η+ = η if η > 0 and η+ = 0 otherwise. The following definition is useful for bounding the norm of elements i ∈ S that are not discovered by several calls to LOCATESIGNAL on a sequence of hashings {Hr}. For a sequence of measurement patterns {Hr,Ar} we let (12) r etail i (Hr,Ar, x). etail i Finally, for any S ⊆ [n]d we let ehead S ({Hr,Ar}, x) := quant1/5 (·) :=Xi∈S (·) and etail ehead i S (·) :=Xi∈S etail i (·), Equipped with the definitions above, we now prove the following lemma, which yields sufficient conditions where · stands for any set of parameters as above. for recovery of elements i ∈ S in LOCATESIGNAL in terms of ehead and etail. Lemma 5.1. Let H = (π, B, R) be a hashing, and let A ⊆ [n]d × [n]d. Then for every S ⊆ [n]d and for every x, χ ∈ C[n]d and x′ = x − χ, the following conditions hold. Let L denote the output of LOCATESIGNAL(χ, H,{m(bx, H, a ⋆ (1, w))}a∈A,w∈W ). Then for any i ∈ S such that x′i > N−Ω(c), if there exists r ∈ [1 : rmax] such that 1. ehead i (H, x′) < x′i/20; 16 i (H,A ⋆ (1, w), x′) < x′i/20 for all w ∈ W; 2. etail 3. for every s ∈ [1 : d] the set A ⋆ (0, es) is balanced in coordinate s (as per Definition 2.13), then i ∈ L. The time taken by the invocation of LOCATESIGNAL is O(B · logd+1 N ). Proof. We show that each coordinate s = 1, . . . , d of Σi is successfully recovered in LOCATESIGNAL. Let q = Σi for convenience. Fix s ∈ [1 : d]. We show by induction on g = 0, . . . , log∆ n − 1 that after the g-th iteration of lines 6-10 of Algorithm 1 we have that fs coincides with qs on the bottom g · log2 ∆ bits, i.e. fs − qs = 0 mod ∆g (note that we trivially have fs < ∆g after iteration g). The base of the induction is trivial and is provided by g = 0. We now show the inductive step. Assume by the inductive hypothesis that fs − qs = 0 mod ∆g−1, so that qs = fs + ∆g−1(r0 + ∆r1 + ∆2r2 + . . .) for some sequence r0, r1, . . ., 0 ≤ rj < ∆. Thus, (r0, r1, . . .) is the expansion of (qs − fs)/∆g−1 base ∆, and r0 is the least significant digit. We now show that r0 is the unique value of r that satisfies the conditions of lines 8-10 of Algorithm 1. First, we have by (6) together with (7) and (9) one has for each a ∈ A and w ∈ W (H, x, χ) + etail i (H, a ⋆ (1, w), x) + N−Ω(c). Since 0 ∈ W, we also have for all a ∈ A (cid:12)(cid:12)(cid:12)mh(i)(bx′, H, a ⋆ (1, w)) − Goi(i)x′iω((a⋆(1,w))T q(cid:12)(cid:12)(cid:12) ≤ ehead (cid:12)(cid:12)(cid:12)mh(i)(bx′, H, a ⋆ (1, 0)) − Goi(i)x′iω(a⋆(1,0))T q(cid:12)(cid:12)(cid:12) ≤ ehead i i (H, x, χ) + etail (H, a ⋆ (1, 0), x) + N−Ω(c), i where the N−Ω(c) terms correspond to polynomially small error from approximate computation of the Fourier transform via Lemma 10.2. Let j := h(i). We will show that i is recovered from bucket j. The bounds above imply that mj(bx′, H, a ⋆ (1, w)) mj(bx′, H, a ⋆ (1, 0)) i = x′iω(a⋆(1,w))T q + E′ x′iω(a⋆(1,0))T q + E′′ (13) for some E′, E′′ satisfying E′ ≤ ehead etail i both (H, x, χ)+ (H, a ⋆ (1, 0)) + N−Ω(c). For all but 1/5 fraction of a ∈ A we have by definition of etail (see (10)) that (14) (H, a⋆(1, w), x)+N−Ω(c) and E′′ ≤ ehead (H, x, χ)+etail i i (H, a ⋆ (1, w), x) ≤ etail i (H,A ⋆ (1, w), x) ≤ x′i/20 etail i and In particular, we can rewrite (13) as etail i (H, a ⋆ (1, 0) ≤ etail i (H,A ⋆ (1, 0), x) ≤ x′i/20. mj(bx′, H, a ⋆ (1, w)) mj(bx′, H, a ⋆ (1, 0)) = = x′iω(a⋆(1,w))T q + E′ x′iω(a⋆(1,0))T q + E′′ ω(a⋆(1,w))T q ω(a⋆(1,0))T q · ξ where ξ = = ω(a⋆(1,w))T q−(a⋆(1,0))T q · ξ = ω(a⋆(0,w))T q · ξ. 1 + ω−(a⋆(1,w))T qE′/x′i 1 + ω−(a⋆(1,0))T qE′′/x′i (15) (16) Let A∗ ⊆ A denote the set of values of a ∈ A that satisfy the bounds (14) and (15) above. We thus have for a ∈ A∗, combining (16) with assumptions 1-2 of the lemma, that E′/x′i ≤ (2/20) + 1/N−Ω(c) ≤ 1/8 and 17 E′′/x′i ≤ (2/20) + 1/N−Ω(c) ≤ 1/8 (17) for sufficiently large N, where O(c) is the word precision of our semi-equispaced Fourier transform computa- tion. Note that we used the assumption that x′i ≥ N−Ω(c). Writing a = (α, β) ∈ [n]d × [n]d, we have by (16) that mj ( bx′,H,a⋆(1,w)) wT q = n∆−gqs when w = n∆−ges (as in line 8 of Algorithm 1), we get mj( bx′,H,a⋆(1,0)) = ω((α,β)⋆(0,w))T q · ξ, and since mj(bx′, H, a ⋆ (1, w)) mj(bx′, H, a ⋆ (1, 0)) = ω(a⋆(0,w))T q · ξ = ωn∆−gβsqs · ξ = ωn∆−gβsqs + ωn∆−gβsqs(ξ − 1). We analyze the first term now, and will show later that the second term is small. Since qs = fs + ∆g−1(r0 + ∆r1 + ∆2r2 + . . .) by the inductive hypothesis, we have, substituting the first term above into the expression in line 10 of Algorithm 1, ω−r·βs ∆ ∆ · ω−n∆−gfs·βs · ωn∆−gβsqs = ω−r·βs = ω−r·βs = ω−r·βs = ω−r·βs ∆ = ω(−r+r0)·βs · ωn∆−g(qs−fs)·βs · ωn∆−g(∆g−1(r0+∆r1+∆2r2+...))·βs · ω(n/∆)·(r0+∆r1+∆2r2+...)·βs · ωr0·βs . ∆ ∆ ∆ ∆ We used the fact that ωn/∆ = e2πi(n/∆)/n = e2πi/∆ = ω∆ and (ω∆)∆ = 1. Thus, we have ω−r·βs ∆ ω−(n2−gfs)·βs mj(bx′, H, a ⋆ (1, w)) mj(bx′, H, a ⋆ (1, 0)) = ω(−r+r0)·βs ∆ + ω(−r+r0)·βs ∆ (ξ − 1). (18) We now consider two cases. First suppose that r = r0. Then ω(−r+r0)·βs = 1, and it remains to note that by (17) we have ξ − 1 ≤ 1+1/8 1−1/8 − 1 ≤ 2/7 < 1/3. Thus every a ∈ A∗ passes the test in line 9 of Algorithm 1. Since A∗ ≥ (4/5)A > (3/5)A by the argument above, we have that r0 passes the test in line 9. It remains to show that r0 is the unique element in 0, . . . , ∆ − 1 that passes this test. Now suppose that r 6= r0. Then by the assumption that A ⋆ (0, es) is balanced (assumption 3 of the lemma) at least 49/100 fraction of ω(−r+r0)·βs have negative real part. This means that for at least 49/100 of a ∈ A we ∆ have using triangle inequality ∆ ∆ (cid:12)(cid:12)(cid:12)hω(−r+r0)·βs + ω(−r+r0)·βs ∆ (ξ − 1)i − 1(cid:12)(cid:12)(cid:12) ≥(cid:12)(cid:12)(cid:12)ω(−r+r0)·βs ≥ i − 1 − 1/3 √2 − 1/3 > 1/3, ≥ − 1(cid:12)(cid:12)(cid:12) −(cid:12)(cid:12)(cid:12)ω(−r+r0)·βs ∆ ∆ (ξ − 1)(cid:12)(cid:12)(cid:12) and hence the condition in line 9 of Algorithm 1 is not satisfied for any r 6= r0. This shows that location is successful and completes the proof of correctness. Runtime bounds follow by noting that LOCATESIGNAL recovers d coordinates with log n bits per coordi- nate. Coordinates are recovered in batches of log ∆ bits, and the time taken is bounded by B · d(log∆ n)∆ ≤ B(log N )3/2. Updating the measurements using semi-equispaced FFT takes B logd+1 N time. We also get an immediate corollary of Lemma 5.1. The corollary is crucial to our proof of Theorem 3.1 (the main result about efficiency of LOCATESIGNAL) in the next section. Corollary 5.2. For any integer rmax ≥ 1, for any sequence of rmax hashings Hr = (πr, B, R), r ∈ [1 : rmax] and evaluation points Ar ⊆ [n]d×[n]d, for every S ⊆ [n]d and for every x, χ ∈ C[n]d , x′ := x−χ, the following 18 conditions hold. If for each r ∈ [1 : rmax] Lr ⊆ [n]d denotes the output of LOCATESIGNAL(bx, χ, Hr,{m(bx, Hr, a⋆ (1, w))}a∈Ar ,w∈W), L =Srmax x′S\L1 ≤ 20ehead r=1 Lr, and the sets Ar ⋆ (0, w) are balanced for all w ∈ W and r ∈ [1 : rmax], (*) S ({Hr,Ar}, x)1 + S · N−Ω(c). ({Hr}, x, χ)1 + 20etail then S Furthermore, every element i ∈ S such that x′i > 20(ehead i ({Hr}, x, χ) + etail i ({Hr,Ar}, x)) + N−Ω(c) (**) belongs to L. Proof. Suppose that i ∈ S fails to be located in any of the R calls, and x′i ≥ N−Ω(c). By Lemma 5.1 and the assumption that Ar ⋆ (0, w) is balanced for all w ∈ W and r ∈ [1 : rmax] this means that for at least one half of values r ∈ [1 : rmax] either (A) ehead (Hr,Ar ⋆ (1, w), x) > xi/20 for at least one w ∈ W. We consider these two cases separately. Case (A). particular ehead (Hs, x, χ) ≥ xi/20 for at least one half of r ∈ [1 : rmax], so in (Hr, x, χ) ≥ xi/20 or (B) etail In this case we have ehead ({Hr}, x, χ) ≥ quant1/5 (Hr, x, χ) ≥ x′i/20. r ehead i i i i i Case (B). Suppose that etail r ∈ [1 : rmax] (denote this set by Q ⊆ [1 : rmax]). We then have (Hr,Ar ⋆ (1, w), x) > x′i/20 for some w = w(r) ∈ W for at least one half of i etail i ({Hr,Ar}, x) = quant1/5 = quant1/5 r∈[1:rmax]etail i (Hr,Ar, x) r∈[1:rmax]"40µHr,i(x) + Xw∈W(cid:12)(cid:12)(cid:12)etail r∈Q(cid:20)40µHr,i(x) +(cid:12)(cid:12)(cid:12)etail (Hr,Ar ⋆ (1, w(r)), x) i i ≥ min etail ≥ min i r∈Q ≥ x′i/20 (Hr,Ar ⋆ (1, w), x) − 40µHr,i(x)(cid:12)(cid:12)(cid:12)+# (Hr,Ar ⋆ (1, w(r)), x) − 40µHr,i(x)(cid:12)(cid:12)(cid:12)+(cid:21) as required. This completes the proof of (*) as well as (**). 6 Analysis of LOCATESIGNAL: bounding ℓ1 norm of undiscovered elements The main result of this section is Theorem 3.1, which is our main tool for showing efficiency of LOCATESIG- NAL. Theorem 3.1 applies to the following setting. Fix a set S ⊆ [n]d and a set of hashings H1, . . . , Hrmax, and let S∗ ⊆ S denote the set of elements of S that are not isolated with respect to most of these hashings H1, . . . , Hrmax. Theorem 3.1 shows that for any signal x and partially recovered signal χ, if L denotes the output list of an invocation of LOCATESIGNAL on the pair (x, χ) with hashings H1, . . . , Hrmax, then the ℓ1 norm of elements of the residual (x − χ)S that are not discovered by LOCATESIGNAL can be bounded by a function of the amount of ℓ1 mass of the residual that fell outside of the 'good' set S \ S∗, plus the 'noise level' µ ≥ x[n]d\S∞ times k. If we think of applying Theorem 3.1 iteratively, we intuitively get that the fixed set of measurements with hashings {Hr} allows us to always reduce the ℓ1 norm of the residual x′ = x − χ on the 'good' set S \ S∗ to about the amount of mass that is located outside of this good set. Theorem 3.1 There exist absolute constants C1, C2, C3 > 0 such that for any x, χ ∈ CN and residual signal x′ = x − χ the following conditions hold. Let S ⊆ [n]d,S ≤ 2k, be such that x[n]d\S∞ ≤ µ. Suppose that 19 x∞/µ ≤ N O(1). Let B ≥ (2π)4d·F · k/αd. Let S∗ ⊆ S denote the set of elements that are not isolated with respect to at least a √α fraction of hashings {Hr}rmax r=1 . Suppose that for every s ∈ [1 : d] the sets Ar ⋆ (0, es) are balanced (as per Definition 2.13), r = 1, . . . , rmax, and the exponent F of the filter G is even and satisfies F ≥ 2d. Let L = rmax[r=1 LOCATESIGNAL(χ, Hr,{m(bx, Hr, a ⋆ (1, w)}a∈Ar ,w∈Wr ). Then if rmax, cmax ≥ (C1/√α) log log N , one has x′S\S ∗\L1 ≤ (C2α)d/2x′S1 + C d2 3 (χ[n]d\S1 + x′S ∗1) + 4µS. As we will show later, Theorem 3.1 can be used to show that (assuming perfect estimation) invoking LO- CATESIGNAL repeatedly allows one to reduce to ℓ1 norm of the head elements down to essentially x′S ∗1 + χ[n]d\S1, i.e. the ℓ1 norm of the elements that are not well isolated and the set of new elements created by the process due to false positives in location. In what follows we derive bounds on ehead1 (in section 6.1) and etail1 (in section 6.2) that lead to a proof of Theorem 3.1. 6.1 Bounding noise from heavy hitters We first derive bounds on noise from heavy hitters that a single hashing H results in, i.e. ehead(H, x), (see Lemma 6.1), and then use these bounds to bound ehead({H}, x) (see Lemma 6.3). These bounds, together with upper bounds on contribution of tail noise from the next section, then lead to a proof of Theorem 3.1. Lemma 6.1. Let x, χ ∈ CN , x′ = x − χ. Let S ⊆ [n]d,S ≤ 2k, be such that x[n]d\S∞ ≤ µ. Suppose that x∞/µ ≤ N O(1). Let B ≥ (2π)4d·F · k/αd. Let π = (Σ, q) be a permutation, let H = (π, B, F ), F ≥ 2d be a hashing into B buckets and filter G with sharpness F . Let S∗H ⊆ S denote the set of elements i ∈ S that are not isolated under H. Then one has, for ehead defined with respect to S, H1 + (2π)d·F · 2O(d)(x′S ∗1 + χ[n]d\S1). (H, x, χ)∞ ≤ 2O(d)αd/2x′S∞. S ehead S\S ∗ H (H, x, χ)1 ≤ 2O(d)αd/2x′S\S ∗ (H, x′) = G−1 Furthermore, if χ[n]d\S = 0 and S∗H = ∅, then one has ehead Proof. By (7) for i ∈ S \ S∗H oi(i) · Xj∈S\S ∗ ehead i oi(i) ·Xj∈S ∗ A1(i), A2 :=Pi∈S\S ∗ + G−1 = G−1 Let A1 :=Pi∈S\S ∗ Goi(j)x′j Goi(j)x′j + Xj∈[n]d\S oi(i) · (A1(i) + A2(i)). We bound A1 and A2 separately. A2(i). H H\{i} H H 20 (isolated head elements) Goi(j)χj (non-isolated head elements and false positives) (19) Bounding A1. We start with a convenient upper bound on A1: A1 = Xi∈S\S ∗ H H Xj∈S\S ∗ =Xt≥0 Xi∈S\S ∗ ≤Xt≥0 Xi∈S\S ∗ = Xj∈S\S ∗ H H H\{i} Goi(j)x′j Xj∈S\S ∗ H\{i} s.t. π(j)−π(i)∞∈(n/b)·[2t−1,2t+1−1) Goi(j) · π(j)−π(i)∞≥(n/b)·(2t−1) max (recall that oi(j) = π(j) − (n/b)h(i)) (consider all scales t ≥ 0) Goi(j)x′j, Xj∈S\S ∗ H\{i} s.t. π(j)−π(i)∞≤(n/b)·(2t+1−1) x′j x′j ·Xt≥0 max π(j)−π(i)∞≥ (n/b)·(2t−1) Goi(j) ·(cid:12)(cid:12)(cid:8)i ∈ S \ S∗H \ {j} s.t. π(j) − π(i)∞ ≤ (n/b) · (2t+1 − 1)(cid:9)(cid:12)(cid:12) . (20) Note that in the first line we summed, over all i ∈ S \ S∗H (i.e. all isolated i), the contributions of all other i ∈ S to the noise in their buckets. We need to bound the first line in terms of x′S\S ∗ H1. For that, we first classified all j ∈ S \ S∗H according to the ℓ∞ distance from i to j (in the second line), then upper bounded the value of the filter Goi(j) based on the distance π(i) − π(j)∞, and finally changed order of summation to ensure that 3. In order to upper bound the outer summation is a weighted sum of absolute values of x′j over all j ∈ S \ S∗H A1 it now suffices to upper bound all factors multiplying x′j in the last line of the equation above. As we now show, a strong bound follows from isolation properties of i. We start by upper bounding G using Lemma 2.3, (2). We first note that by triangle inequality π(j)− (n/b)h(i)∞ ≥ π(j)− π(i)∞ −π(i)− (n/b)h(i)∞ ≥ (n/b)(2t− 1)− (n/b) = (n/b)(2t−1− 2). The rhs is positive for all t ≥ 3 and for such t satisfies 2t−1 − 2 ≤ 2t−2. We hence get for all t ≥ 3 Goi(j) ≤(cid:18) 1 + π(j) − (n/b)h(i)∞(cid:19)F 2 ≤(cid:18) 2 1 + 2t−2(cid:19)F ≤ 2−(t−3)F . (21) max π(j)−π(i)∞≥(n/b)·(2t−1−1) We also have the bound G∞ ≤ 1 from Lemma 2.3, (3). It remains to bound the last term on the rhs of the last line in (20). We need the fact that for a pair i, j such that π(j) − π(i)∞ ≤ 2t+1 − 1 we have by triangle inequality π(j) − (n/b)h(i)∞ ≤ π(j) − π(i)∞ + π(i) − (n/b)h(i)∞ ≤ (n/b)(2t+1 − 1) + (n/b) = (n/b)2t+1. Equipped with this bound, we now conclude that (cid:12)(cid:12)(cid:8)i ∈ S \ S∗H \ {j} s.t. π(j) − π(i)∞ ≤ (n/b) · (2t+1 − 1)(cid:9)(cid:12)(cid:12) = π(S \ {i}) ∩ B∞(n/b)h(i)((n/b) · 2t+1) ≤ (2π)−d·F · αd/22(t+2)d+1 · 2t, (22) where we used the assumption that i ∈ S\S∗H are isolated (see Definition 2.10). We thus get for any j ∈ S\S∗H Goi(j) ·(cid:12)(cid:12)(cid:8)i ∈ S \ S∗H \ {j} s.t. π(j) − π(i)∞ ≤ (n/b) · (2t+1 − 1)(cid:9)(cid:12)(cid:12) max ηj :=Xt≥0 ≤Xt≥0 ≤ (2π)−d·F · αd/222d+1Xt≥0 π(j)−π(i)∞≥ (n/b)·(2t−1) ((2π)−d·F · αd/22(t+2)d+1 · 2t) min{1, 2−(t−3)F } 2t(d+1) · min{1, 2−(t−3)F } 3We note here that we started by summing over i first and then over j, but switched the order of summation to the opposite in the last line. This is because the quantity Goi(j), which determines contribution of j ∈ S to the estimation error of i ∈ S is not symmetric in i and j. Indeed, even though G itself is symmetric around the origin, we have oi(j) = π(j) − (n/b)h(i) 6= oj (i). 21 We now note that Xt≥0 2t(d+1) · min{1, 2−(t−3)F } = 1 + 22(d+1) + 23(d+1)Xt≥3 = 1 + 22(d+1) + 23(d+1)Xt≥3 2(t−3)(d+1) · min{1, 2−(t−3)F } 2(t−3)(d+1−F ) ≤ 1 + 22(d+1) + 23(d+1)+1 ≤ 24(d+1)+1, since F ≥ 2d by assumption of the lemma, and hence for all j ∈ S \ S∗H one has ηj ≤ (2π)−d·F · 2O(d)αd/2. Combining the estimates above, we now get A1 ≤ Xj∈S\S ∗ H x′j · ηj ≤ x′S1(2π)−d·F · 2O(d)αd/2, as required. The ℓ∞ bound for the case when χ[n]d\S = 0 follows in a similar manner and is hence omitted. We now turn to bounding A2. The bound that we get here is weaker since χ[n]d\S is an adversarially placed signal and we do not have isolation properties with respect to it, resulting in a weaker bound on (the equivalent of) ηj for j ∈ S∗H than we had for j ∈ S \ S∗H. We let y := x′S ∗ − χ[n]d\S to simplify notation. We have, as in (20), x′j · κj, H A2 ≤ Xj∈S\S ∗ κj =Xt≥0 where max π(j)−π(i)∞≥ (n/b)·(2t−1) Goi(j) ·(cid:12)(cid:12)(cid:8)i ∈ S \ S∗H \ {j} s.t. π(j) − π(i)∞ ≤ (n/b) · (2t+1 − 1)(cid:9)(cid:12)(cid:12) . The first term can be upper bounded as before. For the second term, we note that every pair of points i1, i2 ∈ S \ S∗H by triangle inequality satisfy (n/b)π(i1) − π(i2)∞ ≤ (n/b)π(i1) − π(j)∞ + π(j) − π(i2)∞ ≤ (n/b) · (2t+2 − 2) ≤ (n/b) · 2t+2 Since both i1 and i2 are isolated under π, this means that where we used the bound from Definition 2.10 for i, but counted the point i itself (this is what makes the bound on κj weaker than the bound on ηj). A similar calculation to the one above for A1 now gives (cid:12)(cid:12)(cid:8)i ∈ S \ S∗H \ {j} s.t. π(j) − π(i)∞ ≤ (n/b) · (2t+1 − 1)(cid:9)(cid:12)(cid:12) ≤ (2π)−d·F · αd/22(t+3)d · 2t+2 + 1, κj :=Xt≥0 Goi(j) ·(cid:12)(cid:12)(cid:8)i ∈ S \ S∗H \ {j} s.t. π(j) − π(i)∞ ≤ (n/b) · (2t+1 − 1)(cid:9)(cid:12)(cid:12) ≤Xt≥0 ≤ 2O(d)((2π)−d·F · αd/2 + 1) = 2O(d). A2 ≤ Xj∈[n]d π(j)−π(i)∞≥ (n/b)·(2t−1) ((2π)−d·F · αd/22(t+3)d · 2t+2 + 1) min{1, 2−(t−3)F } yjκj ≤ 2O(d)y1. We thus have max Plugging our bounds on A1 and A2 into (19), we get ehead i as required. (H, x, χ) ≤ G−1 oi(i) · (A1 + A2) ≤ G−1 oi(i)(2O(d)(2π)−d·F · αd/2x′S1 + 2O(d)y1) ≤ 2O(d)αd/2x′S1 + (2π)d·F · 2O(d)y1 22 Remark 6.2. The second bound of this lemma will be useful later in section 8.1 for analyzing REDUCE- INFNORM. We now bound the final error induced by head elements, i.e. ehead({Hr}, x, χ): Lemma 6.3. Let x, χ ∈ [n]d, x′ = x − χ. Let S ⊆ [n]d,S ≤ 2k, be such that x[n]d\S∞ ≤ µ. Suppose that x∞/µ ≤ N O(1). Let B ≥ (2π)4d·F · k/αd. Let {πr}rmax r=1 be a set of permutations, let Hr = (πr, B, F ), F ≥ 2d be a hashing into B buckets and filter G with sharpness F . Let S∗ denote the set of elements i ∈ S that are not isolated under at least √α fraction of Hr. Then, one has for ehead defined with respect to S, ehead S\S ∗({Hr}, x, χ)1 ≤ 2O(d)αd/2x′S1 + (2π)d·F · 2O(d)χ[n]d\S1. Furthermore, if χ[n]d\S = 0, then ehead Proof. Recall that by (8) one has for each i ∈ [n]d ehead means that for each i ∈ S \ S∗ there exist at least (1/5 − √α)rmax values of r such that ehead ehead i S\S ∗({Hr}, x, χ)∞ ≤ 2d/2αd/2x′S∞. ({Hr}, x, χ) = quant1/5 r∈[1:rmax]ehead i i ({Hr}, x, χ), and hence (Hr, x, χ). This (Hr, x, χ) > i ehead S\S ∗({Hr}, x, χ)1 ≤ 1 (1/5 − √α)rmax rmaxXr=1 ehead S\S ∗ r (Hr, x, χ)1. By Lemma 6.1 one has ehead S\S ∗ Hr (Hr, x, χ)1 ≤ 2O(d)αd/2x′S1 + (2π)d·F · 2O(d)χ[n]d\S1 for all r, implying that ehead S\S ∗ ({Hr}, x, χ)1 ≤ 1 (2O(d)αd/2x′S1 + (2π)d·F · 2O(d)χ[n]d\S1) (1/5 − √α) ≤ 2O(d)αd/2x′S1 + (2π)d·F · 2O(d)χ[n]d\S1 as required. The proof of the second bound follows analogously using the ℓ∞ bound from Lemma 6.1. Remark 6.4. The second bound of this lemma will be useful later in section 8.1 for analyzing REDUCE- INFNORM. 6.2 Bounding effect of tail noise Lemma 6.5. For any constant C′ > 0 there exists an absolute constant C > 0 such that for any x ∈ C[n]d, any integer k ≥ 1 and S ⊆ [n]d such that x[n]d\S∞ ≤ C′x[n]d\[k]2/√k, for any integer B ≥ 1 a power of 2d the following conditions hold. If (H,A) are random measurements as in Algorithm 2, H = (π, B, F ) satisfies F ≥ 2d and x[n]d\[k]2 ≥ N−Ω(c), where O(c) is the word precision of our semi-equispaced Fourier transform computation, then for any i ∈ [n]d one has, for etail defined with respect to S, EH,Ahetail i (H,A, x)i ≤ (2π)d·F · C d(40 + W2−Ω(A))x[n]d\[k]2/√B. 23 Proof. Recall that for any H = (π, B, G), a, w one has (etail(H, a ⋆ (1, w), x[n]d\[k]))2 = ui2, where u = HASHTOBINS( \x[n]d\S, 0, (H, a ⋆ (1, w))). Since the elements of A are selected uniformly at random, we have for any H and w by Lemma 2.9, (3), since a ⋆ (1, w) is uniformly random in [n]d, that (H, a ⋆ (1, w), x))2] = Ea[G−1 Ea[(etail i oi(i)ω−(a⋆(1,w))T Σiuh(i) − xi2] ≤ µ2 H,i(x) + N−Ω(c), (23) where c > 0 is the large constant that governs the precision of our Fourier transform computations. By Lemma 2.9, (2) applied to the pair ( \x[n]d\S , 0) there exists a constant C > 0 such that EH[µ2 H,i] ≤ (2π)2d·F · C dx[n]d\S2 2/B We would like to upper bound the rhs in terms of x[n]d\[k]2 2 (the tail energy), but this requires an argument since S is not exactly the set of top k elements of x. However, since S contains the large coefficients of x, a bound is easy to obtain. Indeed, denoting the set of top k coefficients of x by [k] ⊆ [n]d as usual, we get ∞ ≤ (C′ + 1)x[n]d\[k]2. 2 ≤ x[n]d\(S∪[k])2 2 + k · x[k]\S2 2 + x[k]\S2 2 ≤ x[n]d\[k]2 x[n]d\S2 Thus, we have EH[µ2 H,i(x) + N−Ω(c)] ≤ (2π)2d·F · (C′ + 2)C dx[n]d\[k]2 2/B, where we used the assumption that x[n]d\k2 ≥ N−Ω(c). We now get by Jensen's inequality EH[µH,i(x)] ≤ (2π)d·F · (C′′)dx[n]d\k2/√B (24) for a constant C′′ > 0. Note that Ea[(etail By (23) for each i ∈ [n]d, hashing H, evaluation point a ∈ [n]d × [n]d and direction w we have (H, a ⋆ (1, w), x))2] = (µH,i(x))2. Applying Jensen's inequality, we hence get for any H and w ∈ W (25) i Ea[etail i (H, a ⋆ (1, w), x)] ≤ µH,i(x). Applying Lemma 9.5 with Y = etail involves a 1/5-quantile over A) and using the previous bound, we get, for any fixed H and w ∈ W (H, a ⋆ (1, w), x) and γ = 1/5 (recall that the definition of etail i i (H, z, x) (26) and hence by a union bound over all w ∈ W we have Putting this together with (24), we get i i (H,A ⋆ (1, w), x) − 40 · µH,i(x)(cid:12)(cid:12)(cid:12)+(cid:21) ≤ µH,i(x) · 2−Ω(A), (H,A ⋆ (1, w), x) − 40 · µH,i(x)(cid:12)(cid:12)(cid:12)+# ≤ µH,i(x) · W2−Ω(A). (H,A, x)i (H,A ⋆ (1, w), x) − 40 · µH,i(x)(cid:12)(cid:12)(cid:12)+## EA(cid:20)(cid:12)(cid:12)(cid:12)etail EA"Xw∈W(cid:12)(cid:12)(cid:12)etail EH,Ahetail = EH"EA"40µH,i(x) + Xw∈W(cid:12)(cid:12)(cid:12)etail ≤ EHhµH,i(x)(40 + W2−Ω(A))i ≤ (2π)d·F (C′′)d(40 + W2−Ω(A))x[n]d\k2/√B i i as required. 24 Lemma 6.6. For any constant C′ > 0 there exists an absolute constant C > 0 such that for any x ∈ C[n]d, any integer k ≥ 1 and S ⊆ [n]d such that x[n]d\S∞ ≤ C′x[n]d\[k]/√k, if B ≥ 1, then the following conditions hold , for etail defined with respect to S. If hashings Hr = (πr, B, F ), F ≥ 2d and sets Ar,Ar ≥ cmax for r = 1, . . . , rmax are chosen at random, ({Hr,Ar}, x)i ≤ (2π)d·F C d(40 + W2−Ω(cmax))x[n]d\[k]2/√B. then (1) for every i ∈ [n]d one has {(Hr,Ar)}hetail (2) for every i ∈ [n]d one has {(Hr,Ar)}hetail {(Hr ,Ar)}(cid:20)(cid:12)(cid:12)(cid:12)etail = 2−Ω(rmax) · (2π)d·F C d(40 + W2−Ω(cmax))x[n]d\[k]2/√B. ({Hr,Ar}, x) > (2π)d·F C d(40 + W2−Ω(cmax))x[n]d\[k]2/√Bi = 2−Ω(rmax) ({Hr,Ar}, x) − (2π)d·F C d(40 + W2−Ω(cmax))x[n]d\[k]2/√B(cid:12)(cid:12)(cid:12)+(cid:21) and i i Pr i E E Proof. Follows by applying Lemma 9.5 with Y = etail i (Hr,Ar, x). 6.3 Putting it together The bounds from the previous two sections yield a proof of Theorem 3.1, which we restate here for convenience of the reader: following conditions hold. Theorem 3.1 For any constant C′ > 0 there exist absolute constants C1, C2, C3 > 0 such that for any x ∈ C[n]d, any integer k ≥ 1 and any S ⊆ [n]d such that x[n]d\S∞ ≤ C′µ, where µ = x[n]d\[k]2/√k, the Let πr = (Σr, qr), r = 1, . . . , rmax denote permutations, and let Hr = (πr, B, F ), F ≥ 2d, where B ≥ (2π)4d·F k/αd for α ∈ (0, 1) smaller than a constant. Let S∗ ⊆ S denote the set of elements that are not isolated with respect to at least a √α fraction of hashings {Hr}. Then if rmax, cmax ≥ (C1/√α) log log N , then with probability at least 1 − 1/ log2 N over the randomness of the measurements for all χ ∈ C[n]d such that x′ := x − χ satisifies x′∞/µ ≤ N O(1) one has satisfies L := LOCATESIGNAL(cid:16)χ, k,{m(bx, Hr, a ⋆ (1, w))}rmax rmax[r=1 x′S\S ∗\L1 ≤ (C2α)d/2x′S1 + C d2 r=1,a∈Ar ,w∈W(cid:17) 3 (χ[n]d\S1 + x′S ∗1) + 4µS. Proof. First note that with probability at least 1 − 1/(10 log2 N ) for every s ∈ [1 : d] the sets Ar ⋆ (0, es) are balanced (as per Definition 2.13) for all r = 1, . . . , rmax and all w ∈ W by Claim 2.14. By Corollary 5.2 applied with S′ = S \ S∗ one has (x − χ)(S\S ∗)\L1 ≤ 20 · (ehead We also have S\S ∗ ({Hr}, x′)1 + etail({Hr,Ar}, x)1) + x′∞S · N−Ω(c). ehead S\S ∗({Hr}, x′)1 ≤ 2O(d)αd/2x′S1 + (2π)d·F · 2O(d)χ[n]d\S1 25 by Lemma 6.3 and with probability at least 1 − 1/(10 log2 N ) S\S ∗ ({Hr,Ar}, x)1 ≤ (2π)d·F C d(40 + W2−Ω(cmax))x[n]d\[k]2S/√B etail by Lemma 6.6. The rhs of the previous equation is bounded by Sµ by the choice of B as long as α is smaller than a absolute constant, as required. Putting these bounds together and using the fact that W ≤ log N (so that W · (2−Ω(rmax) + 2−Ω(cmax)) ≤ 1), and taking a union bound over the failure events, we get the result. 7 Analysis of REDUCEL1NORM and SPARSEFFT In this section we first give a correctness proof and runtime analysis for REDUCEL1NORM (section 7.1), then analyze the SNR reduction loop in SPARSEFFT(section 7.2) and finally prove correctness of SPARSEFFT and provide runtime bounds in section 7.3. 7.1 Analysis of REDUCEL1NORM 2/k. Suppose that x∞/µ = N O(1). The main result of this section is Lemma 3.2 (restated below). Intuitively, the lemma shows that REDU- CEL1NORM reduces the ℓ1 norm of the head elements of the input signal x− χ by a polylogarthmic factor, and does not introduce too many new spurious elements (false positives) in the process. The introduced spurious elements, if any, do not contribute much ℓ1 mass to the head of the signal. Formally, we show Lemma 3.2(Restated) For any x ∈ CN , any integer k ≥ 1, B ≥ (2π)4d·F · k/αd for α ∈ (0, 1] smaller than an absolute constant and F ≥ 2d, F = Θ(d) the following conditions hold for the set S := {i ∈ [n]d : xi > µ}, where µ2 ≥ x[n]d\[k]2 For any sequence of hashings Hr = (πr, B, F ), r = 1, . . . , rmax, if S∗ ⊆ S denotes the set of elements of S that are not isolated with respect to at least a √α fraction of the hashings Hr, r = 1, . . . , rmax, then for any χ ∈ C[n]d, x′ := x − χ, if ν ≥ (log4 N )µ is a parameter such that A (x − χ)S1 ≤ (ν + 20µ)k; B χ[n]d\S0 ≤ 1 C (x − χ)S ∗1 + χ[n]d\S1 ≤ ν the following conditions hold. If parameters rmax, cmax are chosen to be at least (C1/√α) log log N , where C1 is the constant from log19 N log4 N k; k, Theorem 3.1 and measurements are taken as in Algorithm 2, then the output χ′ of the call satisfies REDUCEL1NORM(χ, k,{m(bx, Hr, a ⋆ (1, w))}rmax r=1,a∈Ar ,w∈W , 4µ(log4 n)T−t, µ) log4 N νk + 20µk 1. (x′ − χ′)S1 ≤ 1 2. (χ + χ′)[n]d\S0 ≤ χ[n]d\S0 + 1 3. (x′ − χ′)S ∗1 + (χ + χ′)[n]d\S1 ≤ x′S ∗1 + χ[n]d\S1 + 1 (ℓ1 norm of head elements is reduced by ≈ log4 N factor) k (few spurious coefficients are introduced) log20 N log20 N νk (ℓ1 norm of spurious coefficients does not grow fast) with probability at least 1 − 1/ log2 N over the randomness used to take measurements m and by calls to ES- TIMATEVALUES. The number of samples used is bounded by 2O(d2)k(log log N )2, and the runtime is bounded by 2O(d2)k logd+2 N . Before giving the proof of Lemma 3.2, we prove two simple supporting lemmas. 26 Lemma 7.1 (Few spurious elements are introduced in REDUCEL1NORM). For any x ∈ CN , any integer k ≥ 1, B ≥ (2π)4d·F · k/αd for α ∈ (0, 1] smaller than an absolute constant and F ≥ 2d, F = Θ(d) the following conditions hold for the set S := {i ∈ [n]d : xi > µ}, where µ2 ≥ x[n]d\[k]2 For any sequence of hashings Hr = (πr, B, F ), r = 1, . . . , rmax, if S∗ ⊆ S denotes the set of elements of S that are not isolated with respect to at least a √α fraction of the hashings Hr, r = 1, . . . , rmax, then for any χ ∈ C[n]d, x′ := x − χ the following conditions hold. 2/k. Consider the call , 4µ(log4 n)T−t, µ), REDUCEL1NORM(χ, k,{m(bx, Hr, a ⋆ (1, w))}rmax r=1,a∈Ar ,w∈W where we assume that measurements of x are taken as in Algorithm 2. Denote, for each t = 0, . . . , log2(log4 N ), the signal recovered by step t in this call by χ(t) (see Algorithm 3). There exists an absolute constant C > 0 such that if for a parameter ν ≥ 2tµ at step t A (x′ − χ(t))S1 ≤ (2−tν + 20µ)k; B (χ + χ(t))[n]d\S0 ≤ 2 C (x′ − χ(t))S ∗1 + (χ + χ(t))[n]d\S1 ≤ 2ν then with probability at least 1 − (log N )−3 over the randomness used in ESTIMATEVALUES at step t one has log19 N k, k, log4 N (χ + χ(t+1))[n]d\S0 − (χ + χ(t))[n]d\S0 ≤ Proof. Recall that L′ ⊆ L is the list output by ESTIMATEVALUES. We let 1 log21 N k. L′′ =ni ∈ L : χ′i − x′i > α1/2(cid:0)2−tν + 20µ(cid:1)o denote the set of elements in L′ that failed to be estimated to within an additive α1/2(cid:0)2−tν + 20µ(cid:1) error term. For any element i ∈ L we consider two cases, depending on whether i ∈ L′ \ L′′ or i ∈ L′′. Case 1: First suppose that i ∈ L′ \ L′′, i.e. x′i − χ′i < α1/2(2−tν + 20µ). Then if α is smaller than an absolute constant, we have 1000 because only elements i with χ′i > 1 1 x′i > ν2−t + 4µ − (α1/2(2−tν + 20µ)) ≥ 2µ, 1000 ν2−t + 4µ are included in the set L′ in the call χ′ ← ESTIMATEVALUES(x, χ(t), L, k, ǫ, C(log log N + d2 + O(log(B/k))), 1 1000 ν2−t + 4µ) due to the pruning threshold of 1 1000 ν2−t + 4µ passed to ESTIMATEVALUES in the last argument. Since x[n]d\S∞ ≤ µ by definition of S, this means that either i ∈ S, or i ∈ supp χ(t). In both cases i contributes at most 0 to (χ + χ(t+1))[n]d\S0 − (χ + χ(t))[n]d\S0. 27 Case 2: Now suppose that i ∈ L′′, i.e. (x′ − χ′)i ≥ α1/2(2−tν + 20µ). In this case i may contribute 1 to (χ + χ(t+1))[n]d\S0 − (χ + χ(t))[n]d\S0. However, the number of elements in L′′ is small. To show this, we invoke Lemma 9.1 to obtain precision guarantees for the call to ESTIMATEVALUES on the pair x, χ and set of 'head elements' S ∪ supp χ. Note that S ≤ 2k, as otherwise we would have x[n]d\[k]2 2 > µ · k, a contradiction. Further, by assumption B of the lemma we have (χ + χ(t))[n]d\S0 ≤ k, so S ∪ supp(χ + χ(t)) ≤ 4k. The ℓ1 norm of x′ − χ(t) on S ∪ supp(χ + χ(t)) can be bounded as (x′ − χ(t))S1 + (x′ − χ(t))supp(χ+χ(t))\S1 [n]d\S1 + x′[n]d\S∞ · supp(χ + χ(t)) 4k ≤ For the ℓ2 bound on the tail of the signal we have ≤ (x′ − χ(t))S1 + χ(t) (2−tν + 20µ)k + 2ν log4 N 4k k + µ · (4k) ≤ 2−tν + 20µ, 2k (x′ − χ(t))[n]d\(S∪supp(χ+χ(t)))2 2 4k ≤ x[n]d\S2 4k 2 ≤ µ2. We thus have by Lemma 9.1, (1) for every i ∈ L′ that the estimate wi returned by ESTIMATEVALUES satisfies Since rmax is chosen as rmax = C(log log N + d2 + log(B/k)) for a sufficiently large absolute constant Pr[wi − x′i > α1/2(2−tν + 20µ)] < 2−Ω(rmax). C > 0, we have This means that Pr[wi − x′i > α1/2(2−tν + 20µ)] < 2−Ω(rmax) ≤ (k/B) · (log N )−25. E[L′′] ≤ L · (k/B) · (log N )−25 ≤ (B · rmax)(k/B) · (log N )−25 ≤ (log N )−23, where the expectation is over the randomness used in ESTIMATEVALUES. We used the fact that L′ ≤ L ≤ B · rmax and that rmax to derive the upper bound above. An application of Markov's inequality completes the proof. Lemma 7.2 (Spurious elements do not introduce significant ℓ1 error). For any x ∈ CN , any integer k ≥ 1, B ≥ (2π)4d·F · k/αd for α ∈ (0, 1] smaller than an absolute constant and F ≥ 2d, F = Θ(d) the following conditions hold for the set S := {i ∈ [n]d : xi > µ}, where µ2 ≥ x[n]d\[k]2 For any sequence of hashings Hr = (πr, B, F ), r = 1, . . . , rmax, if S∗ ⊆ S denotes the set of elements of S that are not isolated with respect to at least a √α fraction of the hashings Hr, r = 1, . . . , rmax, then for any χ ∈ C[n]d, x′ := x − χ the following conditions hold. 2/k. Consider the call REDUCEL1NORM(χ, k,{m(bx, Hr, a ⋆ (1, w))}rmax r=1,a∈Ar ,w∈W where we assume that measurements of x are taken as in Algorithm 2. Denote, for each t = 0, . . . , log2(log4 N ), the signal recovered by step t in this call by χ(t) (see Algorithm 3). There exists an absolute constant C > 0 such that if for a parameter ν ≥ 2tµ at step t A (x′ − χ(t))S1 ≤ (2−tν + 20µ)k; B (χ + χ(t))[n]d\S0 ≤ 2 log19 N k; , 4µ(log4 n)T−t, µ), 28 C (x′ − χ(t))S ∗1 + (χ + χ(t))[n]d\S1 ≤ 2ν then with probability at least 1 − (log N )−3 over the randomness used in ESTIMATEVALUES at step t one has log4 N k, (x′ − χ(t+1))([n]d\S)∪S ∗1 − (x′ − χ(t))([n]d\S)∪S ∗1 ≤ 1 log21 N k(ν + µ) Proof. We let Q := ([n]d \ S) ∪ S∗ to simplify notation, and recall that L′ ⊆ L is the list output by ESTIMAT- EVALUES. We let L′′ =ni ∈ L : χ′i − x′i > α1/2(cid:0)2−tν + 20µ(cid:1)o i We write denote the set of elements in L′ that failed to be estimated to within an additive α1/2(cid:0)2−tν + 20µ(cid:1) error term. (x − χ(t+1))Q1 = (x − χ(t+1))Q\L′1 + (x − χ(t+1))(Q∩L′)\L′′1 + (x − χ(t+1))Q∩L′′1 for all i 6∈ L′, and hence (x′ − χ(t+1))Q\L1 = (x′ − χ(t))Q\L1. We first note that χ(t+1) = χ(t) i Second, for i ∈ (Q ∩ L′)\ L′′ (second term) one has x′i − χ(t+1) ≤ √α(ν2−t + 4µ). Since only elements i ∈ L with χ′i > 1 1000 ν2−t + 4µ are reported by the threshold setting in ESTIMATEVALUES, so x′i − χ′ ≤ √α(2−tν + 20µ) ≤ x′i as long as α is smaller than a constant. We thus get that (x − χ(t+1))(Q∩L′)\L′′1 ≤ (x − χ(t))(Q∩L′)\L′′1. For the third term, we note that for each i ∈ L the estimate wi computed in the call to ESTIMATEVALUES satisfies (28) Eh(cid:12)(cid:12)wi − x′i − √α(2−tν + 20µ)(cid:12)(cid:12)+i ≤ √α(2−tν + µ)k2−Ω(rmax) by Lemma 9.1, (2). Verification of the preconditions of the lemma is identical to Lemma 7.1 (note that the assumptions of this lemma and Lemma 7.1 are identical) and is hence omitted. Since rmax = C(log log N + log(B/k)), the rhs of (28) is bounded by (log N )−25√α(2−tν +µ)k as long as C > 0 is larger than an absolute constant. We thus have (27) i (x′ − χ(t+1))S∩L′′1 ≤ Xi∈S∩L′′(cid:16)√α(2−tν + 20µ) +(cid:12)(cid:12)wi − x′i − √α(2−tν + 20µ)(cid:12)(cid:12)+(cid:17) . Combining (28) with the fact that by by Lemma 9.1, (1), we have for every i ∈ L by our choice of rmax, we get that Pr(cid:2)wi − x′i > √α(2−tν + 20µ)(cid:3) ≤ 2−Ω(rmax) ≤ (k/B) · (log N )−25 (x′ − χ(t+1))S∩L′′1 ≤ 2√α(2−tν + 20µ) · L · (k/B) · (log N )−25. An application of Markov's inequality then implies, if α is smaller than an absolute constant, that Pr[(x′ − χ(t+1))S∩L′′1 > 1 log21 N (ν + µ)k] < 1/ log3 N. Substituting the bounds we just derived into (27), we get (x − χ(t+1))Q1 ≤ (x − χ(t))Q1 + 1 log21 N (ν + µ)k as required. 29 Equipped with the two lemmas above, we can now give a proof of Lemma 3.2: Proof of Lemma 3.2: We prove the result by strong induction on t = 0, . . . , log2(log4 N ). Specifically, we prove that there exist events Et, t = 0, . . . , log2(log4 N ) such that (a) Et depends on the randomness used in the call to ESTIMATEVALUES at step t, Et satisfies Pr[EtE0∧. . . Et−1] ≥ 1−3/ log2 N and (b) for all t conditional on E0 ∧ E1 ∧ . . . ∧ Et one has (1) (x′ − χ(t))S\S ∗1 ≤ (2−tν + 20µ)k; (2) (χ + χ(t))[n]d\S0 ≤ χ[n]d\S0 + t (3) (x′ − χ(t))S ∗1 + (χ + χ(t))[n]d\S1 ≤ x′S ∗1 + χ[n]d\S1 + t log21 N log21 N νk k; The base is provided by t = 0 and is trivial since χ(0) = 0. We now give the inductive step. We start by proving the inductive step for (2) and (3). We will use Lemma 7.1 and Lemma 7.2, and hence we start by verifying that their preconditions (which are identical for the two lemmas) are satisfied. Precondition A is satisfied directly by inductive hypothesis (1). Precondition B is satisfied since (χ + χ(t))[n]d\S0 ≤ χ[n]d\S0 + t log21 N k ≤ 1 log19 N k + log 2(log4 N ) log21 N 2 log19 N ≤ k, where we used assumption B of this lemma and inductive hypothesis (2). Precondition C is satisfied since (x′−χ(t))S ∗1+(χ+χ(t))[n]d\S1 ≤ x′S ∗1+χ[n]d\S1+ t log21 N νk ≤ ν log4 N k+ t log21 N νk ≤ 2ν log4 N k, where we used assumption 3 of this lemma, inductive assumption (3) and the fact that t ≤ log2(log4 N ) ≤ log N for sufficiently large N. Proving (2). To prove the inductive step for (2), we use Lemma 7.1. Lemma 7.1 shows that with probability at least 1 − (log N )−2 over the randomness used in ESTIMATEVALUES (denote the success event by E 1 t ) we have (χ + χ(t+1))[n]d\S0 − (χ + χ(t))[n]d\S0 ≤ 1 k, log21 N k ≤ χ[n]d\S0 + t+1 log21 N so (χ + χ(t+1))[n]d\S0 ≤ (χ + χ(t))[n]d\S0 + 1 log21 N k as required. Proving (3). At the same time we have by Lemma 7.2 that with probability at least 1 − (log N )−2 (denote the success event by E 2 t ) (x′ − χ(t+1))([n]d\S)∪S ∗1 − (x′ − χ(t))([n]d\S)∪S ∗1 ≤ 1 log21 N kν, so by combing this with assumption (3) of the lemma we get (x′ − χ(t+1))([n]d\S)∪S ∗1 ≤ 1 log20 N νk + t + 1 log21 N νk as required. 30 Proving (1). We let L′′ ⊆ L denote the set of elements in L that fail to be estimated to within a small additive error. Specifically, we let L′′ =ni ∈ L : χ′i − x′i > α1/2(cid:0)2−tν + 20µ(cid:1)o , where χ′ is the output of ESTIMATEVALUES in iteration t. We bound (x′ − χ(t+1))S\S ∗1 by splitting this ℓ1 norm into three terms, depending on whether the corresponding elements were updated in iteration t and whether they were well estimated. We have (x′ − χ(t+1))S\S ∗1 = (x′ − (χ(t) + χ′))S\S ∗1 ≤ (x′ − (χ(t) + χ′))S\(S ∗∪L)1 + (x′ − (χ(t) + χ′))(S∩L)\L′\L′′1 + (x′ − (χ(t) + χ′))(S∩L′)\L′′1 + (x′ − (χ(t) + χ′))L′′1 = (x′ − χ(t))S\(S ∗∪L)1 + (x′ − (χ(t) + χ′))(S∩L)\L′\L′′1 + (x′ − (χ(t) + χ′))(S∩L′)\L′′1 + (x′ − (χ(t) + χ′))(L∩S)∩L′′1 =: S1 + S2 + S3 + S4, (29) where we used the fact that χ′S\L ≡ 0 to go from the second line to the third. We now bound the four terms. The second term (i.e. S2) captures elements of S that were estimated precisely (and hence they are not in L′′), but were not included into L′ as they did not pass the threshold test (being estimated as larger than 1 1000 2−tν + 4µ) in ESTIMATEVALUES. One thus has (x − (χ(t) + χ′))(S∩L)\L′\L′′1 ≤ α1/2(2−tν + 20µ) · (S ∩ L′) \ L′′ + ( 1 1000 2−tν + 4µ) · (S ∩ L′) \ L′′ 1 ≤ (( 1000 + α1/2)2−tν + (4 + 20α1/2)µ)2k (30) since S ≤ 2k by assumption of the lemma. belong to L′) and were approximated well (hence belong to L′′). One has, by definition of the set L′′, The third term (i.e. S3) captures elements of S that were reported by ESTIMATEVALUES (hence do not (x − (χ(t) + χ′))(S∩L′)\L′′1 = α1/2(2−tν + 20µ) · (S ∩ L′) \ L′′ ≤ 2α1/2(2−tν + 20µ)k (31) . since S ≤ 2k by assumption of the lemma. For the forth term (i.e. S4) we have (x′ − (χ(t) + χ′))L′′1 ≤ α1/2(cid:0)2−tν + 20µ(cid:1) · L′′ +Xi∈S(cid:12)(cid:12)(cid:12)χ′i − x′i − α1/2(cid:0)2−tν + 20µ(cid:1)(cid:12)(cid:12)(cid:12)+ By Lemma 9.1, (1) (invoked on the set S ∪ supp(χ + χ(t) + χ′)) we have E[L′′] ≤ B · 2−Ω(rmax) and by Lemma 9.1, (2) for any i one has E(cid:20)(cid:12)(cid:12)(cid:12)χ′i − x′i − α1/2(cid:0)2−tν + 20µ(cid:1)(cid:12)(cid:12)(cid:12)+(cid:21) ≤ L · α1/2(cid:0)2−tν + 20µ(cid:1) 2−Ω(rmax). Since the parameter rmax in ESTIMATEVALUES is chosen to be at least C(log log N + d2 + log(B/k)) for a sufficiently large constant C, and L = O(log N )B, we have Eh(x′ − (χ(t) + χ′))L′′1i ≤ α1/2(cid:0)2−tν + 20µ(cid:1) L2−Ω(rmax) ≤ 1 log25 N (cid:0)2−tν + 20µ(cid:1) k 31 By Markov's inequality we thus have 1 (x′ − (χ(t) + χ′))L′′1 ≤ α1/2(cid:0)2−tν + 20µ(cid:1)L2−Ω(rmax) ≤ with probability at least 1 − 1/ log3 N. Denote the success event by E 0 t . Finally, in order to bound the first term (i.e. S1), we invoke Theorem 3.1 to analyze the call to LOCATESIG- NAL in the t-th iteration. We note that since rmax, cmax ≥ (C1/√α) log log N (where C1 is the constant from log22 N (cid:0)2−tν + 20µ(cid:1) k Theorem 3.1) by assumption of the lemma, the preconditions of Theorem 3.1 are satisfied. By Theorem 3.1 together with (1) and (3) of the inductive hypothesis we have (x′ − χ(t))S\(S ∗∪L)1 ≤ (4C2α)d/2(x′ − χ(t))S\S ∗1 + (4C)d2 ≤ O((4C2α)d/2)(2−tν + 20µ)k + (4C)d2 ≤ ((χ + χ(t))[n]d\S1 + (x′ − χ(t))S ∗1) + 4µS ( (2−tν + 20µ)k + 8µk νk) + 8µk log20 N (32) 1 1000 2 (33) if α is smaller than an absolute constant and N is sufficiently large. Now substituting bounds on S1, S2, S3, S4 provided by (33), (30), (31) and (32) into (29) we get (x′ − χ(t+1))S\S ∗1 ≤ ( 2 1000 + O(α1/2))2−tν + (16 + O(α1/2))µk ≤ 2−tν + 20µk when α is a sufficiently small constant, as required. This proves the inductive step for (1) and completes the proof of the induction. t ∧E 1 t denote the success event for step t. We have by a union bound Pr[Et] ≥ 1−3t/ log2 N Let Et = E 0 t ∧E 2 as required. Sample complexity and runtime It remains to bound the sampling complexity and runtime. First note that REDUCEL1NORM only takes fresh samples in the calls to ESTIMATEVALUES that it issues. By Lemma 9.1 each such call uses 2O(d2)k(log log N ) samples, amounting to 2O(d2)k(log log N )2 samples over O(log log N ) iterations. By Lemma 5.1 each call to LOCATESIGNAL takes O(B(log N )3/2) time. Updating the measurements m(bx, Hr, a ⋆ (1, w)), w ∈ W takes time overall. The runtime complexity of the calls to ESTIMATEVALUES is 2O(d2)· k logd+1 N (log log N )2 time overall. Thus, the runtime is bounded by 2O(d2)k logd+2 N. Wcmaxrmax · F O(d) · B logd+1 N log log N = 2O(d2) · k logd+2 N 7.2 Analysis of SNR reduction loop in SPARSEFFT In this section we prove Theorem 3.3 For any x ∈ CN , any integer k ≥ 1, if µ2 ≥ Err2 following conditions hold for the set S := {i ∈ [n]d : xi > µ} ⊆ [n]d. Then the SNR reduction loop of Algorithm 2 (lines 19-25) returns χ(T ) such that k(x)/k and R∗ ≥ x∞/µ = N O(1), the (x − χ(T ))S1 . µ χ(T ) χ(T ) [n]d\S1 . µ [n]d\S0 . log19 N 1 (ℓ1-SNR on head elements is constant) (spurious elements contribute little in ℓ1 norm) k (small number of spurious elements have been introduced) 32 with probability at least 1 − 1/ log N over the internal randomness used by Algorithm 2. The sample complexity is 2O(d2)k log N (log log N ). The runtime is bounded by 2O(d2)k logd+3 N . Proof. We start with correctness. We prove by induction that after the t-th iteration one has (1) (x − χ(t))S1 ≤ 4(log4 N )T−tµk + 20µk; (2) x − χ(t)∞ = O((log4 N )T−(t−1)µ); (3) χ(t) The base is provided by t = 0, where all claims are trivially true by definition of R∗. We now prove the inductive step. The main tool here is Lemma 3.2, so we start by verifying that its preconditions are satisfied. First note that [n]d\S0 ≤ t log20 N k. 1 log19 N First, since S∗ ≤ 2−Ω(rmax)S ≤ 2−Ω(rmax)k ≤ k with probability at least 1 − 2−Ω(rmax) ≥ 1 − 1/ log N by Lemma 2.12 and choice of rmax ≥ (C/√α) log log N for a sufficiently large constant C > 0. Also, by Claim 2.14 we have that with probability at least 1−1/ log2 N for every s ∈ [1 : d] the sets Ar ⋆(0, es) are balanced (as per Definition 2.13 with ∆ = 2⌊ 1 2 log2 log2 n⌋, as needed for Algorithm 1). Also note that by (2) of the inductive hypothesis one has x − χ(t)∞/µ = R∗ · O(log N ) = N O(1). First, assuming the inductive hypothesis (1)-(3), we verify that the preconditions of Lemma 3.2 are sat- isfied with ν = 4(log4 N )T−tµk. First, for (A) one has (x − χ(t))S1 ≤ 4(log4 N )T−tµk. This satisfies precondition A of Lemma 3.2. We have (x − χ(t))S ∗1 + χ(t) [n]d\S1 ≤ x − χ(t)∞ · ((x − χ(t))S ∗0 + χ(t) [n]d\S0) k(cid:19) ≤ ≤ O(log4 N ) · ν ·(cid:18) 1 log20 N log19 N k + t 16 log14 N (34) νk νk, precondition (C) of Lemma 3.2 is also sat- for sufficiently large N. Since the rhs is less than isfied. Precondition (B) of Lemma 3.2 is satisfied by inductive hypothesis, (3) together with the fact that T = o(log R∗) = o(log N ). log4 N 1 Thus, all preconditions of Lemma 3.2 are satisfied. Then by Lemma 3.2 with ν = 4(log4 N )T−tµ one has with probability at least 1 − 1/ log2 N log4 N νk + 20µk; 1. (x′ − χ(t) − χ′)S1 ≤ 1 2. (χ(t) + χ′)[n]d\S0 − χ(t) 3. (x′ − (χ(t) + χ′))S ∗1 + (χ(t) + χ′)[n]d\S1 ≤ (x′ − χ(t))S ∗1 + χ(t) [n]d\S0 ≤ 1 log20 N k; [n]d\S1 + 1 log20 N νk. Combining 1 above with (34) proves (1) of the inductive step: (x − χ(t+1))S1 = (x − χ(t) − χ′)S1 ≤ 1 4(log4 N )T−tµk + 20µk 1 νk + 20µk = log4 N log4 N = 4(log4 N )T−(t+1)µk + 20µk. k yields χ(t+1) [n]d\S0 ≤ t Also, combining 2 above with the fact that χ(t) In order to prove the inductive step is remains to analyze the call to REDUCEINFNORM, for which we use Lemma 8.1 with parameter k = 4k/ log4 N. We first verify that preconditions of the lemma are satisfied. Let y := x − (χ + χ(t) + χ′) to simplify notation. For that we need to verify that [n]d\S0 ≤ t+1 k as required. log20 N log20 N y[k]1/k ≤ 4(log4 N )T−(t+1)µ = (log4 N ) · ( 33 1 log4 N ν + 20µ) (35) and y[n]d\[k]2/pk ≤ (log4 N ) · ( 1 log4 N ν + 20µ), (36) where we denote k := 4k/ log4 N for convenience. The first condition is easy to verify, as we now show. Indeed, we have yk1 ≤ yS1 + ysupp(χ(t)+χ′)\S1 + x[n]d\S∞ · k ≤ yS1 + (χ(t) + χ′)[n]d\S1 + xsupp(χ(t)+χ′)\S∞ · k + x[n]d\S∞ · k ≤ νk + 2µk ≤ νk + 20µk + νk + 40µk, log4 N log4 N log4 N 1 2 1 where we used the triangle inequality to upper bound ysupp(χ(t)+χ′)\S1 by (χ(t)+χ′)[n]d\S1+xsupp(χ(t)+χ′)\S∞· k to go from the first line to the second. We thus have y[k]1/k ≤ ( 2 log4 N νk + 40µk)/(4k/ log4 N ) ≤ (log4 N ) · ( 1 log4 N ν + 20µ) as required. This establishes (35). To verify the second condition, we first let S := S ∪ supp(χ + χ(t) + χ′) to simplify notation. We have y[n]d\[k]2 2 = y S\[k]2 2 + y([n]d\ S)\[k]2 2 ≤ y S\[k]2 2 + µ2k, (37) 1 log4 N where we used the fact that y[n]d\ S = x[n]d\ S and hence y([n]d\ S)\[k]2 νk + 20µk), and so it must be that yS\[k]∞ ≤ 2( y S1 ≤ 2( top k elements of y[k] would contribute more than 2( constraints y S\[k]2 value, i.e. y S\[k]2 µ2k ≤ 4( 2 ≤ µ2k. We now note that y S\[k]1 ≤ νk + 20µk)(k/k), as otherwise the νk + 20µk) to y S1, a contradiction. With these 2 is maximized when there are k elements in y S\[k], all equal to the maximum possible 2 ≤ y S\[k]2 2 ≤ 4( 2+ νk + 20µk)2(k/k)2k + µ2k. This implies that log4 N log4 N log4 N log4 N 1 1 1 1 νk+20µk)2(k/k)2k. Plugging this into (37), we get y[n]d\[k]2 νk + 20µk)2(k/k)2 + µ2(k/k) ≤ 2(k/k)s( νk + 20µk) + µ)(k/k) ≤ (log4 N )( νk + 20µk), log4 N log4 N 1 1 1 log4 N 1 log4 N y[n]d\[k]2/pk ≤s4( νk + 20µk)2 + µ2 ≤ 2(( establishing (36). Finally, also recall that yS\[k]∞ ≤ 2( We thus have that all preconditions of Lemma 8.1 are satisfied for the set of top k elements of y, and hence νk + 20µk)(k/k) ≤ (log4 N ) · ( νk + 20µk) and log4 N log4 N 1 1 y[n]d\ S∞ = x[n]d\S∞ ≤ µ. its output satisfies x − (χ(t) − χ′ − χ′′)∞ = O(log4 N ) · ( 1 log4 N νk + 20µk). Putting these bounds together establishes (2), and completes the inductive step and the proof of correctness. Finally, taking a union bound over all failure events (each call to ESTIMATEVALUES succeeds with prob- , and with probability at least 1 − 1/ log2 N for all s ∈ [1 : d] the set Ar ⋆ (0, es) ability at least 1 − 1 is balanced in coordinate s) and using the fact that log T = o(log N ) and each call to LOCATESIGNAL is deterministic, we get that success probability of the SNR reduction look is lower bounded by 1 − 1/ log N. log2 N 34 Sample complexity and runtime The sample complexity is bounded by the the sample complexity of the calls to REDUCEL1NORM and REDUCEINFNORM inside the loop times O(log N/ log log N ) for the num- ber of iterations. The former is bounded by 2O(d2)k(log log N )2 by Lemma 3.2, and the latter is bounded by 2O(d2)k/ log N by Lemma 8.1, amounting to at most 2O(d2)k log N (log log N ) samples overall. The run- time complexity is at most 2O(d2)k logd+3 N overall for the calls to REDUCEL1NORM and no more than 2O(d2)k logd+3 N overall for the calls to REDUCEINFNORM. 2/k, µ2 = O(x[n]d\[k]2 7.3 Analysis of SPARSEFFT Theorem 3.5 For any ǫ > 0, x ∈ C[n]d and any integer k ≥ 1, if R∗ ≥ x∞/µ = poly(N ), µ2 ≥ x[n]d\[k]2 solves the ℓ2/ℓ2 sparse recovery problem using 2O(d2)(k log N log log N + 1 time with at least 98/100 success probability. Proof. By Theorem 3.3 the set S := {i ∈ [n]d : xi > µ} satisfies (x − χ(T ))S1 . µk 2/k) and α > 0 is smaller than an absolute constant, SPARSEFFT(x, k, ǫ, R∗, µ) ǫ k logd+3 N ǫ k log N ) samples and 2O(d2) 1 and χ(T ) [n]d\S0 . [n]d\S1 . µk k 1 log19 N χ(T ) with probability at least 1 − 1/ log N. letting Q ⊆ [n]d denote the top 2k coefficients of x′, we have We now show that the signal x′ := x− χ(T ) satisfies preconditions of Lemma 3.4 with parameter k. Indeed, x′Q1 ≤ x′Q∩S1 + χ(T ) (Q\S)∩supp χ(T )1 + Q · x[n]d\S1 ≤ O(µk) Furthermore, since Q is the set of top 2k elements of x′, we have x′[n]d\Q2 2 ≤ x′[n]d\(S∪supp χ(T ))2 ≤ µ2S + x[n]d\[k]2 2 ≤ x[n]d\(S∪supp χ(T ))2 2 = O(µ2k) 2 ≤ x[n]d\S2 2 as required. Thus, with at least 99/100 probability we have by Lemma 3.4 that x − χ(T ) − χ′2 ≤ (1 + O(ǫ)) Errk(x). By a union bound over the 1/ log N failure probability of the SNR reduction loop we have that SPARSEFFT is correct with probability at least 98/100, as required. It remains to bound the sample and runtime complexity. The number of samples needed to compute m(bx, Hr, a ⋆ (1, w)) ← HASHTOBINS(x, 0, (Hr, a ⋆ (1, w))) for all a ∈ Ar, w ∈ W is bounded by 2O(d2)k log N (log log N ) by our choice of B = 2O(d2)k, rmax = O(log log N ), W = O(log N/ log log N ) and Ar = O(log log N ), together with Lemma 9.2. This is asymptotically the same as the 2O(d2)k log N (log log N ) sample complexity of the ℓ1 norm reduction loop by Theorem 3.3. The sampling complexity of the call to RECOVERATCONSTANTSNR is at most 2O(d2) 1 ǫ k log N by Lemma 3.4, yielding the claimed bound. The runtime of the SNR reduction loop is bounded by 2O(d2)k logd+3 N by Theorem 3.3, and the runtime of RECOVERATCONSTANTSNR is at most 2O(d2) 1 ǫ k logd+2 N by Lemma 3.4. 35 8 ℓ∞/ℓ2 guarantees and constant SNR case In this section we state and analyze our algorithm for obtaining ℓ∞/ℓ2 guarantees in O(k) time, as well as a procedure for recovery under the assumption of bounded ℓ1 norm of heavy hitters (which is very similar to the RECOVERATCONSTSNR procedure used in [IKP14]). 8.1 ℓ∞/ℓ2 guarantees The algorithm is given as Algorithm 4. Algorithm 4 REDUCEINFNORM(x, χ, k, ν, R∗, µ) 1: procedure REDUCEINFNORM(x, χ, k, ν, R∗, µ) 2: 3: 4: 5: ⊲ in Cn 2 log2 log2 n⌋ s=1{n∆−g · es} ⊲ es is the unit vector in direction s ⊲ 0d is the zero vector in dimension d χ(0) ← 0 B ← (2π)4d·F · k/αd for a small constant α > 0 T ← log2 R∗ rmax ← (C/√α) log N for sufficiently large constant C > 0 W ← {0d}, ∆ ← 2⌊ 1 for g = 1 to ⌈log∆ n⌉ do W ← W ∪Sd end for G ← filter with B buckets and sharpness F , as per Lemma 2.3 for r = 1 to rmax do ⊲ Samples that will be used for location Choose Σr ∈ Md×d, qr ∈ [n]d uniformly at random, let πr := (Σr, qr) and let Hr := (πr, B, F ) Let Ar ← C log log N elements of [n]d × [n]d sampled uniformly at random with replacement for w ∈ W do end for m(bx, Hr, a ⋆ (1, w)) ← HASHTOBINS(x, 0, (Hr, a ⋆ (1, w))) for all a ∈ Ar, w ∈ W r=1,a∈Ar ,w∈W(cid:17) Lr ← LOCATESIGNAL(cid:16)χ(t), k,{m(bx, Hr, a ⋆ (1, w))}rmax L ←Srmax χ′ ← ESTIMATEVALUES(x, χ(t), L, k, 1, O(log n), 5(ν2T−(t+1) + µ),∞) χ(t+1) ← χ(t) + χ′ end for for t = 0 to T − 1 do ⊲ Locating elements of the residual that pass a threshold test 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: for r = 1 to rmax do r=1 Lr end for 21: 22: 23: 24: end for 25: return χ(T ) 26: 27: end procedure 2/k, then the following conditions hold. Lemma 8.1. For any x, χ ∈ Cn, x′ = x − χ, any integer k ≥ 1, if parameters ν and µ satisfy ν ≥ If S ⊆ [n]d is the set of top k el- x′[k]1/k, µ2 ≥ x′[n]d\[k]2 ements of x′ in terms of absolute value, and x′[n]d\S∞ ≤ ν, then the output χ ∈ C[n]d of a call to REDUCEINFNORM(bx, χ, k, ν, R∗, µ) with probability at least 1 − N−10 over the randomness used in the call satisfies (all elements in S have been reduced to about ν + µ), x′ − χ∞ ≤ 8(ν + µ) + O(1/N c), 36 where the O(x′∞/N c) term corresponds to polynomially small error in our computation of the semiequi- spaced Fourier transform. Furthermore, we have χ[n]d\S ≡ 0. The number of samples used is bounded by 2O(d2)k log3 N . The runtime is bounded by 2O(d2)k logd+3 N . Proof. We prove by induction on t that with probability at least 1 − N−10 one has for each t = 0, . . . , T − 1 (1) (x′ − χ(t))S∞ ≤ 8(ν2T−t + µ) (2) χ(t) [n]d\S ≡ 0 (3) (x′i − χ(t))i ≤ x′i for all i ∈ [n]d for all such t. The base t = 0 holds trivially. We now prove the inductive step. First, since r = C log N for a constant C > 0, we have by Lemma 2.12 that each i ∈ S is isolated under at least a 1 − √α fraction of hashings H1, . . . , Hrmax with probability at least 1 − 2−Ω(√αrmax) ≥ 1 − N−10 as long as C > 0 is sufficiently large. This lets us invoke Lemma 6.3 with S∗ = ∅. We now use Lemma 6.3 to obtain bounds on functions ehead and etail applied to our hashings {Hr} and vector x′. Note that ehead and etail are defined in terms of a set S ⊆ [n]d (this dependence is not made explicit to alleviate notation). We use S = [k], i.e. S is the top k elements of x′. The inductive hypothesis together with the second part of Lemma 6.3 gives for each i ∈ S To bound the effect of tail noise, we invoke the second part of Lemma 6.6, which states that if rmax = C log N for a sufficiently large constant C > 0 , we have etail ({Hr}, x′, χ(t))∞ ≤ (Cα)d/2(x′ − χ(t))S∞. S ({Hr,Ar}, x′)∞ = O(√αµ). These two facts together imply by the second claim of Corollary 5.2 that each i ∈ S such that ehead S is located. In particular, by the inductive hypothesis this means that every i ∈ S such that (x′ − χ(t))i ≥ 20√α(x′ − χ(t))S∞ + 20√αµ (x′ − χ(t))i ≥ 20√α(ν2T−t + 2µ) + (4µ) is located and reported in the list L . This means that (x′ − χ(t))[n]d\L∞ ≤ 20√α(ν2T−t + 2µ) + (4µ), and hence it remains to show that each such element in L is properly estimated in the call to ESTIMATEVALUES, and that no elements outside of S are updated. We first bound estimation quality. First note that by part (3) of the inductive hypothesis together with Lemma 9.1, (1) one has for each i ∈ L Pr[χ′ − (x′ − χ(t))i > √α · (ν + µ)] < 2−Ω(rmax) < N−10, as long as rmax ≥ C log N for a sufficiently large constant C > 0. This means that all elements in the list L are estimated up to an additive (ν + µ)/10 ≤ (ν2T−t + µ)/10 term as long as α is smaller than an absolute constant. Putting the bounds above together proves part (1) of the inductive step. To prove parts (2) and (3) of the inductive step, we recall that the only elements i ∈ [n]d that are updated are the ones that satisfy χ′ ≥ 5(ν2T−(t+1) + µ). By the triangle inequality and the bound on additive estimation error above that (x′ − χ(t))i ≥ 5(ν2T−(t+1) + µ) − (ν + µ)/10 > 4(ν2T−(t+1) + µ) ≥ 4(ν + µ). Since (x′ − χ(t))i ≤ xi by part (2) of the inductive hypothesis, we have that only elements i ∈ [n]d with x′i ≥ 4(ν + µ) are updated, but those belong to S since x′[n]d\S∞ ≤ ν by assumption of the lemma. This proves part (3) of the inductive step. Part (2) of the inductive step follows since (x′− χ(t)− χ′)i ≤ (ν + µ)/10 by the additive error bounds above, and the fact that (x′ − χ(t))i > 4(ν + µ). This completes the proof of the inductive step and the proof of correctness. 37 Sample complexity and runtime Since HASHTOBINS uses B · F d samples by Lemma 9.2, the sample complexity of location is bounded by B · F d · rmax · cmax · W = 2O(d2)k log3 N. Each call to ESTIMATEVALUES uses B · F d · k · rmax samples, and there are O(log N ) such calls overall, resulting in sample complexity of Thus, the sample complexity is bounded by 2O(d2)k log3 N. The runtime bound follows analogously. B · F d · rmax · log N = 2O(d2)k log2 N. 8.2 Recovery at constant SNR The algorithm is given by 2 log2 log2 n⌋ Algorithm 5 RECOVERATCONSTANTSNR(x, χ, k, ǫ) 1: procedure RECOVERATCONSTANTSNR(x, χ, k, ǫ) 2: 3: 4: B ← (2π)4d·F · k/(ǫαd) Choose Σ ∈ Md×d, q ∈ [n]d uniformly at random, let π := (Σ, q) and let Hr := (πr, B, F ) Let A ← C log log N elements of [n]d × [n]d sampled uniformly at random with replacement W ← {0d}, ∆ ← 2⌊ 1 for g = 1 to ⌈log∆ n⌉ do W ← W ∪Sd end for for w ∈ W do m(bx, H, a ⋆ (1, w)) ← HASHTOBINS(x, 0, (H, a ⋆ (1, w))) for all a ∈ A, w ∈ W end for L ← LOCATESIGNAL(cid:0)χ(t), k,{m(bx, H, a ⋆ (1, w))}a∈A,w∈W(cid:1) χ′ ← ESTIMATEVALUES(x, χ, 2k, ǫ, O(log N ), 0) L′ ←top 4k elements of χ′ return χ + χ′L′ 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: end procedure s=1 n∆−g · es ⊲ 0d is the zero vector in dimension d ⊲ es is the unit vector in direction s Our analysis will use Lemma 8.2 (Lemma 9.1 from [IKP14]). Let x, z ∈ Cn and k ≤ n. Let S contain the largest k terms of x, and T contain the largest 2k terms of z. Then x − zT2 Lemma 3.4 For any ǫ > 0, x, χ ∈ CN , x′ = x − χ and any integer k ≥ 1 if x′[2k]1 ≤ O(x[n]d\[k]2√k) 2, the following conditions hold. If x∞/µ = N O(1), then the output χ′ of and x′[n]d\[2k]2 RECOVERATCONSTANTSNR(x, χ, 2k, ǫ) satisfies 2 + 4(x − z)S∪T2 2. 2 ≤ x[n]d\[k]2 2 ≤ x − xS2 x′ − χ′2 2 ≤ (1 + O(ǫ))x[n]d\[k]2 2 with at least 99/100 probability over its internal randomness. The sample complexity is 2O(d2) 1 the runtime complexity is at most 2O(d2) 1 ǫ k logd+1 N. ǫ k log N , and Remark 8.3. We note that the error bound is in terms of the k-term approximation error of x as opposed to the 2k-term approximation error of x′ = x − χ. 38 Proof. Let S denote the top 2k coefficients of x′. We first derive bounds on the probability that an element i ∈ S is not located. Recall that by Lemma 5.1 for any i ∈ S if i 1. ehead (H, x′, 0) < x′i/20; (H,A ⋆ (1, w), x′) < x′i/20 for all w ∈ W; 2. etail 3. for every s ∈ [1 : d] the set A ⋆ (0, es) is balanced (as per Definition 2.13), i then i ∈ L, i.e. i is successfully located in LOCATESIGNAL. simplify notation. We now upper bound the probability that an element i ∈ S is not located. We let µ2 := x[n]d\k2 2/k to Contribution from head elements. We need to bound, for i ∈ S, the quantity ehead i (H, x′, 0) = G−1 oi(i) · Xj∈S\{i} Goi(j)x′j. simplify notation. By Lemma 2.9, (1) one has Recall that m(bx, H, a ⋆ (1, w)) = HASHTOBINS(x, 0, (H, a ⋆ (1, w))), and let m := m(bx, H, a ⋆ (1, w)) to EH[ max a∈[n]d G−1 oi(i)ω−aT Σimh(i) − (x′S)i] ≤ (2π)d·F · C dx′S1/B + µ/N 2 (38) for a constant C > 0. This yields EH [ehead i (H, x′, 0)] ≤ (2π)d·F · C dx′S1/B . (2π)d·F · C dµk/B . αdC dǫµ. by the choice of B in RECOVERATCONSTANTSNR. Now by Markov's inequality we have for each i ∈ [n]d (39) (H, x′, 0) > x′i/20] . αdC dǫµ/x′i . αǫµ/x′i PrH [ehead i as long as α is smaller than a constant. Contribution of tail elements We restate the definitions of etail variables here for convenience of the reader (see (9), (10), (11) and (12)). We have etail i For any Z ⊆ [n]d we have (H, z, x) :=(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) etail i (H,Z, x) := quant1/5 G−1 oi(i) · Xj∈[n]d\S z∈Z(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) G−1 oi(i) · Xj∈[n]d\S . Goi(j)xjωzT Σ(j−i)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Goi(j)xjωzT Σ(j−i)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) . Note that the algorithm first selects sets Ar ⊆ [n]d × [n]d, and then accesses the signal at locations given by Ar ⋆ (1, w), w ∈ W (after permuting input space). (H,Ar, x′) for permutation π = (Σ, q) allows us to capture the amount of noise that our measurements for locating a specific set of bits of Σi suffer from. Since the algorithm requires all w ∈ W to be not too noisy in order to succeed (see preconditions 2 and 3 of Lemma 5.1), we have The definition of etail i etail i (H,A, x′) = 40µH,i(x) + Xw∈W(cid:12)(cid:12)(cid:12)etail i 39 (H,A ⋆ (1, w), x′) − 40µH,i(x′)(cid:12)(cid:12)(cid:12)+ where for any η ∈ R one has η+ = η if η > 0 and η+ = 0 otherwise. then show that for each i ∈ S one has For each i ∈ S we now define an error event E∗i whose non-occurrence implies location of element i, and x′i2 . Once we have (40), together with (39) it allows us to prove the main result of the lemma. In what follows we concentrate on proving (40). Specifically, for each i ∈ S define PrH,A[E∗i ] . αǫµ2 (40) E∗i = {(H,A) : ∃w ∈ W s.t. etail i (H,A ⋆ (1, w), x′) > x′i/20}. Recall that etail By Lemma 2.9, (3) one has, for a uniformly random z ∈ [n]d, that Ez[etail Lemma 2.9, (2), we have that (H, z, x′) = HASHTOBINS( \x[n]d\S, χ[n]d\S, (H, z)) by definition of the measurements m. H,i(x′). By (H, z, x′)2] = µ2 i i EH [µ2 H,i(x′)] ≤ (2π)2d·F · C dk(x − χ)[n]d\Sk2 2/B + µ2/N 2 ≤ αǫµ2. (41) Thus by Markov's inequality Prz[etail i (H, z, x′)2 > (x′i/20)2] ≤ αǫ(µH,i(x′))2/(x′i/20)2. Combining this with Lemma 9.5, we get for all τ ≤ (1/20)(x′i/20) and all w ∈ W PrA[quant1/5 z∈A⋆(1,w)etail i (H, z, x′) > x′i/20µ2 H,i(x′) = τ ] < (4τ /(x′i/20))Ω(A). (42) Equipped with the bounds above, we now bound Pr[E∗i ]. To that effect, for each τ > 0 let the event Ei(τ ) be defined as Ei(τ ) = {µH,i(x′) = τ}. Note that since we assume that we operate on O(log n) bit integers, µH,i(x′) takes on a finite number of values, and hence Ei(τ ) is well-defined. It is convenient to bound Pr[E∗i ] as a sum of three terms: i PrH,A[E∗i ] ≤ PrH,A etail +Z (1/8)(x′ +Z ∞ (1/8)(x′ i/20) √αǫµ i/20) (H,A, x′) > x′i/20(cid:12)(cid:12)(cid:12) [τ≤√αǫµ PrH,Ah etail Pr[Ei(τ )]dτ i Ei(τ ) (H,A, x′) > x′i/20 Ei(τ )i Pr[Ei(τ )]dτ We now bound each of the three terms separately for i such that x′i/20 ≥ 2√αǫµH,i(x′). This is sufficient for our purposes, as other elements only contribute a small amount of ℓ2 1. By (42) and a union bound over W the first term is bounded by 2 mass. W · (√αǫµ/(x′i/20))Ω(A) ≤ αǫµ2/x′i2 · W · 2−Ω(A) ≤ αǫµ2/x′i2. since A ≥ C log log N for a sufficiently large constant C > 0 in RECOVERATCONSTANTSNR. 2. The second term, again by a union bound over W and using (42), is bounded by √αǫµ Z (1/8)(x′ ≤Z (1/8)(x′ √αǫµ i/20) i/20) W · (4τ /(x′i/20))Ω(A)Pr[Ei(τ )]dτ W · (4τ /(x′i/20))Ω(A)(4τ /(x′i/20))2Pr[Ei(τ )]dτ 40 (43) (44) Since A ≥ C log log N for a sufficiently large constant C > 0 and (4τ /(x′i/20)) ≤ 1/2 over the whole range of τ by our assumption that x′i/20 ≥ 2√αǫµH,i(x′), we have for each τ ∈ [√αǫµ, (1/8)(x′i/20)]. Thus, (44) is upper bounded by W · (4τ /(x′i/20))Ω(A) ≤ W · (1/2)Ω(A) = o(1) (4τ /(x′i/20))2Pr[Ei(τ )]dτ √αǫµ i/20) Z (1/8)(x′ (x′i/20)2Z (1/8)(x′ √αǫµ 1 . i/20) τ 2Pr[Ei(τ )]dτ ≤ αǫµ2 (x′i/20)2 since by (41). i/20) Z (1/8)(x′ √αǫµ τ 2Pr[Ei(τ )]dτ ≤Z ∞ 0 τ 2Pr[Ei(τ )]dτ = EH[µ2 H,i(x′)] = O(α)ǫµ2 3. For the third term we have Z ∞ (1/8)(x′ i/20) Pr[Ei(τ )]dτ = Pr[µH,i(x′) > (1/8)(x′i/20)] . αǫµ2 x′i2 by Markov's inequality applied to (41). Putting the three estimates together, we get Pr[E∗i ] = O(α)ǫµ2 i2 x′ αǫµ2 x′i2 + Pr[i 6∈ L] . . αǫµ x′i In particular, . Together with (39) this yields for i ∈ S E"Xi∈S x′i2 · 1i∈S\L# ≤Xi∈S .Xi∈S x′i2Pr[i 6∈ L] x′i2(cid:18) αǫµ x′i + αǫµ2 x′i2(cid:19) . αǫµ2k, where we used the assumption of the lemma that x′[2k]1 ≤ O(x[n]d\[k]2√k) and x′[n]d\[2k]2 in the last line. By Markov's inequality we thus have Pr[x′S\L2 a constant. 2 ≤ x[n]d\[k]2 2 2 > ǫµ2k] < 1/10 as long as α is smaller than We now upper bound x′ − χ′2 getting 2. We apply Lemma 8.2 to vectors x′ and χ′ with sets S and L′ respectively, x′ − χ′L′2 2 ≤ x′ − x′S2 ≤ x[n]d\[k]2 ≤ x[n]d\[k]2 ≤ x[n]d\[k]2 2 2 + 4(x′ − χ′)S∪L′2 2 + 4(x′ − χ′)S\L2 2 + 4ǫµ2k + 4ǫµ2S 2 + O(ǫµ2k), 2 + 4(x′ − χ′)S∩L2 2 where we used the fact that (x′ − χ′)S∩L∞ ≤ √ǫµ with probability at least 1 − 1/N over the randomness used in ESTIMATEVALUES by Lemma 9.1, (3). This completes the proof of correctness. 41 Sample complexity and runtime The number of samples taken is bounded by 2O(d2) 1 the choice of B. The sampling complexity of the call to ESTIMATEVALUES is at most 2O(d2) 1 runtime is bounded by 2O(d2) 1 2O(d2) 1 ǫ k logd+1 N log log N for computing the measurements m(bx, H, a ⋆ (1, w)) and ǫ k log N by Lemma 9.2, ǫ k log N. The ǫ k logd+1 N for estimation. 9 Utilities 9.1 Properties of ESTIMATEVALUES In this section we describe the procedure ESTIMATEVALUES (see Algorithm 6), which, given access to a signal x in frequency domain (i.e. given bx), a partially recovered signal χ and a target list of locations L ⊆ [n]d, estimates values of the elements in L, and outputs the elements that are above a threshold ν in absolute value. The SNR reduction loop uses the thresholding function of ESTIMATEVALUES and passes a nonzero threshold, while RECOVERATCONSTANTSNR uses ν = 0. ⊲ rmax controls estimate confidence B ← (2π)4d·F · k/(ǫα2d) for r = 0 to rmax do Algorithm 6 ESTIMATEVALUES(x, χ, L, k, ǫ, ν, rmax ) 1: procedure ESTIMATEVALUES(x, χ, L, k, ǫ, ν, rmax ) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: end for 17: return wL′ 18: 19: end procedure j ← hr(f ) f ← vr,jG−1 wr end for wf ← median{wr If wf > ν then L′ ← L′ ∪ {f} end for L′ ← ∅ for f ∈ L do for r = 0 to rmax do f}rmax r=1 of (f )ω−zT r Σrf Choose Σr ∈ Md×d, qr, zr ∈ [n]d uniformly at random Let πr := (Σr, qr), Hr := (πr, B, F ), F = 2d ur ← HASHTOBINS(x, χ, χ, (Hr, zr)) ⊲ Using semi-equispaced Fourier transform (Corollary 10.2) ⊲ Initialize output list to empty ⊲ Estimate x′f from each measurement ⊲ Median is taken coordinatewise Lemma 9.1 (ℓ1/ℓ2 bounds on estimation quality). For any ǫ ∈ (0, 1], any x, χ ∈ Cn, x′ = x − χ, any L ⊆ [n]d, any integer k and any set S ⊆ [n]d,S ≤ 2k the following conditions hold. If ν ≥ (x − χ)S1/k and µ2 ≥ (x − χ)[n]d\S2 2/k, then the output w of ESTIMATEVALUES(x, χ, L, k, ǫ, ν, rmax) satisfies the following bounds if rmax is larger than an absolute constant. For each i ∈ L (1) Pr[wi − x′i > √ǫα(ν + µ)] < 2−Ω(rmax); (2) E(cid:2)wi − x′i − √ǫα(ν + µ)+(cid:3) ≤ √ǫα(ν + µ)2−Ω(rmax); (3) Eh(cid:12)(cid:12)wi − x′i2 − ǫα(ν + µ)2(cid:12)(cid:12)+i ≤ 2−Ω(rmax)ǫ(ν2 + µ2). 42 The sample complexity is bounded by 1 Proof. We analyze the vector ur ← HASHTOBINS(x, χ, (Hr, zr)) using the approximate linearity of HASH- TOBINS given by Lemma A.1 (see Appendix A). Writing x′ = x′S + x′[n]d\S, we let ǫ 2O(d2)krmax. The runtime is bounded by 2O(d2) 1 ǫ k logd+1 N rmax. uhead r we apply Lemma 2.9, (1) to the first vector, obtaining := HASHTOBINS(cxS, χS, (Hr, zr)) and utail r := HASHTOBINS( \x[n]d\S, χ[n]d\S, (Hr, zr)) EHr,zr [G−1 oi(i)ω−zT r Σiuhead h(i) − (x′S)i] ≤ (2π)d·F · C dxS1/B + µ/N 2 Similarly applying Lemma 2.9, (2) and (3) to the utail, we get oi(i)ω−zT which by Jensen's inequality implies EHr,zr [G−1 EHr,zr [G−1 oi(i)ω−aT r Σiutail r Σiutail 2/B, hr(i) − (x′[n]d\S )i2] ≤ (2π)2d·F · C dkx′[n]d\Sk2 h(i) − ((x − χ)[n]d\S)i] ≤ (2π)d·F · C dqkx[n]d\Sk2 ≤ (2π)d·F · C dµ ·pk/B. 2/B Putting (45) and (46) together and using Lemma A.1, we get (45) (46) (47) EHr,zr [G−1 oi(i)ω−zT r Σiuh(i) − (x − χ)i] ≤ (2π)d·F · C d(xS1/B + µ ·pk/B). We hence get by Markov's inequality together with the choice B = (2π)4d·F · k/(ǫα2d) in ESTIMATEVALUES (see Algorithm 6) PrHr,zr [G−1 oi(i)ω−zT r Σiuh(i) − (x − χ)i > 1 2 √ǫα(ν + µ)] ≤ (Cα)d/2. (48) The rhs is smaller than 1/10 as long as α is smaller than an absolute constant. Since wi is obtained by taking the median in real and imaginary components, we get by Lemma 9.4 wi − x′i ≤ 2median(w1 i − x′i, . . . ,wrmax i − x′i). By (48) combined with Lemma 9.5 with γ = 1/10 we thus have Pr {Hr,zr}[wi − x′i > √ǫα(ν + µ)] < 2−Ω(rmax). This establishes (1). random variables Xr = wr analogously. (2) follows similarly by applying the first bound from Lemma 9.5 with γ = 1/2 to i − xi, r = 1, . . . , rmax and Y = wi − xi. The third claim of the lemma follows The sample and runtime bounds follow by Lemma 9.2 and Lemma 10.1 by the choice of parameters. 9.2 Properties of HASHTOBINS Lemma 9.2. HASHTOBINS(bx, χ, (H, a)) computes u such that for any i ∈ [n], Goi(j)(x − χ)jωaT Σj uh(i) = ∆h(i) +Xj where G is the filter defined in section 2, and ∆2 O(BF d) samples, and if kχk0 . B, it takes O(2O(d) · B logd N ) time. h(i) ≤ kχk2 2/((R∗)2N 11) is a negligible error term. It takes 43 Algorithm 7 Hashing using Fourier samples (analyzed in Lemma 9.2) 1: procedure HASHTOBINS(bx, χ, (H, a)) G ← filter with B buckets, F = 2d Compute y′ = G · PΣ,a,q(x − χ′), for some χ′ with kbχ −bχ′k∞ < N−Ω(c) Compute uj = √NF−1(y′)(n/b)·j for j ∈ [b]d 2: 3: 4: 5: 6: end procedure return u ⊲ H = (π, B, F ), π = (Σq) ⊲ c is a large constant First, HASHTOBINS computes Proof. Let S = supp(bG), so S . (2F )d · B and in fact S ⊂ B∞F·B1/d(0). \x − χ + bG · PΣ,a,q \x − χ′ = bG · PΣ,a,q y′ = bG · PΣ,a,q \χ − χ′, for an approximation bχ′ to bχ. This is efficient because one can compute (PΣ,a,qbx)S with O(S) time and samples, and PΣ,a,qbχ′S is easily computed from bχ′T for T = {Σ(j − b) : j ∈ S}. Since T is an image of an ℓ∞ ball under a linear transformation and χ is B-sparse, by Corollary 10.2, an approximation bχ′ to bχ can be computed in O(2O(d) · B logd N ) time such that bχi −bχ′i < N−Ω(c) for all i ∈ T . Since kbGk1 ≤ √NkbGk2 = √NkGk2 ≤ NkGk∞ ≤ N and bG is 0 outside S, this implies that as long as c is larger than an absolute constant. Define ∆ by b∆ = √NbG · PΣ,a,q(\χ − χ′). Then HASHTOBINS i∈S (PΣ,a,q(\χ − χ′))i = kbGk1 max kbG · PΣ,a,q(\χ − χ′)k2 ≤ kbGk1 max computes u ∈ CB such that for all i, i∈T (\χ − χ′)i ≤ N−Ω(c) (49) uh(i) = √NF−1(y′)(n/b)·h(i) = √NF−1(y)(n/b)·h(i) + ∆(n/b)·h(i), \x − χ. This computation takes O(ky′k0 + B log B) . B log(N ) time. We have by the for y = bG · PΣ,a,q convolution theorem that uh(i) = √NF−1(bG · PΣ,a,q = (G ∗ F(PΣ,a,q \(x − χ))(n/b)·h(i) + ∆(n/b)·h(i) \(x − χ)))(n/b)·h(i) + ∆(n/b)·h(i) G(n/b)·h(i)−π(j)F(PΣ,a,q \(x − χ))π(j) + ∆(n/b)·h(i) Goi(j)(x − χ)jωaT Σj + ∆(n/b)·h(i) = Xπ(j)∈[N ] = Xi∈[N ] where the last step is the definition of oi(j) and Lemma 2.2. Finally, we note that ∆(n/b)·h(i) ≤ k∆k2 = kb∆k2 = √NkbG · PΣ,a,q(\χ − χ′)k2 ≤ N−Ω(c), where we used (49) in the last step. This completes the proof. 9.3 Lemmas on quantiles and the median estimator In this section we prove several lemmas useful for analyzing the concentration properties of the median estimate. We will use 44 Theorem 9.3 (Chernoff bound). Let X1, . . . , Xn be independent 0/1 Bernoulli random variables withPn µ. Then for any δ > 1 one has Pr[Pn Lemma 9.4 (Error bounds for the median estimator). Let X1, . . . , Xn ∈ C be independent random variables. Let Y := median(X1, . . . , Xn), where the median is applied coordinatewise. Then for any a ∈ C one has i=1 Xi > (1 + δ)µ] < e−δµ/3. i=1 E[Xi] = Y − a ≤2median(X1 − a, . . . ,Xn − a) =2pmedian(X1 − a2, . . . ,Xn − a2). Proof. Let i, j ∈ [n] be such that Y = re(Xi) + i · im(Xj). Suppose that re(Xi) ≥ re(a) (the other case is analogous). Then since re(Xi) is the median in the list (re(X1), . . . , re(Xn)) by definition of Y , we have that at least half of Xs, s = 1, . . . , n satisfy re(Xs) − re(a) > re(Xi) − re(a), and hence re(Xi) − re(a) ≤ median(re(X1) − re(a), . . . ,re(Xn) − re(a)). Since squaring a list of numbers preserves the order, we also have (re(Xi) − re(a))2 ≤ median((re(X1) − re(a))2, . . . , (re(Xn) − re(a))2). A similar argument holds for the imaginary part. Combining (50) (51) Y − a2 = (re(a) − re(Xi))2 + (im(a) − im(Xi))2 Y − a2 ≤median((re(X1) − re(a))2, . . . , (re(Xn) − re(a))2) + median((im(X1) − im(a))2, . . . , (im(Xn) − im(a))2) with (50) gives Noting that Y − a = ((re(a) − re(Xi))2 + (im(a) − im(Xi))2)1/2 ≤ re(a) − re(Xi) + im(a) − im(Xi) and using (51), we also get Y − a ≤median(re(X1) − re(a), . . . ,re(Xn) − re(a)) + median(im(X1) − im(a), . . . ,im(Xn) − im(a)). The results of the lemma follow by noting that re(X)− re(a) ≤ X − a and im(X)− im(a) ≤ X − a. Lemma 9.5. Let X1, . . . , Xn ≥ 0 be independent random variables with E[Xi] ≤ µ for each i = 1, . . . , n. Then for any γ ∈ (0, 1) if Y ≤ quantγ(X1, . . . , Xn), then and E[Y − 4µ/γ+] ≤ (µ/γ) · 2−Ω(n) Pr[Y ≥ 4µ/γ] ≤ 2−Ω(n). Proof. For any t ≥ 1 by Markov's inequality Pr[Xi > tµ/γ] ≤ γ/t. Define indicator random variables Zi by letting Zi = 1 if Xi > tµ/γ and Zi = 0 otherwise. Note that E[Zi] ≤ γ/t for each i. Then since Y is bounded i=1 Zi ≥ γn]. As E[Zi] ≤ γ/t, this above by the γn-th largest of {Xi}n i=1, we have Pr[Y > tµ/γ] ≤ Pr[Pn 45 can only happen if the sumPn to the sequence Zi, i = 1, . . . , n. We have i=1 Zi exceeds expectation by a factor of at least t. We now apply Theorem 9.3 Pr" nXi=1 Zi ≥ γn# ≤ e−(t−1)γn/3 (52) by Theorem 9.3 invoked with δ = t − 1. The assumptions of Theorem 9.3 are satisfied as long as t > 2. This proves the second claim we have t = 4 in that case. For the first claim we have 4 E[Y · 1Y ≥4·µ/γ] ≤Z ∞ ≤Z ∞ ≤ e−n/3Z ∞ = O(µ · e−n/3) 4 4 tµ · Pr[Y ≥ t · µ/γ]dt tµe−(t−1)n/3dt (by (52)) tµe−(t−2)n/3dt as required. 10 Semi-equispaced Fourier Transform In this section we give an algorithm for computing the semi-equispaced Fourier transform, prove its correctness and give runtime bounds. 2b (x ∗ G)i· n for i ∈ [2b]d. ⊲ x ∈ C[n]d is k-sparse Algorithm 8 Semi-equispaced Fourier Transform in 2O(d)k logd N time 1: procedure SEMIEQUISPACEDFFT(x, c) 2: 3: 4: Let B ≥ 2dk, be a power of 2d, b = B1/d G,cG′ ← d-th tensor powers of the flat window functions of [HIKP12a], see below yi ← 1√N by ← FFT(y) bx′i ←byi for i∞ ≤ b/2. returnbx′ We define filters G,cG′ as d-th tensor powers of the flat window functions of [HIKP12a], so that Gi = 0 for all i∞ & c(n/b) log N, kG − G′k2 ≤ N−c, 5: 6: 7: 8: end procedure ⊲ FFT on [2b]d cG′i =(cid:26) 1 0 if i∞ ≤ b/2 if i∞ > b , The following is similar to results of [DR93, IKP14]. andcG′i ∈ [0, 1] everywhere. Lemma 10.1. Let n be a power of two, N = nd, c ≥ 2 a constant. Let integer B ≥ 1, be a power of 2d, b = B1/d. For any x ∈ C[n]d Algorithm 8 computesbx′i for all i∞ ≤ b/2 such that in cO(d)x0 logd N + 2O(d)B log B time. bx′i −bxi ≤ kxk2/N c 46 Proof. Define z = 1 √N x ∗ G. We have thatbzi = bxibGi for all i ∈ [n]d. Furthermore, because subsampling and aliasing are dual under the Fourier transform, since yi = zi·(n/2b), i ∈ [2b]d is a subsampling of z we have for i such that i∞ ≤ b/2 that bx′i =byi = Xj∈[n/(2b)]dbzi+2b·j = Xj∈[n/(2b)]dbxi+2b·jbGi+2b·j = Xj∈[n/(2b)]dbxi+2b·jcG′i+2b·j + Xj∈[n/(2b)]dbxi+2b·j(bGi+2b·j −cG′i+2b·j) = Xj∈[n/(2b)]dbxi+2b·jcG′i+2b·j + Xj∈[n/(2b)]dbxi+2b·j(bGi+2b·j −cG′i+2b·j). Xj∈[n/(2b)]dbxi+2b·j(bGi+2b·j −cG′i+2b·j) ≤ x2bG −cG′2 ≤ x2/N c. Xj∈[n/(2b)]dbxi+2b·jcG′i+2b·j =bxi ·cG′i+2b·0 =bxi For the second term we have using Cauchy-Schwarz For the first term we have for all i ∈ [2b]d such that i∞ ≤ b, since for any j 6= 0 the argument ofcG′i+2b·j is larger than b in ℓ∞ norm, and hencecG′i+2b·j = 0 for all j 6= 0. Putting these bounds together we get that bx′i −bxi ≤ kbxk2kbG −cG′k2 ≤ kxk2N−c as desired. The time complexity of computing the FFT of y is 2O(d)B log B. The vector y can be constructed in time cO(d)x0 logd N. This is because the support of Gi is localized so that each nonzero coordinate i of x only contributes to cO(d) logd N entries of y. We will need the following simple generalization: Corollary 10.2. Let n be a power of two, N = nd, c ≥ 2 a constant, and Σ ∈ Md×d, q ∈ [n]d. Let integer B ≥ 1 be a power of 2d, b = B1/d. Let S = {Σ(i − q) : i ∈ Z,i∞ ≤ b/2}. Then for any x ∈ C[n]d we can computebx′i for all i ∈ S time such that in cO(d)x0 logd N + 2O(d)B log B time. bx′i −bxi ≤ kxk2/N c 47 ω−jT Σ(i−q)xj ω−jT ΣiωjT Σqxj = bxΣ(i−q) = Proof. Define x∗j = ωqjxΣ−T j. Then for all i ∈ [n], √N Xj∈[n]d √N Xj∈[n]d √N Xj ′=ΣT j∈[n]d √N Xj ′=ΣT j∈[n]d =bx∗i . = = 1 1 1 1 ω−(j ′)T iω(j ′)T qxΣ−T j ′ ω−(j ′)T ix∗j ′ We can accessbx∗i with O(d2) overhead, so by Lemma 10.1 we can approximatebxΣ(i−q) =bx∗i for i∞ ≤ k in cO(d)k logd N time. 11 Acknowledgements The author would like to thank Piotr Indyk for many useful discussions at various stages of this work. References [AGS03] A. Akavia, S. Goldwasser, and S. Safra. Proving hard-core predicates using list decoding. FOCS, 44:146 -- 159, 2003. [Aka10] A. Akavia. Deterministic sparse Fourier approximation via fooling arithmetic progressions. COLT, pages 381 -- 393, 2010. [BCG+12] P. Boufounos, V. Cevher, A. C. Gilbert, Y. Li, and M. J. Strauss. What's the frequency, Kenneth?: Sublinear Fourier sampling off the grid. RANDOM/APPROX, 2012. [Bou14] J. Bourgain. An improved estimate in the restricted isometry problem. GAFA, 2014. [CCFC02] M. Charikar, K. Chen, and M. Farach-Colton. Finding frequent items in data streams. ICALP, 2002. [CGV12] M. Cheraghchi, V. Guruswami, and A. Velingker. Restricted isometry of Fourier matrices and list decodability of random linear codes. SODA, 2012. [Cip00] [CP10] [CT06] B. A. Cipra. The Best of the 20th Century: Editors Name Top 10 Algorithms. SIAM News, 33, 2000. E. Candes and Y. Plan. A probabilistic and ripless theory of compressed sensing. IEEE Transac- tions on Information Theory, 2010. E. Candes and T. Tao. Near optimal signal recovery from random projections: Universal encoding strategies. IEEE Trans. on Info.Theory, 2006. [DIPW10] K. Do Ba, P. Indyk, E. Price, and D. Woodruff. Lower Bounds for Sparse Recovery. SODA, 2010. 48 [Don06] [DR93] D. Donoho. Compressed sensing. IEEE Transactions on Information Theory, 52(4):1289 -- 1306, 2006. A. Dutt and V. Rokhlin. Fast fourier transforms for nonequispaced data. SIAM J. Sci. Comput., 14(6):1368 -- 1393, November 1993. [GGI+02] A. Gilbert, S. Guha, P. Indyk, M. Muthukrishnan, and M. Strauss. Near-optimal sparse Fourier representations via sampling. STOC, 2002. [GHI+13] B. Ghazi, H. Hassanieh, P. Indyk, D. Katabi, E. Price, and L. Shi. Sample-optimal average-case sparse Fourier transform in two dimensions. Allerton, 2013. [GL89] O. Goldreich and L. Levin. A hard-corepredicate for allone-way functions. STOC, pages 25 -- 32, 1989. [GLPS10] A. C. Gilbert, Y. Li, E. Porat, and M. J. Strauss. Approximate sparse recovery: optimizing time and measurements. In STOC, pages 475 -- 484, 2010. [GMS05] A. Gilbert, M. Muthukrishnan, and M. Strauss. Improved time bounds for near-optimal space Fourier representations. SPIE Conference, Wavelets, 2005. [HAKI12] H. Hassanieh, F. Adib, D. Katabi, and P. Indyk. Faster GPS via the Sparse Fourier Transform. MOBICOM, 2012. [HIKP12a] H. Hassanieh, P. Indyk, D. Katabi, and E. Price. Near-optimal algorithm for sparse Fourier trans- form. STOC, 2012. [HIKP12b] H. Hassanieh, P. Indyk, D. Katabi, and E. Price. Simple and practical algorithm for sparse Fourier transform. SODA, 2012. [HKPV13] S. Heider, S. Kunis, D. Potts, and M. Veit. A sparse Prony FFT. SAMPTA, 2013. [HR16] I. Haviv and O. Regev. The restricted isometry property of subsampled fourier matrices. SODA, 2016. [IK14] P. Indyk and M. Kapralov. Sample-optimal Fourier sampling in any fixed dimension. FOCS, 2014. [IKP14] [Iwe10] [Iwe12] P. Indyk, M. Kapralov, and E. Price. (Nearly) sample-optimal sparse Fourier transform. SODA, 2014. M. A. Iwen. Combinatorial sublinear-time Fourier algorithms. Foundations of Computational Mathematics, 10:303 -- 338, 2010. M.A. Iwen. Improved approximation guarantees for sublinear-time Fourier algorithms. Applied And Computational Harmonic Analysis, 2012. [KM91] E. Kushilevitz and Y. Mansour. Learning decision trees using the Fourier spectrum. STOC, 1991. [LDSP08] M. Lustig, D.L. Donoho, J.M. Santos, and J.M. Pauly. Compressed sensing mri. Signal Processing Magazine, IEEE, 25(2):72 -- 82, 2008. [LWC12] D. Lawlor, Y. Wang, and A. Christlieb. Adaptive sub-linear time fourier algorithms. arXiv:1207.6368, 2012. [Man92] Y. Mansour. Randomized interpolation and approximation of sparse polynomials. ICALP, 1992. 49 [PR13] S. Pawar and K. Ramchandran. Computing a k-sparse n-length Discrete Fourier Transform using at most 4k samples and O(klogk) complexity. ISIT, 2013. [PS15] E. Price and Z. Song. A robust sparse Fourier transform in the continuous setting. FOCS, 2015. [RV08] [Sid11] M. Rudelson and R. Vershynin. On sparse reconstruction from Fourier and Gaussian measure- ments. CPAM, 61(8):1025 -- 1171, 2008. Emil Sidky. What does compressive sensing mean for X-ray CT and comparisons with its MRI application. In Conference on Mathematics of Medical Imaging, 2011. A Omitted proofs Proof of Lemma 2.11: We start with EΣ,q[π(S \ {i}) ∩ B∞(n/b)·h(i)((n/b) · 2t)] = Xj∈S\{i} PrΣ,q[π(j) ∈ B∞(n/b)·h(i)((n/b) · 2t)] (53) Recall that by definition of h(i) one has (n/b) · h(i) − π(i)∞ ≤ (n/b), so by triangle inequality π(j) − π(i)∞ ≤ π(j) − (n/b)h(i)∞ + π(i) − (n/b)h(i)∞, so EΣ,q[π(S \ {i}) ∩ B∞(n/b)·h(i)((n/b) · 2t)] ≤ Xj∈S\{i} ≤ Xj∈S\{i} Since πΣ,q(i) = Σ(i − q) for all i ∈ [n]d, we have PrΣ,q[π(j) ∈ B∞π(i)((n/b) · (2t + 1))] PrΣ,q[π(j) ∈ B∞π(i)((n/b) · 2t+1)] PrΣ,q[π(j) ∈ B∞π(i)((n/b) · 2t+1)] = PrΣ,q[Σ(j − i)∞ ≤ (n/b) · 2t+1] ≤ 2(2t+2/b)d, where we used the fact that by Lemma 2.5, for any fixed i, j 6= i and any radius r ≥ 0, PrΣ[kΣ(i − j)k∞ ≤ r] ≤ 2(2r/n)d (54) (55) with r = (n/b) · 2t+1. Putting this together with (54), we get EΣ,q[π(S \ {i}) ∩ B∞(n/b)·h(i)((n/b) · 2t)] ≤ S · 2(2t+2/b)d ≤ (S/B) · 2(t+2)d+1 1 4 ≤ (2π)−d·F · 64−(d+F )αd2(t+2)d+1. Now by Markov's inequality we have that i fails to be isolated at scale t with probability at most PrΣ,qhπ(S \ {i}) ∩ B∞π(i)((n/b) · 2t) > (2π)−d·F · 64−(d+F )αd/22(t+2)d+t+1i ≤ 1 4 2−tαd/2. Taking the union bound over all t ≥ 0, we get PrΣ,q[i is not isolated] ≤Xt≥0 1 4 2−tαd/2 ≤ 1 2 αd/2 ≤ 1 2 α1/2 as required. Before giving a proof of Lemma 2.9, we state the following lemma, which is immediate from Lemma 9.2: 50 Lemma A.1. Let x, x1, x2, χ, χ1, χ2 ∈ CN , x = x1 + x2, χ = χ1 + χ2. Let Σ ∈ Md×d, q, a ∈ [n]d, B = bd, b ≥ 2 an integer. Let u = HASHTOBINS(x, χ, (H, a)) u1 = HASHTOBINS(cx1, χ1, (H, a)) u2 = HASHTOBINS(cx2, χ2, (H, a)). Then for each j ∈ [b]d one has G−1 oi(i)ujω−aT Σi − (x − χ)ip . G−1 oi(i)u1 + N−Ω(c) j ω−aT Σi − (x1 − χ1)ip + G−1 oi(i)u2 j ω−aT Σi − (x2 − χ2)ip for p ∈ {1, 2}, where O(c) is the word precision of our semi-equispaced Fourier transform computations. Proof of Lemma 2.9: By Lemma 2.5, for any fixed i and j and any t ≥ 0, PrΣ[kΣ(i − j)k∞ ≤ t] ≤ 2(2t/n)d. Per Lemma 9.2, HASHTOBINS computes the vector u ∈ CB given by uh(i) − ∆h(i) = Xj∈[n]d Goi(j)x′jωaT Σj (56) for some ∆ with k∆k2 ∞ ≤ N−Ω(c). We define the vector v ∈ Cn by vΣj = x′jGoi(j), so that so uh(i) − ∆h(i) = Xj∈[n]d ωaT jvj = √Nbva uh(i) − ωaT ΣiGoi(i)x′i − ∆h(i) = √N ([v {Σi} )a. We have by (56) and the fact that (X + Y )2 ≤ 2X 2 + 2Y 2 oi(i)ω−aT Σiuh(i) − x′i2 = G−2 G−1 ≤ 2G−2 oi(i)uh(i) − ωaT ΣiGoi(i)x′i − ∆h(i)2 + 2G−2 Goi(j)x′jωaT Σj2 + 2G−2 oi(i)uh(i) − ωaT ΣiGoi(i)x′i2 oi(i)∆2 oi(i)∆2 = 2G−2 h(i) h(i) oi(i) Xj∈[n]d By Parseval's theorem, therefore, we have Ea[G−1 oi(i)ω−aT Σiuh(i) − x′i2] ≤ 2G−2 = 2G−2 Goi(j)x′jωaT Σj2] + 2Ea[∆2 2 + ∆2 h(i)] oi(i)(kv oi(i)Ea[ Xj∈[n]d {Σi}k2 . N−Ω(c) + Xj∈[n]d\{i} . N−Ω(c) + Xj∈[n]d\{i} . N−Ω(c) + µ2 Σ,q(i). 51 h(i)) x′jGoi(j)2 x′jGoi(j)2 (57) We now prove (2). Recall that the filter G approximates an ideal filter, which would be 1 inside B∞0 (n/b) and 0 everywhere else. We use the bound on Goi(j) = Gπ(i)−π(j) in terms of π(i)− π(j)∞ from Lemma 2.3, (2). In order to leverage the bound, we partition [n]d = B∞(n/b)·h(i)(n/2) as B∞(n/b)·h(i)(n/2) = B∞(n/b)·h(i)(n/b) ∪ log2(b/2)[t=1 (cid:16)B∞(n/b)·h(i)((n/b)2t) \ B∞(n/b)·h(i)((n/b)2t−1)(cid:17) . For simplicity of notation, let X0 = B∞(n/b)·h(i)(n/b) and Xt = B∞(n/b)·h(i)((n/b)· 2t)\ B∞(n/b)·h(i)((n/b) · 2t−1) for t ≥ 1. For each t ≥ 1 we have by Lemma 2.3, (2) max . (n/b)·h(i)((n/b)2t−1)Goi(l) ≤(cid:18) 2 1 + 2t−1(cid:19)F max π(l)∈Xt Goi(l) ≤ π(l)6∈B∞ Since the rhs is greater than 1 for t ≤ 0, we can use this bound for all t ≤ log2(b/2). Further, by Lemma 2.5 we have for each j 6= i and t ≥ 0 PrΣ,q[π(j) ∈ Xt] ≤ PrΣ,q[π(j) ∈ B∞(n/b)·h(i)((n/b) · 2t)] ≤ 2(2t+1/b)d. Putting these bounds together, we get EΣ,q[µ2 Σ,q(i)] = EΣ,q[ Xj∈[n]d\{i} x′j2 · x′jGoi(j)2] log2(b/2)Xt=0 log2(b/2)Xt=0 +∞Xt=0 ≤ Xj∈[n]d\{i} ≤ Xj∈[n]d\{i} x′j2 · B Xj∈[n]d\{i} ≤ ≤ 2O(d)kx′k2 2F B 2 x′j2 2(t+1)d−F (t−1) π(l)∈Xt Goi(l) PrΣ,q[π(j) ∈ Xt] · max 1 + 2t−1(cid:19)F (2t+1/b)d ·(cid:18) 2 oi(i) ≤ (2π)d·F completes the proof of (2). x′jGoi(j)] + ∆h(i) EΣ,q[ max The proof of (1) is similar. We have a∈[n]d Xj∈[n]d\{i} as long as F ≥ 2d and F = Θ(d). Recalling that G−1 x′jGoi(j)ωaT Σj] ≤ EΣ,q[ Xj∈[n]d\{i} ≤ ∆h(i) + Xj∈[n]d\{i} ≤ ∆h(i) + Xj∈[n]d\{i} x′j · B Xj∈[n]d\{i} ≤ ∆h(i) + ≤ ∆h(i) + 2O(d)kx′k1 x′j · 2F B , log2(b/2)Xt=0 log2(b/2)Xt=0 +∞Xt=0 x′j π(l)∈Xt Goi(l) PrΣ,q[π(j) ∈ Xt] · max 1 + 2t−1(cid:19)F (2t+1/b)d ·(cid:18) 2 2(t+1)d−F (t−1) (58) 52 where Recalling that G−1 oi(i) ≤ (2π)d·F and R∗ ≤ x∞/µ completes the proof of (1). ∆h(i) . N−Ω(c). 53
0808.1246
2
0808
2013-01-21T17:26:48
Minimum Dissatisfaction Personnel Scheduling
[ "cs.DS" ]
In this paper we consider two problems regarding the scheduling of available personnel in order to perform a given quantity of work, which can be arbitrarily decomposed into a sequence of activities. We are interested in schedules which minimize the overall dissatisfaction, where each employee's dissatisfaction is modeled as a time-dependent linear function. For the two situations considered we provide a detailed mathematical analysis, as well as efficient algorithms for determining optimal schedules.
cs.DS
cs
MINIMUM DISSATISFACTION PERSONNEL SCHEDULING Mugurel Ionut Andreica Politehnica University of Bucharest [email protected] Romulus Andreica and Angela Andreica Commercial Academy Satu Mare [email protected] the absolute value of X. Assuming that employee j has been assigned to activity a(j), the overall dissatisfaction will be Abstract: In this paper we consider two problems regarding the scheduling of available personnel in order to perform a given quantity of work, which can be arbitrarily decomposed into a sequence of activities . We are interested in schedules which minimize the overall dissatisfaction, where each employee’s dissatisfaction is modeled as a time-dependent linear function. For the two situations considered we provide a detailed mathematical analysis, as well as efficient algorithms for determining optimal schedules. 1. Introduction Personnel scheduling problems are very important in many activity domains and efficient scheduling techniques are being sought increasingly often. Common scheduling objectives are: maximizing productivity, minimizing losses, maximizing profit and others. In this paper we consider two problems regarding the scheduling of employees, in order to perform a given quantity of work which can be arbitrarily decomposed into a sequence of activities. The objective is to determine a time schedule of the activities and an assignment of employees to the activities which minimizes the overall dissatisfaction, subject to several types of constraints. The dissatisfaction of each employee is modeled as a time - dependent linear function. We present a detailed mathematical analysis of the problems, as well as efficient algorithms for determining optimal schedules. Our results are significant both from a theoretical and a practical point of view. The rest of this paper is structured as follows. In Sections 2 and 3 we present the two personnel scheduling problems we mentioned, together with complete analysis and algorithms. In Section 4 we discuss related work and in Section 5 we conclude. 2. Minimum Dissatisfaction Scheduling with Personnel Ordering Restrictions An economic agent has N employees, numbered with natural numbers from 1 to N, which have to perform some quantity of work. The overall quantity of work can be divided into any number of activities, which can be performed sequentially. Each activity i can be realized in negligible time (zero time), thus its only parameter of interest will be the moment when the activity is scheduled tai. Let’s consider that the quantity of work has been divided into k activities, scheduled at times 0≤ta1<ta2<…< tak. The dissatisfaction of each employee j is a time- dependent linear function, ds(j,t)=wj·t-tej, where wj is the “weight” of employee j and te j is the time moment when the employee j is the most willing (satisfied) to perform an activity (the optimal employee time). By X we denote We overall the in minimizing interested are dissatisfaction. In order to do this, we can choose the total number of activities, the time moments when these activities are scheduled and the assignment of employees to activities. The only constraint we need to consider is that, if u and v are two employees such that 1≤u<v≤N, we must have a(u)≤a(v). This means that employee u cannot be assigned to an activity taking place after the activity to which employee v is assigned. Thus, the ordering of the employees must correspond to the chronological ordering of the activities to which they are assigned: a(1)≤a(2)≤…≤ a(N) (taa(1)≤taa(2)≤…≤taa(N)). We will first provide a dynamic programming algorithm for computing an optimal schedule when the maximum value of the time moments tej (Tmax) is not too large and all the time moments are integer. We will compute a table Dmin[i,t]=the minimum overall dissatisfaction of the employees i, i+1, …, N, if they are assigned to activities scheduled at time moments t’≥t : Dmin[N+1, t]=0. In the first case, no activity is scheduled at time t, thus we will use the value Dmin[i,t+1]. In the second case, we schedule an activity at time t and assign the employee i to it. The employees i+1, …, N can be assigned to the same activity or to a subsequent one, thus we will consider the value Dmin[i+1,t]+ds(i,t). The value of t is between 0 and Tmax and the time complexity of the algorithm is O(N· Tmax). The minimum overall dissatisfaction is found at Dmin[1,0]. The schedule can be easily computed from the table Dmin, by tracing back the way the values of the table were computed. We will now present a greedy algorithm which does not require the time moments tej to be “small”. At first, we will consider that we have only one activity, scheduled at time 0 and all the employees are assigned to this activity. ),()(1jaNjtajdsD],1[),(]1,[min],[minmin1mintiDtidstiDtiDNi Then, we will iteratively improve this solution by adding extra activities or by delaying the existing ones and reassigning the employees to these activities. We will maintain an array tasgn, where tasgn[i] is the moment when the activity to which employee is assigned is scheduled (initially, tasgn[i]=0, 1≤i≤N). If at some step of the algorithm, an employee i is assigned to an activity scheduled at time t, it will be possible to reassign this employee to an activity scheduled at a time moment t’>t (but not at a time moment t’<t). We will maintain an array dinc, where dinc[j]=the value by which the dissatisfaction of employee j increases if the employee is reassigned to an activity starting at time (tasgn[i]+1): dinc[j]=wj, if tej≤tasgn[j], or –wj, if tej>tasgn[j]. We will compute an array incsum, where Thus, incsum[j] is the sum of the increases of dissatisfac - tion of the employees j, j+1, …, N. We will select the minimum value of the array incsum: let this value be incsum[p]. If incsum[p]≥0, then the algorithm will stop. If incsum[p]<0, then, by assigning all the employees p, p+1, …, N to a an activity scheduled later than their current activity, the overall dissatisfaction will decrease. We will find the largest negative value T shift from the set {tasgn[q]-teq p≤q≤N }, i.e. that value which is closest to 0. Then, we will increase all the values tasgn[q] (p≤q≤N) by Tshift. After doing this, we will recompute the arrays dinc and incsum and perform another iteration. The pseudocode of the algorithm is given below: GreedyPersonnelScheduling: Step 1. for i=1 to N do tasgn[i]=0 Step 2. compute the arrays dinc and incsum Step 3. choose the minimum value (incsum[p] ) in the array incsum Step 4. if (incsum[p]≥0) then goto Step 8. Step 5. find the minimum value Tshift=min{tasgn[q]-teq (p≤q≤N) and (tasgn[q]-teq < 0) } Step 6. for i=p to N do tasgn[p]=tasgn[p]+Tshift Step 7. go to Step 2. Step 8. compute Step 9. return D The algorithm above can be easily implemented in time O(N2). We will now explain how its time complexity can be reduced to O(N·log(N)). For this, we will use the segment tree data structure and, in particular, the segment tree framework introduced in [1]. We will maintain three segment trees, as showed in the pseudocode below: GreedyPersonnelScheduling-O(N·logN): for i=1 to N do tasgn[i]=0 if (tei≤tasgn[i]) then dinc[i]=wi else dinc[i]=-wi incsum[N]=dinc[N] for i=N-1 downto 1 do incsum[i]=dinc[i]+incsum[i-1] // compute two auxiliary arrays: incsum_aux and tasgn_aux for i=1 to N do incsum_aux[i]=(incsum[i] , i) if (dinc[i]≥0) then tasgn_aux[i]=(-∞, i) else tasgn_aux[i]=(tasgn[i]-tei, i) st_iaux = the segment tree for the array incsum_aux, with update function uFunc=plus_poz and query function qFunc=min_poz st_taux = the segment tree for the array tasgn_aux, with update function uFunc=plus_poz and query function qFunc=max_poz st_tasgn = the segment tree for the array tasgn, with update function uFunc=+ and query function qFunc=min while (true) do (vmin, pozmin)=STrangeQuery(st_iaux.root, 1, N) if (vmin≥0) then break (Tshift, pozshift)=STrangeQuery(st_taux.root, pozmin, N) STrangeUpdate(st_taux.root, (-Tshift, 0), pozmin, N) STrangeUpdate(st_tasgn.root, -Tshift, pozmin, N) STrangeUpdate(st_taux.root, (-∞, 0), pozshift, pozshift) STrangeUpdate(st_iaux.root, (2·wpozshift, 0), 1, pozshift) for i=1 to N do tasgn[i]=STrangeQuery(st_tasgn.root, i, i) The functions plus_poz, min_poz and max_poz are defined below: plus_poz((vx, pozx), (vy, pozy)): return ((vx+vy), max(pozx, pozy)) min_poz((vx, pozx), (vy, pozy)): if (vx<vy) then return (vx, pozx) else return (vy, pozy) max_poz((vx, pozx), (vy, pozy)): if (vx>vy) then return (vx, pozx) else return (vy, pozy) The functions STrangeUpdate and STrangeQuery are part of the segment tree framework defined in [1]. The algorithm works as follows: we find the minimum value of the array incsum (vmin) and the position of the minimum value (pozmin) using the segment tree st_iaux. If vmin≥0, then the execution ends. Afterwards, we find the largest non-positive value Tshift in the array tasgn_aux, together with its position pozshift, using the segment tree st_taux. Then, we increase by T shift all the positions in the arrays tasgn_aux and tasgn, between pozmin and N. We set the value of tasgn_aux[pozshift] to (-∞, pozshift), in order to ignore this position from now on. After all these operations, the value dinc[pozshift] changes from - wpozshift to +wpozshift. Thus, all the values incsum[p] (1≤p≤pozshift) increase by 2·wpozshift. All the operations are performed in O(log(N)) time per iteration and the algorithm performs O(N) iterations, arriving at a time complexity of O(N·log(N)). 3. Minimum Dissatisfaction Scheduling with Increasing Optimal Employee Times This situation is similar to the previous one, except that the optimal employee times te1, te2, …, teN are sorted in increasing order, i.e. te1≤te2≤…≤teN. There are also other restrictions: the number of activities is fixed to a given value k and they can be scheduled only at time moments equal to optimal employee time moments. Furthermore, any two activities must be scheduled at different time moments. We will enhance the model by considering the dissatisfaction of the employer in the following way: if an activity is scheduled at time moment te j, then the employer’s dissatisfaction will be de j≥0. The objective is to minimize the overall dissatisfaction (the dissatisfaction of the employees plus the dissatisfaction of the employer). We will solve this problem by dynamic programming. We will compute two sets of values: Dmin[i,j,0] and Dmin[i,j,1]:  Dmin[i,j,0]=the minimum overall dissatisfaction if the ith activity is scheduled at time tej (and all the Njppdincjincsum][][N1itasgn[i])ds(i,D employees 1,2,…,j are assigned to one of the activities 1,2,..,i)  Dmin[i,j,1]=the minimum overall dissatisfaction if the ith activity is scheduled at a time moment t≤tej (and all the employees 1,2,…,j are assigned to one of the activities 1,2,..,i) We have the following recurrence equations: The initial values are: Dmin[0,0,0]=Dmin[0,0,1]=0 and Dmin[0,j,0]=Dmin[0,j,1]=+∞ (for j>0). The minimum overall dissatisfaction is equal to Dmin[k,N,1] and the activity schedule and assignment of employees to activities can be determined by tracing back the way the Dmin[i,j,p] values were computed. A naive algorithm implements the equations directly and has time complexity O(N2·k), considering that we can evaluate in O(1) time the sums with the p argument. We can achieve this by computing the arrays wsum, wright and wleft:  wsum[i] = the sum of the weights of the employees 1,2,…,i; wsum[0]=0 and wsum[i] = wsum[i-1]+w[i]  wright[i] = the total dissatisfaction of the employees i, i+1, …, N, if they are assigned to an activity scheduled at time teN ; wright[N+1]=0 ; wright[i] = wright[i+1]+ wi·(teN-tei)  wleft[i] = the total dissatisfaction of the employees 1, 2,…,i, if they are assigned to an activity scheduled at time te1 ; wleft[0]=0 ; wleft[i] = wleft[i-1] + wi·(tei- te1) With these arrays, we can write as (wright[j’+1] – wright[j+1]– (wsum[j]–wsum[j’])·(teN- tej)). Similarly, is equal to (wleft[j]- wleft[j’]-(wsum[j]-wsum[j’])·(tej’-te1). We can improve the algorithm to O(N·K), by introducing the following concepts: for each activity i (1≤i≤k) and each employee j (1≤j≤N), we will define two functions: fi,j and gi,j, which will be used in order to compute the values Dmin[i,j,0] and Dmin[i,j,1]. The functions fi,j are defined on the interval [tej, teN]. fi,j(tep) represents the minimum dissatisfaction of the employees 1,2,…,p if i activities were scheduled, the ith activity is scheduled at time tep and the employees j, j+1, .., p are assigned to activity i. With this definition, Dmin[i,j,0] is the minimum value fi,j’(tej) (0≤j’<j), plus dej. The important issue now becomes to find the minimum value of these functions, without evaluating every function at the time moment te j. (which would get us back to an O(N2·k) algorithm). The equation of a function fi,j(tep) is: Dmin[i-1, j-1, 1] + . The difference between two “consecutive” values of a function fi,j is:  dfi,j(tep+1) = fi,j(tep+1) – fi,j(tep)=(w[j]+w[j+1] + … + w[p])· (tep+1 – tep). We notice that dfi,j(tep+1)<dfi,j’(tep+1), when j’<j (the functions which “started” more recently grow slower than those which have “started” for a longer time). This is because the sum (w[j]+…+w[p]) is larger when j is smaller. From this observation we conclude the following:  if the value of a function fi,j(tep+1) is larger than the value of a function fi,j’(tep+1), with j’>j, then the function fi,j will never have the minimum value (among all the functions) at any of the subsequent steps. if the value of a function fi,j(tep+1) is smaller than the value of a function fi,j’(tep+1), with j’>j, then the function fi,j will be “surpassed” by the function fi,j’ at a time moment tsurpass,i,j,j’ ; fi,j’ will not have the minimum value among all the functions fi,j (j≤j’) before a time moment equal to the maximum value of the set {tsurpass,i,j,j’j<j’}. We can use a double-ended queue (deque), in order to store all the functions which “started” up to a time step p (time moment tep). Within the deque, the functions are sorted according to their value at step p, as well as after the time moment when their value will be the minimum one among all the functions which “started” before them (tearly,i,j for a function fi,j). At every step p, a new function fi,p is inserted into the deque. This function will remove from the end of the deque all the functions having a value which is larger than fi,p at time moment tep, as well as those functions j for which tsurpass,i,j,p is smaller than tearly,i,j (because these function will be surpassed by the function fi,p before getting the chance to have the minimum value among all the other functions; thus, their values wil never be globally minimum). Moreover, at every step p, we iteratively remove the first function from the front of the deque if the second function fi,j has tearly,i,j<tep. In order to compute the time moment tsurpass,i,j,j’ when a function fi,j’ surpasses a function fi,j (j<j’), we must compute the following values. Let’s assume that we are at time step p=j’. We will compute dC= fi,j’(tej’) – fi,j(tej’). We notice that in between two steps j’-1 and j’, the functions fi,j behave like half-lines, with a slope equal to dPj=(wj+wj+1+…+wj’-1). The slope of function fi,j’ is dPj’=0. At every time moment after tej’, the difference between the slopes of the two functions remains constants and equal to dP j-dPj’. This is easily noticeable, because the slopes of the two functions will increase with the same amount at every step q>j’. Thus, the time moment when the function fi,j’ surpasses the function fi,j is tsurpass,i,j,j’=tej’+dC/(dPj-dPj’). In order to compute the values Dmin[i,j,1], we will proceed in a similar manner. We will define some functions gi,j:[wsum[j], wsum[N]], whose values gi,j(wsum[p]) represent the minimum dissatisfaction of the employees 1,2,…,p, if the ith activity is scheduled at time tej and the employees j, j+1, …,p are assigned to activity i. These functions are defined on the partial sums of the weights of the employees, in order to be able to use a similar reasoning. Every function gi,j will be a half-line (with constant slope) in between two “consecutive” points wsum[j’-1] and wsum[j’]. The slope of a function g i,j will be, according to this definition, equal to te j’-tej. The pseudocode of the algorithm is given below: })(]1,',1[{min]0,,[1'min'0minjjppjpjjjtetewdejiDjiD})(]0,',[{min]1,,[1''min'1minjjpjppjjtetewjiDjiDjjppjptetew1')(jjpjpptetew1'')(pjqqpqtetew)( DPPersonnelScheduling: compute the arrays wsum, wright and wleft initialize Dmin[0,j,0] and Dmin[0,j,1] (0≤j≤N) for i=1 to k do dq0=empty; dq1=empty for j=0 to k-1 do Dmin[i,j,0]=Dmin[i,j,1]=+∞ for j=k to N do // clean up the front of dq0 while (dq0.size()>1) and (dq0.getSecond().tearly<tej) do dq0.removeFirst() // compute Dmin[i,j,0] tearly,i,j=tej while (dq0.size()≥1) do e=dq0.getLast() x=e.v+wright[e.j]-wright[j+1]- (wsum[j] -wsum[e.j-1] )·(teN-tej) dC=Dmin[i-1,j-1,1]-x dP=wsum[j-1]-wsum[e.j-1] if (dC≤0) then tsurpass,i,e.j,j=-∞ else tsurpass,i,e.j,j=tej+(dC/dP) if (tsurpass,i,e.j,j≤e.tearly) then dq0.removeLast() else tearly,i,j=tsurpass,i,e.j,j break dq0.addLast((‘v’=Dmin[i-1,j-1,1], ‘tearly’=tearly,i,j, ‘j’=j)) e=dq0.getFirst() Dmin[i,j,0]=e.v+wright[e.j] -wright[j+1]- (wsum[j] -wsum[e.j-1])·(teN-tej)+dej // clean up the front of dq1 while (dq1.size()>1) and (dq1.getSecond().we<wsum[j] ) do dq1.removeFirst() // compute Dmin[i,j,1] wearly,i,j=wsum[i] while (dq1.size()≥1) do e=dq1.getLast() x=e.v+wleft[j]-wleft[e.j]-(wsum[j] -wsum[e.j])·(tee.j-te1) dC=Dmin[i,j,0]-x dP=tej-tee.j if (dC≤0) then wsurpass, i,e. j, j=-∞ else wsurpass,i,e.j,j=wsum[j]+(dC/dP) if (wsurpass,i,e.j,j≤e.we) then dq1.removeLast() else wearly, i, j=wsurpass, i,e. j, j break dq1.addLast((‘v’=Dmin[i,j,0], ‘we’=wearly,i,j, ‘j’=j)) e=dq1.getFirst() Dmin[i,j,1]=e.v+wleft[j]-wleft[e.j]-(wsum[j] - wsum[e.j] )·(tee.j-te1) The algorithm has O(N·k) amortized complexity. The key element of the algorithm is the deque data structure. At every step (i,j), many operations can be performed on the deque, but only O(N) operations are performed on the deque for a given value of i (and all the values of j). 4. Related Work Personnel scheduling is an important research topic and many papers have addressed such scheduling problems, using a large variety of techniques: genetic algorithms [2] , memetic algorithms [3], tabu search [4], heuristics [5], branch and price [9], integer and network programming [6]. Some techniques from other scheduling domains could also be applied, like greedy and dynamic programming algorithms [7] and efficient data structures [1]. Given a different meaning to the problem parameters, our second scheduling problem is nearly identical to the K-Median problem of a set of points on a line, which was solved in O(N·k) time [8]. 5. Conclusions and Future Work In this paper we considered two personnel scheduling problems, in which the objective consisted of minimizing the dissatisfaction of the employees, when they have to perform a sequence of activities. The dissatisfaction of each employee was modeled as a time-dependent linear function. The scheduling constraints consisted either of personnel ordering restrictions or a fixed number of activities which needed to be executed. For both problems we presented efficient algorithms for determining optimal schedules. As future work, we intend to adopt more complex dissatisfaction models and consider some multi- criteria optimization problems. 6. References [1] Andreica, M. I., Tapus, N., "Optimal Offline TCP Sender Buffer Management Strategy", Proceedings of the IEEE International Conference on Communication Theory, Reliability, and Quality of Service, p. 41, 2008. [2] Beddoe, G. R., Petrovic, S., “Selecting and Weighting Features Using a Genetic Algorithm in a Case-Based Reasoning Approach to Personnel Rostering”, European Journal of Operational Research, vol. 175, p. 649, 2006. [3] Burke, E. K., Cowling, P., De Causmaecker, P., Vanden Berghe, G., “A Memetic Approach to the Nurse Rostering Problem”, Applied Intelligence, vol. 15, p.199, 2001. [4] Burke, E. K., De Causmaecker, P., Vanden Berghe, G., “A Hybrid Tabu Search Algorithm for the Nurse Rostering Problem”, Simulated Evolution and Learning, Springer Lecture Notes in Artificial Intelligence , vol. 1585, p. 187, 1999. [5] Burke, E. K., Curtois, T., Post, G., Qu, R., Veltman, B., “A Hybrid Heuristic Ordering and Variable Neighbourhood Search for the Nurse Rostering Problem”, Technical Report NOTTCS-TR-2005-3, University of Nottingham, 2005. [6] Millar, H. H., Kiragu, M., “Cyclic and non-cyclic shift nurses by network scheduling of 12 h programming”, European Journal of Operational Research, vol. 104, p. 582, 1998. [7] Andreica, M. I., Tapus, N., "High Multiplicity Scheduling of File Transfers with Divisible Sizes on Multiple Classes of Paths", Proceedings of the IEEE International Symposium on Consumer Electronics, 2008. [8] Fleischer, R., Golin, M. J., Zhang, Y., “Online Maintenance of k-Medians and k-Covers on a Line”, Algorithmica, vol. 45, p. 549, 2006. [9] Alfieri, A., Kroon, L., van de Veelde, S., “Personnel scheduling in a complex logistic system: a railway application case”, Journal of Intelligent Manufacturing , vol. 18, p. 223, 2007.
1902.07055
3
1902
2019-06-21T18:28:46
Hardness of Exact Distance Queries in Sparse Graphs Through Hub Labeling
[ "cs.DS", "cs.CC", "cs.DC" ]
A distance labeling scheme is an assignment of bit-labels to the vertices of an undirected, unweighted graph such that the distance between any pair of vertices can be decoded solely from their labels. An important class of distance labeling schemes is that of hub labelings, where a node $v \in G$ stores its distance to the so-called hubs $S_v \subseteq V$, chosen so that for any $u,v \in V$ there is $w \in S_u \cap S_v$ belonging to some shortest $uv$ path. Notice that for most existing graph classes, the best distance labelling constructions existing use at some point a hub labeling scheme at least as a key building block. Our interest lies in hub labelings of sparse graphs, i.e., those with $|E(G)| = O(n)$, for which we show a lowerbound of $\frac{n}{2^{O(\sqrt{\log n})}}$ for the average size of the hubsets. Additionally, we show a hub-labeling construction for sparse graphs of average size $O(\frac{n}{RS(n)^{c}})$ for some $0 < c < 1$, where $RS(n)$ is the so-called Ruzsa-Szemer{\'e}di function, linked to structure of induced matchings in dense graphs. This implies that further improving the lower bound on hub labeling size to $\frac{n}{2^{(\log n)^{o(1)}}}$ would require a breakthrough in the study of lower bounds on $RS(n)$, which have resisted substantial improvement in the last 70 years. For general distance labeling of sparse graphs, we show a lowerbound of $\frac{1}{2^{O(\sqrt{\log n})}} SumIndex(n)$, where $SumIndex(n)$ is the communication complexity of the Sum-Index problem over $Z_n$. Our results suggest that the best achievable hub-label size and distance-label size in sparse graphs may be $\Theta(\frac{n}{2^{(\log n)^c}})$ for some $0<c < 1$.
cs.DS
cs
Hardness of exact distance queries in sparse graphs through hub labeling Adrian Kosowski1, Przemysław Uzna´nski2, and Laurent Viennot1 1Inria, Paris University, France∗ 2Institute of Computer Science, University of Wrocław, Poland† Abstract A distance labeling scheme is an assignment of bit-labels to the vertices of an undirected, unweighted graph such that the distance between any pair of vertices can be decoded solely from their labels. An important class of distance labeling schemes is that of hub labelings, where a node v ∈ G stores its distance to the so-called hubs Sv ⊆ V , chosen so that for any u, v ∈ V there is w ∈ Su ∩ Sv belonging to some shortest uv path. Notice that for most existing graph classes, the best distance labelling constructions existing use at some point a hub labeling scheme at least as a key building block. Our interest lies in hub labelings of sparse graphs, i.e., those with E(G) = O(n), for which we log n) for the average size of the hubsets. Additionally, we show a hub-labeling show a lowerbound of n √ construction for sparse graphs of average size O( RS(n)c ) for some 0 < c < 1, where RS(n) is the so- called Ruzsa-Szemerédi function, linked to structure of induced matchings in dense graphs. This implies that further improving the lower bound on hub labeling size to 2(log n)o(1) would require a breakthrough in the study of lower bounds on RS(n), which have resisted substantial improvement in the last 70 years. 2O( n n For general distance labeling of sparse graphs, we show a lowerbound of log n) SUMINDEX(n), 1 √ where SUMINDEX(n) is the communication complexity of the Sum-Index problem over Zn. Our results suggest that the best achievable hub-label size and distance-label size in sparse graphs may be Θ( 2(log n)c ) for some 0 < c < 1. 2Θ( n 1 Introduction Hub labeling schemes are a popular way of distributed encoding shortest path structure for easy retrieval. Given a graph G = (V, E) (across this paper we assume, unless stated otherwise, that G is undirected and unweighted, with V = n and E = m), we store with each vertex v ∈ V (G) the so-called hubset Sv ⊆ V (G) together with shortest path distances between v and its hubs. The distance query uv is resolved by returning min w∈S(u)∩S(v) dist(u, w) + dist(w, v). This framework was introduced in [CHKZ03] under the name of 2-hop covers, further explored by [AG11]) (as landmark labelings) and [ADGW12]. The computed distance between all pairs of nodes u and v is exact ∗Supported by Irif CNRS laboratory and ANR projects DESCARTES (ANR-16-CE40-0023), DISTANCIA (ANR-17-CE40-0015) †Supported by Polish National Science Centre grant 2016/22/E/ST6/00499. and MULTIMOD (ANR-17-CE22-0016). if set S(u) ∩ S(v) contains at least one node on some shortest u − v path. This property of the family of sets (S(u) : u ∈ V ) is known as shortest path cover. Hub labeling schemes are a special case of the more general distance labeling schemes, in which the task is the assignment of a binary string label(u) to each node u ∈ V , so that the graph distance between u and v is uniquely determined by the pair of labels: label(u) and label(v), using a decoding function specified as part of the distance labeling. A central question in the distributed computing literature consists in identifying, for a given graph class, the optimal size of a distance labeling, expressed in terms on a bound on the average or maximum size of the labels used, taken over all nodes of a graph, for graphs belonging to the considered graph class. In general graphs, the distance labeling problem was first investigated by Graham and Pollak [GP72], who provided the first labeling scheme with labels of size O(n). A subsequent line of research contributed to reducing the decoding time, with results of [GPPR04, WP11] and finally [AGHP16a] presented a scheme with 2 n + o(n) and O(1) decoding time. This result is asymptotically tight: by a simple counting labels of size log2 3 argument, the label size of a node has to be at least 1 By contrast, when considering classes of sparse graphs (where m = O(n)), no similar asymptotically tight bounds on distance label size are known. The first sublinear-space distance labeling schemes were proposed only recently: [ADKP16] and later [GKU16] presented a hub labeling scheme with hubs of size O( n log n ), respectively. Interpreted in terms of distance labeling schemes, these works provide O( n log n log log n) bits per label respectively, through some careful encoding of distances to vertices of hubsets. This leaves a substantial gap with respect to the best known lower bound of Ω( √ The objective of this paper is to help understand the source of hardness of distance labeling in sparse graphs. We show a basic obstacle on the path to the construction of better distance labelings: a lower bound of log n) on the hub set size in hub labeling. As we discuss further on in the related work section, this is n √ 2O( an issue as all currently known approaches to distance labeling rely inherently (possibly implicitly) on the construction of some form of hub labels. More rigorously, we succeed in tying-in the distance label size to two long-standing open questions: one from combinatorics on the value of the so-called Ruzsa-Szemerédi function RS(n) on graphs, one from communication complexity on the bit complexity SUMINDEX(n) of a basic 3-party communication problem known as Sum-Index. n) for the bit size of distance labels and of hub labeling schemes per node, given in [GPPR04]. 2 n − O(1), regardless of decoding time [GPPR04]. log n log log n) and O( n log n (log log n)2) and O( n We remark that our results can perhaps help to shed further light on the question of designing (centralized) distance oracles for sparse graphs. A natural objective, so far unachieved in general, would be to obtain for n-node sparse graphs a spectrum of data structures, using space S and resolving exact distance queries in time T , with a time-space tradeoff of ST = O(n2). This tradeoff is trivially achieved at its endpoints (S = O(n), S = O(n2)), but the existence of such oracles appears open, e.g., for S = O(n3/2) and T = O(n1/2) (cf. [CP10, SVY09]). Our result precludes the existence of such a centralized oracle relying on an application of hub labeling. 1.1 Related work Distance labelings vs. Hub labelings. It is noteworthy that for most existing graph classes, the best known distance labelling constructions are based on hub labeling schemes, either explicitly or as a key building block. Such constructions usually involve some form of compression and/or encoding of all distances (from a vertex to its hubs), to avoid log n overhead when going from hubsets to binary labels (see e.g. [GKU16]). For example, for the case of arbitrary graphs, a distance labeling may be constructed as follows: an additive approximation scheme for hub-labeling is constructed, that is for each pair uv, there is w ∈ S(u) ∩ S(v) such that either w or some neighbor x ∈ N (w) is on shortest uv path. This guarantees that the absolute error of estimation is either 0, 1 or 2. Constructing such (small) approximate hub-set and complementing it with explicit correction tables (which require log2 3 2 n bits per vertex) suffices. Many more ingredients and insights 2 are required to achieve constant decoding time as described in [AGHP16a], which goes beyond the scope of this overview. Distance labeling of sparse graphs and sub-classes. Constructions for distance labeling in sparse graphs were considered in the previously mentioned papers [ADKP16] and [GKU16]. Both of them use hubsets as the underlying technique. The first of these constructions relies on the observation that, by selecting randomly a hubset S of size O( n D log D) and assigning S ⊆ S(u) for any u, one already covers almost all pairs of vertices which are at distance D to each other, except at most a 1/D fraction of these pairs. Selecting D = Θ(log n) and storing vertices closer than D as hubs explicitly leads to desired hubset sizes (however, a careful approach is required when dealing with large degree vertices which may appear in a sparse graph, guaranteed only to have constant average degree). Second work shaves log log n term by derandomizing the construction. For the class of trees, the constructions of [Pel00] and [AGHP16b] are based on selection of central vertices as hubs, and proceeding recursively on obtained subtrees. In terms of bit size, those constructions give Θ(log2 n) bits per label (which is asymptotically optimal due to lowerbound of [GPPR04]), which corresponds to log n hubs per vertex. The construction of [FGNW17] through very careful assignment of 4 log2 n + o(log2 n) bits per label, which is optimal pieces of information thorough the construction achieves 1 up to lower order terms due to the lowerbound of [AGHP16b]. √ in any planar graph there is a S ⊆ V such that S = O( √ balanced (up to a factor 2) in sizes. Taking advantage of this, [GPPR04] described O( and O( √ √ Ω( 3 improved in [GU16] to O( log n overhead). For planar graphs, the main technical ingredient is an existence of small size separators. Specifically, n) and S separates V into V1 and V2 that are √ n) hub labeling n log n) bits distance labeling schemes, by applying the separation recursively. They also present n) lower bound (for both hub and distance labeling schemes). The distance labeling size was later n), through better encoding of distances from vertex to its hub (and thus avoiding Lower bounds. The aforementioned lowerbounds on size of distance labels and/or hubsets for sparse graphs, and especially for planar graphs, follow a particular line of thought, which can be called a counting argument. One can construct a family of graphs F on n vertices within the considered graph class, with a preselected subset of vertices V (cid:48) ⊆ V , such that knowing V (cid:48)2 pairwise distances in graph G is enough to identify the graph G ∈ F. One can reason then that the total length of the V (cid:48) labels in some graph in F needs to be at least log2 F, thus giving a lowerbound of 1V (cid:48) log2 F bits per label (the same reasoning applies to hub-labeling schemes as well). This reasoning has one fundamental limitation, in that it is unable to separate a distributed data structure from a centralized one. For example, it is believed that unweighted planar graphs do in fact admit Ω( n) lowerbound for size of distance labels (as is the case for weighted planar graphs). Current lower bound construction of [GPPR04] uses counting technique construction with V (cid:48) = Θ(n1/3) and log2 F = Θ(n2/3). This cannot be improved with counting technique: [AGMW18] shows that planar graphs do in fact admit distance oracles which take in total O(minV (cid:48)2,(cid:112)nV (cid:48)) bits to encode all V (cid:48)2 pairwise distances, which is O(minV (cid:48),(cid:112)n/V (cid:48)) bits per vertex and is maximized when √ V (cid:48) = n1/3 (one needs to argue that counting technique is not able to separate distance oracles from distance labelings, which is the case). This motivates the search for alternative techniques when proving lower bounds. Hub labeling in practice. We remark that the hub-based method of distance computation is efficient for many real-world networks (even in centralised scenarios, as a distance oracle) for at least two reasons. First of all, for transportation-type networks it is possible to show bounds on the sizes of sets S, which follow from the network structure. Notably, Abraham et al. [ADF+16] introduce the notion of highway dimension h of a network, which is presumed to be a small constant e.g. for road networks, and show that an appropriate cover 3 of all shortest paths in the graph can be achieved using sets S of size (cid:101)O(h). Moreover, the order in which elements of sets S(u) and S(v) is browsed when performing the minimum operation is relevant, and in some schemes, the operation can be interrupted once it is certain that the minimum has been found, before probing all elements of the set. This is the principle of numerous heuristics for the exact shortest-path problem, such as contraction hierarchies and algorithms with arc flags [KMS06, BD10]. 1.2 Overview of our results and proof techniques In this work we first show a lower bound on the size of hub labelings in sparse graphs. Note that in the regimes of both distance labeling and hub labeling, the state-of-the-art results for sparse graphs were leaving a huge gap: while upper bounds are of the form O(n/ log n) at best (ignoring poly-loglog terms), the lower √ bounds are Ω( n). We close this gap for hub labeling with the following result. Theorem 1.1. Graphs of max-degree 3 require average hub size to be at least number of vertices. log n) , where n is the n √ 2Θ( (See Section 2 for a detailed proof.) This result is complemented by an upper bound on hub set size, given by Theorem 1.4. Our technical contributions are obtained by using the following observations as a starting point. First, let us fix D = no(1) to be a threshold value, such that we consider distances up to D as small, and large otherwise. Simply using random hubsets of size roughly n/D we can cover all uv pairs with uv-distance being at least D. We therefore see immediately that only small distances are crucial (regardless of whether we are constructing a hard instance for a lowerbound, or small hubsets). Next, we observe that in the regime of small distances, we can afford to fix our attention to monotone hubsets, where we require that for any u, if x ∈ S(u), then all vertices on some chosen shortest ux path belong to S(u) as well. It trivially follows that minimal monotone hubset covering all small distances is withing a factor of D in size from minimal arbitrary hubset. Monotone hubsets have a following advantage in analysis: for uv connected by an unique shortest path, for any x belonging to such path, either u or v has to "pay" for hub x, that is x ∈ S(u) or x ∈ S(v). Thus, looking for hard instances, it is advantageous to consider the following: fix u ∈ V , and consider set S(cid:48)(u) = {h : dist(u, h) = dist(h, v) = D/2} where v ∈ V iterates over vertices such that dist(u, v) = D. If we ensure that S(cid:48)(u) need to be almost-linear in size (on average), since(cid:80)S(cid:48)(u) is within a D factor from total size of hubsets, we have our desired hard instance for hubset covering. Induced matchings in dense graphs. It turns out that the connection between structure of shortest paths and induced matchings is at the heart of the hardness of the hub labeling problem in sparse graphs. This connection as such has already been noted in the literature (cf. [Bod17]); here, we provide a brief exposition from a perspective most relevant to our study. Let us first recall the terminology. Definition 1.2. We say that M ⊆ E(G) is an induced matching of G if (i) it is a matching and (ii) there is a set of vertices V (cid:48) ⊆ V (G) such that M is a subgraph of G induced by V (cid:48). The connection between induced matchings and the shortest path structure follows from considering the bipartite graph G(cid:48) = (V, V, E(cid:48)), where (u, v) ∈ E iff u and v are at distance at most D in G, for some fixed threshold value D. Now consider a quadruple of vertices u, v, u(cid:48), v(cid:48) such that (u, v) ∈ G(cid:48) and (u(cid:48), v(cid:48)) ∈ G(cid:48), dist(u, v) = dist(u(cid:48), v(cid:48)) ≤ D. Take now some hub candidate h ∈ V and some integers a, b such that a + b = dist(u, v). If h is on the unique shortest uv path and h ∈ S(u) ∩ S(v) and dist(u, h) = a, dist(h, v) = b, we can mark it by selecting uv as an edge in some subgraph Mh ⊆ E(cid:48). We do the same for u(cid:48)v(cid:48) and every other pair of vertices, adding edges to Mh if h is a hub on shortest path located at distance a 4 from one endpoint and b from other. It is now an easy observation that e.g. dist(u, v(cid:48)) ≤ a + b, and if the distance is indeed a + b, pair u, v(cid:48) is already covered by hub h. Since h ∈ S(u) and h ∈ S(v(cid:48)) was already amortized by paying for edges uv and u(cid:48)v(cid:48) in Mh, there is no need for adding edge uv(cid:48), and we can ensure that Mh is indeed an induced matching (repeating the reasoning for u(cid:48)v pair). We are thus interested in structure of (linear in n) induced matchings in (potentially dense) graphs. Specifically, when looking for hubset constructions, it is advantageous for us to have an upper bound on number of induced matchings graph can be edge partitioned into. Similarly, when looking for a lowerbound construction, we are interested in an explicit construction of dense graphs edge partitioned into large induced matchings, and moreover in having such graphs realisable as a structure of unique shortest paths. The first of these questions has been studied extensively in the combinatorics literature. The Ruzsa-Szemerédi function RS(n) is a graph-theoretic function, defined as follows. Definition 1.3. An undirected, unweighted graph G on n vertices whose edges can be partitioned into at most n induced matchings is called a Ruzsa-Szemerédi graph.1 Then RS(n) is the largest value such that every Ruzsa-Szemerédi graph has at most n2/RS(n) edges. The study of values of RS(n) was initiated by [RS78] who showed that RS(n) = ω(1). Current bounds state that √ 2Ω(log∗ n) ≤ RS(n) ≤ 2O( log n) due to results of [Fox11] and [Beh46] (see [Elk10] for current best upperbound up to lower-order terms). RS(n) finds applications in algorithms and complexity theory, e.g. communication over a shared chan- nel [BLM93], PCP Theorem [HW03], property testing [AS04] and streaming algorithms [GKK12, Kap13, Kon15]. We note that another work to exploit the connections between RS(n) and the structure of shortest paths in graphs was [Bod17], although this was done for the different (distantly related) problem of con- structing distance preservers. Whereas the lite-motif of noting connections between sets of shortest paths and induced matchings is inherent to both [Bod17] and our work, the combinatorial arguments used in the respective constructions are significantly different. Using a number of combinatorial insights and properties of the hub labeling problem, we show the following result. Theorem 1.4. Any graph G = (V, E) on n vertices and O(n) edges admits a hub labeling {Sv} of average size 1 n (cid:80) v S(v) = O( RS(n)1/c ) for some constant c ≤ 7. n (See Section 4 for a detailed proof.) This result can be read twofold. First, it hints at the possibility that there are hub labeling schemes for sparse graphs with average hub size O( 2logc n ) for some 0 < c < 1, if one is to believe that the true value of RS(n) is on the side of the currently best upperbound. Secondly, it gives a (conditional) lowerbound on our lowerbound technique: one cannot hope to significantly improve the bound from Theorem 1.1 without strengthening existing bounds on value of RS(n), which is a hard open problem. n The connection between induced matchings and the structure of shortest paths leads us to the missing ingredient necessary for proving Theorem 1.1. Namely, in hard instances we are looking for, in addition to already discussed structure, we need the structure of shortest paths to realize some form of Ruzsa-Szemerédi structure, that is admit edge partion into preferably O(n/RS(n)) induced matchings of n edges. Luckily, related ideas for such constructions were explored by [AMS12]. The construction presented there involves graph with vertex set [C]d for some constants C, d, and interpreting vertices as d-dimensional vectors, the rule for connecting with edge (cid:126)x and (cid:126)y iff (cid:107)(cid:126)x − (cid:126)y(cid:107)2 2 − µ ≤ n for some chosen constant µ. We tweak the 1In the literature there exists term of (r, t)-Ruzsa-Szemerédi graph, where edges are partitioned into t induced matchings of size r. We follow the convention of [Bod17] and drop the indices. 5 construction by using [C]d × [(cid:96)] as our vertex set, interpreted as (cid:96) d-dimensional layers, and connecting with an edge only between neighbouring layers (edges go always between i-th and (i + 1)-th layer for some i). We fix (cid:96) to be a small value being in the order of diameter of the graph in the original construction - thus there is an equivalence between paths in the original graph of length (cid:96) and path in the new graph from first to last layer. Finally, we simplify the predicate deciding the existence of an edge (edges connect (cid:126)x and (cid:126)y if they differ in at most one coordinate), and ensure the uniqueness of a shortest paths by introducing weights over the edges of the graph. Distance labelings and and the Sum-Index problem. Our graph family used in the proof of Theorem 1.1 has a very regular structure. Namely, one can distinguish three (large) layers of vertices A, B, C ⊂ V , such that each layer is labeled with vectors from a high-dimensional integer grid, and the following property holds: for u(cid:126)x ∈ A and w(cid:126)z ∈ C, the unique shortest path intersects B in a single vertex that is precisely v((cid:126)x+(cid:126)z)/2 ∈ B. It is tempting to construct a family of (sparse) graphs, where shortest path length from vertices in A to vertices in C is sensitive to existence (or removal) of vertices in B. We can imagine this scenario as a game, where two players, one residing on A side, and one residing on C side of the graph, are evaluating in coordination a A × C → {0, 1} function. To our advantage, such a problem has been widely considered in communication complexity in the 1990's. Definition 1.5 (Sum-Index Problem). Let S = S0S1 . . . Sn−1 ∈ {0, 1}n. Alice holds S and a ∈ [0, n − 1]. Bob holds S and b ∈ [0, n − 1]. They both simultaneously send a messages Ma and Mb to a referee, whose goal is to compute f (Ma, Mb) = S(a+b) mod n. This problem has been first stated explicitly in [Pud94], as a single-bit-output "extract" of a {0, 1}n × [n] → {0, 1}n shift function: shiftk(x) = y, where yi = x(i+k) mod n. Analysis of shift is closely connected to a program of proving highly non-trivial lowerbounds in circuit complexity, c.f. [HG91] for a precise reduction. Informally, the goal is to prove super-linear lowerbounds on the size of circuits for some function {0, 1}n → {0, 1}n, and shift was considered a strong candidate. However, the result of [Pud94] and later [Amb96] have shown that such direction is unfeasible (at least with shift), by showing existence of sub-linear communication complexity protocols for evaluation of Sum-Index. Those results were called "unexpected" upperbounds, and the best construction up-to-date is due to [Amb96] with SUMINDEX(n) = O( n log0.25 n log n ) √ bits complexity, where SUMINDEX(n) denotes the exact bit complexity of the problem. It is also known that SUMINDEX(n) = Ω( n), cf. [BGKL03, BKL95, PRS97, NW93], and the precise complexity is still a major open problem. We prove the following reduction. √ 2 Theorem 1.6. Distance labeling in graphs on n vertices and max-degree 3 requires at least bits per vertex. log n) SUMINDEX(n) 1 √ 2Θ( (See Section 3 for a detailed proof.) We note that our linkage between distance labeling size and communication complexity lowerbounds appears to be the first advancement of the techniques in the area going beyond the graph-counting technique of [GPPR04], and actually using distribution of information as a source of hardness in labeling schemes (although links between communication complexity and related to ours topic of compact routing have been investigated in [Twi06]). One might hope that, with the advancement of communication complexity bounds, this approach will eventually result in non-trivial unconditional lowerbounds for distance labelings. 2 Lower bound on Hub Labeling This section is devoted to the proof of the following theorem. 6 Figure 1: Graph Hb,(cid:96) with b = 2 and (cid:96) = 2 (s = 4). Some edges are drawn in light gray for better readability. The blue path is the only shortest path from v0,(1,0) to v4,(3,2). It passes through v2,(2,1) (which is a point of symmetry for the path) and has length 4A + 4. The red path has length 4A + 8. Theorem 2.1. For any positive integers (cid:96) ∈ N (the number of levels) and b ∈ N (the side length parameter) there exists a graph Gb,(cid:96) such that: (cid:80) v∈V (Gb,(cid:96)) Sv ≥ 2b(cid:96) · 2−Θ(b+(cid:96)) (average size of (i) V (Gb,(cid:96)) = 2b(cid:96) · 2Θ(b+log (cid:96)) (number of nodes). (ii) ∆(Gb,(cid:96)) = 3 (maximum degree). (iii) any hub labeling {Sv} of Gb,(cid:96) satisfies: 1 V (Gb,(cid:96)) hub sets). In following we set s = 2b (the side length). We define vertex set of Hb,(cid:96) as V =(cid:83)2(cid:96) Proof. In order to construct Gb,(cid:96), we more conveniently describe a weighted graph with non-uniform length edges, Hb,(cid:96) = (V, E, w) with integer edge weights appropriately chosen from the range w(e) ∈ [1, (3(cid:96) + 1) · 22b],2 for all e ∈ E. r=0 Vi, where each level Vi, i ∈ [0, 2(cid:96)], satisfies Vi = s(cid:96) and is identified with a set of (cid:96)-dimensional vectors, Vi = {vi,(cid:126)j : (cid:126)j ∈ [0, s − 1](cid:96)}. The edges of Hb,(cid:96) are given so that we put an edge between vi,(cid:126)j and vi+1,(cid:126)j(cid:48) when (cid:126)j and (cid:126)j(cid:48) differ at most k for all k (cid:54)= c, where c = i + 1 for i < (cid:96) and c = 2(cid:96) − i for i ≥ (cid:96). on one coordinate c: that is jk = j(cid:48) The weight of of such an edge is then given as w({vi,(cid:126)j, vi+1,(cid:126)j(cid:48)}) = A + (jc − j(cid:48) c)2 where A = 3(cid:96)s2. Note that each node vi,(cid:126)j has exactly s = 2b neighbors in Vi+1 (if i < 2(cid:96)) and s neighbors in Vi−1 (if i > 0). See Figure 1 for an illustration. We convert Hb,(cid:96) into Gb,(cid:96) as follows. • We associate each vertex v of Hb,(cid:96) with two disjoint perfectly balanced binary trees T in in Gb,(cid:96), both roots being linked to v. Each tree has s leaves and depth log2 s = b. If v ∈ Vi, then leaves v and T out v 2Throughout the text, we use the integer range notation [a, b] ≡ {a, a + 1, . . . , b} and [a, b) ≡ [a, b − 1], for a, b ∈ N. 7 (1,0)(3,2)(2,1)VVV0l2l We have V (Gb,(cid:96)) ≤ V (Hb,(cid:96)) · 4s +(cid:80) of T in T out v v are labeled as vin are labeled as vout u , with u ∈ Vi−1, {u, v} ∈ E(Hb,(cid:96)) (T in u , with u ∈ Vi+1, {v, u} ∈ E(Hb,(cid:96)) (T out v is omitted when i = 0), and leaves of v is omitted when i = 2(cid:96)). • We associate each edge e = {u, v} of Hb,(cid:96), u ∈ Vi, v ∈ Vi+1 of length w(e) to a path of length w(e) − 2b + −2 with w(e) − 2b − 3 auxiliary vertices in Gb,(cid:96), starting at uout u . Note that the path length satisfies w(e) − 2b + −2 ≥ 3(cid:96)s2 − 2b − 2 > 0 for (cid:96) ≥ 1 and b ≥ 1, and that using T out u v , we obtain a path of length w({u, v}) in Gb,(cid:96) for each edge {u, v} ∈ E(Hb,(cid:96)). v and ending at vin and T in e∈E(Hb,(cid:96)) w(e) ≤ 4s · s(cid:96) · (2(cid:96) + 1) + (3(cid:96) + 1)s2 · s(cid:96) · 2(cid:96) · s, so the claims (i) and (ii) follow directly from the construction. To show claim (iii), we first observe that the following property holds. Lemma 2.2. Let (cid:126)x, (cid:126)z ∈ [0, s − 1](cid:96) be such that for all k ∈ [1, (cid:96)], zk − xk is even. Then there exists a unique shortest path in Hb,(cid:96) (and consequently also in Gb,(cid:96)) between vertices v0,(cid:126)x and v2(cid:96),(cid:126)z. Moreover, this shortest path passes through vertex v(cid:96),((cid:126)x+(cid:126)z)/2. We defer the proof of the Lemma 2.2. Now, let {Sv} be any fixed hub labeling of Gb,(cid:96). Fix arbitrarily shortest path trees Tv rooted at each v be the vertex set of the minimal subtree of Tv rooted at v which contains all vertex v of Gb,(cid:96), and let S∗ vertices of Sv. We obviously have: S∗ v ≤ diam(Gb,(cid:96)) · Sv ≤ (3(cid:96) + 1)s2 · 4(cid:96) · Sv. (1) Thus, the sets Sv and S∗ showing a lower bound on(cid:80) v∈V S∗ v. v are of equivalent size up to lower-order terms, and from now on, we focus on Consider all triplets ((cid:126)x, (cid:126)y, (cid:126)z) such that (cid:126)x, (cid:126)y, (cid:126)z ∈ [0, s − 1](cid:96) and that (cid:126)y = ((cid:126)x + (cid:126)z)/2. There is s(cid:96) · (s/2)(cid:96) such triplets. Denote x = v0,(cid:126)x, y = v(cid:96),(cid:126)y and z = v2(cid:96),(cid:126)z, then by Lemma 2.2 y lies on the unique shortest xz z . Since (cid:126)z = 2(cid:126)x − (cid:126)y, we have that value of (cid:126)z is uniquely determined by fixing path, thus y ∈ S∗ (cid:126)x and (cid:126)y, and similarly by (cid:126)x = 2(cid:126)z − (cid:126)y, value of (cid:126)x is uniquely determined by fixing (cid:126)y and (cid:126)z. Thus in each v ≥ (s(cid:96))2 · 2−(cid:96), and taking triplet ((cid:126)x, (cid:126)y, (cid:126)z), vertex y contributes by 1 to the size of S∗ into account Eq. (1), claim (iii) follows. z . Thus(cid:80) x or y ∈ S∗ x or S∗ v∈V S∗ Proof of Lemma 2.2. Finally, we prove the Lemma 2.2. We first consider the weighted graph Hb,(cid:96) only. Intuitively, we show that the unique shortest path in Hb,(cid:96) has the following structure: it climbs from level 0 to level (cid:96) on its first (cid:96) edges, reaching vertex v(cid:96),(cid:126)y, and then climbs next (cid:96) edges to level 2(cid:96); the portions of the path from v0,(cid:126)x to v(cid:96),(cid:126)y and from v(cid:96),(cid:126)y to v2(cid:96),(cid:126)z have a point symmetry with respect to v(cid:96),(cid:126)y. δi = ji Let d(v0,(cid:126)x, v2(cid:96),(cid:126)z) denote the weighted distance between the pair of nodes considered in the Lemma. Consider any path P(cid:126)x,(cid:126)z = (v(cid:126)x ≡ v0,(cid:126)j0, v1,(cid:126)j1, . . . , v2(cid:96)−1,(cid:126)j2(cid:96)−1, v2(cid:96),(cid:126)j2(cid:96) ≡ v(cid:126)z) in Hb,(cid:96) on 2(cid:96) edges. Denote i − ji−1 The following properties hold: • The weighted length of any such P(cid:126)x,(cid:126)z is: and for i ∈ [1, (cid:96)] and δi = ji 2(cid:96)−i+1 for i ∈ [(cid:96) + 1, 2(cid:96)]. 2(cid:96)−i+1 − ji−1 i 2(cid:96)(cid:88) (cid:0)A + δ2 (cid:1) ≤ 2(cid:96)A + 2(cid:96)s2 < (2(cid:96) + 1)A. i i=1 • All v0,(cid:126)xv2(cid:96),(cid:126)z paths in Hb,(cid:96) have at least 2(cid:96) edges. • Any v0,(cid:126)xv2(cid:96),(cid:126)z path in Hb,(cid:96) with at least 2(cid:96) + 1 edges has weighted length at least (2(cid:96) + 1)A, which is greater than that of P(cid:126)x,(cid:126)z. 8 √ √ • P(cid:126)x,(cid:126)z satisfies δi + δ2(cid:96)+1−i = zi − xi. It thus follows that the total length(cid:80)(cid:96) (cid:1) 2(cid:96)+1−i 2 (zi − xi), realized by an unique v0,(cid:126)xv2(cid:96),(cid:126)z path having point (cid:0)2A + δ2 i + δ2 i=1 is minimized when δi = δ2(cid:96)+1−i = 1 symmetry at v(cid:96),(cid:126)y. This finishes the proof for Hb,(cid:96). To complete the proof for Gb,(cid:96) we observe that for any u ∈ Vi and v ∈ Vj with i < j, we have distGb,(cid:96)(u, v) = distHb,(cid:96)(u, v). This comes from the construction of Gb,(cid:96) for j = i + 1 and from the fact that any Vi(cid:48) with i < i(cid:48) < j is a vertex cut in Gb,(cid:96) separating u and v for j > i + 1: any shortest path Q from u to v in Gb,(cid:96) must pass through j − i − 1 vertices in Vi+1 ∪ ··· ∪ Vj−1 corresponding to a path P in Gb,(cid:96) such that Q = w(P ). The shortest path from v0,(cid:126)x to v2(cid:96),(cid:126)z in Gb,(cid:96) is thus unique and passes through v(cid:96),((cid:126)x+(cid:126)z)/2 similarly as the shortest path in Hb,(cid:96), which concludes the proof. Setting both b = (cid:96) = log N for some appropriately chosen N = n/2Θ( log n) in Theorem 2.1 we finally obtain the main result of the Section. Theorem 1.1. Graphs of max-degree 3 require average hub size to be at least number of vertices. log n) , where n is the n √ 2Θ( 3 Lower bound for distance labeling We now show that distance labeling in sparse graphs is no easier than solving Sum-Index. We essentially use the graph construction from Theorem 1.1, and the the fact that the distance between nodes v0,(cid:126)x and v2(cid:96),(cid:126)z is sensitive to the presence (or absence) in the graph of the node v(cid:96),((cid:126)x+(cid:126)z)/2. Theorem 1.6. Distance labeling in graphs on n vertices and max-degree 3 requires at least bits per vertex. log n) SUMINDEX(n) 1 √ 2Θ( Proof. Let S be the binary vector of length m from Sum-Index Problem, with m to be determined later. We describe the strategies of Alice and Bob of constructing the messages Ma and Mb respectively. Consider graph Gb,(cid:96) from Theorem 2.1. We construct G(cid:48) b,(cid:96) by removing some vertices from layer V(cid:96) (together with all adjacent edges) from Gb,(cid:96). We denote the choice of whether to include or remove particular vertex v(cid:96),(cid:126)x as W ((cid:126)x), and we defer how we decide those to later part of the proof. Observation 3.1. Let (cid:126)x and (cid:126)z be as in Lemma 2.2, that is for any k ∈ [1, (cid:96)] zk − xk is even. Then W (((cid:126)x + (cid:126)z)/2) can be decoded based only on (cid:126)x, (cid:126)z and the length of the shortest path between v0,(cid:126)x and v2(cid:96),(cid:126)z in G(cid:48) (cid:126)x ∈ [s](cid:96) we denote repr((cid:126)x) =(cid:0)(cid:80) b,(cid:96). We also note that G(cid:48) has 2b(cid:96) · 2Θ(b+log (cid:96)) vertices and maximum degree of 3. Recall we denoted s = 2b the side-length of a layer in G (or G(cid:48)). We fix m = (s/2)(cid:96). For a vector of (cid:126)x as digits in (s/2)-ary representation. Observe that while repr() is a bijection between [0, s/2 − 1](cid:96) and [0, (s/2)(cid:96) − 1], this is not the case for the whole space [0, s − 1](cid:96) (in fact every value is in the image of 2(cid:96) vectors). We fix the predicate W ((cid:126)x) as: W ((cid:126)x) ≡ [Srepr((cid:126)x) = 1]. i xi · (s/2)i(cid:1) mod m as the integer value coming from treating coordinates The protocol for Alice is as follow: 1. Alice constructs graph G(cid:48) 2. Alice constructs a distance labeling for G(cid:48) 3. Alice finds unique (cid:126)x ∈ [0, s/2 − 1](cid:96) such that repr((cid:126)x) = a (based on the (s/2)-ary representation of b,(cid:96) based on binary word S ∈ {0, 1}m. b,(cid:96). a). 9 4. Alice sends to the referee the label of vertex v0,2(cid:126)x together with integer a. Bob proceeds analogously, representing b as vector (cid:126)z, constructing the same distance labeling of G(cid:48) b,(cid:96) as Alice and sending the label of v2(cid:96),2(cid:126)z with integer b. The referee is then able to compute distance between Alice's and Bob's vertices, reconstructs vectors (cid:126)x and (cid:126)z, and by the Observation 3.1 knows the bit Srepr((cid:126)x+(cid:126)z) = S(a+b) mod m, which follows from repr((cid:126)x+(cid:126)z) = (repr((cid:126)x)+repr((cid:126)z)) mod m = (a+b) mod m. We thus reach the conclusion that distance labeling of sparse graph with 2b(cid:96) · 2Θ(b+log (cid:96)) requires at least SUMINDEX(2(b−1)(cid:96)) − b(cid:96) bits per label. Fixing b = (cid:96) = log n) finishes the n √ proof. log N for some N = √ 2Θ( 4 Upper bound In this section we show how to take advantage of a structure of induced matchings in dense graphs to construct hubsets. We start by considering a case of graphs of constant maxdegree. Theorem 4.1. Any graph G = (V, E) on n vertices and maxdegree ∆ = O(1) admits a hub labeling {Sv} of total size(cid:80) v Sv = O( n2 RS(n)1/c ) for some constant c ≤ 7. Huv ≥ D, then we put v ∈ Qu. By the property of S, we have(cid:80) Proof. Let D be a parameter 1 ≤ D ≤ RS(n) to be fixed later. For any pair of vertices u, v we denote Huv the set of all valid hubs for this pair, that is Huv ≡ {x : dist(u, x) + dist(x, v) = dist(u, v)}. We start by formulating the following property for a set S ⊆ V : (∗) for two vertices u, v such that Huv ≥ D, we have S ∩ Huv (cid:54)= ∅. There exists a set S such that S = O( n D log D) and (∗) is satisfied for all pairs uv except n2 D many. Existence of such set can proven by probabilistic method (c.f. [BCE05]). Indeed, pick such set uniformly at random with S = n D ln D. Any pair u, v with at least D hubs is not covered with probability at most (1 − D/n)S ≤ 1/D, thus the expected number of uncovered pairs is at most n2/D, and there is a selection of S with at most that many pairs not covered. From now on we focus on such S, and we denote by {Qv} a family of sets such that if a pair uv is not covered by S and satisfies We now color all vertices of G with D3 colors, so that for each v ∈ V , the color cv ∈ [1, D3] is assigned independently and uniformly at random. Consider the following event: for a pair u, v, each vertex from Huv is assigned a different color. If Huv ≤ D, then such an event happens with probability at least 1 − 1/D, and the opposite event with probability at most 1/D. If we define sets {Ru} = {v : there are x, y ∈ Hu,v such that cx = cy}, then by simple computation of expected value, there is a choice of colors cv such v Rv ≤ n2/D. Thus we can afford for each v to store as hubs Rv, the vertices where coloring of potential hubs failed to assign unique colors. We now deal with u, v such that Huv ≤ D and Huv was properly colored using different colors. First, we iterate through a, b ≥ 0 such that 1 ≤ a + b ≤ D and iterate h ∈ V . Consider bipartite graph (V, V, Eh a,b), a,b ⊆ V × V . For u, v we put (u, v) ∈ Eh a,b if the following conditions hold: (i) Huv ≤ D, (ii) each Eh vertex of Huv was colored using distinct color, (iii) h ∈ Huv, dist(u, h) = a and dist(h, v) = b. We now use the following Lemma, with proof provided later: Lemma 4.2. Construct {Fv} as follow: a, b iterate so that 1 ≤ a + b ≤ D and h iterate over V , and consider a,b). If v ∈ V1 ∪ V2, we put h into Fv. We then some minimum vertex cover (V1, V2), V1, V2 ⊆ V of (V, V, Eh v∈V Qv ≤ n2/D. that(cid:80) have(cid:80) v Fv = O(D5 n2 RS(n) ). For X ⊆ V , let N (X) = {v : ∃x∈Xdist(v, x) ≤ 1} denote neighborhood. We observe, that for any two vertices u, v, one of the following holds: 10 1. If Huv ≥ D, then either there exists h ∈ S such that h ∈ Huv is a hub for u, v, or v ∈ Qu is a hub for u, v. 2. If Huv ≤ D and there is a color conflict in Huv, then v ∈ Ru is a hub for u, v. 3. If Huv ≤ D and there is no color conflict in Huv, then for any h ∈ Huv, there are a = dist(u, h) and b = dist(h, v) such that (u, v) ∈ Eh a,b. Thus at least one of u, v is in the corresponding vertex cover, and so h ∈ Fu or h ∈ Fv. Since this holds for any h ∈ Huv, and w.l.o.g. u ∈ Fu, v ∈ Fv, by induction along a uv-shortest path there is an edge (x, y) ∈ E such that x ∈ Fu and y ∈ Fv and x, y ∈ Huv, guaranteeing that N (Fu) ∩ N (Fv) (cid:54)= ∅. We then set each vertex hubset Hv = S ∪ Qv ∪ Rv ∪ N (Fv). A bound on size follows (cid:80) n·S +(cid:80) v Rv + (∆ + 1)(cid:80) v Hv ≤ RS(n) ) using Lemma 4.2. v Qv +(cid:80) D log D) +O( n2 D ) +O(D5 n2 v Fv ≤ O( n2 Setting D = RS(n)1/6 completes the proof. a,b ≤ 2M M h a,b. For each color c, consider bipartite graph Gc Proof of Lemma 4.2. Fix values a, b and h and vertex cover V Ch a,b used in that iteration. By relation a,b ⊆ Eh a,b satisfies between maximum matching and minimum vertex cover, any maximal matching M M h V Ch a,b. We now show h:ch=c M M h It is enough to show the following: for any two that M M h distinct (u1, v1), (u2, v2) ∈ M M h a,b. Assume otherwise, that (u1, v2) ∈ M M h(cid:48) a,b due to M M h a,b being a matching). We know that dist(u1, h) = a and dist(h, v2) = b, and each vertex of Hu1v2 was colored using a different color, thus either dist(u1, v2) < a + b or ch(cid:48) (cid:54)= ch, a contradiction. a,b and (u2, v1) (cid:54)∈ Gc a,b for some h(cid:48) (cid:54)= h (we know we can exclude (u1, v2) ∈ M M h a,b is in fact an induced matching in Gc a,b, we have (u1, v2) (cid:54)∈ Gc a,b =(cid:83) a,b. a,b is a Ruzsa-Szemerédi graph (on 2n vertices), with edge partition into induced RS(n) ).3 We then obtain the RS(2n) = O( n2 This shows that Gc matchings M M h following bound: (cid:88) a,b ≤ (2n)2 a,b for h : ch = c. It thus follows that Gc (cid:88) (cid:88) (cid:88) Fv ≤ (cid:88) ≤ (cid:88) ≤ (cid:88) a,b V Ch a,b 2M M h a,b 2Gc 1≤a+b≤D h∈V 1≤a+b≤D h∈V v∈V c∈[1,D3] 1≤a+b≤D = O(D5 n2 RS(n) ). Note that the construction used in proof of Theorem 4.1 generalizes to edges with {0, 1} weights since any path length c ≤ D still decomposes in at most D sums c = a + b of two path lengths. We now note that if G is a graph of constant average degree, that is m/n = O(1), then we can reduce construction of hub labeling to constant max degree case as follow. First, we construct G(cid:48) by subdividing any vertex v ∈ V (G) of degree deg(v) into (cid:100) deg(v) (cid:100)m/n(cid:101)(cid:101) vertices of degree at most 2 +(cid:100)m/n(cid:101), using a path with weight-0 auxiliary edges for linking them (treating all the non-auxiliary edges as weight-1 edges). We have then E(G(cid:48)) = O(m) and V (G(cid:48)) = O(m). We note that for any v(cid:48) ∈ V (G(cid:48)) there is v ∈ V (G) that originated v(cid:48), and for any 3It is straightforward to show RS(2n) = Θ(RS(n)). 11 v ∈ V (G) we can pick one v(cid:48) ∈ V (G(cid:48)) as a representative of v in G(cid:48). Having constructed hub labeling for G(cid:48), denote it {H(cid:48) v}, we construct a hubset of v ∈ V (G) by taking hubset of its representative in G(cid:48) and projecting back each selected hub in G(cid:48) to its original vertex in G. We thus have reached our main result on the side of upper bounds. Theorem 1.4. Any graph G = (V, E) on n vertices and O(n) edges admits a hub labeling {Sv} of average size 1 n (cid:80) v S(v) = O( RS(n)1/c ) for some constant c ≤ 7. n References [ADF+16] Ittai Abraham, Daniel Delling, Amos Fiat, Andrew V. Goldberg, and Renato F. Werneck. Highway dimension and provably efficient shortest path algorithms. J. ACM, 63(5):41:1 -- 41:26, 2016. [ADGW12] Ittai Abraham, Daniel Delling, Andrew V. Goldberg, and Renato F. Werneck. Hierarchical hub labelings for shortest paths. In ESA, pages 24 -- 35, 2012. [ADKP16] Stephen Alstrup, Søren Dahlgaard, Mathias Baek Tejs Knudsen, and Ely Porat. Sublinear distance labeling. In ESA, pages 5:1 -- 5:15, 2016. [AG11] Ittai Abraham and Cyril Gavoille. On approximate distance labels and routing schemes with affine stretch. In DISC, pages 404 -- 415, 2011. [AGHP16a] Stephen Alstrup, Cyril Gavoille, Esben Bistrup Halvorsen, and Holger Petersen. Simpler, faster and shorter labels for distances in graphs. In SODA, pages 338 -- 350, 2016. [AGHP16b] Stephen Alstrup, Inge Li Gørtz, Esben Bistrup Halvorsen, and Ely Porat. Distance labeling schemes for trees. In ICALP, pages 132:1 -- 132:16, 2016. [AGMW18] Amir Abboud, Paweł Gawrychowski, Shay Mozes, and Oren Weimann. Near-optimal compres- sion for the planar graph metric. In SODA, pages 530 -- 549, 2018. [Amb96] [AMS12] [AS04] [BCE05] [BD10] [Beh46] Andris Ambainis. Upper bounds on multiparty communication complexity of shifts. In STACS, pages 631 -- 642, 1996. Noga Alon, Ankur Moitra, and Benny Sudakov. Nearly complete graphs decomposable into large induced matchings and their applications. In STOC, pages 1079 -- 1090, 2012. Noga Alon and Asaf Shapira. Testing subgraphs in directed graphs. J. Comput. Syst. Sci., 69(3):354 -- 382, 2004. Béla Bollobás, Don Coppersmith, and Michael Elkin. Sparse distance preservers and additive spanners. SIAM Journal on Discrete Mathematics, 19(4):1029 -- 1055, 2005. Reinhard Bauer and Daniel Delling. SHARC: Fast and robust unidirectional routing. J. Exp. Algorithmics, 14:4:2.4 -- 4:2.29, January 2010. Felix A Behrend. On sets of integers which contain no three terms in arithmetical progression. Proceedings of the National Academy of Sciences of the United States of America, 32(12):331, 1946. 12 [BGKL03] László Babai, Anna Gál, Peter G. Kimmel, and Satyanarayana V. Lokam. Communication complexity of simultaneous messages. SIAM J. Comput., 33(1):137 -- 166, 2003. [BKL95] [BLM93] László Babai, Peter G. Kimmel, and Satyanarayana V. Lokam. Simultaneous messages vs. communication. In STACS, pages 361 -- 372, 1995. Yitzhak Birk, Nathan Linial, and Roy Meshulam. On the uniform-traffic capacity of single-hop interconnections employing shared directional multichannels. IEEE Trans. Information Theory, 39(1):186 -- 191, 1993. [Bod17] Greg Bodwin. Linear size distance preservers. In SODA, pages 600 -- 615, 2017. [CHKZ03] Edith Cohen, Eran Halperin, Haim Kaplan, and Uri Zwick. Reachability and distance queries via 2-hop labels. SIAM J. Comput., 32(5):1338 -- 1355, May 2003. [CP10] [Elk10] Hagai Cohen and Ely Porat. On the hardness of distance oracle for sparse graph. CoRR, abs/1006.1117, 2010. Michael Elkin. An improved construction of progression-free sets. In SODA, pages 886 -- 905, 2010. [FGNW17] Ofer Freedman, Paweł Gawrychowski, Patrick K. Nicholson, and Oren Weimann. Optimal distance labeling schemes for trees. In PODC, pages 185 -- 194, 2017. [Fox11] [GKK12] [GKU16] [GP72] Jacob Fox. A new proof of the graph removal lemma. Annals of Mathematics, pages 561 -- 579, 2011. Ashish Goel, Michael Kapralov, and Sanjeev Khanna. On the communication and streaming complexity of maximum bipartite matching. In SODA, pages 468 -- 485, 2012. Paweł Gawrychowski, Adrian Kosowski, and Przemysław Uzna´nski. Sublinear-space distance labeling using hubs. In DISC, pages 230 -- 242, 2016. R.L. Graham and H.O. Pollak. On embedding graphs in squashed cubes. In Y. Alavi, D.R. Lick, and A.T. White, editors, Graph Theory and Applications, volume 303 of Lecture Notes in Mathematics, pages 99 -- 110. Springer Berlin Heidelberg, 1972. [GPPR04] Cyril Gavoille, David Peleg, Stéphane Pérennes, and Ran Raz. Distance labeling in graphs. J. Algorithms, 53(1):85 -- 112, October 2004. [GU16] [HG91] [HW03] [Kap13] Paweł Gawrychowski and Przemysław Uzna´nski. A note on distance labeling in planar graphs. CoRR, abs/1611.06529, 2016. Johan Håstad and Mikael Goldmann. On the power of small-depth threshold circuits. Computa- tional Complexity, 1:113 -- 129, 1991. Johan Håstad and Avi Wigderson. Simple analysis of graph tests for linearity and PCP. Random Struct. Algorithms, 22(2):139 -- 160, 2003. Michael Kapralov. Better bounds for matchings in the streaming model. In SODA, pages 1679 -- 1697, 2013. [KMS06] Ekkehard Köhler, Rolf H. Möhring, and Heiko Schilling. Fast point-to-point shortest path computations with arc-flags. In 9th DIMACS Implementation Challenge, 2006. 13 [Kon15] Christian Konrad. Maximum matching in turnstile streams. In ESA, pages 840 -- 852, 2015. [NW93] [Pel00] [PRS97] [Pud94] [RS78] Noam Nisan and Avi Wigderson. Rounds in communication complexity revisited. SIAM J. Comput., 22(1):211 -- 219, 1993. David Peleg. Proximity-preserving labeling schemes. Journal of Graph Theory, 33(3):167 -- 176, 2000. Pavel Pudlák, Vojtech Rödl, and Jirí Sgall. Boolean circuits, tensor ranks, and communication complexity. SIAM J. Comput., 26(3):605 -- 633, 1997. Pavel Pudlák. Unexpected upper bounds on the complexity of some communication games. In ICALP, pages 1 -- 10, 1994. Imre Z. Ruzsa and Endre Szemerédi. Triple systems with no six points carrying three triangles. Combinatorics (Keszthely, 1976), Coll. Math. Soc. J. Bolyai, 18:939 -- 945, 1978. [SVY09] Christian Sommer, Elad Verbin, and Wei Yu. Distance oracles for sparse graphs. In FOCS, pages 703 -- 712, 2009. [Twi06] [WP11] Andrew D Twigg. Compact forbidden-set routing. Technical report, University of Cambridge, Computer Laboratory, 2006. Oren Weimann and David Peleg. A note on exact distance labeling. 111(14):671 -- 673, 2011. Inf. Process. Lett., 14
1807.09898
1
1807
2018-07-25T23:26:43
Mildly Exponential Time Approximation Algorithms for Vertex Cover, Uniform Sparsest Cut and Related Problems
[ "cs.DS" ]
In this work, we study the trade-off between the running time of approximation algorithms and their approximation guarantees. By leveraging a structure of the `hard' instances of the Arora-Rao-Vazirani lemma [JACM'09], we show that the Sum-of-Squares hierarchy can be adapted to provide `fast', but still exponential time, approximation algorithms for several problems in the regime where they are believed to be NP-hard. Specifically, our framework yields the following algorithms; here $n$ denote the number of vertices of the graph and $r$ can be any positive real number greater than 1 (possibly depending on $n$). (i) A $\left(2 - \frac{1}{O(r)}\right)$-approximation algorithm for Vertex Cover that runs in $\exp\left(\frac{n}{2^{r^2}}\right)n^{O(1)}$ time. (ii) An $O(r)$-approximation algorithms for Uniform Sparsest Cut, Balanced Separator, Minimum UnCut and Minimum 2CNF Deletion that runs in $\exp\left(\frac{n}{2^{r^2}}\right)n^{O(1)}$ time. Our algorithm for Vertex Cover improves upon Bansal et al.'s algorithm [arXiv:1708.03515] which achieves $\left(2 - \frac{1}{O(r)}\right)$-approximation in time $\exp\left(\frac{n}{r^r}\right)n^{O(1)}$. For the remaining problems, our algorithms improve upon $O(r)$-approximation $\exp\left(\frac{n}{2^r}\right)n^{O(1)}$-time algorithms that follow from a work of Charikar et al. [SIAM J. Comput.'10].
cs.DS
cs
Mildly Exponential Time Approximation Algorithms for Vertex Cover, Uniform Sparsest Cut and Related Problems Pasin Manurangsi∗ UC Berkeley Luca Trevisan† UC Berkeley July 27, 2018 Abstract In this work, we study the trade-off between the running time of approximation algorithms and their approximation guarantees. By leveraging a structure of the "hard" instances of the Arora-Rao-Vazirani lemma [ARV09, Lee05], we show that the Sum-of-Squares hierarchy can be adapted to provide "fast", but still exponential time, approximation algorithms for several problems in the regime where they are believed to be NP-hard. Specifically, our framework yields the following algorithms; here n denote the number of vertices of the graph and r can be any positive real number greater than 1 (possibly depending on n). • A(cid:16)2 − 1 2r2(cid:17) nO(1) time. • An O(r)-approximation algorithms for Uniform Sparsest Cut, Balanced Separator, Mini- mum UnCut and Minimum 2CNF Deletion that runs in exp(cid:16) n O(r)(cid:17)-approximation algorithm for Vertex Cover that runs in exp(cid:16) n 2r2(cid:17) nO(1) time. Our algorithm for Vertex Cover improves upon Bansal et al.'s algorithm [BCL+17] which achieves (cid:16)2 − 1 O(r)(cid:17)-approximation in time exp(cid:0) n algorithms improve upon O(r)-approximation exp(cid:0) n a work of Charikar et al. [CMM10]. rr(cid:1) nO(1). For the remaining problems, our 2r(cid:1) nO(1)-time algorithms that follow from 1 Introduction Approximation algorithms and fast (sub)exponential time exact algorithms are among the two most popular approaches employed to tackle NP-hard problems. While both have had their fair share of successes, they seem to hit roadblocks for a number of reasons; the PCP theorem [AS98, ALM+98] and the theory of hardness of approximation developed from it have established, for many optimization problems, that trivial algorithms are the best one could hope for (in polynomial time). On the other hand, the Exponential Time Hypothesis (ETH) [IP01, IPZ01] and the fine- grained reductions surrounding it have demonstrated that "brute force" algorithms are, or at least close to, the fastest possible for numerous natural problems. These barriers have led to studies in the cross-fertilization between the two fields, in which one attempts to apply both techniques simultaneously to overcome known lower bounds. Generally ∗Email: [email protected]. †Email: [email protected]. 1 speaking, these works study the trade-offs between the running time of the algorithms and the approximation ratio. In other words, a typical question arising here is: what is the best running time for an algorithm with a given approximation ratio τ? Optimization problems often admit natural "limited brute force" approximation algorithms that use brute force to find the optimal solution restricted to a subset of variables and then extend this to a whole solution. Similar to the study of fast exact algorithms for which a general motivating question is whether one can gain a noticeable speedup over "brute force", the analogous question when dealing with approximation algorithms is whether one can do significantly better than these limited brute force algorithms. For example, let us consider the E3SAT problem, which is to determine whether a given 3CNF formula is satisfiable. The brute force (exact) algorithm runs in 2O(n) time, while ETH asserts that it requires 2Ω(n) time to solve the problem. The optimization version of E3SAT is the Max E3SAT problem, where the goal is to find an assignment that satisfies as many clauses as possible. On the purely approximation front, a trivial algorithm that assigns every variable uniformly indepen- dently at random gives 7/8-approximation for Max E3SAT, while Hastad's seminal work [Hås01] established NP-hardness for obtaining (7/8 + ε)-approximation for any constant ε > 0. The "lim- ited brute force" algorithm for Max E3SAT chooses a subset of O(εn) variables, enumerates all possible assignments to those variables and picks values of the remaining variables randomly; this achieves (7/8 + ε)-approximation in time 2O(εn). Interestingly, it is known that running time of 2Ω(poly(ε)n) is necessary to gain a (7/8 + ε)-approximation if one uses Sum-of-Squares relax- ations [Gri01, Sch08, KMOW17], which gives some evidence that the running time of "limited brute force" (7/8 + ε) approximation algorithms for Max E3SAT are close to best possible. In contrast to Max E3SAT, one can do much better than "limited brute force" for Unique Games. Specifically, Arora et al. [AIMS10] show that one can satisfy an ε fraction of clauses in a (1 − ε)- satisfiable instance of Unique Games in time 2n/ex p(1/ε), a significant improvement over the trivial 2O(εn) time "limited brute force" algorithm. This algorithm was later improved by the celebrated algorithm of Arora, Barak and Steurer [ABS15] that runs in time 2n poly(ε). A number of approximation problems, such as (2 − ε)-approximation of Vertex Cover [KR08, BK09], (0.878· · · + ε) approximation of Max Cut [KKMO07], and constant approximation of Non- uniform Sparsest Cut [CKK+06, KV15] are known to be at least as hard as Unique Games, but are not known to be equivalent to Unique Games. If they were equivalent, the subexponential algorithm of [ABS15] would also extend to these other problems. It is then natural to ask whether these problems admit subexponential time algorithms, or at least "better than brute force" algo- rithms. Indeed, attempts have been made to design such algorithms [ABS15, GS11], although these algorithms only achieve significant speed-up for specific classes of instances, not all worst case instances. Recently, Bansal et al. [BCL+17] presented a "better than brute force" algorithm for Vertex Cover, which achieve a (2 − 1/O(r))-approximation in time 2O(n/rr). Note that the trade-off between approximation and running time is more analogous to the [AIMS10] algorithm for Unique Games than with the "limited brute force" algorithm for Max 3ESAT discussed above. The algorithm of Bansal et al. is partially combinatorial and is based on a reduction to the Vertex Cover problem in bounded-degree graphs, for which better approximation algorithms are known 2 compared to general graphs. Curiously, the work of Bansal et al. does not subsume the best known polynomial time algorithm for Vertex Cover: Karakostas [Kar09] shows that there is a polynomial time algorithm for Vertex Cover that achieves a (cid:18)2 − Ω(1)√log n(cid:19) approximation ratio, but if one set r := plog n in the algorithm of Bansal et al. one does not get a polynomial running time. This overview raises a number of interesting questions: is it possible to replicate, or improve, the vertex cover approximation of Bansal et al. [BCL+17] using Sum-of-Square relaxations? A positive result would show that, in a precise sense, (7/8 + ε) approximation of Max 3SAT is "harder" than (2 − ε) approximation for Vertex Cover (since the former requires poly(ε) · n rounds while the latter would be achievable with n/ exp(1/ε) rounds). Is it possible to have a "better than brute force" approximation algorithm for Vertex Cover that recovers Karakostas's algorithm as a special case? Is it possible to do the same for other problems that are known to be Unique-Games-hard but not NP-hard, such as constant-factor approximation of Balanced Separator? 1.1 Our Results In this work, we answer the above questions affirmatively by designing "fast" exponential time approximation algorithms for Vertex Cover, Uniform Sparsest Cut and related problems. For Ver- tex Cover, our algorithm gives (2− 1/O(r))-approximation in time exp(n/2r2 )nO(1) where n is the number of vertices in the input graph and r is a parameter that can be any real number at least one (and can depend on n). This improves upon the aforementioned recent algorithm of Bansal et al. [BCL+17] which, for a similar approximation ratio, runs in time exp(n/rr)nO(1). For the remaining problems, our algorithms give O(r)-approximation in the same running time, which improves upon a known O(r)-approximation algorithms with running time exp(n/2r)nO(1) that follow from [CMM10] (see the end of Section 1.2 for more details): Theorem 1.1 (Main) For any r > 1, there is an exp(n/2r2 algorithm for Vertex Cover on n-vertex graphs, and, there are exp(n/2r2 algorithms for Uniform Sparsest Cut, Balanced Separator, Min UnCut and Min 2CNF Deletion. )nO(1)-time (2 − 1/O(r))-approximation )nO(1)-time O(r)-approximation We remark that, when r = Cplog n for a sufficiently large constant C, our algorithms co- incide with the best polynomial time algorithms known for these problems [Kar09, ARV09, ACMM05]. 1.2 Other Related Works To prove Theorem 1.1, we use the Sum-of-Square relaxations of the problems and employ the conditioning framework from [BRS11, RT12] together with the main structural lemma from Arora, Rao and Vazirani's work [ARV09]. We will describe how these parts fit together in Section 2. Before we do so, let us briefly discuss some related works not yet mentioned. Sum-of-Square Relaxation and the Conditioning Framework. The Sum-of-Square (SoS) algo- rithm [Nes00, Par00, Las02] is a generic yet powerful meta-algorithm that can be utilized to any polynomial optimization problems. The approach has found numerous applications in both con- tinuous and combinatorial optimization problems. Most relevant to our work is the conditioning framework developed in [BRS11, RT12]. Barak et al. [BRS11] used it to provide an algorithm for Unique Games with similar guarantee to [ABS15], while Raghavendra and Tan [RT12] used the 3 technique to give improved approximation algorithms for CSPs with cardinality constraints. A high-level overview of this framework is given in Sections 2.2 and 2.3. Approximability of Vertex Cover, Sparsest Cut and Related Problems. All problems studied in our work are very well studied in the field of approximation algorithms and hardness of ap- proximation. For Vertex Cover, the greedy 2-approximation algorithm has been known since the 70's (see e.g. [GJ79]). Better (2 − Ω( log log n log n ))-approximation algorithms were independently dis- covered in [BYE85] and [MS85]. These were finally improved by Karakostas [Kar09] who used the ARV Structural Theorem to provide a (2 − Ω(1/plog n))-approximation for the problem. On the lower bound side, Hastad [Hås01] show that (7/6 − ε)-approximation for Vertex Cover is NP-hard. The ratio was improved in [DS05] to 1.36. The line of works that very recently ob- tained the proof of the (imperfect) 2-to-1 game conjecture [KMS17, DKK+16, DKK+17, KMS18] also yield NP-hardness of (√2 − ε)-approximate Vertex Cover as a byproduct. On the other hand, the Unique Games Conjecture (UGC) [Kho02] implies that approximating Vertex Cover to within a factor (2 − ε) is NP-hard [KR08, BK09]. We remark here that only Hastad reduction (together with Moshkovitz-Raz PCP [MR10]) implies an almost exponential lower bond in terms of the running time, assuming ETH. Putting it differently, it could be the case that Vertex Cover can be approximated to within a factor 1.2 in time say 2O(√n), without refuting any complexity con- jectures or hypotheses mentioned here. Indeed, the question of whether a subexponential time (2 − ε)-approximation algorithm for Vertex Cover exists for some constant ε > 0 was listed as an "interesting" open question in [ABS15], and it remains so even after our work. As for (Uniform) Sparsest Cut and Balanced Separator, they were both studied by Leighton and Rao who gave O(log n)-approximation algorithms for the problems [LR99]. The ratio was im- proved in [ARV09] to O(plog n). In terms of hardness of approximation, these problems are not known to be NP-hard or even UGC-hard to approximate to even just 1.001 factor. (In contrast, the non-uniform versions of both problems are hard to approximate under UGC [CKK+06, KV15].) Fortunately, inapproximability results of Sparsest Cut and Balanced Separator are known under stronger assumptions [Fei02, Kho06, RST12]. Specifically, Raghavendra et al. [RST12] shows that both problems are hard to approximate to any constant factor under the Small Set Expansion Hy- pothesis (SSEH) [RS10]. While it is not known whether SSEH follows from UGC, they are similar in many aspects, and indeed subexponential time algorithms for Unique Games [ABS15, BRS11] also work for the Small Set Expansion problem. This means, for example, that there could be an O(1)-approximation algorithm for both problems in subexponential time without contradicting with any of the conjectures. Whether such algorithm exists remains an intriguing open ques- tion. Finally, both Min UnCut and Min 2CNF Deletion are shown to be approximable to within a factor of O(plog n) in polynomial time by Agarwal et al. [ACMM05], which improves upon previous known O(log n)-approximation algorithm for Min UnCut and O(log n log log n)-approximation algorithm for Min 2CNF Deletion by Garg et al. [GVY96] and Klein et al. [KPRT97] respectively. On the hardness side, both problems are known to be NP-hard to approximate to within (1 + ε) factor for some ε > 0 [PY91]. Furthermore, both are UGC-hard to approximate to within any constant factor [KKMO07, CKK+06, KV15]. That is, the situations for both problems are quite similar to Sparsest Cut and Balanced Separator: it is still open whether there are subexponential time algorithms that yield O(1)-approximation for Min UnCut and Min 2CNF Deletion. 4 Fast Exponential Time Approximation Algorithms. As mentioned earlier, Bansal et al. [BCL+17] recently gave a "better than brute force" approximation algorithm for Vertex Cover. Their tech- nique is to first observe that we can use branch-and-bound on the high-degree vertices; once only the low-degree vertices are left, they use Halperin's (polynomial time) approximation al- gorithm for Vertex Cover on bounded degree graphs [Hal02] to obtain a good approximation. This approach is totally different than ours, and, given that the only way known to obtain (2 − Ω(1/plog n))-approximation in polynomial time is via the ARV Theorem, it is unlikely that their approach can be improved to achieve similar trade-off as ours. [BCL+17] is not the first work that gives exponential time approximation algorithms for Vertex Cover. Prior to their work, Bourgeois et al. [BEP11] gives a (2 − 1/O(r))-approximation exp(n/r)- time algorithm for Vertex Cover; this is indeed a certain variant of the "limited brute force" algo- rithm. Furthermore, Bansal et al. [BCL+17] remarked in their manuscript that Williams and Yu have also independently come up with algorithms with similar guarantees to theirs, but, to the best of our knowledge, Williams and Yu's work is not yet made publicly available. For Sparsest Cut, Balanced Separator, Min UnCut and Min 2CNF Deletion, it is possible to derive O(r)-approximation algorithms that run in exp(n/2r)-time from a work of Charikar et al. [CMM10]. In particular, it was shown in [CMM10] that, for any metric space of n elements, if every subset of n/2r elements can be embedded isometrically into ℓ1, then the whole space can be embedded into ℓ1 with distortion O(r). Since d-level of Sherali-Adams (SA) relaxations for these problems ensure that every d-size subset of the corresponding distance metric space can be em- bedded isometrically into ℓ1, (n/2r)-level of SA relaxations, which can be solved in exp(n/2Ω(r)) time, ensures that the entire metric space can be embedded into ℓ1 with distortion O(r). An algo- rithm with approximation ratio O(r) can be derived from here, by following the corresponding polynomial time algorithm for each of the problems ([LR99, Kar09, ACMM05]). Organization In the next section, we describe the overview of our algorithms. Then, in Section 3, we formalize the notations and state some preliminaries. The main lemma regarding conditioned SoS solution and its structure is proved in Section 4. This lemma is subsequently used in all our algorithms which are presented in Section 5. We conclude our paper with several open questions in Sec- tion 6. 2 Overview of Technique Our algorithms follow the "conditioning" framework developed in [BRS11, RT12]. In fact, our algorithms are very simple provided the tools from this line of work, and the ARV structural theorem from [ARV09, Lee05]. To describe the ideas behind our algorithm, we will first briefly explains the ARV structural theorem and how conditioning works with Sum-of-Squares hierarchy in the next two subsections. Then, in the final subsection of this section, we describe the main insight behind our algorithms. For the ease of explaining the main ideas, we will sometimes be informal in this section; all algorithms and proofs will be formalized in the sequel. For concreteness, we will use the c-Balanced Separator problem as the running example in this section. In the c-Balanced Separator problem, we are given a graph G = (V, E) and the goal is to find a partition of V into S0 and S1 = V \ S0 that minimizes the number of edges across the 5 cut (S0, S1) while also ensuring that S0, S1 > c′n for some constant c′ ∈ (0, c) where n = V. Note that the approximation ratio is the ratio between the number of edges cut by the solution and the optimal under the condition S0, S1 > cn. (That is, this is a pseudo approximation rather than a true approximation.) For the purpose of exposition, we focus only on the case where c = 1/3. 2.1 The ARV Structural Theorem The geometric relaxation used in [ARV09] embeds each vertex i ∈ V into a point vi ∈ Rd such that kvik2 = 1. For a partition (S0, S1), the intended solution is vi = v∅ if i ∈ S0 and vi = −v∅ other- 4kvi − vjk2 wise, where v∅ is some unit vector. As a result, the objective function here is ∑(i,j)∈E 2, and the cardinality condition S0, S1 > n/3 is enforced by ∑i,j∈V kvi − vjk2 2 > 8n/9. Furthermore, Arora et al. [ARV09] also employ the triangle inequality: kvi − vjk2 2 for all i, j, k ∈ V. In other words, this relaxation can be written as follows. 2 6 kvi − vkk2 2 + kvk − vjk2 1 minimize ∑ (i,j)∈E subject to ∑ 2 1 4kvi − vjk2 i,j∈[n] kvi − vjk2 kvik2 2 = 1 kvi − vjk2 2 > 8n/9 (1) (2) (3) (4) ∀i ∈ V ∀i, j, k ∈ V 2 6 kvi − vkk2 2 + kvk − vjk2 2 Note here that the above relaxation can be phrased as a semidefinite program and hence can be solved to arbitrarily accuracy in polynomial time. The key insight shown by Arora et al. is that, given a solution {vi}i∈V to the above problem, one can find two sets of vertices T, T′ that are Ω(1/plog n) apart from each other, as stated below. Note that this version is in fact from [Lee05]; the original theorem of [ARV09] has a worst parameter with ∆ = Ω((log n)2/3). Theorem 2.1 (ARV Structural Theorem [ARV09, Lee05]) Let {vi}i∈V be any vectors in Rd satisfy- ing (2), (3), (4). There exist disjoint sets T, T′ ⊆ V each of size Ω(n) such that, for every i ∈ T and j ∈ T′, kvi − vjk2 2 > ∆ = Ω(1/plog n). Moreover, such sets can be found in randomized polynomial time. It should be noted that, given the above theorem, it is easy to arrive at the Ω(1/plog n)- In particular, we can pick a number θ approximation algorithm for balanced separator. uniformly at random from [0, ∆) and then output S0 = {i ∈ V ∃j ∈ T, kvi − vjk2 2 6 θ} It is easy to check that the probability that each edge (i, j) ∈ E is cut is and S1 = V \ S0. 2/∆ = O(plog n · kvi − vjk2 at most kvi − vjk2 2). Moreover, we have S0 > T > Ω(n) and S1 > T′ > Ω(n), meaning that we have arrived at an O(plog n)-approximate solution for Balanced Separator. An interesting aspect of the proof of [Lee05] is that the bound on ∆ can be improved if the solution {vi}i∈V is "hollow" in the following sense: for every i ∈ V, the ball of radius1 0.1 around i contains few other vectors vj's. In particular, if there are only m such vj's, then ∆ can be made Ω(1/plog m), 1Here 0.1 can be changed to arbitrary positive constant; we only use it to avoid introducing additional parameters. 6 instead of Ω(1/plog n) in the above version. We will indeed use this more fine-grained version (in a black-box manner) in our algorithms. To the best of our knowledge, this version of the theorem has not yet been used in other applications of the ARV Structural Theorem. Theorem 2.2 (Refined ARV Structural Theorem [ARV09, Lee05]) Let {vi}i∈V be any vectors in Rd satisfying (2), (3), (4). Moreover, let m = maxi∈V {j ∈ V kvi − vjk2 2 6 0.01}. There exist disjoint sets T, T′ ⊆ V each of size Ω(n) such that, for every i ∈ T and j ∈ T′, kvi − vjk2 2 > ∆ = Ω(1/plog m). Moreover, such sets can be found in randomized polynomial time. 2.2 Conditioning in Sum-of-Square Hierarchies Another crucial tool used in our algorithm is Sum-of-Square hierarchy and the conditioning tech- nique developed in [BRS11, RT12]. Perhaps the most natural interpretation of the sum-of-square solution with respect to the conditioning operation is to view the solution as local distributions. One can think of a degree-d sum-of-square solution for Balanced Separator as a collection of local distributions µS over {0, 1}S for subsets of vertices S ⊆ V of sizes at most d that satisfies cer- tain consistency and positive semi-definiteness conditions, and additional linear constraints corre- sponding to S0, S1 > n/3 and the triangle inequalities. More specifically, for every U ⊆ V and every φ : U → {0, 1}, the degree-d sum-of-squares solution gives us PrµU [ ∀j∈U, j ∈ Sφ(j)] which is a number between zero and one. The consistency constraints ensures that these distributions are locally consistent; that is, for every U′ ⊆ U ∈ {0, 1}, the marginal distribution of µU on U′ is equal to µU′. We remark here that, for Balanced Separator and other problems considered in this work, a solution to the degree-d SoS relaxation for them can be found in time (n d)O(1) = O(n/d)O(d). This consistency constraint on these local distributions allow us to define conditioning on local distributions in the same ways as typical conditional distributions. For instance, we can condition on the event i ∈ S0 if Prµi[i ∈ S0] 6= 0; this results in local distributions {µ′U}U⊆V,U6d−1 where µ′U is the conditional distribution of µU∪{i} on the event i ∈ S0. In other words, for all φ : U → {0, 1}, Pr µ′U [ ∀j ∈ U, j ∈ Sφ(j)] = PrµU∪{i}hi ∈ S0 ∧(cid:16) ∀j ∈ U, j ∈ Sφ(j)(cid:17)i Prµi[i ∈ S0] . Notice that the local distributions are now on subsets of at most d− 1 vertices instead of on subsets of at most d vertices. In other words, the conditioned solution is a degree-(d − 1) solution. As for the semi-definiteness constraint, it suffices for the purpose of this discussion to think about only the degree-2 solution case. For this case, the semi-definiteness constraint in fact yields unit vectors v∅, {vj}j∈V such that Pr µi [i ∈ S0] = Pr µ{i,j} [i, j ∈ S0] = 2 1 + hv∅, vii 1 + hv∅, vii +(cid:10)v∅, vj(cid:11) +(cid:10)vi, vj(cid:11) 4 ∀i ∈ V, ∀i, j ∈ V. It is useful to also note that the probability that i, j are on different side of the cut is exactly equal 7 2; this is just because to 1 4kvi − vjk2 Pr µ{i,j} [Yi 6= Yj] = Pr µi [i ∈ S0] + Pr µj [j ∈ S0] − 2 Pr µ{i,j} [i ∈ S0 ∧ j ∈ S0] = 1 −(cid:10)vi, vj(cid:11) 2 = 1 4kvi − vjk2 2, (5) where Yi, Yj are boolean random variables such that i ∈ SYi and j ∈ SYj. Finally, we note that the constraints for S0, S1 > n/3 and the triangle inequalities are those that, when written in vector forms, translate to inequalities (2) and (4) from the ARV relaxation. 2.3 Our Algorithms: Combining Conditioning and the ARV Theorem The conditioning framework initiated in [BRS11, RT12] (and subsequently used in [ABG13, YZ14, MR16]) typically proceeds as follows: solve for a solution to a degree-d Sum-of-Square relaxation of the problem for a carefully chosen value of d, use (less than d) conditionings to make a solution into an "easy-to-round" degree-O(1) solution, and finally round such a solution. To try to apply this with the Balanced Separator problem, we first have to understand what are the "easy-to-round" solutions for the ARV relaxation. In this regards, first observe that, due to the more refined version of the ARV Theorem (Theorem 2.2), the approximation ratio is actu- ally O(plog m) which can be much better than O(plog n). In particular, if m 6 2O(r2), this al- ready yields the desired O(r)-approximation algorithm. This will be one of the "easy-to-round" situations. Observe also that we can in fact relax the requirement even further: it suffices if {j ∈ V kvi − vjk2 2 6 0.01} 6 m holds for a constant fraction of vertices i ∈ V. This is because we can apply Theorem 2.2 on only the set of such i's which would still result in well- separated set of size Ω(n). Recall also that from (5) the condition kvi − vjk2 2 6 0.01 is equivalent to Prµ{i,j} Another type of easy-to-round situation is when, for most (i.e. 0.9n) of i ∈ V, Prµi[i ∈ S0] /∈ [0.2, 0.8]. In this latter scenario, we can simply find a pair of large well-separated sets (T, T′) by just letting T = {i ∈ V Prµi[i ∈ S0] < 0.2} and T′ = {j ∈ V Prµj[j ∈ S0] > 0.8}. It is not hard to argue that both T, T′ are at least Ω(n) and that, for every i ∈ T and j ∈ T′, kvi − vjk2 2 is at least 0.6. [Yi 6= Yj] 6 0.04. To recap, it suffices for us to condition degree-d solution so that we end up in one of the following two "easy-to-round" cases in order to get O(r) approximation algorithm for the problem. [Yi 6= Yj] 6 0.04} 6 2O(r2). 1. For at least n/100 vertices i ∈ V, we have {j ∈ V Prµ{i,j} 2. For at least 9n/10 vertices i ∈ V, we have Prµi[i ∈ S0] /∈ [0.2, 0.8]. Here we will pick our d to be n/2r2; the running time needed to solve for such a solution is indeed O(n/d)O(d) = exp(n/2O(r2))nO(1) as claimed. Now, suppose that we have a degree-d solution that does not belong to any of the two easy-to-round cases as stated above. This means that there must 6= Yj] 6 0.04} > 2O(r2). be i ∈ V such that Prµi[i ∈ S0] /∈ [0.2, 0.8] and that {j ∈ V Prµ{i,j} For simplicity, let us also assume for now that Prµi[i ∈ S0] = 0.5. We will condition on the event i ∈ S0; let the local distributions after conditioning be {µ′U}U⊆V,U6d−1. Consider each j ∈ V such that Prµ{i,j} [Yi 6= Yj] 6 0.04. Observe first that, before the conditioning, we have [Yi Pr µj [j ∈ S0] > Pr µi [i ∈ S0] − Pr µ{i,j} [Yi 6= Yj] > 0.4 8 and Pr µj [j ∈ S0] > Pr µi [i ∈ S0] + Pr µ{i,j} [Yi 6= Yj] < 0.6. On the other hand, after the conditioning, we have Prµ{i,j} [i ∈ S0, j ∈ S0] Prµi[i ∈ S0] Prµi[i ∈ S0] − Prµ{i,j} [i ∈ S0, j ∈ S1] Prµi[i ∈ S0] Prµi[i ∈ S0] − Prµ{i,j} Prµi[i ∈ S0] [Yi 6= Yj] Pr µ′j [j ∈ S0] = = > > 1 − 0.04/0.5 > 0.9. Thus, this conditioning makes at least 2r2 vertices j's such that Prµj[j ∈ S0] /∈ [0.2, 0.8] beforehand satisfy Prµ′j [j ∈ S0] ∈ [0.2, 0.8] afterwards. If we ignore how conditioning affects the remaining variables for now, this means that, after n/2r2 such conditioning all vertices j ∈ V must have Prµj[j ∈ S0] ∈ [0.2, 0.8]. Hence, we have arrived at an "easy-to-round" solution and we are done! The effect to the other variables that we ignored can easily be taken into account via a simple potential function argument and by considering conditioning on both i ∈ S0 and i ∈ S1; this part of the argument can be found in Section 4. This concludes the overview of our algorithm. 3 Preliminaries 3.1 Sum-of-Square Hierarchy, Pseudo-Distribution, and Conditioning We define several notations regarding the Sum-of-Square (SoS) Hierarchy; these notations are based mainly on [BBH+12, OZ13]. We will only state preliminaries necessary for our algorithms. We recommend interested readers to refer to [OZ13, BS14] for a more thorough survey on SoS. We use Rd[X1, . . . , Xn] to denote the set of all polynomials on X1, . . . , Xn of total degree at most d. First, we define the notion of pseudo-expectation, which represents solutions to SoS Hierar- chy: Definition 3.1 (Pseudo-Expectation) A degree-d pseudo-expectation is E : Rd[X1, . . . , Xn] → R that satisfies the following: • (Normalization) E[1] = 1. • (Linearity) For any p ∈ Rd[X1, . . . , Xn] and q ∈ Rd[X1, . . . , Xn], E[p + q] = E[p] + E[q]. • (Positivity) For any p ∈ R⌊d/2⌋[X1, . . . , Xn], E[p2] > 0. Furthermore, E is said to be boolean if E[(X2 Observe that, while E is a function over infinite domain, E has a succinct representation: due to its linearity, it suffices to specify the values of all monomials of total degree at most d and there are i − 1)p] = 0 for all p ∈ Rd−2[X1, . . . , Xn]. a linear operator 9 only nO(d) such monomials. Furthermore, for boolean E, we can save even further since it suffices to specify only products of at most d different variables. There are only O(n/d)O(d) such terms. From now on, we will only consider boolean pseudo-expectations. Note also that we use Xi as ±1 variables instead of 0, 1 variable as used in the proof overview. (Specifically, in the language of the proof overview section, Prµi[i ∈ S0] is now equal to E[(1 − Xi)/2].) Definition 3.2 A system of polynomial constraints (P, Q) consists of the set of equality con- straints P = {pi = 0}i∈P and the set of inequality constraints Q = {qj > 0}j∈Q, where all pi and qj are polynomials over X1, . . . , Xn. We denote the degree of (P, Q) by deg(P, Q) := max{deg(pi), deg(qj)}i∈P,j∈Q where deg(p) denote the (total) degree of polynomial p. For every S ⊆ [n], we use XS to denote the monomial ∏i∈S Xi. Furthermore, for every S ⊆ [n] and every φ : S → {±1}, let Xφ be the polynomial ∏i∈S (1 + φ(i)Xi). A boolean degree-d pseudo-expectation E : Rd[X1, . . . , Xn] → R is said to satisfy a system of polynomial constraints (P, Q) if the following conditions hold: • For all p ∈ P and all S ⊆ [n] such that S 6 d − deg(p), we have E[XS p] = 0. • For all q ∈ Q, all S ⊆ [n] such that S 6 d − deg(q) and all φ : S → {±1}, we have E[Xφq] > 0. Note that there are only O(n/d)O(d) equalities and inequalities generated above; indeed all degree- d SoS relaxations considered in our work can be solved in time O(n/d)O(d) since it can be expressed as a semidefinite program2 of size O(n/d)O(d). Definition 3.3 (Conditioning) Let E : Rd[X1, . . . , Xn] → R be any boolean degree-d pseudo- expectation for some d > 2. For any b ∈ {±1} such that E[Xi] 6= −b, we denote the conditional pseudo-expectation of E on Xi = b by EXi=b : Rd−1[X1, . . . , Xn] → R where EXi=b[p] = E[p(1 + bXi)] E[1 + bXi] for all p ∈ Rd−1[X1, . . . , Xn]. The proposition below is simple to check, using the identity (1 + bXi) = 1 Proposition 3.4 Let E, b, EXi=b be as in Definition 3.3. If E satisfies a system of polynomial constraints (P, Q), then EXi=b also satisfies the system (P, Q). 3.2 ARV Structural Theorems 2 (1 + bXi)2. Having defined appropriate notations for SoS, we now move on to another crucial preliminary: the ARV Structural Theorem. It will be useful to state the theorem both in terms of metrics and in terms of pseudo-expectation. Let us start by definitions of several notations for metrics. Definition 3.5 (Metric-Related Notations) A metric d on X is a distance function d : X × X → R>0 that satisfies3 (1) d(x, x) = 0, (2) symmetry d(x, y) = d(y, x) and (3) triangle inequality d(x, z) 6 2It has been recently pointed out by O'Donnell [O'D17] that the fact that SoS can be written as small SDP is not sufficient to conclude the bound on the running time. However, this is not an issue for us since we are working with the primal solutions (as opposed to sum-of-square certificates) and we can tolerate small errors in each of the equalities and inequalities. In particular, the ellipsoid algorithm can find, in time polynomial of the size of the program, a solution where the error in each inequality is at most say 2−n100, and this suffices for all of our algorithms. 3Here we do not require "identity of indiscernibles " (i.e. d(x, y) = 0 if and only if x = y), which is sometimes an axiom for metrics in literature. Without such a requirement, d is sometimes referred to as a pseudometric. 10 d(x, y) + d(y, z), for all x, y, z ∈ X. We use the following notations throughout this work: • For x ∈ X and S, T ⊆ X, d(x, S) := miny∈S d(x, y) and d(S, T) := miny∈S d(y, T). • We say that S, T are ∆-separated iff d(S, T) > ∆. • The diameter of a metric space (X, d) denoted by diam(X, d) is maxx,y∈X d(x, y). • We say that (X, d) is α-spread if ∑x,y∈X d(x, y) > αX2. • An (open) ball of radius r around x denoted by Bd(x, r) is defined as {y ∈ X d(x, y) < r}. • A metric space (X, d) is said to be (r, m)-hollow if Bd(x, r) 6 m for all x ∈ X. Definition 3.6 (Negative Type Metric) A metric space (X, d) is said to be of negative type if √d is Euclidean. That is, there exists f : X → Rq such that k f (x) − f (y)k2 2 = d(x, y) for all x, y ∈ X. The ARV Theorem states that, in any negative type metric space (X, d) that is Ω(diam(d))-spread and (Ω(diam(d)), m)-hollow, there exists two large subsets that are Ω(cid:18) diam(d)√log m(cid:19)-separated: Theorem 3.7 (ARV Structural Theorem - Metric Formulation [ARV09, Lee05]) Let α, r > 0 be any positive real number and m ∈ N be any positive integer. For any negative type metric space (X, d) with diam(d) 6 1 that is α-spread and (r, m)-hollow, there exist disjoints subsets T, T′ ⊆ X each of size Ωα,r(X) such that d(T, T′) > Ωα,r(1/plog m). Moreover, these sets can be found in randomized poly- nomial time. We remark that the quantitative bound ∆ = Ωα,β(1/plog m) comes from Lee's version of the theorem [Lee05] whereas the original version only have ∆ = Ωα,β(1/(log m)2/3). We also note that even Lee's version of the theorem is not stated exactly in the above form; in particular, he only states the theorem with m = X, for which the Hollowness condition is trivial. We will neither retread his whole argument nor define all notations from his work here, but we would like to point out that it is simple to see that his proof implies the version that we use as well. Specifically, the inductive hypothesis in the proof of Lemma 4.2 of [Lee05] implies that when the procedure fails (with constant probability) to find T, T′ that are separated by ∆ = C/plog m where C = C(α, r) is sufficiently large, then there exists S ⊆ X that is (100plog m/r, 0.1, √2r)-covered by X. Lemma 4.1 of [Lee05] then implies that, for each x ∈ S, we must have B(x, r) > m. As we are using the ARV Theorem in conjunction with the SoS conditioning framework, it is useful to also state the theorem in SoS-based notations. To do so, let us first state the following fact, which can be easily seen via the fact that the moment matrix (with (i, j)-entry equal to E[XiXj]) is positive semidefinite and thus is a Gram matrix for some set of vectors: Proposition 3.8 Let E : R2[X1, . . . , Xn] → R be any degree-2 pseudo-expectation that satisfies the triangle inequality E[(Xi − Xj)2] 6 E[(Xi − Xk)2] + E[(Xk − Xj)2] for all i, j, k ∈ [n]. Define d E : [n] × [n] → R>0 by d E(i, j) = E[(Xi − Xj)2]. Then, ([n], d E) is a negative type metric space. When it is clear which pseudo-expectation we are referring to, we may drop the subscript from d E and simply write d. Further, we use all metric terminologies with E in the natural manner; for instance, we say that S, T ⊆ [n] are ∆-separated if d E(S, T) > ∆. Theorem 3.7 can now be restated in pseudo-expectation notations as follows. Theorem 3.9 (ARV Structural Theorem - SoS Formulation [ARV09, Lee05]) For any α, β > 0 and m ∈ N, let E : R2[X1, . . . , Xn] → R be any degree-2 pseudo-expectation such that the following conditions 11 hold: Then, there exists a randomized polynomial time algorithm that, with probability 2/3, produces disjoint • (Boolean) For every i ∈ [n], E[X2 i ] = 1. • (Triangle Inequality) For every i, j, k ∈ [n], E[(Xi − Xj)2] 6 E[(Xi − Xk)2] + E[(Xk − Xj)2]. • (Balance) ∑i,j∈[n] E[(Xi − Xj)2] > αn2. • (Hollowness) For all i ∈ [n], {j ∈ [n] E[XiXj] > 1 − β} 6 m. subsets T, T′ ⊆ [n] each of size at least Ωα,β(n) such that T, T′ are ∆-separated for ∆ = Ωα,β(1/plog m). Notice that, for boolean E, E[XiXj] = 1 − E[(Xi − Xj)2]/2 = 1 − d E(i, j)/2. This means that {j ∈ [n] E[XiXj] > 1 − β} is simply Bd E (i, 2β). Another point to notice is that the metric d E can have diam(d E) as large as 4, instead of 1 required in Theorem 3.7, but this poses no issue since we can scale all distances down by a factor of 4. We also need a slight variant of the theorem that does not require the balanceness constraint; such variant appears in [Kar09, ACMM05]. It is proved via the "antipodal trick" where, for every i ∈ [n], one also add an additional variable X−i and add the constraint E[Xi + X−i] = 0 to the system. Applying the above lemma together with an observation that the procedure to creates a set from [ARV09] can be modified so that i ∈ T iff −i ∈ T′ gives the following: Corollary 3.10 (ARV Structural Theorem for Antipodal Vectors [Kar09]) Let E : R2[X1, . . . , Xn] → R be any degree-2 pseudo-expectation that satisfies the following conditions for any β > 0 and m ∈ N: • (Boolean) For every i ∈ [n], E[X2 • (Triangle Inequality) For every i, j, k ∈ [n], i ] = 1. E[(Xi − Xj)2] 6 E[(Xi − Xk)2] + E[(Xk − Xj)2], E[(Xi − Xj)2] 6 E[(Xi + Xk)2] + E[(Xk + Xj)2], E[(Xi + Xj)2] 6 E[(Xi − Xk)2] + E[(Xk + Xj)2], E[(Xi + Xj)2] 6 E[(Xi + Xk)2] + E[(Xk − Xj)2]. • (Hollowness) For all i ∈ [n], {j ∈ [n] E[XiXj] > 1 − β} 6 m. Then, there exists a randomized polynomial time algorithm that, with probability 2/3, produces disjoint subsets T, T′ ⊆ [n] such that T + T′ > Ωβ(n) and, for every i, i′ ∈ T and j, j′ ∈ T′, we have E[(Xi − Xj)2], E[(Xi + Xi′ )2], E[(Xj + Xj′ )2] > Ωβ(1/plog m). 3.3 The Problems The following are the list of problems we consider in this work. Vertex Cover. A subset S ⊆ V of vertices is said to be a vertex cover of G = (V, E) if, for every edge {u, v} ∈ E, S contains at least one of u or v. The goal of the vertex cover problem is to find a vertex cover of minimum size. Sparsest Cut. Given a graph G = (V, E). The (edge) expansion of S ⊆ V is defined as ΦG(S) = E(S,V\S) , where E(S, V \ S) denote the set of edges across the cut (S, V \ S). In the uniform min{S,V\S} sparsest cut problem, we are asked to find a subset of vertices S that minimizes ΦG(S). 12 Balanced Separator. In the Balanced Separator problem, the input is a graph G = (V, E) and the goal is to find a partition of V into S0, S1 with S0, S1 > c′V for some constant c′ > 0 such that ΦG(S0) is minimized. Note that the approximation ratio is with respect to the minimum ΦG(S0) for all partition S0, S1 such that S0, S1 > cV where c is some constant greater than c′. In other words, the algorithm is a pseudo (aka bi-criteria) approximation; this is also the notion used in [LR99, ARV09]. For simplicity, we only consider the case where c = 1/3 in this work; it is easy to see that the algorithm provided below can be extended to work for any constant c ∈ (0, 1). Minimum UnCut. Given a graph G = (V, E), the Minimum UnCut problem asks for a subset S ⊆ V of vertices that minimizes the number of edges that do not cross the cut (S, V \ S). Minimum 2CNF Deletion. In this problem, we are given a 2CNF formula and the goal is to find a minimum number of clauses such that, when they are removed, the formula becomes satisfiable. Here we use n to denote the number of variables in the input formula. 4 Conditioning Yields Easy-To-Round Solution The main result of this section is the following lemma on structure of conditioned solution: Lemma 4.1 Let τ, γ be any positive real numbers such that τ2 < γ < 1. Given a boolean degree-d pseudo-expectation E : Rd[X1, . . . , Xn] → R for a system (P, Q) and an integer ℓ < d, we can, in time O(n/d)O(d), find a boolean degree-(d − ℓ) pseudo-expectation E′ : Rd−ℓ[X1, . . . , Xn] → R for the system (P, Q) such that the following condition holds: • Let V(−τ,τ) := {i ∈ [n] E′[Xi] ∈ (−τ, τ)} denote the set of indices of variables whose pseudo- expectation lies in (−τ, τ) and, for each i ∈ [n], let Cγ(i) := {j ∈ [n] E′[XiXj] ∈ [−γ, γ]} denote the set of all indices j's such that E′[XiXj] lies in [−γ, γ]. Then, for all i ∈ V(−τ,τ), we have V(−τ,τ) \ Cγ(i) 6 n ℓ(γ − τ2)2 . In other words, the lemma says that, when d is sufficiently large, we can condition so that we arrive at a pseudo-expectation with the hollowness condition if we restrict ourselves to V(−τ,τ). Note here that, outside of V(−τ,τ), this hollowness condition does not necessarily hold. For instance, it could be that after conditioning all variables be come integral (i.e. E[Xi] ∈ {±1}). However, this is the second "easy-to-round" case for ARV theorem, so this does not pose a problem for us. The proof of Lemma 4.1 will be based on a potential function argument. In particular, the potential function we use is Φ( E) = ∑i∈[n] E[Xi]2. The main idea is that, as long as there is a "bad" i ∈ [n] that violates the condition states in the lemma, we will be able to finding a conditioning that significantly increases Φ. However, Φ is always at most n, meaning that this cannot happens too many times and, thus, we must at some point arrive at a pseudo-distribution with no bad i. To facilitate our proof, let us prove a simple identity regarding the potential change for a single variable after conditioning: Proposition 4.2 Let E : Rd[X1, . . . , Xn] → R be any degree-d pseudo-expectation for some d > 2 and let 13 i ∈ [n] be such that E[Xi] 6= −1, 1. Then, for any j ∈ [n], we have (cid:18) 1 − E[Xi] (cid:19)(cid:0) EXi=1[Xj](cid:1)2 Proof. For succinctness, let a = (1 − E[Xi])/2, b = EXi=1[Xj] and c = EXi=−1[Xj]. Observe that, from definition of conditioning, we have (cid:19)(cid:0) EXi=−1[Xj](cid:1)2 ( E[XiXj] − E[Xi] E[Xj])2 +(cid:18) 1 + E[Xi] − E[Xj]2 = 1 − E[Xi]2 2 2 . ab + (1 − a)c = E[(1 − Xi)Xj/2] + E[(1 + Xi)Xj/2] = E[Xj]. Hence, the left hand side term of the equation in the proposition statement can be rewritten as ab2 + (1 − a)c2 − (ab + (1 − a)c)2 = a(1 − a)(b − c)2. Let µi = E[Xi]. Now, observe that b − c is simply EXi=−1[Xj] − EXi=1[Xj] = = = = − 1 + µi 1 − µi E[(1 + Xi)Xj] E[(1 − Xi)Xj] E[(1 + µi)(1 − Xi)Xj − (1 − µi)(1 + Xi)Xj] E[2(µi − Xi)Xj] 2(µi E[Xj] − E[XiXj]) 1 − µ2 1 − µ2 i i . 1 − µ2 i (6) (cid:3) Plugging the above equality back into (6) yields the desired identity. With the above lemma ready, we now proceed to the proof of Lemma 4.1. Before we do so, let us also note that our choice of potential function E[Xi]2 is not of particular importance; indeed, there are many other potential functions that work, such as the entropy of Xi. Proof of Lemma 4.1. We describe an algorithm below that finds E′ by iteratively conditioning the pseudo-distribution on the variable Xi that violates the condition. 1. Let E0 = E 2. For t = 1, . . . , ℓ, execute the following steps. (a) Let Vt−1 Moreover, for each i ∈ [n], let Ct−1 (−τ,τ) := {i ∈ [n] Et−1[Xi] ∈ (−τ, τ)}. ℓ(γ−τ2)2 for all i ∈ Vt−1 (−τ,τ) \ Ct−1 (−τ,τ) such that Vt−1 (b) If Vt−1 (c) Otherwise, pick i ∈ Vt−1 γ (i) 6 n γ (i) := {j ∈ [n] Et−1[XiXj] ∈ [−γ, γ]}. (−τ,τ), then output Et−1 and terminate. (−τ,τ) \ Ct−1 γ (i) > n ℓ(γ−τ2)2 . Compute Φ( EtXi=1) and Φ( EtXi=−1) and let Et be equal to the one with larger potential. 3. If the algorithm has not terminated, output NULL. Notice that, if the algorithm terminates in Step 2b, then the output pseudo-distribution obviously satisfies the condition in Lemma 4.1. Hence, we only need to show that the algorithm always terminates in Step 2b (and never reaches Step 3). Recall that we let Φ( E) denote ∑i∈[n] E[Xi]2. To prove this, we will analyze the change in Φ( Et) over time. In particular, we can show the following: 14 Claim 4.3 For every t ∈ [ℓ], Φ( Et) − Φ( Et−1) > n/ℓ. Proof of Claim 4.3. First, notice that it suffices to prove the following because Et−1[(1 − Xi)/2] + Et−1[(1 + Xi)/2] = 1 and, from our choice of Et, we have Φ( Et) = max{Φ( Et−1Xi=1), Φ( Et−1Xi=−1)}. (cid:18) E(cid:20) 1 − Xi 2 (cid:21) · Φ( Et−1Xi=−1) + E(cid:20) 1 + Xi 2 (cid:21) · Φ( Et+1Xi=1)(cid:19) − Φ( Et−1) > n/ℓ. Recall that, from our definition of Φ, the left hand side above can simply be written as ∑ j∈[n](cid:18) E(cid:20) 1 − Xi 2 (cid:21)(cid:0) Et−1Xi=−1[Xj](cid:1)2 + E(cid:20) 1 + Xi 2 (cid:21)(cid:0) Et−1Xi=1[Xj](cid:1)2 − Et−1[Xj]2(cid:19) . (7) (8) (9) (10) From Proposition 4.2, this is equal to ∑ j∈[n](cid:0) Et−1[XiXj] − Et−1[Xi] Et−1[Xj](cid:1)2 1 − Et−1[Xi]2 > > ∑ ∑ γ (i)(cid:0) Et−1[XiXj] − Et−1[Xi] Et−1[Xj](cid:1)2 γ (i)(cid:0)γ − τ2(cid:1) 1 − Et−1[Xi]2 2 j∈Vt−1 (−τ,τ)\Ct−1 j∈Vt−1 (−τ,τ)\Ct−1 n (11) γ (i). γ (i) > (−τ,τ) \ Ct−1 ℓ(γ − τ2)2(cid:19) > n/ℓ, (cid:18)From Vt−1 where the second inequality follows from E[Xi], E[Xj] < τ and E[XiXj] > γ for all j ∈ Vt−1 (−τ,τ) \ Ct−1 It is now easy to see that Claim 4.3 implies that the algorithm never reaches Step 3. Otherwise, we would have Φ( Eℓ) > n/ℓ + Φ( Eℓ−1) > · · · > n + Φ( E) > n, a contradiction. (cid:3) 5 The Algorithms All of our algorithms follow the same three-step blueprint, as summarized below. Step I: Solving for Degree-n/2Ω(r2) Pseudo-Expectation. We first consider the system of con- straints corresponding to the best known existing polynomial time algorithm for each problem, and we solve for degree-n/2Ω(r2) pseudo-expectation for such a system. Step II: Conditioning to Get "Hollow" Solution. Then, we apply Lemma 4.1 to arrive at a degree-2 pseudo-expectation that satisfies the system and that additionally is hollow, i.e., V(−τ,τ) \ Cγ(i) 6 2r2 for all i ∈ V(−τ,τ) for appropriate values of τ, γ. Recall here that V(−τ,τ) and Cγ(i) are defined in Lemma 4.1. y Step III: Following the Existing Algorithm. Finally, we follow the existing polynomial time ap- proximation algorithms (from [ARV09, Kar09, ACMM05]) to arrive at an approximate solution for the problem of interest. The improvement in the approximation ratio comes from the fact that our 15 pseudo-expectation is now in the "easy-to-round" regime, i.e., the ARV Theorem gives separation of Ω(1/r) for this regime instead of Ω(1/plog n) for the general regime. While the last step closely follows the previous known algorithms, there are sometimes subtlety involves (although there is nothing complicated). In particular, the second "easy-to-round" case needs not be handled in previous algorithms but have to be dealt with in our case. 5.1 Vertex Cover Theorem 5.1 For any r > 1 (possibly depending on n), there exists an exp(n/2Ω(r2))poly(n)-time (cid:16)2 − 1 O(r)(cid:17)-approximation algorithm for Vertex Cover on n-vertex graphs. Proof. On input graph G = (V = [n], E), the algorithm works as follows. Step I: Solving for Degree-n/2Ω(r2) Pseudo-Expectation. For every real number OBJ ∈ R, let (P VC G,OBJ) be the following system of polynomial constraints: G,OBJ, QVC 1. (Boolean) For all i ∈ [n], X2 2. (Edge Cover Condition) For all (i, j) ∈ E, (1 − Xi)(1 − Xj) = 0. 3. (Triangle Inequalities) For all i, j, k ∈ [n], i − 1 = 0. (Xi − Xk)2 + (Xk − Xj)2 − (Xi − Xj)2 > 0, (Xi + Xk)2 + (Xk + Xj)2 − (Xi − Xj)2 > 0, (Xi − Xk)2 + (Xk + Xj)2 − (Xi + Xj)2 > 0, (Xi + Xk)2 + (Xk − Xj)2 − (Xi + Xj)2 > 0. 4. (Objective Bound) OBJ − ∑i∈[n](1 + Xi)/2 > 0. ⌉ + 2. The algorithm first uses binary search to find the largest OBJ such that G,OBJ). Let this value of OBJ be OBJ∗, G,OBJ∗, QVC Let D := ⌈1000n/2r2 G,OBJ, QVC there exists a degree-D pseudo-expectation for (P VC and let E be a degree-D pseudo-expectation satisfying (P VC )(cid:17) nO(1) = Notice that this step of the algorithm takes O(n/D)O(D)nO(1) = exp(cid:16)O(nr2/2r2 exp(cid:16)n/2Ω(r2)(cid:17) nO(1) time. Moreover, observe that the integral solution is a solution to the system with OBJ = OPT where OPT is the size of the optimal vertex cover of G. Thus, OBJ∗ 6 OPT. G,OBJ∗). Step II: Conditioning to Get "Hollow" Solution. Use Lemma 4.1 to find an a degree-2 pseudo- expectation E′ for (P VC G,OBJ∗) such that for all i ∈ V(−0.1,0.1), V(−0.1,0.1) \ C0.1(i) < 2r2. G,OBJ∗, QVC Step III: Following Karakostas's Algorithm. The last step of our algorithm proceeds exactly in the same manner as Karakostas's [Kar09]. First, let τ := 1/(10Cr) where C > 1 is a constant to be specified later; observe that τ < 0.1. We divide the vertices into three groups: (i) i's whose 16 E′[Xi] > τ, (ii) i's whose E′[Xi] 6 −τ and (iii) i's with E′[Xi] < τ. More formally, let V>τ = {i ∈ [n] E′[Xi] > τ}, V6−τ = {i ∈ [n] E′[Xi] 6 −τ} and V(−τ,τ) = {i ∈ [n] E′[Xi] < τ}. The key lemma from [Kar09] translates in our settings to the following claim. Claim 5.2 There exists an absolute constant δ > 0 such that, for any sufficiently large constant C, V(−τ,τ) contains an independent set of size δV(−τ,τ). Moreover, such an independent set can be found (with probability 2/3) in polynomial time. Proof. Consider any edge (i, j) ∈ E such that i, j ∈ V(−τ,τ). From the edge cover constraint, we have E′[XiXj] = E′[Xi] + E′[Xj] − 1 < 2τ − 1. As a result, for every (i, j) ∈ E ∩ (V(−τ,τ) × V(−τ,τ)), we have E′[(Xi + Xj)2] = 2(1 + E′[XiXj]) < 4τ. (12) Now, from τ > 0.1, the hollowness guarantee from Step II allows us to invoke the antipodal version of the ARV structural lemma (Corollary 3.10). This gives us subsets T, T′ ⊆ [n] such that T + T′ > ζV(−τ,τ) and, for every i, i′ ∈ T and j, j′ ∈ T′, we have E[(Xi + Xi′ )2], E[(Xj + Xj′ )2] > θ/r where θ, ζ > 0 are both absolute constants (not depending on C). Observe that, for any C > 1/θ, we have 4τ < θ/r; in other words, for such C, (12) implies that both T and T′ are independent sets. Since T + T′ > ζV(−τ,τ), at least one of them must be an independent set of size at least (ζ/2)V(−τ,τ), thereby proving the claim with δ = ζ/2. Our algorithm finds an independent set I ⊆ V(−τ,τ) of size at least δV(−τ,τ) using the claim above. It then outputs the set V>τ ∪ (V(−τ,τ) \ I). We now analyze the correctness of our algorithm. To see that the algorithm outputs a valid vertex cover of G, first observe that from the edge covering condition, if (i, j) ∈ E, then we have E′[Xi] + E′[Xj] = 1 − E′[XiXj] = E′[(Xi − Xj)2] > 0. j ] − E′[XiXj] = E′[X2 E′[X2 i ] + 1 2 1 2 1 2 y This implies that V>τ already cover all edges except those whose both endpoints lie in V(−τ,τ). Now, since I is an independent set, (V(−τ,τ) \ I) must indeed cover all edges within V(−τ,τ) and, hence, the output set is a valid vertex cover. Finally, we will argue that the output solution is of size at most (2 − 1/O(r)) · OBJ∗ 6 (2 − 1/O(r)) · OPT. To see this, first observe that 2 V>τ 6 1 + τ i∈V>τ Next, suppose that we choose C such that 1/(10C) < δ/2, we have E′[(1 + Xi)/2] = (cid:18)2 − 1 O(r)(cid:19) ∑ ∑ i∈V>τ E′[(1 + Xi)/2] V(−τ,τ) \ I 6 (1 − δ) · V(−τ,τ) 6 (1 − δ) · 2 1 − τ ∑ E′[(1 + Xi)/2] i∈V(−τ,τ) 17 (From our choice of C) 6 (1 − δ) · E′[(1 + Xi)/2] By summing the two inequalities, we have 6 (2 − δ) ∑ i∈V(−τ,τ) 2 1 − δ/2 ∑ i∈V(−τ,τ) E′[(1 + Xi)/2]. V>τ ∪ (V(−τ,τ) \ I) 6(cid:18)2 − 6(cid:18)2 − which concludes our proof. E′[(1 + Xi)/2] + (2 − δ) ∑ i∈V(−τ,τ) 1 1 i∈V>τ O(r)(cid:19) ∑ O(r)(cid:19) · OBJ∗, E′[(1 + Xi)/2] (cid:3) 5.2 Balanced Separator Theorem 5.3 For any r > 1 (possibly depending on n), there exists an exp(n/2Ω(r2))poly(n)-time O(r)- approximation for Balanced Separator on n-vertex graphs. Proof. On input graph G = (V = [n], E), the algorithm works as follows. G,OBJ) be the following system of equations: Step I: Solving for Degree-n/2Ω(r2) Pseudo-Expectation. For every real number OBJ ∈ R, let (P BS G,OBJ, QBS 1. (Boolean) For all i ∈ [n], X2 2. (Balance) ∑i,j∈[n](Xi − Xj)2 − 16n2/9 > 0, n/3 − ∑i∈[n] Xi > 0 and ∑i∈[n] Xi + n/3 > 0. 3. (Triangle Inequalities) For all i, j, k ∈ [n], i − 1 = 0. (Xi − Xk)2 + (Xk − Xj)2 − (Xi − Xj)2 > 0 (1 − Xi)2 + (1 − Xj)2 − (Xi − Xj)2 > 0, (1 + Xi)2 + (1 − Xj)2 − (Xi − Xj)2 > 0. 4. (Objective Bound) 4 · OBJ − ∑(i,j)∈E(Xi − Xj)2 > 0. Let D := ⌈1000n/2r2 G,OBJ, QBS there exists a degree-D pseudo-expectation for (P BS and let E be a degree-D pseudo-expectation satisfying (P BS Again, observe that this step takes exp(cid:16)n/2Ω(r2)(cid:17) poly(n) time and OBJ∗ 6 OPT where OPT is ⌉ + 2. The algorithm first uses binary search to find the largest OBJ such that G,OBJ). Let this value of OBJ be OBJ∗, G,OBJ∗, QBS the number of edges cut in the balanced separator of G. G,OBJ∗). Step II: Conditioning to Get "Hollow" Solution. Use Lemma 4.1 to find an a degree-2 pseudo- expectation E′ for (P BS G,OBJ∗) such that for all i ∈ V(−0.9,0.9), V(−0.9,0.9) \ C0.9(i) < 2r2. G,OBJ∗, QBS 18 Step III: Following ARV Algorithm. The last step follows the ARV algorithm [ARV09]. The first step in the algorithm is to use the structural lemma to obtain two large well separated set. While in the traditional setting, the structural theorem can be applied immediately; we have to be more careful and treat the two "easy-to-round" cases differently. This is formalized below. Claim 5.4 There exist disjoint subsets T, T′ ⊆ [n] that are Ω(1/r)-separated. Moreover, these subsets can be found (with probability 2/3) in polynomial time. Proof. Similar to before, for every a, b ∈ R, let V>a = {i ∈ [n] E′[Xi] > a}, V6b = {i ∈ [n] E′[Xi] 6 b} and V(a,b) = {i ∈ [n] E′[Xi] < τ}. Let τ = 0.9. We consider the following two cases: 1. V>τ > 0.1n or V6−τ > 0.1n. Suppose without loss of generality that it is the former. We claim that V60.8 > 0.2n. To see that this is the case, observe that E′[Xi] + ∑ i∈V60.8 n/3 > ∑ i∈[n] E′[Xi] = ∑ i∈V\V60.8 E′[Xi] > 0.8(n − V60.8) − V60.8 = 0.8n − 1.8V60.8 which implies that V60.8 > (0.8n − n/3)/1.8 > 0.2n as desired. Let T = V>τ and T′ = V60.8. As we have shown, T, T′ > Ω(n). Moreover, for every i ∈ T and j ∈ T′, triangle inequality implies that E′[XiXj] 6 E′[XiXj] + E′[(1 − Xi)(1 + Xj)] = 1 − E′[Xi] + E′[Xj] < 1 − 0.9 + 0.8 = 0.9. That is, we have E′[(Xi − Xj)2] = 2 − 2 E′[XiXj] > 0.2, completing the proof for the first case. 2. V>τ < 0.1n and V6−τ < 0.1n. This implies that V(−τ,τ) > 0.8n. Moreover, observe that ∑ i,j∈V(−τ,τ) E[(Xi − Xj)2] = ∑ i,j∈[n] E[(Xi − Xj)2] − ∑ i,j∈[n] > 16n2/9 − 8nV>τ − 8nV6τ > 0.1n2. i∈V>τ or j∈V>τ E[(Xi − Xj)2] − E[(Xi − Xj)2] ∑ i,j∈[n] i∈V6τ or j∈V6τ Hence, applying the ARV Structural Theorem (Theorem 3.9) to V(−τ,τ) yields the desired T, T′. Thus, in both cases, we can find the desired T, T′ in randomized polynomial time. y Once we have found the sets T, T′, we use the following rounding scheme from [LR99, ARV09]: • Pick θ uniformly at random from [0, d(T, T′)). • Let S = {i ∈ [n] d(i, T) < θ}. • Output (S, V \ S). 19 Observe that T ⊆ S and T′ ⊆ (V \ S), which means that S, V \ S > Ω(n); in other words, the output is a valid (pseudo-)solution for the Balanced Separator Problem. Moreover, for every (i, j) ∈ E, it is easy to see that the probability that the two endpoints end up in different sets is at most d(i, T) − d(j, T)/d(T, T′ ) 6 d(i, j)/d(T, T′) 6 O(r) · d(i, j). As a result, the expected number of edges cut by our solution is O(r) · ∑(i,j)∈E d(i, j) = O(r) · OBJ∗, which completes our proof. (cid:3) 5.3 Uniform Sparsest Cut Theorem 5.5 For any r > 1 (possibly depending on n), there exists an exp(n/2Ω(r2))poly(n)-time O(r)- approximation for Uniform Sparsest Cut on n-vertex graphs. Proof. Given an input graph G = (V = [n], E). For every t ∈ [n], let us use ΦG(t) to denote min S⊆V ΦG(S). For each t ∈ [n], we will design an algorithm so that it outputs a set S ⊆ V S=t with ΦG(S) 6 O(r) · ΦG(t). By running this algorithm for every t ∈ [n] and output the set with minimum edge expansion, we can approximate the Uniform Sparsest Cut to within O(r) factor. Let us now fix t ∈ [n]. Observe that we may assume w.l.o.g. that t 6 n/2. Moreover, when t > n/2r2/100, we can just enumerate all subsets S ⊆ V of size t and find the one with smallest edge ex- pansion; this is an exact algorithm for ΦG(t) that runs in time (n/t)O(t)nO(1) = exp(n/2Ω(r2))nO(1). Hence, from this point onwards, we may assume that κ := t/n lies in (1/2r2/100, 1/2]. We will already gives the desired approximation in polynomial time. also assume without loss of generality that r 6 plog n/100; otherwise, ARV algorithm [ARV09] Step I: Solving for Degree-n/2Ω(r2) Pseudo-Expectation. For every real number OBJ ∈ R, let (P SC G,OBJ,t) be the following system of equations: G,OBJ,t, QSC 1. (Boolean) For all i ∈ [n], X2 2. (Size) ∑i,j∈[n](Xi − Xj)2 − 8t(n − t) = 0. 3. (Triangle Inequalities) For all i, j, k ∈ [n], i − 1 = 0. (Xi − Xk)2 + (Xk − Xj)2 − (Xi − Xj)2 > 0 (1 − Xi)2 + (1 − Xj)2 − (Xi − Xj)2 > 0, (1 + Xi)2 + (1 − Xj)2 − (Xi − Xj)2 > 0. 4. (Objective Bound) OBJ · t − ∑(i,j)∈E(Xi − Xj)2 > 0. Let D := ⌈1000n/2r2 G,OBJ,t, QSC there exists a degree-D pseudo-expectation for (P SC and let E be a degree-D pseudo-expectation satisfying (P SC Again, observe that this step takes exp(cid:16)n/2Ω(r2)(cid:17) poly(n) time and OBJ∗ 6 ΦG(t). ⌉ + 2. The algorithm first uses binary search to find the largest OBJ such that G,OBJ,t). Let this value of OBJ be OBJ∗, G,OBJ∗,t, QSC G,OBJ∗,t). 20 Step II: Conditioning to Get "Hollow" Solution. Let τ = 1 − κ/10 and let γ = 1 − κ/30. Ap- plying Lemma 4.1 to E gives us a degree-2 pseudo-expectation E′ for (P SC G,OBJ,t∗) such that, for all i ∈ V(−τ,τ), we have G,OBJ,t∗, QSC V(−τ,τ) \ Cγ(i) 6 n (1000n/2r2 )(γ − τ2)2 = O 2r2 κ2! 6 O 2r2 2−r2/50! = O(22r2 ) where the second inequality follows from κ > 2−r2/100. Step III: Following ARV Algorithm. The last step follows the ARV algorithm [ARV09] for Spars- est Cut. Here we will adhere to the notation of Lee [Lee05]; in fact, the proof below is exactly the same as that of Lee with only one exception: we have to consider the second "easy-to-round" case, which will be the first case in the lemma below. For convenient, we will write d(i, ∅) to denote E[(Xi − 1)2]; due to the fact that we add triangle inequalities for 1 as well, d still remains a valid metric on [n] ∪ {∅}. The key lemma of [ARV09, Lee05] is the following. Lemma 5.6 There exists a set T ⊆ [n] such that i,j∈[n]d(i, T) − d(j, T) > d(i, j) = Ω(nt/r). ∑ i,j∈[n] O(r) (13) ∑ 1 Proof. We consider the following two cases: 1. V>τ > 0.1n or V6τ > 0.1n. Assume without loss of generality that it is the former. Let T = V>τ. We have 4κn2 6 8t(n − t) = ∑ i,j∈[n] (d(i, ∅) + d(j, ∅)) = 2n ∑ i∈[n] where the last inequality comes from the fact that d(i, T) ⊆ B(∅, κ). The above inequality implies that ∑i∈[n] d(i, T) > 2κn. As a result, we have d(i, j) 6 ∑ i,j∈[n] d(i, ∅) 6 2n ∑ i∈[n] (d(i, T) + κ) ∑ i,j∈[n]d(i, T) − d(j, T) > ∑ j/∈T,i∈T d(i, T) > 2κnT > 0.2κn2 > Ω(1) · ∑ i,j∈[n] d(i, j) as desired. 2. V>τ < 0.1n and V6τ < 0.1n. In this case, we have V(−τ,τ) > 0.8n. Observe that 8κn2 > ∑ i,j∈[n] d(i, j) > ∑ d(i, j) i,j∈V(−τ,τ) > ∑ i∈V(−τ,τ) > ∑ i∈V(−τ,τ) ∑ d(i, j) j∈V(−τ,τ)\B(i,100κ) 100κ · V(−τ,τ) \ B(i, 100κ). Hence, there must exist i∗ ∈ V(−τ,τ) such that V(−τ,τ) \ B(i∗, 100κ) 6 8κn2/(100κ · 0.8n) = 0.1n. In other words, V(−τ,τ) ∩ B(i∗, 100κ) > 0.7n. Let us consider the set U = V(−τ,τ) ∩ 21 B(i∗, 100κ). Observe that the guarantee of Step II implies that, for all i ∈ U, we have U \ B(i, κ/15) 6 O(22r2 ). Recall that r 6 plog n/100, meaning that U \ B(i, κ/15) < 0.5n for sufficiently large n. As a result, we have ∑ i,j∈U d(i, j) > ∑ i∈U > ∑ i∈U ∑ d(i, j) j∈U\B(i,κ/15) (κ/15) · U \ B(i, κ/15) > 0.7n · (κ/15) · 0.2n > Ω(κn2). Notice that the metric space (U, d) has diameter O(κ) and that it is Ω(κU2)-separated. Hence, we can now apply the ARV Theorem (Theorem 3.74) on U which gives us the sets T, T′ of size Ω(U) = Ω(n) which are Ω(κ/r)-separated. This means that i,j∈[n] d(i, T) − d(j, T) > ∑ ∑ j∈T,i∈T′ Ω(κ/r) = Ω(κn2/r) = Ω(1/r) · ∑ i,j∈[n] d(i, T) > ∑ j∈T,i∈T′ d(i, j). Finally, given the set T from Lemma 5.6, we consider the following algorithm: • Sort vertices by the distance to T in increasing order. Let π(1), . . . , π(n) be the sorted list. • Consider sets Sℓ := {π(1), . . . , π(ℓ)} for all ℓ ∈ [n − 1]. • Output Sℓ that minimizes ΦG(Sℓ) among all ℓ ∈ [n − 1]. The output set has expansion min ℓ∈[n−1] E(Sℓ, V \ Sℓ) 2Sℓ · V \ Sℓ ∑(i,j)∈E 1[i ∈ Sℓ] − 1[j ∈ Sℓ] ∑i,j∈V 1[i ∈ Sℓ] − 1[j ∈ Sℓ] ΦG(Sℓ) 6 2n · min ℓ∈[n−1] = 2n · min ℓ∈[n−1] ∑ℓ∈[n−1](d(π(ℓ + 1), T) − d(π(ℓ), T)) · ∑i,j∈V 1[i ∈ Sℓ] − 1[j ∈ Sℓ] ! 6 2n ∑ℓ∈[n−1](d(π(ℓ + 1), T) − d(π(ℓ), T)) · ∑(i,j)∈E 1[i ∈ Sℓ] − 1[j ∈ Sℓ] = 2n ∑(i,j)∈E d(i, T) − d(j, T) ∑(i,j)∈[n] d(i, T) − d(j, T)! 6 O(r/t) (i,j)∈Ed(i, T) − d(j, T)  ∑  6 O(r/t) · ∑ (i,j)∈E 6 O(r) · OBJ∗, d(i, j) (13) which concludes our proof. 4Notice that here all distances are scaled by a factor of κ and hence the Ω(κ/r)-separation. 22 y (cid:3) 5.4 Minimum 2CNF Deletion and Minimum UnCut Theorem 5.7 For any r > 1 (possibly depending on n), there exists an exp(n/2O(r2))poly(n)-time O(r)- approximation for Minimum 2CNF Deletion and Minimum UnCut where n denote the number of input variables for Minimum 2CNF Deletion and the number of input vertices for Minimum UnCut. The algorithms of [ACMM05] for both Min 2CNF Deletion and Min UnCut are derived via an algo- rithm for a more general problem called Minimum Symmetric Directed Cut as defined below. Min Symmetric DiCut. A directed graph G = (V, E) is said to be symmetric if (i) the vertex set V is [−n] ∪ [n] where [−n] = {−n, . . . , −1} and (ii) an arc (i, j) belongs to E if and only if (−j, −i) also belongs to E. For every S ⊆ V, we use −S to denote {−i i ∈ S}. A set S is said to be symmetric iff S = −S. Furthermore, we say that a cut (S, V \ S) is symmetric iff V \ S = −S. In Min Symmetric DiCut, we are given as an input a symmetric directed graph G = (V, E) and the goal is to find a symmetric cut (S, −S) that minimizes the number of arcs going from S to −S. Proposition 5.8 ([ACMM05]) If there exists a T(n)-time ρ(n)-approximation for Min Symmetric DiCut, then there also exists O(T(n))-time ρ(n)-approximation for Min 2CNF Deletion and Min UnCut. Proof Sketch of Proposition 5.8. We can reduce Min 2CNF Deletion to Min Symmetric DiCut as fol- lows. Suppose that the variable set in the Min 2CNF Deletion input is X = {x1, . . . , xn}. Let the input graph of Min Symmetric DiCut be G = (V, E) such that V = [−n] ∪ [n] and, for each clause which is an OR of two literals b1 and b2, we add two arcs (− sgn(b1)· var(b1), sgn(b2)· var(b2)) and (sgn(b2) · var(b2), − sgn(b1) · var(b1)) where sgn(b) ∈ {±1} is -1 iff the clause b is a negation of a variable and var(b) ∈ [n] denote the index of the variable corresponding to b. Observe that there is a one-to-one correspondence between assignments from X to {0, 1} and symmetric cuts in G such that the number of arcs cut is exactly twice the number of clauses unsatisfied. Hence, a T(n)-time ρ(n)-approximation algorithm for Min Symmetric DiCut translates directly to an O(T(n))-time ρ(n)-approximation algorithm for Min 2CNF Deletion. The reduction from Min UnCut to Min Symmetric DiCut is similar. Suppose that the input graph to Min UnCut is G′ = (V′, E′) where V′ = [n]. Then, we create the input graph G = (V, E) for Min Symmetric Cut where V = [−n] ∪ [n] and, for each edge {i, j} ∈ E′, we add two arcs (−i, j) and (−j, i) to E. Analogous to before, it is simple to see that there is a one-to-one correspondence between cuts of G′ and symmetric cuts of G such that the number of arcs cut in G is exactly twice the number of uncut edges in G′. Thus, a T(n)-time ρ(n)-approximation algorithm for Min Symmetric DiCut implies to an O(T(n))-time ρ(n)-approximation algorithm for Min UnCut. (cid:3) Given Proposition 5.8, we can focus our attention to design an approximation algorithm for Min Symmetric DiCut. In particular, to show Theorem 5.7, it suffices to prove the following: Theorem 5.9 For any r > 1 (possibly depending on n), there exists an exp(n/2O(r2))poly(n)-time O(r)- approximation for Min Symmetric DiCut. To prove the theorem, it will be convenient to define the notion of symmetric directed metric used in the work of Agarwal et al. [ACMM05]. The notations surrounding symmetric directed metric are defined in an analogous fashion to those of metric (Definition 3.5): 23 Definition 5.10 (Directed Metric-Related Notions) A symmetric directed metric d on a symmetric set X ⊆ [−n] ∪ [n] is a distance function d : X × X → R>0 that satisfies (1) d(x, x) = 0, (2) symmetry d(x, y) = d(−y, −x) and (3) triangle inequality d(x, z) 6 d(x, y) + d(y, z), for all x, y, z ∈ X. We use the following notations throughout this section: • For x ∈ X and S, T ⊆ X, d(x, S) := miny∈S d(x, y) and d(S, T) := miny∈S d(y, T). • We say that S, T are ∆-separated iff d(S, T) > ∆. • An (open) ball of radius r around x denoted by Bd(x, r) is defined as {y ∈ X d(x, y) < r}. • A metric space (X, d) is said to be (r, m)-hollow if Bd(x, r) 6 m for all x ∈ X. We will need an additional notation of volume of a set of vertices which is simply the total distance of all edges with both endpoints lie in the set: Definition 5.11 (Volume) Given a directed graph G = (V, E) where V ⊆ [n] ∪ [−n] is a symmetric set d(i, j). and a symmetric directed metric d on V, the volume of M ⊆ V is defined as vold,G(M) := ∑ (i,j)∈E i,j∈M Similar to the case of (undirected) metric above, boolean degree-2 pseudo-expectation naturally induces a symmetric directed metric on [−n] ∪ [n], as specified below. Definition 5.12 Let E : R2[X1, . . . , Xn] → R be any degree-2 pseudo-expectation that satisfies the follow- ing triangle inequalities for all i, j, k ∈ [n]: E[(Xi − Xj)2] 6 E[(Xi − Xk)2] + E[(Xk − Xj)2], E[(Xi − Xj)2] 6 E[(Xi + Xk)2] + E[(Xk + Xj)2], E[(Xi + Xj)2] 6 E[(Xi − Xk)2] + E[(Xk + Xj)2] and E[(Xi + Xj)2] 6 E[(Xi + Xk)2] + E[(Xk − Xj)2]. Define ddir Then, ddir E (i, j) = E[(1 + sgn(i) · Xi)(1 − sgn(j) · Xj)]. E : ([n] ∪ [−n]) × ([n] ∪ [−n]) → R>0 by ddir E is a symmetric directed metric on [−n] ∪ [n]. Finally, we state the version of the ARV Lemma used in the symmetric directed metric case. This version is closely related to the antipodal version of the ARV Lemma (Corollary 3.10), with two ex- ceptions: (1) the "size" of S is not measured in terms of S but rather in vol(S) and (2) the distance is now in terms of the directed metric instead of the usual metric distance. For a full proof of how to derive such a variant from the standard version, please refer to Lemma 4.6 of [ACMM05]. Lemma 5.13 (ARV Lemma: Directed Metric Version [ACMM05]) Let E : R2[X1, . . . , Xn] → R be any degree-2 pseudo-expectation that satisfies the following conditions for any β > 0 and m ∈ N: • (Boolean) For every i ∈ [n], E[X2 • (Triangle Inequality) For every i, j, k ∈ [n], i ] = 1. E[(Xi − Xj)2] 6 E[(Xi − Xk)2] + E[(Xk − Xj)2], E[(Xi − Xj)2] 6 E[(Xi + Xk)2] + E[(Xk + Xj)2], E[(Xi + Xj)2] 6 E[(Xi − Xk)2] + E[(Xk + Xj)2], E[(Xi + Xj)2] 6 E[(Xi + Xk)2] + E[(Xk − Xj)2]. • (Hollowness) For all i ∈ [n], {j ∈ [n] E[XiXj] > 1 − β} 6 m. Let G = ([n] ∪ [−n], E) be any graph and M ⊆ [−n] ∪ [n] be any symmetric set. Then, there exists a randomized polynomial time algorithm that, with probability 2/3, produces a subset S ⊆ M such that vol ddir ,G E vol (M\(S∪−S)) ddir E (M) ,G 6 1 − Ωβ(1) and ddir E (S, −S) > Ωβ(1/plog m). 24 With all the preliminaries in place, we proceed to prove Theorem 5.9. As with the previous proofs, to ease the notations, we will drop the subscripts when the graph, metric or pseudo-distribution are already clear from the context. Proof of Theorem 5.9. On input graph G = (V = [−n] ∪ [n], E), the algorithm works as follows. Step I: Solving for Degree-n/2Ω(r2) Pseudo-Expectation. For every real number OBJ ∈ R, let (P VC G,OBJ) be the following system of polynomial constraints: G,OBJ, QVC 1. (Boolean) For all i ∈ [n], X2 2. (Triangle Inequalities) For all i, j, k ∈ [n], i − 1 = 0. (Xi − Xk)2 + (Xk − Xj)2 − (Xi − Xj)2 > 0, (Xi + Xk)2 + (Xk + Xj)2 − (Xi − Xj)2 > 0, (Xi − Xk)2 + (Xk + Xj)2 − (Xi + Xj)2 > 0, (Xi + Xk)2 + (Xk − Xj)2 − (Xi + Xj)2 > 0. 3. (Objective Bound) OBJ − ∑(i,j)∈E∩([n]×[n])(1 − XiXj) + ∑(i,j)∈E∩([−n]×[n])(1 + XiXj) > 0. ⌉ + 2. The algorithm first uses binary search to find the largest OBJ such that G,OBJ). Let this value of OBJ be OBJ∗, G,OBJ∗, QVC Let D := ⌈1000n/2r2 there exists a degree-D pseudo-expectation for (P VC G,OBJ, QVC and let E be a degree-D pseudo-expectation satisfying (P VC )(cid:17) nO(1) = Notice that this step of the algorithm takes O(n/D)O(D)nO(1) = exp(cid:16)O(nr2/2r2 exp(cid:16)n/2Ω(r2)(cid:17) nO(1) time. Observe also that the integral solution is a solution with OBJ = OPT where OPT is the minimum number of arcs cut by any symmetric cut of G. Thus, OBJ∗ 6 OPT. G,OBJ∗). Step II: Conditioning to Get "Hollow" Solution. Use Lemma 4.1 to find an a degree-2 pseudo- expectation E′ for (P VC G,OBJ∗) such that for all i ∈ V(−0.1,0.1), V(−0.1,0.1) \ C0.1(i) < 2r2. G,OBJ∗, QVC Step III: Following Agarwal et al.'s Algorithm. The last step of our algorithm proceeds exactly in the same manner as Agarwal et al.'s [ACMM05]. The algorithm proceed in iterations as follows. 1. First, initialize M0 ← [n] ∪ [−n] and ℓ ← 0. 2. While Mℓ is not empty, execute the following: S0 = ∅, then let ℓ ← 1 and skip the following steps. (1 − C) · vol(Mℓ) for some constant C > 0 and d(Sℓ, −Sℓ) > Ω(1/r). (a) If ℓ = 0, let S0 = {i i ∈ [n] and E′[Xi] 6 −0.1} ∪ {−i i ∈ [n] and E′[Xi] > 0.1}. If (b) Otherwise, use Lemma 5.13 to find a set Sℓ ⊆ Mℓ such that vol(M \ (Sℓ ∪ −Sℓ)) 6 (c) Pick θ uniformly at random from [0, d(Sℓ, −Sℓ)/2). (d) Let Tℓ = {i ∈ [−n] ∪ [n] d(Sℓ, i) 6 θ}, Mℓ+1 ← Mℓ \ (Tℓ ∪ −Tℓ) and ℓ ← ℓ + 1. 3. Output the cut (S, −S) where S = ∪ℓ>0Tℓ. 25 To bound the expected number of arcs cut, first observe that vol(Mℓ) shrinks by a factor of (1 − C) in each iteration, i.e., vol(Mℓ) 6 (1 − C)ℓ−1 · vol(V). Next, consider the arcs cut in the ℓ-th step for ℓ > 1, i.e., the arcs (i, j) that lies in (Tℓ × Mℓ) ∪ (Mℓ × −Tℓ). Consider any arc (i, j) ∈ Mℓ × Mℓ. The probability that the arc is cut in the ℓ-th iteration is at most d(i, j)/(d(Sℓ, −Sℓ)/2) 6 O(r) · d(i, j). Hence, in total the expected number of arcs cut in this iteration is at most ∑ (i,j)∈E∩(Mℓ×Mℓ) O(r) · d(i, j) = O(r) · vol(Mℓ) 6 O(r) · (1 − C)ℓ−1 · vol(V). As a result, the expected total number of arcs cut in all iterations ℓ > 1 is at most ∑ℓ>1 O(r) · (1 − C)ℓ−1 · vol(V) 6 O(r) · vol(V). It can be similarly argued that the expected number of arcs cut in the first step is O(vol(V)). Thus, the expected total number of arcs cut is O(r) · vol(V). Finally, observe that the objective bound can be written as OBJ > vol(V)/2. As a result, this yields an O(r)-approximation for the problem. (cid:3) 6 Conclusion and Open Questions In this work, we use the conditioning framework in the SoS Hierarchy together with the ARV Structural Theorem to design "fast" exponential time approximation algorithms for Vertex Cover, Uniform Sparsest Cut and related problems that achieve significant speed-up over the trivial "lim- ited brute force" algorithms. While we view this as a step towards ultimately understanding the time vs approximation ratio trade-off for these problems, many questions remain open. First and most importantly, as discussed in the introduction, current lower bounds do not rule out subexponential time approximation algorithms in the regime of our study. For instance, an 1.9-approximation algorithm for Vertex Cover could still possibly be achieved in say 2O(√n) time. Similarly for Uniform Sparsest Cut and Balanced Separator, O(1)-approximation for them could still possibly be achieved in subexponential time. The main open question is to either confirm that such algorithms exist, or rule them out under certain believable complexity hypotheses. Another, perhaps more plausible, direction is to try to extend our technique to other problems for which the best known polynomial time approximation algorithms employ the ARV Struc- tural Theorem. This includes Balanced Vertex Separator, (Non-uniform) Sparsest Cut, and Min- nomial time [FHL08], several more ingredients beyond the ARV Theorem are required to make imum Linear Arrangement. While the first problem admits O(plog n)-approximation in poly- the algorithm work. On the other hand, the latter two problems only admit O(plog n log log n)- approximation [ALN05, CHKR10, FL07]. It seems challenging to remove this log log n factor and achieve a constant factor approximation, even in our "fast" exponential time regime. References [ABG13] Per Austrin, Siavosh Benabbas, and Konstantinos Georgiou. Better balance by being biased: A 0.8776-approximation for max bisection. In SODA, pages 277 -- 294, 2013. [ABS15] Sanjeev Arora, Boaz Barak, and David Steurer. Subexponential algorithms for unique games and related problems. J. ACM, 62(5):42:1 -- 42:25, 2015. 26 [ACMM05] Amit Agarwal, Moses Charikar, Konstantin Makarychev, and Yury Makarychev. O(plog n) approximation algorithms for min UnCut, min 2CNF deletion, and di- rected cut problems. In STOC, pages 573 -- 581, 2005. Sanjeev Arora, Russell Impagliazzo, William Matthews, and David Steurer. proved algorithms for unique games via divide and conquer. ECCC, 17:41, 2010. Im- [AIMS10] [ALM+98] Sanjeev Arora, Carsten Lund, Rajeev Motwani, Madhu Sudan, and Mario Szegedy. Proof verification and the hardness of approximation problems. J. ACM, 45(3):501 -- 555, 1998. [ALN05] [ARV09] [AS98] [BBH+12] Sanjeev Arora, James R. Lee, and Assaf Naor. Euclidean distortion and the sparsest cut. In STOC, pages 553 -- 562, 2005. Sanjeev Arora, Satish Rao, and Umesh V. Vazirani. Expander flows, geometric em- beddings and graph partitioning. J. ACM, 56(2):5:1 -- 5:37, 2009. Sanjeev Arora and Shmuel Safra. Probabilistic checking of proofs: A new characteri- zation of NP. J. ACM, 45(1):70 -- 122, 1998. Boaz Barak, Fernando G. S. L. Brandão, Aram Wettroth Harrow, Jonathan A. Kelner, David Steurer, and Yuan Zhou. Hypercontractivity, sum-of-squares proofs, and their applications. In STOC, pages 307 -- 326, 2012. [BCL+17] Nikhil Bansal, Parinya Chalermsook, Bundit Laekhanukit, Danupon Nanongkai, and Jesper Nederlof. New tools and connections for exponential-time approximation. CoRR, abs/1708.03515, 2017. [BEP11] [BK09] [BRS11] [BS14] [BYE85] Nicolas Bourgeois, Bruno Escoffier, and Vangelis Th. Paschos. Approximation of max independent set, min vertex cover and related problems by moderately exponential algorithms. Discrete Applied Mathematics, 159(17):1954 -- 1970, 2011. Nikhil Bansal and Subhash Khot. Optimal long code test with one free bit. In FOCS, pages 453 -- 462, 2009. Boaz Barak, Prasad Raghavendra, and David Steurer. Rounding semidefinite pro- gramming hierarchies via global correlation. In FOCS, pages 472 -- 481, 2011. Boaz Barak and David Steurer. Sum-of-squares proofs and the quest toward optimal algorithms. ECCC, 21:59, 2014. R. Bar-Yehuda and S. Even. A local-ratio theorem for approximating the weighted vertex cover problem. In G. Ausiello and M. Lucertini, editors, Analysis and Design of Algorithms for Combinatorial Problems, volume 109 of North-Holland Mathematics Stud- ies, pages 27 -- 45. North-Holland, 1985. [CHKR10] Moses Charikar, Mohammad Taghi Hajiaghayi, Howard J. Karloff, and Satish Rao. ℓ2 2 spreading metrics for vertex ordering problems. Algorithmica, 56(4):577 -- 604, 2010. [CKK+06] Shuchi Chawla, Robert Krauthgamer, Ravi Kumar, Yuval Rabani, and D. Sivakumar. On the hardness of approximating multicut and sparsest-cut. Computational Complex- ity, 15(2):94 -- 114, 2006. 27 [CMM10] Moses Charikar, Konstantin Makarychev, and Yury Makarychev. Local global trade- offs in metric embeddings. SIAM J. Comput., 39(6):2487 -- 2512, 2010. [DKK+16] [DKK+17] [DS05] [Fei02] [FHL08] [FL07] [GJ79] [Gri01] [GS11] [GVY96] [Hal02] Irit Dinur, Subhash Khot, Guy Kindler, Dor Minzer, and Muli Safra. Towards a proof of the 2-to-1 games conjecture? ECCC, 23:198, 2016. Irit Dinur, Subhash Khot, Guy Kindler, Dor Minzer, and Muli Safra. On non- optimally expanding sets in grassmann graphs. ECCC, 24:94, 2017. Irit Dinur and Shmuel Safra. On the hardness of approximating minimum vertex cover. Annals of Mathematics, 162(1):439 -- 485, 2005. Uriel Feige. Relations between average case complexity and approximation complex- ity. In STOC, pages 534 -- 543, 2002. Uriel Feige, MohammadTaghi Hajiaghayi, and James R. Lee. Improved approxima- tion algorithms for minimum weight vertex separators. SIAM J. Comput., 38(2):629 -- 657, 2008. Uriel Feige and James R. Lee. An improved approximation ratio for the minimum linear arrangement problem. Inf. Process. Lett., 101(1):26 -- 29, 2007. Michael R. Garey and David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman, 1979. Dima Grigoriev. Complexity of positivstellensatz proofs for the knapsack. Computa- tional Complexity, 10(2):139 -- 154, 2001. Venkatesan Guruswami and Ali Kemal Sinop. Lasserre hierarchy, higher eigenvalues, and approximation schemes for graph partitioning and quadratic integer program- ming with PSD objectives. In FOCS, pages 482 -- 491, 2011. Naveen Garg, Vijay V. Vazirani, and Mihalis Yannakakis. Approximate max-flow min- (multi)cut theorems and their applications. SIAM J. Comput., 25(2):235 -- 251, 1996. Eran Halperin. Improved approximation algorithms for the vertex cover problem in graphs and hypergraphs. SIAM J. Comput., 31(5):1608 -- 1623, 2002. [Hås01] Johan Håstad. Some optimal inapproximability results. J. ACM, 48(4):798 -- 859, 2001. [IP01] [IPZ01] [Kar09] [Kho02] [Kho06] Russell Impagliazzo and Ramamohan Paturi. On the complexity of k-SAT. J. Comput. Syst. Sci., 62(2):367 -- 375, 2001. Russell Impagliazzo, Ramamohan Paturi, and Francis Zane. Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63(4):512 -- 530, 2001. George Karakostas. A better approximation ratio for the vertex cover problem. ACM Trans. Algorithms, 5(4):41:1 -- 41:8, 2009. Subhash Khot. On the power of unique 2-prover 1-round games. In CCC, page 25, 2002. Subhash Khot. Ruling out PTAS for graph min-bisection, dense k-subgraph, and bipartite clique. SIAM J. Comput., 36(4):1025 -- 1071, 2006. 28 [KKMO07] Subhash Khot, Guy Kindler, Elchanan Mossel, and Ryan O'Donnell. Optimal inap- SIAM J. Comput., proximability results for MAX-CUT and other 2-variable csps? 37(1):319 -- 357, 2007. [KMOW17] Pravesh K. Kothari, Ryuhei Mori, Ryan O'Donnell, and David Witmer. Sum of squares lower bounds for refuting any CSP. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2017, Montreal, QC, Canada, June 19-23, 2017, pages 132 -- 145, 2017. [KMS17] [KMS18] Subhash Khot, Dor Minzer, and Muli Safra. On independent sets, 2-to-2 games, and grassmann graphs. In STOC, pages 576 -- 589, 2017. Subhash Khot, Dor Minzer, and Muli Safra. Pseudorandom sets in grassmann graph have near-perfect expansion. ECCC, 25:6, 2018. [KPRT97] Philip N. Klein, Serge A. Plotkin, Satish Rao, and Éva Tardos. Approximation algo- rithms for steiner and directed multicuts. J. Algorithms, 22(2):241 -- 269, 1997. [KR08] [KV15] [Las02] [Lee05] [LR99] [MR10] [MR16] [MS85] [Nes00] [O'D17] [OZ13] Subhash Khot and Oded Regev. Vertex cover might be hard to approximate to within 2-epsilon. J. Comput. Syst. Sci., 74(3):335 -- 349, 2008. Subhash Khot and Nisheeth K. Vishnoi. The unique games conjecture, integrality gap for cut problems and embeddability of negative-type metrics into ℓ1. J. ACM, 62(1):8:1 -- 8:39, 2015. Jean B. Lasserre. An explicit equivalent positive semidefinite program for nonlinear 0-1 programs. SIAM Journal on Optimization, 12(3):756 -- 769, 2002. James R. Lee. On distance scales, embeddings, and efficient relaxations of the cut cone. In SODA, pages 92 -- 101, 2005. Frank Thomson Leighton and Satish Rao. Multicommodity max-flow min-cut theo- rems and their use in designing approximation algorithms. J. ACM, 46(6):787 -- 832, 1999. Dana Moshkovitz and Ran Raz. Two-query PCP with subconstant error. 57(5):29:1 -- 29:29, 2010. J. ACM, Pasin Manurangsi and Prasad Raghavendra. A birthday repetition theorem and com- plexity of approximating dense CSPs. CoRR, abs/1607.02986, 2016. Burkhard Monien and Ewald Speckenmeyer. Ramsey numbers and an approxima- tion algorithm for the vertex cover problem. Acta Inf., 22(1):115 -- 123, 1985. Yurii Nesterov. Squared functional systems and optimization problems. In High per- formance optimization, pages 405 -- 440. Springer, 2000. Ryan O'Donnell. SOS is not obviously automatizable, even approximately. In ITCS, pages 59:1 -- 59:10, 2017. Ryan O'Donnell and Yuan Zhou. Approximability and proof complexity. In SODA, pages 1537 -- 1556, 2013. 29 [Par00] [PY91] [RS10] [RST12] [RT12] [Sch08] [YZ14] Pablo A. Parrilo. Structured semidefinite programs and semialgebraic geometry methods in robustness and optimization. PhD thesis, California Institute of Technology, 2000. Christos H. Papadimitriou and Mihalis Yannakakis. Optimization, approximation, and complexity classes. J. Comput. Syst. Sci., 43(3):425 -- 440, 1991. Prasad Raghavendra and David Steurer. Graph expansion and the unique games conjecture. In STOC, pages 755 -- 764, 2010. Prasad Raghavendra, David Steurer, and Madhur Tulsiani. Reductions between ex- pansion problems. In CCC, pages 64 -- 73, 2012. Prasad Raghavendra and Ning Tan. Approximating CSPs with global cardinality constraints using SDP hierarchies. In SODA, pages 373 -- 387, 2012. Grant Schoenebeck. Linear level lasserre lower bounds for certain k-csps. In FOCS, pages 593 -- 602, 2008. Yuichi Yoshida and Yuan Zhou. Approximation schemes via sherali-adams hierarchy for dense constraint satisfaction problems and assignment problems. In ITCS, pages 423 -- 438, 2014. 30
1811.07413
1
1811
2018-11-18T22:19:09
The Preemptive Resource Allocation Problem
[ "cs.DS" ]
We revisit a classical scheduling model to incorporate modern trends in data center networks and cloud services. Addressing some key challenges in the allocation of shared resources to user requests (jobs) in such settings, we consider the following variants of the classic {\em resource allocation problem} (\textsf{RAP}). The input to our problems is a set $J$ of jobs and a set $M$ of homogeneous hosts, each has an available amount of some resource. A job is associated with a release time, a due date, a weight, and a given length, as well as its resource requirement. A \emph{feasible} schedule is an allocation of the resource to a subset of the jobs, satisfying the job release times/due dates as well as the resource constraints. A crucial distinction between classic {\textsf{RAP}} and our problems is that we allow preemption and migration of jobs, motivated by virtualization techniques. We consider two natural objectives: {\em throughput maximization} (\textsf{MaxT}), which seeks a maximum weight subset of the jobs that can be feasibly scheduled on the hosts in $M$, and {\em resource minimization} (\textsf{MinR}), that is finding the minimum number of (homogeneous) hosts needed to feasibly schedule all jobs. Both problems are known to be NP-hard. We first present a $\Omega(1)$-approximation algorithm for \textsf{MaxT} instances where time-windows form a laminar family of intervals. We then extend the algorithm to handle instances with arbitrary time-windows, assuming there is sufficient slack for each job to be completed. For \textsf{MinR} we study a more general setting with $d$ resources and derive an $O(\log d)$-approximation for any fixed $d \geq 1$, under the assumption that time-windows are not too small. This assumption can be removed leading to a slightly worse ratio of $O(\log d\log^* T)$, where $T$ is the maximum due date of any job.
cs.DS
cs
The Preemptive Resource Allocation Problem Kanthi Sarpatwar∗ Baruch Schieber† Hadas Shachnai‡ November 20, 2018 Abstract We revisit a classical scheduling model to incorporate modern trends in data center net- works and cloud services. Addressing some key challenges in the allocation of shared resources to user requests (jobs) in such settings, we consider the following variants of the classic re- source allocation problem (RAP). The input to our problems is a set J of jobs and a set M of homogeneous hosts, each has available amount of some resource. A job is associated with a release time, a due date, a weight and a given length, as well as its resource requirement. A feasible schedule is an allocation of the resource to a subset of the jobs, satisfying the job release times/due dates as well as the resource constraints. A crucial distinction between classic RAP and our problems is that we allow preemption and migration of jobs, motivated by virtualization techniques. We consider two natural objectives: throughput maximization (MaxT), which seeks a max- imum weight subset of the jobs that can be feasibly scheduled on the hosts in M , and resource minimization (MinR), that is finding the minimum number of (homogeneous) hosts needed to feasibly schedule all jobs. Both problems are known to be NP-hard. We first present an Ω(1)-approximation algorithm for MaxT instances where time-windows form a laminar family of intervals. We then extend the algorithm to handle instances with arbitrary time-windows, assuming there is sufficient slack for each job to be completed. For MinR we study a more general setting with d resources and derive an O(log d)-approximation for any fixed d ≥ 1, under the assumption that time-windows are not too small. This assumption can be removed leading to a slightly worse ratio of O(log d log∗ T ), where T is the maximum due date of any job. 1 Introduction We revisit a classical scheduling model to incorporate modern trends in data center networks and cloud services. The proliferation of virtualization and containerization technologies, along with the advent of increasingly powerful multi-core processors, has made it possible to execute multiple virtual machines (or jobs) simultaneously on the same host, as well as to preempt and migrate jobs with relative ease. We address some fundamental problems in the efficient allocation of shared resources such as CPU cores, RAM, or network bandwidth to several competing jobs. These problems are modeled to exploit multi-job execution, facilitate preemption and migration while respecting resource and timing constraints. Typically, the infrastructure service providers are oversubscribed and therefore, the common goals here include admission control of jobs to maximize throughput, or minimizing the additional resource required to process all jobs. The broad setting considered in this paper is the following. Suppose we are given a set of jobs J that need to be scheduled on a set of identical hosts M , where each host has a limited amount of one or more resources. Each job j ∈ J has release time rj, due date dj, and length pj, along with a required amount of the resource sj (¯sj for multiple resources). A job j can be preempted and migrated across hosts but cannot be processed simultaneously on multiple hosts, i.e., at any given instant of time a job can be processed by at most one host. However, multiple jobs can be processed by any given host, at any given time, as long as their combined resource requirement ∗IBM T.J. Watson Research Center, Yorktown Heights, NY. [email protected] †Computer Science Department, New Jersey Institute of Technology, Newark, NJ. [email protected] ‡Computer Science Department, Technion, Haifa, Israel. [email protected] 1 does not exceed the available resource. As mentioned above, we consider two commonly occurring objectives, namely, throughput maximization and resource minimization. In the maximum throughput (MaxT) variant, we are given a set of homogeneous hosts M and a set of jobs J, such that each job j has a profit wj and attributes (pj, sj, rj , dj). The goal is to find a subset S ⊆ J of jobs of maximum profit Pj∈S wj that can be feasibly scheduled on M . This problem can be viewed as a preemptive variant of the classic resource allocation problem (RAP) [28, 11, 8, 5]. assigns a set of jobs Si,t to a host i ∈ M at time t is feasible ifPj∈Si,t In the resource minimization (MinR) variant, we assume that each job j has a resource require- ment vector ¯sj ∈ [0, 1]d as one of the attributes, where d ≥ 1 is the number of available resources. W.l.o.g., we assume that each host has a unit amount of each of the d resources. A schedule that ¯sj ≤ ¯1d. Given a set of jobs J with attributes (pj, ¯sj, rj , dj), we seek a set of (homogeneous) hosts M of minimum cardinality such that all of the jobs can be scheduled feasibly on M . This problem is a generalization of the classic vector packing (VP) problem, in which a set of d-dimensional items needs to be feasibly packed into a minimum number of d-dimensional bins of unit size in each dimension, i.e., the vector sum of all the items packed into each bin has to be less than or equal to ¯1d. Any instance of VP can be viewed as an instance of MinR with rj = 0, dj = 1 and pj = 1 for job j ∈ J. Another application of this general scheduling setting relates to the allocation of space and time to advertisements by online advertisement platforms (such as Google or Facebook). In the ad placement problem [14, 18] we are given a schedule length of T time slots and a collection of ads that need to be scheduled within this time frame. The ads must be placed in a rectangular display area whose contents can change in different time slots. All ads share the same height, which is the height of the display area, but may have different widths. Several ads may be displayed simultaneously (side by side), as long as their combined width does not exceed the width of the display area. In addition, each advertisement specifies a display count (in the range 1, . . . , T ), which is the number of time slots during which the ad must be displayed. The actual time slots in which the advertisement will be displayed may be chosen arbitrarily by the scheduler, and, in particular, need not be consecutive. Suppose that each advertisement is associated with some positive profit, and the scheduler may accept or reject any given ad. A common objective is to schedule a maximum-profit subset of ads within a display area of given width. Indeed, this problem can be cast as a special case of MaxT with a single host, where all jobs have the same release time and due date. 1.1 Prior Work The classical problem of preemptively scheduling a set of jobs with attributes (pj, sj = 1, rj, dj) on a single machine so as to maximize throughput can be cast as a special case of MaxT with a single host, where each job requires all of the available resource. Lawler [25] showed that in this special case MaxT admits a PTAS, and the problem is polynomially solvable for uniform job weights. For multiple hosts (i.e., m = M > 1), this special case of MaxT (sj = 1 for all j ∈ J) admits a 1 6+ε -approximation, for any fixed ε > 0. This follows from a result of Kalyanasundaram and Pruhs [22]. As mentioned earlier, another special case of MaxT was studied in the context of advertisement placement. The ad placement problem was introduced by Adler et al. [1] and later studied in numerous papers (see, e.g., [14, 18, 15, 24, 23] and the comprehensive survey in [27]). Freund and Naor [18] presented a (1/3 − ε)-approximation for the maximum profit version, namely, for MaxT with a single host and the same release time and due date for all jobs. Fox and Korupula [17] recently studied our preemptive scheduling model, with job attributes (pj, sj, rj, dj ), under another popular objective, namely, minimizing weighted flow-time. Their work differs from ours in two ways: while they focus on the online versions, we consider our prob- lems in an offline setting. Further, as they note, while the throughput and resource minimization objectives are also commonly considered metrics, their techniques only deal with flow-time. In fact, these objectives are fundamentally different and we need novel algorithms to tackle them. The non-preemptive variant of MaxT, known as the resource allocation problem (RAP), was introduced by Phillips et al. [28], and later studied by many authors (see, e.g., [7, 6, 8, 9, 20, 11] and the references therein).∗ Chakaravarthy et al. [9] consider a generalization of RAP and obtain ∗RAP is also known as the bandwidth allocation problem. 2 a constant approximation based on a primal-dual algorithm. We note that the preemptive versus non-preemptive problems differ quite a bit in their structural properties. As mentioned above, MinR generalizes the classic vector packing (VP) problem. The first non- trivial O(log d)-approximation algorithm for VP was presented by Chekuri and Khanna [10], for any fixed d ≥ 1. This ratio was improved by Bansal, Caprara and Sviridenko [3] to a randomized algorithm with asymptotic approximation ratio arbitrarily close to ln d + 1. Bansal, Eli´as and Khan [4] recently improved this ratio further to 0.807 + ln(d + 1). A "fractional variant" of MinR problem was considered by Jansen and Porkolab [21], where time was assumed to be continuous. For this problem, in the case of a single host, they obtain a polynomial time approximation scheme (PTAS), by solving a configuration linear program (rounding the LP solution is not necessary because time is continuous in their case). Resource minimization was considered also in the context of the ad placement problem. In this variant, all ads must be scheduled, and the objective is to minimize the width of the display area required to make this possible. Freund and Naor [18] gave a 2-approximation algorithm for the problem, which was later improved by Dawande et al. [15] to 3/2. This implies a 3-approximation for MinR instances with d = 1, where all jobs have the same release time and due date. We note that this ratio can be slightly improved, using the property that sj ≤ 1 for all j ∈ J. Indeed, we can schedule the jobs to use the resource, such that the total resource requirements at any two time slots differ at most by one. Thus, the total amount of resource required at any time exceeds the optimum, OP T , at most by one unit, implying the jobs can be feasibly scheduled on 2OP T + 1 hosts. Another line of work relates to the non-preemptive version of MinR, where d = 1 and the requirement of each job is equal to 1 (see, e.g. [13, 12]); thus, at most one job can be scheduled on each host at any time. 1.2 Contributions and Techniques Before summarizing our results, we define the notion of slackness. Denote the time window for processing job j ∈ J by χj = [rj, dj], and let χj = dj − rj + 1 denote the length of the interval. Throughout the discussion, we assume that the time windows are large enough, namely, there is a constant λ ∈ (0, 1), such that pj ≤ λχj for any job j. Such an assumption is quite reasonable in scenarios arising in our applications. We call λ the slackness parameter of the instance. For the MaxT problem, we present (in Section 3) an Ω(1) approximation algorithm. As men- tioned earlier, the non-preemptive version of this problem is the classic resource allocation problem (RAP). To see the structural differences between the non-preemptive and preemptive versions, we consider their natural linear programming relaxations. In the case of RAP, it is sufficient to have a single indicator variable xjt for each job j and time slot t to represent its start time. This allows the application of a natural randomized rounding algorithm, where job j is scheduled to start at time t with probability xjt. On the other hand, in MaxT, a job can be preempted several times; therefore, each job requires multiple indicator variables. Further, these variables must be rounded in an all-or-nothing fashion, i.e., either we schedule all parts of a job or none of them. Our approach to handle this situation is to, somewhat counter-intuitively, "dumb down" the linear program by not committing the jobs to a particular schedule; instead, we choose a subset of jobs that satisfy certain knapsack constraints and construct the actual schedule in a subsequent phase. We first consider a laminar variant of the problem, where the time windows for the jobs are chosen from a laminar family of intervals.† This setting includes several important special cases, such as (i) all jobs are released at t = 0 but have different due dates, or (ii) jobs are released at different times, but all must be completed by a given due date. Recall that m = M is the number of hosts. Our result for the laminar case is a 1 that the slackness parameter satisfies λ < 1 − 2 2 + 1 instance to laminar, we obtain a 1 assuming that λ < 1 2 and 1 approaches 1 2 − λ(cid:0) 1 m(cid:1)-approximation algorithm, assuming m(cid:1)-approximation algorithm for general instances, m+2 . Using a simple transformation of an arbitrary 8 − λ(cid:0) 1 2 + 1 2(m+2) . Our results imply that as λ decreases, the approximation ratio 4 − 1 8 for the laminar and the general case, respectively. Subsequently, we tighten the slackness assumption further to obtain an Ω(1) approximation algorithm for any constant slackness λ ∈ (0, 1) for the laminar case and any constant λ ∈ (0, 1 4 ) for the general case. In the special case where the weight of the job is equal to its area, we extend †See the formal definition in Section 2. 3 an algorithm due to Chen, Hassin and Tzur [11] to obtain an Ω(1) approximation guarantee for the general case with no assumption on slackness. Our algorithm for the laminar case relies on a non-trivial combination of a packing phase and a scheduling phase. While the first phase ensures that the output solution has high profit, the second phase guarantees its feasibility. To facilitate a successful completion of the selected jobs, we formulate a set of conditions that must be satisfied in the packing phase. Both phases make use of the structural properties of a laminar family of intervals. In the packing phase, we apply our rounding procedure (for the LP solution) to the tree representation of the intervals.‡ We further use this tree in the scheduling phase, to feasibly assign the resource to the selected jobs in a bottom-up fashion. Our framework for solving MaxT is general, and may therefore find use in other settings of non-consecutive resource allocation. For the MinR problem, we obtain (in Section 4) an O(log d)-approximation algorithm for any constant d ≥ 1, under a mild assumption that any job has a window of size Ω(d2 log d log T ), where T = maxj dj. We show that this assumption can be removed, leading to a slight degradation in the approximation factor to O(log d log∗ T ), where log∗ T is the smallest integer κ such that T ≤ 1. Our approach builds on a formulation of the problem as a configuration LP, log log . . . log κ times {z } inspired by the works of [3, 16]. However, we quickly deviate from these prior approaches, in order to handle the time-windows and the extra constraints. Our algorithm involves two main phases: a maximization phase and residual phase. Roughly speaking, a configuration is a subset of jobs that can be feasibly assigned to a host at a given time slot t. For each t, we choose O(m log d) configurations with probabilities proportional to their LP-values. In this phase, jobs may be allocated the resource only for part of their processing length. In the second phase, we construct a residual instance based on the amount of time each job has been processed. A key challenge is to show that, for any time window χ, the total "area" of jobs left to be scheduled is at most 1/d of the original total area. We use this property to solve the residual instance. 2 Preliminaries We start with some definitions and notation. For our preemptive variants of RAP, we assume w.l.o.g. that each host has a unit amount of each resource. We further assume that time is slotted. We allow non-consecutive allocation of a resource to each job, as well as job migration. Multiple jobs can be assigned to the same machine at a given time but no job can be processed by multiple machines at the same time. Formally, we denote the set of jobs assigned to host i ∈ M at time t by Si,t. We say that job j is completed if there are pj time slots t ∈ [rj , dj] = χj in which j is allocated its required amount of the resource on some host. A job j is completed if {t ∈ χj : ∃i ∈ M such that j ∈ Si,t} ≥ pj. Let T = maxj∈J dj be the latest due date of any job. In MaxT, each job j ∈ J has a resource requirement sj ∈ (0, 1]. An assignment of a subset of jobs S ⊆ J to the hosts in M is feasible if each job j ∈ S is completed, and for any time slot t sj ≤ 1, i.e., the sum of requirements of all jobs assigned to host i is at and host i ∈ M , Pj∈Si,t most the available resource. For the MinR variant, we assume multiple resources. Thus, each job j has a resource require- ment vector ¯sj ∈ [0, 1]d, for some constant d ≥ 1. Further, each host has a unit amount of each of the d resources. An assignment of a set of jobs Si,t to a host i ∈ M at time t is feasible if ¯sj ≤ ¯1d. Pj∈Si,t Let aj = sjpj denote the total resource requirement (or, area) of job j ∈ J and refer to the quantity wj /aj as the density of job j. Finally, a set of intervals is laminar if for any two intervals χ′ and χ′′, exactly one of the following holds: χ′ ⊆ χ′′, χ′′ ⊂ χ′ or χ′ ∩ χ′′ = φ. 3 Throughput Maximization We first consider the case where L = {χj : j ∈ J} forms a laminar family of intervals. In Sec- tion 3.1, we present an Ω(1)-approximation algorithm for the laminar case when λ ∈(cid:16)0, 1 − 2 m+2(cid:17). ‡This procedure bears some similarity to the pipage rounding technique of [2]. 4 4 − 1 Following this, we describe (in Section 3.2) our constant approximation for the general case for slackness parameter (i) λ ∈ (0, 1) in the laminar case (ii) λ ∈ (0, 1 λ ∈ (cid:16)0, 1 teresting corollary, we obtain an Ω(cid:16) 1 2(m+2)(cid:17). We then show, in Section 3.3, how to tighten the results to any constant log n(cid:17)-approximation algorithm for the general MaxT problem with no slackness assumption. Further, we show that in the special case of maximum utilization (i.e., the profit of each job equals its "area"), we obtain an Ω(1) guarantee with no assumption on the slackness. 4 ) in the general case. As an in- 3.1 The Laminar Case Our algorithm proceeds in two phases. While the first phase ensures that the output solution has high profit, the second phase guarantees its feasibility. Specifically, let ω ∈ (0, 1 − λ m ] be a parameter (to be determined). In Phase 1, we find a subset of jobs S satisfying a knapsack constraint for each χ. Indeed, any feasible solution guarantees that the total area of jobs within any time-window χ ∈ L is at most mχ. Our knapsack constraints further restrict the total area of jobs in χ to some fraction of mχ. We adopt an LP-rounding based approach to compute a subset S that is optimal subject to the further restricted knapsack constraints. (We remark that a dynamic programming approach would work as well. However, such an approach would not provide us with any intuition as to how an optimal solution for the further restricted instance compares with the optimal solution of the original instance.) In Phase 2 we allocate the resource to the jobs in S, by considering separately each host i at a given time slot t ∈ [T ] as a unit-sized bin (i, t) and iteratively assigning each job j ∈ S to a subset of such available bins, until j has the resource allocated for pj distinct time slots. An outline of the two phases is given in Algorithm 1. Input: Set of jobs J, hosts M and a parameter ω ∈ (0, 1 − λ m ] Output: Subset of jobs S ⊆ J and a feasible assignment of S to the hosts in M Phase 1: Select a subset S ⊆ J, such that for each χ ∈ L: Pj∈S:χj ⊆χ aj ≤ (ω + λ m )mχ Phase 2: Find a feasible allocation of the resource to the jobs in S Algorithm 1: Throughput maximization outline Phase 1: The algorithm starts by finding a subset of jobs S ⊆ J such that for any χ ∈ L: m )mχ. We solve the following LP relaxation, in which we impose stricter constraint on the total area of the jobs assigned in each time window χ. Pj∈S:χj ⊆χ aj ≤ (ω + λ LP: Maximize Pj∈J wjxj Subject to: Pj:χj ⊆χ ajxj ≤ ωmχ ∀χ ∈ L 0 ≤ xj ≤ 1 ∀j ∈ J Rounding the Fractional Solution: Suppose x∗ = (x∗ j : j ∈ J) is an optimal fractional solution for the LP. Our goal is to construct an integral solution x = (xj : j ∈ J). We refer to a job j with x∗ j ∈ (0, 1) as a fractional job, and to the quantity ajx∗ j as its fractional area. W.l.o.g., we may assume that for any interval χ ∈ L, there is at most one job j with χj = χ such that 0 < x∗ j < 1, i.e., it is fractional. Indeed, if two such jobs exist, then the fractional value of the higher density job (breaking ties arbitrarily) can be increased to obtain a solution no worse than the optimal. Note, however, that there could be fractional jobs j′ with χj ′ ⊂ χ. We start by setting xj = x∗ j for all j ∈ J. Consider the tree representation of L, which contains a node (also denoted by χ) for each χ ∈ L, and an edge between nodes corresponding to χ and χ′, where χ′ ⊂ χ, if there is no interval χ′′ ∈ L such that χ′ ⊂ χ′′ ⊂ χ.§ Our rounding procedure works in a bottom-up fashion. As part of this procedure, we label the nodes with one of two possible colors: gray and black. Initially, all leaf nodes are colored black, and all internal nodes §Throughout the discussion we use interchangeably the terms node and interval when referring to a time-window χ ∈ L. 5 are colored gray. The procedure terminates when all nodes are colored black. A node χ is colored as black if the following property holds: Property 1. For any path P(χ, χl) from χ to a leaf χl there is at most one fractional job j such that χj lies on P(χ, χl). We note that the property trivially holds for the leaf nodes. Now, consider a gray interval χ with children χ1, χ2, . . . , χν, each colored black. Note that χ is well defined because leaf intervals are all colored black. If there is no fractional job that has χ as its time-window, Property 1 follows by induction, and we color χ black. Assume now that j is a fractional job that has χ as its time-window (i.e., χj = χ). If there is no other fractional job that has its time-window (strictly) contained in χ, Property 1 is trivially satisfied. Therefore, assume that there are other fractional jobs j1, j2, . . . , jl that have their time-windows (strictly) contained in χ. Now, we decrease the fractional area (i.e., the quantity aj xj) of j by ∆ and increase the fractional area of jobs in the and . We choose these increments such that either xj becomes 0, or for each k ∈ [l], set {j1, j2, . . . , jl} by ∆k for job jk, such that ∆ =Pk∈[l] ∆k. Formally, we set xj → xj − ∆ xjk → xjk + ∆k ajk xjk becomes 1. Clearly, in both scenarios, Property 1 is satisfied, and we color χ black. aj When all nodes are colored black, we round up the remaining fractional jobs. Namely, for all jobs j such that xj ∈ (0, 1), we set xj = 1. It is important to note that by doing so we may violate the knapsack constraints. However, in Theorem 1, we bound the violation. Theorem 1. Suppose I = (J, M, L) is a laminar instance of MaxT with optimal profit W and ∀j ∈ J: pj ≤ λχj . For any ω ∈ (0, 1 − λ m ], the subset S = {j ∈ J : xj = 1}, obtained as above, satisfies Pj∈S wj ≥ ωW , and for any χ ∈ L, Pj∈S:χj ⊆χ aj ≤ (ω + λ Proof. We first observe that any optimal solution x∗ for the LP satisfies: Pj∈J wjx∗ j ≥ ωW . Indeed, consider an optimal solution O for the instance I. We can construct a fractional feasible solution x′ for the LP by setting x′ j = 0. Clearly, x′ is a feasible solution for the LP with profit ωW . j = ω if j ∈ O; otherwise, x′ m )mχ. first show that Pj∈J wj xj ≥ ωW . To this end, we prove that Pj∈J wj xj ≥ Pj∈J wj x∗ Consider an integral solution x, obtained by applying the rounding procedure on x∗. We j ≥ ωW . Suppose we decrease the fractional area of a job j by an amount ∆, i.e., we set xj ← xj − ∆ . By aj the virtue of our procedure, we must simultaneously increase the fractional area of some subset of jobs Fj, where for each k ∈ Fj we have χk ⊂ χj. Further, the combined increase in the fractional area of the jobs in Fj is the same ∆. Now, we observe that the density of job j (i.e., wj ) cannot aj be higher than any of the jobs in Fj. Indeed, if j′ ∈ Fj has density strictly lower than j, then the optimal solution x∗ can be improved by decreasing the fractional area of j′ by some ǫ while increasing that of j by the same amount (it is easy to see that no constraint is violated in this process) -- a contradiction. Therefore, our rounding procedure will never result in a loss, and Pj∈J wj xj ≥Pj∈J wj x∗ We now show that, for each χ ∈ L,Pj∈J:χj ⊆χ aj xj ≤ (ω + λ m )mχ. First, observe that for any gray interval χ the total fractional area is conserved. This is true because there is no transfer of fractional area from the subtree rooted at χ to a node outside this subtree until χ is colored black. Now, consider an interval χ that is colored black. We note that for any job j with x∗ j = 0, our algorithm ensures that xj = 0, i.e., it creates no new fractional jobs. Consider the vector x when the interval χ is converted from gray to black. At this stage, we have that the total (fractional) j ≥ ωW . def area packed in the subtree rooted at χ is V (χ) set of all fractional jobs j′ that have their time-windows contained in χ (i.e., χj ′ ⊆ χ). We claim = Pj∈J:χj ⊆χ aj xj ≤ ωmχ. Let F (χ) denote the that the maximum increase in V (χ) by the end of the rounding procedure is at mostPj ′∈F (χ) aj ′ . This holds since our procedure does not change the variables xj ∈ {0, 1}. Thus, the maximum increase in the total area occurs due to rounding all fractional jobs into complete ones, after all nodes are colored black. To complete the proof, we now show that the total area of the fractional jobs in the subtree rooted at χ satisfies A[χ] node χ. Clearly, if χ is a leaf then the claim holds, since there can exist at most one fractional job j in χ, and aj ≤ pj ≤ λχ. Suppose that {χ1, χ2, . . . χl} are the children of χ. If there = Pj ′∈F (χ) aj ′ ≤ λχ. We prove this by induction on the level of def 6 is a fractional job j with χj = χ then, by Property 1, there are no other fractional jobs with time-windows contained in χ. Hence, A[χ] = aj ≤ λχ. Suppose there is no fractional job with χj = χ; then, by the induction hypothesis: A[χk] ≤ λχk for all k ∈ [l]. Further,Pk∈[l] χk ≤ χ and A[χ] =Pk∈[l] A[χk] ≤Pk∈[l] λχk ≤ λχ. Let O be an optimal solution for I satisfying ∀χ ∈ L : Xj∈O:χj ⊆χ aj ≤ cmχ, j ≥ ω for some c ≥ 1. Then it is easy to verify that any optimal solution x∗ for the LP satisfies: c W . Hence, we have some c ≥ 1. Then, for any ω ∈ (0, 1 − λ Corollary 1. Suppose I = (J, M, L) is a laminar instance of MaxT, such that ∀j ∈ J : pj ≤ λχj . Pj∈J wj x∗ Let S+ ⊆ J be a subset of jobs of total profit W satisfying ∀χ ∈ L: Pj∈S+:χj ⊆χ aj ≤ cmχ, for m ], there exists a subset S ⊆ J satisfying Pj∈S wj ≥ ω such that ∀χ ∈ L, Pj∈S:χj ⊆χ aj ≤ (ω + λ Phase 2: We refer to host i at time t as a bin (i, t). In the course of the allocation phase, we label a bin with one of three possible colors: white, gray or black. Initially, all bins are colored white. We color a bin (i, t) gray when some job j is assigned to host i at time t, and color it black when we decide to assign no more jobs to this bin. Our algorithm works in a bottom-up fashion and marks an interval χ as done when it has successfully completed all the jobs j with χj ⊆ χ. Consider an interval χ such that any χ′ ⊂ χ has already been marked done. m )mχ. c W , Let j ∈ J be a job with time-window χj = χ, that has not been processed yet. To complete job j, we must pick pj distinct time slots in χ and assign it to a bin in each slot. Suppose that we have already assigned the job to p′ j < pj slots so far. Denote by avail(j) ⊆ χ the subset of time slots where j has not been assigned yet. We pick the next slot and bin as shown in Algorithm 2. else if there exists a white bin (i′, t′) in avail(j) then 1: if there exists a gray bin (i, t) in avail(j) then 2: 3: let S(i,t) be the set of jobs assigned to this bin if Pj ′∈S(i,t) sj ′ + sj ≤ 1 then assign j to host i at time t else assign j to host i′ at time t′. color (i, t) and (i′, t′) black pair up (i, t) ↔ (i′, t′) 4: 5: 6: 7: 8: 9: 10: 11: 12: else if there exists a white bin (i, t) in avail (j) then 13: 14: 15: else 16: 17: end if assign j to host i at time t color the bin (i, t) gray report fail report fail end if Algorithm 2: Resource allocation to job j in a single time slot 2 + 1 Theorem 2. For any λ < 1 − 2 laminar MaxT problem, assuming that pj ≤ λχj for all j ∈ J. m+2 , there exists a 1 2 − λ(cid:0) 1 m(cid:1)-approximation algorithm for the Proof. Given an instance I = (J, M, L) and a parameter ω ∈ (0, 1 − λ m ], let W denote the optimal profit. We apply Theorem 1 to find a subset of jobs S ⊆ J of profit ωW , such that for any χ ∈ L: m )mχ. We now show that there is a feasible resource assignment to the We show that for the above value of ω Algorithm 2 never reports fail, i.e., the resource is feasibly allocated to all jobs in S. Assume towards contradiction that Algorithm 2 reports fail 2 + 1 m(cid:1). Clearly, this would imply the theorem. jobs in S for ω = 1 Pj∈S:χj ⊆χ aj ≤ (ω + λ 2 − λ(cid:0) 1 7 while assigning job j. Suppose that j was assigned to p′ j < pj bins before this fail. For t ∈ χ = χj, we say that bin (i, t) is bad if either (i, t) is colored gray, or j has been assigned to some bin (i′, t) in the same time slot. We first show that the following invariant holds, as long as no job j+ such that χ ⊂ χj+ has been allocated the resource: the number of bad bins while processing job j is at most λmχ. Assuming that the claim is true in each of the child intervals of χ, {χ1, χ2 . . . , χl}, before any job with time window χ is allocated the resource, we have the number of bad bins = number of gray bins is at most Pk∈[l] λmχk ≤ λmχ. Now, consider the iteration in which we assign j to host i at time t. If (i, t) is a gray bin, then the number of bad bins cannot increase. On the other hand, suppose (i, t) was white before we assign j. If there are no gray bins in χ, then the number of bad bins is at most mpj ≤ λmχ. Suppose there exist some gray bins, and consider those bins of the form (i′, t′) such that job j has not been assigned to any host at time t′. If there are no such bins, then again the number of bad bins is at most mpj ≤ λmχ. Otherwise, we must have considered one such gray bin (i′, t′) and failed to assign j to host i′ at time t′. By the virtue of the algorithm, we must have colored both (i, t) and (i′, t′) black. Thus, the number of bad bins does not increase, and our claim holds. Now, since we pair the black bins (i, t) ↔ (i′, t′) only if m )mχ. Hence, the total sj ′ > 1, the total number of black bins < 2(ω + λ Pj∈S(i,t) sj +Pj ′∈S(i′ ,t′) number of bins that are black or bad is < (λ + 2(ω + λ there should be at least one bin (i∗, t∗) that is neither black nor bad. But in this case, we could have assigned j to host i∗ at time t∗, which is a contradiction to the assumption that the algorithm reports a fail. m ))mχ. Now, setting ω = 1 2 + 1 2 − λ(cid:0) 1 m(cid:1), For convenience, we restate the claim shown in the proof of Theorem 2. ω ≤ 1 2 + 1 2 − λ(cid:0) 1 Corollary 2. Let I = (J, M, L) be a laminar instance where pj ≤ λχj ∀j ∈ J, for λ ∈ (0, 1). m )mχ, where Let S ⊆ J be a subset of jobs, such that for any χ ∈ L: Pj∈S:χj ⊆χ aj ≤ (ω + λ m(cid:1). Then, there exists a feasible resource assignment to the jobs in S. 3.2 The General Case We use a simple transformation of general instances of MaxT into laminar instances and prove an Ω(1)-approximation guarantee. Let W denote the set of all time-windows for jobs in J, i.e., W = {χj : j ∈ J}. We now construct a laminar set of intervals L and a mapping L : W → L. Recall that T = maxj∈J dj. The construction is done via a binary tree T whose nodes correspond to intervals [l, r] ⊆ [T ]. The construction is described in Algorithm 3. Input: Job set J and W = {χj : j ∈ J} Output: Laminar set of intervals L and a mapping L : W → L add to T two nodes [l, ⌊ l+r 1: let [T ] be the root node of tree T 2: while ∃ a leaf node [l, r] in T such that r − l > 1 do 3: 4: end while 5: let L be the set of intervals corresponding to the nodes of T 6: For each χ ∈ W, let L(χ) = χ′, where χ′ is the largest interval in L contained in χ, breaking 2 ⌋ + 1, r] as the children of [l, r] 2 ⌋] and [⌊ l+r ties by picking the rightmost interval. Algorithm 3: Transformation into a laminar set Lemma 1. In Algorithm 3, the following properties hold: 1. For any j ∈ J, χj ≤ 4L(χj). 2. For χ ∈ L, let χ = {t ∈ χj : j ∈ J, L(χj ) = χ}, i.e., the union of all time-windows in W that are mapped to χ. Then, χ ≤ 4χ. Proof. To prove the first property, it suffices to show that χj cannot completely contain 3 con- secutive intervals in L that are at the same level as L(χj). Indeed, this would imply that χj cannot intersect more than 4 consecutive intervals, and therefore χj ≤ 4L(χj). Now, suppose χj contains at least 3 such consecutive intervals. Then, by the virtue of our algorithm, L(χj) is the rightmost interval. Let χ be the parent of L(χj). Two cases arise: 8 Case 1: L(χj ) is a left child of χ. Consider the two other consecutive intervals at the same level as L(χj) that are contained in χj. Observe that these two intervals are siblings; therefore, their parent (which is also in L) is also contained in χj. This is a contradiction to the assumption that L(χj ) is the largest interval in L contained in χj. Case 2: L(χj) is a right child of χ. We observe that the sibling of L(χj ) must also be contained in χj, implying that χ is contained in χj, a contradiction. We now prove the second property. For any χ = [s, d] ∈ L, let χl = [sl, dl] ∈ W (resp. χr = [sr, dr]) be the leftmost (resp. rightmost) interval in W such that L(χl) = χ (resp. L(χr) = χ); then, χ = [sl, dr]. Consider the intervals χ1 = [sl, s] and χ2 = [d, dr]. As argued above, χl cannot contain 3 consecutive intervals in L at the same level as χ Thus, χ1 < 2χ. Also, χ2 < χ; otherwise, there is an interval to the right of χ of the same size that can be mapped to χr. Thus, χ1 + χ2 < 3χ. Now, the claim follows by observing that χ = χ1 + χ + χ2 ≤ 4χ. Theorem 3. For any λ < 1 MaxT , assuming that pj ≤ λχj for all j ∈ J. 2(m+2) , there exists a 1 4 − 1 8 − λ(cid:0) 1 2 + 1 m(cid:1)-approximation algorithm for Proof. Given an instance (J, M, W) of MaxT with slackness parameter λ ∈ (0, 1), we first use Algorithm 3 to obtain a laminar set of intervals L and the corresponding mapping L : W → L. Consider a new laminar instance (Jℓ = {jℓ : j ∈ J}, Mℓ = M, L), constructed by setting χjℓ = L(χj ). Note that if Sℓ ⊆ Jℓ is a feasible solution for this new instance, the corresponding set S = {j : jℓ ∈ Sℓ} is a feasible solution for the original instance. Let λℓ denote the slackness parameter for the new instance. We claim that λℓ ≤ 4λ. Assume this is not true, i.e., there exists a job jℓ, such that pjℓ > 4λχjℓ ; however, by Lemma 1, we have pjℓ = pj ≤ λχj ≤ 4λχjℓ . A contradiction. Now, suppose O ⊆ J is an optimal solution of total profit W for the original (non- laminar) instance. Consider the corresponding subset of jobs Oℓ = {jℓ : j ∈ O}. By Lemma 1, for for any ω ∈ (0, 1 − λℓ any χ ∈ L, χ ≤ 4χ. It follows that, for any χ ∈ L,Pjℓ∈Oℓ:χjℓ ⊆χ ajℓ =Pj∈O:L(χj )⊆χ aj ≤ 4mχ. Pjℓ∈Sℓ:χj ⊆χ ajℓ ≤ (ω + λℓ Now, we use Corollary 1 for the laminar instance, taking c = 4, S+ = Oℓ and λℓ ∈ (0, 1). Then, c W , such that ∀χ ∈ L, m )mχ. By Corollary 2, there is a feasible assignment of the resource to m ], there exists Sℓ ⊆ Jℓ of total profit Pjℓ∈Sℓ 2 − λℓ(cid:0) 1 the jobs in Sℓ for ω ≤ 1 wj ≥ ω 2 + 1 m(cid:1). Taking − 4λ(cid:18) 1 + 2 1 m(cid:19) ≤ ω = 1 2 c = 1 8 − 4λ(cid:0) 1 8 + 1 1 2 + 1 2 m(cid:19), − λℓ(cid:18) 1 4m(cid:1), for any λ < 1 4 − 1 2(m+2) . we have the approximation ratio w We now return to the original instance and take for the solution the set S = {j : jℓ ∈ Sℓ}. 3.3 Eliminating the Slackness Requirements In this section we show that the slackness requirements in Theorems 2 and 3 can be eliminated, while maintaining a constant approximation ratio for MaxT . In particular, for laminar instances, we show below that Algorithm 1 can be used to obtain a polynomial time Ω(1)-approximation for any constant slackness parameter λ ∈ (0, 1). For general MaxT instances, this leads to an Ω(1)-approximation for any constant λ ∈ (0, 1 log n )- approximation algorithm for general MaxT using no assumption on slackness. We use below the next result, for instances with 'large' resource requirement. 4 ). We also show a polynomial time Ω( 1 Lemma 2. For any δ ∈ (0, 1) there is an Ω( of MaxT satisfying sj ≥ δ ∀ j ∈ J. 1 log(1/δ) )-approximation for any instance I = (J, M, W) Proof. Given an instance I, we first round down the resource requirement (or, height) of each job j ∈ J to the nearest value of the form δ(1 + ε′)k, for some fixed ε′ ∈ (0, 1) and integer 0 ≤ k ≤ ⌈log1+ε′ ( 1 δ )) classes, such that the jobs in each class have the same rounded height. For a class with job height δ(1 + ε′)k, let mk = m · ⌊ δ(1+ε′)k ⌋. We define for this class the instance Ik = (Jk, Mk, W) of MaxT in which Mk = mk and sj = 1 for all j ∈ Jk. δ )⌉. We now partition the jobs into O(log( 1 1 Recall that Lawler [25] gave a PTAS for MaxT on a single host, where sj = 1 for all j ∈ J. Consider an algorithm Ak for MaxT on Ik, which proceeds as follows. We schedule iteratively the 9 jobs in J on hosts 1, . . . , mk. Let Ji−1 be the set of jobs scheduled on hosts 1, . . . i − 1, and J0 = ∅. In iteration i ≥ 1, we use the PTAS of [25] for the set of jobs J \ Ji−1. We note that the resulting 1 schedule uses no migrations. By a result of [22], this iterative algorithm yields a ratio of 6+ε to the profit of an optimal schedule for MaxT (which may use migrations). Let Ak(Ik) be the profit of the solution obtained for Ik. Then we choose the solution set δ )⌉ Ak(Ik). for the instance Iℓ∗ which maximizes the profit. That is, Aℓ∗ (Iℓ∗ ) = max0≤k≤⌈log1+ε′ ( 1 We note that since the job heights are rounded down, transforming back to the original job 1 1+ε′ . W.l.o.g., assume that heights may require to reduce the number of hosts, at most by factor mℓ∗ > m (otherwise, the rounded height of the scheduled jobs is larger than 1 2 , implying they can be scheduled feasibly with their original heights on m hosts). Thus, among the mℓ∗ hosts, we select m′ 1+ε′ ⌋ hosts on which the total weight of scheduled jobs is maximized. It follows that the approximation ratio is ( 1 ℓ∗ = ⌊ m∗ 1 ℓ 1+ε′ − 1 mℓ∗ ) · (6+ε)⌈log1+ε′ ( 1 δ )⌉ . 3.3.1 Laminar Instances Recall that m = M is the number of hosts. Given a fixed λ ∈ (0, 1), let α = α(m, λ) = λ(1 − λ) 1 − λ + λ m . (1) In Phase 1 of Algorithm 1, we round the LP solution to obtain a subset of jobs S ⊆ J. We first prove the following. Lemma 3. Let λ ∈ (0, 1) be a slackness parameter, and ω = (1 − α)(1 − λ) − αλ m , (2) where α is defined in (1). Then, given a laminar instance I = (J, M, L) satisfying pj ≤ λχj and sj ≤ α, there is a feasible allocation of the resource to the jobs in S. Proof. We generate a feasible schedule of the jobs in S proceeding bottom-up in each laminar tree. That is, we start handling job j only once all the jobs ℓ with time windows χℓ ⊂ χj have been scheduled. Jobs having the same time window are scheduled in an arbitrary order. Let j be the next job, whose time window is χ = χj. We can view the interval χ as a set of χ time slots, each consisting of m unit size bins. We say that a time slot t ∈ χj is 'bad' for job j if there is no space for one processing unit of j (i.e., an 'item' of size sj) in any of the bins in t; else, time slot t is 'good'. We note that immediately before we start scheduling job j the number of bad time slots for j is at most mχ(1−λ)(1−α)−aj . Indeed, by Theorem 1, choosing for ω the value in (2), after rounding the LP solution the total area of jobs ℓ ∈ S, such that χℓ ⊆ χj, is at most m(1−sj ) (ω + αλ m )mχ = ((1 − α)(1 − λ) − αλ m + αλ m )mχ. (3) In addition, for a time slot t to be 'bad' for job j, each bin in t has to be at least (1 − sj)-full. Hence, the number of good time slots for j is at least χ − mχ(1 − λ)(1 − α) − aj m(1 − sj) (1 − λ)(1 − α) 1 − sj (1 − λ)(1 − α) 1 − sj ) + ) + aj m(1 − sj) aj m(1 − sj) = χ(1 − (1 − ≥ pj λ ≥ pj The first inequality follows from the fact that pj ≤ λχj = λχ, and the second inequality holds since sj ≤ α. Hence, job j can be feasibly scheduled, for any j ∈ S. Using Lemmas 2 and 3, we prove our main result. 10 Theorem 4. For any m ≥ 1 and constant λ ∈ (0, 1), MaxT admits a polynomial time Ω(1)- approximation on any laminar instance I = (J, M, L) with slackness parameter λ. Proof. Given a laminar instance I satisfying the slackness condition, we handle separately two subsets of jobs. Subset 1: Jobs j satisfying sj ≤ α = α(m, λ), where α is defined in (1). We solve MaxT for these jobs using Algorithm 1, taking the value of ω as in (2). By Theorem 1, the approximation ratio is ω = (1 − α)(1 − λ) − αλ m = (1 − λ)2, i.e., we have a constant factor. Subset 2: For jobs j satisfying sj > α, use Lemma 2 to obtain an Ω( 1 log(1/α) )-approximation. Taking the best among the solutions for the two subsets of jobs, we obtain an Ω(1)-approximation. 3.3.2 The General Case Recall that, given a general MaxT instance, (J, M, W), with a slackness parameter λ ∈ (0, 1), our transformation yields a new laminar instance (Jℓ = {jℓ : j ∈ J}, Mℓ = M, L) with a slackness parameter λℓ ≤ 4λ (see the proof of Theorem 3). Now, define and set αℓ = αℓ(m, λℓ) = λℓ(1 − λℓ) 1 − λℓ + λℓ m , ω = (1 − αℓ)(1 − λℓ) − αℓλℓ m . (4) (5) Then, by Lemma 3, we have that any job jℓ ∈ Jℓ selected for the solution set S can be assigned the resource (using Algorithm 1). Theorem 5. For any m ≥ 1 and constant λ ∈ (0, 1 approximation on any instance I = (J, M, W) with slackness parameter λ. 4 ), MaxT admits a polynomial time Ω(1)- Proof. Given such an instance I, consider the resulting laminar instance. As before, we handle separately two subsets of jobs. Subset 1: For jobs jℓ ∈ Jℓ satisfying sjℓ ≤ αℓ, where αℓ is defined in (4), apply Algorithm 1 with ω value as in (5). Then, the approximation ratio is ω = (1 − λℓ)2 ≥ (1 − 4λ)2. Subset 2: For jobs jℓ where sjℓ > αℓ, use Lemma 2 to obtain Ω( log(1/αℓ) )-approximation. 1 Taking the best among the solutions for the two subsets of jobs, we obtain an Ω(1)-approximation. Finally, consider a general instance of MaxT . By selecting δ = 1 to obtain an Ω( 1 be a solution consisting of all jobs j for which sj < 1 log n )-approximate solution, S1 for the jobs j ∈ J of heights sj ≥ 1 n , we can apply Lemma 2 n . Let S2 n . Note that this solution is feasible since Pj∈S2 sj < 1. Selecting the highest profit solution between S1 and S2, we have the following. Corollary 3. There is a polynomial time Ω( 1 log n )-approximation algorithm for MaxT . 3.3.3 Maximizing Utilization Consider instances of MaxT where the profit gained from scheduling job j is wj = aj = sjpj. In this section, we obtain an Ω(1)-approximation for MaxT instances where the weight of a job is equal to its area. In other words, the goal is to maximize resource utilization. Our result builds on an algorithm of [11]. Theorem 6. There is a polynomial time Ω(1)-approximation for any instance of MaxT where wj = aj for all j ∈ J. Proof. As before, we represent a time slot t on a host i by a bin (i, t). We first assume that for some constant α ∈ (0, 1), sj ≤ α. For the case where sj > α, we can obtain a constant approximation using Lemma 2. 11 Fix some λ < 1 4 . We first split the jobs by their lengths. A job j is long if pj > λχj; otherwise, job j is short. For a given optimal solution of the problem, let OP Ts and OP Tℓ be the contributions of short jobs and long jobs, respectively. We handle the long and short jobs separately. Note that since short jobs satisfy the requirements of Theorem 5, we can obtain a constant approximation with respect to OP Ts. We now handle the long jobs. For this part, we adapt an algorithm due to Chen, Hassin and Tzur [11]. Suppose L is the set of long jobs. Consider the following algorithm. Step 1: Sort the jobs in non-increasing order of their time-window sizes χj. Step 2: For each job j in the sorted order, if there are pj time-slots that have at least one bin that is less than 1 − sj full, schedule j; otherwise, discard it. Let A be the set of jobs chosen by this algorithm. We now analyze the performance of the algorithm. For each job j, we define an augmented job j′ as follows: pj ′ = 3χj, and sj ′ = sj 1 − α χj ′ = [rj − χj, dj + χj] Let A′ denote the set of augmented jobs for A. We note that there may be no feasible schedule for the jobs in A′. We define the effective weight of A′ as Wef f (A′) =Xt min{m, Xj ′∈A′:t∈χj′ sj ′ } It follows that W (A) ≥ (1 − α)λ 3 W (A′) ≥ (1 − α)λ 3 Wef f (A′) To complete the proof, we simply show that Wef f (A′) ≥ W (OP Tℓ). To this end, it suffices to show that Two cases arise: Xj ′∈A′:t∈χj′ sj ′ ≥ Xo∈OP Tℓ:t∈χo so Case I: No long job j with t ∈ χj is rejected by our algorithm. In this case the claim follows trivially. Case II: There exists some long job j that is rejected by our algorithm. We show that Pj ′∈A′:t∈χj′ sj ′ ≥ m. The proof would be follow since Po∈OP Tℓ:t∈χo Since j was rejected ∃t′ ∈ χj such that each bin (i, t′) is at least (1 − α) full. Let Aj be the set of jobs already scheduled in t′ before j was rejected, and let A′ j be the respective set of augmented jobs. We claim that for all j′ p . To see this, we first note that, for any jp ∈ Aj , we have χjp ≥ χj (because the jobs are chosen in increasing order of time-window sizes). Further, χjp ∩ χj contains at least t′ and hence χj and χjp are intersecting. Therefore, the augmented job j′ p ∈ A′ j must completely contain χj and so t ∈ χj ′ p . Thus, we have so ≤ m. p ∈ A′ j, t ∈ χj ′ Xj ′∈A′:t∈χj′ sj ′ ≥ Xj ′ p∈A′ j sj ′ p ≥ 1 1 − α Xjp∈Aj sjp ≥ m(1 − α) 1 − α = m. 4 Resource Minimization In this section, we consider the MinR problem with d resources, where d ≥ 1 is some constant. We show that the problem admits an O(log d)-approximation under some mild assumptions on the slack and minimum window size. 12 Our approach builds on a formulation of the problem as a configuration LP and involves two main phases: a maximization phase and residual phase. Informally, a configuration is a subset of jobs that can be feasibly assigned to a host at a given time slot t. For each t, we choose O(m log d) configurations with probabilities proportional to their LP-values. In this phase, jobs may be allocated the resource only for part of their processing length. In the second phase, we construct a residual instance based on the amount of time each job has been processed. A key challenge is to show that, for any time window χ, the total "area" of jobs left to be scheduled is at most 1/d of the original total area. We use this property to solve the residual instance. We start by describing the configuration linear program that is at the heart of our algorithm. 4.1 Configuration LP Let Jt ⊆ J denote the set of all jobs j such that t ∈ χj, i.e., j can be allocated resources at time slot t. For any t ∈ [T ] and S ⊆ Jt, C = (S, t) is a valid configuration on a single host if Pj∈S ¯sj ≤ ¯1d, i.e., the jobs in S can be feasibly allocated their resource requirements on a single host at time slot t. Denote the set of all valid configurations at time t by Ct, and by Cj the set of all valid configurations (S, t), such that S contains job j. Denote by xC the indicator variable for choosing configuration C, and by m the number of hosts needed to schedule all jobs. The fractional relaxation of the Integer Program formulation of our problem is given below. Primal : Minimize m Subject to: m −PC∈Ct −PC∈Cj∩Ct PC∈Cj xC ≥ pj, xC ≥ 0, xC ≥ 0, xC ≥ −1, ∀j ∈ J, t ∈ [T ] ∀t ∈ [T ] ∀j ∈ J ∀C The first constraint ensures that we do not pick more than m configurations for each time slot t ∈ [T ]. The second constraint guarantees that at most one configuration is chosen for each job j at a given time t. Finally, the last constraint guarantees that each job j is allocated the resource for pj time slots, i.e., job j is completed. Given that the LP has an exponentially number of variables, we consider solving the dual. Dual: Maximize Pj∈J (pjαj −Pt∈[T ] βj,t) Subject to: Pj∈S(αj − βj,t) − γt ≤ 0, ∀C = (S, t) Pt∈[T ] γt ≤ 1, αj, βj,t, γt ≥ 0 The proof of the following theorem is similar to a result due to Fleischer et al. [16], with some differences due to the "negative" terms in the objective of the dual program. Theorem 7. For any ǫ > 0, there is a polynomial time algorithm that yields a (1 + ǫ)-approximate solution for the configuration LP. Proof. We first describe a separation oracle for the dual program. Given a vector (γt : t ∈ [T ], βj,t : j ∈ J, t ∈ [T ], αj, j ∈ J), the oracle should either report that the solution is feasible or find a violating constraint. Clearly, the non-trivial task is to check the exponentially many constraints corresponding to the configurations. To this end, we compute a configuration C = (S, t), for each t, that maximizes the value Pj∈S(pjαj − βj,t). Subsequently, we can compare this value against the fixed value γt. Further, observe that such a subset S (for a given t) can be approximately found by solving the following instance of the multi-dimensional knapsack problem. Indeed, we have an item for each job j ∈ Jt with size sj and profit pjαj − βj,t. The goal is to find a subset of items of maximum total profit that can fit into the d-dimensional bin 1d. There is a well known PTAS for the multi-dimensional knapsack problem, for any fixed d > 1 [19]. Let ǫ′ > 0 be the error parameter for the PTAS. We now run the ellipsoid algorithm on the dual program. We perform a binary search over the possible values of z∗ ≤Pj∈J (αj −Pt∈T βj,t). Suppose that the ellipsoid algorithm reports failure at the value z∗ + δ, where δ is the accuracy parameter of the binary search, which can be made as small as desired. Clearly, the optimal solution value must be lower than z∗ + δ. On the other 13 hand, since we are using a (1 + ǫ′)-approximation oracle, we have that if a solution (αj, βj,t, γt) is reported to be feasible, then we must have that (αj/(1 + ǫ′), βj,t/(1 + ǫ′), γt) is feasible for the original dual program. Hence, the optimal solution lies in the range [z∗/(1 + ǫ′), z∗ + δ]. Further, we look at the constraints checked by the ellipsoid algorithm when the value is set to be z∗ +δ. There are polynomial number of such constraints before the algorithm reports a failure. We consider the dual of this restricted LP that is equivalent to a restricted original configuration LP obtained by setting the variables corresponding to the constraints not considered by the ellipsoid algorithm. As noted by Fleischer et al. [16], the cost of this LP is at most z∗ + δ by LP duality. Thus, for appropriate selection of ǫ′ ∈ (0, ǫ), we obtain a (1 + ǫ)-approximate solution for the configuration LP. Input: MinR instance (J, W), where J is the set of jobs and W is the set of time-windows Output: An assignment of all jobs in J to a (approximate) minimum number of hosts 1: Solve the configuration LP approximately using Theorem 7 to obtain a (fractional) solution {xC : ∀C}. Let m denote the objective value of the solution (assume m is rounded up to the nearest integer). 2: Let c > 1 be a constant (to be determined). For each t ∈ [T ] repeat: for m1 = cm log d iterations, choose a configuration C ∈ Ct with probability xC /m. If two configurations C1 = (S1, t) and C2 = (S2, t) where S1 ∩ S2 6= φ are chosen in this process, replace C2 with C′ 2 = (S2 \ S1, t). Continue with this replacement process until all configuration sets corresponding to a given time-slot t are disjoint. 3: If a configuration C = (S, t) is chosen in Step 2 in iteration i for time t, assign the jobs in S to host i at time t. 4: Let Jres be the set of residual jobs constructed from J as follows: for each j ∈ J, let nj denote the number of configurations containing job j that are chosen in Step 2. Now, define a residual job j′ with attributes (pj ′ = max(pj − nj, 0), sj ′ = ¯sj∞, χj ′ = χj). For each job associate a set, forb(j′), of forbidden time-slots in which a configuration containing job j is already chosen. 5: Use the construction given in Section 3.2 to transform W into a laminar family of intervals L res = {j′ : and obtain the corresponding mapping L : W → L. Consider a modified instance (J ′ j ∈ Jres}, L) such that χj ′ = L(χj ). 6: Use Lemma 6 to compute a feasible schedule for the residual jobs J ′ res. Let m2 be the number of additional hosts needed in this step. 7: Output the resulting assignment of the jobs in J to m1 + m2 hosts. Algorithm 4: Algorithm for the MinR problem 4.2 The Algorithm Let m∗ denote the optimal value of the configuration LP, and let m ≤ (1 + ǫ)m∗ be the objective value of the approximate solution of the configuration LP, rounded up to the nearest integer. The detailed description of the algorithm is given in algorithm 4. We use the following two stage process. In the first stage, we choose O(m log d) configurations C (with probabilities proportional to their xC values in the LP solution) for each time slot. Indeed, this random selection may lead to partial execution of some jobs j, which are allocated the resources for less than pj time slots. The second stage amends this, by considering the "residual" job parts and assigning them to a set of m new hosts. Our key technical result (in Lemma 5) is that, with high probability, the total volume of the residual jobs to be scheduled in any time window χ is sufficiently small. Some additional challenges arise due to the fact that the time slots used to schedule a job in the first and second stages must be disjoint. Thus, the time slots used for job j in the first stage become "forbidden" for j in the second stage. We associate with each job j a subset of "forbidden" time slots, denoted forb(j) ⊆ χj. Any feasible solution for the residual jobs must ensure that job j is not scheduled at time t ∈ forb(j). To resolve this issue we need to refine Algorithm 2 (in Lemma 6). 14 4.3 Analysis Towards analyzing our algorithm, we prove several technical lemmas. The following useful result is due to McDiarmid [26]. Lemma 4 (McDiarmid). Let Y = (Y1, Y2, . . . , Yl) be a family of independent random variables, such that Yj has its domain over the event set Ej. Further, suppose f : (E1 × E2 × . . . × El) → R is a real function over the l-dimensional event space, such that: f (¯y) − f (¯y′) ≤ ci for all ¯y and i ). ¯y′ differing in exactly the ith coordinate. Then, P r[f (Y ) − E(f (Y )) ≥ ψ] ≤ exp(−2ψ2/Pl The next lemma gives the conditions implying that the total volume of the residual jobs is i=1 c2 small. This is essential for obtaining our performance bounds. Lemma 5. Let χ be any sub-interval of [T ]. For any ǫ ∈ (0, 1), ω ∈ (0, 1), and a sufficiently large value of θ that depends on ǫ and ω, the following holds with probability at least 1 − ǫ assuming interval χ staisfies Xj∈Jres:χj ⊆χ p′ jk¯sjk∞ ≤ ωmχ, χ ≥ 1 m θd2 log d log(ǫ− 1 2 T ). (6) (7) Further, if T = O(dδ), for some constant δ ≥ 0, then the restriction on the length of χ in (7) can be dropped and (6) holds for any interval χ. Proof. Consider an interval χ that satisfies (7) and a job j such that χj ⊆ χ. Define Xjt as the total xC . (fractional) value of configurations corresponding to job j and time t, i.e., Xjt = PC∈Cj∩Ct Then, (8) (9) Xt∈χj Xjt = XC∈Cj xC ≥ pj Further, by the LP constraints, we have that Xjt ≤ 1. For the analysis, we partition χ into pj regions Rj 1, Rj 2, . . . , Rj pj , such that Xjt ≥ 1/2. Xt∈Rj k The regions are not necessarily formed of consecutive time slots in χ. One way of doing this is as follows. Start with singleton regions {t} for which Xjt ≥ 1/2. Let qj denote the number of regions generated. If qj ≥ pj then we are done; otherwise, until pj regions are obtained, we do the following, for k ∈ [qj + 1, pj]: starting with Rj Xjt < 1/2, add a time slot t′ that has not yet been assigned to any region. Since any such t′ has not been chosen as a Xjt ≤ 1. From Equation (8) we have that k = φ and while Pt∈Rj k singleton region, we have Xjt′ < 1/2; therefore,Pt∈Rj at least pj regions are generated in this process. k Let Rj k denote the event that job j is not scheduled in a given region Rj k in the first stage of k). Let P r(j, t) be the probability that j is the algorithm. We now compute the probability P(Rj not assigned to any host at time t. Then, P r(j, t) =(cid:18)1 − Xjt m (cid:19)cm log d ≤ exp(−cXjt log d) Hence, the probability that job j is not scheduled in region Rj k satisfies P(Rj k) ≤ Πt∈Rj k exp(−cXjt log d) = exp(−c log d Xt∈Rj k ≤ exp(− c 2 log d) = d− c 2 15 Xjt) (10) The last inequality follows from (9). P(Rj j ] ≤ Pk∈[pj ] Recall that p′ j (in Algorithm 4) is the processing time required for the residual job j. The value j is upper bounded by the number of regions in which job j has not been scheduled. Therefore, of p′ we have E[p′ mχ¯1d. A simple (folklore) fact is that if a set V of d-dimensional items can be vector-packed into the cube ¯1d, then the set of 1-dimensional items obtained from V by taking the ℓ∞ norm of item size 2 . By the LP constraints, we have that Pj:χj ⊆χ pj ¯sj ≤ vectors can be bin packed into at most d unit sized bins. It follows thatPj:χj ⊆χ pjk¯sjk∞ ≤ mχd. Hence, using (10), we obtain the following upper bound on the expected total volume of residual jobs in χ: k) ≤ pjd− c jk¯sjk∞ p′ E  Xj:χj ⊆χ 2  ≤ mχd1− c (11) To complete the proof, we need to show that, with high probability, the total volume of residual jobs in any sub-interval of [T ] is small. To this end, we apply Lemma 4 as follows. For each t ∈ χ and iteration i ∈ [cm log d], there is an associated random variable indicating the configuration C chosen in iteration i at time t. Note that since Lemma 4 requires independence between events, the configurations considered are the ones prior to the modifications applied in Step 2. This is valid as we define the function f (·) in Lemma 4 to take into account the modifications jk¯sjk∞ which is a function of these cmχ log d independent random variables. If one of these variables is altered, it might affect the choice of at most one configuration, namely, a configuration C′ selected in iteration i at time t is replaced by another configuration C′′. Suppose A′ res(χ) are the two corresponding realizations of the random variable Ares(χ). We now bound the quantity A′ res(χ): the worst scenario is clearly when none of the jobs in configuration C′ is contained in any other configuration chosen at time t, whereas every job in C′′ is contained in some other configuration chosen at time t; or vice versa. Thus, we have A′ res(χ) ≤ applied in Step 2. This function is defined as the quantity Ares[χ] = Pj:χj ⊆χ p′ res(χ) and A′′ res(χ) − A′′ res(χ) − A′′ max(Pj∈C ′ k¯sjk∞,Pj∈C ′′ k¯sjk∞) ≤ d. Applying Lemma 4, we have, for any ω′ ≥ 0 P r[Ares(χ) − E(Ares(χ)) ≥ ω′mχ] ≤ exp(−(2ω′2)m2χ2 cm log dχd2) = exp(− 2ω′2 c · mχ d2 log d ) Let c > 2 be a sufficiently large constant such that ω > d1− c 2 . We set ω′ = ω − d1− c 2 , and θ = cω′−2. Then, we have P r[Ares(χ) ≥ ωmχ] = P r[Ares(χ) ≥ (ω′ + d1− c ≤ P r[Ares(χ) − E(Ares(χ)) ≥ ω′mχ] 2 )mχ] ≤ exp(− 2ω′2 c · ≤ exp(−2 log(ǫ− 1 ) = exp( mχ d2 log d 2 T )) = ǫT −2 −2 θ · mχ d2 log d ) The first inequality follows from (11) and the third from (7). Since the total number of distinct intervals possible in [T ] is at most T 2, by applying the union bound, the probability that some interval χ that satisfies (7) fails to satisfy (6) is at most ǫ. Now, consider the case where T = dδ, for some constant δ ≥ 0 (independent of d). We have P r[Ares(χ) ≥ ωmχ] ≤ P r[Ares(χ) ≥ E(Ares(χ))ω d1− c 2 ] ≤ d1− c 2 ω . The first inequality follows from (11) and the second from Markov's inequality. As before, we observe that total number of distinct intervals possible in [T ] is at most T 2 ≤ d2δ. Now, we choose ǫ′ > 0 to be a large enough constant satisfying ω−1d− ǫ′ 2 ≤ ǫ, and c ≥ 2(2δ + 1) + ǫ′. Hence, P r[Ares(χ) ≥ ωmχ] ≤ d1−(2δ+1)−ǫ′/2 ω ≤ ǫT −2. 16 Again, since the total number of distinct intervals possible in [T ] is at most T 2, by applying the union bound, the probability that some interval χ fails to satisfy (6) is at most ǫ. The next lemma gives the condition that guarantee feasible schedule for the residual jobs. Lemma 6. Let (J, L) be a single resource laminar instance of MinR such that for any job j, pj + forb(j) ≤ λχj, for some λ ∈ (0, 1), and for any χ ∈ L: P{j∈J:χj ⊆χ} pjsj ≤ αmχ, for some α ∈ (0, 1). Then, if λ + 2α ≤ 1, all jobs in J can be assigned to m hosts. Proof. We use an algorithm similar to Algorithm 2. The only difference is that in our case avail(j) ⊆ χj \ forb(j). Similar to the proof of Theorem 2 we prove that the algorithm never reports fail while assigning job j. Suppose that j was assigned to p′ j < pj bins before this fail. For t ∈ χj, we say that bin (i, t) is bad if either t ∈ forb(j), or (i, t) is colored gray, or j has been assigned to some bin (i′, t) in the same time slot. It can be shown by induction that as long as no job j+ such that χj ⊂ χj+ has been allocated the resource: the number of bad bins while sj sj ′ > 1, the total number of black bins < 2αmχj. Hence, the total number of bins that are black or bad is < (λ + 2α)mχj. Thus if λ + 2α ≤ 1, there should be at least one bin (i∗, t∗) that is neither black nor bad. But in this case, we could have assigned j to host i∗ at time t∗, which is a contradiction to the assumption that the algorithm reports a fail. processing job j is at most λmχ. Since we pair the black bins (i, t) ↔ (i′, t′) only if Pj∈S(i,t) + Pj ′∈S(i′ ,t′ ) The above lemmas lead to an O(log d) performance guarantee for instances with large time windows, as formalized in the next result. Theorem 8. Let (J, W) be an instance of MinR with slackness parameter λ ∈ (0, 1 (0, 1). If χj ≥ 1 yields an O(log d) approximation guarantee with probability at least 1 − ǫ. 4 ). Fix an ǫ ∈ 2 ) ∀ j ∈ J, for sufficiently large constant θ, then Algorithm 4 m θd2 log d log(T ǫ− 1 Proof. The optimal objective value of the configuration LP, denoted m∗ is a lower bound on the number of hosts required for the instance (J, W). By Theorem 7, m ≤ (1 + ǫ)m∗. Now, assuming Algorithm 4 is correct, the number of hosts used is at most m(c log d) + m, implying an O(log d) approximation guarantee. Below, we prove correctness of Algorithm 4, i.e., we show that it feasibly schedules all the jobs in J. It suffices to show that the residual set of jobs Jres can be successfully scheduled. Recall that Algorithm 4 uses the construction given in Section 3.2 to transform W into a laminar set of intervals L and to obtain a mapping L : W → L. Then, the algorithm computes a schedule res = {j′ : j ∈ J}, L), where of the residual set of jobs Jres by solving the laminar instance (J ′ χj ′ = L(χj ). Observe that for any job j ∈ Jres we have that p′ j + forb(j) = pj ≤ λχj ≤ 4λχj ′ , where the last inequality follows from Lemma 1. By the same lemma, we also get that for any job j ∈ Jres, χj ′ ≥ 1 4 χj. Now, let χj ′ be the union of all the time windows mapped by L to time 4m θd2 log d log(T ǫ− 1 windows in χj ′ . Also, by Lemma 1 χj ′ ≤ 4χj ′ . Clearly, χj ′ ≥ χj ′ ≥ 1 2 ). Now, apply Lemma 5 to the intervals χj ′ for j ∈ Jres (with appropriate value of θ), to get that jk¯sjk∞ ≤ 4ωmχ with probabillty at least 1 − ǫ. We now apply Lemma 6, by setting α ← 4ω and λ ← 4λ. We note that there is a feasible schedule of jobs j′ on m hosts if 4λ + 8ω = 1. Indeed, for any λ < 1 4 , there is a positive constant ω that satisfies this equation. Finally, it is easy to show that transforming the instance back to d dimensions (by replacing the requirement of k¯sjk∞ by ¯sj) the schedule remains feasible. This completes the proof. that Pj∈Jres:χj′ ⊆χ p′ We conclude our analysis with the following result. Theorem 9. Let (J, W) be an instance of MinR with slackness parameter λ ∈ (0, 1 4 ). Fix an ǫ ∈ (0, 1). There is a polynomial time algorithm that yields an O(log d log∗ T ) approximation ratio with probability at least 1 − ǫ. Proof. The key idea is the following. Starting with the maximum schedule length T , we recursively define κ + 1 ranges for the time-window sizes in the original instance. We then partition the set of jobs J to κ + 1 subsets, each containing jobs with time windows within the corresponding range, where κ = O(log∗ T ). The crux of this partition is that the resulting κ + 1 instances of our problem satisfy the conditions of Theorem 8. In particular, all jobs have 'large' windows. Thus, 17 we can obtain for each instance a log d-approximate solution. Formally, let θ be the constant in Theorem 8. Set γ = θd2 log d (we assume that the log is base 2). Define the function ψ : N → R+ as follows: ψ(i) =(4⌈γ2⌉ min{T,(cid:0)21/(2γ)(cid:1)ψ(i−1) if i = 1 } if i > 1 It is easy to verify that, for i ≥ 1, we have ψ(i) ≤ ψ(i + 1), and ψ(i) ≥ 2γ log2 ψ(i + 1). Also, let κ be the smallest integer for which ψ(κ) = T . Then, we have κ = O(log∗ T ). We partition the set of intervals W into groups based on their length as follows: I0 = {χ : χ ∈ [1, ψ(1)]}, Iw = {χ : χ ∈ (ψ(w), ψ(w + 1)]} for all w ∈ [1, κ]. Next, we define κ + 1 instances of our problem, where the wth instance is given by: (Jw = {j ∈ J : χj ∈ Iw}, Iw). Since each of the above instances requires to schedule a subset of jobs in the original instance, they optimally need at most m hosts to complete all jobs. Consider the wth instance. The largest window size here is at most ψ(w + 1). We further partition this instance as follows. Let I i w,Odd = [(2i + 1)ψ(w + 1) + 1, min{(2i + 3)ψ(w + 1), T }], where i ≥ 0 and (2i + 1)ψ(w + 1) < T . Similarly, let I i w,Even = [(2i)ψ(w + 1) + 1, min{(2i + 2)ψ(w + 1), T }], where i ≥ 0 and (2i)ψ(w + 1) < T . Now, we define and J i w,Odd = {j ∈ Jw : χj ⊆ I i w,Odd} J i w,Even = {j ∈ Jw : χj ⊆ I i w,Even}. Let Jw,Odd = ∪iJ i from Jw,Even and the corresponding J i w,Odd and Jw,Even = ∪iJ i w,Even. Finally, remove each job j ∈ Jw,Odd ∩ Jw,Even w,Even. Consequently, Jw,Odd ∩ Jw,Even = ∅. For any w > 0, fix an i ≥ 0 such that (2i + 1)ψ(w + 1) < T and consider the instance defined by the jobs in J i w,Odd. We claim that this instance can be solved using Theorem 8. Indeed, the total number of time slots in this instance is 2ψ(w + 1), and the time-window of any job j in the instance is χj ≥ ψ(w) ≥ 2θd2 log d log ψ(w + 1). Thus, the conditions in Theorem 8 are satisfied, and we can obtain a feasible schedule using O(m log d) hosts. Now, fix an i ≥ 0 such that (2i + 1)ψ(1) < T and consider the instance defined by the jobs in J i 0,Odd. We claim that this instance can also be solved using Theorem 8, since in this case the total number of time slots in this instance is 2ψ(1) = O(dδ), for some constant δ ≥ 0. w,Odd, J ℓ w,Odd for i 6= ℓ are mutually disjoint (jobs and time-windows). Thus, we can solve them in parallel using the same O(m log d) hosts. We can do the same for Jw,Even. Suppose we need mo and me hosts to solve Jw,Odd and Jw,Even, respectively. Since no job is shared between Jw,Odd and Jw,Even, we can schedule all the jobs in Jw using mo + me = O(m log d) hosts. Note that for any w, the odd instances J i Now, to handle the instances corresponding to all w ∈ {0, . . . , κ}, we note that no job is shared among the instances. Therefore, we can aggregate the hosts to obtain a feasible schedule for all instances using O(mκ log d) hosts. References [1] Micah Adler, Phillip B Gibbons, and Yossi Matias. Scheduling space-sharing for internet advertising. Journal of Scheduling, 5(2):103 -- 119, 2002. 18 [2] Alexander A. Ageev and Maxim Sviridenko. Pipage rounding: A new method of constructing algorithms with proven performance guarantee. J. Comb. Optim., 8(3):307 -- 328, 2004. [3] Nikhil Bansal, Alberto Caprara, and Maxim Sviridenko. A new approximation method for set covering problems, with applications to multidimensional bin packing. SIAM J. Comput., 39(4):1256 -- 1278, 2009. [4] Nikhil Bansal, Marek Eli´as, and Arindam Khan. Improved approximation for vector bin packing. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1561 -- 1579, 2016. [5] Nikhil Bansal, Zachary Friggstad, Rohit Khandekar, and Mohammad R Salavatipour. A loga- rithmic approximation for unsplittable flow on line graphs. ACM Transactions on Algorithms, 10(1):1, 2014. [6] Amotz Bar-Noy, Reuven Bar-Yehuda, Ari Freund, Joseph Naor, and Baruch Schieber. A unified approach to approximating resource allocation and scheduling. J. ACM, 48(5):1069 -- 1090, 2001. [7] Amotz Bar-Noy, Sudipto Guha, Joseph Naor, and Baruch Schieber. Approximating the throughput of multiple machines in real-time scheduling. SIAM J. Comput., 31(2):331 -- 352, 2001. [8] Gruia Calinescu, Amit Chakrabarti, Howard J. Karloff, and Yuval Rabani. An improved approximation algorithm for resource allocation. ACM Trans. Algorithms, 7(4):48:1 -- 48:7, 2011. [9] Venkatesan T Chakaravarthy, Anamitra R Choudhury, Shalmoli Gupta, Sambuddha Roy, and Yogish Sabharwal. Improved algorithms for resource allocation under varying capacity. In European Symposium on Algorithms, pages 222 -- 234. Springer, 2014. [10] Chandra Chekuri and Sanjeev Khanna. On multidimensional packing problems. SIAM jour- nal on computing, 33(4):837 -- 851, 2004. [11] Bo Chen, Refael Hassin, and Michal Tzur. Allocation of bandwidth and storage. IIE Trans- actions, 34(5):501 -- 507, 2002. [12] Julia Chuzhoy and Paolo Codenotti. Resource minimization job scheduling. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, pages 70 -- 83. Springer, 2009. [13] Julia Chuzhoy, Sudipto Guha, Sanjeev Khanna, and Joseph Naor. Machine minimization In Foundations of Computer Science, 2004. for scheduling jobs with interval constraints. Proceedings. 45th Annual IEEE Symposium on, pages 81 -- 90, 2004. [14] Milind Dawande, Subodha Kumar, and Chelliah Sriskandarajah. Performance bounds of algorithms for scheduling advertisements on a web page. Journal of Scheduling, 6(4):373 -- 394, 2003. [15] Milind Dawande, Subodha Kumar, and Chelliah Sriskandarajah. Scheduling web advertise- ments: a note on the minspace problem. Journal of Scheduling, 8(1):97 -- 106, 2005. [16] L. Fleischer, M. X. Goemans, V. S. Mirrokni, and M. Sviridenko. Tight approximation algorithms for maximum separable assignment problems. Math. Oper. Res., 36(3):416 -- 431, 2011. [17] Kyle Fox and Madhukar Korupolu. Weighted flowtime on capacitated machines. In Pro- ceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms, pages 129 -- 143. SIAM, 2013. [18] Ari Freund and Joseph Naor. Approximating the advertisement placement problem. Journal of Scheduling, 7(5):365 -- 374, 2004. 19 [19] Alan M Frieze and MRB Clarke. Approximation algorithms for the m-dimensional 0 -- 1 knap- sack problem: Worst-case and probabilistic analyses. European Journal of Operational Re- search, 15(1):100 -- 109, 1984. [20] Navendu Jain, Ishai Menache, Joseph Naor, and Jonathan Yaniv. Near-optimal scheduling mechanisms for deadline-sensitive jobs in large computing clusters. ACM Transactions on Parallel Computing, 2(1):3, 2015. [21] Klaus Jansen and Lorant Porkolab. On preemptive resource constrained scheduling: polynomial-time approximation schemes. Integer Programming and Combinatorial Optimiza- tion, pages 329 -- 349, 2002. [22] Bala Kalyanasundaram and Kirk Pruhs. Eliminating migration in multi-processor scheduling. J. Algorithms, 38(1):2 -- 24, 2001. [23] Arshia Kaul, Sugandha Aggarwal, Anshu Gupta, Niraj Dayama, Mohan Krishnamoorthy, and PC Jha. Optimal advertising on a two-dimensional web banner. International Journal of System Assurance Engineering and Management, pages 1 -- 6, 2017. [24] Subodha Kumar, Milind Dawande, and Vijay Mookerjee. Optimal scheduling and placement of internet banner advertisements. IEEE Transactions on Knowledge and Data Engineering, 19(11), 2007. [25] Eugene L Lawler. A dynamic programming algorithm for preemptive scheduling of a single machine to minimize the number of late jobs. Annals of Operations Research, 26(1):125 -- 133, 1990. [26] Colin McDiarmid. On the method of bounded differences. Surveys in combinatorics, 141(1):148 -- 188, 1989. [27] Shinjini Pandey, Goutam Dutta, and Harit Joshi. Survey on revenue management in media and broadcasting. Interfaces, 47(3):195 -- 213, 2017. [28] Cynthia A. Phillips, R. N. Uma, and Joel Wein. Off-line admission control for general schedul- ing problems. In Proceedings of the Eleventh Annual ACM-SIAM Symposium on Discrete Algorithms, pages 879 -- 888, 2000. 20
1711.09384
1
1711
2017-11-26T13:20:06
Online Facility Location on Semi-Random Streams
[ "cs.DS" ]
In the streaming model, the order of the stream can significantly affect the difficulty of a problem. A $t$-semirandom stream was introduced as an interpolation between random-order ($t=1$) and adversarial-order ($t=n$) streams where an adversary intercepts a random-order stream and can delay up to $t$ elements at a time. IITK Sublinear Open Problem \#15 asks to find algorithms whose performance degrades smoothly as $t$ increases. We show that the celebrated online facility location algorithm achieves an expected competitive ratio of $O(\frac{\log t}{\log \log t})$. We present a matching lower bound that any randomized algorithm has an expected competitive ratio of $\Omega(\frac{\log t}{\log \log t})$. We use this result to construct an $O(1)$-approximate streaming algorithm for $k$-median clustering that stores $O(k \log t)$ points and has $O(k \log t)$ worst-case update time. Our technique generalizes to any dissimilarity measure that satisfies a weak triangle inequality, including $k$-means, $M$-estimators, and $\ell_p$ norms. The special case $t=1$ yields an optimal $O(k)$ space algorithm for random-order streams as well as an optimal $O(nk)$ time algorithm in the RAM model, closing a long line of research on this problem.
cs.DS
cs
Online Facility Location on Semi-Random Streams Harry Lang∗ Abstract In the streaming model, the order of the stream can significantly affect the difficulty of a problem. A t-semirandom stream was introduced as an interpolation between random-order (t = 1) and adversarial-order (t = n) streams where an adversary intercepts a random-order stream and can delay up to t elements at a time. IITK Sublinear Open Problem #15 asks to find algorithms whose performance degrades smoothly as t increases. We show that the celebrated online facility location algorithm achieves an expected competitive ratio of O( log t log log t). We present a matching lower bound that any randomized algorithm has an expected competitive ratio of Ω( log t log log t). We use this result to construct an O(1)-approximate streaming algorithm for k- median clustering that stores O(k log t) points and has O(k log t) worst-case update time. Our technique generalizes to any dissimilarity measure that satisfies a weak triangle inequality, including k-means, M-estimators, and 'p norms. The special case t = 1 yields an optimal O(k) space algorithm for random-order streams as well as an optimal O(nk) time algorithm in the RAM model, closing a long line of research on this problem. 7 1 0 2 v o N 6 2 ] S D . s c [ 1 v 4 8 3 9 0 . 1 1 7 1 : v i X r a ∗Inria Saclay and Johns Hopkins University. Introduction 1 One of the fundamental theoretical questions in the streaming model is to understand how the stream order impacts computation. In the adversarial-order model, results must hold under any order, whereas in the random-order model the order is selected uniformly at random. The order of the stream can strongly affect the resources required to solve a problem. For example, for streams of n integers where the stream may be read sequentially multiple times, determining the median using polylogarithmic space requires Θ( log n log log n) passes in adversarial-order [33, 18] but only Θ(log log n) passes in random-order [17, 8]. As demonstrated by the median problem, there can be an exponential gap in the resources required for random-order and adversarial-order streams. To interpolate between these two extremes, Guha and McGregor introduced two notions of semirandom-order where the adversary has limited power. Definition 1 (t-semirandom order, [17]). A t-bounded adversary1 can permute a stream p1, . . . , pn to the stream pσ(1), . . . , pσ(n) with any permutation σ that satisfies {j ∈ [n] : j < i and σ(j) > σ(i)} < t for every i ∈ [n]. A stream is in t-semirandom order if it is generated by a t-bounded adversary acting on a random-order stream. Definition 2 (-generated random order, [18]). Let µ be the uniform distribution over all permutations of n elements. A stream of n points arrives in -generated random-order if the permutation is drawn from a distribution ν such that µ − ν1 ≤ 2. These models capture the notion of an adversary with limited power and establish a spectrum of semirandom orders to intermediate between the fully random and fully adversarial cases. IITK Sublinear Open Problem #15 [27] asks: How do these notions relate to each other? Can we develop algorithms whose performance degrades smoothly as the stream ordering becomes "less-random" using either definition? For a given application, which notion is more appropriate? We respond to the first question by showing that no non-trivial relations hold between these models. One can verify that  = 0 and t = 0 correspond to random-order, and that  = 1 and t = n correspond to adversarial-order. However, we show that these models are incomparable in the sense that an -generated adversary requires  > 1 − 2−Ω(n) to simulate the action of a t-bounded adversary for any t > 1, and that a t-bounded adversary requires t > n/2 to simulate the action of an -generated adversary for any  ≥ 2−Ω(n). We answer the second question by proving matching bounds for the online facility location problem that show the performance degrades smoothly as t increases. These are the first bounds for semirandom streams that match at all values of t. Previous results matched only for t sufficiently small. For example, the result of [17] shows how to return the median in √ n). However, for a constant c < 1 the algorithm is only O(log log n) passes when t = O( 1Our definition of t-bounded actually corresponds to (t − 1)-bounded as introduced in [17]. This turns out to be more natural and avoids writing t + 1 in all our bounds. 1 guaranteed to terminate in O(n) passes when t = Ω(nc). In comparison, even at t = n there are polylogarithmic-space algorithms that return the median in only O(log n/ log log n) passes [33]. Our results provide evidence that t-bounded adversarial-order is a viable model of semi- randomness. We address the third question by complementing our positive results for the t-semirandom model with an argument showing that the -generated random order model is uninteresting for a wide class of problems. A more complete discussion of IITK Open Question #15 is included in Section 6. 1.1 Our Contributions We present results for online facility location and a large class of clustering problems. In Section 3, we provide a novel analysis that the online facility location algorithm of [31] is O( log t log log t)-competitive in expectation. Adapting Meyerson's original argument for a t-bounded adversary is possible but results in an O(t) expected competitive ratio. We introduce a different analysis that permits this exponential improvement. We complement this result by presenting a matching lower bound in Section 4 that any randomized algorithm for online facility location is Ω( log t log log t)-competitive in expectation. See Table 1 for a comparison with existing results. In Section 5, we present a streaming algorithm for clustering using any function that satisfies a weak triangle inequality (this includes k-median, k-means, M-estimators, and 'p norms). Our algorithm stores O(k log t) points and has O(k log t) worst-case update time. As shown in Table 2, we match the state-of-the-art for adversarial-order streams and provide the first results for all t < n. We remark that our algorithm respects sparsity by only storing a weighted subset of the input. Another notable property of our clustering algorithm is that it is oblivious to the actual values of k and t. The algorithm takes an input value m, and the output is valid as long as m = Ω(k log t). This may be useful for practical applications where the number of clusters or power of the adversary is unknown. For example, if the data exhibits a hierarchical structure than the resolution of the result (measured by k) degrades smoothly as the power of the adversary increases. The special case t = 1 yields the first result for clustering on random-order streams. In the RAM model where we can shuffle the input into random order in linear time, this implies an optimal O(nk) time algorithm and closes a long line of research on the problem. As a blackbox used by our clustering algorithm, we present a method to compress a 2 distinct points in linear time while weighted set of n distinct points to a weighted set of n+k incurring less than twice the optimal cost of clustering to k points. Our algorithm, based on 2-coloring a nearest neighbor graph, is presented in Section 5.2 as it may be of independent interest. 1.2 Prior Work Random-Order Streams: There has been an increasing interest to design algorithms for data streams that arrive in random-order, and in recent years the model has become 2 Regime t = 1 1 ≤ t ≤ n t = n Upper Bound Source [31] Lower Bound Source Trivial Ω(1) Ω(cid:16) log t Ω(cid:16) log n log log t log log n (cid:17) (cid:17) ?? [15] O(1) (cid:16) log t (cid:16) log n log log t log log n (cid:17) (cid:17) O O ?? [15] Table 1: Expected competitive ratio for online facility location. Upper bounds apply to the algorithm of [31]. Lower bounds apply to any randomized algorithm. Regime t = 1 Space O(k) 1 ≤ t ≤ n O(k log t) O(k log n) t = n Source ?? ?? [15] Table 2: Space complexity (measured in weighted points) of algorithms for metric k-median and k-means in the streaming model. quite popular. Random-order streams have been considered for problems including rank selection [33, 20, 28], frequency moments [3], entropy [21], submodular maximization [32], and graph matching [26, 25, 13]. Lower bounds that hold even under the assumption of random-order have been developed using multi-party communication complexity [9, 7, 8, 16]. Semirandom-order streams, in both the t-bounded and -generated models, have been considered for rank selection [17, 18]. The stochastic streaming model, which takes the random-order assumption a step further by assuming that stream elements are independent samples from an unknown distribution, has also attracted attention [19, 34, 12]. The stochastic streaming model is strictly easier than the random-order model since any stochastic stream is automatically in random-order. Online Facility Location: The study of online facility location was initiated by Mey- erson [31]. He provided a simple randomized algorithm and proved that for random- order streams it is O(1)-competitive in expectation. Later, Fotakis [15] showed that for adversarial-order streams any randomized algorithm has an expected competitive ratio of Ω(log n/ log log n) and proved that Meyerson's randomized algorithm achieves this bound; he also presented a novel deterministic algorithm that achieves this bound. For Euclidean space, a simple and practical deterministic algorithm was provided by [2]. Streaming Metric k-median and k-means Clustering: The streaming k-median and k-means problems have only been considered in the adversarial-order model. These problems are well-studied; here we mention only the metric space results that achieved an improve- ment in the space bound over the previous state-of-the-art. The first streaming solution computed a 2O(1/r)-approximation for any r ∈ (0, 1) and stored O(nr/r) points [22]. Later, 3 an algorithm storing only O(k log2 n) points was provided [10]. The current state-of-the-art O(1)-approximation stores O(k log n) points [6]. A variety of other results are known for Euclidean space. Runtime O(n2 log n) O(nk log k) O(n2) O(nk + n log n + k2 log2 n) O(nk + n1/2k3/2 log2 n log3/2 k) O(nk) Ω(nk) Source [24] [23] [29] [30] [11] ?? [30] Table 3: Results for metric k-median in the RAM model RAM-Model Metric k-median and k-means Clustering: The history of fast O(1)- approximations2 in the RAM model is summarized in Table 3, omitting results that do not improve the runtime for any value of k. These results for k-median generalize to k-means with a larger constant in the approximation ratio. We conclude this line of research with an optimal O(nk) time algorithm, matching the Ω(nk) time lower bound for any randomized algorithm [30]. We remark that there exists an O(nk) time algorithm for k-means in Euclidean space [1], but it relies on the principal axis theorem and therefore does not generalize to k-median or to other metric spaces. 2 Preliminaries Let (X , d) be a metric space. In the facility location problem with parameter f > 0 (called the facility cost), we are given a set3 A ⊂ X called demands. The problem is to compute a set B ⊂ X called facilities and to connect each demand to a facility. To connect demand a to facility b, we incur cost d(a, b). We also incur cost f for each facility opened. The objective is to a∈A minb∈B d(a, b), the total cost is Bf + COST(A, B) by connecting each demand to the nearest facility. compute B such that the total cost is minimized. Defining COST(A, B) =P In online facility location, we receive A as a stream of points. When point p arrives, we may open a facility (incurring facility cost f) and then must connect p to a facility 2Most of the results shown in Table 3 actually output O(k) centers instead of exactly k. However, we observe that the result of [29] implies that any solution of O(k) centers can be converted to a solution of exactly k centers in O(k2) time. 3We use the word "set" to actually mean "multiset". Multisets may contain multiple copies of the same element. 4 Figure 1: Example of a 3- bounded adversary acting on a stream. Each step is shown on a different row. The shaded box represents the memory of the adversary. The adversary must send an element to the algorithm before receiving the next element. (incurring connection cost). Observe that if we open a facility at the location of p, there is no connection cost. The problem is online because the decisions to open a facility and connect p are irrevocable, meaning that a facility can never be closed and that p cannot be reconnected if a closer facility opens later. For the k-median problem, there is no facility cost but the number of facilities (here called centers) is fixed at k. The goal is to compute a set B that minimizes the total cost COST(A, B). When the input arrives as a stream, we seek to design algorithms that require a minimal amount of memory. Definition 3 (Optimal Cost). Let A be a set and let k ≥ 1. OPTk(A) is defined as the minimum of COST(A, B) where B ⊂ X ranges over all sets of k points. The optimal cost for k-median is OPTk(A). For facility location, the optimal cost is the minimum kf + OPTk(A) where k ranges over all positive integers. An α-approximation is a solution with cost at most α times the optimum. A t-semirandom stream is the result of a random-order stream that has been intercepted by a t-bounded adversary (see Definition 1). Imagine that the stream of elements is a deck of cards, initially shuffled into random order. The adversary draws cards into his hand from the deck. He may give any card from his hand to the algorithm. The restriction is that he can have at most t cards in his hand at any time. This means that if he has a full hand of t cards, he cannot draw a new card until giving one to the algorithm. See Figure 1 for an example. 3 Online Facility Location The algorithm of Meyerson [31] is simple and elegant. Let f > 0 be the facility cost parameter. When a point p arrives, let δ(p) be the distance between p and the nearest facility. With probability min(1, δ(p)/f), we open a facility at p and pay facility cost f. Otherwise, we connect p to the nearest facility and pay connection cost δ(p). We write OFL to refer to this algorithm. Theorem 1. Let r > 1 and h ∈ N such that rh ≥ 4t, and let k be a positive integer. If OFL(f) runs on a t-semirandom stream S, the facility cost and connection cost incurred by OFL(f) are each less than (r + 3)OPTk(S) + (h + 2)f k in expectation. 5 1234563124563124563142563146257878787878 Proof. Partition S into k optimal clusters {X'}'∈[k] so that OPTk(S) = P '∈[k] OPT1(X'). Consider the centers {c'}'∈[k] such that COST(X', c') = OPT1(X'). Lemmas 1, 2, and 6 bound the expected connection cost and expected facility cost on each X' by (r+3)OPT1(X')+(h+2)f. We obtain the result by summing over all ' ∈ [k]. We now provide the results used in the proof of Theorem 1. Let X ⊂ S be a set of n points. Given a center point c, define A = COST(X, c) and a = A/n. We partition X into three pieces as follows: G = {x ∈ X : d(x, c) ≤ 2a} M = {x ∈ X : 2a < d(x, c) ≤ 2rha} B = {x ∈ X : d(x, c) > 2rha} Defining AZ = COST(Z, c) for any set Z, we decompose A = AG + AM + AB. Fact 1. In any order, the expected connection cost of a set Z incurred before a facility opens in Z is less than f. Proof. For convenience we normalize to f = 1. Let (z1, . . . , zm) be the order of Z. Define xj = min(1, δ(zj)). There is a probability of xj that point zj opens as a facility; otherwise zj incurs connection cost xj. Let Ei denote the expected connection cost before a facility is opened when OFL is run Ei =Pm on the suffix (zi, zi+1, . . . , zm). For 1 ≤ i ≤ j ≤ m define P j '=i(1 − x'). Observe that We write the recursive formula Ei = (1 − xi)(xi + Ei+1). Observe that Em ≤ 1/4, with the maximum occurring when xm = 1/2. Assuming inductively that Ei+1 < 1, observe that Ei = (1 − xi)(xi + Ei+1) < 1 − x2 i ≤ 1. We conclude that E1 < 1. i =Qj j=i xjP j i . We seek to prove that E1 < 1. Observe that δ(p) can be used to simultaneously bound both the expected connection cost and the expected facility cost. We use this in Lemmas 1-6 to bound both types of cost with the same argument. Lemma 1. In any order, the expected connection cost and expected facility cost of G are each at most f + AG + 2aG. Proof. By Fact 1, the expected connection cost of points in G before a facility opens in G is less than f. The facility cost is exactly f when the first facility opens in G. After a facility has opened in G, we may bound δ(g) ≤ d(g, c) + 2a for any g ∈ G by the triangle inequality. The result follows by summing over all g ∈ G. The proof of the next lemma is similar to the previous. Lemma 2. In any order, the expected connection cost and expected facility cost of M are each at most hf + (r + 1)AM. Proof. We partition M into h parts, defining Mj = {x ∈ X : 2rj−1a < d(x, c) ≤ 2rja} for j ∈ {1, . . . , h}. By Fact 1, the expected connection cost of points in Mj before a facility opens in Mj is less than f. The facility cost of Mj is exactly f when the first facility opens in Mj. After a facility opens in Mj, we may bound δ(m) ≤ d(m, c) + 2rja ≤ (r + 1)d(m, c) for each m ∈ Mj by the triangle inequality. The result follows by summing over all m ∈ M. 6 Fixing an order, let α0 i be the expected connection cost of the ith point of G. For j. For i ∈ {0, . . . ,G}, let βi be the number of points i ∈ {1, . . . ,G}, define αi = min1≤j≤i α0 in B that arrive after exactly i points of G have arrived. each at most AB + 2aB + f β0 +PG Lemma 3. In any order, the expected connection cost and expected facility cost of B are i=1 αiβi. Proof. The first β0 points of B incur cost at most f β0 trivially. If a point b arrives after a point g, then δ(b) ≤ d(b, c) + 2a + δ(g) by the triangle inequality. Hence for a point b that arrives after i points of G, taking expectations and then the minimum over the i preceding points of G shows that E[δ(b)] ≤ d(b, c) + 2a + αi. The result follows by summing over all b ∈ B. The remainder of the proof will depend on the assumption of t-semirandom order. For precision, we continue to use E[·] for expectation over the randomness used by OFL and introduce E[·] for expectation over the randomness of the stream order. Let β0 i be the number of points in B that occur after exactly i points of G in the initial random-order stream before being intercepted by the adversary. Since the adversary may hold at most t points, if the adversary has received t + i points of G then the algorithm has received at least i points of G. This provides the relation β0 + . . . + βi ≤ β0 i+t−1 for every i ≥ 0. We can view i as the number of balls in the ith bin when we randomly drop B balls into G + 1 bins. β0 Observe that f > α1 ≥ α2 ≥ . . . ≥ αG. The adversary's optimal strategy against our bound in Lemma 3 is to delay points in G as long as possible. We therefore identify f β0 +PG i+t−1 for every i ≥ 1. We rewrite the worst-case bound β0 = β0 i=1 αiβi = fPt−1 t−1 and βi = β0 i+t−1. 0 + . . . + β0 i=1 αiβ0 The difficulty is that αi and βi are dependent random variables. Although they cannot affect each other directly, both αi and βi depend on the prefix of the stream ending on the ith point of G. To overcome this, we split the sum into two pieces and for each piece we find an upper bound on either αi or βi that holds independently of the prefix. j +PG 0 + . . . + β0 j=0 β0 The next lemma quantifies the intuition that if many points of G have arrived then there must be a facility very close to G. This bound suffices after a constant fraction of G has arrived. Lemma 4. In t-semirandom order, PG Proof. Let µ(g) be the indicator random variable that no facility is open in G after g P is processed. Let G0 be the set of i points of G that have arrived. Fact 1 implies that g∈G E[δ(g)µ(g)] < f. Thus there must be some g ∈ G0 such that E[δ(g)µ(g)] < f /i. Since αi = ming∈G0 E[δ(g)µ(g)], we bound αi < f /i. By Markov's inequality B < n 4ti. The result follows since PG 2rh ≤ n 8t and G ≥ d n which implies E[αiβi] < E[(f /i)βi] < f i=dG/2e+1 E[αiβi] < f ln(2)/4t. i+t−1] = B i < ln(2). 1 2e. Then E[βi] = E[β0 G+1 < 1 4t i=dG/2e+1 If we drop B balls into G + 1 bins and condition on the number of balls in i of the bins, the expected number of balls in any other bin is at most that of dropping B balls into 7 G − i + 1 bins. This bound blows up towards the end of the stream but suffices for the first half. Lemma 5. In t-semirandom order, PdG/2e E[αiβi] < f ln(3)/2t i=1 Proof. Let P(i) denote the order of the prefix of the stream ending on the ith point of G. Observe that E[β0 j = 0 for all j ∈ {0, . . . , i − 1}. This implies h(i) := maxP (i) E[βiP(i)] ≤ G−i+1 with the maximum occurring when β0 iP(i)] ≤ B B By causality, points that arrive after the ith point of G do not affect αi. Therefore αi is a G−t−i+2. constant when P(i) is fixed. We can now separate E[αiβi] = EP (i)[E[αiβiP(i)]] = EP (i)[E[αiP(i)] · E[βiP(i)] ≤ EP (i)[E[αiP(i)] · h(i)] = h(i)EP (i)[E[αiP(i)]] = h(i)E[αi] i=1 i=1 We have the restraint PG PdG/2e h(i)E[αi] is maximized when αi = fdG/2e for i ≤ dG/2e. We boundPdG/2e PdG/2e since otherwise B = ∅ and there is nothing to show. We conclude by PdG/2e PG−t+1 i=1 E[αi] < f by Fact 1. Since h(i) is increasing, the sum E[αiβi] ≤ 2t. We may assume that t < n 8 G−t−i+2 = G−t−i+2. By Markov's inequality y=bG/2c−t+2 We can now provide a bound for B that holds for t-semirandom order streams. y < ln(cid:16) G−t+1 B dG/2e < 1 < ln(3). bG/2c−t+1 fdG/2e (cid:17) B i=1 i=1 1 1 Lemma 6. In t-semirandom order, the expected connection cost and expected facility cost of B are each less than AB + 2aB + f. bound for the worst-case adversary E[β0] =Pt−1 Proof. We substitute the bounds of Lemmas 4 and 5 into Lemma 3. The last part is to 4 and observe that ln(18) < 3. k=0 E[β0 j] ≤ 1 3.1 Application to Online Facility Location Our main result for online facility location is now a simple corollary of Theorem 1. As shown in the Section 5, Theorem 1 yields results for both online facility location and k-median clustering by applying the theorem with different choices of r and h. Corollary 1. On a t-semirandom order stream, OFL is (2 + o(1))(cid:16) log2 t (cid:17)-competitive in expectation. Proof. Let C be an optimal facility set for S. Define k = C and observe that OPTk(S) is the connection cost associated with the optimal solution with facility set C. The optimal cost for log2 t the facility location problem is then kf + OPTk(S). For any  > 0, set r = (1 + ) log2 log2 t and h = dre. Observe that rh ≥ 4t for all t greater than some function of . Applying Theorem 1 to S with these values of r, h, and k shows that the total expected cost is at most 2(r + 3)(kf + OPTk(S)). This implies the result since 3 < r by taking t sufficiently large. log2 log2 t 8 Remark on Aspect Ratio: Suppose that we are working in a metric space of aspect ratio4 ∆. Setting rh ≥ ∆ instead of rh ≥ 4t, observe in the proof of Theorem 1 that B = ∅. This yields a bound of (r + 3)OPTk(S) + (h + 1)kf on both the expected facility cost and expected connection cost. We may therefore replace t with min(t, ∆) in our results. This justifies the lower bound in the following section being constructed in a metric space of aspect ratio t. Our upper and lower bounds match for all choices of t and ∆ by substituting min(t, ∆) for t. 4 Lower Bound We present a lower bound on the expected competitive ratio of any randomized algorithm for the online facility location problem. The bound holds even when the algorithm can open a facility at any location in the metric space. The proof works by constructing a sequence of points that converge to the location of an optimal facility. At each step, there are enough possible locations of the optimal facility that no algorithm can guess (except with negligible probability) the correct location until it is too late. Theorem 2. On a t-semirandom order stream for t ≥ 4, every randomized algorithm for online facility location has an expected competitive ratio of at least 1 3d log2 t log2 log2 te. We will construct a family of inputs and show that any deterministic algorithm has at least a certain competitive ratio when run on an input selected uniformly at random from this family. The result immediately extends to randomized algorithms by Yao's principle. log2 log2 te, h := m−1, and D := f /h. Let z be a positive The Metric Space: Define m := d log2 t integer. The points of the metric space are the nodes of a complete z-ary tree of depth h. This means that the root is at depth 0 and leaves are at depth h. The distance between a node at depth i and any of its z children is Dm−i − Dm−i−1. The distance between other nodes is obtained by summing the distances of the shortest path between them. The Family of Inputs: The family of inputs is enumerated by the hz possible strings of h numbers in {1, . . . , z}. We now describe how to construct the input associated with (b1, . . . , bh) ∈ {1, . . . , z}h. Define x0 to be the root. Recursively define xi to be the bth i child n ≥ t. Since Ph of xi−1. For i ∈ {1, . . . , h}, place mi points at node xi. We let the input size be n for any i=1 mi < t ≤ n, there will be some remaining points. Place all remaining points at the root. The randomized input is to select a member from this family of zh inputs uniformly at random. all non-root points to xr. The distance between xi and xr is Ph−1 The Optimal Cost: The optimal cost of the input associated with the string (b1, . . . , bh) is at most the cost of the solution that places facilities at the root and at xr, connecting j=i (Dm−j − Dm−j−1) = 4The aspect ratio of a metric space is the ratio between the maximum and minimum non-zero distance between points. 9 Dm−i − Dm−h < Dm−i. Therefore the optimal cost is less than 2f +Ph The t-Bounded Adversary's Strategy: There are Ph for every input the the family. i=1 mi < t points not located at the root. This implies that regardless of the order that the points are sent, a t-bounded adversary can deterministically ensure that points arrive in non-decreasing order of depth. The adversary does this by simply sending along any elements at the root while storing the at most t other elements until they are ready to be sent in non-decreasing order of depth. We consider this arrival order. i=1 mi(Dm−i) = 3f The Algorithm's Optimal Strategy: We define a cost scheme for the algorithm that is strictly less than the original cost (therefore any lower bound in this easier scheme is valid for the original problem). This greatly simplifies the analysis by allowing us to isolate an optimal strategy. Suppose that if a facility is open at certain node, then the connection cost of a point at any ancestor5 node is zero. With this modification, we can define an optimal strategy when a point arrives. If there is an open facility at any descendant node, then connect this point with zero cost. Otherwise, open a facility with cost f at any descendant leaf node and then connect with zero cost. If there is no open facility at a descendant node, the second option is optimal since the nearest facility cannot be closer than the parent node. The parent node is at distance Dm−(i−1) − Dm−i = f m−i. The algorithm, aware of the family of inputs, knows that a total of mi points are coming at this node. This means that the total connection cost from this node would be at least f. Therefore it is optimal to pay f and open a new facility. Given that we will open a new facility, placing it at a descendant leaf node is optimal because it minimizes the connection cost of future points in the stream. Without loss of generality, we have our deterministic algorithm always open at the descendant leaf node obtained by moving down the first child of each node in the path from the current node. The Algorithm's Expected Cost: Using the algorithm's strategy defined above, one can see that the algorithm incurs zero connection cost. For the input associated with (b1, . . . , bh), the number of facilities besides the root is just the number of bi not equal to 1. The probability that bi 6= 1 is 1 − 1 z)h + 1. Using sufficiently large z shows that it is not possible to achieve expected cost below h + 1. 3d log2 t log2 log2 te as desired. The result z. The expected total cost is then (1 − 1 The competitive ratio is therefore at least (h + 1)/3 = 1 extends to randomized algorithms by Yao's principle. 5If node a is contained in the subtree of node b, we say that a is a descendant of b and that b is an ancestor of a. 10 k-Median Clustering on Streams 5 In this section, we present a O(1)-approximation streaming algorithm for k-median clustering that stores O(k log t) points and has O(k log t) worst-case update time. The extension to other functions is sketched in Section 5.1. Our algorithm is based on the doubling algorithm of [10]. Among our innovations is a subroutine B(X, k) that permits us to improve the update time and approximation ratio of the original algorithm. B(X, k) is described in Section 5.2 and comes with the following guarantee: Theorem 3. For a weighted set X of n distinct points, suppose that the nearest neighbor in X has already been computed for each x ∈ X. Given an integer k ≥ 1, the algorithm B(X, k) terminates in O(n) time and outputs a pair (Z, λ) such that Z is a weighted set of at most b n+k 2 c points and λ = COST(X, Z) < 2OPTk(X). Throughout this section, as in Theorem 3, we overload notation by writing COST(A, B) where B is a weighted set (with total weight equal to that of A). Recall that for an unweighted set B, the function COST(A, B) denotes the minimum connection cost of connecting the demand set A to the facility set B where each facility can service an unlimited number of demands. When B is a weighted set, we let COST(A, B) denote the minimum connection cost under the restraint that each facility must service exactly its weight in demands. We now present Algorithm 1 to maintain a set Ψ which we show can determine a O(1)- approximation to the k-median clustering of the stream. Observe that the main loop of Lines 3-15 always begins with Ψ ≤ 29m, which ensures by Theorem 3 that the while-loop of Lines 7-15 always begins with Ψ ≤ 15m. Algorithm 1 Input: integer m ≥ 1, a stream of points P 1: L ← 0 2: Ψ ← the first 29m points of P 3: loop 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: (Ψ, λ) ← B(Ψ, m) L ← max(10L, λ/3) COST ← 0 while Ψ < 29m and COST < 14L do p ← next point of P y ← arg miny0∈Ψ d(p, y0) u ← uniform random in (0, 1) if uL < m d(p, y) then Ψ ← Ψ ∪ {p} w(y) ← w(y) + 1 COST ← COST + d(p, y) else Lemma 7. Except between Lines 4 and 5, COST(P, Ψ) < 20L. 11 Proof. The variable COST is an upper bound on the increase of COST(P, Ψ) during the current instance of the while-loop. Since COST increases by at most L m in each iteration, the termination condition of Line 7 ensures that COST < 15L. It remains to show that the cost when the while-loop began was at most 5L. Let us recursively assume that when the previous while-loop began, the cost was at most 5L0 where L0 was the previous value of L0. During that instance, less than 15L0 cost was incurred. On Line 4, exactly λ cost was incurred. We may bound λ ≤ 3L and L0 ≤ L/10 by Line 5. Therefore the total cost is 5L0 + 15L0 + λ ≤ 5L as desired. The next lemma addresses a subtle issue that only arises for 1 < t < n. Observe that any segment of a random-order (t = 1) stream is in random-order, and that any segment of an adversarial-order (t = n) stream is in adversarial-order. However, a segment of a t-semirandom order stream for 1 < t < n is not necessarily in t-semirandom order (or even in 2t-semirandom order) because the adversary may have as many as t points in storage when the segment begins. Instead, we analyze a segment as two separate t-semirandom streams, one coming from the adversary's storage and the other as those points that the adversary has not yet received. Lemma 8. Assume that m ≥ k(4 + dlog2 te). Whenever the while-loop of Lines 7-15 terminates, OPTk(P) > L with probability 1 2. Proof. Observe that the while-loop runs OFL with facility cost f = L m. Setting r = 2 and h = dlog2(4t)e, apply Theorem 1 and plug in the value for f. This shows that on a t- semirandom stream, OFL incurs less than 5OPTk(P) + L in expected connection cost and opens less than m(1 + 5OPTk(P)/L) facilities in expectation. Observe that this bound holds for the points of P even when P is interlaced with points from another stream. For a segment P of the t-semirandom stream, let P1 be the adversary's storage at the beginning of the segment and let P2 be all other points. Applying the previous argument twice, we see that on this segment OFL incurs less than 5OPTk(P)+2L in expected connection cost and opens less than m(2 + 5OPTk(P)/L) facilities in expectation. The terms involving OPTk(P) did not double since OPTk(P1) + OPTk(P2) ≤ OPTk(P). With probability at least 1 2, the cost and number of facilities are most twice these bounds by Markov's inequality. 2, the while-loop incurs less than 14L cost and opens less than 14m facilities. Since the while-loop begins with Ψ ≤ 15m, the termination condition means that either 14L cost was incurred or 14m facilities were opened. We conclude with probability at least 1 2 that OPTk(P) > L when the while-loop terminates. Suppose that OPTk(P) ≤ L. Then with probability at least 1 For correctness of the algorithm, the result of the preceding lemma only needs to hold for the most recent termination of the while-loop. We therefore apply it only once, avoiding a factor of O(log n) in the space bound that would result from applying the lemma at each loop iteration. After processing a point, Algorithm 1 waits on Line 8 for the next point. We now extend the previous lemma to hold on this line, and therefore after each point has been processed. 12 Lemma 9. Assume that m ≥ k(4 + dlog2 te). On Line 8, L < 14 OPTk(P) with probability 1 2. Proof. Let L0 and Ψ0 be the states of L and Ψ at the beginning of the current iteration of the main loop. We condition upon the event that OPTk(P) > L0, which occurs with probability 2 by Lemma 8. From Line 5 we infer that either L = 10L0 or 3L = λ = COST(Ψ0, Ψ). at least 1 In the case that L = 10L0, then the result is immediate. Otherwise, 3L = COST(Ψ0, Ψ) < 2OPTm(Ψ0) by the guarantee of B(X, k). We have OPTm(Ψ0) ≤ OPTk(Ψ0) since m ≥ k by assumption. Applying the triangle inequality to each point of Ψ0, we get OPTk(Ψ0) ≤ OPTk(P) + COST(P, Ψ0). We have that COST(P, Ψ0) < 20L0 < 20OPTk(P), where the first inequality is by Lemma 7 and the second inequality is the event we have conditioned upon. Therefore L < 14OPTk(P). This result holds regardless of how many iterations of the while-loop have occurred since OPTk(P) is non-decreasing as points are added to P. 1 We now state our main theorem for clustering. Amplifying the probability of success is δe independent instances of Algorithm 1 in parallel and return the Ψ from simple; run dlog2 an instance with minimal L. Theorem 4. Algorithm 1 with parameter m can be implemented to run in O(m) worst-case update time and store O(m) points. Suppose that the input stream P of n points arrives in t-semirandom order. If m ≥ k(4 + dlog2 te), then with probability at least 1 2 the set Ψ maintained by the algorithm satisfies COST(P, Ψ) ≤ O(1) · OPTk(P). Proof. Combining Lemmas 7 and 9 shows that COST(P, Ψ) < 280 OPTk(P). It is immediate from the pseudocode that the storage is less than 29m points. As for the update time, each iteration of the while-loop requires O(m) time. By Theorem 3, if the nearest neighbor function for Ψ has been computed then Line 4 terminates in O(m) time. We must show how to ensure with O(m) worst-case update time that the nearest neighbor function for Ψ has been computed before each time that Line 4 is executed. Given the nearest neighbor function π for a set of n points, observe that we can insert a point into the set and update π in O(n) time. Beginning with the nearest neighbor function π of the first two points of Ψ, we simply update π with the next three points of Ψ each time one point is received from the stream. The while-loop runs at least 14m times before each time that Line 4 executes. Therefore the nearest neighbor function for all of Ψ is guaranteed to have been computed by the time the while-loop terminates. By tweaking parameters and refining the analysis, one can improve the guarantee to COST(P, Ψ) < 3OPTk(P) (in particular, the space blows up as the constant approaches 2). It is well-known that if COST(P, Ψ) ≤ αOPTk(P) then any γ-approximation of Ψ is a (α(γ +1)+ α)- approximation of P [10]. Therefore Theorem 4 implies that Ψ carries enough information to determine a O(1)-approximation of P. Our constant α ≤ 3 does not guarantee a particularly low approximation ratio. However, Algorithm 1 can be used as a building block for a more accurate solution. Using the technique of [5], we can use Algorithm 1 to maintain an -coreset which carries enough information to determine a (1 + )-approximation6 for any  > 0. This 6An efficiently computed solution will have a larger approximation factor. Both the k-median and k-means problem are MAX-SNP Hard for all k ≥ 2. See the related work section of [4] for a survey of hardness results. 13 technique essentially converts the constant in the approximation factor into a constant in the size of the coreset. The only space required in addition to Algorithm 1 is the space needed to store the -coreset. As an example, for k-median in Rd, coresets of size O(−2kd) are known [14], implying that our result can be used to determine a (1 + )-approximation using O(−2kd + k log t) space. As a corollary to Theorem 4, we obtain an O(nk)-time approximation algorithm for the RAM model. In light of the Ω(nk) time lower bound of [30], the runtime is optimal. Corollary 2. Given a set P of n points, there exists an algorithm that outputs a O(1)- approximation to the k-median clustering of P with probability 1 − δ in time O(nk log 1 δ). Proof. Shuffle P in O(n) time. Set m = 4k and run Algorithm 1 in O(nk) time followed by the offline algorithm of [30] in O(k2) time to obtain by Theorem 4 a set C of k points such that COST(P, C) ≤ O(1) · OPTk(P) with probability at least 1 δe times and output the solution of minimal cost. 2. Repeat this dlog2 1 5.1 Extension to Other Functions We have assumed that we are in a metric space (X , d) but we can weaken this assumption. Suppose that throughout our results we replace the metric with an arbitrary symmetric positive-definite function D : X × X → [0,∞). If D satisfies the triangle inequality, then D is a metric and our result for k-median applies directly. However, suppose that D just satisfies a weak triangle inequality for some β ≥ 1: D(a, c) ≤ β(D(a, b) + D(b, c)) for all a, b, c ∈ X All of our proofs go through with larger constants. The bound in Theorem 4 generalizes to (h + 1 + β)f k + β(r + 3β)OPTk(S) and the guarantee of the B(X, k) routine of the next subsection generalizes to COST(X, Z) < 2βOPTk(X). For any function D satisfying a constant β value, our results for both online facility location and clustering carry through with larger constants. An example application is that our results generalize to 'p norms. Another important case is k-means that corresponds to D(x, y) = d(x, y)2. µ that minimizes P Recall that the maximum likelihood estimator for the mean µ of Gaussian data Q is the q∈Q d(q, µ)2. To handle outliers more robustly, the statistics community P introduced M-estimators which generalize maximum likelihood estimation by minimizing q∈Q ρ(d(q, µ)) for some positive-definite function ρ : [0,∞) → [0,∞). An M-estimator that minimizes P along with a positive integer k defines a clustering problem to find a set C of k points q∈Q minc∈C ρ(d(q, c)). Observe that we recover k-means for ρ(x) = x2 and k-median for ρ(x) = x. The convergence and robustness properties of M-estimators have been well-studied, but we also observe that the function D = ρ ◦ d usually satisfies a weak triangle inequality for a very low β value. Evidently we can let β be any value such that ρ(c) ≤ β(ρ(a) + ρ(b)) for all a, b, c ≥ 0 such that c ≤ a + b. In Table 4 we have calculated tight β values for the most commonly used M-estimators . 14 ρ function ρ(x) = x ρ(x) = x2 x2 1 − (1 − x2)3 1 ρ(x) = if x < 1 2x − 1 if x ≥ 1 ρ(x) = log(1 + x2) β 1 2 2 2 2 Estimator Linear Gaussian Huber Cauchy Tukey ρ(x) = if x < 1 if x ≥ 1 Table 4: List of the most common M-estimators. The last column is redundant since the β value can be directly calculated from the ρ function. All of these estimators are actually a parameterized family by scaling ρ(x) to c1ρ(c2x) for c1, c2 > 0, but we choose only a single representative since the β value is unchanged. These results imply that O(k log t) space suffices to approximate M-estimators on a data stream. We remind the reader that we can use the technique of [5] to maintain an -coreset which permits a (1 + )-approximation to the optimal M-estimator. 5.2 The B(X, k) Routine We present a deterministic algorithm B that accepts a weighted set A of n distinct points along with a positive integer k and returns a weighted set Z of b n+k 2 c distinct points such that COST(A, Z) < 2OPTk(A). If the nearest neighbor graph on A has been computed, then B terminates in O(n) time. In what follows, there must be a way to order the points of A. This is necessary for a technical detail that comes up in Lemma 10; we need a consistent way to break ties. In practice, this can simply be the order that the algorithm loops through the points of A. Definition 4. The function π : A → A is defined such that π(a) = arg minx∈A\{a} d(a, x). If there is more than one point x that minimizes d(x, a), break ties by selecting the x that is greatest according to the order of A. We use π to define a graph as follows: Definition 5. Let A be a weighted set. The directed graph G(A, π) has the points of A as vertices. For each vertex a, there is exactly one directed edge leaving a and pointing to π(a). G(A, π) possesses a special structure of not containing any cycles of length greater than 2. Lemma 10. The graph G(A, π) contains cycles only of length 2. 15 Proof. Let {a1, . . . , as} be a cycle such that for each 1 ≤ i ≤ s we have π(ai) = ai+1 (additions should be interpreted modulo s). We will show that s = 2. By definition of π, it must be that d(ai, ai+1) ≤ d(ai−1, ai) since π(ai) = ai+1. Then we have d(a1, a2) ≤ . . . ≤ d(as, a1) ≤ d(a1, a2) and the chain of inequalities implies equality. Let at be the element of the cycle that is greatest according to the ordering of A. Since at and at+2 are equidistant from at+1, the criterion for breaking ties in Definition 4 ensures that π(at+1) = at. Since π(at+1) = at+2, it must be that t + 2 = t and so s = 2. In light of Lemma 10, let us consider the structure of the directed graph (A, π). Removing the edges in length-2 cycles, we are left with a forest (a collection of trees directed to the root). Considering the full graph along with these 2-cycles, we see that each component is a pair of trees whose roots are coupled. This forest of "bi-trees" can be 2-colored, and the following lemma shows that we can do this efficiently. Lemma 11. Given the function π, the graph G(A, π) can be 2-colored in O(m) time. Proof. We say that π(a) is the parent of a, and that a is the child of π(a). Each vertex has exactly one parent, and the edges point to the parent. For each point a ∈ A, we store a pointer to its parent as well as a list of pointers to its children. Given the function π, this can be accomplished in O(n) time. As reasoned above, the graph can be partitioned into bi-tree components. We use the following iterative procedure until all vertices have been colored: (1) Select any uncolored vertex; (2) Walk along the edges until reaching the two roots; (3) Color each root a different color; (4) Recursively color each child vertex the opposite color than its parent. For Step 2, we will know we have located the roots when we return to the vertex we just left. This process (of moving from a to π(a) until reaching the root) terminates in time proportional to the depth of the tree. Therefore a total of O(n) time is spent during Step 2 over all iterations of this procedure. For Step 4, finding a child takes O(1) time since we have stored a list of children with each vertex. Therefore a total of O(n) time is spent during Step 4 over all iterations of this procedure. We will need the following technical lemma to bound COST(A, Z). Recall that OPTk(A) is defined using centers from anywhere in the metric space X . The lemma says that if we restrict to centers from A itself, then the optimal cost increases by less than a factor of two. Lemma 12. Let OPTk(A) denote the minimum of COST(A, B) where B ⊂ A ranges over all sets of k points. Then OPTk(A) < 2OPTk(A). Proof. Let C ⊂ X be a set of k points such that COST(A, C) = OPTk(A). For each c ∈ C, let c0 be the closest point of A to c. Any element a ∈ A that was connected to c can be instead connected to c0 with a cost of d(a, c0) ≤ d(a, c) + d(c, c0) ≤ 2d(a, c) since d(c, c0) ≤ d(c, a). Moreover, the cost of this cluster increased by strictly less than factor of two since if c /∈ A the cost decreased for a = c0 and if c ∈ A the cost stayed the same. Define C0 = {c0}c∈C. Then C0 ⊂ A is a set of k points such that OPTk(A) ≤ COST(A, C0) < 2COST(A, C) = 2OPTk(A). 16 Figure 2: A 2-colored bi-tree of the nearest neighbor graph G(A, π). Algorithm B(A, k) removes all blue points by moving the weight of each blue point to the red point to which it points. The B(X, k) algorithm is presented in the next theorem. The basic idea is to 2-color G(A, π) and then eliminate one of the colors by relocating those points to their image under π. Since π maps each point to a point of the opposite color, this transformation increases the weights of one color while completely eliminating the other. Theorem 5. Let A be a weighted set of n distinct points. Assume that π has been computed for A. In O(n) time, we can compute a weighted set Z of at most b n+k 2 c distinct points such that COST(A, Z) < 2OPTk(A). Proof. Let the function w : A → N map each point of A to its weight. By Lemma 11, we 2-color A in O(n) time. Let A1 and A2 be the partition of A into the two colors after removing the k points with the top values of w(a)d(a, π(a)). Let At be the larger component (by number of points) and note that At ≥ d n−k 2 e. Build Z from A as follows: for each a ∈ At, increment w(π(a)) by w(a) and delete a. This procedure terminates in O(n) time. By definition of a 2-coloring, π(a) /∈ At for every Observe that COST(A, Z) = P element a ∈ At, and so Z contains n − At ≤ b n+k a∈At w(a)d(a, π(a)). The optimal k-median solution of nearest neighbor, so P A using points from A involves moving n − k points of A by at least the distance to the a∈A1∪A2 w(a)d(a, π(a)) ≤ OPTk(A) and so COST(A, Z) ≤ OPTk(A). 2 c weighted points. This completes the proof since Lemma 12 guarantees OPTk(A) < 2OPTk(A). To complete the guarantee of Theorem 3, observe that we can return the exact value of COST(A, Z) in O(n) time. 6 Discussion of Models for Semirandom Order IITK Open Problem #15 addresses computational models of semirandom-order for streams and asks how the models of t-bounded adversarial order and -generated random order relate to each other [27]. One can verify that  = 0 like t = 0 is equivalent to random-order and that  = 1 like t = n is equivalent to adversarial-order. However, we demonstrate in the following two lemmas that no other relations hold between these models. Lemma 13. To simulate the t-bounded adversarial order model for any t > 1, the -generated order model requires  ≥ 1 − 2−n/2. 17 Proof. Let the stream consist of elements {1, . . . , n}. Let χ(i) denote the identity of the ith element in the initial random-order stream. For any t ≥ 2, a t-bounded adversary can ensure that χ(2i − 1) < χ(2i) for all 1 ≤ i ≤ n 2. Let Ai be the event that χ(2i − 1) < χ(2i). 2 and that the {Ai}n/2 In random-order, observe that P(Ai) = 1 i=1 are mutually independent. Therefore the uniform distribution µ assigns probability mass 1−( 1 2)n/2 to the orders satisfying χ(2i − 1) > χ(2i) for some 1 ≤ i ≤ n 2. Any distribution ν that assigns probability mass 1 to ∩n/2 i=1Ai must satisfy µ − ν1 ≥ 2(1 − 2−n/2) Lemma 14. To simulate the -generated order model for any  ≥ 2−n/10, the t-bounded adversarial order model requires t > n/2. Proof. Let X be a subset of r elements. In random-order, let A be the event at at least one element of X arrives among the first βn elements. Pµ(A) ≥ 1 − (1 − β)r, so we can create a distribution ν such that Pν(A) = 1 and µ − ν1 ≤ 2(1 − β)r. In the t-bounded adversarial order model, elements are sent in random-order but inter- cepted by an adversary who manipulates the order that elements arrive for the algorithm. Observe that an element among the last n−t to 2 arrive. If r ≤ n−t then with positive probability all elements of X are among the last n−t 2 2 to be sent. Therefore if βn ≤ n−t 2 we have P(A) < 1. Setting r = βn, this necessitates that t > (1 − 2β)n whenever  ≥ (1 − β)βn. The result follows by setting β = 1 4. to be sent cannot be among the first n−t 2 Our matching bounds for online facility location show a non-trivial degradation of performance in the t-bounded adversarial-order model that smooothly interpolates between random-order and adversarial-order. This supports the claim that t-bounded adversarial-order is a viable model of semi-randomness. In contrast, it is trivial to show matching bounds of Θ(1 +  log n log log n) in the -generated model. More generally, any bound in expectation which is Θ(f) in random-order and Θ(g) in adversarial-order implies a Θ(f + g) bound in the -generated model. As a result, the -generated model is not interesting for a wide class of δ) bound with probability 1 − δ implies problems. This class is rather large since any Θ(f log 1 a Θ(f) bound in expectation. We conclude with an open question: Open Question: Given an adversarial-order bound of O(f(n)), all the results in this paper present a bound of O(f(t)) for t-bounded adversarial order, showing a smooth degradation as t increases. However, some problems exhibit a sharp phase transition. For example, the size of the largest component in an Erdos-R´enyi graph ER(n, p) jumps from O(log n) to Ω(n) around p ∼ 1/n. In the t-bounded adversarial order model, is it always the case that bounds degrade smoothly as t increases? Alternatively, do problems exist that exhibit a sharp jump in some quantity of interest (i.e. time, space, or approximation factor) when t increases by only a constant factor around some value? 18 References [1] Ankit Aggarwal, Amit Deshpande, and Ravi Kannan. Adaptive sampling for k-means clustering. In APPROX-RANDOM, pages 15 -- 28, 2009. [2] Aris Anagnostopoulos, Russell Bent, Eli Upfal, and Pascal Van Hentenryck. A simple Inf. Comput., and deterministic competitive algorithm for online facility location. 194(2):175 -- 202, November 2004. [3] Alexandr Andoni, Andrew McGregor, Krzysztof Onak, and Rina Panigrahy. Better bounds for frequency moments in random-order streams. CoRR, abs/0808.2222, 2008. [4] Pranjal Awasthi, Moses Charikar, Ravishankar Krishnaswamy, and Ali Kemal Sinop. The hardness of approximation of euclidean k-means. In SoCG, volume 34, pages 754 -- 767, 2015. [5] Vladimir Braverman, Dan Feldman, and Harry Lang. New frameworks for offline and streaming coreset constructions. CoRR, abs/1612.00889, 2016. [6] Vladimir Braverman, Adam Meyerson, Rafail Ostrovsky, Alan Roytman, Michael Shindler, and Brian Tagiku. Streaming k-means on well-clusterable data. In SODA, pages 26 -- 40, 2011. [7] Amit Chakrabarti, Graham Cormode, and Andrew McGregor. Robust lower bounds for communication and stream computation. In STOC, pages 641 -- 650, 2008. [8] Amit Chakrabarti, T. S. Jayram, and Mihai Patra¸scu. Tight lower bounds for selection in randomly ordered streams. In SODA, pages 720 -- 729, 2008. [9] Amit Chakrabarti, Subhash Khot, and Xiaodong Sun. Near-optimal lower bounds on the multi-party communication complexity of set disjointness. In In IEEE Conference on Computational Complexity, pages 107 -- 117, 2003. [10] Moses Charikar, Liadan O'Callaghan, and Rina Panigrahy. Better streaming algorithms for clustering problems. In STOC, pages 30 -- 39, 2003. [11] Ke Chen. On coresets for k-median and k-means clustering in metric and euclidean spaces and their applications. SIAM J. Comput., 39(3):923 -- 947, August 2009. [12] Michael Crouch, Andrew McGregor, Gregory Valiant, and David P. Woodruff. Stochastic streams: Sample complexity vs. space complexity. In ESA, volume 57, pages 32:1 -- 32:15, 2016. [13] Hossein Esfandiari, Mohammad T. Hajiaghayi, Vahid Liaghat, Morteza Monemizadeh, and Krzysztof Onak. Streaming algorithms for estimating the matching size in planar graphs and beyond. In SODA, pages 1217 -- 1233, 2015. 19 [14] Dan Feldman and Michael Langberg. A unified framework for approximating and clustering data. In STOC, pages 569 -- 578, 2011. [15] Dimitris Fotakis. On the competitive ratio for online facility location. Algorithmica, 50(1):1 -- 57, December 2007. [16] Sudipto Guha and Zhiyi Huang. Revisiting the direct sum theorem and space lower bounds in random order streams. In ICALP, pages 513 -- 524, 2009. [17] Sudipto Guha and Andrew McGregor. Approximate quantiles and the order of the stream. In PODS, pages 273 -- 279, 2006. [18] Sudipto Guha and Andrew McGregor. Lower bounds for quantile estimation in random- order and multi-pass streaming. In ICALP, pages 704 -- 715, 2007. [19] Sudipto Guha and Andrew Mcgregor. Space-efficient sampling. In AISTATS, volume 2, pages 171 -- 178, 2007. [20] Sudipto Guha and Andrew McGregor. Stream order and order statistics: Quantile estimation in random-order streams. SIAM J. Comput., 38(5):2044 -- 2059, January 2009. [21] Sudipto Guha, Andrew McGregor, and Suresh Venkatasubramanian. Streaming and sublinear approximation of entropy and information distances. In SODA, pages 733 -- 742, 2006. [22] Sudipto Guha, Adam Meyerson, Nina Mishra, Rajeev Motwani, and Liadan O'Callaghan. Clustering data streams: Theory and practice. IEEE Trans. on Knowl. and Data Eng., 15(3):515 -- 528, March 2003. [23] Piotr Indyk. Sublinear time algorithms for metric space problems. In STOC, pages 428 -- 434, 1999. [24] Kamal Jain and Vijay V. Vazirani. Approximation algorithms for metric facility location and k-median problems using the primal-dual schema and lagrangian relaxation. J. ACM, 48(2):274 -- 296, March 2001. [25] Michael Kapralov, Sanjeev Khanna, and Madhu Sudan. Approximating matching size from random streams. In SODA, pages 734 -- 751, 2014. [26] Christian Konrad, Fr´ed´eric Magniez, and Claire Mathieu. Maximum matching in semi-streaming with few passes. In APPROX-RANDOM, 2012. [27] Andrew McGregor. List of open problems in sublinear algorithms: Problem 15. http: //sublinear.info/15. [28] Andrew McGregor and Paul Valiant. The shifting sands algorithm. In SODA, pages 453 -- 458, 2012. 20 [29] Ramgopal R. Mettu and C. Greg Plaxton. The online median problem. SIAM J. Comput., 32(3):816 -- 832, March 2003. [30] Ramgopal R. Mettu and C. Greg Plaxton. Optimal time bounds for approximate clustering. Mach. Learn., 56(1-3):35 -- 60, June 2004. [31] A. Meyerson. Online facility location. In FOCS, pages 426 -- , 2001. [32] Vahab Mirrokni and Morteza Zadimoghaddam. Randomized composable core-sets for distributed submodular maximization. In STOC, pages 153 -- 162, 2015. [33] J. I. Munro and M. S. Paterson. Selection and sorting with limited storage. In SFCS, pages 253 -- 258, 1978. [34] David P. Woodruff. The average-case complexity of counting distinct elements. In ICDT, pages 284 -- 295, 2009. 21
1109.3401
2
1109
2012-10-30T02:38:45
Max-Throughput for (Conservative) k-of-n Testing
[ "cs.DS", "cs.DC" ]
We define a variant of k-of-n testing that we call conservative k-of-n testing. We present a polynomial-time, combinatorial algorithm for the problem of maximizing throughput of conservative k-of-n testing, in a parallel setting. This extends previous work of Kodialam and Condon et al., who presented combinatorial algorithms for parallel pipelined filter ordering, which is the special case where k=1 (or k = n). We also consider the problem of maximizing throughput for standard k-of-n testing, and show how to obtain a polynomial-time algorithm based on the ellipsoid method using previous techniques.
cs.DS
cs
Max-Throughput for (Conservative) k-of-n Testing Lisa Hellerstein∗ Ozgur Ozkan† Linda Sellie‡ June 4, 2018 Abstract We define a variant of k-of-n testing that we call conservative k-of-n testing. We present a polynomial- time, combinatorial algorithm for the problem of maximizing throughput of conservative k-of-n testing, in a parallel setting. This extends previous work of Kodialam and Condon et al., who presented com- binatorial algorithms for parallel pipelined filter ordering, which is the special case where k = 1 (or k = n) [4, 5, 8]. We also consider the problem of maximizing throughput for standard k-of-n testing, and show how to obtain a polynomial-time algorithm based on the ellipsoid method using previous techniques. 1 Introduction In standard k-of-n testing, there are n binary tests, that can be applied to an "item" x. We use xi to denote the value of the ith test on x, and treat x as an element of {0, 1}n. With probability pi, xi = 1, and with probability 1 − pi, xi = 0. The tests are independent, and we are given p1, . . . , pn. We need to determine whether at least k of the n tests on x have a value of 0, by applying the tests sequentially to x. Once we have enough information to determine whether this is the case, that is, once we have observed k tests with value 0, or n − k + 1 tests with value 1, we do not need to perform further tests.1 We define conservative k-of-n testing the same way, except that we continue performing tests until we have either observed k tests with value 0, or have performed all n tests. In particular, we do not stop testing when we have observed n − k + 1 tests with value 1. There are many applications where k-of-n testing problems arise, including quality testing, medical diagnosis, and database query optimization. In quality testing, an item x manufactured by a factory is tested for defects. If it has at least k defects, it is discarded. In medical diagnosis, the item x is a patient; patients are diagnosed with a particular disease if they fail at least k out of n special medical tests. A database query may ask for all tuples x satisfying at least k of n given predicates (typically k = 1 or k = n). For k = 1, standard and conservative k-of-n testing are the same. For k > 1, the conservative variant is relevant in a setting where, for items failing fewer than k tests, we need to know which tests they failed. For example, in quality testing, we may want to know which tests were failed by items failing fewer than k tests (i.e. those not discarded) in order to repair the associated defects. Our focus is on the MaxThroughput problem for k-of-n testing. Here the objective is to maximize the throughput of a system for k-of-n testing in a parallel setting where each test is performed by a separate "processor". In this problem, in addition to the probabilities pi, there is a rate limit ri associated with the processor that performs test i, indicating that the processor can only perform tests on ri items per unit time. ∗Polytechnic Institute of NYU. This research is supported by the NSF Grant CCF-0917153. [email protected] †Polytechnic Institute of NYU. This research supported by US Department of Education Grant P200A090157. [email protected] ‡Polytechnic Institute of NYU. This research is supported by a CIFellows Project postdoc, sponsored by NSF and the CRA. [email protected] 1In an alternative definition of k-of-n testing, the task is to determine whether at least k of the n tests have a value of 1. Symmetric results hold for this definition. 1 MaxThroughput problems are closely related to MinCost problems [6, 9]. In the MinCost problem for k-of-n testing, in addition to the probabilities pi, there is a cost ci associated with performing the ith test. The goal is to find a testing strategy (i.e. decision tree) that minimizes the expected cost of testing an individual item. There are polynomial-time algorithms for solving the MinCost problem for standard k-of-n testing [1, 3, 10, 11]. Kodialam was the first to study the MaxThroughput k-of-n testing problem, for the special case where k = 1 [8]. He gave a O(n3 log n) algorithm for the problem. The algorithm is combinatorial, but its correctness proof relies on polymatroid theory. Later, Condon et al. studied the problem, calling it "parallel pipelined filter ordering". They gave two O(n2) combinatorial algorithms, with direct correctness proofs [5]. In this paper, we extend the previous work by giving a polynomial-time combinatorial Our Results. algorithm for the MaxThroughput problem for conservative k-of-n testing. Our algorithm can be im- plemented to run in time O(n2), matching the running time of the algorithms of Condon et al. for 1-of-n testing. More specifically, the running time is O(n(log n + k) + o), where o varies depending on the output representation used; the algorithm can be modified to produce different output representations. We discuss output representations below. The MaxThroughput problem for standard k-of-n testing appears to be fundamentally different from its conservative variant. We leave as an open problem the task of developing a polynomial time combinatorial algorithm for this problem. We show that previous techniques can be used to obtain a polynomial-time algorithm based on the ellipsoid method. This approach could also be used to yield an algorithm, based on the ellipsoid method, for the conservative variant. Output Representation For the type of representation used by Condon et al. in achieving their O(n2) bound, o = O(n2). A more explicit representation has size o = O(n3). We also describe a new, more compact output representation for which o = O(n). In giving running times, we follow Condon et al. and consider only the time taken by the algorithm to produce the output representation. We note, however, that different output representations may incur different post-processing costs when we want to use them them to implement the routings. For example, the compressed representation has o = O(n), but it requires spending O(n) time in the worst case to extract any permutation of megaprocessors stored by the megaprocessor representation. We can reduce this complexity In contrast, the explicit O(n3) representation gives direct to O(log n) using persistent search trees [13]. access to the permutations. In practice, the choice of the best output representation can vary depending on the application and the setting. For ease of presentation, in our pseudocode we use the megaprocessor representation, which is also used by Condon et al. [5] in their Equalizing Algorithm. 2 Related Work Deshpande and Hellerstein studied the MaxThroughput problem for k = 1, when there are precedence constraints between tests [6]. They also showed a close relationship between the exact MinCost and MaxThroughput problems for k-of-n testing, when k = 1. Their results can be generalized to apply to testing of other functions. Liu et al. [9] presented a generic, LP based method for converting an approximation algorithm for a MinCost problem, into an approximation algorithm for a MaxThroughput problem. Their results are not applicable to this paper, where we consider only exact algorithms. Polynomial-time algorithms for the MinCost problem for standard k-of-n testing were given by Salloum, Breuer, Ben-Dov, and Chang et al. [1, 3, 10 -- 12]. The problem of how to best order a sequence of tests, in a sequential setting, has been studied in many different contexts, and in many different models. See for example [9] and [5] for a discussion of related work on the filter-ordering problem (i.e. the MinCost problem for k = 1) and its variants, and [14] for a general survey of sequential testing of functions. 2 3 Problem Definitions A k-of-n testing strategy for tests 1, . . . , n is a binary decision tree T that computes the k-of-n function, f : {0, 1}n → {0, 1}, where f (x) = 1 if and only if x contains fewer than k 0's. Each node of T is labeled by a variable xi. The left child of a node labeled with xi is associated with xi = 0 (i.e., failing test i), and the right child with xi = 1 (i.e., passing test i). Each x ∈ {0, 1}n corresponds to a root-to-leaf path in the usual way, and the label at the leaf is f (x). A k-of-n testing strategy T is conservative if, for each root-to-leaf path leading to a leaf labeled 1, the path contains exactly n non-leaf nodes, each labeled with a distinct variable xi. Given a permutation π of the n tests, we define T c k (π) to be the conservative strategy described by the following procedure: Perform the tests in order of permutation π until at least k 0's have been observed, or all tests have been performed, whichever comes first. Output 0 in the first case, and 1 in the second. Similarly, we define T s k (π) to be the following standard k-of-n testing strategy: Perform the tests in order of permutation π until at least k 0's have been observed, or until n − k + 1 1's have been observed, whichever comes first. Output 0 in the first case, and 1 in the second. Each test i has an associated probability pi, where 0 < pi < 1. Let Dp denote the product distribution on {0, 1}n defined by the pi's; that is, if x is drawn from Dp, then ∀i, Pr [xi = 1] = pi and the xi are independent. We use x ∼ Dp to denote a random x drawn from Dp. In what follows, when we use an expression of the form Pr [. . .] involving an item x, we mean the probability with respect to Dp. 3.1 The MinCost problem In the MinCost problem for standard k-of-n testing, we are given n probabilities pi and costs ci > 0, for i ∈ {1, . . . , n}, associated with the tests. The goal is to find a k-of-n testing strategy T that minimizes the expected cost of applying T to a random item x ∼ Dp. The cost of applying a testing strategy T to an item x is the sum of the costs of the tests along the root-to-leaf path for x in T . In the MinCost problem for conservative k-of-n testing, the goal is the same, except that we are restricted to finding a conservative testing strategy. For example, consider the MinCost 2-of-3 problem with probabilities p1 = p2 = 1/2, p3 = 1/3 and costs c1 = 1, c2 = c3 = 2. A standard testing strategy for this problem can be described procedurally as follows: Given item x, begin by performing test 1. If x1 = 1, follow strategy T s 2 (π1), where π1 = (2, 3). Else if x1 = 0, follow strategy T s 1 (π2), where π2 = (3, 2). Under the above strategy, which can be shown to be optimal, evaluating x = (0, 0, 1) costs 5, and evaluating x′ = (1, 1, 0) costs 3. The expected cost of applying this strategy to a random item x ∼ Dp is 3 5 6 . Because the MinCost testing strategy may be a tree of size exponential in the number of tests, algorithms for the MinCost problem may output a compact representation of the output strategy. In the literature, versions of the MinCost problem for The Algorithm for the MinCost Problem. 1-of-n testing are studied under a variety of different names, including pipelined filter ordering, selection ordering, and satisficing search (cf. [5]). The following is a well-known, simple algorithm for solving the MinCost problem for standard 1-of-n testing (see e.g. [7]): First, sort the tests in increasing order of the ratio ci/(1 − pi). Next, renumber the tests, so that c1/(1 − p1) < c2/(1 − p2) < . . . < cn/(1 − pn). Finally, output the sorted list π = (1, . . . , n) of tests, which is a compact representation of the strategy T s 1 (π) (which is the same as T c 1 (π)). The above algorithm can be applied to the MinCost problem for conservative k-of-n testing, simply by treating π as a compact representation of the conservative strategy T c k (π). In fact, that strategy is optimal for conservative k-of-n testing: it has minimum expected cost among all conservative strategies. This follows immediately from a lemma of Boros et al. [2]2. 2The lemma of Boros et al. actually proves that the corresponding decision tree is 0-optimal. A decision tree computing a function f is 0-optimal if it minimizes the expected cost of testing an random x, given that f (x) = 0. In conservative k-of-n testing, where f is the k-of-n function, the cost of testing x is the same for all x such that f (x) = 1. Thus the problem of finding a min-cost conservative strategy for k-of-n testing is essentially equivalent to the problem of finding a 0-optimal decision tree 3 3.2 The MaxThroughput problem The MaxThroughput problem for k-of-n testing is a natural generalization of the MaxThroughput problem for 1-of-n testing, first studied by Kodialam [8]. We give basic definitions and motivation here. For further information about this problem, including information relevant to its application in practical settings, see [4, 5, 8]. In the MaxThroughput problem for k-of-n testing, as in the MinCost problem, we are given the probabilities p1, . . . , pn associated with the tests. Instead of costs ci for the tests, we are given rate limits ri > 0. The MaxThroughput problem arises in the following context. There is an (effectively infinite) stream of items x that need to be tested. Every item x must be assigned a strategy T that will determine which tests are performed on it. Different items may be assigned to different strategies. Each test is performed by a separate "processor", and the processors operate in parallel. (Imagine a factory testing setting.) Item x is sent from processor to processor for testing, according to its strategy T . Each processor can only test one item at a time. We view the problem of assigning items to strategies as a flow-routing problem. Processor Oi performs test i. It has rate limit (capacity) ri, indicating that it can only process ri items x per unit time. The goal is to determine how many items should be assigned to each strategy T , per unit time, in order to maximize the number of items that can be processed per unit time, the throughput of the system. The solution must respect the rate limits of the processors, in that the expected number of items that need to be tested by processor Oi per unit time must not exceed ri. We assume that tests behave according to expectation: if m items are tested by processor Oi per unit time, then mpi of them will have the value 1, and m(1 − pi) will have the value 0. Let T denote the set of all k-of-n testing strategies and Tc denote the set of all conservative k-of-n testing strategies. Formally, the MaxThroughput problem for standard k-of-n testing is defined by the linear program below. The linear program defining the MaxThroughput problem for conservative k-of-n testing is obtained by simply replacing the set of k-of-n testing strategies T by the set of conservative k-of-n testing strategies Tc. We refer to a feasible assignment to the variables zT in the LP below as a routing. We call constraints of type (1) rate constraints. The value of F is the throughput of the routing. We define g(T, i) as the probability that test i will be performed on an item x that is tested using strategy T , when x ∼ Dp. For i ∈ {1, . . . , n}, if PT ∈T g(T, i)zT = ri, we say that the routing saturates processor Oi. "SMT(k) problem" and the "CMT(k) problem", respectively. We will refer to the MaxThroughput problems for standard and conservative k-of-n testing as the As a simple example, consider the following CMT(k) problem (equivalently, SMT(k) problem) instance, where k = 1 and n = 2: r1 = 1, r2 = 2, p1 = 1/2, p2 = 1/4. There are only two possible strategies, T1(π1), where π1 = (1, 2), and T1(π2), where π2 = (2, 1). Since all flow assigned to T1(π1) is tested by O1, g(T1(π1), 1) = 1; this flow continues on to O2 only if it passes test 1, which happens with probability p1 = 1/2, so g(T1(π1), 2) = 1/2. Similarly, g(T1(π2), 2) = 1 while g(T1(π2), 1) = 1/4, since p2 = 1/4. Consider the routing that assigns F1 = 4/7 units of flow to strategy T1(π1), and F2 = 12/7 units to strategy T1(π2). Then the amount of flow reaching O1 is 4/7 · g(T1(π1), 1) + 12/7 · g(T1(π2), 1) = 1, and the amount of flow reaching O2 is 4/7 · g(T1(π1), 2) + 12/7 · g(T1(π2), 2) = 2. Since r1 = 1 and r2 = 2, this routing saturates both processors. By the results of Condon et al. [5], it is optimal. MaxThroughput LP: Given r1, . . . , rn > 0 and p1 . . . , pn ∈ (0, 1), find an assignment to the variables zT , for all T ∈ T , that maximizes subject to the constraints: zT F = XT ∈T computing the k-of-n function. The lemma of Boros et al. also applies to a more general class of functions f that include the k-of-n functions. 4 (1) PT ∈T g(T, i)zT ≤ ri for all i ∈ {1, . . . , n} and (2) zT ≥ 0 for all T ∈ T where g(T, i) denotes the probability that test i will be performed on an item x that is tested using strategy T , when x ∼ Dp. 4 The Algorithm for the CMT(k) problem We begin with some useful lemmas. The algorithms of Condon et al. [5] for maximizing throughput of 1-of-n testing rely crucially on the fact that saturation of all processors implies optimality. We show that the same holds for conservative k-of-n testing. Lemma 1. Let R be a routing for an instance of the CMT(k) problem. If R saturates all processors, then it is optimal. Proof. Each processor Oi can test at most ri items per unit time. Thus at processor Oi, there are at most ri(1 − pi) tests performed that have the value 0. Let f denote the k-of-n function. Suppose R is a routing achieving throughput F . Since F items enter the system per unit time, F items must also leave the system per unit time. An item x such that f (x) = 0 does not leave the system until it fails k tests. An item x such that f (x) = 1 does not leave the system until it has had all tests performed on it. Thus, per unit time, in the entire system, the number of tests performed that have the value 0 must be F · M , where M = (k · Pr [x has at least k 0's] +Pk−1 Pn i=1 ri(1 − pi). Solving for F , this gives an upper bound of F ≤ Pn Since at most ri(1 − pi) tests with the value 0 can occur per unit time at processor Oi, F · M ≤ i=1 ri(1 − pi)/M on the maximum throughput. This bound is tight if all processors are saturated, and hence a routing saturating all processors achieves the maximum throughput. j=0 j · Pr [x has exactly j 0's]). In the above proof, we rely on the fact that every routing with throughput F results in the same number of 0 test values being generated in the system per unit time. Note that this is not the case for standard testing, where the number of 0 test values generated can depend on the routing itself, and not just on the throughput of that routing. We now give a simple counterexample showing that, in fact, saturation does not imply optimality for the SMT(k) problem. Consider the MaxThroughput 2-of-3 testing instance where p1 = 1/2, p2 = 1/4, p3 = 3/4, and r1 = 2, r2 = 1 3 4 , r3 = 1 3 4 . The following is a 2-of-3 testing strategy: Given item x, peform test 1. If x1 = 1, follow strategy T s 1 (π1), where π1 = (2, 3). Else if x1 = 0, follow strategy T s 1 (π2), where π1 = (3, 2). Assigning 2 units of flow to this strategy saturates the processors: O1 is saturated since it receives the 2 units entering the system, O2 is saturated since it receives 1 = 2·p1 units from O1 and 3/4 = 2·p3·(1−p1) items from O1, O2. Similarly, O3 is saturated since it receives 1 = 2 · (1 − p1) units from O1 and 3/4 = 2 · (1 − p3) · p1 units from O1O3. We show that the routing is not optimal by giving a different routing with higher throughput. The routing uses two strategies. The first is as follows: Given item x, perform test 1. If x1 = 1, follow strategy T s 2 (π1), where π1 = (3, 2). Else, if x1 = 0 follow strategy T s 1 (π1), where π2 = (2, 3). The second strategy 2 units to the first strategy uses 1 1 used by the routing is T s 2 units of the capacity of O1, 15/16 = 1 1 2 · p1 · (1 − p3) units of the capacity of O2, and 15/16 = 1 1 2 · (1 − p1) · p2 of the capacity of O3. This leaves O2 and O3 with residual capacity more than 3/4 < 1 + 3/4 − 15/16, and O1 with residual capacity 1/2 = 2 − 1 1 2 . We can then assign 3/4 additional units to the second strategy without violating any of the rate constraints, for a routing with total throughput 2 1 2 (π3), where π3 = (3, 2, 1). Assigning F = 1 1 4 . (The resulting routing is not optimal, but illustrates our point.) 2 · (1 − p1) + 1 1 2 · (1 − p1) + 1 1 The routing produced by our algorithm for the CMT(k) problem uses only strategies of the form T c k (π), for some permutation π of the tests (in terms of the LP, this means zT > 0 only if T = T c k (π) for some π). We call such a routing a permutation routing. We say that it has a saturated suffix if for some subset Q of 5 the processors (1) R saturates all processors in Q, and (2) for every strategy T c in Q (in some order) must form a suffix of π. k (π) used by R, the processors With this definition, and the above lemma, we are now able to generalize a key lemma of Condon et al. to apply to conservative k-of-n testing. The proof is essentially the same as theirs; we present it below for completeness. Lemma 2. (Saturated Suffix Lemma) Let R be a permutation routing for an instance of the CMT(k) problem. If R has a saturated suffix, then R is optimal. Proof. If R saturates all processors, then the previous lemma guarantees its optimality. If not, let L denote the set of processors not saturated by R. Imagine that we removed the rate constraints for each processor in L. Let R′ be an optimal routing for the resulting problem. We may assume that on any input x, R′ performs the tests in L in some fixed arbitrary order (until and unless k tests with value 0 are obtained), prior to performing any tests in Q. This assumption is without loss of generality, because if not, we could modify R′ to first perform the tests in L without violating feasibility, since the processors in L have no rate constraints, and performing their tests first can only decrease the load on the other processors. Thus the throughput attained by R′ is TR · 1 , where TR denotes the maximum throughput achievable just with the pL processors in Q, and pL is the probability that a random x will have the value 0 for fewer than k of the tests in L (i.e. it will not be eliminated by the tests in L). Routing R also routes flow first through L, and then through Q. Since it saturates the processors in Q, by the previous lemma, it achieves maximum possible throughput with those processors. It follows that R achieves the same throughput as R′, and hence is optimal for the modified instance where processors in L have no rate constraints. Since removing constraints can only increase the maximum possible throughput, it follows that R is also optimal for the original instance. 4.1 The Equal Rates Case We begin by considering the CMT(k) problem in the special case where the rate limits ri are equal to some constant value r for all processors. Condon et al. presented a closed-form solution for this case when k = 1 [5]. The solution is a permutation routing that uses n strategies of the form T1(π). Each permutation π is one of the n left cyclic shifts of the permutation (1, . . . , n). More specifically, for i ∈ {1, . . . , n}, let πi = (i, i + 1, . . . , n, 1, 2, . . . , i − 1), and let Ti = T c 1 (πi). The solution assigns r(1 − pi−1)/(1 − p1 · · · pn) units of flow to each Ti (where p0 is defined to be pn). By simple algebra, Condon et al. verified that the solution saturates all processors. Hence it is optimal. The solution of Condon et al. is based on the fact that for the 1-of-n problem, assigning (1 − pi−1) flow to each Ti equalizes the load on the processors. Surprisingly, this same assignment equalizes the load for the k-of-n problem as well. Using this fact, we obtain a closed-form solution to the CMT(k) problem. ℓ=a(1 − xℓ) and let α =Pk Lemma 3. Consider an instance of the CMT(k) problem. For i ∈ {1, . . . , n}, let Ti be as defined above. Let t=1 Pr [X1,n ≥ t]. Any routing that assigns a total of t units of flow to j=1(1 − pj−1), j=1(1 − pj) units. If all processors have the same rate limit r, then the routing that assigns r(1 − pi−1)/α units of flow to strategy Ti saturates all processors. Xa,b =Pb the strategies Ti, such that the fraction of the total that is assigned to each Ti is (1 − pi−1)/Pn will cause each processor's residual capacity to be reduced by tα/Pn Proof. We begin by considering the routing in which (1−pi−1) units of flow are assigned to each Ti. Consider the question of how much flow arrives per unit time at processor O1, under this routing. For simplicity, assume now that k = 2. Thus as soon as an item has failed 2 tests, it is discarded. Let qi = (1 − pi). Of the qn units assigned to strategy T1, all qn arrive at processor O1. Of the qn−1 units assigned to strategy Tn, all qn−1 arrive at processor O1, since they can fail either 0 or 1 test (namely test n) beforehand. Of the qn−2 units assigned to strategy Tn−1, the number reaching processor O1 is qn−2βn−1, where βn−1 is the probability that an item fails either 0 or 1 of tests n − 1 and n. Therefore, βn−1 = 1 − qn−1qn. 6 More generally, for i ∈ {1, . . . , n}, of the qi−1 units assigned to Ti, the number reaching processor O1 is qi−1βi, where βi is the probability that a random item fails a total of 0 or 1 of tests i, i + 1, . . . , n. Thus, βi = Pr [Xi,n = 0] + Pr [Xi,n = 1]. It follows that the total flow arriving at processor O1 is i=1(qi−1Pr [Xi,n = 1]). Pn i=1(qi−1Pr [Xi,n = 0]) +Pn Consider the second summation, Pn clearly equal to the probability that x has at least two xi's that are set to 0. The conditionPn i=1(qi−1Pr [Xi,n = 1]). We claim that this summation is equal to Pr [X1,n ≥ 2], which is the probability that x has at least two xi's that are 0. To see this, consider a process where we observe the value of xn, then the value of xn−1 and so on down towards x1, stopping if and when we have observed exactly two 0's. The probability that we will stop at some point, having observed two 0's, is j=i(1 − xj) = 1 is satisfied when exactly 1 of xn, xn−1, . . . , xi has the value 0. Thus qi−1Pr [Xi,n = 1] is the probability that we observe exactly one 0 in xn, . . . , xi, and then we observe a second 0 at xi−1. That is, it is the probability that we stop after observing xi−1. Since the second summation takes the sum of qi−1Pr [Xi,n = 1] over all i between 1 and n, the summation is precisely equal to the probability of stopping at some point in the above process, having seen two 0's. This proves the claim. An analogous argument shows that the first summation,Pn It follows that the amount of flow reaching processor O1 is Pr [X1,n ≥ 1] + Pr [X1,n ≥ 2]. This expres- sion is symmetric in the processor numbers, so the amount of flow reaching every Oi is equal to this value. Thus the above routing causes all processors to receive the same amount of flow. i=1(qi−1Pr [Xi,n = 0]), is equal to Pr [X1,n ≥ 1]. Scaling each assignment in the above routing by a constant factor scales the amount of flow reaching each processor by the same factor. In the above routing, the fraction of total flow assigned to each Ti is j=1 qj, so each unit of input flow sent along the Ti results in each processor receiving (Pr [X1,n ≥ 1]+ j=1 qj units. Thus any routing that assigns a total of t units of flow to the strate- j=1 qj, will cause each processor to receive qi−1/Pn Pr [X1,n ≥ 2])/Pn gies Ti, such that the fraction assigned to each Ti is qi−1/Pn t(Pr [X1,n ≥ 1] + Pr [X1,n ≥ 2])/Pn distribution of flow for arbitrary k assigns a qi−1/Pn unit of input flow sent along the Ti according to these proportions results in α/Pn The above argument for k = 2 can easily be extended to arbitrary k. The corresponding proportional j=1 qj fraction of the total flow to strategy Ti, and each j=1 qj units reaching each processor. The saturating routing for arbitrary k, when all processors have rate limit r, assigns rqi−1/α units of flow to strategy Ti. Thus if all processors have the same rate limit r, the routing that assigns rqi−1/(Pr [X1,n ≥ 1] + Pr [X1,n ≥ 2]) units to each strategy Ti will saturate all processors. j=1 qj units. 4.2 The Equalizing Algorithm of Condon et al. Our algorithm for the CMT(k) problem is an adaptation of one of the two MaxThroughput algorithms, for the special case where k = 1, given by Condon et al. [5]. We begin by reviewing that algorithm, which we will call the Equalizing Algorithm. Note that when k = 1, it only makes sense to consider strategies that are permutation routings, since an item can be discarded as soon as it fails a single test. Consider the CMT(k) problem for k = 1. View the problem as one of constructing a flow of items through the processors. The capacity of each processor is its rate limit, and the amount of flow sent along a permutation π (i.e., assigned to strategy T c 1 (π)) is equal to the number of items sent along that path per unit time. Sort the tests by their rate limits, and re-number them so that rn ≥ rn−1 ≥ . . . ≥ r1. Assume for the moment that all rate limits ri are distinct. The Equalizing Algorithm constructs a flow incrementally as follows. Imagine pushing flow along the single permutation (n, . . . , 1). Suppose we continuously increase the amount of flow being pushed, beginning from zero, while monitoring the "residual capacity" of each processor, i.e., the difference between its rate limit and the amount of flow it is already receiving. (For the moment, do not worry about exceeding the rate limit of a processor.) Consider two adjacent processors, i and i − 1. As we increase the amount of flow, the residual capacity of each decreases continuously. Initially, at zero flow, the residual capacity of i is greater than the residual capacity of i − 1. It follows by continuity that the residual capacity of i cannot become less than the residual 7 capacity of i − 1 without the two residual capacities first becoming equal. We now impose the following stopping condition: increase the flow sent along permutation (n, . . . , 1) until either (1) some processor becomes saturated, or (2) the residual capacities of at least two of the processors become equal. The second stopping condition ensures that when the flow increase is halted, permutation (n, . . . , 1) still orders the processors in decreasing order of their residual capacities. (Algorithmically, we do not increase the flow continuously, but instead directly calculate the amount of flow which triggers the stopping condition.) If stopping condition (1) above holds when the flow increase is stopped, then the routing can be shown to have a saturated suffix, and hence it is optimal. If stopping condition (2) holds, we keep the current flow, and then augment it by solving a new Max- Throughput problem in which we set the rate limits of the processors to be equal to their residual capacities under the current flow (their pi's remain the same). We solve the new MaxThroughput problem as follows. We group the processors into equivalence classes according to their rate limits. We then replace each equivalence class with a single megaprocessor, with a rate limit equal to the residual capacities of the constituent processors, and probability pi equal to the product of their probabilities. We then essentially apply the procedure for the case of distinct rate limits to the megaprocessors. gen The one twist is the way in which we translate flow sent through a megaprocessor into flow sent through the constituent processors of that megaprocessor; we route the flow through the constituent processors so as to equalize their load. We accomplish this by dividing the flow proportionally between the cyclic shifts of a permutation of the processors, using the proportional allocation of Lemma 3. We thus ensure that the processors in each equivalence class continue to have equal residual capacity. Note that, under this scheme, the residual capacity of a processor in a megaprocessor may decrease more slowly than it would if all flow were sent directly to that processor (because some flow may first be filtered through other processors in the megaprocessor) and this needs to be taken into account in determining when the stopping condition is reached. We illustrate the Equalizing Algorithm on the following CMT(k) problem where k = 1 and n = 3 (since k = 1 this is also an SMT(k) problem, where k = 1 and n = 3). Suppose we have 3 processors, O1, O2, O3 with rate limits r1 = 3, r2 = 14, and r3 = 18, and probabilities p1 = 1/8, p2 = 1/2 and p3 = 1/3. When flow is sent along O3, O2, O1, after 6 units of flow is sent we achieve a stopping condition with O3 and O2 having the same residual capacity of 12; the residual capacity of O1 is 2. Our algorithm then performs a recursive call where the processors O3 and O2 are combined into a megaprocessor O2,3 with associated probability p2,3 = 1/2 · 1/3 = 1/6. Within megaprocessor O2,3, flow will be routed by sending 3/7 of it along permuatation O3, O2, and the remaining 4/7 along permutation O2, O3; we observe that for one unit of flow sent through O2,3 the amount of capacity used by each processor is 3/7 + 2/7 = 5/7. Using this internal routing for megaprocessor O2,3, the algorithm sends flow along O2,3, O1; after 12 units of flow, we reach a stopping condition when O1 is saturated. Even though O2 and O3 are not saturated (they have 12 − 12 · 5/7 residual capacity left) the flows constructed as described provide optimal throughput. The Equalizing Algorithm, implemented in a straightforward way, outputs a representation of the result- ing routing that consists of a sequence of pairs of the form ((Em, . . . , E1), t), one for each recursive call. We call this a megaprocessor representation. The list (Em, . . . , E1) represents the permutation of megaprocessors Ei along which flow is sent during that call. Each Ei is given by the subset of original processors contained in it, and t > 0 is a real number that denotes the amount of flow to be sent along (Em, . . . , E1). Of course, flow coming into each megaprocessor should be routed so as to equalize the load on each of its constituent processors. The size of this representation is O(n2). Interpreted in a straightforward way, the representa- tion corresponds to a routing that sends flow along an exponential number of different permutations of the original processors. Condon et al. describe a combinatorial method to reduce the number of such permutations used to be O(n2) [5]. After such a reduction, the output can be represented explicitly as a set of O(n2) pairs of the form (π, t), one for each permutation π that is used, indicating that t > 0 amount of flow should be sent along permutation π. We call such a representation a permutation representation. The size of this permutataion representation, given explicitly, is O(n3). (Hellerstein and Deshpande describe a linear algebraic method for 8 reducing the number of permutations to be at most n, yielding an explicit reprsentation of size O(n2), but at the cost of higher time complexity [6].) We also describe a variant of the megaprocessor representation called the compressed representation, where the algorithm outputs only the first permutation explicitly, and the outputs the sequence of merges, yielding a representation of size O(n). 4.3 An Equalizing Algorithm for the CMT(k) problem In this section, we prove the following Theorem by presenting an algorithm. We will give an outline of the algorithm as well as its pseudocode. We will then describe how to achieve the running time stated in the Theorem. Theorem 4. There is a combinatorial algorithm for solving the CMT(k) problem that can be implemented to run in time O(n(log n + k) + o), where the value of o depends on the output representation. For the megapro- cessor representation, o = O(n2), for the permutation representation, o = O(n3), and for the compressed representation, o = O(n). Algorithm Outline We extend the Equalizing Algorithm of Condon et al., to apply to arbitrary values of k. Again, we will push flow along the permutation of the processors (n, . . . , 1) (where rn ≥ rn−1 ≥ . . . ≥ r1) until one of the two stopping conditions is reached: (1) a processor is saturated, or (2) two processors have equal residual capacity. Here, however, we do not discard an item until it has failed k tests, rather than discarding it as soon as it fails one test. To reflect this, we divide the flow into k different types, numbered 0 through k − 1, depending on how many tests its component items have failed. Flow entering the system is all of type 0. When m units of flow of type τ enters a processor Oi, pim units pass test i, and (1 − pi)m units fail it. So, if τ < k − 1, then of the m incoming units of type τ , (1 − pi)m units will exit processor Oi as type τ + 1 flow, and pim will exit as type τ flow. Both types will be passed on to the next processor in the permutation, if any. If τ = k − 1, then pim units will exit as type τ flow and be passed on to the next processor, and the remaining (1 − pi)m will be discarded. Algorithmically, we need to calculate the minimum amount of flow that triggers a stopping condition. This computation is only slightly more complicated for general k than it is for k = 1. The key is to compute, for each processor Oi, what fraction of the flow that is pushed into the permutation will actually reach processor Oi (i.e. we need to compute the quantity g(T c k (π), i) in the LP.) If stopping condition (2) holds, we keep the current flow, and augment it by solving a new MaxThrough- put problem in which we set the rate limits of the processors to be equal to their residual capacities under the current flow (their pi's remain the same). To solve the new MaxThroughput problem, we again group the processors into equivalence classes according to their rate limits, and replace each equivalence class with a single megaprocessor, with a rate limit equal to the rate limit of the constituent processors, and probability pi equal to the product of their probabilities. We then want to apply the procedure for the case of distinct rate limits to the megaprocessors. To do this, we need to translate flow sent into a megaprocessor into flow sent through the constituent processors of that megaprocessor, so as to equalize their load. We do this translation separately for each type of flow entering the megaprocessor. Note that flow of type τ must be discarded as soon as it fails an additional k − τ tests. We therefore send flow of type τ into the constituent processors of the megaprocessor according to the proportional allocation of Lemma 3 for (k − τ )-of-n′ testing, where n′ is the number of consituent processors of the megaprocessor. We also need to compute how much flow of each type ends up leaving the megaprocessor (some of the incoming flow of type τ entering the megaprocessor may, for example, become outgoing flow of type τ + n′), and how much its residual capacity is reduced by the incoming flow. We give a more detailed description of the necessary computations in the pseudocode, which we discuss next. However, the pseudocode does not contain all the implementation details, and is not optimized for efficiency. It also gives the output using a megaprocessor representation. Following presentation of the 9 pseudocode, we discuss how to implement it to achieve the running times stated in Theorem 4 for the different output representations. Pseudocode The main part of the pseudocode is presented below as Algorithm 1. The following informa- tion will be helpful in understanding it. At each stage of the algorithm, the processors are partitioned into equivalence classes. The proces- sors in each equivalence class constitute a megaprocessor. Each equivalence class consists of a contiguous subsequence of processors in the sorted sequence On, . . . , O2, O1. We use m to denote the number of megapro- cessors (equivalence classes). The processors in each equivalence class all have the same residual capacity. In Step 1 of the algorithm, we partition the processors into equivalence classes according to their rate limits; two processors are in the same equivalence class if and only if they have the same rate limit. We use Ei to denote both the ith equivalence class and the ith megaprocessor. In some our examples, we denote a megaprocessor containing processors {Oi, Oi+1, . . . , Oj } by Oi,i+1,...,j. In Step 2, we compute the amount of flow t that triggers one of the two stopping conditions. In order to do this, we need to know the rate at which the residual capacity of each processor within an equivalence class Ei will be reduced when flow is sent down the megaprocessors in the order Em, . . . , E1. We use ξ(i) to denote the amount by which the residual capacity of the processors in Ei is reduced when one unit of flow is sent in that order. The equation for ξ(i) follows from the preceding lemmas and discussion. We use fj(z) to denote the amount of flow of type j that would reach processor z, if one unit of flow were sent down the permutation On, . . . , O1, where these are the original processors, not the megaprocessors. This is precisely equal to the probability that random item x has exactly j 0's in tests n, . . . , z + 1. We compute the value of fj(z) for all z and j in a separate initialization routine, given below. The key here is noticing that if you send one unit of flow down the megaprocessors Em, . . . , E1, the amount of flow reaching megaprocessor Ei is precisely fj(c(i)), where c(i) is the highest index of a processor in Ei; the amount of flow reaching the megaprocessor depends only on how many 0's have been encountered in test n, . . . , c(i) + 1, and not on the order used to perform those tests. The quantity t1 is the amount of flow sent down Em, . . . , E1 that would cause saturation of the processors in E1. The quantity t2 is the minimum amount of flow sent down Em, . . . , E1 that would cause the residual capacities of two megaprocessors to equalize. The stopping condition holds at the minimum of these two quantities. MaxThroughput Initialization fj(z) ← 0, ∀z ∈ {1, . . . , n}, ∀j ∈ {0, . . . , k − 1}; f0(1) ← 1; for (z ← 2; z ≤ n; z ← z + 1) do for (j ← 0; j ≤ k − 1; j ← j + 1) do fj(z) ← qz−1fj−1(z − 1) + pz−1fj(z − 1); return SolveMaxThroughput(p1, . . . , pn,r1, . . . , rn); Example We illustrate our algorithm for the CMT(k) problem on the following example. Let k = 2 and n = 4. Suppose the probabilities are p1 = p2 = p3 = 1/2, p4 = 3/4, and the rate limits are r1 = r2 = 12, r3 = r4 = 10. Our algorithm first combines processors with same rate limits into megaprocessors; thus we combine O1 and O2 into megaprocessor O1,2 with rate limit 12. It routes flow through this megaprocessor by sending a 1/2 fraction of the flow in the order O1, O2, and sending the other 1/2 fraction in the order O2, O1. Similarly, O3 and O4 have the same rate limit, so they are combined into a megaprocessor O3,4 with rate limit 10, where a 1/3 fraction of the flow is sent along O3, O4, and the other 2/3 fraction is sent along O4, O3. Our megaprocessor O1,2 has a higher rate limit than O3,4, consequently our algorithm routes flow in the order O1,2, O3,4. We now show that the stopping condition is reached after sending 6 units of flow along this 10 Algorithm 1 SolveMaxThroughput(p1, . . . , pn,r1, . . . , rn) Input: n selectivities p1, . . . , pn; n rate limits r1 ≤ . . . ≤ rn Output: representation of solution to the MaxThroughput problem for the given input parameters 1. // form the equivalence classes Em, . . . , E1; Let 1 ≤ ℓ1 < . . . < ℓm+1 = n + 1 such that, for all y, y′ ∈ [ℓi−1, ℓi) and z, z′ ∈ [ℓi, ℓi+1), where i ∈ [2, n], we have ry = ry ′ < rz = rz ′ Then, for i ∈ [1, m], Ei = {Oz ℓi ≤ z < ℓi+1}, and Ri ← rℓi . 2. // calculate t using the following steps; for (i ← 1; i ≤ m; i ← i + 1) do c(i) ← highest index of a processor in Ei; b(i) ← lowest index of a processor in Ei; t1 ← R1 Recall that Xa,b =Pb j=0 fj(c(i)) ·(cid:16)Pk−j ξ(i) ←Pk−1 ξ(i)−ξ(i−1)(cid:17); t2 ← mini∈[2,...,m](cid:16) Ri−Ri−1 t ← min(t1, t2); ξ(1) ; ℓ=a(1 − xℓ) v=1 Pr(cid:2)Xb(i),c(i) ≥ v(cid:3)(cid:17) /Pc(i) t=b(i)(1 − pt); 3. // calculate the residual capacity for each processor Oℓ; for (ℓ ← 1; ℓ ≤ n; ℓ ← ℓ + 1) do j ← index of the equivalence class Ej containing processor Oℓ; ℓ ← rℓ − ξ(j)t; r′ 4. // store new flow and recurse if needed K ← ((Em, . . . , E1), t); if (r′ 1 == 0) then // residual capacity of equivalence class E1 is 0 return K; else K ′ ← SolveMaxThroughput(p1, . . . , pn,r′ return K ◦ K ′; // i.e. the concatenation of K and K ′ 1, . . . , r′ n); 11 route. The 6 units of flow decreased the capacity of processors O1, and O2 in O1,2 by 6, since k = 2 and thus flow cannot be discarded before it has been subject to at least two tests. We now calculate the reduction of capacity in O3 and O4 caused by the 6 units of flow sent through O1,2, O3,4. Flow leaving O1,2 has a 1/4 probability of having failed both processors in O1,2 and exiting the system; for flow that stays in the system to be tested by O3,4, it has a 1/4 chance of having passed the test of both processors; it has a 1/2 chance of having passed the test of one processor and having failed the test of the other processor. Thus, of the 6 units of flow sent into O1,2, 1/4 · 6 = 3/2 units are passed on to O3,4 as type 0 flow, and 1/2 · 6 = 3 units of flow are passed on to O3,4 as type 1 flow. Of the 3/2 units of type 0 flow, entering O3,4, all of it must undergo both test 3 and test 4, since flow is not discarded until it has failed two tests. Thus that flow reduces the capacity of both O3 and O4 by 3/2 units. Of the 3 units of type 1 flow entering O3,4, 1/3 is tested first by O3, and then by O4 only if it passes test 3 (which it does with probability 1/2). The remaining 2/3 is tested first by O4, and then by O3 only if it passes test 4 (which is does with probability 3/4). Thus of the 3 units of type 1 flow, 3·(1/3+2/3·3/4) = 5/2 units reach O3, and 3 · (2/3 + 1/3 · 1/2) = 5/2 units reach O4. Hence the 3 + 3/2 total units of flow entering O3,4 reduce the capacities of both O3 and O4 by 5/2 + 3/2 = 4. We have thus shown that the 6 units of flow sent first to O1,2 and then to O3,4, cause the residual capacities of O1 and O2 to be 12 − 6 = 6, and the residual capacities of O3 and O4 to be 10 − 4 = 6. Thus the residual capacities of all processors equalize, as claimed. At this point our algorithm constructs a new megaprocessor, by combining the processors in O1,2 with the processors in O3,4. All the processors in the resulting megaprocessor, O1,2,3,4, have a residual capacity of 6. Using the proportional allocation of Lemma 3 to route flow sent into O1,2,3,4, we assign 1/7 of the flow into O1,2,3,4 to permutation π1 = {1, 2, 3, 4}, 2/7 to permutation π2 = {2, 3, 4, 1}, 2/7 to permutation π3 = {3, 4, 1, 2}, and 2/7 to permutation π4 = {4, 1, 2, 3}. By sending a total of 7 units of flow through O1,2,3,4 according to this allocation, we send 1, 2, 2, and 2 units respectively along the four permutations, achieving the saturating routing given in Lemma 3. Our final routing achieves a throughput of 6 + 7 = 13 which is optimal. Achieving the running time. Let us first consider the running time of the algorithm excluding the computation of ξ(i) and the time it takes to construct the output representation K. It is easy to see that the algorithm makes at most n − 1 recursive calls, because megaprocessors can only be merged a total of n − 1 times. Excluding the computation of ξ(i), the time spent in each recursive call is clearly O(n). However, we can implement the algorithm so as to ensure this time is O(log n), as follows. First, the maintenance of the equivalence classes can be handled in O(1) time per merge by simply taking a union of the sets of adjacent processors in each megaprocessor, instead of recomputing these sets from scratch. Second, we do not need to compute the residual capacity of each megaprocessor at every recursive call. In fact, for all megaprocessors except the first one, we only need enough information about its residual capacity to allow us to compute t2 ← mini∈[2,...,m](cid:16) Ri−Ri−1 i ≥ 2, we keep the quantity Qi, where Qi =(cid:16) Ri−Ri−1 ξ(i)−ξ(i−1)(cid:17). This suggests that for each megaprocessor i where ξ(i)−ξ(i−1)(cid:17) instead of Ri. The megaprocessors can be stored in a priority queue, according to their Qi values. Consider any i where Ei or Ei−1 are not involved in a merge. Then (Ri − ξ(i)t) − (Ri−1 − ξ(i − 1)t) ξ(i) − ξ(i − 1) = Ri − Ri−1 ξ(i) − ξ(i − 1) − t. Thus following the merge, Qi is decreased by the same amount t for all such i. Therefore, instead of updating the Qi for these i in the priority queue, we can keep their current values, and maintain the sum of the t values computed so far; this can be subtracted from Qi if its updated value is needed. We do need to remove the two merged megaprocessors from the priority queue, insert the information about the resulting new megaprocessor, and update the Qi values for megaprocessors i such that Ei or Ei−1 were involved in 12 a merge. Note that we need to change the Qi values for such megaprocessors due to the change in the ξ(·) value of the newly formed megaprocessor. The above operations can be performed in time O(log n) time per merge, using the priority queue. Therefore, the running time of the algorithm excluding the computation of ξ(i) is O(n log n + o) where o is the time required to construct the output. In the pseudocode, the output is computed using the megapro- cessor representation. Since there are at most n recursive calls, there are at most n pairs ((Em, . . . , E1), t) in the output, and therefore o = O(n2). If one chose to convert this representation to a permutation representation, using the combinatorial method of Condon et al. [5], then the value of o would be O(n3). Consider instead the following more compact output representation, which we call the compressed rep- resentation. Suppose the algorithm outputs the initial permutation, then outputs the sequence of merges performed, together with the t values associated with the merges. In this case, we have o = O(n). We will next show that the computation of ξ(i) throughout the algorithm can be performed in O(nk) total time. Computing ξ(i). Let E(i) k be the k th megaprocessor in the recursive call associated with the ith merge. k , and let c(i, k) be the highest index of a processor in k denote the size of that megaprocessor, that is, the number of processors in it. Thus Let b(i, k) be the lowest index of a processor in E(i) k . Let E(i) E(i) E(i) k = c(i, k) − b(i, k) + 1. Let h(i) and h(i) + 1 be the indices of the megaprocessors merged by the ith merge (i.e. E(i) h(i) and E(i) h(i)+1 are the megaprocessors merged by the ith merge). Observe that at iteration i after megaprocessor E(i) h(i) is merged with E(i) h(i)+1 we only recompute ξ(h(i)). After the merge, we need to compute ξ(h(i)) = k−1 Xj=0 fj(c(i, h(i) + 1)) · k−j Xv=1 Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) ≥ v(cid:3)! / c(i,h(i)+1) (1 − pt) Xt=b(i,h(i)) Consider the denominator Pc(i,h(i)+1) probabilities of all processors contained in E(i) h(i)+1. To enable this computation to be performed in constant time per recursive call, we simply store, with each megaprocessor, the sum of the failure probabilities of all processors in it. In each recursive call, it only takes constant time to update this information. Recall that fj(c(i, h(i) + 1)) for all j ∈ {0, . . . , k − 1} are computed in the initialization procedure. Let h(i) and E(i) t=b(i,h(i)) (1 − pt) in the above expression. It is the sum of the failure Dj = k−j Xv=1 Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) ≥ v(cid:3) . Given Dj for j ∈ {0, . . . , k − 1}, we can compute ξ(h(i)) in O(k) time. Observe that Dj = Dj+1 + Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) ≥ k − j(cid:3) . Therefore, given Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) ≥ v(cid:3) for v ∈ {1, . . . , k}, we can compute {D0, . . . , Dk−1} in O(k) time. Finally, observe that Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) ≥ v(cid:3) = Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) ≥ v + 1(cid:3) + Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3) . Therefore, given Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3) for v ∈ {1, . . . , k}, we can compute Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) ≥ v(cid:3) for all v ∈ {1, . . . , k} in O(k) time. To enable these computations, we store, with each megaprocessor, the values Pr [Xb,c = v] for all v ∈ {1, . . . , k}, where b and c are respectively the lowest and highest indices of the processors contained in that megaprocessor. We will analyze below the total cost of keeping these values updated. 13 We denote by C the total cost of computing ξ(·) throughout the algorithm, using the implementation described. Since we will have to compute ξ(·) at most n times throughout the algorithm, by the arguments v=0 Ci,v. We show that C = O(nk) by proving Pn−1 above, C is bounded by O(nk) plus the cost of computing Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3) for all i ∈ {1, . . . , n − 1} and v ∈ {0, . . . , k}. Let us denote the cost of computing Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3) by Ci,v. Therefore, C = O(nk) +Pn−1 i=1 Pk Lemma 5. Pn−1 i=1 Pk h(i)+1 and E(i) to compute Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3), we have already computed and stored Pr(cid:2)Xb(i,h(i)),c(i,h(i)) = v(cid:3) and Pr(cid:2)Xb(i,h(i)+1),c(i,h(i)+1) = v(cid:3) for all v ∈ {0, . . . , k}. Since Pr [Xb,c = v] = 0 for any b, c if v > c − b + 1, we can compute Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3) using v=0 Ci,v = O(nk). h(i) if E(i) h(i)+1 otherwise. Recall that when we need i=1 Pk the following equality: v=0 Ci,v = O(nk). Proof. Let E(i) h(i) ≤ E(i) min = E(i) min = E(i) min(v,E (i) h(i)) Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1)= v(cid:3) = X Pr(cid:2)Xb(i,h(i)),c(i,h(i)) = j(cid:3) · Pr(cid:2)Xb(i,h(i)+1),c(i,h(i)+1)= v − j(cid:3) (i) h(i)+1) j=max(0,v−E Thus, we perform at most one multiplication and one addition for each term in Equation 1, yielding Ci,v < 2 · min(v + 1, E(i) min + 1). (1) (2) the two megaprocessors, distributing the cost evenly among the processors in the megaprocessor. Thus, we We can now bound Pi,v Ci,v as follows. Each time two megaprocessors E(i) the cost of computing Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3), for all v ∈ {0, . . . , k} to the processors in the smaller of charge (Pk Let κj(i, v) denote how much of the cost of computing Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3) we charge to Oj during the ith merge. Let κj(v) denote how much of the cost of computing Pr(cid:2)Xb(i,h(i)),c(i,h(i)+1) = v(cid:3) for all i = {1, . . . , k − 1} we charge to processor Oj . Let κj denote the total amount we charge to processor Oj. In other words, min to each processor Oi ∈ E(i) min. h(i)+1 merge, we charge v=0 Ci,v)/E(i) h(i) and E(i) (3) (4) (5) 0 n−1 min κj(i, v) =(cid:26) Ci,v/E(i) Xi=1 Xi=1 Xv=0 κj(v) = κj(v) = κj = k n−1 k κj(i, v) if Oj ∈ E(i) otherwise. min, κj(i, v) Xv=0 Then, we have Pi,v Ci,v =Pn Consider any processor Oj . We will show that κj(v) = O(1). Let i′(z) = i′(j, v, z) be the index of the merge in which processor Oj is charged for the cost of computing Pr [Xb,c = v] for any b, c for the z th time. Formally, let j=1 κj. We will bound Pi,v Ci,v by proving an upper bound on κj. i′(z) = i′(j, v, z) =(cid:26) ℓ 0 if ∃ℓ ∈ [1, n − 1] s.t. κj(ℓ, v) > 0 ∧ {t t < ℓ, κj(t, v) > 0} = z − 1 otherwise By Equation 2, Ci,v < 2E(i) min + 2, which implies κj(i, v) < 4 by Equation 3. Observe that by the definition of E(i) min and i′(z), if i′(2) > 0, we have E(i′(2)) min ≥ E(i′(1)) h(i′(1)) + E(i′(1)) h(i′(1))+1 ≥ v. (6) 14 Also by the definition of E(i) min, if i′(z) > 0, we have Combining all these facts, and letting Z = max(x : i′(x) > 0), we have E(i′(z)) min ≥ 2 · E(i′(z−1)) min . (7) κj(v) = n−1 Xi=1 κj(i, v) n−1 κj(i, v) κj(i′(z), v) Ci′(z),v E(i′(z)) min 2v + 2 E(i′(z)) min 2v + 2 2z−2 · E(i′(2)) min 2v 2z−2 · E(i′(2)) min 2 2z−2 Z Z Z Xi=2 Xz=2 Xz=2 Xz=2 Xz=2 Xz=2 Xz=2 Z Z Z ≤ 4 + = 4 + = 4 + < 4 + ≤ 4 + < 6 + ≤ 6 + < 6 + 4 = 10. by definition κj(i, v) < 4 by definition by Equation 3 by Equation 2 by Equation 7 E(i′(2)) min ≥ 2 by Equation 6 have, Thus, we have κj(v) = O(1). This yields κj =Pk v=0 κj(v) = O(k). Since Pn Xj=1 κj ≤ n · O(k) = O(nk) Xi=1 Xv=0 Ci,v = n−1 n k j=1 κj ≤ n · maxi∈{1,...,n} κi, we Therefore, by Lemma 5, we have C = O(nk) +Pn−1 total time O(n(log n + k) + o). i=1 Pk v=0 Ci,v = O(nk). Thus, our algorithm runs in 5 An Ellipsoid-Based Algorithm for the SMT(k) problem There is a simple and elegant algorithm that solves the MinCost problem for standard k-of-n testing, due to Salloum, Breuer, and (independently) Ben-Dov [1,10,11]. It outputs a strategy compactly represented by two permutations, one ordering the processors in increasing order of the ratio ci/(1 − pi), and the other in increasing order of the ratio ci/pi. Chang et al. and Salloum and Breuer later gave modified versions of this algorithm that output a less compact, but more efficiently evaluatable representation of the same strategy [3, 12]. We now show how to combine previous techniques to obtain a polynomial-time algorithm for the SMT(k) problem based on the ellipsoid method. The algorithm uses a technique of Despande and Hellerstein [6]. 15 They showed that, for 1-of-n testing, an algorithm solving the MinCost problem can be combined with the ellipsoid method to yield an algorithm for the MaxThroughput problem. In fact, as we see in the proof below, their approach is actually a generic one, and can be applied to the testing of other functions. The ellipsoid-based algorithm for k-of-n testing makes use of the dual of the LP for the CMT(k) problem, which is as follows: Dual of Max-Throughput LP: Given r1, . . . , rn > 0, p1 . . . , pn ∈ (0, 1), find an assignment to the variables yi, for all i ∈ {1, . . . , n}, minimizing n subject to the constraints: F = riyi Xi=1 i=1 g(π, i)yi ≥ 1 for all T ∈ Tc, (2) yi ≥ 0 for all i ∈ {1, . . . , n}. (1) Pn Theorem 6. There is a polynomial-time algorithm, based on the ellipsoid method, for solving the SMT(k) problem. Proof. The approach of Deshpande and Hellerstein works as follows. The input consists of the pi and the ri, and the goal is to solve the MaxThroughput LP in time polynomial in n. The number of variables of the MaxThroughput LP is not polynomial, so the LP cannot be solved directly. Instead, the idea is to solve it by first using the ellipsoid method to solve the dual LP. The ellipsoid method is run using an algorithm that simulates a separation oracle for the dual in time polynomial in n. During the running of the ellipsoid method, the violated constraints returned by the separation oracle are saved in a set M . Each constraint of the dual corresponds to an ordering T . When the ellipsoid method terminates, a modified version of the MaxThroughput LP is generated, which includes only the variables zT corresponding to orderings T in M (i.e. the other variables zT are set to 0). This modified version can then be solved directly using a polynomial-time LP algorithm. The resulting solution is an optimal solution for the original MaxThroughput LP. The above approach requires a polynomial-time algorithm for simulating the separation oracle for the dual. Deshpande and Hellerstein's method for simulating the separation oracle relies on the following observa- tions. In the dual LP for the MaxThroughput 1-of-n testing problem, there are n! constraints correspond- i=1 g(T1(π), i)yi ≤ 1. If i=1 g(T, i)yi is the expected cost of testing i=1 g(T, i)yi by solving the MinCost problem with probabilities p1, . . . , pn and cost vector y. (Liu et al.'s approximation algorithm for generic MaxThroughput also relies on this observation [9].) ing to the n! permutations of the processors. The constraint for permutation π is Pn one views y as a vector of costs, where the cost of i is yi, then Pn an item x using ordering T . Thus one can determine the ordering T that minimizesPn If the MinCost ordering T has expected cost less than 1, then the constraint it corresponds to is violated. Otherwise, since the right hand side of each constraint is 1, y obeys all constraints. Thus simulating the separation oracle for the dual on input y can be done by first running the MinCost algorithm (with probabilities pi and costs yi) to find a MinCost ordering T . Once T is found, the values of the coefficients i=1 g(T, i), the expected cost of T . If this value is less i=1 g(T, i) is returned. g(T, i) are calculated. These are used to calculate Pn than 1, then the constraint Pn dual LP for this problem, there is a constraint, Pn To apply the above approach to MaxThroughput for standard k-of-n testing, we observe that in the i=1 g(T, i)yi ≤ 1, for every possible strategy T , We can simulate a separation oracle for the dual on input y by running a MinCost algorithm for standard k-of-n testing. We also need to be able to compute the g(T, i) values for the strategy output by that algorithm. The algorithm of Chang et al. for the MinCost standard k-of-n testing problem is suitable for this purpose, as it can easily be modified to output the g(T, i) values associated with its output strategy T [3]. 16 References [1] Yosi Ben-Dov. Optimal testing procedure for special structures of coherent systems. Management Science, 27:1410 -- 1420, 1981. [2] Endre Boros and Tongu¸c Unluyurt. Diagnosing double regular systems. Annals of Mathematics and Artificial Intelligence, 26(1-4):171 -- 191, 1999. [3] Ming-Feng Chang, Weiping Shi, and W. Kent Fuchs. Optimal diagnosis procedures for k-out-of-n structures. IEEE Transactions on Computers, 39(4):559 -- 564, 1990. [4] Anne Condon, Amol Deshpande, Lisa Hellerstein, and Ning Wu. Flow algorithms for two pipelined filter ordering problems. In Proceedings of the Twenty-Fifth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, June 26-28, PODS 2006, Chicago, Illinois, USA, pages 193 -- 202. ACM, 2006. [5] Anne Condon, Amol Deshpande, Lisa Hellerstein, and Ning Wu. Algorithms for distributional and adversarial pipelined filter ordering problems. ACM Transactions on Algorithms, 5:24:1 -- 24:34, March 2009. [6] Amol Deshpande and Lisa Hellerstein. Parallel pipelined filter ordering with precedence constraints. ACM Transactions on Algorithms, 8(4):41, 2012. [7] Michael R. Garey. Optimal task sequencing with precedence constraints. Discrete Mathematics, 4:37 -- 56, 1973. [8] Murali S. Kodialam. The throughput of sequential testing. In Proceedings of Integer Programming and Combinatorial Optimization, 8th International IPCO Conference, Utrecht, The Netherlands, June 13-15, 2001, volume 2081 of Lecture Notes in Computer Science, pages 280 -- 292. Springer, 2001. [9] Zhen Liu, Srinivasan Parthasarathy, Anand Ranganathan, and Hao Yang. A generic flow algorithm for shared filter ordering problems. In Proceedings of the Twenty-Seventh ACM SIGMOD-SIGACT- SIGART Symposium on Principles of Database Systems, PODS 2008, June 9-11, 2008, Vancouver, BC, Canada, pages 79 -- 88. ACM, 2008. [10] Salam Salloum. Optimal testing algorithms for symmetric coherent systems. PhD thesis, University of Southern California, 1979. [11] Salam Salloum and Melvin A. Breuer. An optimum testing algorithm for some symmetric coherent systems. Journal of Mathematical Analysis and Applications, 101(1):170 -- 194, 1984. [12] Salam Salloum and Melvin A. Breuer. Fast optimal diagnosis procedures for k-out-of-n:G systems. IEEE Transactions on Reliability, 46(2):283 -- 290, June 1997. [13] Neil Sarnak and Robert Endre Tarjan. Planar point location using persistent search trees. Communi- cations of the ACM, 29(7):669 -- 679, 1986. [14] Tongu¸c Unluyurt. Sequential testing of complex systems: a review. Discrete Applied Mathematics, 142(1-3):189 -- 205, 2004. 17
1901.04934
1
1901
2019-01-15T16:57:17
An Algorithm for Bounding the Probability of r-core Formation in k-uniform Random Hypergraphs
[ "cs.DS" ]
We present an algorithm for bounding the probability of r-core formation in k-uniform hypergraphs. Understanding the probability of core formation is useful in numerous applications including bounds on the failure rate of Invertible Bloom Lookup Tables (IBLTs) and the probability that a boolean formula is satisfiable.
cs.DS
cs
An Algorithm for Bounding the Probability of r-core Formation in k-uniform Random Hypergraphs George Bissias [email protected] College of Information and Computer Sciences, UMass Amherst January 16, 2019 1 Introduction We present an algorithm for bounding the probability of r-core formation in k-uniform hypergraphs. Understanding the probability of core formation is useful in numerous applications including bounds on the failure rate of Invertible Bloom Lookup Tables (IBLTs) [2] and the probability that a boolean formula is satisfiable [3]. of the(cid:0)v k v,p be a k-uniform hypergraph on v vertices V and edge set E where each (cid:1) edges in E occurs with probability p. An r-core over vertices U ⊆ V is 1.1 Problem Statement Let Hk an induced subgraph Hk C(v, p, k, r) to be the probability that at least one r-core forms in Hk paper, we seek upper and lower bounds on C(v, p, k, r). v,p(U ) in which every vertex has degree at least r. Define v,p. In this 1.2 Establishing r-core Existence The succinct description of an r-core belies the complexity associated with identifying them. The standard approach is by means of a peeling process [3]. Proceeding in rounds, all vertices with degree less than r are removed from Hk v,p along with any incident edges. The process is repeated in the subsequent rounds, terminating after the round where no vertices are removed. The remaining vertices form an r-core in Hk v,p. 2 General Algorithm Calculating C∗(v, p, k, r), the probability that exactly one r-core forms any- where in Hk v,p is relatively straightforward given knowledge of C¯u(v, p, k, r), the probability that an r-core forms on all vertices in some subset of u vertices. 1 Algorithm 1 (appearing in Appendix B) describes how to calculate C∗(v, p, k, r) from C¯u(v, p, k, r), which we prove correct in the remainder of this section. Given that C¯u(v, p, k, r) is known for all u ≤ v, our approach is to recursively calculate Cu(v, p, k, r) -- the probability that a single r-core of size u, and no other, forms somewhere in Hk v,p -- and use the partial results to construct C∗(v, p, k, r). Notice that the probability that i r-cores form in Hk v,p is bounded above by C∗(v, p, k, r)i. This is true because the latter quantity is equivalent to allowing edges to be reused between r-cores. From this it follows that C(v, p, k, r) ≤ ∞(cid:80) C∗(v, p, k, r)i i=1 C∗(v,p,k,r) 1−C∗(v,p,k,r) , = where the second step is the closed-form for a geometric series. We next show how C¯u(v, p, k, r) is related to Cu(v, p, k, r), the most critical step in the algorithm. Because we are working with random hypergraphs, the probability that an r-core forms on vertex set U is equivalent to the proba- bility that an r-forms on any other set U(cid:48) ⊆ V where U(cid:48) = U. Therefore C¯u(v, p, k, r) = CU (v, p, k, r), where the latter quantity is the probability that an r-core forms on all vertices in U ⊆ V . Because Hk v,p is k-uniform, it is clear that no r-core can form when v < k. Hence, ∀u < k,Cu(v, p, k, r) = 0. The case where u ≥ k is covered by the following theorem. THEOREM 1: For every u, k ≤ u ≤ v Cu(v, p, k, r) = C(cid:48)(v, p, k, r)C(cid:48)(cid:48)(v, p, k, r) CU (v, p, k, r) (1 − Cx(v, p, k, r))(v−u x−v) , where C(cid:48) u(v, p, k, r) = and v(cid:89) (cid:19) (cid:18)v (cid:88) u(v, p, k, r) = 1 − v−u(cid:88) C(cid:48)(cid:48) U⊆V,u=U u x>u Cv−u(x, p, k, r). x=k PROOF: We proceed by showing that C(cid:48) u(v, p, k, r) is the probability that exactly one r-core of size u forms somewhere in Hk v,p and is not contained in any larger r-core. While C(cid:48)(cid:48) u(v, p, k, r) is the probability that no other r- core forms in Hk v,p over a subset of vertices distinct from the set of vertices containing the r-core of size u. If both of these hold, then it is clear that Cu(v, p, k, r) = C(cid:48) u(v, p, k, r)C(cid:48)(cid:48) (cid:1) u(v, p, k, r), we begin by summing (over all possible U ⊆ V ) the prob- abilities CU (v, p, k, r) qualified by the restriction that U not be contained in a x−u supersets of size x containing the u vertices. This implies that the probability that the r-core on u vertices is not contained in any r-core of size x, is given by (1 − Cx(v, p, k, r))s, which can be extended by conjunction to all x > u. That is to say, the probability that an r-core forms over all vertices U and that this larger r-core over vertices X. Let u = U. For any x > u, there exist s =(cid:0)v−u u(v, p, k, r), thus the theorem will be proved. For C(cid:48) 2 r-core is a subset of no other r-core is given by v(cid:89) CU (v, p, k, r) (1 − Cx(v, p, k, r))(v−u x−v) . (cid:1) ways to choose a subset of u vertices we arrive at the x>u Summing over the (cid:0)v desired result, C(cid:48) Turning to C(cid:48)(cid:48) u u(v, p, k, r). u(v, p, k, r), we know that any r-core of size greater than v − u must intersect every r-core of size u, which implies that it could not be a distinct r-core. Thus, we consider only distinct r-cores that form over x vertices in the range [k, v − u]. Assuming that one r-core of size u exists, a distinct r-core could only form in an induced subgraph of size v − u, which occurs with probability Cv−u(x, p, k, r). It follows that the probability that no distinct r-core of size x forms, for any possible value of x, is given by C(cid:48)(cid:48) u(v, p, k, r). 2 3 Bounding Local r-core Formation With Theorem 1 in hand, we next seek to measure CU (v, p, k, r), the probability that an r-core forms over a specific subset of vertices U in Hk v,p. This paper describes two different approaches: one gives upper and lower bounds based on hypergraph connectivity and another provides a close approximation based on vertex covering. 3.1 Connectivity Bound We begin with the observation that a connected component on vertices U is equivalent to a 1-core on U . Thus, CU (v, p, k, 1) is the probability that the induced subgraph on U is connected. Expanding on this idea, consider an interleaved graph construction / peeling process yielding a hypergraph I k v,p wherein an r-core is revealed by peeling in rounds, one 1-core at a time, and edges are regenerated at random (removing the remaining old ones and adding new ones) with probability p after each round. Let C∗ U (v, p, k, r) denote the probability that any r-core forms over all vertices U in I k v,p using this interleaving process. In this alternative construction, an r-core on vertex set U exists iff a 1-core on U exists during each round. Thus, C∗ U (v, p, k, r) = CU (v, p, k, 1)r. Moreover, as the next theorem shows, the probability C∗(v, p, k, r) that any r-core forms in I k can be used to bound C(v, p, k, r) both above and below. THEOREM 2: In expectation, C∗(v, p/r, k, r) ≤ C(v, p, k, r) ≤ C∗(v, p, k, r). v,p PROOF: To show C∗(v, p/r, k, r) ≤ C(v, p, k, r), let N be the expected number of edges formed in Hk v,p, we divide the number of edges uniformly between rounds in parcels of N/r. Since edges are cleared between rounds and their total number is N , it follows that the probability that an r-core forms v,p. For I k 3 in I k v,p with edge probability p/r cannot exceed the probability that an r-core forms in Hk v,p where all edges contribute simultaneously to the formation of an r-core. The inequality C(v, p, k, r) ≤ C∗(v, p, k, r) can be argued similarly by noting that I k v,p generates and clears N edges in expectation per round, thus the probability that an r-core develops in it cannot be less than the probability that one forms in Hk v,p. 2 3.1.1 A recursive formula for connectivity probability Gilbert [1] introduced the following classical result that gives the exact probability that a specific u vertices in H2 v,p, an Erdos-Renyi random graph, are connected. p (u) = 1 − u−1(cid:88) f 2 f 2 p (i) i=1 (cid:18)u − 1 (cid:19) i − 1 (1 − p)i(u−i), p (v) can equivalently be interpreted as the probability p (1) = 1. Function f 2 with f 2 that the entire graph H2 with the following definitions. For all u ≥ 1, u,p is connected. We next prove a more general result for k-uniform hypergraphs, beginning where f k(1) = 1, f k(u) = 0 when 1 < u < k, f k p (u, i) = f k for u ≥ k and 1 ≤ i < u, and f k i=1 p (u) = 1 − u−1(cid:88) (cid:19) (cid:18)u − 1 (cid:18)i min(i,k−1)(cid:88) i − 1 p (i) j=1 j εk(u, i) = f k p (u, i), (1 − p)εk(u,i), (cid:19)(cid:18)u − i (cid:19) k − j . THEOREM 3: The probability that a certain set of u vertices form a connected component in Hk p (u, i), where u ≥ k and 1 ≤ i < u, gives the probability that there exists at least one set of i vertices in Hk v,p, u ≤ v, is given by f k u,p that connect to each other and to no others. p (u). Furthermore, f k PROOF: We proceed by induction on u as follows. Clearly f k p (1) = 1 is correct since every vertex forms a connected component with itself. And for 1 < u < k, it is also clear that f k p (u) should have value 0, because no edge forms on fewer p (u − 1) gives the correct probability that a than k vertices. Now suppose that f k v,p when u− 1 ≥ k. The probability connected component of size u− 1 forms in Hk that a set of u vertices is connected is equivalent to the complement of the probability that there exists some connected component that forms exclusively p (u, i) provided on a proper subset of those vertices, which is equal to 1−(cid:80)u−1 i=1 f k 4 p (u) will follow. Suppose that the induction on f k 1 ≤ i < u. There are(cid:0)u−1 that f k correctness of our expression for f k the validity of f k p (u, i) gives the indicated probability. Thus, it remains only to prove the p (u, i), given that f k p (i) holds for i < u, and p (i) holds for components up to size i = u−1, and consider adding a new vertex x to the component. We claim that f (u, i) gives the probability that there exists a component on exactly i vertices where from the original set of u− 1 vertices. Adding vertex x to S, means the candidate subset has i vertices. Since i < u, we know by induction that all vertices in S are connected with probability f k p (i). So taken together, the probability of forming a connected component with size at least i is given by f k for candidate component S to have exactly i vertices, it must be the case that none of its i vertices are connected to any of the remaining u − i vertices. In a k-uniform hypergraph, there are εk(u, i) possible edges between vertices S and the remaining vertices. And the probability that none of those edges exist is equal to (1 − p)εk(u,i), which completes the proof. (cid:1) ways to choose a candidate subset S of i − 1 vertices (cid:1). Now in order p (i)(cid:0)u−1 i−1 i−1 2 For Hk 3.2 Covering Heuristic Another approach to measuring CU (v, p, k, r), is to determine the probability that every vertex in U is covered by at least r edges, which is almost identical to CU (v, p, k, r), except that it admits the additional possibility that multiple r-cores create a disjoint covering of U . In this section, we develop a function CU (v, p, k, r), that closely approximates the coverage probability, and CU (v, p, k, r) accordingly. v,p, we can imagine that edges in E are formed as follows. Each edge has k slots, every slot can accommodate exactly one vertex from V , and no vertex can occupy more than one slot in a single edge. Define b(x; n, p) and B(x; n, p) to be the probability mass and cumulative distribution functions of the distribution Binomial[n, p], respectively. Suppose that there are eU edges in U with u = U. Placing vertices into slots independently at random defines a Poisson process. In particular, the probability that a given vertex is assigned to at least r slots, independent of the other vertices is given by 1− B(r− 1; eU , k/u). The actual number of edges in Hk v,p(U ) varies according to a separate Poisson p. Thus, the probability that exactly eU edges form within Hk now derive our approximation to CU (v, p, k, r). (cid:1) possible edges in U , and each is present with probability (cid:1), p). With probabilities for edge and r-core formation in hand, we can process. There are(cid:0)u b(eU ;(cid:0)u v,p(U ) is equal to k k CU (v, p, k, r) = b eU ; (1 − B(r − 1; eU , k/u)). (1) , p (cid:18) (cid:18)u (cid:19) (cid:19) k)(cid:88) (u eU =0 k 5 Figure 1: Predicted probabilities of local r-core formation where u = eu ≤ 50 and k = 3. The left plot shows the log probability of local 1-core formation using graph connectivity (green), the covering heuristic (orange), and the mean of 1M Monte Carlo trials per point (blue). The right plot shows the log probability of local 2-core formation using the upper and lower connectivity bounds (blue and orange) as well as the covering heuristic (green). 4 Evaluation In this section we empirically investigate the accuracy of the local and global bounds provided in previous sections. Although the bounds we have presented apply to global r-core formation for any r ≥ 2, our experiments focus exclusively on the case where r = 2. Overall, the connectivity bound on local 1-core formation is demonstrated to closely match actual probabilities generated via Monte Carlo (MC) trials. And as a result, compared to MC, it provides good upper and lower bounds on global 2-core formation by way of Algorithm 1 and Theorem 2. Unfortunately, this bound also becomes numerically unstable as v, the number of vertices in Hk v,p, grows. For larger values of v, we show empirically that the covering heuristic can be used to gain a very good approximation to the probability of 2-core formation, even though it does not always provide a strict upper bound. 4.1 Local r-core probabilities We first evaluate various techniques for computing C¯u(v, p, k, r), the probability that an r-core forms on a specific set of u vertices in Hk v,p. Figure 1 (left) shows the probability of local 1-core formation in 3-uniform hypergraphs with core size u varying from 1 to 50 and having eu = u expected edges in any set of u vertices. The blue curve shows the result of 1M MC trials per point, which we generated by creating random hypergraphs and testing for the presence of a 1-core. The green curve shows the same probability as determined by Theorem 3, which we call the connectivity approach. Finally, the orange curve gives an estimate of 1-core probability using the covering heuristic defined by Equation 1. For all values eu ∈ [1, 50], the connectivity calculation of 1-core probability 6 1020304050Edge count107106105104103102101Log ProbabilityMCPoissonconnectivity1020304050Edge count1016101410121010108106104102Log ProbabilityhighlowPoisson Figure 2: Bounds on global r-core formation. The left set of plots show the probability of global 2-core formation over 3-uniform hypergraphs (i.e. k = 3) using graph connectivity (green), the covering heuristic (orange), and the mean of 100 Monte Carlo trials per point (blue). The right set of plots shows the same curves for probability of 2-core formation over 4-uniform hypergraphs (i.e. k = 4). closely match that of the MC trials. In contrast, the covering heuristic provides a much less accurate value for 1-core probability when eu is small. However, as eu approaches 50, the heuristic becomes much tighter. Not shown in the plots is the numerical breakdown of the connectivity approach. For example, when eu = 200, MC trials indicate that the probability that a 1-core forms is 1.9e-4. The connectivity approach predicts -1.84e+23, and the covering heuristic predicts a probability of 2.2e-4. Thus for large values of eu, the connectivity approach breaks down entirely, while the covering heuristic maintains a reasonable estimate. As we will in Section 4.2, the numerical instability of the connectivity calculation propagates to global r-core bounds provided by Theorem 2. Figure 1 (right) gives probabilities of local 2-core formation in 3-uniform hypergraphs, where again, core size u varies from 1 to 50 and there are eu = u edges expected in each subset of u vertices. Here we see upper and lower bounds provided by Theorem 2 shown in the blue and orange curves, respectively. The green curve shows an estimate of 2-core probability using the covering heuristic defined by Equation 1. Overall, the upper and lower bounds are initially close, but diverge significantly for eu close to 20, and then gradually begin to converge again for larger eu. The covering heuristic initially provides an upper bound on 2-core probability, but for eu > 30, it settles somewhat below the upper bound. 4.2 Bounding global r-core probabilities We next evaluate our bound on C(v, p, k, r), the probability that at least one r-core forms somewhere in Hk v,p. Figure 2 shows the probability of 2-core formation anywhere in a 3-uniform (left) or 4-uniform (right) hypergraph. Here we vary the total number of vertices in the hypergraph v and the expected number of edges ev (both along the independent axis) as well as overhead, which is the ratio of vertices to edges (a 7 Edge Count0.00.51.0Probabilityk=3, overhead=1.00Edge CountProbabilityk=3, overhead=1.202040Edge Count0.00.51.0Probabilityk=3, overhead=1.402040Edge CountProbabilityk=3, overhead=1.60Edge Count0.00.51.0Probabilityk=4, overhead=1.40Edge CountProbabilityk=4, overhead=1.602040Edge Count0.00.51.0Probabilityk=4, overhead=1.802040Edge CountProbabilityk=4, overhead=2.00 Figure 3: Heuristic assessment of global r-core formation. The left set of plots show the log probability of global 2-core formation over 3-uniform hypergraphs (i.e. k = 3) using the Poisson covering heuristic (red), and the mean of 800 Monte Carlo trials per point (blue). The right set of plots shows the same curves for log probability of 2-core formation over 4-uniform hypergraphs (i.e. k = 4). distinct value for each facet). In particular, if the overhead is x in a given facet, then ev varies from k up to 60 along the independent axis and v = xev. The blue curve shows the mean of 100 MC trials per point, while the red and green curves show upper and lower bounds, respectively, using Theorem 3 along with Theorem 2. Breaks in the bounds occur after the value ev where numerical failure is detected; because probability is typically (though perhaps not necessarily) non-increasing with vertex count, and v is a function of ev, we assume numerical breakdown when the probability begins to increase with ev. There are several notable trends in the plots. First, the bounds become tighter as both ev and the overhead increase (i.e. as v grows large relative to ev). When k = 3 and overhead is 1.6, we see that the upper bound drops very close to the MC curve as ev increases. Similarly, for k = 4 and overhead equal to 2.0, the MC curve falls closely in-line with the lower bound as ev grows. Second, numerical instability also appears to increase with overhead. Although some instability is apparent in nearly all plots, it occurs for lower and lower values of ev as the overhead increases. 4.2.1 Approximate solution Due to the numerical breakdown of the connectivity approach, we also explore an approximation to C(v, p, k, r) that uses the covering heuristic along with Theorem 2. Figure 3 shows the probability of 2-core formation anywhere in a 3-uniform (left) or 4-uniform (right) hypergraph. Again, we vary the total number of vertices in the hypergraph v and the expected number of edges ev (both along the independent axis) as well as overhead (a distinct value for each facet). The blue curve shows the mean of 800 MC trials per point. The red curve shows the approximation. From the plots we see two major trends. First, the approximation appears to 8 Edge Count103101Log Probabilityk=3, overhead=1.00Edge CountLog Probabilityk=3, overhead=1.20050100150Edge Count103101Log Probabilityk=3, overhead=1.40050100150Edge CountLog Probabilityk=3, overhead=1.60Edge Count103102101100Log Probabilityk=4, overhead=1.40Edge CountLog Probabilityk=4, overhead=1.50050100150Edge Count103102101100Log Probabilityk=4, overhead=1.60050100150Edge CountLog Probabilityk=4, overhead=1.70 remain above the actual probability when ev is small, at some point crosses below the probability, and then remains below as ev continues to increase. Second, the tendency for the approximation to remain above the actual probability appears to increase with k. Not shown in the plot are the values for MC and approximate probability when k = 3, ev = 500, overhead was 1.6, which were 1.67e-3 and 6.28e-9, respectively. Therefore, it appears that the relative difference between actual and approximate probabilities widens considerably as ev increases. 5 Conclusion We have presented an algorithm for computing the exact probability that a single r-core forms in a k-regular hypergraph. It can be easily extended to provide an upper bound on the probability that at least one r-core forms in the hypergraph. The algorithm requires a subroutine that calculates the probability that a 1-core forms in the induced hypergraph on any given subset of vertices. To that end, we also presented two methods for calculating local 1-core probability. The first method is an exact solution that uses hypergraph connectivity. We prove that this connectivity approach can be used to produce upper and lower bounds on the probability of global r-core formation. The second method is an approximation that uses a covering heuristic. The exact solution is shown experimentally to break down numerically for modestly large numbers of vertices (30-50, depending on other parameters). The approximation remains numerically stable and is reasonably accurate for hypergraphs with fewer than 100 vertices; but it is not reliable as either an upper or lower bound. References [1] Gilbert, E. N. Random Graphs. In The Annals of Mathematical Statistics (1959), vol. 30, pp. 1141 -- 1144. [2] Goodrich, M., and Mitzenmacher, M. Invertible bloom lookup tables. In 49th Annual Allerton Conference on Communication, Control, and Computing (Sept 2011), pp. 792 -- 799. [3] Molloy, M. The pure literal rule threshold and cores in random hypergraphs. In Proceedings of the Fifteenth Annual ACM-SIAM Symposium on Discrete Algorithms (Philadelphia, PA, USA, 2004), SODA '04, Society for Industrial and Applied Mathematics, pp. 672 -- 681. 9 A Notation order of hypergraph core number of hypergraph vertices expected number of hypergraph edges number of vertices per edge the probability that any given edge forms in the hypergraph probability mass function of the distribution Binomial[n, p] r v e k p b(x; n, p) B(x; n, p) CDF of the distribution Binomial[n, p] Hk v,p Hk v,p(U ) I k v,p C(v, p, k, r) C∗(v, p, k, r) Cu(v, p, k, r) C¯u(v, p, k, r) CU (v, p, k, r) C∗ U (v, p, k, r) CU (v, p, k, r) Poisson formula approximating CU (v, p, k, r) a k-uniform hypergraph with v vertices and edge probability p the induced hypergraph on vertices U a k-uniform interleaved hypergraph with v vertices and edge probability p probability that one or more r-cores form anywhere in Hk probability that exactly one r-core forms anywhere in Hk probability that an r-core of size u forms anywhere in Hk probability that an r-core forms on a specific set of u vertices in Hk v,p on vertices U ⊆ V probability that an r-core forms in Hk probability that an r-core forms on vertices U ⊆ V in hypergraph I k probability that certain u vertices are connected in Hk probability there exists at least one component on i vertices in Hk number of possible edges connecting vertex sets of size i and u − i in Hk f k p (u) f k p (u, i) εk(u, i) v,p v,p v,p v,p v,p v,p u,p v,p 10 B General Algorithm v,p k 2: 3: (cid:1) 4: 5: 6: 7: Algorithm 1 Probability exactly one r-core forms somewhere in Hk 1: procedure C∗(v, p, k, r) ProbMap = {} for v(cid:48) ∈ {k, . . . , v} do ProbMap[v(cid:48)] = {} ProbMap[v(cid:48)][v(cid:48)] = C¯v(cid:48)(v(cid:48), p, k, r) for c ∈ {v(cid:48), . . . , k} do n(cid:48) = p(cid:0)v(cid:48) ProbGlobalMap[v(cid:48)][c] =(cid:0)m(cid:48) (cid:16) ProbGlobalMap[v(cid:48)][c] ∗= C¯c(c, p, k, r) for x ∈ {c + 1, v(cid:48)} do ProbNoCore = pow ProbGlobalMap[v(cid:48)][c] ∗= ProbNoCore (cid:46) loop in reverse order (cid:46) number of subsets of size c (cid:1) (cid:1)(cid:17) 1 − ProbGlobalMap[v(cid:48)][x],(cid:0)v(cid:48)−c (cid:46) r-core not subset of any others c x−c if v(cid:48) − c > k then Prob = 0 for i ∈ {} do (cid:46) exist no other r-cores (cid:46) add up entries 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: Prob += ProbGlobalMap[x][i] ProbGlobalMap[v(cid:48)][c] ∗= 1 − Prob FinalProb = 0 for i ∈ {} do FinalProb += ProbGlobalMap[v][i] return FinalProb 11
1812.04230
1
1812
2018-12-11T06:22:50
A Non-iterative Parallelizable Eigenbasis Algorithm for Johnson Graphs
[ "cs.DS" ]
We present a new $O(k^2 \binom{n}{k}^2)$ method for generating an orthogonal basis of eigenvectors for the Johnson graph $J(n,k)$. Unlike standard methods for computing a full eigenbasis of sparse symmetric matrices, the algorithm presented here is non-iterative, and produces exact results under an infinite-precision computation model. In addition, our method is highly parallelizable; given access to unlimited parallel processors, the eigenbasis can be constructed in only $O(n)$ time given n and k. We also present an algorithm for computing projections onto the eigenspaces of $J(n,k)$ in parallel time $O(n)$.
cs.DS
cs
A Non-iterative Parallelizable Eigenbasis Algorithm for Johnson Graphs Jackson Abascal∗ [email protected] Amadou Bah† [email protected] Mario Banuelos‡ [email protected] David Uminsky§ Olivia Vasquez¶ [email protected] [email protected] December 12, 2018. Abstract We present a new O(cid:16)k2(cid:0)n k(cid:1)2(cid:17) method for generating an orthogonal basis of eigenvectors for the Johnson graph J(n, k). Unlike standard methods for computing a full eigenbasis of sparse symmetric matrices, the algorithm presented here is non-iterative, and produces exact results under an infinite-precision computation model. In addition, our method is highly parallelizable; given access to unlimited parallel processors, the eigenbasis can be constructed in only O(n) time given n and k. We also present an algorithm for computing projections onto the eigenspaces of J(n, k) in parallel time O(n). Keywords: algorithms, combinatorics, algebraic signal processing, fourier analysis. ∗Department of Computer Science and Mathematics, University of Rochester, Rochester NY, 14627 †Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, Cambridge MA, 98926 ‡Department of Mathematics, California State University, Fresno, Fresno CA, 93740 §University of San Francisco, San Francisco CA, 94117 ¶Department of Mathematics, Central Washington University, Ellensburg WA, 98926 1 1 Introduction The Johnson graph J(n, k) has the k-element subsets of {1, . . . , n} as vertices. There is an edge between two subsets S and T exactly when S ∩ T = k − 1. In this work, we present an efficient and highly parallelizable algorithm which computes the orthogonal eigenbasis, as described in [7], in time O(cid:16)k2(cid:0)n k(cid:1)2(cid:17). Most known eigenvector methods to date are iterative, and result only in numerical solutions [13]. The eigenspaces of Johnson graphs have a number of remarkable combinatorial properties, and have found many uses both in pure and applied mathematics. Spectral analysis, a technique pioneered by Diaconis in [4], is a method of analyzing data modeled on a set X with a natural group action G → Aut(X). Let the unitary representation ρ be the extension of this action from G to the free vector space on X with coefficients in C. Then ρ can be broken into a direct sum of irreducible representations, and each f : X → C can be decomposed as the set of isotypic projections of f onto the irreducible components. The Johnson graph becomes important when X is the k-element subsets of {1, . . . , n} and G is the symmetric group, where σ ∈ Sn sends S = {s1, s2, . . . , sk} to σS = {σs1, σs2, . . . , σs3}. In this case, the isotypic components are exactly the eigenspaces of J(n, k) [12]. This technique was used by Uminsky and Orrison to analyze voting coalitions in the United States Supreme court in [14], [11], and by Diaconis in [5] for analyzing voting data from the American Psychological Association. Maslen, Orrison, and Rockmore present an efficient method for projection of a vector onto eigenspaces of real symmetric matrices in [9] using Lanzcos iteration. Other efficient methods for computing such projections have been developed by [6], [10], and [8]. All of these methods focus exclusively on the projection of a given vector without considering the computation of an eigenbasis. The Johnson graph also has important ties to coding theory due to its close relation to the Johnson association scheme. A more detailed account of how the Johnson scheme can be used in error correcting codes can be found in [2]. In [7], Filmus gives an explicit description of an orthogonal eigenbasis for the eigenspaces of Johnson graphs. Filmus doesn't consider the algorithmic complexity of his formula, however a naive implementation does not lend to any efficient algorithm. For J(n, k), we are led to evaluate j In this work, we derive an alternative constructive description of the same eigenbasis from Filmus's work, leading to an efficient algorithm for generating the eigenbasis. Our algorithm runs in serial time O(k2(cid:0)n k(cid:1)2), but leads to a highly parallelizable version which can generate an orthogonal eigenbasis and perform projections onto the eigenbasis in parallel time O(n), assuming an unbounded number of processors. 2 An Orthogonal Basis for Johnson Matrices We begin with some preliminary definitions, which closely follow the terminology of [7]. Let [n] denote the set {1, . . . , n}. Let Sn,d be the set of sequences of distinct elements in [n] with length d. Definition 2.1. For two sequences A and B in Sn,d, we say that A ≺ B if (1) the i-th element of A is less than the i-th element of B, and (2) A and B share no elements. Note that ≺ is a partial order on Sn,d. Definition 2.2. A sequence B ∈ Sn,d is a top set if it is increasing, and there exists some A such that A ≺ B. 1 Let Bn,d be the set of all top sets in Sn,d. For any A ≺ B in Sn,d, define the multivariate polynomial d where Ai and Bi are the i-th elements of A and B, respectively. Now define χA,B(x1, . . . , xn) = (xAi − xBi) Yi=1 χA,B. χB = XA≺B k(cid:1) be the set of (x1, . . . , xn) ∈ {0, 1}n such thatPn i=1 xi = k. Each column of the adjacency matrix of J(n, k) is labeled with a subset S, but we could instead and let Yn,d = {χB : B ∈ Bn,d}. Let(cid:0)[n] label it with the corresponding element (x1, . . . , xn) in (cid:0)[n] There are k +1 eigenspaces of J(n, k), with eigenvalues (k −d)(n−k −d)−d for d ∈ {0, 1, . . . , k}. These eigenspaces are mutually orthogonal [3]. Let Md be the space of vectors with eigenvalue (k − d)(n − k − d) − d. To construct an orthogonal basis for Md, we construct a basis eigenvector for each χ ∈ Yn,d. Given such a χ, there is an eigenvector whose entry associated with column (x1, . . . , xn) ∈ Yn,d is equal to χ(x1, . . . , xn). We can compute this by setting the eigenvector k(cid:1) where xi = 1 if and only if i ∈ S. coefficient in the column associated with (x1, . . . , xn) ∈(cid:0)[n] k(cid:1) to χ(x1, . . . , xn). 2.1 Example for J(4,2) Suppose we want to compute a set of eigenvectors that form an orthogonal basis for M1 in J(4, 2). We begin by constructing(cid:0)[4] 2(cid:1) = {(1, 1, 0, 0), (1, 0, 1, 0), (1, 0, 0, 1), . . . }. To find a basis of this space we need to find Y4,1. Now B4,1 = {{2}, {3}, {4}}. Thus: • For B = {2}, A can only be {1}. • For B = {3}, A can be {1} or {2}. • For B = {4}, A can be {1}, {2}, or {3}. We can now write each χB for B ∈ B4,2 as function of x1, x2, x3, and x4: • χ{1} = (x1 − x2). • χ{2} = (x1 − x3) + (x2 − x3). • χ{3} = (x1 − x4) + (x2 − x4) + (x3 − x4). Evaluating χB for each B at all entries in (cid:0)[4] to an eigenvector and together the rows form a basis for M1. 2(cid:1) produces Table 1, where each row corresponds 2.2 Coefficients of χB Definition 2.3. Let f (x1, . . . , xn) be a polynomial, and S = {s1, . . . , sk} ⊆ [n]. We define Cf (S) as the coefficient of xs1 · · · xsk in f . 2 1100 1010 1001 χ{1} χ{2} χ{3} 0 2 2 1 −1 2 1 1 −2 0110 −1 −1 2 0101 −1 1 −2 0011 0 −2 −2 Table 1: The eigenbasis of M1 for the J(4, 2). Theorem 1. Let S ∈ [n] be of size k. For i ∈ [n], if i ∈ S, let xi = 1 and let xi = 0 otherwise. Let B be a top set of size d ≤ k. Then χB(x1, . . . , xn) = XT ⊆S T =d CχB (T ). Proof. Recall that χB is multilinear and homogeneous of degree d. Let T = {t1, . . . , td} ⊆ [n]. If xti = 0 for any ti ∈ T , then the monomial xt1 · · · xtk will be evaluated to zero on inputs x1, . . . , xn. If the monomial is not evaluated to zero, then xti = 1 for all i, and thus each ti ∈ S. So T ⊆ S. Since nonzero xi are 1, it follows that χB(x1, . . . , xn) is exactly the sum of all coefficients whose monomial is nonzero on inputs x1, . . . , xn, which are exactly CχB (T ) for all size d subsets T of S. Corollary 1. Let S ⊆ [n] be of size k. For i ∈ [n] let xi = 1 if i ∈ S, and xi = 0 otherwise. Let B be a top set of size k. Then χB(x1, . . . , xn) is the coefficient of the monomial in χB with variables indexed by S. Proof. Since χB is multilinear and homogeneous of degree k, it follows that the only monomial which evaluates to a nonzero number is the monomial indexed by elements in S. Furthermore, since the variables indexed by elements in S are evaluated at 1, χB(x1, . . . , xn) is simply the coefficient of the monomial with variables indexed by S. Definition 2.4. Let U be a set of length k and let V be a sequence of length k. Define U − V as the elements in U not in V , and U ∩ V as the elements in both U and V . Theorem 2. Let B be a top set of size d. Let S = {s1, . . . , sd} be a subset of [n]. Then CχB (S) is equal to (−1)S∩B multiplied by the number of A ≺ B such that CχA,B (A) 6= 0. Proof. Suppose CχA,B (A) is nonzero. Recall that χA,B = (xA1 − xB1)(xA2 − xB2) · · · (xAd − xBd). Any monomial in χA,B must be of the form xt1 · · · xtd where ti is in {Ai, Bi}. Let T = {t1, . . . , td}. The coefficient of this monomial is a product over 1 ≤ i ≤ d of the coefficient of xti in xAi − xBi, and in particular is equal to 1T ∩A(−1)T ∩B. Since T must be a permutation of S for xt1 · · · xtd to equal xs1 · · · xsd, it follows that T ∩ B = S ∩ B, and so CχA,B (S) = (−1)S∩B. Thus for all A ≺ B, it follows that CχA,B (S) is either 0, or (−1)S∩B. Combined with the fact that we obtain the desired result. CχB (S) = XA≺B CχA,B (S), 3 Theorem 3. Let B be a top set of size k. Let S = {s1, . . . , sk} be a subset of [n]. Let A ≺ B. Then CχA,B (S) 6= 0 if and only if (1) S − B ⊆ A and (2) there is no pair α ∈ S − B and β ∈ S ∩ B such that the index of α in A equals the index of β in B. Proof. Suppose CχA,B (S) 6= 0. Then each si must appear in either A or B, since otherwise xsi would appear nowhere in χA,B. Thus if si /∈ B, it must be in A, proving condition (1). Suppose that there is some pair α ∈ S − B and β ∈ S ∩ B, where the index of α in A is j and the index i=1,i6=j(xAi − xBi). Now P contains neither xα nor xβ, since all elements of A and B are distinct from each other. Then, neither xαP (x1, . . . , xn) nor xβP (x1, . . . , xn) contain a term with both xα and xβ, and so neither can their sum χA,B. This proves condition (2). of β in B is j. Then χA,B = (xα − xβ)P (x1, . . . , xn) where P (x) = Qd Now instead suppose that conditions (1) and (2) hold. There are d different factors (xAi − xBi) which divide χB. Since all d elements of S must appear as Ai or Bi for some i, and by condition (2) no two elements of S can appear as Ai and Bi for the exact same i, it follows that for each i exactly one of Ai and Bi is in S. Thus by expanding χB into monomials, we see that xs1 · · · xsk has a nonzero coefficient. Theorem 4. For a top set Bn,d = {b1, b2, . . . , bd} there are (b1 − 1)(b2 − 3)(b3 − 5) · · · (bd − 2d + 1) sequences A ∈ Sn,d such that A ≺ B. Proof. We prove the statement by induction. For d = 1, there are b1 − 1 numbers in [n] less than b1. For d > 0, we choose one of (b1 − 1)(b2 − 3) · · · (bd−1 − 2(d − 1) + 1) possibilities for the first d − 1 elements of A. The last element can by any of the bd − 1 elements in [n] which are less than bd and not one of the 2(d − 1) elements previously chosen for A or taken by B. Thus we can choose any of bd − 1 − 2(d − 1) = bd − 2d + 1 options for it, yielding our formula when multiplied by the number of ways to chose the first d − 1 elements. We have proven that the magnitude and sign of the coefficients for χB can be derived by the coefficients of monomials for χA,B. We have also provided formulas for calculating χB when B = k. We will use these theorems in the following algorithm to generate coefficients of χB in the construction of the eigenvectors. 3 Our Algorithm Next we describe an algorithm for generating an orthogonal eigenbasis, along with a procedure for projecting a vector onto each Mi for 0 ≤ i ≤ d. This significantly reduces runtime and will prime us for calculating each fi by projecting f onto each Mi. In order to project f we describe a method of computing eigenvectors which uses the linear mapping defined in Theorem 1. Consider a top set B of length d and a subset S ⊆ [n] of size d. Let s1 < s2 < · · · < sd be the elements of S. The procedure described in Algorithm 1 allows one to extract the coefficient of xs1 · · · xsd in χB. 4 Algorithm 1 Extract coefficient of xs1 · · · xsd in χB. 1: procedure ExtractCoefficient(B, S) 2: i ← 1 j ← 0 answer ← 1 while i ≤ d do 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: if j < d and Bi = sj+1 then answer ← answer · (i + j − Bi) i ← i + 1 j ← j + 1 else if j = d or Bi < sj then answer ← answer · (j − i + 1) i ← i + 1 else j ← j + 1 end if end while return answer 17: 18: end procedure 3.1 Proof of Correctness Theorem 5. Let ℓ(b) be the number of si ∈ S which are less than b. Then CχB (S) = Qd where Wi = Bi − i − ℓ(Bi) if Bi ∈ S and Wi = ℓ(Bi) − i + 1 otherwise. i=1 Wi Proof. By Theorem 3, CχB (S) is the number of A ≺ B such that (1) S − B ⊆ A and (2) there is no pair α ∈ S − B and β ∈ S ∩ B such that the index of α in A equals the index of β in B. We will walk through a process with steps 1, 2, . . . , d for constructing such an A where these conditions hold. At step i, we fix a value for the i-th element in A. If Bi is in S, then Ai must satisfy all of these conditions I. Ai < Bi II. Ai /∈ S III. Ai /∈ B IV. Ai 6= Aj for any j < i. There are Bi − 1 elements initially satisfying the first condition. We then subtract out the ℓ(Bi) elements which do not satisfy the second condition. Let w be the number of elements in B which are less than Bi and not in S ∩ B. Then we subtract off the w elements remaining which do not satisfy the third condition. Finally, there are i − 1 − w elements remaining which are in A, but not in S. In total there are (Bi − 1) − ℓ(Bi) − (w) − (i − 1 − w) = Bi − i − ℓ(i) choices for Ai. Now suppose that Bi is not in S. Then Ai must be in S, must be less than Bi, and must not be in B. Thus, there are ℓ(Bi) − (i − 1) = ℓ(Bi) − i + 1 possible choices in this case. This proves the theorem. 5 Algorithm 1 uses a two-pointers method to iterate over all elements in B ∩ S in order from least to greatest. At the start of each iteration of the while loop, j = ℓ(Bi). When an element Bi in B ∩ S is iterated over, we multiply answer by i + ℓ(Bi) − Bi = −(Bi − i − ℓ(Bi)). Multiplying by this factor accounts for both the combinatorial change in number of satisfying sets A, as well as the sign change incurred by increasing the size of B ∩ S by one. When an element in Bi in B − S is iterated over, we multiply answer by ℓ(Bi) − i + 1. At the end of the algorithm, we have that answer = (−1)B∩S d Yi Wi = (−1)B∩SCχB (S) = CχB (S) by Theorem 2. This proves correctness of the algorithm. 3.2 Enumerating Top Sets Let k Bn,k = Bn,d. [i=d In this section, we detail generation of Bn,k using a recursive method, where every recursive call corresponds to a single element of Bn,k. The generation algorithm is described below. We use Append(L, x) to denote the appending of item x to the list L. Algorithm 2 Recursively generate all of Bn,k 1: procedure GenerateB(B, v, n, k) 2: Print(B) if B = k then return end if b ← min{x ∈ [n] : ∀i ∈ [d], x > Bi}. if v = 0 then b = b + 1 end if while b ≤ n do q ← 0 if B > 0 then q ← BB end if GenerateB(Append(B, b), b − q − 2) b ← b + 1 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: end while 16: 17: end procedure We now prove correctness of the algorithm. Theorem 6. In GenerateB, at all times v = q(B) − 2B, where q(B) = {x ∈ [n] : x ≤ b for some b ∈ B} 6 Proof. The length of B is only zero in the base call of the recursion, so trivially v = q(∅) = 0 if B = 0. When we append a value on the end of B to make a new sequence B′, then v′ must equal q(B′) − 2B′. Thus v′ − v = q(B′) − 2(B + 1) − (q(B) − 2B) = q(B′) − q(B) − 2. To complete the proof, note that q(B) = BB when B 6= 0. The variable b is always larger than the largest value in B, thus when it is appended q(Append(B, b)) = b. This corresponds directly to the value of v passed into GenerateB on line 14. Theorem 7. GenerateB(∅, 0, n, k,) enumerates all top sets in Bn,k. Proof. We prove inductively that all B ∈ Bn,d are printed in calls to GenerateB of recursion depth d exactly once (where the base call has recursion depth 0), and no other sets are printed. When d = 0, the single base call at recursion depth 0 prints the null sequence, the single top set of length 0. Now let d > 0 and suppose all elements in Bn,d−1 are printed exactly once in calls of recursion depth d − 1. Choose any B′ ∈ Bn,d. Calls of depth d can only print sequences of length d, since with each recursive call one element is appended to the end of the B variable. As the B variable is only appended to and never changed during the recursion, if B′ is printed it must be printed from a call whose B variable is the prefix of B′ excluding only the last element. In the loop making recursive calls to GenerateB, the variable b is different each time. Thus B′ cannot be printed more than once. We now prove that B′ is printed at least once. Let B be the prefix of B′ excluding only the last element, and let b be the new element added. If appending b to B creates a new top set in Bn,d, then so does appending b + 1 as long as b + 1 ≤ n, since any A ≺ Append(B, b) also satisfies A ≺ Append(B, b + 1). Therefore in order to call GenerateB on all top sets, we need find the smallest b such that Append(B, b) is a top set. Clearly b is larger than the all elements in B, and this is guaranteed on line 5. For Append(B, b) to be a top set it must be the true that b − 2(B + 1) ≥ 0. If some A ≺ Append(B, b) then the total elements in A and Append(B, b) combined is 2(B + 1), and all of these elements are at most b. Given B is a top set, we can always construct some sequence A ≺ Append(B, b) by extending any sequence ≺ B with any of the b − 2(B + 1) − 1 elements not in A or B′ so far. This proves correctness of the generation algorithm. All operations except Print, and the loop take constant time, and all operations within the loops except GenerateB take constant time as well. All loop iterations fix a valid element of (at least) one valid top set, so the runtime to generate all of Bn,k is absorbed into the runtime of any processing we might perform which looks at all entries of all elements in Bn,k. Since all algorithms presented in this paper do so, we ignore the runtime contribution of generating coefficients for the remainder of the paper. 3.3 Extracting Eigenvectors We now have a fast procedure for calculating each χB. All that remains is to describe a compu- tational procedure for extracting the eigenvector associated to a given χB. To do this, we use the formula given in Theorem 1. It takes O(cid:0)k(cid:0)n k(cid:1)(cid:1) time to generate all coefficients of χB. Naively 7 k(cid:1)(cid:0)k applying the linear transformation to some χB where B = d takes time O((cid:0)n d(cid:1)). Thus, the algorithm takes order k Xd=0(cid:18)(cid:18)n d(cid:19) −(cid:18) n d − 1(cid:19)(cid:19)(cid:18)(cid:18)n k(cid:19)(cid:18)k d(cid:19) +(cid:18)n d(cid:19)d(cid:19) time. At a slight cost to parallelizability, we can reduce the sequential runtime further. Let La,b with a < b denote the linear transformation from R([n] Then we would like to apply the transformation Ld,k, and to do so we will apply Li,i+1 for every d ≤ i < k in sequence and scale the result. Note that Lj−1,jLi,j−1 = (j − i)L(j, i), since there are j − i ways to choose an intermediate subset of size j − 1 between any size j subset and some size i subset of it. Thus, the value at each subset is counted j − i times in Lj−1,jLi,j−1. We may use this recurrence to compute Ld,k in total time b ) defined by L(f )S =PT ⊂S,T =a fT . a ) to R([n] This brings the runtime of the algorithm to k Xr=d+1 r(cid:18)n r(cid:19). k Xd=0(cid:18)(cid:18)n d(cid:19) −(cid:18) n d − 1(cid:19)(cid:19) k Xr=d+1 r(cid:18)n r(cid:19) ≤ k k d − 1(cid:19)(cid:19) r(cid:18)n r(cid:19) d(cid:19) −(cid:18) n d − 1(cid:19)(cid:19) k = Xr=d(cid:18)(cid:18)n d(cid:19) −(cid:18) n Xd=0 r(cid:19) r Xd=0(cid:18)(cid:18)n r(cid:18)n Xr=0 r(cid:19)2 r(cid:18)n Xr=0 k(cid:19)2 ≤ k2(cid:18)n = k . in total. 3.4 Projecting onto Subspaces Fix n, k ≤ n/2, and d ≤ k. Let f ∈ R(n k). We will describe a computational procedure for projecting f onto the subspace Md. To project f onto Md, it suffices to project onto an orthogonal set of basis vectors for Md and sum the projections [14]. Let cB be a vector containing all the coefficients of χB. Let eB be the eigenvector associated with B, namely containing the results of evaluating χB(x0, . . . , xn−1) at all x0, . . . , xn−1 where exactly k values of xi are 1 and the remaining are 0. In Theorem 1, it is proven that the map cB 7→ eB is a linear transformation L. Recall that for B ∈ Bn,d, the set of eB forms an orthogonal basis for Md. Let fd be the projection of f onto Md. 8 Then fd = XB∈Bn,d = XB∈Bn,d = XB∈Bn,d = L XB∈Bn,d proj(f, eB) f T eB keBk2 eB f T LcB keBk2 LcB (f T L)cB keBk2 cB. A theorem of Filmus [7] gives an explicit formula for keBk2 under a different norm. However, the norm used by Filmus differs from the one used for Johnson Graphs by exactly a factor of (cid:0)n k(cid:1). Putting this information together, we obtain a formula keBk2 =(cid:18)n k(cid:19) d (bi − 2i + 2)(bi − 2i + 3)! kd(n − k)d Yi=1 n2d where eB is a vector containing all the coefficients of χB, eB is the eigenvector associated with B, and ab = a!/(a − b)!. In order to compute the projection fd, the following procedure suffices. First, compute f T L. Let v be the zero vector of dimension (cid:0)n Scale cB by (f T L)cB been iterated over, we have found fd = Lv. keB k2 , using our stored row vector for f T L. Then, add cB to v. Once all B have d(cid:1). Iterate over all B, and compute both cB and keBk2. 4 Computational Complexity 4.1 Runtime of Projection We now look at the runtime of computing fd. While more efficient numerical methods exist for projection onto each Md, the following method is both exact (non-numerical) and more efficient than k(cid:1)2) and performing projections. The linear transformation simply generating an eigenbasis in O(k2(cid:0)n k(cid:1) rows and (cid:0)n L can be represented as a matrix with (cid:0)n d(cid:1) columns. Each column contains exactly (cid:0)k d(cid:1) 1s, with the remaining entries being 0. Using sparse matrix multiplication methods, applying L d(cid:1) time, but as previously discussed, L may be computed in time Pk to a vector takes (cid:0)n k(cid:1)(cid:0)k r=d r(cid:0)n r(cid:1). d−1(cid:1) (where (cid:0) n The size of Bn,d is (cid:0)n d(cid:1) −(cid:0) n −1(cid:1) is defined to be 0), as it is exactly the dimension of Md [1]. For each such B, we compute all (cid:0)n d(cid:1) coefficients, which takes O(d) time each. It takes an keBk2 . Finally, we take the summation of all (f T L)cB order O(cid:0)(cid:0)n k(cid:1)(cid:0)k d(cid:1)(cid:1) time compute fd by applying L to it. Putting this information together, the total additional O(d) time to compute (f T L)cB runtime of computing fd is of order and in keB k2 k Xr=d r(cid:18)n r(cid:19) +(cid:20)(cid:18)n d(cid:19) −(cid:18) n d − 1(cid:19)(cid:21)(cid:18)n d(cid:19). 9 We now analyze the runtime of computing all such projections. Note that since f = f0 + f1 + · · · + fk−1 + fk, we need only explicitly compute fd for d < k to obtain fk by subtracting the other fd from f . Then the total runtime is of order k−1 Xd=0 k Xr=d r(cid:18)n r(cid:19) +(cid:20)(cid:18)n d(cid:19) −(cid:18) n d − 1(cid:19)(cid:21)(cid:18)n d(cid:19) = ≤ k−1 k Xd=0 Xr=0 k k−1 k−1 k−1 Xr=d Xd=0 r(cid:18)n r(cid:19) + Xd=0(cid:20)(cid:18)n d(cid:19) −(cid:18) n d − 1(cid:19)(cid:21)(cid:18)n d(cid:19)d r(cid:18)n r(cid:19) + Xd=0(cid:20)(cid:18)n d(cid:19) −(cid:18) n d − 1(cid:19)(cid:21)(cid:18)n d(cid:19)d Xd=0(cid:20)(cid:18)n r(cid:18)n d(cid:19) −(cid:18) n r(cid:19) + d − 1(cid:19)(cid:21)(cid:18)n d(cid:19)d Xr=0 k(cid:19) +(cid:18) n k − 1(cid:19)k(cid:20)(cid:18) n k − 1(cid:19) −(cid:18) n −1(cid:19)(cid:21) k − 1(cid:19)2 k(cid:19) +(cid:18) n k−1 k. k ≤ (k − 1) ≤ k3(cid:18)n ≤ k3(cid:18)n 4.2 Comparison of Runtime with Filmus's Construction We will show that a naive implementation of Filmus's description the eigenbasis, described in Section 2, has worse complexity than the algorithm presented in this paper. We do so by finding a lower bound L(n, k) for the runtime of Filmus's formula, and showing the asymptotic bound L(n,k) = Ω((3/2)k/k). The bounds presented here are very loose, and in practice the difference k2(n k) between our algorithm and Filmus's is even greater. We start by proving a useful technical lemma. We use the notation x!! to denote the double factorial, defined as x!! = ⌈x/2−1⌉ Yi=0 (n − 2i). Lemma 1. Let S ⊆ [n] be of size 2k. Then there are exactly (2k − 1)!! pairs (A, B) such that A ≺ B, B ∈ Bn,k, and S is the collection of all elements in either A or B. Proof. We prove the statement by induction on S. Let C(k) be the number of pairs (A, B) such that A ≺ B, B ∈ Bn,k, and S is the collection of all elements in either A or B. For k = 1, the lemma says C(1) = 1, which is true since S = 2 and the larger element of S must be in B while the smaller element must be in A. Now let S = 2k where k > 1. Let s ∈ S be the largest element in S. If s = Ai for some i, then Bi > s, but Bi ∈ S contradicts the maximality of s. If s = Bi for some i < k, then Bk > Bi = s, but Bk ∈ S contradicts the maximality of s. Therefore Bk = s. There are S − 1 = 2k − 1 choices for Ak at this point; take any of them. Regardless of our choice for Ak, we now must construct (A′, B′) out of the elements S − {Ak, Bk} such that A′ ≺ B′, then append Ak to A′ to obtain A and append Bk to B′ to obtain B. Note that any such choice is valid; we are guaranteed Bk > Bk−1 since Bk was maximal in S. Thus by induction, C(k) = (2k − 1)C(k − 1) = (2k − 1)(2k − 3)!! = (2k − 1)!!. Corollary 2. There are (cid:0) n 2k(cid:1)(2k − 1)!! pairs (A, B) with A ≺ B and B ∈ Bn,k. 10 Proof. There are (cid:0) n 2k(cid:1) subsets of [n] of size 2k. For each S ⊆ [n], Lemma 4.2 states that there are (2k − 1)!! pairs (A, B) with A ≺ B such that S is the collection of all elements in A and B. Each pair (A, B) with A ≺ B is associated to exactly one such set S. Summing (2k − 1)!! over all S, we obtain the desired result. We are now ready to obtain a lower bound for the runtime of a naive implementation of Filmus's formulas for an orthogonal eigenbasis of J(n, k). In order to use Filmus's formulas, we must evaluate attempting to find a lower bound, we may restrict B to be in Bn,k ⊂ Bn,k instead. Evaluating χA,B χA,B(x1, . . . , xn) over all (x1, . . . , xn) ∈(cid:0)[n] at (x1, . . . , xn) ∈ (cid:0)[n] χA,B as Qd which by Corollary 4.2 is equal to (cid:0) n k(cid:1), every B ∈ Bn,k, and every A ≺ B. Since we are only k(cid:1) takes at least Ω(k) time by looping through the product decomposition of k(cid:1) different inputs. The number of χA,B 2k(cid:1)(2k − 1)!!. Thus the runtime of the naive implementation is L(n, k) = k(cid:18)n i=1(Ai − Bi). Each χA,B must be evaluated at (cid:0)n that must be evaluated is equal to the number of pairs (A, B) such that A ≺ B and B ∈ Bn,k, 2k(cid:19)(2k − 1)!!. k(cid:19)(cid:18) n Ω(L(n, k)) where Recall that the complexity of our algorithm is O(cid:16)k2(cid:0)n k(cid:1)2 = Ω((3/2)k/k), k2(cid:0)n L(n, k) k(cid:1)2(cid:17). We show that proving that our algorithm has better asymptotics than a naive implementation of Filmus's formu- las. 1 2r + 1! L(n, k) = = k(2k)!(n − 2k)! k!(n − k)!(2k − 1)!! k(cid:1)2 = (cid:0) n 2k(cid:1)(2k − 1)!! k(cid:0)n k(cid:1) k2(cid:0)n n − k − r! k−1 k + 1 + r! k−1 k k−1 Yr=0 Yr=0 Yr=0 k k−1 ! Yr=0 k k−1 n/2 + 1 + r ! Yr=0 n/2 + 1 + r (cid:19)k k (cid:18) (n/2 − r)(2r + 1) (n − k − r)(2r + 1) (n/2 − r)(2r + 1) k + 1 + r ≥ = 1 1 1 1 = . n/2+1+r Define fn(r) = (n/2−r)(2r+1) n/2+1 ≥ 3 and fn(n/2 − 1) = n−1 n ≥ 1 x+y . If 0 < r < n/2 − 1, then x and y are both at least 2. The minimum value of xy x+y given x, y ≥ 2 is 2·2 2+2 = 1, since the derivative is positive at every coordinate. If 1 < r < n/2 − 2, then x and y are , and let n ≥ 8 and k ≥ 4. Note that for n ≥ 2, fn(0) = n/2 2 . Let x = n/2 − r and y = 2r + 1. Then we can write fn(r) = xy 11 at least 3, so fn(r) ≥ 9 6 = 3 2 by the same argument. Then we have 1 n/2 + 1 + r (cid:19)k k (cid:18) (n/2 − r)(2r + 1) ≥ 1 k · 3 · 1 2 · 1 · 1 ·(cid:18) 3 2(cid:19)k−4 = 3( 3 2 )k−4 2k . Since the asymptotics depend only on k, we also allow k ≤ 3, as it can be masked by the constant factor. This proves that a naive implementation of Filmus's algorithm takes almost exponentially longer in k than the algorithm presented in this paper. 4.3 Comparison with Iterative Algorithms We provide a non-iterative algorithm for calculating eigenvectors of the Johnson association scheme. Standard algorithms for calculating eigenvectors of both general and real symmetric matrices require iteration toward some degree of accuracy. As a result, the runtime of our algorithm is not directly comparable to traditional algorithms because we lack the additional component which specifies the degree of precision desired. We compare our runtime to the runtime for the power iteration. This algorithm is the 'state- of-the-art' method for computing eigenpairs for general matrices. For power iteration the runtime per step is O(n2) with a linear convergence rate [13]. This does not include the construction of the matrix, and only considers iterations from some initial guess for eigenvalues. 5 Parallelization The computation of the eigenbases for J(n, k) and the projection of f onto the subsequent eigenspaces is highly parallelizable. To demonstrate this, we provide a parallelized version of both computa- tions and analyze their runtime assuming an unbounded number of processors. We first consider the eigenbasis extraction algorithm for J(n, k). Theorem 8. An orthogonal eigenbasis for J(n, k) can be generated in O(n) time given unlimited parallel processors. Proof. Recall that each eigenvector is described by a top set B of length d for 0 ≤ d ≤ k. Modify Algorithm 2 so that each recursive call runs on a new processor. The sequential runtime is the largest amount of time it takes generate any specific B ∈ Bn,k. Suppose we are in the body of GenerateB printing a top set. We bound the amount of time it took to reach this point neglecting the time of recursive calls not currently on the stack, giving us our recursive runtime. Note that, tracing only these recursive calls leading us to our current state, the value of the variable b is always increasing. In fact, each iteration of the inner while loop implies b is increased by one, so in all, the inner loop is executed at most n times to reach B. There is O(k) overhead from the function calls and thus generating all of Bn,k takes O(n + k) = O(n) time in total. Once all B ∈ Bn,k are generated, we need to generate subsets labelling the coefficients of χB. This is possible to do with a recursive search procedure in O(n) time, where the search procedure passes down the current subset being built and a potential next element. Details are omitted. Once all subsets are generated, we run ExtractCoefficient(B, S) on every pair, taking time O(k). So far, we have taken O(n + n + k) = O(n) time to generate coefficients of all χB. All that remains is to compute the linear transformation L. We compute each eigenvector entry in parallel, so take O(n) time to generate all size k subsets for each B. The eigenvector entry associated with 12 S ⊂ n is a sum of the coefficients of χB associated to each size B subset of S. We can generate all subsets of S in parallel in O(S) = O(k) time, and sum the subsets of size B as the threads halt and return in O(k) time as well. This procedure halts in O(n) time with all eigenvectors generated. Theorem 9. Given f ∈ R(n unlimited parallel processors. k), one can compute proj(f, Md) for each 0 ≤ d ≤ k in O(n) time given Proof. We begin with the procedure described in Theorem 8, but modify it so that directly after computing each eigenvector eB, it also projects f onto eB. It takes O(n) time to find f ·eB eB eB, since dot products and scaling vectors takes O(log(cid:0)n generated via a recursive search, in which all top sets of length B are enumerated at recursion depth d by the proof of Theorem 3.2. Once projections onto each basis vector have been generated, the projections onto each subspace can be added together. Each vector entry can be added in parallel k(cid:1)) = O(log(2n)) = O(n) time. Recall that Bn,k is time O(log(cid:0)n O(n) time. k(cid:1)), and it takes O(log(cid:0)n k(cid:1)) to start all of these threads, so this final phase also takes 6 Acknowledgements This paper is dedicated to our advisors, Dr. David Uminsky and Dr. Mario Banuelos. The authors were supported in part by NSF Grant #DMS-1659138, NSA Grant #H98230-18-1-0008, and Sloan Grant #G-2017-9876. 13 References [1] Andries E Brouwer and Willem H Haemers. "Distance-regular graphs". In: Spectra of Graphs. Springer, 2012, pp. 177 -- 185. [2] P. Delsarte and V. I. Levenshtein. "Association Schemes and Coding Theory". In: IEEE Trans. Inf. Theor. 44.6 (Sept. 2006), pp. 2477 -- 2504. issn: 0018-9448. doi: 10.1109/18.720545. [3] Philippe Delsarte. "An algebraic approach to the association schemes of coding theory". In: Philips Res. Rep. Suppl. 10 (1973), pp. vi+ -- 97. [4] Persi Diaconis. "Group representations in probability and statistics". In: Lecture Notes: Monograph Series 11 (1988), pp. i -- 192. [5] Persi Diaconis. "A Generalization of Spectral Analysis with Application to Ranked Data". In: Ann. Statist. 17.3 (Sept. 1989), pp. 949 -- 979. doi: 10.1214/aos/1176347251. [6] Persi Diaconis. "Efficient Computation of Isotypic Projections for the Symmetric Group". In: (Mar. 1995). [7] Yuval Filmus. "An orthogonal basis for functions over a slice of the boolean hypercube". In: The Electronic Journal of Combinatorics 23.1 (2016), P1 -- 23. [8] Rodrigo Iglesias and Mauro Natale. "Complexity of the Fourier transform on the Johnson graph". In: arXiv preprint arXiv:1704.06299 (2017). [9] David Keith Maslen, Michael Orrison, and Daniel N. Rockmore. "Computing Isotypic Pro- jections with the Lanczos Iteration". In: 25 (Jan. 2003), pp. 784 -- 803. [10] Risi Kondor. "Non-commutative harmonic analysis in multi-object tracking". In: (2011). [11] Brian L Lawson, Michael E Orrison, and David T Uminsky. "Spectral analysis of the supreme court". In: Mathematics Magazine 79.5 (2006), pp. 340 -- 346. [12] Michael E Orrison. "An eigenspace approach to decomposing representations of finite groups". PhD thesis. Dartmouth College, 2001. [13] Gilbert Strang. Linear Algebra and its Applications. Thompson Brooks/Cole, 2006. [14] David Thomas Uminsky. "Generalized spectral analysis on large sets of approval voting data". In: Senior Thesis, Harvey Mudd College (2003). 14
1802.02744
1
1802
2018-02-08T08:23:39
Minimizing Latency in Online Ride and Delivery Services
[ "cs.DS" ]
Motivated by the popularity of online ride and delivery services, we study natural variants of classical multi-vehicle minimum latency problems where the objective is to route a set of vehicles located at depots to serve request located on a metric space so as to minimize the total latency. In this paper, we consider point-to-point requests that come with source-destination pairs and release-time constraints that restrict when each request can be served. The point-to-point requests and release-time constraints model taxi rides and deliveries. For all the variants considered, we show constant-factor approximation algorithms based on a linear programming framework. To the best of our knowledge, these are the first set of results for the aforementioned variants of the minimum latency problems. Furthermore, we provide an empirical study of heuristics based on our theoretical algorithms on a real data set of taxi rides.
cs.DS
cs
Minimizing Latency in Online Ride and Delivery Services∗ Abhimanyu Das Google Research [email protected] Sreenivas Gollapudi Google Research [email protected] Anthony Kim† Stanford University [email protected] Debmalya Panigrahi Duke University [email protected] 8 1 0 2 b e F 8 ] S D . s c [ 1 v 4 4 7 2 0 . 2 0 8 1 : v i X r a ABSTRACT Motivated by the popularity of online ride and delivery services, we study natural variants of classical multi-vehicle minimum latency problems where the objective is to route a set of vehicles located at depots to serve request located on a metric space so as to min- imize the total latency. In this paper, we consider point-to-point requests that come with source-destination pairs and release-time constraints that restrict when each request can be served. The point- to-point requests and release-time constraints model taxi rides and deliveries. For all the variants considered, we show constant-factor approximation algorithms based on a linear programming frame- work. To the best of our knowledge, these are the first set of results for the aforementioned variants of the minimum latency problems. Furthermore, we provide an empirical study of heuristics based on our theoretical algorithms on a real data set of taxi rides. CCS CONCEPTS • Theory of computation → Routing and network design problems; Discrete optimization; KEYWORDS Vehicle Routing, Minimum Latency Problem, Online Ride Services ACM Reference Format: Abhimanyu Das, Sreenivas Gollapudi, Anthony Kim, Debmalya Panigrahi, and Chaitanya Swamy. 2018. Minimizing Latency in Online Ride and Deliv- ery Services. In Proceedings of ACM Conference (Conference'17). ACM, New York, NY, USA, 12 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn 1 INTRODUCTION In recent years, ride-sharing platforms such as Lyft, Ola and Uber, and online delivery services such as DoorDash and GrubHub have become increasingly popular and have expanded their operations to many cities and countries. A central problem common to these on- line services is the vehicle routing problem where a fleet of vehicles ∗A short version of the paper is to appear at the 27th Web Conference (formerly, World Wide Web Conference), 2018. †Part of this work was done when the author was an intern at Google, Inc. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the owner/author(s). Conference'17, July 2017, Washington, DC, USA © 2018 Copyright held by the owner/author(s). ACM ISBN 978-x-xxxx-xxxx-x/YY/MM. https://doi.org/10.1145/nnnnnnn.nnnnnnn Chaitanya Swamy University of Waterloo [email protected] are routed to serve ride and delivery requests over a geographical area. Indeed, this problem is also at the core of traditional city taxi services, such as Yellow Cab, where taxis are routed to serve ride re- quests received over the phone or the Internet. In all these settings, a request comprises a pair of source and destination locations, such as the rider's starting and ending coordinates for taxi services, and the restaurant and customer addresses for food delivery services. Furthermore, these "point-to-point" requests typically have release- time constraints, i.e., the customer specifies a desired service time before which the request cannot be serviced. The vehicle routing algorithm desires to minimize the average latency of customers, i.e., the difference between their requested service time and the actual service time. In this paper, we formally define this multi-vehicle routing problem, obtain an algorithm based on a linear program- ming framework with a formal guarantee on its performance, and demonstrate that heuristics based on this formal algorithm improve on benchmark greedy solutions on real data sets of city taxi rides. Most current systems, such as the online1 and traditional services mentioned above, employ various heuristics for a batch of requests to solve this kind of vehicle routing problems in practice. In con- trast, there is a rich history in the algorithmic literature on the so-called vehicle routing problems (or VRP), which covers a wide range of routing problems for one or more vehicles under a variety of constraints. For these problems, the formal literature comprises a wide array of sophisticated techniques, often based on linear programing formulations, that lead to approximation algorithms with provable guarantees. While we are not aware of any previous results on our exact problem formulation with point-to-point re- quests and release-time constraints, the related literature raises the natural question: can these sophisticated algorithmic techniques be brought to bear on this important practical problem of minimizing latency for point-to-point requests with release-time constraints? And if so, do these algorithmic ideas also lead to better heuristics in practice? We answer both these questions affirmatively by design- ing a constant approximation algorithm for this problem, which also leads to a heuristic that outperforms a natural greedy strategy. 1.1 Our Contributions We formally define the minimum latency problems in Section 2. In Section 3, we present the linear programming framework due to Post and Swamy [22] that will be central in our algorithms 1Note that we use "online" to refer to the requests being generated by web-based services, and not to refer to requests arriving "online" in an algorithmic sense. Conference'17, July 2017, Washington, DC, USA Das et al. and analyses. Our theoretical contributions are to obtain constant approximation algorithms for the following problems: (1) (Section 4.1) For the minimum latency problem (MLP) and single-depot, multi-vehicle minimum latency problem (k- MLP) with point-to-point requests. (2) (Section 4.2) For the multi-depot, multi-vehicle minimum latency problem (k-MLP) with point-to-point requests. (3) (Section 5) For the above problems with release-time con- straints for both point and point-to-point requests. Additionally, we perform a large-scale empirical analysis for the minimum latency problem by comparing our algorithms with a natural greedy baseline using two real-world taxi data sets. We show that our algorithms outperform the baseline on a set of different metrics including latency, tour length, and utilization (active time) of the cabs in the system. See Table 1 for a summary of our theoretical results with the pre- cise constant approximation factors. To the best of our knowledge, these results are the first polynomial-time approximation guarantees for the respective minimum latency problems. For multi-depot prob- lems, we obtain approximation guarantees with somewhat large constants via a constant-factor reduction (of ratio 3). We believe better approximation ratios are possible with use of more compli- cated constructs, but we do not explore these in this paper to keep our algorithms viable in practice. "Client-side" vs "Platform-side" objectives: Note the average latency objective that we study in this paper is a "client-side" objective whereas the total distance traveled by the vehicles, commonly stud- ied in problems such as the well-known traveling salesman problem (or TSP), is a "platform-side" objective. We can interpret the average latency as the average waiting time from the clients' perspective and the total distance as the platform's operation cost for fuel, etc. Our routing problem with point-to-point requests can be thought of as the "client-side" counterpart of what is known as the Dial- a-Ride problem with unit-capacity vehicles, where vehicles serve requests with point-to-point requests as in our problem, but seek to minimize the "platform-side" objective of total travel distance. The latency minimization problem with point requests subject to release-time constraints has been proposed as an open problem in [31] and there exist polynomial-time approximation schemes for special cases such as a constant number of vehicles, or if the metric space has a special structure such as the Euclidean plane or weighted trees [29]. Our result is the first one for a general metric space and an arbitrary number of vehicles, and generalizes further to point-to-point requests. 1.2 Related Work Our problem is an example of a vehicle routing problem, which is a generic term used to describe a wide range of routing problems over metric spaces. Of particular relevance to our context is the minimum latency problem (or MLP), also known as the traveling repairman problem or the delivery man problem, which has applications in diskhead scheduling and searching information in a network such as the world wide web [7, 16]. This problem is a special case of our problem, where requests are at point locations (instead of point-to- point requests) and there are no release-time constraints. MLP and k-MLP (respectively, one or k vehicles) have been long studied in both the Operations Research and Computer Science communities. MLP was shown to be NP-complete and then MAXSNP-hard for general metrics [8, 21, 25]. In fact, it is NP-hard even when the metric is a weighted tree with {0, 1} weights [28] and is thought to be harder than the well-known traveling salesman problem.2 There have been many works focused on exactly solving MLP/k- MLP and related problems, albeit not in polynomial time. A number of mixed integer formulations have been proposed and exact meth- ods such as cutting-plane algorithms and branch-cut-and-price algo- rithms (e.g., [1, 17, 18]) and various meta-heuristics (e.g., [19, 20, 27]) have been proposed. More recently, several mixed integer formu- lations for k-MLP have been proposed and experimented with on routing and scheduling instances with the number of nodes ranging up to 80 [3]. The first constant-factor approximation algorithm for MLP was obtained in [8] and the approximation factor was subsequently improved to 3.592 in a series of work [5, 9, 14]. Similarly, we have constant-factor approximation algorithms for the multi-vehicle version, k-MLP, for both the multi-depot and single-depot variants due to a series of work [9, 11, 13, 22]: the current best-known approximation factors are 8.497 and 7.183 respectively. For several special cases, stronger guarantees are known. A quasi-polynomial time approximation scheme was known for weighted trees and Euclidean metrics in any finite dimensions [6], and, more recently, a polynomial time approximation scheme was shown for weighted trees and the Euclidean plane for MLP and single-depot k-MLP for any constant k [29]. MLP/k-MLP are also closely related to other vehicle routing prob- lems such as the traveling salesman problem, orienteering (cf. [10]) and the Dial-a-Ride problem (cf. [12]). They are also related to many sequencing problems with minimum total (weighted) completion time objective in the scheduling literature (cf. [15, 29]). There is a large body of work on vehicle routing problems and scheduling problems beyond the scope of this paper. For further details, we refer to the above work and references therein. Finally, we mention several work among many on other aspects of the ride and delivery services from the Data Mining and Artifi- cial Intelligence communities. Different taxi dispatching strategies and route-recommendation systems have been studied in order to minimize passengers' waiting times (cf. [2, 33] in different settings from ours), to maximize drivers' profits (cf. [24]), and to guarantee fairness within a group of competing drivers (cf. [23]). To address inefficiencies in taxi systems, several graph-based models and algo- rithms have been designed to minimize the total number of required taxis and to reduce the total idle time of taxi drivers (cf. [32, 34]). Dynamic variants where ride requests arrive on demand have also been studied (cf. [26]). 2 PROBLEM FORMULATION We define the multi-vehicle minimum latency problem (k-MLP) with point-to-point requests as follows. Let G = (V , E) be a weighted complete undirected graph with a distance function on edges, c : E → R+, that forms a metric space. There are n point-to-point requests where each request Ri is given by a pair (si , di) of source 2The traveling salesman problem is MAXSNP-hard for general metrics but is solvable in polynomial time in the case of weighted tree metrics (via an Eulerian tour). Minimizing Latency in Online Services Conference'17, July 2017, Washington, DC, USA MLP Single-Depot k-MLP Multi-Depot k-MLP P Reqs. 3.592 ([9]) 7.183 ([22]) 8.497 ([22]) P2P Reqs. P Reqs. w/ RTs P2P Reqs. w/ RTs 3.592 8.978 25.488 7.183 7.183 13.728 7.183 8.978 41.184 Table 1: The state-of-the-art approximation guarantees for various minimum latency problems (MLP/k-MLP) with point (P) requests and point-to-point (P2P) requests and with or without release times (RTs). Except those in the first column, the constant-factor approximation ratios are new and due to this paper. and destination nodes and to be satisfied without interruption, that is, a vehicle serves it by first going to the source node and then to the destination node directly. There are k vehicles located at respec- tive designated depot nodes, equivalently, root nodes, r1, . . . , rk. The objective is to find k paths P1, . . . , Pk starting from respective depots that serve all the requests and minimize the total latency, that is, the sum of latencies of requests, where the latency of a request is equal to the distance from the depot to the destination of the request on the path of the vehicle that serves it.3 After appropriate scaling and rounding, we may assume ce are + csjdj ≥ 1 for every root node ri and request integers and cri sj Rj. For ease of exposition, we assume the distances ce are given in a unit of time and interpret the latency of a request to be its completion time, following the job scheduling literature. The problem thus defined is the most general version to be studied in this paper and we refer to it as multi-depot k-MLP with point-to-point requests. We refer to the case when there is a single depot r0 for all vehicles (i.e., r0 = r1 = · · · = rk) as single-depot k-MLP with point-to-point requests, and the case with exactly one vehicle (i.e., k = 1) as MLP with point-to-point requests. When the requests' source and destination nodes are identical, we have the classical k-MLP and we refer to them as (multi-depot/single-depot) k-MLP with point requests (e.g., [22]) to distinguish them from the more general problems with point-to-point requests. MLP/k-MLP with release times is MLP/k-MLP with additional release-time constraints. Each request Ri has release time Ti such that it cannot be visited before time Ti. Both point and point-to- point requests can be considered with release times. When a vehicle is at the source node of a request, it may wait there until when the request become available at its release time. When clear from the context, we refer to these problems with shorter names. Notations. We refer to the designated nodes using the ri, si and di, and to arbitrary nodes of any kind using generic indexing variables such as u and v. We use I to denote the input size. A path may start from and end at different nodes and a tour must start from and end at the same node. We represent a path/tour by the sequence of nodes on the path/tour or simply by the sequence of requests in the order served if it is a vehicle's route. For example, if the order of the requests is R1 · · · Rn, the corresponding path is P = r0s1d1 · · · sndn (assuming the root r0). For a path P, let Lat(P, i) be the latency of the i-th request on the path, i.e., the distance along the path from the root of the path to the destination of the request, and i =1 Lat(P, i) be the total latency of the path. The total latency objective is the sum of the latencies of the paths of the k 3Note the total latency and average latency differ by the factor of n and optimizing with respect to both objectives are equivalent. Lat(P) =n vehicles. Note that if there is one vehicle located at the root r0 that serves the all the requests in the order R1 · · · Rn, then (cid:40)Lat(P, i − 1) + cdi−1si Lat(P, i) = 0, + csi di , i > 1 i = 0 , where d0 = r0. Given a set of edges Q and a distance function c, let c(Q) be the sum of the lengths given by c of the edges in Q; if P is a path, then c(P) is the length of the path. We frequently perform concatenation and shortcutting operations on paths and tours. If two paths/tours meet at the same node, that is, one ending at and the other starting from the same node, we may concatenate them back to back to create a longer path/tour. We may shortcut a path/tour to avoid visiting a node twice by skipping it; this leads to a path/tour of at most the original length if the distances satisfy the triangle inequality, which holds in metric spaces. 3 LP FRAMEWORK We describe the linear programming framework due to Post and Swamy [22] for single-depot k-MLP and MLP with point requests. Some of our algorithms utilize a directed metric, so we describe their LP in this general setting. Linear programs for multi-depot k-MLP are also given in [22] and are different, but we primarily focus on the linear program for the single-depot case in this paper. Let r denote the single depot for the point-request version. Given a problem instance with point requests, let digraph D = (V , A) with arc-costs {cu,v}u,v ∈V represent the underlying directed metric. (If we have an undirected metric, we simply bidirect the edges to obtain D, setting cu,v = cv,u = cuv.) We use a to index the arcs in A, v to index nodes in V \ {r}, i to index the k vehicles, and t to index time units in [T]. We use variables xi to denote v,t if node v is visited at time t by the route originating at the root. Directing the vehicles' routes away from the root in a solution, zi a,t indicates if arc a lies on the portion of vehicle i's route up to time t. Let T be an easily certifiable upper bound on the maximum latency of a request. Consider the following LP. We will be able to ensure that either: (a) T is polynomially bounded by scaling and rounding the metric (e.g., [6]) while losing a (1 + ϵ)-factor, in which case this LP can be solved efficiently; or (b) log T is polynomially bounded, and use ideas from [22] to obtain a (1 + ϵ)-approximate solution to this LP. Constraints (1) ensure that every non-root node is visited at some time, and constraints (2) ensure that each node cannot be visited before the distance from the root is covered. Constraints (3)–(5) are for the vehicles' routes: (3) ensures that the portion of a vehicle's route up to time t must visit every node visited by that vehicle Conference'17, July 2017, Washington, DC, USA Das et al. by time t, (4) ensures that this route indeed has length at most t, and finally (5) seeks to encode that the route forms a path. (Note that constraints (5) are clearly valid, and one could also include the a∈δ out(r) zi a,t ≤ 1 for all i, t.) Figure 1: A visualization of the structure of routes com- puted by our algorithms (e.g., Algorithm 1). The frontiers are dashed and routes are solid. ∫ n Corollary 3 (Corollary 2.2 in [22]). The shortest 1 (cid:123) n path in CG(w1, . . . , wn) has length at most µ∗ 1 f (x)dx, where 2 : [1, . . . , n] (cid:55)→ R+ is the lower-envelope curve of {(j, wj) : j = f 1, . . . , n}, and only visits nodes corresponding to extreme points of (w1, . . . , wn). 4 POINT-TO-POINT REQUESTS In this section, we present polynomial-time constant-factor approx- imation algorithms for MLP and single-depot/multi-depot k-MLP with point-to-point requests. The main idea is to first reduce the instance to a point-request instance in a modified metric and, then, solve linear program (LP) and round the fractional optimal solu- tion to nearly optimal routes via the arborescence-packing result and concatenation process described in Section 3. For single-depot k-MLP and MLP, we have a lossless reduction to a point-request instance in a directed metric; for multi-depot k-MLP, we reduce to the point-request version in an undirected metric incurring a factor-3 loss. Intuitively speaking, our algorithms find a sequence of frontiers of increasing sizes around the depot(s) and route the vehicle(s) to satisfy the requests in the order determined by the frontiers. See Figure 1 for a visualization. Our main results are as follows. We prove the single-depot results in Section 4.1 and the multi-depot ones in Section 4.2. a (µ∗ + ϵ)-approximate solution in time poly(I, Theorem 4. For MLP with point-to-point requests, we can compute ϵ ) for any ϵ > 0. 1 Theorem 5. For single-depot k-MLP with point-to-point requests, we can compute a (2.5µ∗ +ϵ)-approximate solution in time poly(I, ϵ ) 1 for any ϵ > 0. (2.5µ∗ ≈ 8.978.) Theorem 6. For multi-depot k-MLP with point-to-point requests, ϵ ) 1 we can compute a(25.488+ϵ)-approximate solution in time poly(I, for any ϵ > 0. 4.1 Single Depot The algorithm leading to Theorem 5 is given in Algorithm 1; the improved ratio for MLP (Theorem 4) is due to a simple observation and the underlying algorithm and analysis are essentially identi- cal. As noted earlier, we transform the given undirected problem instance with point-to-point requests to a point-request instance v,t,i constraints min  s.t.     a∈δ in(S) t,i v,t txi v,t ≥ 1 xi v,t = 0 if cr,v > t xi zi a,t ≥  a,t ≥  ∀v ∀v, t, i ∀S ⊆ V \ {r}, v ∈ S,∀t, i ∀t, i a,t ∀v, t, i zi a∈δ out(v) xi v,t′ t′≤t (LP) (1) (2) (3) (4) (5) a cazi a,t ≤ t zi a∈δ in(v) x, z ≥ 0. (6) To round a fractional solution to a set of routes for vehicles, we use a polynomial-time arborescence packing result for weighted digraphs and the concatenation graph. The following result does not require the edge costs are symmetric or form a metric, but holds for arbitrary nonnegative edge costs. in(u) ≥ δ i =1 γi = K, γ1, . . . , γq in polynomial time such thatq we for all e ∈ A, and rected graph with n nodes and an arc (i, j) of length(cid:0)n − i +j Theorem 1 (Theorem 3.1 in [22]). Let D = (U +r , A) be a digraph with nonnegative integer edge weights {we}, where r (cid:60) U is a root out(u) for all u ∈ U . For any integer K ≥ 0, node and δ one can find out-arborescences F1, . . . , Fq rooted at r and integers i:e∈Fi γi ≤ i:u∈Fi γi = min{K, λD(r , u)} for all u ∈ U . The concatenation graph was introduced by Goemans and Klein- berg [14] and then extended by Archer and Blasiak [4] as a con- venient mean of representing the concatenation process of con- structing vehicles' routes from shorter paths. The concatenation graph corresponding to a sequence w1 = 0, . . . , wn of nonnegative numbers (that starts with a 0), denoted CG(w1, . . . , wn), is a di- all i < j. In our applications, a path through CG(w1, . . . , wn) will correspond to the selection of certain partial solutions of smaller routes and the subsequent concatenation of these partial solutions to obtain a final solution of the vehicles' routes. The length of the path will upper bound the total latency of the final solution. We say that wℓ is an extreme point of the sequence (w1, . . . , wn) if (ℓ, wℓ) is an extreme-point of the convex hull of {(j, wj) : j = 1, . . . , n}. Given a point-set C ⊆ R2 +, define its lower-envelope curve f : [min(x,y)∈C x, max(x,y)∈C x] (cid:55)→ R+ by f (x) = min{y : (x, y) ∈ conv(C)} where conv(C) denotes the convex hull of C. We say that (ℓ, wℓ) is a corner point of the lower-envelope curve of {(j, wj) : j = 1, . . . , n} if wℓ is an extreme point of (w1, . . . , wn). 2 (cid:1)wj for We have the following results on the concatenation graph: Theorem 2 ([4, 14]). The shortest 1 (cid:123) n path in CG(w1, . . . , wn) has length at most µ∗ ℓ=1 wℓ where µ∗ < 3.5912 is the solution to µ ln µ = µ + 1. Moreover, the shortest path only visits nodes corre- sponding to extreme points of (w1, . . . , wn). 2 n Minimizing Latency in Online Services Conference'17, July 2017, Washington, DC, USA in a directed metric (see Step 1 of Algorithm 1) and apply the linear programming approach in Section 3. The transformation to a di- rected metric is lossless since there is a one-to-one correspondence between feasible solutions in G and G′ and corresponding solutions have the same total latency. Algorithm 1 works with the directed instance G′ in Steps 1–7 and with the given undirected instance G in Steps 7 and 8. The analysis closely resembles the one in [22] but is more in- volved due to "directionality" of the requests since a vehicle serves a request by going from the source to the destination, not the other way around. Lemma 7 relates the lower-envelope curve f of C in Step 5 and the objective value of the fractional optimal solution in Step 2 as in [22], since this only requires nonnegative edge costs. Lemma 7. (i)∫ n 1 f (x)dx ≤ 5 u∈V ,t ∈[T] tx′ ℓ and time t∗ u,t . (ii) If(cid:0)ℓ, f (ℓ)(cid:1) is + 2t(cid:1) to C. By Theorem 1, E[c′(Qt (cid:21) ℓ satisfying the ℓ ℓ ℓ ) )∩ S(t), 3c′(Q t k ) (cid:20) 3c′(Q t point(cid:0)V(Qt + 2t kt and, hence, E proof and the lemma follows. Proof. This is a modified version of Lemma 6.3 in [22] and has essentially the same proof. The only difference is that we add the )] ≤ ≤ 5t. The rest follows the same □ Lemma 8. If (ℓ, f (ℓ)) is a corner point of f , each of the tours + 2t∗ Z1, ℓ, . . . , Zk, ℓ created in Step 7 has length at most ℓ. In particular, the part of each tour without the first and last edges connecting to the root has length at most 2c′(Q∗ 2c′(Q∗ k k ) ) . ℓ ℓ ℓ a corner point of f , then there is a tree Q∗ properties stated in Step 5 in Algorithm 1. k ℓ Proof. When breaking the cycle Zℓ, a break point can be either on a node or on an edge. In the former case, the node appears in two consecutive segments, and in the latter case, the edge is removed. In either cases, all the nodes of Q∗ will be contained in at least one segment and the corresponding request will be covered in one of the k tours Z1, ℓ, . . . , Zk, ℓ by the construction below. Consider a segment and the corresponding tour Zi, ℓ. In the cy- cle Zℓ, we visit a node through a "correctly" oriented edge (i.e., in the same direction as the tour) for the first visit and through "incorrectly" oriented edges (i.e., in the opposite direction) for sub- sequent visits, and consequently, the segment consists of both correctly and incorrectly oriented edges. Without loss of gener- ality, let R1, . . . , Rq be the requests corresponding to the vertices that are visited for the first time within the given segment in Zℓ. Then, Zi, ℓ = r0s1d1 · · · sqdqr0. For P = d1s2d2 · · · sqdq, we show c(P) ≤ 2c′(Q∗ . By the definition of c′, each arc in G′ corresponds to a path of length 2 in the original graph G. We replace the edges of the segment with corresponding paths of length 2 of the form disjdj. The resulting path in G has length at most 2c′(Q∗ and contains the nodes of P as a subsequence, not necessarily contiguously. We shortcut to get P exactly where shortcutting involves going directly from di to si +1 for some i and truncating the beginning or end. Since G has metric edge costs {ce}, it follows that c(P) ≤ 2c′(Q∗ ) . For the two paths r0s1d1 and dqr0 that complete P into Zi, ℓ, we upper bound the length of each path by t∗ . Let r be the root in G′ and v1, vq ∈ V ′ be the vertices corresponding to d1 and dq, respectively. k k k ) ) ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ ) ) k k k ), c′ + 2t∗ and c′ ℓ + csqdq . Then, . It ℓ . □ 2.5µ∗ . Also, ∩ S(t∗ rv1 ≤ t∗ and cr0dq ≤ cr0sq Since v1 and vq are in Q∗ rvq ≤ t∗ cr0s1 + cs1d1 = c′ rv1 ≤ t∗ rvq ≤ t∗ = c′ follows that c(Zi, ℓ) = c(P) +cr0s1 +cs1d1 +cr0dq ≤ 2c′(Q∗ ) +2t∗ Proof of Theorem 5. We claim that the solution returned by ∫ n 2  Algorithm 1 has total latency at most the length of PC in the concate- nation graph CG(f (1), . . . , f (n)). By Corollary 3 and Lemma 7 part 1 f (x)dx ≤ 5µ∗ (i), the length of PC is at most µ∗ v,t = 2 is at most (1+ϵ) times the opti- v,i,t txi v,t mal latency, where the (1 + ϵ)-factor is due to scaling and rounding. We now prove the claim. More specifically, we show that the total latency is at most the length of PC in CG(f (1), . . . , f (n)) by induction. By Theorem 2 and Lemma 7, there exist Q∗ and t∗ satis- fying the properties stated in Step 5 for each corner point (ℓ, f (ℓ)) on PC. By Lemma 8, the tours that would be created from Q∗ have length at most 2c′(Q∗ in the correct direction and cover all the requests corresponding to the vertices of Q∗ . In particular, the part of each tour without the first and last edges connecting to the root has length at most 2c′(Q∗ in the correct direction. v,i,t txi v,t v,t tx′ Suppose inductively that we have covered at least o requests by the partial solution constructed by concatenating tours correspond- ing to the nodes on PC up to and including o. Assume we next take an edge (o, ℓ) and consider the additional contribution to the total latency when we concatenate Zi, ℓ to vehicle i's route for i ∈ [k]. Note the resulting partial solution covers at least ℓ requests. Each request covered in the current concatenation step incurs additional latency of at most f (ℓ) in expectation. To see this, let 2 L be the length of the part of a tour Zi, ℓ without the root r0 and L′ be the length up to the destination of a request covered by the tour. With probability 3 4, the additional latency incurred for the request is tℓ + L′. With probability 1 4, the additional latency is at most tℓ + 3(L − L′) because the length of a traversal in the opposite direction is upper bounded by 3 times the length of the corresponding traversal in the correct direction (accounting the si-di portions 3 times). For example, if s1d1 . . . sndn is a traversal in the correct direction, the reverse traversal is a shortcut version of dnsndnsn . . . d1s1d1s1 which has length at most 3 times that of s1d1 . . . sndn. In expectation, the additional latency incurred for the request is at most 3 as L ≤ 2c′(Q∗ By a similar argument, each request that is still uncovered after concatenation incurs additional latency of at most f (ℓ) in expecta- tion. The traversal in the correct direction has length at most 2tℓ +L and the one in the opposite direction has length at most 2tℓ + 3L. In expectation, the additional latency is at most 2tℓ + 3L2 ≤ f (ℓ). There are exactly ℓ requests covered by the tours Z1, ℓ, . . . , Zk, ℓ and at most ℓ − o new requests are covered in the current concate- nation step. Each of these incurs additional latency at most f (ℓ) 2 . At most n − ℓ requests remain to be covered and they each incur additional latency at most f (ℓ). The overall increase in the total latency is at most f (ℓ) is equal to the length of the edge (o, ℓ) in CG(f (1), . . . , f (n)). By induction, the total latency is at most the length of PC. 2 (ℓ − o) + f (ℓ)(n − ℓ) = f (ℓ)(cid:16) 4(tℓ + 3L − 3L′) = tℓ + 3L4 ≤ f (ℓ) 2 (cid:17) which 4(tℓ + L′) + 1 n − o+ℓ2 k ) . ℓ Conference'17, July 2017, Washington, DC, USA Das et al. Algorithm 1. The input is a single-depot k-MLP instance G = (V , E) with point-to-point requests and root r0. 1. Define a directed graph G′ = (V ′, A) on n + 1 nodes corresponding to the root/requests and arcs (vi, vj) with length c′ for all requests i and j. Treat root r0 as the 0-th request (s0, d0) with r0 = s0 = d0. Let r denote the root in G′. Let T = 4nLB where LB := maxv∈V cr0v . By scaling and rounding the c-metric (e.g., [6]), we may assume that T = poly(cid:0)I, 1 ϵ a }. Let x′ 2. Compute an optimal solution (x, z) to (LP) for the instance given by G′ and {c′ 3. Initialize C ← {(1, 0)}, Q ← ∅. Let K be such Kz′ a,t 4. For all t = 1, . . . , T, do the following. Apply Theorem 1 on the digraph D with edge weights {Kz′ is an integer for all a, t. For t ∈ [T], define S(t) = {u ∈ V :t + 2t(cid:1) to C, and 5. For all ℓ = 1, . . . , n, compute f (ℓ) where f : [1, n] (cid:55)→ R+ is the lower-envelope curve of C. We show in Lemma 7 that for every corner point(cid:0)ℓ, f (ℓ)(cid:1) weighted arborescence family (γ1, Q t1), . . . , (γq, Q t add Q t a,t = in the family, add the point(cid:0)V (Q t u,t′ > 0}. (Note that a,t }a∈A and integer K (and root r) to obtain a (cid:1) losing a (1 + ϵ)-factor. q). For each arboresence Q t r ∈ S(t) for all t > 0.) v,t = a,t′ for all v, a, t. ) ∩ S(t), v,t , z′ t′=0 x′ = cdi sj + csj dj to Q. 3c′(Q t i x i i zi vi vj k ) ℓ ℓ ℓ ℓ of f , there is some tree Q∗ ) ∩ S(t∗ 6. Find a shortest 1 (cid:123) n path PC in the concatenation graph CG(f (1), . . . , f (n)). 7. For every node ℓ > 1 on PC , do the following. Do a DFS-traversal from r on Q∗ ∈ Q and some time t∗ such that ℓ = V (Q∗ ℓ ℓ ℓ ℓ ℓ twice. Break Zℓ into k segments, each of c′-length at most 2c′(Q∗ to obtain a cycle Zℓ, in the undirected sense, that uses each arc of Q∗ )/k. For each segment, create the corresponding tour Zi, ℓ in G, starting from and ending at r0, that satisfies only the requests that have their (first) appearance within the segment in the Eulerian tour and in the order of first appearances. Skip requests that are not in S(t∗ 4 , in the opposite direction (satisfying the same set of requests but in the reverse order). This yields a collection of k tours Z1, ℓ, . . . , Zk, ℓ. 8. For every i = 1, . . . , k, concatenate the tours Zi, ℓ for nodes ℓ on PC to obtain vehicle i's route, shortcutting if a request has already been satisfied. 4 , we traverse Zi, ℓ in the correct direction and with probability 1 ). With probability 3 ℓ ℓ ℓ ), f (ℓ) = 3c′(Q∗ ) ℓ k + 2t∗ ℓ , and maxv∈Q∗ ℓ ∩S(t∗ ℓ rv ≤ t∗ )c′ ℓ . For the running time, since T = poly(I, ϵ ), we can design a 1 separation oracle for (3), which is a min-cut algorithm, and solve (LP) in time poly(I, ϵ ). 1 □ ℓ ℓ )(cid:1) ). In Step 4, we now add the point(cid:0)V(Qt Proof of Theorem 4. We follow the same analysis above for Algorithm 1. The improvement of the approximation ratio comes from the fact that we do not need to break the cycle Zℓ into k tours in Step 7 since we have exactly one vehicle. Moreover, we note that the length of a traversal of Zℓ in either direction is at most 2c′(Q∗ ) ∩ S(t), 2c′(Qt to C to leverage this fact. Following the proof of Theorem 5, we now therefore obtain a µ∗-approximation. □ We remark that for single-depot k-MLP, we can avoid the additive ϵ in the approximation factors by utilizing the more combinato- rial approach presented in [22]. In this approach, we obtain the arborescences directly without solving an LP. Specifically, for each i = 1, . . . , n, we aim to find the least c′-cost arborescence spanning at least i requests (which in turn utilizes arborescence packings). We then again use the concatenation graph to select a subset that will be converted into tours which are then concatenated. This is closer to the approach we follow in our experimental results. ℓ 4.2 Multiple Depots For the more general multi-depot k-MLP with point-to-point re- quests, we provide a reduction showing that an α-approximation algorithm for the point-request version on undirected metrics yields a 3α-approximation algorithm for the point-to-point request ver- sion on undirected metrics. More specifically, the following result immediately yields Theorem 6 using the (8.496 + ϵ)-approximation for multi-depot k-MLP with point-requests in [22]. Lemma 9. Let OPT and OPT ′ denote respectively the optimal val- ues of the multi-depot k-MLP instance with point-to-point requests, and the multi-depot k-MLP instance with point requests obtained by the reduction under the c′ edge costs (described below). Then OPT ≤ OPT ′ ≤ 3 · OPT. Hence, an α-approximate solution to the point-requests instance yields a 3α-approximate solution to the point- to-point requests instance. vivj = csi sj + csi di + csjdj The main idea of the factor-3 reduction is to identify the requests by their source nodes and incorporate the request-specific distances into distances between sources in a symmetric way. We treat csi di the root nodes as dummy requests with the identical source and des- tination nodes for the reduction. More specifically, G′ contains only root nodes and nodes representing the requests, and the distance between vi and vj in G′ is c′ . It is easy to see that (G′, c′) is a metric. We then solve the resulting problem instance using an algorithm for the point requests and convert the computed paths into ones in the original problem instance. Via this reduction, observe that the latency of a rooted path in the (G′, c′) instance corresponds to the latency of a particular type of path, that we call a backtracking path, in the original problem instance, where a vehicle satisfies each request i by going from si to di and then returning to si before moving onto the next request. The back- tracking paths are for the purpose of analysis only and we shortcut these paths to obtain the final routes for the vehicles. Clearly, there are bijective mappings between request-orderings and paths and backtracking paths. If the order of the requests is R1 · · · Rn, which equivalently corresponds to a path P, the corresponding backtrack- ing path is Pb = r0s1d1s1s2d2s2 · · · sndn . If the order of the requests is R1 · · · Rn on the route P of a vehicle starting from, say, root r0, the latency of the i-th request on the corresponding backtracking path Pb is determined as Lat(Pb , i) = (cid:40)Lat(Pb , i − 1) + cdi−1si−1 + csi−1si The total latency of Pb is Lat(Pb) =n + csi di , i > 1 i = 0 . i =1 Lat(Pb , i). In particular, the following property is useful in proving Lemma 9. 0, Minimizing Latency in Online Services Conference'17, July 2017, Washington, DC, USA Lemma 10. For any path P and corresponding backtracking path Pb , we have Lat(P) ≤ Lat(Pb) ≤ 3 Lat(P). Further, the factor of 3 is tight. Proof. Without loss of generality, let R1R2 · · · Rn be the order- ing of requests on P. Let Lat(P, i) denote the latency of the Ri on P. Define Lat(P, i) = 0 for all i ≤ 0. We show by induction that Lat(P, i) ≤ Lat(Pb , i) ≤ 2 Lat(P, i − 1) + Lat(P, i) for all i. Since 2 Lat(P, i − 1) + Lat(P, i) ≤ 3 Lat(P, i), summing over all i implies the statement. The base case when i = 1 holds since Lat(P, 1) = Lat(Pb , 1) = cr0s1 + cs1d1. Suppose inductively the claim holds for i − 1. Then Lat(P, i) = Lat(P, i − 1) + cdi−1si + csi di ≤ Lat(Pb , i − 1) + cdi−1si−1 + csi−1si = Lat(Pb , i) , + csi di where the inequality follows from the induction hypothesis and the triangle inequality. For the upper bound, we have that Lat(Pb , i) = Lat(Pb , i − 1) + cdi−1si−1 + csi−1si + csi di ≤ 2 Lat(P, i − 2) + Lat(P, i − 1) + (csi−1di−1 + cdi−1si)+ = 2(cid:0)Lat(P, i − 2) + csi−1di−1 cdi−1si−1 + csi di (cid:1) + Lat(P, i − 1)+ cdi−1si + csi di ≤ 2 Lat(P, i − 1) + Lat(P, i) . The first inequality follows from the induction hypothesis and the triangle inequality; and the second inequality follows from the recurrence definitions of Lat(P, i − 1) and Lat(P, i). □ To see that the factor of 3 is tight, consider the following instance with n requests R1, . . . , Rn which are to be satisfied in that order. The sources are evenly spaced on a line at the distance interval of 1 and the destinations coincide with the sources such that r0 = s1, d1 = s2, d2 = s3, etc. For the path P, Lat(P, i) = i for all i and the total latency is Lat(P) = 1 2n. For the backtracking path Pb, 2n Lat(Pb , i) = 3(i − 1) + 1 for all i and the total latency is Lat(Pb) = 2n. Since limn→∞ Lat(Pb) i =1 Lat(Pb , i) = 3 2 − 1 Lat(P) = 3, the ratio 2n can be arbitrarily close to 3. We can now prove the approximation guarantee via the factor-3 n 2 + 1 reduction. 1 1 b , . . . , Qk b By Lemma 10, the paths Q Proof of Lemma 9. Let P , . . . , Pk be an optimal solution to the original multi-depot k-MLP instance with point-to-point requests. Let Q be backtracking paths corresponding to an optimal solution to the resulting multi-depot k-MLP instance with point requests (and the c′-edge costs). map to paths for the original instance of no greater total latency, so OPT ≤ OPT ′. Again, by Lemma 10, the paths P , . . . , Pk map to backtracking paths of total latency at most 3 · OPT, so OPT ′ ≤ 3 · OPT. The second statement follows immediately from the first one since any solution to the modified instance with point requests yields a solution to the original instance of no greater total latency. □ 1 b , . . . , Qk b 1 5 RELEASE-TIME CONSTRAINTS We show constant-factor approximation algorithms for the mini- mum latency problems with release-time constraints for both point requests and point-to-point requests. We incorporate the release- time constraints into the linear program (LP) and solve the resulting linear program optimally as before. When rounding an optimal frac- tional solution to an integral solution, we follow the same analysis steps in Section 4 but need to account for the release times. Our anal- ysis can be easily modified to satisfy the release-time constraints with little or no extra cost in terms of approximation guarantees. For point requests, we have the following results with similar approximation ratios as for the variants without release times. We prove them in Sections 5.1 and 5.2, respectively: Theorem 11. For point requests with release times, we obtain the ϵ ) for any ϵ > 0: following approximation guarantees in time poly(I, 1 (1) A (2µ∗ + ϵ)-approximation for MLP and single-depot k-MLP; (2) A (13.728 + ϵ)-approximation for multi-depot k-MLP. (2µ∗ ≈ 7.183) For point-to-point requests, we also have constant-factor approx- imation algorithms: Theorem 12. For point-to-point requests with release times, we ϵ ) for 1 have the following approximation guarantees in time poly(I, any ϵ > 0: (1) A (2µ∗ + ϵ)-approximation for MLP; (2µ∗ ≈ 7.183) (2) A (2.5µ∗ + ϵ)-approximation for single-depot k-MLP; (2.5µ∗ ≈ (3) A (41.184 + ϵ)-approximation for multi-depot k-MLP. 8.978) As in the case without release times, the total latency objective is computed with respect to the beginning of the paths at the root nodes. This is analogous to the total-completion-time objective that is widely used in the scheduling literature (see, e.g., [30]). While, admittedly, measuring the latency of a request Ri by (time taken to reach di) −Ti, which accounts for the actual time Ri spends in the system, yields a more natural objective that is akin to the flow-time objective in scheduling, the resulting optimization problem is much harder to approximate (as is the case in scheduling). Therefore, following much of the work in scheduling, we consider our latency objective, which is a reasonable first step in studying ride-sharing and delivery problems with release times. To distinguish from the latency objective without release times, we use Lat+ to denote latencies and incorporate the release times by making vehicles wait at the source of a request if it has not been released. For example, for path P = r0s1d1 · · · sndn, note that the latency of the i-th request on P is Lat+(P, i) = (cid:40)max{Lat+(P, i − 1) + cdi−1si ,Ti} + csi di , i > 1 i = 0 . Similarly, the length of a path/tour needs to correspond to the tra- versal time subject to release-time constraints. Given a sequence of requests to be satisfied, the traversal time for the sequence consists of driving times for moving from one location to another and wait- ing times for staying fixed at a location before a request is released. We can still concatenate and shortcut in the sense that the total traversal time of concatenation of two paths meeting at a node is 0, Conference'17, July 2017, Washington, DC, USA Das et al. at most the sum of traversal times of the paths, and the traversal time of a shortcut path is at most that of the original path. The algorithms and their analyses stay essentially the same for traversal times as for lengths of paths/tours. 5.1 Point Requests: Proof of Theorem 11 Part (1). We incorporate the following release-time constraints into the linear program (LP) and solve for an optimal fractional solution as before: ∀v, t, i . v,t = 0 if Ti > t xi (7) (Since we have point requests, the c′ edge costs used in Algorithm 1 are simply the bidirected c costs.) We now need to incorporate the Ri's in our upper bound T, but log T is still polynomially bounded and we can obtain a (1 + ϵ)-approximate solution to the LP. Then, we round the fractional solution as in Algorithm 1 by creating a set of tours starting and ending at the root and concatenating them. In the analysis, we upper bound the traversal times of the tours using the same upper bound (or nearly the same) we have used for the lengths of the tours, and, hence, obtain the same or similar approximation guarantees with respect to the total latency objective as for the variants without release times. Specifically, Theorem 6.1 in Post and Swamy [22], which is the equivalent of Theorem 5 for point requests with release times, obtains an approximation ratio of 2µ∗ for single-depot k-MLP with point requests without release times. We observe that the same upper bound of 2c(Q∗ on the c-length of a tour obtained for time-point t∗ used in Theorem 6.1 in [22] also upper bounds the traversal time of any tour Zi, ℓ that we obtain in Step 7 of Algorithm 1. This is because the upper bound of t∗ on the lengths of the edges connecting the ends of Zi, ℓ to the root also upper bounds the waiting time portion of the traversal: since all requests on Zi, ℓ have release time at most t∗ by the release-time constraints (7), t∗ ℓ also accounts for the total waiting time of the traversal of Zi, ℓ. Thus, we do not incur any extra cost; the rest of the analysis is the same as that in [22], and the approximation guarantee follows. + 2t∗ k ℓ ) ℓ ℓ ℓ ℓ Part (2). For this result, we use Algorithm 1 in [22] and its anal- ysis, which uses a related but different linear program. We incor- porate the release-time constraints (7) as before. Due to the space constraints, we omit the linear program and refer to [22] for details. As before, we upper bound the traversal times of tours obtained for some time-point t by (the total driving time of at most t to visit the requests in the tour) + t, since t is an upper bound on the waiting time incurred as all requests on the tour have release times at most t. Consequently, following the analysis in [22], one can argue that for any constant 1 < c < e, we obtain an approximation ratio of at most (2c +1)(1−e−1) ln c(1−ce−1) + ϵ.4 Taking c = 1.58726, we obtain an approximation ratio of at most 13.7272 + ϵ. 4Claim 5.2 (iii) in [22] changes as follows: conditioned on the random offset h, the expected latency of a node v first covered in iteration j of the algorithm is now at most (1 + ϵ)(3t0 + 3t1 + . . . + 3tj−1 + 2tj) ≤ (1+ϵ)(2c +1) · tj c−1 5.2 Point-to-Point Requests: Proof of Theorem 12 The proof follows the same reasoning as in the proof of Theorem 11. For parts (1) and (2), we move to a directed metric c′ as in Step 1 of Algorithm 1, incorporate release times as in (7), solve the resulting LP (LP), and round it using Algorithm 1. The guarantees in parts (1) and (2) rely on the analysis in Theorems 4 and 5 respectively, and the now-familiar fact that the waiting time for a tour for time t is at most t. For part (3), we use the following factor-3 reduction to the point- requests and use part (2) of Theorem 11. This yields a (41.184 + ϵ)- approximation. The reduction is analogous to the constant-factor re- duction presented in Section 4.2 but proof details are more involved. For path P = r0s1d1 · · · sndn, we have the following relations for the latencies of the corresponding backtracking path Pb, (cid:26) Lat+(Pb , i − 1) (cid:27) Lat+(Pb , i) = + cdi−1si−1 + csi−1si ,Ti + csi di , i > 1 i = 0 . max 0, We have the following property of the backtracking paths with release times and, hence, the approximation guarantee via the re- duction. The proof of Lemma 14 follows the same steps as that of Lemma 9. Lemma 13. For any path P and corresponding backtracking path Pb , we have Lat+(P) ≤ Lat+(Pb) ≤ 3 Lat+(P). Lemma 14. Given point-to-point requests with release times, the optimal backtracking path has total latency at most 3 times that of the optimal path. More generally, an α-approximate backtracking path has total latency at most 3α times that of the optimal path. In the remaining of the section, we prove Lemma 13. Proof of Lemma 13. Without loss of generality, we assume P = r0s1d1 · · · sndn and Pb = r0s1d1s1 · · · sndn from root r0. (Lower bound) We show by induction that Lat+(P, i) ≤ Lat+(Pb , i) for all i. Then, it would follow that Lat+(P) = Lat+(Pb , i) = Lat+(Pb) . n i =1 Lat+(P, i) ≤ n i =1 The base case when i = 1 holds since Lat+(P, 1) = Lat+(Pb , 1) = max{cr0s1 ,T1}+cs1d1. We now assume Lat+(P, i−1) ≤ Lat+(Pb , i−1) and show Lat+(P, i) ≤ Lat+(Pb , i). Note Lat+(P, i) = max{Lat+(P, i − 1) + cdi−1si ,Ti} + csi di ≤ max{Lat+(Pb , i − 1) + cdi−1si−1 + csi−1si ,Ti} + csi di = Lat+(Pb , i) , where the inequality follows from the induction hypothesis and the triangle inequality. Hence, the induction holds and the lower bound is proved. (Upper bound) Similarly, we show that Lat+(Pb , i) ≤ 2 Lat+(P, i − 1) + Lat+(P, i) for all i by induction. Then, (cid:0)2 Lat+(P, i − 1) + Lat+(P, i)(cid:1) ≤ 3 Lat+(P, i) , n i =1 n i =1 Minimizing Latency in Online Services Conference'17, July 2017, Washington, DC, USA and Lat+(Pb) ≤ 3 Lat+(P). The base case holds since Lat+(Pb , 1) = Lat+(P, 1) and Lat+(P, 0) = 0. Suppose Lat+(Pb , i−1) ≤ 2 Lat+(P, i− 2) + Lat+(P, i − 1). Then, Lat+(Pb , i) = max{Lat+(Pb , i − 1) + cdi−1si−1 + csi−1si ,Ti} + csi di ≤ max{2 Lat+(P, i − 2) + Lat+(P, i − 1)+ cdi−1si−1 + csi−1di−1 + cdi−1si ,Ti} + csi di = max{2(Lat+(P, i − 2) + csi−1di−1) + Lat+(P, i − 1) ≤ 2(cid:0)Lat+(P, i − 2) + csi−1di−1 + cdi−1si ,Ti} + csi di (cid:1) + max{Lat+(P, i − 1) + cdi−1si ,Ti} + csi di , (cid:1) where the first inequality follows from the triangle inequality and inductive hypothesis, and the second one follows from the max operator. In the last expression, note the second and last terms together are exactly Lat+(P, i). We upper bound the first term by 2 Lat+(P, i − 1): 2(cid:0) Lat+(P, i − 2) + csi−1di−1 (cid:1) ,Ti−1} ≤ max{2(cid:0)Lat+(P, i − 2) + csi−1di−1 ≤ 2(cid:0)max{Lat+(P, i − 2),Ti−1} + csi−1di−1 (cid:1) ≤ 2(cid:0)max{Lat+(P, i − 2) + cdi−2si−1 ,Ti−1} + csi−1di−1 ≤ 2 · max{Lat+(P, i − 2) + csi−1di−1 ,Ti−1} (cid:1) = 2 Lat+(P, i − 1) , where the inequalities follow directly from the definition of max operator. Therefore, it follows that Lat+(Pb , i) ≤ 2 Lat+(P, i − 1) + Lat+(P, i) , and the induction holds. □ 6 EXPERIMENTS In this section, we will present a comparison of our algorithm and a natural greedy baseline on two public datasets, viz., the Chicago taxi data5 and the NYC taxi data6. We focus on the single depot k- MLP problem with release times; we also evaluated our algorithms for the k-MLP problem without release times on the same datasets and obtained qualitatively similar results. 6.1 Datasets The Chicago dataset consists of 27 million taxi trips from 2013 to 2016, consisting of pick-up times, drop-off times, pick-up locations, drop-off locations, trip times and trip lengths. The pick-up and drop-off locations are specified in terms of Census Tracts instead of precise latitude and longitude values. For our analysis and graph construction, we cover the city using equal-sized geographical cells of size 1000-sq. meters, and map the Census Tracts to these cells. Each taxi trip is then treated as a trip between two cells. We assign pairwise distances between each pair of cells to be the driving time between centroids of each cell, computed using Google Maps API. The New York taxi dataset consists of more than 1 billion taxi trips from 2009 to 2015 with location information. We discretize the pick-up and drop-off locations of each trip to their respective 5http://digital.cityofchicago.org/index.php/chicago-taxi-data-released/ 6http://www.nyc.gov/html/tlc/html/about/trip_record_data.shtml geographical cells, and compute pairwise driving distances between all cells in New York. We randomly choose one weekday for both datasets, 7/17/2015 for Chicago and 5/31/2013 for New York, and consider all taxi rides in a one-hour (5PM to 6PM) and two-hour (5PM to 7PM) window. Also, since the datasets do not contain release-times (when the trip-request arrived), we set the release-times to be equal to the pick-up times of the requests. We also choose a random cell in each city as the depot location. Figure 2 plots a random sample of 100 taxi pick-up (white) and drop-off (red) locations in the 1-hour window for Chicago and New York. As seen from the figure, the distribution of taxi rides in Chicago is relatively more spread out. (a) New York City (b) Chicago Figure 2: Spatial distributions of random samples of 100 ride requests in New York City and Chicago. 6.2 Algorithm Implementations We first describe the natural greedy algorithm for the problem, that we use as a baseline. For each taxi that becomes idle, the greedy algorithm scans through all unassigned trip requests, and assigns the trip request with the smallest resulting finish-time. The resulting solution has at most k paths branching out from the root and we refer to such solution as a k-path solution. A path of a k-path solution will correspond to the path of a taxi. Even though our Algorithm 1 from Section 4.1 has constant approximation guarantees, it is relatively complex and hard to implement in practice. We therefore use the following practical heuristic (that we call kMLP-Fast) based on Algorithm 1 (in the sequel, n refers to the number of trip requests and k refers to the number of taxis): (1) Sort the requests in increasing order of their release times (2) Define a layer(i) solution as the greedy k-path solution con- sidering only the first 2i requests. Generate layers for i ∈ [1, 2, . . . , log(n)] where each layer i consists of at most k paths of the layer(i) solution. (3) Create a "concatenation graph" as follows: Each node in the concatenation graph corresponds to a path in a given layer. We create an edge from path Pi in layer i to path Pj in layer j for j > i, and set the edge cost as follows: e(Pi , Pj) = t ∈Pj(Lat(Pi +Pj , t)−Lat(Pj , t))+(n−2j)·length(Pj), where t indexes the requests in Pj, Pi + Pj represents the path obtained by appending Pj to Pi and removing duplicates, and length(Pj) is the traversal time of the path (which includes both waiting and driving times). Essentially, the edge cost is  Conference'17, July 2017, Washington, DC, USA Das et al. from 25 to 5. A similar trend, with the difference ranging from 6% to 13%, is observed in Chicago. The reason for the higher difference in Chicago compared to New York City might be attributed to the different demand distributions in the two cities (see Figure 2). The requests in New York are more densely concentrated in a smaller region, which helps the greedy algorithm. 6.4 Other Desiderata While the user satisfaction in terms of latency is a good character- istic of a ride sharing service, other characteristics such as the total distance covered by the taxis in the system, the efficiency of the taxi in terms of taxi idle times, the load on each taxi, etc are also good properties of any ride sharing service. We measured the per- formance of the kMLP-Fast algorithm w.r.t. these metrics. Figure 4 illustrates the relative performance of our algorithm compared to the greedy baseline. Even though the kMLP-Fast algorithm is optimized for the la- tency objective, it performs surprisingly well in minimizing the total distance a taxi travels to serve its rides. In fact, the cabs travel between 5% and 15% less on this measure. Another promising re- sult is the performance on the measure of idle time a taxi spends transitioning between rides. Here again, our algorithm performs significantly better by 15% to 35% over the greedy baseline. Finally, we measured the fairness as the coefficient of variation of the total trip lengths of taxis. A fair allocation ensures taxis are generally equally loaded, resulting in a smaller value of this measure. On this measure, the greedy algorithm under-performs in New York City while the difference is much less in Chicago. Note that the greedy algorithm tends to produce more balanced paths by its design. an upper bound on the additional latency incurred by trips in Pj and all subsequent trips in higher layers, when appending Pj to Pi. Create a dummy start node s corresponding to an empty path, and connect every node to s with edge costs computed as before. Create a finish node t and connect every path in the last layer (i = log(n)) to t, with edge cost 0. (4) Assign a capacity of 1 to each edge in the concatenation graph, and run a min-cost flow algorithm from s to t with the target flow amount k. Concatenate the paths traversed by each flow (removing duplicates) to generate the final solution. The main simplification that the kMLP-Fast algorithm performs (compared to Algorithm 1) is that it greedily defines requests for each layer by sorting them by their release times. For each layer, it then creates a k-path solution using the greedy-heuristic as a subroutine to cover all nodes in that layer. This differs from the paths obtained in Algorithm 1. Finally, the algorithm concatenates the paths across different layers using a min-cost flow algorithm (as opposed to a shortest path in the concatenation-graph, since we now work with at most k paths per layer.) 6.3 Latency Objective We compare the kMLP-Fast and greedy algorithms on the total- latency objective, which includes both the waiting time and the driving time for a request. Figure 3 illustrates the performance of the algorithm on both datasets. Note that on the y-axis, we re- port values representing the sum of the corresponding metric over all requests in the observed interval. One trend we observe in both cities is that as the number of taxis increases, our algorithm outperforms the greedy algorithm by a wider margin. Indeed, in New York City, our algorithm does better by around 5% - 8% as the average number of trips for a taxi decreases (a) New York City (b) Chicago Figure 3: Total latency of all trips in hours 05000100001500020000250003000035000510152025Total Completion Time (Hrs)Average requests per cabsGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1 hr) 02000400060008000100001200014000160001800020000510152025Completion Time (hrs)Average requests per cabGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1hr) Minimizing Latency in Online Services Conference'17, July 2017, Washington, DC, USA (a) New York City - total length in hours (b) Chicago - total length in hours (c) New York City - total idle time of cabs in hours (d) Chicago - total idle time of cabs in hours (e) New York City - balanced allocations (f) Chicago - balanced allocations Figure 4: The performance of kMLP-Fast algorithm w.r.t. other natural measures. REFERENCES [1] Hernán Abeledo, Ricardo Fukasawa, Artur Pessoa, and Eduardo Uchoa. 2013. The time dependent traveling salesman problem: polyhedra and algorithm. Mathematical Programming Computation 5, 1 (01 Mar 2013), 27–55. https: //doi.org/10.1007/s12532-012-0047-y [2] Aamena Alshamsi, Sherief Abdallah, and Iyad Rahwan. 2009. Multiagent Self- organization for a Taxi Dispatch System. In Proceedings of the 8th International Conference on Autonomous Agents and Multiagent Systems (AAMAS '09). [3] F. Angel-Bello, Y. Cardona-Valdés, and A. Álvarez. 2017. Mixed integer formula- tions for the multiple minimum latency problem. Operational Research (08 Feb 2017). https://doi.org/10.1007/s12351-017-0299-4 [4] Aaron Archer and Anna Blasiak. 2010. Improved Approximation Algorithms for the Minimum Latency Problem via Prize-collecting Strolls. In Proceedings of the Twenty-first Annual ACM-SIAM Symposium on Discrete Algorithms (SODA '10). Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 429–447. http://dl.acm.org/citation.cfm?id=1873601.1873637 [6] Sanjeev Arora and George Karakostas. 2003. Approximation Schemes for Mini- mum Latency Problems. SIAM J. Comput. 32, 5 (2003), 1317–1337. https://doi.org/ 10.1137/S0097539701399654 arXiv:https://doi.org/10.1137/S0097539701399654 [5] Aaron Archer, Asaf Levin, and David P. Williamson. 2008. A Faster, Bet- SIAM https://doi.org/10.1137/07068151X ter Approximation Algorithm for the Minimum Latency Problem. J. Comput. 37, 5 (2008), 1472–1498. arXiv:https://doi.org/10.1137/07068151X [7] Giorgio Ausiello, Stefano Leonardi, and Alberto Marchetti-Spaccamela. 2000. On Salesmen, Repairmen, Spiders, and Other Traveling Agents. Springer Berlin Heidelberg, Berlin, Heidelberg, 1–16. [8] Avrim Blum, Prasad Chalasani, Don Coppersmith, Bill Pulleyblank, Prabhakar Raghavan, and Madhu Sudan. 1994. The Minimum Latency Problem. In Proceed- ings of the Twenty-sixth Annual ACM Symposium on Theory of Computing (STOC '94). ACM, New York, NY, USA, 163–171. https://doi.org/10.1145/195058.195125 [9] Kamalika Chaudhuri, Brighten Godfrey, Satish Rao, and Kunal Talwar. 2003. Paths, Trees, and Minimum Latency Tours. In Proceedings of the 44th Annual IEEE Symposium on Foundations of Computer Science (FOCS '03). IEEE Computer Society, Washington, DC, USA, 36–. http://dl.acm.org/citation.cfm?id=946243. 946316 [10] Chandra Chekuri, Nitish Korula, and Martin Pál. 2012. Improved Algorithms for Orienteering and Related Problems. ACM Trans. Algorithms 8, 3, Article 23 (July 2012), 27 pages. https://doi.org/10.1145/2229163.2229167 [11] Chandra Chekuri and Amit Kumar. 2004. Maximum Coverage Problem with Group Budget Constraints and Applications. Springer Berlin Heidelberg, Berlin, Heidelberg, 72–83. [12] Willem E. de Paepe, Jan Karel Lenstra, Jiri Sgall, RenÃľ A. Sitters, and Leen Stougie. 2004. Computer-Aided Complexity Classification of Dial-a-Ride Prob- lems. INFORMS Journal on Computing 16, 2 (2004), 120–132. https://doi.org/10. 1287/ijoc.1030.0052 arXiv:https://doi.org/10.1287/ijoc.1030.0052 0500100015002000250030003500400045005000510152025Total Path Length (Hrs)Average requests per cabGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1 hr) 0500100015002000250030003500400045005000510152025Total Path Length (Hrs)Average requests per cabGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1hr) 05001000150020002500510152025Total Idle Time (Hrs)Average requests per cabGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1 hr) 050010001500200025003000510152025Total Idle Time (Hrs)Average requests per cabGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1hr) 00.050.10.150.20.25510152025FairnessAverage requests per cabGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1 hr) 00.050.10.150.20.250.30.35510152025FairnessAverage requests per cabGreedy (2 hr)k-MLP (2 hr) Greedy (1 hr)k-MLP (1hr) Conference'17, July 2017, Washington, DC, USA Das et al. [13] Jittat Fakcharoenphol, Chris Harrelson, and Satish Rao. 2003. The K-traveling Re- pairman Problem. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA '03). Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 655–664. http://dl.acm.org/citation.cfm?id=644108.644215 [14] Michel Goemans and Jon Kleinberg. 1996. An Improved Approximation Ratio for the Minimum Latency Problem. In Proceedings of the Seventh Annual ACM-SIAM Symposium on Discrete Algorithms (SODA '96). Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 152–158. http://dl.acm.org/citation.cfm? id=313852.313909 [15] R.L. Graham, E.L. Lawler, J.K. Lenstra, and A.H.G.Rinnooy Kan. 1979. Opti- mization and Approximation in Deterministic Sequencing and Scheduling: a Survey. In Discrete Optimization II, P.L. Hammer, E.L. Johnson, and B.H. Ko- rte (Eds.). Annals of Discrete Mathematics, Vol. 5. Elsevier, 287 – 326. https: //doi.org/10.1016/S0167-5060(08)70356-X [16] Elias Koutsoupias, Christos Papadimitriou, and Mihalis Yannakakis. 1996. Search- ing a fixed graph. Springer Berlin Heidelberg, Berlin, Heidelberg, 280–289. [17] Zhixing Luo, Hu Qin, and Andrew Lim. 2014. Branch-and-price-and-cut for the multiple traveling repairman problem with distance constraints. European Journal of Operational Research 234, 1 (2014), 49–60. https://EconPapers.repec.org/RePEc: eee:ejores:v:234:y:2014:i:1:p:49-60 [18] Isabel Méndez-Díaz, Paula Zabala, and Abilio Lucena. 2008. A New Formulation for the Traveling Deliveryman Problem. Discrete Appl. Math. 156, 17 (Oct. 2008), 3223–3237. https://doi.org/10.1016/j.dam.2008.05.009 [19] Nenad Mladenović, Dragan Urošević, and Saïd Hanafi. 2013. Variable neighbor- hood search for the travelling deliveryman problem. 4OR 11, 1 (01 Mar 2013), 57–73. https://doi.org/10.1007/s10288-012-0212-1 [20] Samuel Nucamendi-Guillén, Iris Martínez-Salazar, Francisco Angel-Bello, and J Marcos Moreno-Vega. 2016. A mixed integer formulation and an efficient metaheuristic procedure for the k-Travelling Repairmen Problem. Journal of the Operational Research Society 67, 8 (01 Aug 2016), 1121–1134. https://doi.org/10. 1057/jors.2015.113 [21] Christos H. Papadimitriou and Mihalis Yannakakis. 1993. The Traveling Salesman Problem with Distances One and Two. Math. Oper. Res. 18, 1 (Feb. 1993), 1–11. https://doi.org/10.1287/moor.18.1.1 [22] Ian Post and Chaitanya Swamy. 2015. Linear Programming-based Approximation Algorithms for Multi-vehicle Minimum Latency Problems. In Proceedings of the Twenty-sixth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA '15). Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 512–531. http://dl.acm.org/citation.cfm?id=2722129.2722164 [23] Shiyou Qian, Jian Cao, Frédéric Le Mouël, Issam Sahel, and Minglu Li. 2015. SCRAM: A Sharing Considered Route Assignment Mechanism for Fair Taxi Route Recommendations. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD '15). ACM, New York, NY, USA, 955–964. https://doi.org/10.1145/2783258.2783261 [24] Meng Qu, Hengshu Zhu, Junming Liu, Guannan Liu, and Hui Xiong. 2014. A Cost- effective Recommender System for Taxi Drivers. In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD '14). ACM, New York, NY, USA, 45–54. https://doi.org/10.1145/2623330.2623668 [25] Sartaj Sahni and Teofilo Gonzalez. 1976. P-Complete Approximation Problems. J. ACM 23, 3 (July 1976), 555–565. https://doi.org/10.1145/321958.321975 [26] Douglas O. Santos and Eduardo C. Xavier. 2013. Dynamic Taxi and Ridesharing: A Framework and Heuristics for the Optimization Problem. In Proceedings of the Twenty-Third International Joint Conference on Artificial Intelligence (IJCAI '13). AAAI Press, 2885–2891. http://dl.acm.org/citation.cfm?id=2540128.2540544 [27] Marcos Melo Silva, Anand Subramanian, Thibaut Vidal, and Luiz Satoru Ochi. 2012. A simple and effective metaheuristic for the Minimum Latency Problem. European Journal of Operational Research 221, 3 (2012), 513 – 520. https://doi. org/10.1016/j.ejor.2012.03.044 [28] René Sitters. 2002. The Minimum Latency Problem Is NP-Hard for Weighted Trees. In Proceedings of the 9th International IPCO Conference on Integer Programming and Combinatorial Optimization. Springer-Verlag, London, UK, UK, 230–239. http://dl.acm.org/citation.cfm?id=645591.660083 [29] René Sitters. 2014. Polynomial Time Approximation Schemes for the Traveling Repairman and Other Minimum Latency Problems. In Proceedings of the Twenty- fifth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA '14). Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 604–616. http: //dl.acm.org/citation.cfm?id=2634074.2634120 [30] M. Skutella. 2006. List Scheduling in Order of α-Points on a Single Machine. In Efficient Approximation and Online Algorithms. Springer, 250–291. [31] John N. Tsitsiklis. 1992. Special cases of traveling salesman and repairman problems with time windows. Networks 22, 3 (1992), 263–282. https://doi.org/10. 1002/net.3230220305 [32] Xianyuan Zhan, Xinwu Qian, and Satish V. Ukkusuri. 2014. Measuring the Efficiency of Urban Taxi Service System. In The Third International Workshop on Urban Computing (UrbComp '14). [33] Xudong Zheng, Xiao Liang, and Ke Xu. 2012. Where to Wait for a Taxi?. In Proceedings of the ACM SIGKDD International Workshop on Urban Computing (UrbComp '12). ACM, New York, NY, USA, 149–156. https://doi.org/10.1145/ 2346496.2346520 [34] Chenguang Zhu and Balaji Prabhakar. 2017. Reducing Inefficiencies in Taxi Systems. In Proceedings of the Fifty-Sixth IEEE Conference on Decision and Control (CDC '17).
1005.2211
1
1005
2010-05-12T21:33:10
Arboricity, h-Index, and Dynamic Algorithms
[ "cs.DS" ]
In this paper we present a modification of a technique by Chiba and Nishizeki [Chiba and Nishizeki: Arboricity and Subgraph Listing Algorithms, SIAM J. Comput. 14(1), pp. 210--223 (1985)]. Based on it, we design a data structure suitable for dynamic graph algorithms. We employ the data structure to formulate new algorithms for several problems, including counting subgraphs of four vertices, recognition of diamond-free graphs, cop-win graphs and strongly chordal graphs, among others. We improve the time complexity for graphs with low arboricity or h-index.
cs.DS
cs
Arboricity, h-Index, and Dynamic Algorithms Min Chih Lin ∗ Francisco J. Soulignac ∗ Jayme L. Szwarcfiter † Abstract In this paper we present a modification of a technique by Chiba and Nishizeki [Chiba and Nishizeki: Arboricity and Subgraph Listing Algorithms, SIAM J. Comput. 14(1), pp. 210 -- 223 (1985)]. Based on it, we design a data structure suitable for dynamic graph algorithms. We employ the data structure to formulate new algorithms for several prob- lems, including counting subgraphs of four vertices, recognition of diamond-free graphs, cop-win graphs and strongly chordal graphs, among others. We improve the time com- plexity for graphs with low arboricity or h-index. Keywords: data structures, dynamic algorithms, arboricity, h-index, cop-win graphs, diamond-free graphs, strongly chordal graphs. 1 Introduction We describe a variation of a technique by Chiba and Nishizeki [3], leading to a data structure for graph algorithmic problems, called the h-graph data structure. It supports operations of insertion and removal of vertices, as well as insertion and removal of edges. Although the data structure can be used for general purpose, it is particularly suitable for applications in dynamic graph algorithms. As an application of this data structure, we describe new algorithms for several graph problems, as listing cliques; counting subgraphs of size 4; recognition of diamond-free graphs; finding simple, simplicial and dominated vertices; recognition of cop-win graphs; recognition of strongly chordal graphs. We remark that no previous such dynamic algorithms exist so far in the literature. On the other hand, in some cases, there is also an improvement in time complexity (relative to static graph algorithms) for graphs of low arboricity or h-index. A dynamic data structure designed for graphs with low h-index has been first defined by Eppstein and Spiro [7]. This data structure keeps, for each graph G with h-index h, the set of vertices with degree at least h, and a dictionary that indicates the number of two-edges paths between any pair of vertices, for all those vertices at distance 2. The total size of the data structure is O(mh) bits. Using this information, the authors show how to maintain the family of triangles of G in O(h) randomized amortized time while edges are inserted or removed. The authors also show how to keep other statistics of G with this data structure. Our h-graph data structure follows a different approach. First, we store no more than the adjacency lists of G in a special format, using O(n + m) bits. Second, we do not compute the h-index of G. The ∗Universidad de Buenos Aires, Facultad de Ciencias Exactas y Naturales, Departamento de Computaci´on, Buenos Aires, Argentina. {oscarlin, fsoulign}.dc.uba.ar 20001-970 Rio de Janeiro, RJ, Brasil. [email protected] †Universidade Federal do Rio de Janeiro, Instituto de Matem´atica, NCE and COPPE, Caixa Postal 2324, 1 advantage of our data structure is that we can use to maintain the family of triangles of G in O(dh) deterministic worst case time per vertex insertion or removal, where d is the degree of the vertex. Furthermore, the time required by this algorithm when it is applied to all the vertices of the graph, so as to compute the family of triangles of G, is O(αm), where α ≤ h is the arboricity of G. The disadvantage is that we cannot longer maintain the triangles as efficiently as Eppstein and Spiro when edge operations are allowed. So, though both data structures have some similarities in their inceptions, they are better suited for different applications. In particular, our h-graph data structure allows the "efficient" examination of the subgraph of G induced by the neighborhood of an inserted or removed vertex. One of the similarities between the h-graph data structure and the data structure by Eppstein and Spiro, is that both differentiate between low and high degree vertices. The technique of handling differently vertices of high and low degree has been first employed by Alon et al. [1], and since then many other works made use of this classification (e.g. [7, 10]). However, we use a local classification on each vertex. So, some vertices can be considered as both high and low depending on the local classification of each of its neighbors. The paper is organized as follows. In the next section we introduce the notation and terminology employed. In Section 3 we discuss the technique by Chiba and Nishizeki, and its variation for dynamic graphs. The h-graph data structure is described in Section 4, together with the operations that it supports. Finally, in Section 5, we show the applicability of the h-graph data structure by solving the problems listed above. 2 Preliminaries In this paper we work with undirected simple graphs. Let G be a graph with vertex set V (G) and edge set E(G), and call n = V (G) and m = E(G). Write vw to denote the edge of G formed by vertices v, w ∈ V (G). For v ∈ V (G), represent by NG(v) the subset of vertices adjacent to v, and let NG[v] = NG(v) ∪ {v}. The set NG(v) is called the neighborhood of v, while NG[v] is the closed neighborhood of v. The edge-neighborhood of v, denoted by N ′ G(v), is the set of edges whose both endpoints are adjacent to v. Similarly, the neighborhood NG(vw) of an edge vw is the set of vertices that are adjacent to both v and w. All the vertices in NG(vw) are said to be edge-adjacent to vw. The degree of v is dG(v) = N (v), the degree of vw is dG(vw) = NG(vw), and the edge-degree of v is d′ G(v). When there is no ambiguity, we may omit the subscripts from N and d. For W ⊆ V (G), denote by G[W ] the subgraph of G induced by W , and write EG(W ) to represent E(G[W ]). As before, we omit the subscript when there is no ambiguity about G. A clique is a set of pairwise adjacent vertices. We also use the term clique to refer to the corresponding induced subgraph. The clique of size k is represented by Kk, and the graph K3 is called a triangle. We shall denote by O(nω) the time required for the multiplication of two n × n matrices. Up to this date, the best bounds on nω are n2 ≤ nω < n2.376 [5]. The arboricity α(G) of G is the minimum number of edge-disjoint spanning forests into which G can be decomposed. The h-index h(G) of G is the maximum h such that G contains h vertices of degree at least h. It is not hard to see that G(v) = N ′ δ 2 < m n − 1 ≤ α(G) ≤ h(G) ≤ √2m for every graph G, where δ is the minimum among the degrees of the vertices of G. 2 For each vertex v of a graph G, define N (v, i) = {w ∈ N (v) d(w) = i}, i.e., N (v, i) is the set of neighbors of v with degree i. Denote by L(v) the set of neighbors of v of degree at most d(v) − 1, and H(v) the set of neighbors of v of degree at least d(v), i.e., L(v) = N (v, 1) ∪ . . . ∪ N (v, d(v) − 1), and H(v) = N (v, d(v)), . . . , N (v, n − 1). We use ℓ(v) and h(v) to respectively denote L(v) and H(v). Observe that v can have at most h(G) vertices of degree at least d(v) + 1, thus h(v) ≤ h(G), and the number of nonempty sets in the family N (v, 1), . . . , N (v, d(v)) is at most 2h(G). 3 Revisiting the Approach by Chiba and Nishizeki In [3], Chiba and Nishizeki devised a new method for listing all the triangles of a graph, based on the following lemma. Lemma 1 ([3]). For every graph G, Xvw∈E(G) min{d(v), d(w)} ≤ 2α(G)m. The idea of the algorithm is simple; for each v ∈ V (G), find those z ∈ N (w) that are adjacent to v, for every w ∈ L(v)∪N (v, d(v)). (The original algorithm by Chiba and Nishizeki is slightly different, so as to list each triangle once. In particular, it requires the vertices of V (G) to be ordered by degree.) By Lemma 1, such algorithm takes O(n + α(G)m) time. At each iteration, the algorithm by Chiba and Nishizeki finds only those triangles v, w, z such that d(v) ≥ min{d(w), d(z)}. Suppose, the aim is to find all those triangles containing some vertex v. For instance, suppose we need to dynamically maintain all the triangles of G, while vertices are inserted into G, and v has been recently inserted. In this case we can find those z ∈ H(w) that are adjacent to v, for every w ∈ N (v). The total time required for computing all the triangles with this algorithm while vertices are dynamically inserted is again O(n + α(G)m), according to the next lemmas (see Section 4 for the implementation details). Lemma 2. Let e1, . . . , em be an ordering of E(G) for a graph G, and call ei = viwi. Denote by hi(v) the value of h(v) in the subgraph of G that contains the edges e1, . . . , ei, for every 1 ≤ i ≤ m. Then, m hi(vi) ≤ 4α(G)m. Xi=1 Proof. Call di(v) to the degree of v in the subgraph of G that contains only the edges e1, . . . , ei. We define two values, fi(vw) and F (vw), for every pair of vertices v and w that are useful for decomposing the values of hi. Specifically, for 1 ≤ i ≤ m, let fi(vw) =(1 0 if v = vi, w ∈ NG(v) \ {wi} and di(w) ≥ di(vi) otherwise and F (vw) =Pm i=1 fi(vw). With this definition, m Xi=1 m hi(vi) ≤ Xi=1 Xvw∈E(G) fi(vw) = Xvw∈E(G) F (vw). 3 We now prove that F (vw) ≤ 2 min{dG(v), dG(w)}. For this, suppose that dG(w)−dG(v) = k, for some k ≥ 0. By definition, if ei 6= vw is inserted before vw, then fi(vw) = 0. 6= vw is one of the last k − 1 edges inserted among those incident to w, Similarly, if ei then di(w) > dG(v) ≥ di(v), thus fi(vw) = 0. Therefore, at most dG(v) edges ei incident to w are such that fi(vw) = 1, which implies that F (vw) ≤ 2dG(v) as desired. Consequently, by Lemma 1, m Xi=1 hi(vi) ≤ Xvw∈E(G) F (vw) ≤ Xvw∈E(G) 2 min{dG(v), dG(w)} ≤ 4α(G)m. Lemma 3. For every graph G, Xvw∈E(G) h(v) ≤ 4α(G)m. Proof. The proof is similar to the one of Lemma 2. Just replace di with d in the definition of fi and follow the same proof. One of the properties about this new algorithm for computing the triangles, is that we can apply it to each vertex v so as to find all the triangles that contain v in O(d(v)h(G)) time. In Section 5.2 we also show how to count the number of some induced graphs on four vertices that contain v. The next corollaries are also relevant for the h-graph data structure to be presented. Corollary 4. Let v1, . . . , vn be an ordering of V (G), for a graph G. Denote by hi(v) the value of h(v) in the subgraph of G induced by v1, . . . , vi, for every 1 ≤ i ≤ n. Then, n Xi=1 Xw∈N (vi) hi(w) ≤ 8α(G)m. Corollary 5. For every graph G, Xv∈V (G) Xw∈N (v) h(w) ≤ 8α(G)m. 4 The h-Graph Data Structure In this section we present a new data structure, called the h-graph data structure, that is well suited for graphs with low h-index or low arboricity. The goal is to make it easier to traverse the set H(v) in O(h(v)) time, for every vertex v, while vertices and edges are dynamically inserted to and removed from the graph. Then, this data structure can be used to solve many problems by using the technique implied by Lemmas 2 and 3 and Corollaries 4 and 5, as the maintenance of triangles described in the previous section. For each vertex v, the h-graph data structure stores an object with the following data: • The degree d(v) of v, • A doubly linked list N (v) containing one object N(v, i) for each of the nonempty sets of the family {N (v, 1), . . . , N (v, d(v) − 1)} (1 ≤ i < d(v)). The members of the list N (v) are ordered so that N(v, i) appears before N(v, j) for 1 ≤ i < j ≤ d(v) − 1. 4 • A set H(v) representing H(v). • A pointer data(v), referencing an object that contains the data of v. For simplicity, we refer to H(v) as N(v, d(v) + i), and to H(v) as N (v, d(v) + i), for every i ≥ 0. That is, for every 1 ≤ i ≤ n − 1, the set N (v, i) contains the neighbors of v with degree i, while N(v, i) is the object of the data structure that contains the neighbors of v with degree i. In the data structure, each N(v, i) (1 ≤ i ≤ n − 1) is stored as a doubly linked list that contains one object for each w ∈ N (v, i), with the following data associated to the object representing w: • a pointer pos(v, w), referencing the object of N(w, d(v)) that represents v, • a pointer list(v, w), referencing the list N(w, d(v)), • a pointer node(v, w), referencing the object that represents w, and • a pointer data(v, w), referencing an object that contains the data of vw. Note: both data(v, w) and data(w, v) reference the same object. Observe that the space required for the h-graph is O(n + m) bits. The h-graph data structure provides the set of basic operations described below. Inside the parenthesis we show one value (x) or two values (x, y). The value x is the time required when the operation is applied once, while y is the time required when the operation is applied once for each vertex or edge. (We assume m > n.) For instance, the insertion of one vertex takes O(dh) time, while the iterative insertion of the n vertices takes O(αm). Here d = d(v), h = h(G) and α = α(G). • vertex insert: (O(dh), O(αm)). inserts a new vertex v into G with a specified neighborhood N (v) • vertex remove: removes a vertex v from G (O(dh), O(αm)). • edge insert: inserts a new edge vw into G (O(h), O(αm)). • edge remove: removes an edge vw from G (O(h), O(αm)). • adjacent: queries if two vertices v and w are adjacent (O(h)). • H: returns the set H(v) for a vertex v (O(1)). • N′: returns the set N ′(v) for a vertex v (O(dh), O(αm)) • G[N()]: returns the adjacency lists of the graph G[N (v)] for a vertex v (O(dh), O(αm)). The implementation of H is trivial. We discuss the other operations below. In the following sections we show several algorithms that work on the h-graph data structure. 5 The insertion of vertices and edges. The algorithm for inserting a new edge vw into G is straightforward. In a first phase, update the families N (z) for every z ∈ N [v] ∪ N [w]. For this, create the set N(v, dG(v)), move the vertices with degree dG(v) from H(v) to N(v, dG(v)), and move v from N(z, dG(v)) to N(z, dG(v)+ 1), for every z ∈ H(v). Next, apply the analogous operations for w. The second phase is to actually insert the edge vw. For this, insert v at the end of N(w, dG(v) + 1) and w at the end of N(v, dG(w) + 1), update the values of d(v) and d(w), and create the pointers pos, list, node, and data for vw. Discuss the time complexity of the above algorithm. For the first phase, apply Algorithm 1 twice, once for v and once for w. Recall that this algorithm is applied before incrementing d for v and w, thus d(z) is the degree of z before the insertion of vw. Note that each iteration of the main loop can be implemented so as to run in O(1) time, by using the pointers in the data structure. Thus, the update of N (z), for every z ∈ N [v] ∪ N [w], takes O(h(v) + h(w)) time. Algorithm 1. Update of N (z) for every z ∈ N [v]. 1. Insert a new empty set N(v, d(v)) at the end of N (v). 2. For each z ∈ H(v): 3. If d(z) = d(v), then move z from H(v) to N(v, d(v)). 4. Move v from N(z, d(v)) to N(z, d(v) + 1). If N(z, d(v)) = ∅, then delete N(z, d(v)). 5. If N(v, d(v)) = ∅, then delete N(v, d(v)). For the second phase, traverse the family N (w) until the first set N(w, d) with d > dG(v) is reached. Then, create the set N = N(w, dG(v) + 1), if d > d(v) + 1, and insert v into N. Next, traverse N (v) so as to find the set that must contain w, and insert w. Recall that there are at most 2h(G) sets inside each of N (v) and N (w). So, the time required by these steps is O(min{d(v), d(w), h(G)}), while the creation of the pointers and the increase of d take O(1) time. Therefore, the insertion of vw requires time O (min{d(v), d(w), h(G)} + h(v) + h(w)) = O(h(G)) The insertion of a new vertex v is simple. First, insert v as an isolated vertex, and then add the edges vw, for each w ∈ N (v). The time required is O(1 + d(v)h(G)). If we use the above algorithm for building G from scratch, then the total time is O(n + α(G)m), by Lemma 2. Corollary 6. The time required for inserting the vertices and edges of a graph G, one at a time in no particular order, into an initially empty h-graph data structure is O(n + α(G)m). Proof. The insertion of the n vertices takes O(n) time. Let e1, . . . , em be an ordering of E(G), and call di(v) and hi(v) to the values of d(v) and h(v) in the graph prior the insertion of ei. By the analysis above, the time required for the insertion of ei = vw is Thus, by Lemmas 1 and 2, the total time required for the insertion of all the edges is O(min{di(v), di(w)} + hi(v) + hi(w)). Xvw∈E(G) O(min{di(v), di(w)}) + Xvw∈E(G) O(hi(v) + hi(w)) = O(α(G)m) 6 The removal of vertices and edges. For the removal of an edge vw, we should undo the insertion process. But this time, we first undo the second phase, and then we undo the first phase. To undo the second phase we need to physically remove the edge vw. Suppose that dG(v) ≤ dG(w), i.e., w ∈ H(v). Traverse H(v) so as to locate and remove the object that represents w in H(v). By using the pos and list pointers, we can easily remove v from N(w, dG(v)) in O(1) time. Since v has h(v) neighbors in H(v), this phase takes O(h(v)) = O(h(G)) time. To undo the first phase, we need to update the families N (z) for every z ∈ NG(v) ∪ NG(w). For this, we move v from N (z, dG(v)) to N (z, dG(v) − 1) for every z ∈ HG(v), and then we remove N(v, dG(v) − 1) from N (v) so as to append it to H(v). Note that in this step we should update all the list pointers of the vertices in N(v, dG(v) − 1) so as to reference H(v). Next, we should apply the same operations for w. This phase is rather similar to the one for edge insertion and it also takes time O(hG\{vw}(v) + hG\{vw}(w)) = O(h(G)). As before, we can remove a vertex v by removing all its incident edges first, and the object representing v later. The time required by this operation is again O(1 + d(v)h(G)). Finally, if we use the above algorithm for decomposing G, then the time required for removing all the edges is O(n + α(G)m), by Lemma 2. Corollary 7. The time required for removing the vertices and edges of a graph G, one at a time and in no particular order, from an h-graph data structure is O(n + α(G)m). Adjacency query. Querying whether two vertices v and w are adjacent takes O(h(v) + h(w)) = O(h(G)) time. Simply traverse the set H(z) for z ∈ {v, w} with minimum degree. Edge-neighborhoods and their induced subgraphs. To compute the set N ′(v) for a vertex v, first mark each z ∈ N (v) with 1. Following, traverse each z ∈ H(w) for every w ∈ N (v) and, if z is marked with 1, then insert it into N ′(v) and mark it with 2. Since each w is traversed in O(h(w)) = O(h(G)) time, this algorithm takes O(d(v)h(G)) time. Furthermore, the time required to find {N ′(v)}v∈V (G), by applying this algorithm to all the vertices in the graph, is O(α(G)m), by Corollary 5. Clearly, the subgraph of G induced by N (v) is just the graph whose vertex set is N (v) and whose edge set is N ′(v). Thus, the graph G[N (v)], implemented with adjacency lists, can be computed in O(d(v)h(G)) time, while the family {G[N (v)]}v∈V (G) can be computed in O(α(G)m) time. 5 Applications In this section we list several problems that can be improved by using the technique implicit in Lemma 2 and Corollary 4. These algorithms build upon the h-graph data structure, and serve as examples of its applicability. One of the most appealing aspects of some of these algorithms is that they are simple to obtain from the problems' definitions. 5.1 Listing the Cliques of a Vertex In [3], Chiba and Nishizeki devised an algorithm for listing all the Kk's of a graph, for a given k ∈ N. Conceptually, their algorithm computes all the Kk−1's in the subgraph of G induced 7 by N (v), and it outputs v plus these cliques, for every v ∈ G. (Again, some ordering of the vertices is required so as to avoid repetitions.) This algorithm can be translated to find all the Kk's that contain a given vertex v. First, compute G′ = G[N (v)] in O(d(v)h(G)) time, as in Section 4. Then, apply the algorithm by Chiba and Nishizeki that lists the Kk−1's of G′ in O(V (G′) + (k − 1)α(G′)k−1E(G′)) time. Note that E(G′) ≤ Xw∈N (v) ≤ Xw∈N (v) min{d(v), d(w)} ≤ d(w) + Xw∈N (v) d(w)≤h(G) d(w)>h(G) d(v) = O(d(v)h(G)), thus the time required to find all the Kk's that contain v is O(cid:16)d(v)h(G) + V (G′) + kα(G′)k−1E(G′)(cid:17) = O(cid:16)kd(v)h(G)α(G)k−1(cid:17) . Also, the total time required for listing all the cliques, by iteratively executing the above algorithm for each vertex v (and then removing v), is O n + α(G)m + kα(G)k−1 Xv∈V (G) Xw∈N (v) min{d(v), d(w)}  = O(cid:16)n + kα(G)km(cid:17) matching the time complexity of the algorithm by Chiba and Nishizeki. 5.2 The 4-Subgraph Counting Problem The 4-subgraph counting problem is the problem of counting how many copies of some graph H on four vertices appear as induced subgraphs of a given graph G. The connected graphs on four vertices are six: the complete graph K4, the diamond K4 \ {e} for e ∈ E(K4), the square C4, the path P4, the paw P3 ∪ K1, and the claw K3 ∪ K1. The disconnected graphs on four vertices are five: K4, K4 \ {e}, C4, P3 ∪ K1, and K3 ∪ K1. In [10], Kloks et al. showed a system of linear equations that solves the 4-subgraph counting problem for connected graphs. Specifically, Kloks et al. proved the following theorem. Theorem 8 ([10]). Let H be a connected graph on four vertices such that there is an O(t(G)) time algorithm counting the number of induced H's in a graph G. Then, there is an O(nω + t(G)) time algorithm counting the number of induced H's of G for all connected graphs H on four vertices. Since the number of K4's can be computed in either O(n + m(ω+1)/2) = O(n + m1.61) or O(n + α(G)2m) time [3, 10], solving the 4-subgraph counting problem for connected graphs takes O(nω + min{m1.61, α(G)2m}) time. This result can be improved with a new system of linear equations that solves the 4-subgraph counting problem in O(n + α(G)m + t(G)) time, even for disconnected graphs. By using the algorithm in [3] for counting the number of K4's, an O(n + min{m1.61, α(G)2m}) time algorithm is obtained. The system of linear equations appears in the proof of the next theorem. 8 Theorem 9. Let H be a graph on four vertices such that there is an O(t(G)) time algorithm counting the number of induced H's in a graph G. Then, there is an O(n + α(G)m + t(G)) time algorithm counting the number of induced H's of G for every graph H on four vertices. Proof. Let k, d, s, p, q, and y denote the number of induced K4's, diamonds, squares, P4's, paws, and claws in G, respectively Similarly, let ¯k, ¯d, ¯s, ¯q and ¯y be the number of induced complements of K4's, diamonds, squares, paws, and claws in G, respectively. Define m = (cid:0)n 2(cid:1) − m, d(v) = n − d(v) − 1 for v ∈ V (G), and δ(v, w) = d(v) − d(vw) for vw ∈ E(G). That is, m is the number of edges of G, d(v) is the degree of v in G, and δ(v, w) is the number of vertices that are adjacent to v and not w. Finally, let S be the set obtained after executing the algorithm C4 in [3]. In S, each element is a triple (v, w, L) where v, w ∈ V (G) and L is a set of vertices. Then, G fulfills the following system of linear equations. δ(v, w)δ(w, v) = 4s + p 2 (cid:19)(cid:19) = q + 3y 2 (cid:19) = 3k + d + s 2 (cid:19) = 6k + d X(v,w,L)∈S(cid:18)L Xvw∈E(G)(cid:18)d(vw) Xvw∈E(G) Xvw∈E(G)(cid:18)(cid:18)δ(v, w) 2 (cid:19) +(cid:18)δ(w, v) Xvw∈E(G)(cid:18)d(v) + d(w) − d(vw) − 2 Xv∈V (G) Xv∈V (G)(cid:18)d(v) (cid:18)m 2(cid:19) − Xv∈V (G)(cid:18)d(v) 2 (cid:19) = 3k + 2d + 2s + p + q + ¯s 2 (cid:19) = s + p + 3¯k + 2 ¯d + 2¯s + ¯q 2(cid:19) − Xv∈V (G)(cid:18)d(v) (cid:18)m (cid:18)n 4(cid:19) = k + d + s + p + q + y + ¯k + ¯d + ¯s + ¯q + ¯y 2 (cid:19) = 6k + 5d + 4s + p + 3q + 3y d′(v)(n − 3) = 12k + 6d + 3q + 3¯y 2 (cid:19)(n − 3) = 12k + 8d + 4s + 2p + 5q + 3y + ¯q + 3¯y (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Equations (2) -- (4) correspond to the first, third and fifth equations of [10], respectively. For the translation between them, observe that if A is the adjacency matrix of G and C is the adjacency matrix of the complement of G, then A2 v,w = d(vw) and ACv,w = δ(v, w). Thus, G satisfies these equations [10]. Each triple of S represents a set of non induced cycles of G in the following way. Let v1, . . . , vn be an ordering of V (G) in non increasing order of degree. Then (vi, vj, L) is a triple of S if and only if i < min{j, k, l}, L ⊂ N (vi) ∩ N (vj) and L > 2. Therefore, (cid:0)L 2(cid:1) counts the number of non induced 4-length cycles that contain vi and vj and such that vivj is not an 9 edge of the cycle. Such cycles count three times each K4, and once each diamond and each square. Thus, (1) is fulfilled by G. The remaining equations follow analogously, by observing that: (5) counts, for each edge vw, the number of pairs of vertices that are adjacent to at least one of v and w; (6) counts, for each vertex v, the number of triangles of v plus one vertex; (7) counts those graphs on four vertices where v has degree at least 2; (8) and (9) count the number of pair of disjoint edges on G and G, respectively; and (10) counts the number of induced graphs on 4 vertices of G. These 10 equations are linearly independent, and by fixing the number of subgraphs H we can solve the whole system. As for the time complexity of computing the constant terms of the system, algorithm C4 takes O(n + α(G)m) time [3]; d′ = N ′ is found in O(n + α(G)m) time; the degrees of the edges and δ are found in O(n + α(G)m) by traversing all edge- neighborhoods; and all the terms in (7) -- (10) are computed in O(n + m) time. We now consider a slight modification of the 4-subgraph counting problem. Given a vertex v, the goal is to count the number of graphs on 4 vertices that contain v. We focus our attention on four types of connected graphs: K4's, diamonds, paws, and claws. For i ∈ {1, 2, 3}, define ki(v), di(v), qi(v), and yi(v) as the number of K4's, diamonds, paws, and claws that contain a given vertex v, where the degree of v in such an induced subgraph is i. In the previous section we saw that k3(v) can be computed in O(d(v)h(G)α(G)) time. The following theorem shows that we can compute di(v), qi(v), and yi(v), once k3(v) is given. Theorem 10. There is dynamic graph data structure, consuming O(n + m) space, with the following properties: • Both the insertion and the removal of a vertex v take O(d(v)h(G)) time. • The time required for inserting the vertices of G, one at a time, into an initially empty instance of the data structure is O(n + α(G)m). • Given k3(v), the values of di(v), qi(v), and yi(v) can be found in O(d(v)h(G)) time, for every v ∈ V (G) and i ∈ {1, 2, 3}. • If k3(v) is given for every v ∈ V (G), then the number of diamonds, paws, and claws can be found in O(n + α(G)m) time. Proof. Fix a vertex v and let ki = ki(v), di = di(v), qi = qi(v), and yi = yi(v), for i ∈ {1, 2, 3}. Define δ as in Theorem 9. Then, v fulfills the following system of linear equations. 2 (cid:19) − 3k3 d(vw)δ(v, w) − 2d3 (d′(w) − d(vw)) − 3k3 − 2d2 d2 = Xwz∈N ′(v) q2 = Xw∈N (v) (d(wz) − 1) − 3k3 d(vw)δ(w, v) − 2d2 d3 = Xw∈N (v)(cid:18)d(vw) 2q3 = Xw∈N (v) q1 = Xw∈N (v) 3y3 = Xw∈N (v)(cid:18)δ(v, w) 2 (cid:19) − q3 y1 = Xw∈N (v)(cid:18)δ(w, v) 2 (cid:19) − q1 These equations are similar to those in Theorem 9, e.g., (cid:0)d(vw) vertices x, z that are both adjacent to v and w, thusPw∈N (v)(cid:0)d(vw) 2 (cid:1) counts the number of pairs of 2 (cid:1) counts three times each 10 K4 that contains v, and one time each diamond that contains v with degree 3. The other equations follow analogously. The dynamic data structure is just the h-graph data structure with the addition that d(wz) is stored in data(w, z), for every edge wz. This value can be easily updated in O(d(v)h(G)) time when a vertex v is either inserted or removed. Indeed, according to whether v is inserted or removed, we can increase or decrease in 1 the value of d(wz) for every wz ∈ N ′(v) with a single traversal of N ′(v). On the other hand, the value of d(vw) is simply the degree of w in G[N (v)], for every w ∈ N (v). Then, the values of di(v), qi(v), and yi(v) can be obtained in O(d(v)h(G)) time by solving the system of equations above, once k3(v) is given. Furthermore, by solving the above equations for all the vertices, we can compute the number of diamonds, paws, and claws can be found in O(n + α(G)m) time, by Corollary 5. 5.3 Dynamic Recognition of Diamond-Free Graphs Recall that the graph that is obtained by removing one edge from a complete graph of four vertices is called a diamond. A diamond-free graph is a graph that contains no induced diamond. Diamond-free graphs appear in many contexts; for example in the study of perfect graphs [4, 9, 18]. In [10], Kloks et al. showed how to find an induced diamond in O(m3/2 + nω) time, if one exists. The fast matrix multiplication algorithm is used in one of the steps of this algorithm, which explains why nω is a term of the complexity order. However, the fast matrix multipli- cation can be avoided while improving the time complexity to O(m3/2) time, as it is shown by Eisenbrand and Grandoni [6]. Talmaciu and Nechita [17] devised a recognition algorithm based on decompositions, but they claim that in the worst case the time required by their algorithm is not better than the one by Kloks et al. Note that Theorem 9 implies that there is an O(α(G)2m) time algorithm for recognizing whether a graph is a diamond-free graph, improving over the previous algorithms for some sparse graphs. Finally, Vassilevska [19] used the algorithm by Eisenbrand and Grandoni to find an induced Kk \ e in a graph. A Kk \ e is a complete graph on k vertices, minus one edge. For every even k, the algorithm by Vassilevska takes O(cid:0)d(n, m)m(k−4)/2(cid:1) time, where d(n, m) is the time required to find a diamond in a graph with n vertices and m edges. Thus, this algorithm is implicitly improved with each improvement on d(n, m). The algorithm by Kloks et al. is based on the fact that a graph G is diamond-free if and only if G[N (v)] is a disjoint union of maximal cliques, for every v ∈ V (G). Testing whether a graph is a disjoint union of cliques takes linear time, and we saw in Section 4 how to compute the family {G[N (v)]}v∈V (G) in O(α(G)m) time. Therefore, by using the h-graph data structure, the algorithm by Kloks et al. can be implemented so as to run in O(α(G)m) time, improving over the algorithm by Eisenbrand and Grandoni and the algorithm implied by Theorem 9. In this section we develop a dynamic data structure for maintaining diamond-free graphs. This data structure can also be used to find an induced diamond of a static graph G in O(α(G)m) time, if one exists. As a by-product, the data structure can be used to query the maximal cliques of the dynamic diamond-free graph in constant time. The data structure is based on this well known theorem about diamond-free graphs. Theorem 11. A graph is a diamond-free graph if and only if every edge belongs to exactly one maximal clique. 11 An h-graph data structure is used to represent a diamond-free graph G. Also, the family of non singleton cliques of G is stored in the dynamic diamond-free data structure. Each non singleton clique is in turn implemented as the set of edges that belong to the clique. Also, the pointer data(vw) references the unique clique Cvw of the family that contains vw, for every vw ∈ E(G). Finally, each clique C is associated with a counter c(C) that is initialized to 0. The purpose of c(C) is to count the number of neighbors of v inside C, when a vertex v is inserted into G. We are now ready to discuss the operations allowed by the data structure. Suppose first that G is a diamond-free graph and v 6∈ V (G) is to be inserted into G. Vertex v is given with its neighborhood set N (v), which also defines its edge-neighborhood N ′(v). Say that v is edge-adjacent to a clique C of G when E(C) ∩ N ′(v) 6= ∅, while v is fully edge-adjacent to C when E(C) ∩ N ′(v) = E(C). The following theorem shows how to insert v into G. Theorem 12. The graph G∪{v} is diamond-free if and only if the following two statements hold for every maximal clique C to which v is edge-adjacent. 1. v is fully edge-adjacent to C, and 2. if v is edge-adjacent to a maximal clique C ′ 6= C, then V (C ′) ∩ V (C) = ∅. Proof. If v is not fully edge-adjacent to C, then there is some vertex u ∈ C which is not adjacent to v. Since v is edge-adjacent to C, then there is an edge wz ∈ N ′(v) ∩ E(C). But then, u, v, w, z induce a diamond in G. Suppose now that v is edge-adjacent to a maximal clique C ′ 6= C that contains some vertex u ∈ C. Since C and C ′ are maximal cliques, it follows that there is some vertex w ∈ C which is not adjacent to a vertex z ∈ C ′. Thus, u, v, w, z induce a diamond. For the converse, suppose that G ∪ {v} is not a diamond-free graph. Since G is diamond- free, then there are three vertices u, w, z such that together with v induce a diamond in G. If u and v are not adjacent, then u, w, z belong to some maximal clique C of G. Since v is adjacent to w, z but not to u, we obtain that v is edge-adjacent but not fully edge-adjacent to C. So, we may assume that v is adjacent to u, w, z, and that w and z are not adjacent. But then, uw and uz belong to different maximal cliques C and C ′. Thus, v is edge-adjacent to C and C ′ and u ∈ V (C) ∩ V (C ′). Algorithm 2, which is obtained from Theorem 12, can be used to decide whether G ∪ {v} is a diamond-free graph. Algorithm 2. Insertion of a vertex v into a diamond-free graph G 1. Remove the mark from every w ∈ V (G). 2. For each maximal clique C of G to which v is edge-adjacent: 3. If v is not fully edge-adjacent to C, then output "G ∪ {v} is not diamond-free." 4. For each maximal clique C of G to which v is edge-adjacent: 5. If there is some marked w ∈ C, then output "G ∪ {v} is not diamond-free." Otherwise, mark every w ∈ C. 6. Output "G ∪ {v} is a diamond-free graph". 12 Observe that after G∪{v} is claimed to be a diamond-free graph in Step 6, all the vertices of every edge-adjacent maximal clique C have a mark, and every vertex w ∈ C was traversed and marked only once. Then, v is fully-adjacent to C and no vertex of C belongs to other clique to which v is edge-adjacent. Therefore, by Theorem 12, the algorithm is correct. Discuss the implementation of Algorithm 2. The input of the algorithm is formed by the graph G, the vertex v, and the set N (v) of neighbors of v in G. The first step is to insert v into the h-graph data structure of G in O(d(v)h(G)) time. We consider that w is marked if and only if data(vw) 6= N U LL. Hence, Step 1 of the algorithm is executed in O(d(v)) time, by traversing once the set N (v) to initialize data(vw). Before traversing each edge-adjacent maximal clique in Steps 2 and 4, we compute N ′(v), in O(d(v)h(G)) time, as in Section 4. The family C = {Cwz}wz∈N ′(v) is computed by iteratively inserting Cwz into C, for every wz ∈ N ′(v). While C is generated, N ′(v) ∩ E(Cwz) can be computed by increasing c(Cwz) by 1 when wz is first traversed. This operation takes O(1) time per wz ∈ N ′(v), thus it takes O(d(v)h(G)) total time. Once C is computed, each maximal clique C ∈ C is traversed. If c(C) = N ′(v)∩E(C) 6= E(C), then v is not fully edge-adjacent to C and the algorithm stops with a failure message in Step 3. Otherwise, every maximal clique C ∈ C has to be traversed once again to update data(vw) so as to reference Cvw, for every w ∈ C. Instead of doing this, we traverse N ′(v) and, for every edge wz, we set data(vw) and data(vz) to point to Cwz, because v is fully adjacent to Cwz. If when updating Cvw (resp. Cvz) to point to C we discover that Cvw (resp. Cvz) points to C ′ with C 6= C ′, then the algorithm stops in failure as in Step 5. If Cwz is maintained together with wz in N ′(v), then each edge gets traversed in O(1) time. Thus, the time complexity of both loops is O(d′(v)) = O(d(v)h(G)). After the main loops are completed, the algorithm claims that G ∪ {v} is a diamond-free graph. Before another vertex can be inserted, the data structure that represents G has to be updated into a data structure that represents G ∪ {v}. The set of edges {vw w ∈ N (v)} can be split into two types. Those whose pointer data references some maximal clique of G and those whose data is still N U LL. For those edges that reference some maximal clique, the edge has to be inserted into Cvw. For those edges vw with data = N U LL, a new clique has to be created that contains only the edge vw. This clique has to be inserted to the set of maximal cliques of G ∪ {v} and data(vw) has to be updated accordingly. All this can be done in O(d(v)) time. Finally, c(C) has to be updated to 0 for every C ∈ C, again in O(d′(v)) = O(d(v)h(G)) time. Therefore, the insertion of a new vertex takes O(d(v)h(G)) time as desired. Observe that if G ∪ {v} is a diamond-free graph, then its family of maximal cliques is obtained in O(1) time and the maximal clique to which an edge vw belongs can be queried in O(1) time. Algorithm 2 can also be modified so as to output an induced diamond in O(d(v)h(G)) time, when G ∪ {v} is not diamond-free. Consider the two alternatives for the algorithm to stop in failure. First, if v is not fully edge-adjacent to C ∈ C, then there is some vertex w ∈ C that is not adjacent to v. In this case, v, w and the endpoints of an edge in N ′(v)∩ C induce a diamond. To find w, traverse the edges of C and query if each endpoint is adjacent to v. (For this step, we may use the marks used in the computation of N ′(v), or we may re-compute them with a single traversal of N (v).) The first vertex that is not adjacent to v is taken as w. To find an edge in N ′(v) ∩ C, traverse N ′(v) until some edge of C is reached. Thus, the certificate in this case can be found in O(d′(v)) time. The second reason for the algorithm to stop in failure is that v is fully edge-adjacent to C and C ′, and vw is marked with C ′ while trying to mark it with C 6= C ′. In this case, we ought to find two non 13 adjacent vertices of C ∪ C ′. As in the proof of Theorem 12, these two vertices together with v and w induce a diamond. To find these two vertices observe that w is the unique vertex in C ∩ C ′ and that all the vertices of C \{w} are not adjacent to the vertices of C ′ \{w}. Thus, the two non adjacent vertices of C ∪ C ′ can be found in O(1) time by traversing at most one edge of both C and C ′. The dynamic data structure supports also the removal of vertices and the insertion and removal of edges. For the removal of a vertex v, note that G \ {v} is always a diamond-free graph. Thus, all we need to do is to remove v from the h-graph data structure, and to remove vw from Cvw, for every w ∈ N (v). As explained in Section 4, the former operation takes O(d(v)h(G)) time, while the latter takes O(d(v)) time. With respect to the insertion of an edge vw, graph G ∪ {vw} is diamond-free if and only if N (v) ∩ N (w) ≤ 1 and, if there is some z ∈ N (v) ∩ N (w), then dG(vz) = dG(wz) = 0. We can compute N (v) ∩ N (w) in O(d(v) + d(w)) time, while, for z ∈ N (v) ∩ N (w), we can access data(vz) and data(wz) in O(1) time so as to see whether these maximal cliques have exactly one edge. If so, the maximal cliques Cvz and Cwz need to be merged, again in O(1) time. Thus, the insertion of vw takes O(d(v) + d(w)) time. Finally, for vw ∈ E(G), the graph G\{vw} is diamond-free if and only if d(vw) ≤ 1, i.e., if Cvw has at most three edges. If d(vw) = 1, then Cvw has to be split into two maximal cliques of G \ {vw} in O(1) time. Therefore, the removal of an edge takes O(min{di(v), di(w)} + hi(v) + hi(w)) because we need to remove vw from the h-graph data structure. Finally, the diamond-free data structure can be used to test whether a graph G is diamond- free, just by iteratively inserting the vertices of G into the data structure. At each step, the operations of greater complexity are the insertion of the new vertex into the h-graph data structure, and the computation of N ′(v). As we have discussed in Section 4, the total time cost for these operations is O(α(G)m). Thus, this algorithm runs as fast as the improvement of the algorithm by Kloks et al. discussed before. 5.4 Simple, Simplicial, and Dominated Vertices of Dynamic Graphs A vertex v is dominated by a vertex w if N [v] ⊆ N [w]. Equivalently, v is dominated by w ∈ N (v) if d(v) − d(vw) = 1. We say that v and w are comparable if either v is dominated by w or w is dominated by v. If v is dominated by all its neighbors, then v is a simplicial vertex, while if v is a simplicial vertex and every pair of neighbors are comparable, then v is a simple vertex. In [10], Kloks et al. showed how to compute the set of simplicial vertices in O(n + m2ω/(ω+1)) = O(n + m1.41) time, using the fast matrix multiplication algorithm. With the h-graph data structure, we can find all the simple, simplicial, and dominated vertices in O(α(G)m) time, as follows. First, find the degree d(vw) for every vw ∈ E(G) in O(n+α(G)m) time, as discussed in Section 4. Next, for each vertex v, find the set of vertices D(v) that dominate v, by testing whether d(v) − d(vw) = 1, for every w ∈ N (v). Clearly, if D(v) 6= ∅, then v is a dominated vertex, while if D(v) = d(v), then v is a simplicial vertex. To de- termine if a simplicial vertex v is simple, it is enough to check whether z ∈ D(w), for each edge wz ∈ N ′(v) with d(w) ≤ d(z). As discussed in Section 4, we can traverse all the edge- neighborhoods N ′(v) in O(α(G)m) time, thus simple, simplicial, and dominated vertices can be found in O(α(G)m) time. In this section, we show how can the h-graph data structure be used to maintain the simple, simplicial, and dominated vertices, while vertices are inserted to or removed from a 14 dynamic graph. Let G be a graph implemented with the h-graph data structure, where d(wz) is stored in data(w, z) for every edge wz, and let D be the family of dominated vertices. Suppose that a new vertex v with neighborhood N (v) ⊆ V (G) is to be inserted into G, and that we want to update D so as to store the dominated vertices of G ∪ {v}. The next lemma shows how to find the new dominated vertices. Lemma 13. A vertex w 6= v is dominated in H = G∪ {v} if and only if one of the following statements is true: H(v). • w 6∈ N (v) and w is dominated in G, • dH (w) − dH (vw) = 1, or • dH (w) − dH (wz) = 1, for some wz ∈ N ′ The first step is to insert v into G and to compute d(vw) for every w ∈ N (v). Both steps take O(d(v)h(G)) time, as discussed in Section 4 and Theorem 10. Next, we update the set D. By the lemma above, we need not consider the vertices outside N (v). To find those w ∈ N (v) that are dominated by v, we traverse N (v) while checking whether d(w)−d(vw) = 1. Next, we find all the other dominated vertices, by checking the values of d(w)−d(wz) and d(z)−d(wz), for every wz ∈ N ′(v). Finally, we remove from D those neighbors of v that are not longer dominated, and we insert v if there is some w such that d(v) − d(vw) = 1. Since N ′(v) is computed in O(d(v)h(G)) time, the whole procedure takes O(d(v)h(G)) time. A similar procedure can be used to update the family S of simplicial vertices of G when v is inserted into G. In this case, the simplicial vertices are found as in the next lemma. Lemma 14. A vertex w 6= v is simplicial in H = G ∪ {v} if and only if one of the following statements is true: • w 6∈ N (v) and w is simplicial in G, or • w is simplicial in G, and d(w) − d(vw) = 1. Again, begin with the insertion of v into G and the computation of d(vw) for every w ∈ N (v), in O(d(v)h(G)) time. In this case, we update S by first traversing each w ∈ N (v) and checking whether w ∈ S and d(w) − d(vw) = 1. On the other hand, we insert v into S if and only if d(v) − d(vw) = 1 for every w ∈ N (v). The time required by these operations is O(d(v)), once v was inserted into G. Thus, the update of S takes O(d(v)h(G)) time. Updating the family Q of simple vertices is not as simple as updating the families D and S. The reason is that we can no longer skip the vertices outside N (v). To provide an efficient update of Q, we store in data(x), for each vertex x, the number µ(x) of edges wz ∈ N ′(x) such that w and z are not comparable. So, x is simple if and only if x is simplicial and µ(x) = 0. We can find out the value of µ(v) in O(d(v)h(G)) time, by traversing every wz ∈ N ′(v) and checking whether min{d(w), d(z)} − d(wz) = 1. The update of all the other values of µ is based on the following lemma. Lemma 15. Two vertices w and z of G are comparable in G ∪ {v} if and only if they are comparable in G and either {w, z} ⊆ N (v) or {w, z} ∩ N (v) = ∅. The update of µ(x) for every x 6= v is done as in Algorithm 3. 15 Algorithm 3. Update of µ after the insertion of v. 1. For each w ∈ N (v): 2. For each z ∈ H(w): 3. 4. 5. If z 6∈ N (v), dG(w) − dG(wz) = 1 and dG(z) − dG(wz) > 1, then: {w and z were comparable before inserting v, but now they are not} Set µ(x) = µ(x) + 1, for every x ∈ N (wz). Algorithm 3 requires O(m) time in the worst case. However, suppose that Algorithm 3 is iteratively executed for computing the simple vertices as in Algorithm 4. In such an algorithm, the condition of the inner loop of Algorithm 3 is executed at most once for each edge wz. Indeed, if w and z are not comparable prior the insertion of v, then they are not comparable after the insertion of v. On the other hand, when wz meets the condition of the inner loop, we know that dG(w) ≤ dG(z). Hence, as discussed in Section 4, the time required by Algorithm 4 is O(n + α(G)m) for the update of the h-graph data structure and d(vw), and O n + Xwz∈E(G) min{d(v), d(z)}  = O(n + α(G)m) for the update of µ. Algorithm 4. Iterative update of µ for a graph G. 1. Let v1, . . . , vn be an ordering of V (G), and G′ be an empty graph. 2. For i = 1, . . . , n: insert vi into G′ while executing Algorithm 3. As a corollary, we obtain that the simple, simplicial, and dominated vertices of G can be found in O(n + α(G)m) time. The process for updating the sets of simple, simplicial, and dominated vertices when a vertex is removed is similar. When v is removed, again we should not consider those vertices outside N (v) for the update of D and S. A vertex in N (v) is dominated in G\{v} if, in G\{v}, d(w)− d(wz) = 1 for some z ∈ H(w), while it is simplicial in G \ {v} if L(w) = ∅ and d(w) − d(wz) = 1 for every z ∈ H(w). Thus, we can update D and S in O(d(v)h(G)) time. Finally, we can update µ in O(m) time when v is removed by applying Algorithm 5, which is the inverse of Algorithm 3. Algorithm 5. Update of µ after the insertion of v. 1. For each w ∈ N (v): 2. For each z ∈ H(w): 3. 4. 5. If z 6∈ N (v), dG(w) − dG(wz) = 2 and dG(z) − dG(wz) > 1, then: {w and z were not comparable before inserting v, but now they are} Set µ(x) = µ(x) − 1, for every x ∈ N (wz). 16 The removal operations can be used to improve the best known algorithm for the recog- nition of cop-win and strongly perfect graphs, for sparse graphs. A cop-win order of a graph G is an ordering v1, . . . , vn of V (G) such that vi is dominated in the subgraph induced by vi, . . . , vn, for 1 ≤ i ≤ n. A graph that admits a cop-win order is a cop-win graph. The cop-win name comes from the fact that cop-win graphs are precisely the graphs in which a cop can always catch the robber in a pursuit game [11]. This class has been introduced in [12], cf. [2]. Cop-win graphs are also known in the literature under the name of dismantlable graphs [13], and they are a main tool in the study of clique graphs [16]. The currently best algorithms for recognizing cop-win graphs run in O(nm) time or in O(n3/ log n) time [15]. A dismantling of a graph G is a graph H obtained by iteratively removing one dominated vertex of G, until no more dominated vertices remain. It is not hard to see that all the dismantlings of G are isomorphic. Using the h-graph data structure, we can compute the dismantling of a graph, and the cop-win order of a cop-win graph, in O(α(G)m) time easily. First, find the set D of dominated vertices in O(n + α(G)m) time (cf. above). Then, while D 6= ∅, choose a vertex D, and remove it from G while updating D as explained above. The graph obtained after this procedure is the dismantling H of G. If H has a unique vertex, then G has a cop-win order, given by the order in which the vertices were removed by the algorithm. This algorithm takes O(n + α(G)m) time, as discussed above. A simple elimination ordering of a graph G is an ordering v1, . . . , vn of V (G) such that vi is a simple vertex in the subgraph of G induced by vi, . . . , vn. The family of graphs that admit a simple elimination ordering is precisely the family of strongly chordal graphs [8]. Strongly chordal graphs were introduced as a subclass of chordal graph for which the domination problem is solvable in polynomial time [8]. The best known algorithms for computing a simple elimination ordering run in either O(n2) or O((n + m) log n) time [14]. These algorithms work by finding a doubly lexical ordering of the adjacency matrix of the graph, and then testing if this sorted matrix contains some forbidden structure. Our approach, instead, is based on iteratively finding a simple elimination ordering by iteratively removing the simple vertices. Every strongly chordal graph G has at least one simple vertex, and G \ {v} is strongly chordal for every v ∈ V (G) [8]. Thus, we can compute a simple elimination ordering of G by removing the simple vertices in any order. That is, first find the set Q of simple vertices in O(n + α(G)m) time (cf. above). Then, while Q 6= ∅, choose a vertex in Q, and remove it from G while updating Q with Algorithm 5. If all the vertices are removed from Q, then the removal order given by the algorithm is a simple elimination ordering of G. As discussed for Algorithm 4, the inner loop of Algorithm 5 is executed at most once for each edge (cf. above). Therefore, the simple elimination ordering is computed in O(n + α(G)m) time, improving the previous best algorithms for graphs with low arboricity. References [1] N. Alon, R. Yuster, and U. Zwick. Finding and counting given length cycles. Algorith- mica, 17(3):209 -- 223, 1997. [2] Hans-Jrgen Bandelt and Erich Prisner. Clique graphs and Helly graphs. J. Combin. Theory Ser. B, 51(1):34 -- 45, 1991. 17 [3] Norishige Chiba and Takao Nishizeki. Arboricity and subgraph listing algorithms. SIAM J. Comput., 14(1):210 -- 223, 1985. [4] Michele Conforti. (K4 − e)-free perfect graphs and star cutsets. In B. Simeone, editor, Combinatorial optimization (Como, 1986), volume 1403 of Lecture Notes in Math., pages 236 -- 253. Springer, Berlin, 1989. [5] Don Coppersmith and Shmuel Winograd. Matrix multiplication via arithmetic progres- sions. J. Symbolic Comput., 9(3):251 -- 280, 1990. [6] Friedrich Eisenbrand and Fabrizio Grandoni. On the complexity of fixed parameter clique and dominating set. Theoret. Comput. Sci., 326(1-3):57 -- 67, 2004. [7] David Eppstein and Emma S. Spiro. The h-index of a graph and its application to dy- namic subgraph statistics. In Frank K. H. A. Dehne, Marina L. Gavrilova, Jorg-Rudiger Sack, and Csaba D. T´oth, editors, Algorithms and Data Structures, 11th International Symposium, WADS 2009, Banff, Canada, August 21-23, 2009. Proceedings, volume 5664 of Lecture Notes in Computer Science, pages 278 -- 289. Springer, 2009. [8] Martin Farber. Characterizations of strongly chordal graphs. Discrete Math., 43(2- 3):173 -- 189, 1983. [9] J. Fonlupt and A. Zemirline. A polynomial recognition algorithm for perfect K4\{e}-free graphs. Rev. Maghr´ebine Math., 2(1):1 -- 26, 1993. [10] Ton Kloks, Dieter Kratsch, and Haiko Muller. Finding and counting small induced subgraphs efficiently. Inform. Process. Lett., 74(3-4):115 -- 121, 2000. [11] Richard Nowakowski and Peter Winkler. Vertex-to-vertex pursuit in a graph. Discrete Math., 43(2-3):235 -- 239, 1983. [12] Tim Poston. Fuzzy Geometry. PhD thesis, University of Warwick, 1971. [13] Alain Quilliot. Homomorphismes, points fixes, r´etractions et jeux de poursuite dans les graphes, les ensembles ordonn´es et les espaces m´etriques. PhD thesis, Universit´e de Paris VI, France, 1983. [14] Jeremy P. Spinrad. Efficient graph representations, volume 19 of Fields Institute Mono- graphs. American Mathematical Society, Providence, RI, 2003. [15] Jeremy P. Spinrad. Recognizing quasi-triangulated graphs. Discrete Appl. Math., 138(1- 2):203 -- 213, 2004. [16] Jayme Luiz Szwarcfiter. A survey on clique graphs. In C. Linhares Sales and B. Reed, editors, Recent advances in algorithms and combinatorics, volume 11 of CMS Books Math./Ouvrages Math. SMC, pages 109 -- 136. Springer, New York, 2003. [17] Mihai Talmaciu and Elena Nechita. Recognition algorithm for diamond-free graphs. Informatica (Vilnius), 18(3):457 -- 462, 2007. [18] Alan Tucker. Coloring perfect (K4−e)-free graphs. J. Combin. Theory Ser. B, 42(3):313 -- 318, 1987. 18 [19] Virginia Vassilevska. Efficient Algorithms for Path Problems in Weighted Graphs. PhD thesis, School of Computer Science, Carnegie Mellon University, August 2008. 19
1510.05093
1
1510
2015-10-17T07:56:35
Faster algorithms to enumerate hypergraph transversals
[ "cs.DS", "cs.DM", "math.CO" ]
A transversal of a hypergraph is a set of vertices intersecting each hyperedge. We design and analyze new exponential-time algorithms to enumerate all inclusion-minimal transversals of a hypergraph. For each fixed k>2, our algorithms for hypergraphs of rank k, where the rank is the maximum size of a hyperedge, outperform the previous best. This also implies improved upper bounds on the maximum number of minimal transversals in n-vertex hypergraphs of rank k>2. Our main algorithm is a branching algorithm whose running time is analyzed with Measure and Conquer. It enumerates all minimal transversals of hypergraphs of rank 3 on n vertices in time O(1.6755^n). Our algorithm for hypergraphs of rank 4 is based on iterative compression. Our enumeration algorithms improve upon the best known algorithms for counting minimum transversals in hypergraphs of rank k for k>2 and for computing a minimum transversal in hypergraphs of rank k for k>5.
cs.DS
cs
Faster algorithms to enumerate hypergraph transversals Manfred Cochefert1, Jean-Fran¸cois Couturier2, Serge Gaspers34, and Dieter Kratsch1 1 LITA, Universit´e de Lorraine, Metz, France. [email protected], 2 CReSTIC, Universit´e de Reims, France. [email protected] 3 University of New South Wales, Sydney, Australia. [email protected] [email protected] 4 NICTA, Sydney, Australia Abstract. A transversal of a hypergraph is a set of vertices intersecting each hyperedge. We design and analyze new exponential-time algorithms to enumerate all inclusion-minimal transversals of a hypergraph. For each fixed k ≥ 3, our algorithms for hypergraphs of rank k, where the rank is the maximum size of a hyperedge, outperform the previous best. This also implies improved upper bounds on the maximum number of minimal transversals in n-vertex hypergraphs of rank k ≥ 3. Our main algorithm is a branching algorithm whose running time is analyzed with Measure and Conquer. It enumerates all minimal transversals of hypergraphs of rank 3 in time O(1.6755n ). Our algorithm for hypergraphs of rank 4 is based on iterative compression. Our enumeration algorithms improve upon the best known algorithms for counting minimum transversals in hypergraphs of rank k for k ≥ 3 and for computing a minimum transver- sal in hypergraphs of rank k for k ≥ 6. 1 Introduction A hypergraph H is a couple (V, E), where V is a set of vertices and E is a set of subsets of V ; these subsets are called hyperedges. A transversal of H is a subset of vertices S ⊆ V such that each hyperedge of H contains at least one vertex from S. A transversal of H is minimal if it does not contain a transver- sal of H as a proper subset. The rank of a hypergraph H is the maximum size of a hyperedge. Finding, counting and enumerating (minimal) transversals, respectively (minimal) hitting sets of set systems fulfilling certain constraints are fundamental problems in Theoretical Computer Science with many impor- tant applications, for example in artificial intelligence, biology, logics, relational and distributed databases, Boolean switching theory and model-based diagno- sis. Various of those applications are described in Section 6 of [3]. The notions hitting set and transversal are synonymous, both of them name a subset of el- ements (vertices) having non empty intersection with each subset (hyperedge) of a given set system (hypergraph). We shall use both notions interchangeably usually speaking of transversals in hypergraphs whenever adressing enumera- tion, while speaking of hitting sets when adressing optimization and counting. 2 M. Cochefert, J.-F. Couturier, S. Gaspers, and D. Kratsch The Minimum Hitting Set problem is a well-studied NP-complete problem that, like its dual Minimum Set Cover, belongs to the list of 21 problems shown to be NP-complete by Karp in 1972 [19]. It can be seen as an extension of the fundamental graph problems Minimum Dominating Set, Minimum Ver- tex Cover and Maximum Independent Set; all of them also belonging to Karp's list [19]. These fundamental NP-complete problems have been studied ex- tensively from many algorithmic views; among them exact, approximation and parameterized algorithms. Prior to our work. Wahlstrom studied Minimum Hitting Set on hyper- graphs of rank 3 and achieved an O(1.6359n) time and polynomial space algo- rithm as well as an O(1.6278n) time and exponential space algorithm [25,26]. Here, n denotes the number of vertices. In an attempt to show that iterative compression can be useful in exact exponential-time algorithms, Fomin et al. studied Minimum Hitting Set on hypergraphs of rank at most k for any fixed k ≥ 2 as well as the problem of counting minimum hitting sets and achieved best known running times for most of these problems without improving upon Wahlstrom's algorithms [9]. (See also Table 1 in [9].) The Minimum Hitting Set problem on hypergraphs of fixed rank k has also been studied from a pa- rameterized point of view by various authors [6,7,8,9,24,26]. (See Table 2 in [9].) A well-known result of Cygan et al. states that for every c < 1, Minimum Hitting Set cannot be solved by an O(2cn) algorithm unless the Strong Ex- ponential Time Hypothesis fails [2], while there is a O(2n) algorithm based on verifying all subsets of elements. The only exponential-time algorithm to enu- merate all minimal transversals prior to our work had been given by Gaspers in his Master's thesis. It is a branching algorithm which for hypergraphs of rank k has branching vector (1, 2, . . . , k) since in the worst case it selects a hyperedge of size k and recurses on instances with n − 1, n − 2, . . . , and n − k vertices. The corresponding recurrence for k = 3 gives a running time of O(1.8393n). Our techniques and results. We use various properties of minimal transver- sals to design branching algorithms and analyze them using an elaborate Measure & Conquer analysis. For an in-depth treatment of branching algorithms, their construction and analysis, branching rules, branching vectors and Measure & Conquer we refer to [10]. For details on our approach, see Subsection 3.1 and [13,14]. Our main result is the algorithm for hypergraphs of rank 3 in Section 3 which runs in time O(1.6655n). In Section 4 we show that the iterative compres- sion approach from [9] can be extended to enumeration problems and obtain an algorithm of running time O(1.8863n) for hypergraphs of rank 4. In Section 5 we construct branching algorithms to enumerate the minimal transversals of hyper- graphs of rank at most k, for all fixed k ≥ 5. Our algorithmic results combined with implied upper bounds and new combinatorial lower bounds for the max- imum number of minimal transversals in n-vertex hypergraphs of rank k are summarized in Table 1. Finally to underline the potential of our enumeration algorithms let us mention that they can be used to improve upon the best known algorithms (see e.g. Table 1 in [9]) for counting minimum hitting sets in hyper- Faster algorithms to enumerate hypergraph transversals 3 Rank Lower bound Upper bound 2 3 4 5 6 7 8 9 10 20 1.4422n 1.5848n 1.6618n 1.7114n 1.7467n 1.7734n 1.7943n 1.8112n 1.8253n 1.8962n 1.4423n [23,22] O(1.6755n) O(1.8863n) O(1.9538n) O(1.9779n) O(1.9893n) O(1.9947n) O(1.9974n) O(1.9987n) O(1.9999988n ) Table 1. Lower and upper bounds for the maximum number of minimal transversals in an n-vertex hypergraph of rank k. graphs of rank k ≥ 3 and for solving Minimum Hitting Set in hypergraphs of rank k ≥ 6. Other related work. Enumerating all minimal transversals of a hypergraph is likely to be the most studied problem in output-sensitive enumeration. The problem whether there is an output-polynomial time algorithm, i.e. an algorithm with a running time bounded by a polynomial in the input size and the output size, to enumerate all minimal transversals of a hypergraph is still open despite efforts of more than thirty years including many of the leading researchers of the field. These efforts have produced many publications on the enumeration of the minimal transversals on special hypergraphs [3,4,5,11,20,21] and has also turned output-sensitive enumeration into an active field of research. Recent progress by Kant´e et al. [16] showing that an output-polynomial time algorithm to enumerate all minimal dominating sets of a graph would imply an output-polynomial time algorithm to enumerate the minimal transversals of a hypergraph has triggered a lot of research on the enumeration of minimal dominating sets, both in output- sensitive enumeration and exact exponential enumeration; see e.g. [1,15,17,18]. 2 Preliminaries We refer to the set of vertices and the set of hyperedges of a hypergraph H = (V, E) by V (H) and E(H), respectively. Throughout the paper we denote the number of vertices of a hypergraph by n. Note that a hypergraph of rank k has O(nk) hyperedges. Let v ∈ V be a vertex of H. The degree of v in H, denoted dH (v), is the number of hyperedges in E containing v. We omit the subscript when H is clear from the context. The neighborhood of v in H, denoted N (v) or NH (v), is the set of vertices (except v itself) that occur together with v in some hyperedge of H. We denote by di(v) or di,H (v) the number of hyperedges j=0 dj(v). If the hypergraph of size i in H containing v. We denote d≤i(v) := Pi 4 M. Cochefert, J.-F. Couturier, S. Gaspers, and D. Kratsch is viewed as a set system E over a ground set V , transversals are also called hitting sets. We also say that a vertex v hits a hyperedge e if v ∈ e. 3 Hypergraphs of rank 3 3.1 Measure We will now introduce the measure we use to track the progress of our branching algorithm. Definition 1. A measure µ for a problem P is a function from the set of all instances for P to the set of non-negative reals. Our measure will take into account the degrees of the vertices and the number of hyperedges of size 2. Measures depending on vertex degrees have become relatively standard in the literature. As for hyperedges of size 2, our measure, similar to Wahlstrom's [25], indicates an advantage when we can branch on hyperedges of size 2 once or several times. Let H = (V, E) be a hypergraph of rank at most 3. Denote by nk the number of vertices of degree k ∈ N. Denote by mk the number of hyperedges of size k ∈ {0, . . . , 3}. Also, denote by m≤k := Pk i=0 mi. The measure of H is µ(H) = Ψ (m≤2) + ∞ Xi=0 ωini , where Ψ : N → R≥0 is a non-increasing non-negative function such that maxi{Ψ (i)} = Ψ (0) is independent of n, and ωi are non-negative reals. The function Ψ is non- increasing since we would like to model that we have an advantage when the size of a hyperedge decreases from 3 to 2. Clearly, µ(H) ≥ 0. We will now make some assumptions simplifying our analysis and introduce notations easing the description of variations in measure. We set ωi := ω5 , Ψ (i) := 0 ∆ωi := ωi − ωi−1 , ∆Ψ (i) := Ψ (i) − Ψ (i − 1) for each i ≥ 6, and (1) for each i ≥ 1 . (2) We constrain that 0 ≤ ∆ωi+1 ≤ ∆ωi and 0 ≥ ∆Ψ (i + 1) ≥ ∆Ψ (i) for each i ≥ 1 . (3) Note that, by (3), we have that ωi − ωi−k ≥ k · ∆ωi for 0 ≤ k ≤ i. In addition, our branching rules will add constraints on the measure. Note that a branching rule with one branch is a reduction rule and one with no branch is a halting rule. Denote by T (µ) := 2µ an upper bound on the number of leaves of the search trees modeling the recursive calls of the algorithm for all H with µ(H) ≤ µ. Faster algorithms to enumerate hypergraph transversals 5 Suppose a branching rule creates k ≥ 1 branches B[1], . . . , B[k], each B[i] decreasing the measure by ηi. Then, we obtain the following constraint on the measure: k Xi=1 T (µ − ηi) ≤ T (µ) . Dividing by 2µ, the constraint becomes k Xi=1 2−ηi ≤ 1 . (4) Given these constraints for all branching rules, we will determine values for Ψ (0), . . . , Ψ (5), ω0, . . . , ω5 so as to minimize the maximum value of µ(H)/V (H) taken over all rank-3 hypergraphs H when V (H) is large. Since Ψ (m≤2) is a constant, this part of the measure contributes only a constant factor to the running time. Given our assumptions on the weights, optimizing the measure amounts to solving a convex program [13,14] minimizing ω5 subject to all con- straints, which can be done with certificates of optimality. If, in addition, we make sure that the maximum recursion depth of the algorithm is polynomially bounded, we obtain that the running time is within a polynomial factor of 2ω5. 3.2 Algorithm An instance of a recursive call of the algorithm is a hypergraph H = (V, E) with rank at most 3 and a set S, which is a partial hitting set for the original hypergraph. The hypergraph H contains all hyperedges that still need to be hit, and the vertices that are eligible to be added to S. Thus, V ∩ S = ∅. Initially, S = ∅. Each branching rule has a condition which is a prerequisite for applying the rule. When the prerequisites of more than one rule hold, the first applicable rule is used. Our branching rules create subinstances where some vertices are selected and others are discarded. -- If we select a vertex v, we remove all hyperedges containing v from the subinstance of the branch, we add v to S, and remove v from V . -- If we discard a vertex v, we remove v from all hyperedges and from V . We now come to the description of the branching rules, their correctness, and their analysis, i.e., the constraints they impose on the measure. Rules 0.x are halting rules, and Rules 1.x are reduction rules. Each rule first states the pre- requisite, then describes its actions, then the soundness is proved if necessary, and the constraints on the measure are given for the analysis. Rule 0.0 There is a hyperedge e ∈ E of size 0. Do nothing. The algorithm back- tracks and enumerates no transversal in this recursive call since there remains a hyperedge that cannot be hit by a vertex. 6 M. Cochefert, J.-F. Couturier, S. Gaspers, and D. Kratsch v u v u w v u w Rule 2.1 Rule 2.2 Rule 2.3 Rule 0.1 E = ∅. If S is a minimal transversal for the original hypergraph, output S, otherwise do nothing. We are in a recursive call where no hyperedge remains to be hit. Thus, S is a transversal of the original input hypergraph. However, S might not be minimal, and the algorithm checks in polynomial time if S is a minimal transversal of the initial hypergraph and outputs it if so. Rule 1.0 There is a vertex v ∈ V with degree 0. Discard v. Indeed, since v hits no hyperedge of H, a transversal for H containing v is not minimal. The constraint on the measure is 2−ω0 ≤ 20, which is trivially satisfied since ω0 ≥ 0. Rule 1.1 There is a hyperedge e1 ∈ E that is a subset of another hyperedge e2 ∈ E of size 3. Remove e2 from E. The rule is sound since each transversal of (V, E \ {e2}) is also a transversal of H. This is because any vertex that hits e1 also hits e2. Since e2 has size 3, this rule has no effect on the measure; the constraint 20 ≤ 20 is always satisfied. Rule 1.2 There is a hyperedge e of size 1. Select v, where {v} = e. The rule is sound since v is the only vertex that hits e. Selecting v removes v and all hyperedges containing v from the instance. By (3), the decrease in measure is at least η1 = ωd(v) + Ψ (d≤2(v)) − Ψ (0). To fulfill (4), we will need to constrain that η1 ≥ 0. Since d≤2(v) ≤ d(v) and by (3), if suffices to constrain Ψ (i) − Ψ (0) ≥ −ωi for 1 ≤ i ≤ 6 . (5) Rule 2 There is a vertex v ∈ V with degree one. Denote e the unique hyperedge containing v and branch according to the following three subrules. Rule 2.1 The hyperedge e has size 2. Denote e = {v, u}. Branch into two subproblems: B[1] where v is selected, and B[2] where v is discarded. In B[1], the vertex u is discarded due to minimality of the transversal, and the number of hyperedges of size at most 2 decreases by 1 since e is removed. By (3) the decrease in measure in B[1] is at least η1 = ω1 + ωd(u) + ∆Ψ (m≤2). In B[2], the vertex u is selected by applying Rule 1.2 after having discarded v. We have that d≤2(u) ≤ min(d(u), m≤2) hyperedges of size at most 2 disappear. By (3) the decrease in measure in B[2] is at least η2 = ω1 + ωd(u) + Ψ (m≤2) − Ψ (max(m≤2 − d(u), 0)). Note that we do not take into account additional sets of size at most 2 that may be created by discarding u and the degree-decreases of the other vertices in the neighborhood of u as a result of selecting u. However, these do not increase the measure due to constraints (3). Thus, we constrain that 2−ω1−ωd(u)−∆Ψ (m≤2) + 2−ω1−ωd(u)−Ψ (m≤2)+Ψ (max(m≤2−d(u),0)) ≤ 1 , (6) Faster algorithms to enumerate hypergraph transversals 7 v u1 v u1 u2 u1 v u2 u3 Rule 3.1 Rule 3.2 Rule 3.3 for all d(u) and m≤2 such that 1 ≤ d(u) ≤ 6 and 1 ≤ m≤2 ≤ 6. Note that the value of d(u) ranges up to 6 instead of 5 although ω5 = ω6, so that we have a constraint modeling that the value of Ψ increases from Ψ (6) = 0 to Ψ (0) in the second branch. In the remaining subrules of Rule 2, the hyperedge e has size 3. Rule 2.2 The other two vertices in e also have degree 1. Branch into 3 subprob- lems adding exactly one vertex from e to S and discarding the other 2. Clearly, any minimal transversal contains exactly one vertex from e. The decrease in measure is 3ω1 in each branch, giving the constraint 3 · 2−3ω1 ≤ 1 . (7) Rule 2.3 Otherwise, let e = {v, u, w} with d(u) ≥ 2. We create two subprob- lems: in B[1] we select v and in B[2] we discard v. Additionally, in B[1] we discard u and w due to minimality. The measure decreases by at least η1 = 2ω1 + ω2 and η2 = ω1 − maxi≥1{∆Ψ (i)} = ω1; the last equality holds since Ψ (i) = 0, i ≥ 6, and by (3). We obtain the constraint 2−2ω1−ω2 + 2−ω1 ≤ 1 . (8) Rule 3 At least one hyperedge has size 2. Let v be a vertex that has maximum degree among all vertices contained in a maximum number of hyperedges of size 2. Let e = {v, u1} be a hyperedge containing v. Note that, due to Rule 2, every vertex has degree at least 2 if Rule 3 applies. We branch according to the following subrules. Rule 3.1 d2(v) = 1. We branch into two subproblems: in B[1] we select v and in B[2] we discard v. Additionally, in B[2], we select u1 by Rule 1.2. Since u1 is contained in the hyperedge e and since d2(u1) ≤ d2(v), we have that d2(u1) = 1 and therefore d(v) ≥ d(u1). In B[1], we observe that the degrees of v's neighbors decrease. Also, e is a hyperedge of size 2 and it is removed; this affects the value of Ψ . The measure decrease in the first branch is therefore at least ωd(v) + ∆ωd(u1) + ∆Ψ (m≤2) ≥ ωd(u1) + ∆ωd(u1) + ∆Ψ (m≤2). In B[2], since we select u1, we have that d2(u1) = 1 hyperedge of size 2 disappears, and since we discard v, we have that d(v) − 1 sets of size 3 will become sets of size 2. Also, none of these size-2 sets already exist in E, otherwise Rule 1.1 would apply. We have a measure decrease of ωd(v) + ωd(u1) + Ψ (m≤2) − Ψ (m≤2 + d(v) − 2) ≥ 2ωd(u1)+Ψ (m≤2)−Ψ (m≤2+d(u1)−2). We obtain the following set of constraints: 2−ωd(u1)−∆ωd(u1 )−∆Ψ (m≤2) + 2−2ωd(u1)−Ψ (m≤2)+Ψ (m≤2+d(u1)−2) ≤ 1 , (9) 8 M. Cochefert, J.-F. Couturier, S. Gaspers, and D. Kratsch for each d(u1) and m≤2 with 2 ≤ d(u1) ≤ 6 and 1 ≤ m≤2 ≤ 6. Here, d(u1) ranges up to 6 since ∆ω6 = 0, whereas ∆ω5 may be larger than 0. Rule 3.2 d2(v) = 2. We branch into two subproblems: in B[1] we select v and in B[2] we discard v. Denoting {v, u2} the second hyperedge of size 2 containing v, we additionally select u1 and u2 in B[2]. In B[1], the measure decrease is at least η1 = ωd(v) + ∆ωd(u1) + ∆ωd(u2) + Ψ (m≤2) − Ψ (m≤2 − 2). In B[2], selecting u1 and u2 removes d2(u1) + d2(u2) ≤ min(4, m≤2) hyperedges of size 2, and discarding v decreases the size of d(v) − 2 hyperedges from 3 to 2. Thus, the measure decrease is at least η2 = ωd(v) + ωd(u1) + ωd(u2) + Ψ (m≤2) − Ψ (max(m≤2 − 4, 0) + d(v) − 2). We obtain the following set of constraints: 2−ωd(v)−∆ωd(u1 )−∆ωd(u2)−Ψ (m≤2)+Ψ (m≤2−2) + 2−ωd(v)−ωd(u1)−ωd(u2 )−Ψ (m≤2)+Ψ (max(m≤2−4,0)+d(v)−2) ≤ 1 , (10) for each d(v), d(u1), d(u2), and m≤2 with 2 ≤ d(v), d(u1), d(u2) ≤ 6 and 2 ≤ m≤2 ≤ 6. Rule 3.3 d2(v) ≥ 3. We branch into two subproblems: in B[1] we select v and in B[2] we discard v. In B[2] we additionally select all vertices occurring in hyperedges of size 2 with v. Denote by {v, u2} and {v, u3} a second and third hyperedge of size 2 containing v. In B[1], the number of size-2 hyperedges decreases by d2(v). The measure decrease is at least ωd2(v) + ∆ωd(u1) + ∆ωd(u2) + ∆ωd(u3) + Ψ (m≤2) − Ψ (m≤2 − d2(v)). In B[2], the number of hyperedges of size at most 2 decreases at most by d2(u1) + d2(u2) + d2(u3) ≤ min(d(u1) + d(u2) + d(u3), m≤2). We obtain a measure decrease of at least ωd2(v) + ωd(u1) + ωd(u2) + ωd(u3) + (d2(v) − 3) · ω2 + Ψ (m≤2) − Ψ (max(m≤2 − d(u1) − d(u2) − d(u3), 0)). The family of constraints for this branching rule is therefore i=1 ∆ωd(ui )−Ψ (m≤2)+Ψ (m≤2−d2(v)) 2−ωd2(v)−P3 + 2−ωd2(v)−P3 ≤ 1 , i=1 ωd(ui)−(d2(v)−3)·ω2−Ψ (m≤2)+Ψ (max(m≤2−P3 i=1 d(ui),0)) (11) where 3 ≤ d2(v) ≤ m≤2 ≤ 6 and 2 ≤ d(u1), d(u2), d(u3) ≤ 6. Rule 4 Otherwise, all hyperedges have size 3. Choose v ∈ V with maximum degree, and branch according to the following subrules. Rule 4.1 d(v) ≥ 3. We branch into two subproblems: in B[1] we select v and in B[2] we discard v. In B[1], the degree of each of v's neighbors decreases by the number of hyperedges it shares with v. We obtain a measure decrease of at least ωd(v) +Pu∈N (v)(ωd(u) − ωd(u)−{e∈E:{u,v}⊆e), which, by (3), is at least ωd(v) + 2 · d(v) · ∆ωd(v). In B[2], the number of hyperedges of size 2 increases from 0 to d(v), for a measure decrease of at least ωd(v) + Ψ (0) − Ψ (d(v)). For d(v) ∈ {3, . . . , 6}, this branching rules gives the constraint 2−ωd(v)−2·d(v)·∆ωd(v) + 2−ωd(v)−Ψ (0)+Ψ (d(v)) ≤ 1 . (12) Faster algorithms to enumerate hypergraph transversals 9 v v u v u1 u2 w1 w2 Rule 4.1 Rule 4.2 Rule 4.3 Rule 4.2 d(v) = 2 and there is a vertex u ∈ V \{v} which shares two hyperedges with v. We branch into two subproblems: in B[1] we select v and in B[2] we discard v. Additionally, we discard u in B[1] due to minimality. Since each vertex has degree 2, we obtain the following constraint. 2−2ω2−2∆ω2 + 2−ω2−Ψ (0)+Ψ (2) ≤ 1 . (13) Rule 4.3 Otherwise, d(v) = 2 and for every two distinct e1, e2 ∈ E with v ∈ e1 and v ∈ e2 we have that e1 ∩ e2 = {v}. Denoting e1 = {v, u1, w1} and e2 = {v, u2, w2} the two hyperedges containing v, we branch into three subproblems: in B[1] we select v and u1; in B[2] we select v and discard u1; and in B[3] we discard v. Additionally, we discard u2 and w2 in B[1] due to minimality. Again, all vertices have degree 2 in this case. In B[1], the degree of w1 decreases to 1. Among the two hyperedges containing u2 and w2 besides e2, at most one is hit by u1, since d(u1) = 2, and none of them is hit by v; thus, the branch creates at least one hyperedge of size at most 2. The measure decrease is at least 4ω2 + ∆ω2 − ∆Ψ (1). In B[2], the degrees of w1, u2, and w2 decrease by 1 and the size of a hyperedge containing u1 decreases. The measure decrease is at least 2ω2 + 3∆ω2 − ∆Ψ (1). In B[3], two size-2 hyperedges are created for a measure decrease of ω2 − ∆Ψ (2). This gives us the following constraint: 2−4ω2−∆ω2+∆Ψ (1) + 2−2ω2−3∆ω2+∆Ψ (1) + 2−ω2+∆Ψ (2) ≤ 1 . (14) This finishes the description of the algorithm. We are now ready to prove an upper bound on its running time, along the lines described in Subsection 3.1, using the following lemma. Lemma 1 ([14], Lemma 2.5 in [13]). Let A be an algorithm for a prob- lem P , c ≥ 0 be a constant, and µ(·), η(·) be measures for the instances of P , such that for any input instance I, Algorithm A transforms I into instances I1, . . . , Ik, solves these recursively, and combines their solutions to solve I, us- ing time O(η(I)c) for the transformation and combination steps (but not the recursive solves), and (∀i) η(Ii) ≤ η(I) − 1 , and k Xi=1 2µ(Ii) ≤ 2µ(I) . (15) (16) 10 M. Cochefert, J.-F. Couturier, S. Gaspers, and D. Kratsch Then A solves any instance I in time O(η(I)c+1)2µ(I). Theorem 1. The described algorithm enumerates all minimal transversals of an n-vertex hypergraph of rank 3 in time O(1.6755n). Proof. Consider any input instance H = (V, E) with n vertices and measure µ = µ(H). Using the following weights, the measure µ satisfies all constraints. i 0 1 2 3 ωi 0 0.580392137 0.699175718 0.730706814 Ψ (i) 0.566096928 0.436314617 0.306532603 0.211986294 i 4 5 6 ωi 0.742114220 0.744541491 0.744541491 Ψ (i) 0.119795899 0.035202514 0 Also, µ ≤ ω5 · n + Ψ (0). Therefore, the number of times a halting rule is executed (i.e., the number of leaves of the search tree) is at most 2ω5·n+O(1). Since each recursive call of the algorithm decreases the measure η(H) := V + E by at least 1, the height of the search tree is polynomial. We conclude, by Lemma 1, that the algorithm has running time O(1.6755n) since 2ω5 = 1.6754... ⊓⊔ In the proof of Theorem 1, the tight constraints are (6) with (d(u), m≤2) ∈ {(5, 5), (6, 5), (6, 6)}, (9) with d(u1) = 2 and m≤2 = 1, (10) with d(v) = 2, d(u1) = d(u2) = 6, and 2 ≤ m≤2 ≤ 4, and (12) for all values of d(v). 4 Hypergraphs of rank 4 For hypergraphs of rank 4, we adapt an iterative compression algorithm of [9], which was designed for counting the number of minimum transversals, to the enumeration setting. Theorem 2. Suppose there is an algorithm with running time O∗((ak−1)n), 1 < ak−1 ≤ 2, enumerating all minimal transversals in rank-(k − 1) hypergraphs. Then all minimal transversals in a rank-k hypergraph can be enumerated in time min 0.5≤α≤1 max(cid:26)O∗(cid:18)(cid:18) n αn(cid:19)(cid:19) , O∗(cid:0)2αn(ak−1)n−αn(cid:1)(cid:27) . Proof. Let H = (V, E) be a rank-k hypergraph. First the algorithm tries all subsets of V of size at least ⌊αn⌋ and outputs those that are minimal transversals of H. The running time of this phase is O∗(cid:16)Pn i=⌊αn⌋(cid:0)n i(cid:1)(cid:17) = O∗(cid:0)(cid:0) n αn(cid:1)(cid:1). Now there are two cases. In the first case, there is no transversal of size ⌊αn⌋. But then, H has no transversals of size at most ⌊αn⌋ and we are done. In the second case, there exists a transversal X of size ⌊αn⌋. For each subset N ⊆ X, the algorithm will enumerate all minimal transversals of H whose intersection with X is N . For a given subset N ⊆ X, obtain a new hypergraph H ′ = (V ′, E′) from H by removing the hyperedges that contain a vertex from N , removing the vertices X \ N from all remaining hyperedges, and setting Faster algorithms to enumerate hypergraph transversals 11 V ′ = V \X. Observe that for every minimal transversal X ′ of H with X ′∩X = N , we have that X ′ \ N is a minimal transversal of H ′. Moreover, observe that the rank of H ′ is at most k − 1, since all vertices from X have been removed and they form a transversal of H. Therefore, the algorithm invokes an algorithm for enumerating all minimal transversals in rank-(k − 1) hypergraphs and runs it on H ′. For each minimal transversal Y that is output, check whether X ∪ Y is a minimal transversal of H, and if so, output X ∪ Y . This phase of the algorithm has running time O∗ (2αn(ak−1)n−αn). ⊓⊔ Combining Theorem 2 with Theorem 1, the running time is minimized for α ≈ 0.66938. Theorem 3. The described algorithm enumerates all minimal transversals of an n-vertex hypergraph of rank 4 in time O(1.8863n). 5 Hypergraphs of rank at least 5 For a hypergraph H = (V, E) of rank k ≥ 5, we use the following algorithm to enumerate all minimal transversals. As in Subsection 3.2, the instance of a recursive call of the algorithm is a hypergraph H = (V, E) and set S which is a partial transversal of the original hypergraph. The hypergraph H contains all hyperedges that still need to be hit and the vertices that can be added to S. The algorithm enumerates all minimal transversals Y of the original hypergraph such that Y \ S is a minimal transversal of H. H1 If E = ∅, then check whether S is a minimal transversal of the original hypergraph and output S if so. H2 If ∅ ∈ E, then H contains an empty hyperedge, and the algorithm backtracks. R1 If there is a vertex v ∈ V with dH (v) = 0, then discard v and recurse. R2 If there are two hyperedges e1, e2 ∈ E with e1 ⊆ e2, then remove e2 and recurse. R3 If there is a hyperedge e ∈ E with e = 1, then select v, where e = {v} and recurse. B1 If there is a vertex v ∈ V with dH (v) = 1, then let e ∈ E denote the hyperedge with v ∈ e. Make one recursive call where v is discarded, and one recursive call where v is selected and all vertices from e \ {v} are discarded. B2 Otherwise, select two hyperedges e, e′ such that e is a smallest hyperedge and e∩e′ ≥ 1. Order their vertices such that their common vertices appear first: e = {v1, . . . , ve} and e′ = {v1, . . . , vℓ, uℓ+1, . . . , ue′}. Make e recursive calls; in the ith recursive call, v1, . . . , vi−1 are discarded and vi is selected. Theorem 4. For any k ≥ 2, the described algorithm enumerates the minimal transversals of a rank-k hypergraph in time O((βk)n), where βk is the positive real root of −1 + x−1 + k Xi=3 (i − 2) · x−i + 2k−1 Xi=k+1 (2k − i) · x−i = 0 . 12 M. Cochefert, J.-F. Couturier, S. Gaspers, and D. Kratsch 0 1 2 . . . ℓ ℓ + 1 ℓ + 2 . . . k ℓ + 2 ℓ + 3 . . . k + 1 ℓ + 3 ℓ + 4 . . . k + 2 k + 1 k + 2 . . . 2k − 1 Fig. 1. Decreasing the number of vertices in recursive calls of rule B2. Proof. The correctness of the halting and reduction rules are easy to see. For the correctness of branching rule B1, it suffices to observe that a transversal containing v and some other vertex from e is not minimal. The correctness of B2 follows since the ith recursive call enumerates the minimal transversals such that the first vertex among v1, . . . , ve they contain is vi. As for the running time, a crude analysis gives the same running time as the analysis of [12], since we can associate the branching vector (1, e) with B1, which is (1, 2) in the worst case, and the branching vector (1, 2, . . . , k) with B2. Let us look at B2 more closely. In the worst case, e = k. Due to the reduction rules, we have that e ∩ e′ = ℓ < e. We consider two cases. In the first case, ℓ = 1. Since v1 is discarded in branches 2, . . . , k, we have that the size of e′ is at most k − 1 in each of these recursive calls, and the algorithm will either use branching rule B1 or branching rule B2 on a hyperedge of size at most k − 1 in branches 2, . . . , k. In the worst case, it uses branching rule B2 on a hyperedge of size k − 1 in each of these branches, leading to the branching vector (1, 3, 4, . . . , k + 1, 4, 5, . . . , k + 2, 5, 6, . . . , 2k − 1) whose recurrence T (n) = T (n − 1) + k Xi=3 (i − 2) · T (n − i) + 2k−1 Xi=k+1 (2k − i) · T (n − i) solves to βk. In the second case, ℓ ≥ 2, and we will show that this case is no worse than the first one. Since v1, . . . , vℓ are discarded in branches ℓ + 1, . . . , k, the size of e′ is at most k − ℓ in each of these recursive calls, and in the worst case the algorithm will branch on a hyperedge of size k − ℓ in branches ℓ + 1, . . . , k, leading to the branching vector (1, 2, . . . , ℓ, ℓ + 2, ℓ + 3, . . . , k + 1, ℓ + 3, ℓ + 4, . . . , k + 2, . . . , k +1, k +2, . . . , 2k −ℓ). See Fig. 1. To see that this is no worse than the branching vector of the first case, follow each branch i with 2 ≤ i ≤ ℓ by a k-way branching (1, 2, . . . , k), replacing the entry i in the branching vector with 1+i, 2+i, . . . , k+i. Compared with the branching vector of the first case, the only difference in branches i, 2 ≤ i ≤ ℓ, is that these have the additional entries k + i. But note that branch ℓ + 1 has entries k + 2, . . . , k + ℓ in the first case but not in the second case. We conclude that the branching vector where entries i, 2 ≤ i ≤ ℓ, ⊓⊔ are replaced by 1 + i, 2 + i, . . . , k + i is a sub-vector of the one for ℓ = 1. Faster algorithms to enumerate hypergraph transversals 13 Since this algorithm guarantees branching on hyperedges of size at most k −1 in certain cases, its running time outperforms the one in [12] for each k ≥ 3. 6 Lower bounds The graphs with a maximum number of maximal independent sets are the dis- joint unions of triangles. They are hypergraphs of rank 2 with 3n/3 minimal transversals. We generalize this lower bound to hypergraphs with larger rank. Theorem 5. For any two integers k, n > 0, there is an n-vertex hypergraph of rank k with (cid:18)2 · k − 1 k (cid:19)⌊n/(2·k−1)⌋ minimal transversals. Proof. Let Hk = (V, E) be a hypergraph on 2 · k − 1 vertices where E is the set of all subsets of V of cardinality k. We claim that every subset of k elements from V is a minimal transversal of Hk. First, any transversal X of Hk contains at least k vertices, otherwise V \ X ≥ k and there is least one hyperedge that has an empty intersection with X. Second, any subset X ′ of V of cardinality k is a hitting set for Hk. Indeed, as V \ X ′ = k − 1, every hyperedge that does not intersect X ′ has cardinality at most k − 1, but E contains no such hyperedge. This proves the claim that every subset of k elements from V is a minimal transversal of Hk. Thus, Hk has (cid:18)2 · k − 1 (cid:19) k minimal transversals. The bound of the theorem is then achieved by a disjoint union of ⌊n/(2 · k − 1)⌋ copies of Hk, and n − ⌊n/(2 · k − 1)⌋ isolated vertices. ⊓⊔ Acknowledgments We thank Fabrizio Grandoni for initial discussions on this research. Serge Gaspers is the recipient of an ARC Future Fellowship (project number FT140100048) and acknowledges support under the ARC's Discovery Projects funding scheme (project number DP150101134). NICTA is funded by the Aus- tralian Government through the Department of Communications and the Aus- tralian Research Council (ARC) through the ICT Centre of Excellence Program. References 1. Jean-Fran¸cois Couturier, Pinar Heggernes, Pim van 't Hof, and Dieter Kratsch. Minimal dominating sets in graph classes: Combinatorial bounds and enumeration. Theoretical Computer Science, 487(8):2 -- 94, 2013. 14 M. Cochefert, J.-F. Couturier, S. Gaspers, and D. Kratsch 2. Marek Cygan, Holger Dell, Daniel Lokshtanov, Daniel Marx, Jesper Nederlof, Yoshio Okamoto, Ramamohan Paturi, Saket Saurabh, and Magnus Wahlstrom. On problems as hard as CNF-SAT. In Proc. CCC, pages 74 -- 84, 2012. 3. Thomas Eiter and Georg Gottlob. Identifying the minimal transversals of a hy- pergraph and related problems. SIAM Journal on Computing, 24(6):1278 -- 1304, 1995. 4. Thomas Eiter, Georg Gottlob, and Kazuhisa Makino. New results on monotone dualization and generating hypergraph transversals. SIAM Journal on Computing, 32(2):514 -- 537, 2003. 5. Khaled M. Elbassioni and Imran Rauf. Polynomial-time dualization of r-exact hy- pergraphs with applications in geometry. Discrete Mathematics, 310(17-18):2356 -- 2363, 2010. 6. Henning Fernau. Parameterized algorithmics for d -hitting set. International Jour- nal of Computer Mathematics, 87(14):3157 -- 3174, 2010. 7. Henning Fernau. Parameterized algorithms for d-hitting set: The weighted case. Theoretical Computer Science, 411(16-18):1698 -- 1713, 2010. 8. Henning Fernau. A top-down approach to search-trees: Improved algorithmics for 3-hitting set. Algorithmica, 57(1):97 -- 118, 2010. 9. Fedor V. Fomin, Serge Gaspers, Dieter Kratsch, Mathieu Liedloff, and Saket Saurabh. Iterative compression and exact algorithms. Theoretical Computer Sci- ence, 411(7-9):1045 -- 1053, 2010. 10. Fedor V. Fomin and Dieter Kratsch. Exact Exponential Algorithms. Springer, 2010. 11. Michael L. Fredman and Leonid Khachiyan. On the complexity of dualization of monotone disjunctive normal forms. Journal of Algorithms, 21(3):618 -- 628, 1996. 12. Serge Gaspers. Algorithmes exponentiels. Master's thesis, Univ. Metz, France, 2005. 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. Petr A. Golovach, Pinar Heggernes, Dieter Kratsch, and Yngve Villanger. An incremental polynomial time algorithm to enumerate all minimal edge dominating sets. Algorithmica, 72(3):836 -- 859, 2015. 16. Mamadou Moustapha Kant´e, Vincent Limouzy, Arnaud Mary, and Lhouari Nourine. On the enumeration of minimal dominating sets and related notions. SIAM Journal on Discrete Mathematics, 28(4):1916 -- 1929, 2014. 17. Mamadou Moustapha Kant´e, Vincent Limouzy, Arnaud Mary, Lhouari Nourine, and Takeaki Uno. A polynomial delay algorithm for enumerating minimal domi- nating sets in chordal graphs. In Proc. WG, 2015. 18. Mamadou Moustapha Kant´e, Vincent Limouzy, Arnaud Mary, Lhouari Nourine, and Takeaki Uno. Polynomial delay algorithm for listing minimal edge dominating sets in graphs. In Proc. WADS, 2015. 19. Richard M. Karp. Reducibility among combinatorial problems. In Complexity of computer computations, pages 85 -- 103. Plenum Press, New York, 1972. 20. Dimitris J. Kavvadias and Elias C. Stavropoulos. An efficient algorithm for the transversal hypergraph generation. Journal of Graph Algorithms and Applications, 9(2):239 -- 264, 2005. 21. Leonid Khachiyan, Endre Boros, Khaled M. Elbassioni, and Vladimir Gurvich. On the dualization of hypergraphs with bounded edge-intersections and other related classes of hypergraphs. Theoretical Computer Science, 382(2):139 -- 150, 2007. Faster algorithms to enumerate hypergraph transversals 15 22. R. E. Miller and D. E. Muller. A problem of maximum consistent subsets. IBM Research Report RC-240, J. T. Watson Research Center, 1960. 23. John W. Moon and Leo Moser. On cliques in graphs. Israel Journal of Mathemat- ics, 3:23 -- 28, 1965. 24. Rolf Niedermeier and Peter Rossmanith. An efficient fixed-parameter algorithm for 3-hitting set. Journal of Discrete Algorithms, 1(1):89 -- 102, 2003. 25. Magnus Wahlstrom. Exact algorithms for finding minimum transversals in rank-3 hypergraphs. Journal of Algorithms, 51(2):107 -- 121, 2004. 26. Magnus Wahlstrom. Algorithms, measures and upper bounds for satisfiability and related problems. PhD thesis, Linkoping University, Sweden, 2007.
1910.05646
1
1910
2019-10-12T21:20:10
"Bring Your Own Greedy"+Max: Near-Optimal $1/2$-Approximations for Submodular Knapsack
[ "cs.DS", "cs.LG" ]
The problem of selecting a small-size representative summary of a large dataset is a cornerstone of machine learning, optimization and data science. Motivated by applications to recommendation systems and other scenarios with query-limited access to vast amounts of data, we propose a new rigorous algorithmic framework for a standard formulation of this problem as a submodular maximization subject to a linear (knapsack) constraint. Our framework is based on augmenting all partial Greedy solutions with the best additional item. It can be instantiated with negligible overhead in any model of computation, which allows the classic \greedy algorithm and its variants to be implemented. We give such instantiations in the offline (Greedy+Max), multi-pass streaming (Sieve+Max) and distributed (Distributed+Max) settings. Our algorithms give ($1/2-\epsilon$)-approximation with most other key parameters of interest being near-optimal. Our analysis is based on a new set of first-order linear differential inequalities and their robust approximate versions. Experiments on typical datasets (movie recommendations, influence maximization) confirm scalability and high quality of solutions obtained via our framework. Instance-specific approximations are typically in the 0.6-0.7 range and frequently beat even the $(1-1/e) \approx 0.63$ worst-case barrier for polynomial-time algorithms.
cs.DS
cs
"Bring Your Own Greedy"+Max: Near-Optimal 1/2-Approximations for Submodular Knapsack Dmitrii Avdiukhin∗ Grigory Yaroslavtsev† October 15, 2019 Samson Zhou‡ Abstract The problem of selecting a small-size representative summary of a large dataset is a cor- nerstone of machine learning, optimization and data science. Motivated by applications to recommendation systems and other scenarios with query-limited access to vast amounts of data, we propose a new rigorous algorithmic framework for a standard formulation of this problem as a submodular maximization subject to a linear (knapsack) constraint. Our framework is based on augmenting all partial Greedy solutions with the best additional item. It can be instantiated with negligible overhead in any model of computation, which allows the classic Greedy algorithm and its variants to be implemented. We give such instantiations in the offline (Greedy+Max), multi-pass streaming (Sieve+Max) and distributed (Distributed Sieve+Max) settings. Our algorithms give (1/2 − )-approximation with most other key pa- rameters of interest being near-optimal. Our analysis is based on a new set of first-order linear differential inequalities and their robust approximate versions. Experiments on typical datasets (movie recommendations, influence maximization) confirm scalability and high quality of solu- tions obtained via our framework. Instance-specific approximations are typically in the 0.6-0.7 range and frequently beat even the (1 − 1/e) ≈ 0.63 worst-case barrier for polynomial-time algorithms. 1 Introduction A fundamental problem in many large-scale machine learning, data science and optimization tasks is finding a small representative subset of a big dataset. This problem arises from applications in rec- ommendation systems [LKG+07, EAG11, BMSC17, MBN+17, YXC18, AMYZ19], exemplar-based clustering [GK10], facility location [LWD16], image processing [IB19], viral marketing [HMS08], principal component analysis [KGPK15], and document summarization [LB11, WLKB13, SSSJ12] and can often be formulated as constrained monotone submodular optimization under various con- straints such as cardinality [BMKK14, BEM18, KMZ+19], knapsack [HKY17], matchings [CK14], and matroids [CCPV11, AHN+19] due to restrictions demanded by space, budget, diversity, fairness or privacy. As a result, constrained submodular optimization has been recently and extensively studied in various computational models, including centralized [NWF78], distributed [MKSK13, ∗Indiana University, Bloomington. [email protected]. †Indiana University, Bloomington & The Alan Turing Institute. [email protected]. ‡Carnegie Mellon University & Indiana University, Bloomington. [email protected]. 1 KMVV15, dPBENW15, MZ15, MZK16, dPBENW16, LV19], streaming [BMKK14, BFS15, NTM+18, ASS19, KMZ+19], and adaptive [GK11, BS18, BRS19, FMZ19, EN19b, CQ19] among others. In this paper we focus on monotone submodular maximization under a knapsack constraint, which captures the scenario when the representative subset should have a small cost or size. While a number of algorithmic techniques exist for this problem, there are few that robustly scale to large data and can be easily implemented in various computing frameworks. This is in contrast with a simpler cardinality-constrained version in which only the number of elements is restricted. In this setting the celebrated Greedy algorithm of [NWF78] enjoys both an optimal approximation ratio and a simplicity that allows easy adaptation in various environments. For knapsack constraints, such a simple and universal algorithm is unlikely. In particular, Greedy does not give any approximation guarantee. We develop a framework that augments solutions constructed by Greedy and its variations and gives almost 1/2-approximations1 in various computational models. For example, in the multi- pass streaming setting we achieve optimal space and almost optimal number of queries and running time. We believe that our framework is robust to the choice of the computational model as it can be implemented with essentially the same complexity as that of running Greedy and its variants. 1.1 Preliminaries and our contributions A set function f : 2U → R is submodular if for every S ⊆ T ⊆ U and e ∈ U it holds that f (e ∪ T ) − f (T ) ≤ f (e ∪ S) − f (S). Moreover, f is monotone if for every S ⊆ T ⊆ U it holds that f (T ) ≥ f (S). Intuitively, elements in the universe contribute non-negative utility, but their resulting gain is diminishing as the size of the set increases. In the monotone submodular maximization problem subject to a knapsack constraint, each item e has cost c(e). Given a parameter K > 0, the task is to maximize a non-negative monotone submodular function f (S) under the constraint e∈S c(e) ≤ K. Without loss of generality, we assume that mine∈S c(e) ≥ 1, which can be achieved by rescaling the costs and taking all items with cost 0. Then K = min(n, K) is an upper bound on the number of elements in any feasible solution. c(S) :=(cid:80) Any algorithm for submodular maximization requires query access to f. As query access can be expensive, the number of queries is typically considered one of the performance metrics. Further- more, in some critical applications of submodular optimization such as recommendation systems, another constraint often arises from the fact that only queries to feasible sets are allowed (e.g. when click-through rates can only be collected for sets of ads which can be displayed to the users). Practi- cal algorithms for submodular optimization hence typically only make such queries, an assumption commonly used in the literature (see e.g. [NTM+18]). For any algorithm that only makes queries on feasible sets, it is easy to show that Ω(n2) queries are required to go beyond 1/2-approximation under various assumptions on f (Theorem 2.14). Hence it is natural to ask whether we can get a 1/2-approximation, while keeping other performance metrics of interest nearly optimal and hence not compromising on practicality. We answer this question positively. We first state the following simplified result in the most basic offline model (i.e. when an algo- rithm can access any element at any time) to illustrate the main ideas and then improve parameters in our other results. In this model, we are given an integer knapsack capacity K ∈ Z+ and a set E of elements e1, . . . , en from a finite universe U.2 1Algorithm gives an α-approximation if it outputs S such that f (S) ≥ αf (OPT), where OPT is optimum solution. 2W.l.o.g. for all e we have 1 ≤ c(e) ≤ K as one can rescale the capacity and costs and filter out all items with 2 Theorem 1.1 (Offline Greedy+Max) Let K = min(n, K). There exists an offline algorithm Greedy+Max (Algorithm 1) that gives a 1/2-approximation for the submodular maximization problem under a knapsack constraint with query (cid:17) complexity and running time O(cid:16) Kn (Theorem 2.6). In the single-pass streaming model, the algorithm is given K and a stream E consisting of elements e1, . . . , en ∈ U, which arrive sequentially. The objective is to minimize the auxiliary space used by algorithm throughout the execution. In the multi-pass streaming model, the algorithm is further allowed to make multiple passes over E. This model is typically used for modeling storage devices with sequential access (e.g. hard drives) while using a small amount of RAM. In this setting minimizing the number of passes becomes another key priority. Note that since Ω( K) is a trivial lower bound on space and Ω(n) is a trivial lower bound on time and query complexity of any approximation algorithm that queries feasible sets, our next result is almost optimal in most parameters of interest. exists a multi-pass streaming algorithm Sieve+Max (Algorithm 2) that uses O(cid:16) K problem under a knapsack constraint, with query complexity and running time3 O(cid:16) Theorem 1.2 (Multi-pass streaming algorithm Sieve+Max) Let K = min(n, K). There space and O (1/) passes over the stream and outputs a (1/2−)-approximation to the submodular maximization n(1/ + log K) (cid:17) (cid:17) (see Theorem 2.10). (cid:112) (cid:113) (cid:112) n/ K and s = O( We also give an algorithm in the massively-parallel computation (MPC) model [KSV10] used to model MapReduce/Spark-like systems. We use the most restrictive version, which only allows linear total memory, running time and communication per round [ANOY14]. In this model, the input set E of size n is arbitrarily distributed across m machines, each with s = O(n/m) memory so that the overall memory is O (n). A standard setting of parameters for submodular optimization is m = n K) (see e.g. [LV19, AMYZ19]). One of the machines is designated as the central machine and outputs the solution in the end. The machines communicate to each other in a number of synchronous rounds. In each round, each machine receives an input of size O( n K), performs a local linear-time computation, and sends an output of size O( n K) to other machines before the next round begins. The primary objective in this model is minimizing the number of rounds. Our main result in this model is given below. Theorem 1.3 (MPC algorithm Distributed Sieve+Max) Let K = min(n, K). There exists an MPC algorithm Distributed Sieve+Max (Algorithm 3)that runs in O (1/) rounds on n K) memory. Each machine uses query complexity and runtime n K) per round. The algorithm outputs a (1/2 − )-approximation to the submodular maximiza- n/ K machines, each with O( O( tion problem under a knapsack constraint(see Theorem 2.13). In particular, our algorithm uses execution time O( and number of queries O (n/). cost more than K (in all our results this means replacing K with the aspect ratio K/ mine∈E c(e)). n K/) and total communication, CPU time (cid:112) (cid:112) 3Note that when 1  (cid:28) K, in terms of running time our streaming algorithm is more efficient than our offline algorithm. Hence, in the offline setting one can use the best of the two algorithms depending on the parameters. (cid:113) (cid:112) (cid:112) 3 1.2 Relationship to previous work The classic version of the problem considered in this work sets c(e) = 1 for all e ∈ U and is known as monotone submodular maximization under a cardinality constraint and has been extensively studied. The celebrated result of [NWF78] gives a 1 − 1/e ≈ 0.63-approximation using Greedy, which is optimal unless P (cid:54)= N P , [Fei98]. The problem of maximizing a monotone submodu- lar function under a knapsack constraint was introduced by [Wol82], who gave an algorithm with ≈ 0.35-approximation. e ≈ 0.39- approximation as well as a more complicated algorithm PartialEnum+Greedy which requires time. Par- tialEnum+Greedy was later analyzed by [Svi04] who showed a (1 − 1/e) ≈ 0.63-approximation, matching the hardness of [Fei98]. The subsequent search for more efficient algorithms has motivated [BV14] and [EN19a] give algorithms with approximation 1 − 1/e − . a number of further studies. However while these algorithms are theoretically interesting, they are self-admittedly impractical due to their exponential dependence on large polynomials in 1/. a partial enumeration over an initial seed of three items and hence runs in O(cid:16) Kn4(cid:17) √ [KMN99] gave a simple GreedyOrMax algorithm with 1 − 1/ Compared to the well-studied cardinality-constrained case, streaming literature on monotone submodular optimization under a knapsack constraint is relatively sparse. A summary of results in the streaming setting is given in Figure 1. Prior to our work, the best results in streaming are by [HKY17, HK19]. While the most recent work of [HK19] achieves the (1/2 − )-approximation, its space, runtime and query complexities are far from optimal and depend on large polynomials of 1/, making it impractical for large data. Compared to this result, our Theorem 1.2 gives an improvement on all main parameters of interest, leading to near-optimal results. On the other hand, for the cardinality-constrained case, an optimal single-pass (1/2− )-approximation has very recently been achieved by [KMZ+19]. While using different ideas, our multi-pass streaming result matches theirs in terms of approximation, space and improves slightly on the number of queries and runtime ) only at the cost of using a constant number of passes (from O(cid:16) to O(cid:16) n(1/ + log K) n log K/ (cid:17) (cid:17) for constant . Reference [HKY17] [HKY17] [HKY17] [HK19] Sieve+Max (Alg. 2) Space Approx. Passes 1/3 −  4/11 −  2/5 −  O(cid:0) 1  K log K(cid:1) O(cid:0) 1  K log K(cid:1) O(cid:0) 1 2 K log2 K(cid:1) 1/2 −  O (1/) O(cid:0) 1 7 K log2 K(cid:1) 1 1 3 1/2 −  O (1/) O (K) Runtime and Queries O(cid:0) 1  n log K(cid:1) O(cid:0) 1  n log K(cid:1) O(cid:0) 1  n log K(cid:1) O(cid:0) 1 8 n log2 K(cid:1)  + log K(cid:1)(cid:1) O(cid:0)n(cid:0) 1 Fig. 1: Monotone submodular maximization under a knapsack constraint in the streaming model. In the distributed setting, [MKSK13] give an elegant two round protocol for monotone sub- modular maximization subject to a knapsack constraint that achieves a subconstant guarantee. [KMVV15] later give algorithms for both cardinality and matroid constraints that achieve a constant factor approximation, but the number of rounds is Θ(log ∆), where ∆ is the maximum increase in the objective due to a single element, which is infeasible for large datasets since ∆ even be significantly larger than the size of the entire dataset. [dPBENW15, dPBENW16] subsequently give a frame- work for both monotone and non-monotone submodular functions under cardinality, matroid, and 4 p-system constraints. Specifically, the results of [dPBENW16] achieves almost 1/2-approximation using two rounds, a result subsequently matched by Liu and Vondrák without requiring the dupli- cation of items, as well as a (1 − 1/e − ) approximation using O (1/) rounds. [dPBENW15] also gives a two-round algorithm for a knapsack constraint that achieves roughly 0.17-approximation in expectation. For extensions to other constraints, non-monotone objectives and other generalizations see e.g. [CK14, CGQ15, CHJ+17, EDFK17, ELVZ17, MJK18, FKK18, CQ19]. 1.3 Our techniques Let f (e S) = f (e ∪ S) − f (S) be the marginal gain and ρ (e S) = f (e S) /c(e) be the marginal density of e with respect to S. Greedy starts with an empty set G and repeatedly adds an item that maximizes ρ (e G) among the remaining items that fit. While by itself this does not guarantee any approximation, the classic result of [KMN99] shows that GreedyOrMax algorithm, which takes the best of the greedy solution and the single item with maximum value, gives a 0.39-approximation but cannot go beyond 0.44-approximation. Our algorithm Greedy+Max (Algorithm 1) instead attempts to augment every partial greedy solution with the item giving the largest marginal gain. For each i, let Gi be the set of the first i items taken by greedy. We augment this solution with the item si which maximizes f (si Gi) among the remaining items that fit. Greedy+Max then outputs the best solution among such augmentations. Our main technical contribution lies in the analysis of this algorithm and its variants, which shows a 1/2-approximation (this analysis is tight, see Example 2.1 ). Let o1 be the item from OPT with the largest cost. The main idea is to consider the last partial greedy solution such that o1 still fits. Since o1 has the largest cost in OPT, we can augment the partial solution with any element from OPT, and all of them have a non-greater marginal density than the next selected item. While Greedy+Max augments partial solutions with the best item, for the sake of analysis it suffices to consider only augmentations with o1 (note that the item itself is unknown to the algorithm). To simplify the presentation, in the analysis we rescale f and the costs so that f (OPT) = 1 and K = 1. Suppose that at some point, the partial greedy solution has collected elements with total cost x ∈ [0, 1]. We use a continuous function g(x) to track the performance of Greedy. We also introduce a function g1(x) to track the performance of augmentation with o1 and then show that g and g1 satisfy a differential inequality g1(x) + (1 − c (o1))g(cid:48)(x) ≥ 1 (Lemma 2.5), where g(cid:48) denotes the right derivative. To give some intuition about the proof, consider the case when there exists a partial greedy solution of cost exactly 1 − c (o1). If g1(1 − c (o1)) ≥ 1/2, then the augmenation with o1 gives a 1/2-approximation. Otherwise, by the differential inequality, g(cid:48)(1 − c (o1)) ≥ 1/2(1−c(o1)). Since g(0) = 0 and g(cid:48) is non-increasing, g(1 − c (o1)) ≥ (1 − c (o1))g(cid:48)(1 − c (o1)) ≥ 1/2. See full analysis for how to handle the cases when there is no partial solution of cost exactly 1 − c (o1). Our streaming algorithm Sieve+Max and distributed algorithm Distributed Sieve+Max approximately implement Greedy+Max in their respective settings. Sieve+Max makes O (1/) passes over the data, and for each pass it selects items with marginal density at least a threshold cf (OPT) K(1+)i in the i-th pass for some constant c > 0. This requires having a constant-factor approxima- tion of f (OPT) which can be computed using a single pass. Distributed Sieve+Max combines the thresholding approach with the sampling technique developed by [LV19] for the cardinality con- straint. The differential inequality which we develop for Greedy+Max turns out to be robust to various sources of error introduced through thresholding and sampling. As we show, it continues to hold with functions and derivatives replaced with their (1 + )-approximations, which results in 5 (1/2 − )-approximation guarantees for both algorithms. 2 Algorithms and analysis 2.1 Offline algorithm Greedy+Max We introduce the main ideas by first describing our offline algorithm Greedy+Max which is then adapted to the streaming and distributed settings. As this algorithm is a modification of the standard Greedy algorithm we describe Greedy first. Greedy starts with an empty set G and in each iteration selects an item e with the highest marginal density ρ (e G) that still fits into the knapsack. We refer to the resulting solution as the greedy solution and denote it as G. Greedy+Max is based on augmenting each partial solution constructed by Greedy with the item of the largest marginal value (as opposed to density) and taking the best among such augmentations. Recall that Gi is the set of the first i items in the greedy solution. Greedy+Max finds for each i an augmenting item si which maximizes f (si ∪Gi) among all items that still fit, i.e. c(si ∪ Gi) ≤ K. The final output is the best among all such augmented solutions. Implementation is given as Algorithm 1. In the rest of this section we show that Greedy+Max gives 1/2-approximation. This Algorithm 1: Offline algorithm Greedy+Max Input: Set of elements E = e1, . . . , en, knapsack capacity K, cost function c(·), non-negative monotone submodular function f; Output: 1 G ← ∅, S ← ∅; while E (cid:54)= ∅ do 2-approximation for submodular maximization under knapsack constraint; S ← G ∪ s; s ← argmaxe∈E f (e G); if f (S) < f (G ∪ s) then a ← argmaxe∈E ρ (e G); G ← G ∪ a; K ← K − c(a); Remove all elements e ∈ E with c(e) > K; return S analysis is tight as illustrated by the following example: 2 and c(e3) = 1+ 2 . Let f be a linear function, i.e. f (S) =(cid:80) Example 2.1 Let e1, e2, e3 be three items such that f (e1) = f (e2) = 1  > 0. Let c(e1) = c(e2) = 1 Then OPT = {e1, e2} has value 1 while Greedy+Max outputs {e3} of value 1 As discussed in Section 1.3, our analysis is based on a number of differential inequalities for functions tracking the performance of our algorithm. We assume that these functions are continuous and piecewise smooth, and by ξ(cid:48)(x) we denote the right-hand derivative of ξ at point x. All these inequalities are of the form ξ(x) + αξ(cid:48)(x) ≥ β for some function ξ, applied in a certain range [u, v] and have some initial condition ξ(u). We frequently need to integrate these inequalities to get a lower bound on ξ(v) which can be done as follows: 2 +  for any e∈S f (e). 2 and f (e3) = 1 2 + . 6 Our proof proceeds by case analysis on whether o1, the item of the largest cost in OPT, is included in the greedy solution G or not. We first show that if o1 ∈ G, then f (G) is at least a 1/2-approximation. Let OPT be the optimal solution, i.e. the maximizer of f (OPT) under c(OPT) ≤ K. Let o1 be the element of the largest cost in OPT. W.l.o.g. and only for the sake of analysis of approximation we rescale the function values and costs so that f (OPT) = 1 and c(OPT) = K = 14. We first define a greedy performance function g(x) which allows us to track the performance of the greedy solution in a continuous fashion. Let G be the greedy solution computed by Algorithm 1 and let g1, g2, . . . , gm be the elements in G in the order they were added and recall that Gi = {g1, . . . , gi}. For a fixed x, let its greedy index i be the smallest index such that c(Gi) > x. Definition 2.2 (Greedy performance function) For x ∈ [0, 1] we define g(x) as: g(x) = f (Gi−1) + (x − c(Gi−i))ρ (gi Gi−1) . Note that g is a continuous and monotone piecewise-linear function such that g(0) = 0. Since an important role in the analysis is played by the derivative of this function we further define g(cid:48) to be the right derivative for g so that g(cid:48) is defined everywhere on the interval [0, c(G)) and is always non-negative. We now define a function g+(x) which tracks the performance of Greedy+Max when the greedy solution collects a set of cost x. Note that the cost of the last item which Greedy+Max uses to augment the solution does not count in the argument of this function. Definition 2.3 (Greedy+Max performance function) For any fixed x, let i be the smallest index such that c(Gi) > x. We define g+(x) = g(x) + f (v Gi−1), where v = argmax e∈E\Gi−1:c(e∪Gi−1)≤K f (eGi−1) is the element with the largest marginal gain with respect to the current partial greedy solution Gi−1. For technical reasons which we describe below instead of working directly with g+ it is easier to work with a lower bound on it g1 which has some nicer properties. For g1 we only consider adding o1, the largest item from OPT, to the current partial greedy solution. Note that hence g1 is only defined while this item still fits. Consider the last item added by the greedy solution before the cost of this solution exceeds 1 − c(o1). We define c∗ so that 1 − c(o1) − c∗ is the cost of the greedy solution before this item is taken. Definition 2.4 (Greedy+Max performance lower bound) For x ∈ [0, 1 − c (o1) − c∗] we define g1(x) = g(x) + f (o1 Gi−1) so that g1(x) ≤ g+(x). Lemma 2.5 (Greedy+Max inequality) Let g(cid:48) denote the right derivative of g. Then for all x ∈ [0, 1 − c (o1) − c∗], the following differential inequality holds: g1(x) + (1 − c (o1))g(cid:48)(x) ≥ 1 4Note that if c(OPT) < K then we can set K = c(OPT) first as this does not affect f (OP T ). 7 Similarly to the proof of the standard greedy inequality it suffices to show the statement Proof : only for points where x = c(Gi−1) for some i ≥ 1. Hence, we have g1(x) = g(c(Gi−1))+f (o1 Gi−1) = f (Gi−1∪o1). Since we normalized f (OPT) = 1, then by monotonicity, 1 = f (OPT) ≤ f (Gi−1∪OPT). Hence: 1 ≤ f (Gi−1 ∪ OPT) = f (Gi−1 ∪ o1) + f (OPT \ (o1 ∪ Gi−1)Gi−1 ∪ o1) ≤ g1(x) + f (eGi−1 ∪ o1) (cid:88) (cid:88) = g1(x) + e∈OPT\(o1∪Gi−1) e∈OPT\(o1∪Gi−1) c(e)ρ (eGi−1 ∪ o1) , where the second inequality is by submodularity and the definition of g1 and the last equality is by the definition of marginal density. Since x ≤ 1 − c (o1) − c∗, then all items in OPT \ (o1 ∪ Gi−1) still fit, as o1 is the largest item in OPT. Since the greedy algorithm always selects the item with the largest marginal density, then maxe∈OPT\(o1∪Gi−1) ρ (eGi−1 ∪ o1) ≤ g(cid:48)(x). Hence: 1 ≤ g1(x) + ≤ g1(x) + ≤ g1(x) + (cid:88) (cid:88) (cid:88) e∈OPT\(o1∪Gi−1) e∈OPT\(o1∪Gi−1) e∈OPT\(o1∪Gi−1) (cid:88) c(e)ρ (eGi−1 ∪ o1) c(e)ρ (eGi−1) c(e)g(cid:48)(x) = g1(x) + g(cid:48)(x) c(e) e∈OPT\(o1∪Gi−1) = g1(x) + g(cid:48)(x)c(OPT \ (o1 ∪ Gi−1)) ≤ g1(x) + g(cid:48)(x)(1 − c (o1)), where the last inequality follows from the normalization of c(OPT) ≤ 1 and the fact that o1 ∈ OPT. 2 Theorem 2.6 Recall that K = min(n, K) is an upper bound on the number of elements in feasible solutions. Then Greedy+Max gives a 1/2-approximation to the submodular maximization problem under a knapsack constraint and runs in O(cid:16) Kn (cid:17) time. Proof : By applying Lemma 2.5 at the point x = 1 − c (o1) − c∗, we have: g1(1 − c (o1) − c∗) + (1 − c (o1))g(cid:48)(1 − c (o1) − c∗) ≥ 1 2, then we have 1 g(cid:48)(1 − c (o1) − c∗) ≥ 1 − g1(1 − c (o1) − c∗) If g1(1− c(o1)− c∗) ≥ 1 2-approximation, because g1(1− c(o1)− c∗) is a lower bound on the value of the augmented solution when the cost of the greedy part is 1− c(o1)− c∗. Otherwise: > 1 1 − c (o1) 2(1 − c (o1)) . 8 Note that since g(0) = 0 and g(cid:48) is non-increasing by the definition of Greedy, for any x ∈ [0, 1] we have g(x) ≥ g(cid:48)(x) · x: (cid:90) x g(x) ≥ (cid:90) x g(cid:48)(χ)dχ ≥ g(cid:48)(x)dχ = g(cid:48)(x) · x, Therefore, applying this inequality at x = 1 − c (o1) − c∗: χ=0 χ=0 g(1 − c (o1) − c∗) ≥ (1 − c (o1) − c∗)g(cid:48)(1 − c (o1) − c∗) ≥ 1 − c (o1) − c∗ 2(1 − c (o1)) . Recall that 1 − c (o1) − c∗ was the last cost of the greedy solution when we could still augment it with o1; therefore, the next element e that the greedy solution selects has the cost at least (1 − c (o1)) − (1 − c (o1) − c∗) = c∗. Thus, the function value after taking e is at least g(1 − c (o1) − c∗) + c∗g(cid:48)(1 − c (o1) − c∗) ≥ 1 − c (o1) − c∗ 2(1 − c (o1)) + c∗ 2(1 − c (o1)) = 1 2 Hence, Algorithm 1 gives a 1 2-approximation to the submodular maximization problem under a knapsack constraint. It remains to analyze the running time and query complexity of Algorithm 1. Since K is the maximum size of a feasible set, Algorithm 1 makes at most K iterations. In each . 2 iteration, it makes O (n) oracle queries, so the total number of queries and runtime is O(cid:16) Kn (cid:17) 2.2 Streaming algorithm Sieve+Max Our multi-pass streaming algorithm is given as Algorithm 2. To simplify the presentation, we first give the algorithm under the assumption that it is given a parameter λ, which is a constant-factor approximation of f (OPT). We then show how to remove this assumption using standard techniques in Theorem B.3. As discussed in the description of our techniques Sieve+Max uses O (1/) passes over the data to simulate the execution of Greedy+Max approximately. In the analysis, which gives the proof of Theorem 1.2, we define functions t, t+, and t1 analogous to g, g+, and g1 respectively, based on Ti, the first i items collected by the thresholding algorithm. We show that t and t1 satisfy the same differential inequalities as g and g1 respectively, up to (1 + ) factors, and similar to before, our analysis then proceeds by casework on whether o1, the largest item in OPT, is included in the thresholding solution T or not. We first show that if o1 ∈ T , then f (T ) is at least a(cid:0) 1 2 − (cid:1)-approximation. Let T be the set of items constructed Sieve+Max (as in Algorithm 2) and let t1, t2, . . . be the order that they are collected. We refer to the part of the algorithm which constructs T as "thresholding" and the rest as "augmentation" below. We use Ti to denote the set containing the i items {t1, t2, . . . , ti}. We again use o1 to denote the item with highest cost in OPT. Similar to the above, we define two functions representing the values of our thresholding algorithm, and augmented solutions given the utilized proportion of the knapsack. Definition 2.7 (Thresholding performance function) For any x ∈ [0, 1], let i be the smallest index such that c(Ti) > x. We define t(x) = f (Ti−1) + (x − c(Ti−i))ρ (ti Ti−1) and t(cid:48)(x) to be the right derivative of t. 9 Algorithm 2: Multi-pass streaming algorithm Sieve+Max Input: Stream e1, . . . , en, knapsack capacity K, cost function c(·), non-negative monotone submodular function f, λ which is an α-approximation of f (OPT) for some fixed constant α>0,  > 0; Output: (1/2 − )-approx. for submodular maximization under a knapsack constraint; T ← ∅, τ ← λ αK ; 2K do while τ > λ // Thresholding stage Take a new pass over the stream; for each read item e do if ρ (e T ) ≥ τ and c(e ∪ T ) ≤ K then T ← T ∪ {e}; τ ← τ /(1 + ); For each i, let Gi be the first i selected in the construction of T above and let si = ∅; Take a pass over the stream; for each read item e do // Augmentation stage if e /∈ T then j = max{ic(Gi) + c(e) ≤ K}; if f (Gj ∪ sj) < f (Gj ∪ e) then sj ← {e}; return argmax f (Gi ∪ si) We define a function t1(x) that lower bounds the performance of Sieve+Max when the thresh- olding solution collects a set of cost x: Definition 2.8 (Sieve+Max performance function and lower bound) For any fixed x, let i be the smallest index such that c(Ti) > x. Then we define t1(x) = t(x) + f (o1 Ti−1), where o1 = argmaxe∈OPT c(e). In order to analyze the output of the algorithm, we prove a differential inequality for t1 rather than t+. If c(T ) ≥ 1 − c(o1) then let c∗ ≥ 0 be defined so that 1 − c(o1) − c∗ is the cost of the thresholding solution before the algorithm takes the item which makes the cost exceed 1 − c(o1). Lemma 2.9 (Sieve+Max Inequality) If c(T ) ≥ 1 − c(o1) then for all x ∈ [0, 1 − c (o1) − c∗], then t and t1 satisfy the following differential inequality: t1(x) + (1 + )(1 − c (o1))t(cid:48)(x) ≥ 1. First, note that for x ∈ [0, p] where p is the total cost of items taken in the first Proof : pass the inequality holds trivially since t(cid:48)(x) ≥ 1 (as in the proof of the standard thresholding inequality). Hence assume that x ∈ [p, 1 − c(o1) − c∗] is fixed and consider any pass after the first one. Similarly to other proofs it suffices to only consider left endpoints of the intervals of the form [c(Ti−1), c(Ti)) so let x = c(Ti−1). Since we normalized f (OPT) = 1, then by monotonicity, 10 1 = f (OPT) ≤ f (Ti−1 ∪ OPT). Hence: 1 ≤ f (Ti−1 ∪ OPT) = f ((Ti−1 ∪ o1) ∪ (OPT \ o1)) = f (Ti−1 ∪ o1) + f (OPT \ (o1 ∪ Ti−1)Ti−1 ∪ o1) ≤ t1(x) + f (eTi−1 ∪ o1) = t1(x) + e∈OPT\(o1∪Ti−1) e∈OPT\(o1∪Ti−1) c(e)ρ (eTi−1 ∪ o1) , (cid:88) (cid:88) where the second inequality is by submodularity and the last line is by the definition of marginal density. Since o1 has the maximum cost in OPT. x ≤ 1 − c (o1), all items in OPT \ (o1 ∪ Ti−1) still fit into the remaining knapsack capacity. In all passes after the first one, the thresholding algorithm always selects an element which gives 1+-approximation of the highest possible marginal density: 1 Combining with the inequality above: (cid:88) (1 + )t(x) ≥ max e∈OPT\(o1∪Ti−1) ρ (e o1 ∪ Ti−1) . 1 ≤ t1(x) + c(e)ρ (eTi−1 ∪ o1) e∈OPT\(o1∪Ti−1) ≤ t1(x) + (1 + )t(cid:48)(x) (cid:88) c(e) e∈OPT\(o1∪Ti−1) = t1(x) + (1 + )t(cid:48)(x)c(OPT \ (o1 ∪ Ti−1)) ≤ t1(x) + (1 + )t(cid:48)(x)(1 − c (o1)), where the last equality is by the normalization of c(OPT) = 1 and the fact that o1 ∈ OPT. Theorem 2.10 There exists an algorithm that uses O(cid:16) K makes O(cid:16) n/ + n log K (cid:17) space and O (1/) passes over the stream, queries, and outputs a (1/2 − )-approximation to the submodular maxi- (cid:17) 2 mization problem under a knapsack constraint. Proof : We can use existing algorithm from Theorem B.3 to obtain a constant factor approxi- mation λ to f (OPT). We thus analyze the correctness of Algorithm 2 given an input λ that is a constant factor approximation to f (OPT). The proof is similar to proof of Theorem 2.6. By applying Lemma 2.9 at the point x = 1 − c (o1) − c∗, we have: t1(1 − c (o1) − c∗) + (1 + )(1 − c (o1))t(cid:48)(1 − c (o1) − c∗) ≥ 1 2-approximation, because t1(1− c(o1)− c∗) is a lower bound If t1(1− c (o1)− c∗) ≥ 1 on the value of the augmented solution when the cost of the thresholding solution is 1 − c(o1) − c∗. Otherwise: 2, then we have 1 t(cid:48)(1 − c (o1) − c∗) ≥ 1 − g1(1 − c (o1) − c∗) (1 − c (o1))(1 + ) 2(1 − c (o1))(1 + ) > 1 11 Note that since t(0) = 0, for any x ∈ [0, 1] we have t(x) ≥ t(cid:48)(x)·x 1+ : t(cid:48)(x) · x 1 +  t(cid:48)(χ)dχ ≥ t(cid:48)(x) 1 +  (cid:90) x (cid:90) x t(x) ≥ dχ = , χ=0 χ=0 where we used the fact that t(cid:48) is a 1 not increase. Therefore, applying this at x = 1 − c (o1) − c∗: 1+ approximation of the maximum marginal density, which does t(1 − c (o1) − c∗) ≥ (1 − c (o1) − c∗)t(cid:48)(1 − c (o1) − c∗) ≥ 1 − c (o1) − c∗ 2(1 − c (o1))(1 + ) . Recall that 1 − c (o1) − c∗ was the last cost of the thresholding solution when we could still augment it with o1; therefore, the next element e that the thresholding solution selects has the cost at least (1 − c (o1)) − (1 − c (o1) − c∗) = c∗. Thus, the function value after taking e is at least 1 =  c∗ 2(1 + ) 2(1 + ) = 1 2 − . ≥ 1 2 + 2(1 − c (o1))(1 + ) 2 implies that t(x) > 1 2 by Lemma A.3. 2K since t(cid:48)(x) < 1 (cid:17) under knapsack constraints, given a constant factor approximation to f (OPT). Note that it suffices to consider only thresholds up to τ 2 − (cid:1)-approximation to the submodular maximization problem g(1 − c (o1) − c∗) + c∗g(cid:48)(1 − c (o1) − c∗) ≥ 1 − c (o1) − c∗ 2(1 − c (o1))(1 + ) − Hence, Algorithm 2 gives a (cid:0) 1 in Theorem B.3) that use additional O(cid:16) stored by the augmented solution S. Hence, the space complexity of Algorithm 2 is O(cid:16) K most O(cid:0) n In this section, we assume that there are m = (cid:112)n/ K machines M1, . . . , Mm, each with O(cid:0) n (cid:112) Using existing algorithms to obtain a constant factor approximation λ (e.g., by setting  = 1 6 queries, then correctness of Algorithm 2 follows. It remains to analyze the space and query complexity of Algorithm 2. Since each item has cost at least 1, at most K items are stored by the thresholding algorithm, and at most K items are . If τ is an α-approximation to f (OPT) for some constant α, then the algorithm makes log1+  passes over the input stream. Each pass makes at most n queries, so the number of queries is at 2 2.3 Distributed algorithm Distributed Sieve+Max (cid:17) 2α = O(cid:0) 1 n K) amount of local memory. Our distributed algorithm (Algorithm 3) follows a similar O( thresholding approach as our streaming algorithm: at each round, machines collect items whose marginal densities exceed the threshold corresponding to the round. (cid:1) = n log K (cid:1).  (cid:1) m We require the following form of Azuma's inequality for submartingales. Theorem 2.11 (Azuma's Inequality) Suppose X0, X1, . . . , Xn is a submartingale and Xi − Xi+1 ≤ ci. Then 1 (cid:18) −t2 2(cid:80) i c2 i (cid:19) . Pr [Xn − X0 ≤ −t] ≤ exp 12 Algorithm 3: Distributed Sieve+Max: A O(cid:0) 1 (cid:1)-round MapReduce algorithm for sub- modular maximization under knapsack constraints. Input: Set of elements E = e1, . . . , en, knapsack capacity K, cost function c(·), non-negative monotone submodular function f, τ that is α-approximation of f (OPT) for some constant α > 0; Output: A set S that is a ( 1 knapsack constraint; T ← ∅, t ← τ while t > τ 2 − )-approximation for submodular maximization with a αK , K ← min(n, K); 2K do  (cid:113) Form Γ by sampling each e ∈ E with probability 4 Partition E randomly into sets V1, V2, . . . Vm; Send Vi to machine Mi for all i; Send Γ and T to all machines including a central machine C; for each machine Mi (in parallel) do K/n; Xi = T ; for each item e ∈ Γ do if ρ(eXi) > t then Xi = Xi ∪ {e}; for each item e ∈ Vi do if ρ(eXi) > t then Xi = Xi ∪ {e}; Xi = Xi \ T ; Send Xi \ T to C; if ρ(eT ) > t then T = T ∪ {e}; for each item e ∈ ∪Xi (on central machine) do For each i, let Gi denote the first i items that a greedy algorithm would select from T and initialize si = ∅; for each item e ∈ Vi \ T do t = t 1+ Send T to all machines; for each machine Mi (in parallel) do j = max{ic(e) + c(Gi) ≤ K}; if f (Gj ∪ sj) < f (Gj ∪ e) then sj ← e; Send argmax f (Gi ∪ si)} to C; return argmax of solutions received in C 13 n K. (cid:112) Since each element is sampled with probability K We first bound the total number of elements sent to the central machine. Lemma 2.12 In Algorithm 3, with probability 1− e−Ω(K), the total number of elements sent to the central machine is n , the expected number of elements in Proof : n K with probability at least 1 − e−Ω( K) by standard Γi is 4 Chernoff bounds. Let Ni denote the total number of elements with marginal density at least f (OPT) (1+)i K with respect to Ti−1, so that the number of elements sent to the central unit in round i is exactly Ni + Γi. (cid:112) Suppose Γi is partitioned into at least 3 K chunks of size(cid:113) n n K for any round i. Hence Γi ≥ 3 elements. If there are less than (cid:112) K n K remaining elements before each chunk whose marginal density with respect to Ti−1 exceeds f (OPT) (1+)i K , then certainly at most n K elements are sent to the central machine. (cid:112) (cid:112) (cid:112) 1 −(cid:113) K n (cid:18) (cid:19)√ n On the other hand, if there are at least n K remaining elements before each chunk whose . Then an additional element is added to Ni marginal density with respect to Ti−1 exceeds f (OPT) (1+)i K with probability at least 1 − > 1/2. To use a martingale argument to bound the (cid:80)i number of elements selected in Γi, we let Xi be the indicator random variable for the event that at least one element is selected from the ith block so that we have E[Xi X1, . . . , Xi−1] ≥ 1 2. Let Yi = j=1(Xi − 1/2) so that the sequence Y1, Y2, . . . is a submartingale, i.e., E[Yi Y1, . . . , Yi−1] ≥ Yi−1 (cid:80)3 K and Yi − Yi−1 ≤ 1. By Azuma's inequality (Theorem 2.11), Pr[Y3 K < − 1 K] < e−Ω( K), so that K ≥ K with probability at least 1 − e−Ω( K), in which case no elements are sent 2 j=1 Xj = YK + 3 2 to the central machine. K 2 We now analyze the approximation guarantee and performance of Algorithm 3. of communication between (cid:112)n/ K machines, each with O(cid:16)(cid:112) Theorem 2.13 There exists an algorithm Distributed Sieve+Max which uses O (1/) rounds memory. With high probability, n K the total number of elements sent to the central machine is (1/2 − )-approximation to the submodular maximization problem with a knapsack constraint. Proof : the same manner as Algorithm 2. The space bounds follow from Lemma 2.12. Correctness follows from the observation that the algorithm performs thresholding in 2 n K and the algorithm outputs a (cid:17) (cid:112) 2.4 Query lower bound We show a simple query lower bound under the standard assumption [NTM+18, KMZ+19] that the algorithm only queries f on feasible sets. Theorem 2.14 For α > 1/2, any α-approximation algorithm for maximizing a function f under a knapsack constraint that succeeds with constant probability and only queries values of the function f on feasible sets (i.e. sets of cost at most K) must make at least Ω(n2) queries if f is either: 1) non- monotone submodular, 2) monotone and submodular on the feasible sets, 3) monotone subadditive. 14 Let e1, . . . , en be the set of elements and set c(ei) = K/2 for all i. By Yao's principle it Proof : suffices to consider two hard distributions D1/2 and D1 such that the optimum for every instance in the support of these distributions is 1/2 and 1 respectively and then show that no algorithm making o(n2) deterministic queries can distinguish the two distributions with constant probability. The distributions D1/2 and D1 are as follows: • D1/2 has f (S) = 1/2 for all S (cid:54)= ∅. • D1 is constructed by picking two items ei (cid:54)= ej uniformly at random and assigning f (S) = 1 for S = {ei, ej}. Otherwise, set f (S) = 1/2 for all S (cid:54)= ∅ and S (cid:54)= {ei, ej}. Q/(cid:0)n (cid:1). Hence if the algorithm succeeds with a constant probability then it must be the case that Fix the set of deterministic queries Q that the algorithm makes. Since the algorithm is only allowed to make queries to sets of cost at most K, all sets in Q have size at most two. Furthermore, note that f (ei) = 1/2 for all i under both D1/2 and D1. Thus, only queries to sets of size exactly two can help the algorithm distinguish the two distributions. All such queries give value 1/2 under both distributions except for a single query (i, j) under D1 which gives value 1. Since (i, j) is chosen uniformly at random under D1 the probability that a fixed set Q contains it is given as Q = Ω(n2). Note that the construction of f results in a non-monotone submodular function but f is mono- tone when restricted to feasible sets of size at most two items. By changing D1 so that the functions in this distribution take value 1 on all sets of size more than 2 one can ensure monotonicity of f. However, f is still submodular on the feasible sets and subadditive everywhere (recall that a subadditive function satisfies f (S) + f (T ) ≥ f (S ∪ T ) for all S, T ⊆ U). 2 2 3 Experimental results We compare our offline algorithm Greedy+Max and our streaming algorithm Sieve+Max with baselines, answering the following questions: (1) What are the approximation factors we are getting on real data? (2) How do the objective values compare? (3) How do the runtimes compare? (4) How do the numbers of queries compare? We compare Greedy+Max to the following baselines: (1) PartialEnum+Greedy [Svi04]. Given an input parameter d, this algorithm creates a separate knapsack for each combination of d items, and then runs the Greedy algorithm on each of the knapsacks. At the end, the algorithm outputs the best solution among all knapsacks, so that the total runtime is Ω(Knd+1). In fact, PartialEnum+Greedy is only feasible for d = 1 and our smallest dataset. (2) Greedy. This algorithm starts with an empty knapsack and repeatedly adds the item with the highest marginal density with respect to the collected items in the knapsack, until no more item can be added to the knapsack. (3) GreedyOrMax [KMN99]. This algorithm compares the value of the best item with the value of the output of the Greedy algorithm and outputs the better of the two. In streaming we compare Sieve+Max to Sieve [BMKK14] and SieveOrMax [HKY17], which are similar thresholding-based algorithms. Sieve starts with an empty knapsack and collects all items whose marginal density with respect to the items in the knapsack exceed a given threshold 2), while SieveOrMax uses a similar approach, but compares the items (which is initially equal to 1 collected by the thresholding algorithm to the best single item, and outputs the better of the two 15 solutions. We also implemented a single-pass BranchingMRT by [HKY17] that uses thresholding along with multiple branches and gives a 4/11 ≈ 0.36-approximation. We did not implement [HK19] as their algorithms are orders of magnitude slower than BranchingMRT which is already several orders of magnitude slower than other algorithms. Our code is available at https://github.com/aistats20submodular/aistats20submodular. 3.1 Objectives and Datasets Graph coverage. For a graph G(V, E) and Z ⊂ V , the objective is to maximize the neighborhood vertex coverage function f (Z) := Z ∪ N (Z)/V , where N (Z) is the set of neighbors of Z. The cost of each node is roughly proportional to the value of the node. Specifically, the cost of each node v ∈ V is c(v) = βV (N (v) − α), where α = 1 20 and β is a normalizing factor so that c(v) ≥ 1, so that the cost of each node is roughly proportional to the value of the node. We ran experiments on two graphs from SNAP [LK14]: 1) ego-Facebook(4K vertices, 81K edges), 2) com-DBLP (317K vertices, 1M edges). Movie ratings. We also analyze a dataset of movies to model the scenario of movie recom- mendation. The objective function, defined as in [AMYZ19], is maximized for a set of movies that is similar to a user's interests and the cost of a movie is set to be roughly proportional to its value. Each movie is assigned a rating in the range [1, 5] by users. Let rx,u be the rating assigned by user u to movie x and ravg be the average rating across all movies. For each movie x, we normalize the ratings to produce a vector vx by setting vx,u = 0 if user u did not rate movie x and vx,u = rx,u−ravg otherwise. We then define the similarity between two movies x1 and x2 as the dot product (cid:104)vx1, vx2(cid:105) of their vectors. Given a set X of movies, to quantify how representative a subset of movies Z is, we x∈X maxz∈Z(cid:104)vz, vx(cid:105). Hence, the maximizer of fX (Z) corresponds to a set of movies that is similar to the user's interests. We analyze the ml-20 MovieLens dataset [Gro15], which contains approximately 27K movies and 20M ratings. consider a parameterized objective function fX (Z) =(cid:80) 3.2 Results We first give instance-specific approximation factors for different values of K for offline (Fig. 2) and streaming (Fig. 3) algorithms. These approximations are computed using upper bounds on f (OPT) which can be obtained using the analysis of Greedy. Greedy+Max and Sieve+Max typically perform at least 20% better than their 1/2 worst-case guarantees. In fact, our results show that the output value can be improved by up to 50%, both by Greedy+Max upon Greedy (Figure 4) and by Sieve+Max upon Sieve (Figure 5). Running time. We point out that the runtimes of Greedy+Max and GreedyOrMax algo- rithms are similar, being at most 20% greater than the runtime of Greedy, as shown in Figure 6. On the other hand, even though PartialEnum+Greedy does not outperform Greedy+Max, it is only feasible for d = 1 and the ego-Facebook dataset and uses on average almost 500 times as much runtime for K = 10 across ten iterations of each algorithm, as shown in Figure 6. The runtimes of Sieve+Max, SieveOrMax, and Sieve are generally similar; however in the case of the com-dbpl dataset, the runtime of Sieve+Max grows with K. This can be explained by the fact that oracle calls on larger sets typically require more time, and augmented sets typically contain more elements than sets encountered during execution of Sieve. On the other hand, the runtime of BranchingMRT was substantially slower, and we did not include its runtime for scaling purposes, 16 (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 2: Instance-specific approximations for different K. Greedy+Max performs substantially better than its worst-case 1/2-approximation guarantee and typically beats even the (1− 1/e) ≈ 0.63 bound. Despite much higher runtime, PartialEnum+Greedy does not beat Greedy+Max even on the only dataset where its runtime is feasible (ego-Facebook). (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 3: Instance-specific approximations for different K. Sieve+Max performs substantially better than its worst-case (1/2 − )-approximation guarantee and robustly dominates all other approaches. It can improve by up to 40% upon Sieve. Despite much higher runtime, BranchingMRT does not beat Sieve+Max (some data points not shown for BranchingMRT as it did not terminate under a 200-second time limit). as for K = 5, the runtime of BranchingMRT was already a factor 80K more than Sieve. Error bars for the standard deviations of the runtimes of the streaming algorithms are given in Figure 8. Oracle calls. We also compare the number of oracle calls performed by the algorithms. Greedy+Max, GreedyOrMax and Greedy require the same amount of oracle calls, since computing marginal gains and finding the best element for augmentation compute the objective on the same set. On the other hand, PartialEnum+Greedy requires 544x more calls than Greedy for K = 8. For the 17 510K0.50.60.7OPT approximation510K0.50.60.7OPT approximation510K0.40.50.6OPT approximationGreedyGreedy+MaxGreedyOrMaxPartialEnum+Greedy510K0.600.650.70OPT approximation510K0.50.60.7OPT approximation510K0.40.50.6OPT approximationSieveSieve+MaxSieveOrMaxBranchingMRT (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 4: Ratio of the objective of offline algorithms to the objective of Greedy for different values of K. Greedy+Max can improve by almost 50% upon Greedy, but by definition, Greedy+Max and GreedyOrMax cannot perform worse than Greedy. Despite its runtime, PartialEnum+Greedy does not outperform Greedy+Max on the ego-Facebook dataset. (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 5: Ratio of the objective of streaming algorithms to the objective of Sieve for different values of K. Sieve+Max can improve by almost 40% upon Sieve, but by definition, Sieve+Max and SieveOrMax cannot perform worse than Sieve. Despite its runtime, BranchingMRT does not outperform Sieve+Max. streaming algorithms, the number of oracle calls made by Sieve, Sieve+Max, and Sieve, never differed by more than a factor of two, while BranchingMRT requires a factor 125K more oracle calls than Sieve for K = 8. We illustrate the number of oracle calls made by these algorithms in Figure 9. 18 510K1.01.21.4Ratio to Greedy objective510K1.01.21.4Ratio to Greedy objective510K1.01.21.4Ratio to Greedy objectiveGreedy+MaxGreedyOrMaxPartialEnum+Greedy510K1.001.051.101.15Ratio to Sieve objective510K1.01.21.4Ratio to Sieve objective510K1.01.21.4Ratio to Sieve objectiveSieve+MaxSieveOrMaxBranchingMRT (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 6: Ratio of runtime of offline algorithms to the runtime of Greedy, for different values of K. Observe that Greedy+Max and GreedyOrMax show similar running time, which is at most 20% greater than Greedy running time. The ratio of PartialEnum+Greedy runtime is not displayed, due to it being several orders of magnitude larger, e.g., 1000 times larger for K = 15. (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 7: Ratio of average runtime of streaming algorithms to the average runtime of Sieve for different values of K, across ten iterations. The larger ratios can be explained from the oracle calls made on larger sets by Sieve+Max being more expensive than the average oracle call made by Sieve. The ratio of BranchingMRT runtime is not displayed, due to being several orders of magnitude larger, e.g., 80K times larger for K = 5. References [AHN+19] Nima Anari, Nika Haghtalab, Seffi Naor, Sebastian Pokutta, Mohit Singh, and Al- fredo Torrico. Structured robust submodular maximization: Offline and online algo- rithms. In Proceedings of Machine Learning Research, volume 89 of Proceedings of Machine Learning Research, pages 3128 -- 3137. PMLR, 16 -- 18 Apr 2019. [AMYZ19] Dmitrii Avdiukhin, Slobodan Mitrovic, Grigory Yaroslavtsev, and Samson Zhou. Ad- versarially robust submodular maximization under knapsack constraints. In Proceed- 19 2.55.07.510.0K0.80.91.01.1Ratio to Greedy time2.55.07.510.0K0.51.01.52.0Ratio to Greedy time2.55.07.510.0K0.70.80.91.0Ratio to Greedy timeGreedy+MaxGreedyOrMax2.55.07.510.0K2.02.53.03.5Ratio to Sieve time2.55.07.510.0K02468Ratio to Sieve time2.55.07.510.0K1.01.11.21.3Ratio to Sieve timeSieve+MaxSieveOrMax (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 8: Ratio of average runtime of streaming algorithms compared to the average runtime of Sieve, with error bars representing one standard deviation for each algorithm on the corresponding knapsack constraint across ten iterations. (a) com-dblp (b) ego-Facebook (c) ml-20 Fig. 9: Smoothed ratio of average number of oracle calls made by streaming algorithms compared to the average number of oracles calls made by Sieve, across ten iterations. ings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD., pages 148 -- 156, 2019. [ANOY14] Alexandr Andoni, Aleksandar Nikolov, Krzysztof Onak, and Grigory Yaroslavtsev. Parallel algorithms for geometric graph problems. In Symposium on Theory of Com- puting, STOC, pages 574 -- 583, 2014. [ASS19] [BEM18] Shipra Agrawal, Mohammad Shadravan, and Cliff Stein. Submodular secretary prob- lem with shortlists. In 10th Innovations in Theoretical Computer Science Conference, ITCS, 2019. MohammadHossein Bateni, Hossein Esfandiari, and Vahab S. Mirrokni. Optimal distributed submodular optimization via sketching. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD, pages 1138 -- 1147, 2018. 20 2.55.07.510.0K234Ratio to Sieve time2.55.07.510.0K0510Ratio to Sieve time2.55.07.510.0K1.01.21.4Ratio to Sieve timeSieve+MaxSieveOrMax510K1.82.02.2Ratio to Sieve oracle calls510K1.801.851.901.952.00Ratio to Sieve oracle calls510K1.01.21.41.61.8Ratio to Sieve oracle calls [BFS15] [BMKK14] [BMSC17] [BRS19] [BS18] [BV14] [CCPV11] [CGQ15] [CHJ+17] [CK14] [CQ19] Niv Buchbinder, Moran Feldman, and Roy Schwartz. Online submodular maxi- mization with preemption. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 1202 -- 1216, 2015. Ashwinkumar Badanidiyuru, Baharan Mirzasoleiman, Amin Karbasi, and Andreas Krause. Streaming submodular maximization: Massive data summarization on the fly. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 671 -- 680. ACM, 2014. Ilija Bogunovic, Slobodan Mitrović, Jonathan Scarlett, and Volkan Cevher. Robust submodular maximization: A non-uniform partitioning approach. In Proceedings of the 34th International Conference on Machine Learning, ICML, pages 508 -- 516, 2017. Eric Balkanski, Aviad Rubinstein, and Yaron Singer. An exponential speedup in parallel running time for submodular maximization without loss in approximation. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 283 -- 302, 2019. Eric Balkanski and Yaron Singer. The adaptive complexity of maximizing a sub- modular function. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC, pages 1138 -- 1151, 2018. Ashwinkumar Badanidiyuru and Jan Vondrák. Fast algorithms for maximizing sub- modular functions. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Sympo- sium on Discrete Algorithms, SODA, pages 1497 -- 1514, 2014. 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. Chandra Chekuri, Shalmoli Gupta, and Kent Quanrud. Streaming algorithms for submodular function maximization. In Automata, Languages, and Programming - 42nd International Colloquium, ICALP, Proceedings, Part I, pages 318 -- 330, 2015. T.-H. Hubert Chan, Zhiyi Huang, Shaofeng H.-C. Jiang, Ning Kang, and Zhi- hao Gavin Tang. Online submodular maximization with free disposal: Randomiza- tion beats 0.25 for partition matroids. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 1204 -- 1223, 2017. Amit Chakrabarti and Sagar Kale. Submodular maximization meets streaming: Matchings, matroids, and more. In Integer Programming and Combinatorial Op- timization - 17th International Conference, IPCO. Proceedings, pages 210 -- 221, 2014. Chandra Chekuri and Kent Quanrud. Submodular function maximization in parallel via the multilinear relaxation. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 303 -- 322, 2019. [dPBENW15] Rafael da Ponte Barbosa, Alina Ene, Huy L. Nguyen, and Justin Ward. The power In of randomization: Distributed submodular maximization on massive datasets. 21 Proceedings of the 32nd International Conference on Machine Learning, ICML, pages 1236 -- 1244, 2015. [dPBENW16] Rafael da Ponte Barbosa, Alina Ene, Huy L. Nguyen, and Justin Ward. A new frame- work for distributed submodular maximization. In IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS, pages 645 -- 654, 2016. [EAG11] [EDFK17] Khalid El-Arini and Carlos Guestrin. Beyond keyword search: discovering relevant scientific literature. In Proceedings of the 17th ACM SIGKDD international confer- ence on Knowledge discovery and data mining, pages 439 -- 447. ACM, 2011. Ethan R. Elenberg, Alexandros G. Dimakis, Moran Feldman, and Amin Karbasi. Streaming weak submodularity: Interpreting neural networks on the fly. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Infor- mation Processing Systems, pages 4047 -- 4057, 2017. [ELVZ17] Alessandro Epasto, Silvio Lattanzi, Sergei Vassilvitskii, and Morteza Zadimoghad- dam. Submodular optimization over sliding windows. In Proceedings of the 26th International Conference on World Wide Web, WWW, pages 421 -- 430, 2017. [EN19a] [EN19b] [Fei98] [FKK18] [FMZ19] [GK10] [GK11] Alina Ene and Huy L. Nguyen. A nearly-linear time algorithm for submodular maxi- mization with a knapsack constraint. In 46th International Colloquium on Automata, Languages, and Programming, ICALP, pages 53:1 -- 53:12, 2019. Alina Ene and Huy L. Nguyen. Submodular maximization with nearly-optimal ap- proximation and adaptivity in nearly-linear time. In Proceedings of the Thirtieth An- nual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 274 -- 282, 2019. Uriel Feige. A threshold of ln n for approximating set cover. J. ACM, 45(4):634 -- 652, 1998. Moran Feldman, Amin Karbasi, and Ehsan Kazemi. Do less, get more: Streaming submodular maximization with subsampling. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Sys- tems, NeurIPS, pages 730 -- 740, 2018. Matthew Fahrbach, Vahab S. Mirrokni, and Morteza Zadimoghaddam. Submodular maximization with nearly optimal approximation, adaptivity and query complexity. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algo- rithms, SODA, pages 255 -- 273, 2019. Ryan Gomes and Andreas Krause. Budgeted nonparametric learning from data streams. In Proceedings of the 27th International Conference on Machine Learning, ICML, pages 391 -- 398, 2010. Daniel Golovin and Andreas Krause. Adaptive submodularity: Theory and applica- tions in active learning and stochastic optimization. Journal of Artificial Intelligence Research, 42:427 -- 486, 2011. 22 [Gro15] [HK19] [HKY17] [HMS08] [IB19] [KGPK15] [KMN99] [KMVV15] [KMZ+19] [KSV10] [LB11] GroupLens. Datasets. https://grouplens.org/datasets/movielens, 2015. MovieLens Chien-Chung Huang and Naonori Kakimura. Multi-pass streaming algorithms for monotone submodular function maximization. In Algorithms and Data Structures - 16th International Symposium, WADS, 2019. (to appear). https://arxiv.org/abs/ 1802.06212. Chien-Chung Huang, Naonori Kakimura, and Yuichi Yoshida. Streaming algorithms for maximizing monotone submodular functions under a knapsack constraint. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM, pages 11:1 -- 11:14, 2017. Jason Hartline, Vahab Mirrokni, and Mukund Sundararajan. Optimal marketing strategies over social networks. In Proceedings of the 17th International Conference on World Wide Web, WWW '08, pages 189 -- 198. ACM, 2008. Rishabh Iyer and Jeffrey Bilmes. Near optimal algorithms for hard submodular programs with discounted cooperative costs. In Proceedings of Machine Learning Research, volume 89 of Proceedings of Machine Learning Research, pages 276 -- 285. PMLR, 16 -- 18 Apr 2019. Rajiv Khanna, Joydeep Ghosh, Russell Poldrack, and Oluwasanmi Koyejo. Sparse Submodular Probabilistic PCA. In Proceedings of the Eighteenth International Con- ference on Artificial Intelligence and Statistics, volume 38 of Proceedings of Machine Learning Research, pages 453 -- 461. PMLR, 09 -- 12 May 2015. Samir Khuller, Anna Moss, and Joseph Naor. The budgeted maximum coverage problem. Inf. Process. Lett., 70(1):39 -- 45, 1999. Ravi Kumar, Benjamin Moseley, Sergei Vassilvitskii, and Andrea Vattani. Fast greedy algorithms in mapreduce and streaming. ACM Transactions on Parallel Com- puting (TOPC), 2(3):14, 2015. Ehsan Kazemi, Marko Mitrovic, Morteza Zadimoghaddam, Silvio Lattanzi, and Amin Karbasi. Submodular streaming in all its glory: Tight approximation, minimum memory and low adaptive complexity. In Proceedings of the 36th International Con- ference on Machine Learning, ICML, pages 3311 -- 3320, 2019. Howard J. Karloff, Siddharth Suri, and Sergei Vassilvitskii. A model of computation for mapreduce. In Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 938 -- 948, 2010. Hui Lin and Jeff Bilmes. A class of submodular functions for document summariza- tion. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pages 510 -- 520. Association for Computational Linguistics, 2011. [LK14] Jure Leskovec and Andrej Krevl. SNAP Datasets: Stanford large network dataset collection. http://snap.stanford.edu/data, June 2014. 23 [LKG+07] [LV19] [LWD16] [MBN+17] [MJK18] Jure Leskovec, Andreas Krause, Carlos Guestrin, Christos Faloutsos, Jeanne Van- Briesen, and Natalie Glance. Cost-effective outbreak detection in networks. In Pro- ceedings of the 13th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 420 -- 429. ACM, 2007. Paul Liu and Jan Vondrák. Submodular optimization in the mapreduce model. In 2nd Symposium on Simplicity in Algorithms, SOSA@SODA 2019, pages 18:1 -- 18:10, 2019. Erik M. Lindgren, Shanshan Wu, and Alexandros G. Dimakis. Leveraging sparsity for efficient submodular data summarization. In Advances in Neural Information Pro- cessing Systems 29: Annual Conference on Neural Information Processing Systems, pages 3414 -- 3422, 2016. Slobodan Mitrović, Ilija Bogunovic, Ashkan Norouzi-Fard, Jakub Tarnawski, and Volkan Cevher. Streaming robust submodular maximization: A partitioned thresh- olding approach. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems, pages 4560 -- 4569, 2017. Baharan Mirzasoleiman, Stefanie Jegelka, and Andreas Krause. Streaming non- monotone submodular maximization: Personalized video summarization on the fly. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI- 18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), pages 1379 -- 1386, 2018. [MKSK13] Baharan Mirzasoleiman, Amin Karbasi, Rik Sarkar, and Andreas Krause. Distributed submodular maximization: Identifying representative elements in massive data. In Advances in Neural Information Processing Systems, pages 2049 -- 2057, 2013. [MZ15] [MZK16] [NTM+18] Vahab S. Mirrokni and Morteza Zadimoghaddam. Randomized composable core- sets for distributed submodular maximization. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC, pages 153 -- 162, 2015. Baharan Mirzasoleiman, Morteza Zadimoghaddam, and Amin Karbasi. Fast dis- tributed submodular cover: Public-private data summarization. In Advances in Neu- ral Information Processing Systems 29: Annual Conference on Neural Information Processing Systems, pages 3594 -- 3602, 2016. Ashkan Norouzi-Fard, Jakub Tarnawski, Slobodan Mitrovic, Amir Zandieh, Aidasa- dat Mousavifar, and Ola Svensson. Beyond 1/2-approximation for submodular max- imization on massive data streams. In Proceedings of the 35th International Confer- ence on Machine Learning, ICML, pages 3826 -- 3835, 2018. [NWF78] George L. Nemhauser, Laurence A. Wolsey, and Marshall L. Fisher. An analysis of approximations for maximizing submodular set functions - I. Math. Program., 14(1):265 -- 294, 1978. 24 [SSSJ12] [Svi04] [WLKB13] [Wol82] [YXC18] Ruben Sipos, Adith Swaminathan, Pannaga Shivaswamy, and Thorsten Joachims. Temporal corpus summarization using submodular word coverage. In Proceedings of the 21st ACM international conference on Information and knowledge management, pages 754 -- 763. ACM, 2012. Maxim Sviridenko. A note on maximizing a submodular set function subject to a knapsack constraint. Oper. Res. Lett., 32(1):41 -- 43, 2004. Kai Wei, Yuzong Liu, Katrin Kirchhoff, and Jeff Bilmes. Using document sum- marization techniques for speech data subset selection. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 721 -- 726, 2013. Laurence A. Wolsey. Maximising real-valued submodular functions: Primal and dual heuristics for location problems. Math. Oper. Res., 7(3):410 -- 425, 1982. Qilian Yu, Easton Li Xu, and Shuguang Cui. Streaming algorithms for news and scientific literature recommendation: Monotone submodular maximization with a $d$ -knapsack constraint. IEEE Access, 6:53736 -- 53747, 2018. A Standard greedy and thresholding inequalities In this section we prove the standard greedy inequality g(x) ≥ 1 − e−x, where x is the cost of a partial greedy solution. To prove it, we first show that a differential inequality g(x)+g(cid:48)(x) ≥ 1 holds, and then integrate it using Proposition A.1. For the thresholding algorithm a similar approximate inequality holds. Proposition A.1 Let ξ be a continuous and piecewise smooth function [u, v] → R+. If for some α, β > 0 we have ξ(x) + αξ(cid:48)(x) ≥ β for u ≤ x ≤ v, then ξ(v) ≥ β + (ξ(u) − β)e Proof : αξ(cid:48)(x)e ξ(x)αe First, consider the case when ξ is smooth. ξ(x) + αξ(cid:48)(x) ≥ β implies that ξ(x)e x α + α is the derivative of α through multiplication by e α ≥ βe α . Hence, d(ξ(x)αe dx α . Observe that ξ(x)e x α + αξ(cid:48)(x)e ≥ βe x α implies u−v α . x α ) x x x x x (cid:90) v d(ξ(x)αe x (ξ(x)αe α ) α − ξ(u)αe v x α ) ≥ (cid:12)(cid:12)(cid:12)v u x α ≥ αβe α ≥ αβe u u (cid:12)(cid:12)(cid:12)v u (cid:90) v βe x α dx v α − αβe u α . u ξ(v)αe Dividing both sides by α, ξ(v)e v α − ξ(u)e u α ≥ βe v α − βe u α ξ(v) ≥ β + (ξ(u) − β)e u−v α . For a piecewise smooth ξ, let u = x0 < x1 < ··· < xt = v, such that ξ is smooth on a segment (xi, xi+1) for any i. By induction, we prove that the inequality holds for x0, xi for any i: ξ(xi) ≥ β + (ξ(x0) − β)e xi−x0 α . 25 The statement is true for i = 0. Induction step: xi−xi+1 α ξ(xi+1) ≥ β + (ξ(xi) − β)e ≥ β + (ξ(x0) − β)e ≥ β + (ξ(x0) − β)e xi−xi+1 α x0−xi α e x0−xi+1 α 2 Theorem A.2 (Standard greedy inequality) For all x ∈ [0, 1 − c (o1)], the greedy performance function g satisfies the following differential inequality: and hence also its integral version: g(x) ≥ 1 − e−x. g(x) + g(cid:48)(x) ≥ 1, Let x ∈ [0, 1 − c (o1)] and recall that by definition Gi−1 is the largest set of elements Proof : selected by the greedy solution without exceeding total cost of x. Note that it suffices to show the inequality only for the left endpoints of the piecewise linear intervals of the form [c(Gi−1), c(Gi)) as inside these intervals g(cid:48) stays constant while g can only increase and hence the inequality holds. Hence we can assume that x = c(Gi−1) in the proof below which implies that g(x) = f (Gi−1). Since we normalized f (OPT) = 1, by monotonicity: 1 = f (OPT) ≤ f (OPT ∪ Gi−1) = f (Gi−1) + f (OPT \ Gi−1 Gi−1) . Then by submodularity and using the fact that by definition f (Gi−1) = g(x): where the last inequality follows because greedy always picks the item with the largest marginal density and since x ≤ 1 − c(o1) every item in OP T \ Gi−1 can still fit into the knapsack. Hence, (cid:88) 1 ≤ g(x) + g(cid:48)(x) c(e) e∈OPT\Gi−1 = g(x) + g(cid:48)(x)c(OPT \ Gi−1). 1 ≤ f (Gi−1) + f (OPT \ Gi−1 Gi−1) ≤ g(x) + f (eGi−1) . e∈OPT\Gi−1 Since f (eGi−1) = c(e)ρ (eGi−1): 1 ≤ g(x) + = g(x) + ≤ g(x) + f (eGi−1) c(e)ρ (eGi−1) c(e)g(cid:48)(x), e∈OPT\Gi−1 e∈OPT\Gi−1 e∈OPT\Gi−1 (cid:88) (cid:88) (cid:88) (cid:88) 26 The desired differential inequality follows from the observation that c(OPT \ Gi−1) ≤ c(OPT) ≤ 1. Finally, by integrating from 0 to x using the initial condition g(0) = 0, it follows that g(x) ≥ 1− e−x (by Proposition A.1). 2 Theorem A.3 (Standard thresholding inequality) For all x ∈ [0, 1 − c(o1)], the thresholding performance function t satisfies the following differential inequality: t(x) + (1 + )t(cid:48)(x) ≥ 1. And hence also its integral version: t(x) ≥ 1 − e − x 1+ . Let p ∈ [0, 1] be the total cost of the elements collected by the thresholding algorithm Proof : in the first pass. First, note that for the first pass when x ∈ [0, p] the differential inequality follows trivially as t(cid:48)(x) ≥ λ αK ≥ 1 since λ ≥ αf (OPT) and by our normalization f (OPT) = K = 1. Fix x ∈ [p, 1 − c (o1)] and recall that by definition Ti−1 is the largest set of elements selected by the thresholding algorithm without exceeding total cost of x. Similarly to the previous proofs it suffices to consider only the left endpoints of the intervals of the form [c(Ti−1,Ti)) so we assume x = c(Ti−1). Since we normalized f (OPT) = 1, then by monotonicity: 1 = f (OPT) ≤ f (OPT ∪ Ti−1) = f (Ti−1) + f (OPT \ Ti−1 Ti−1) . Then by submodularity and using the fact that by definition t(x) = f (Ti−1): where the last inequality follows because after the first pass t(cid:48)(x) ≥ ρ(e Ti−1) for all e ∈ OPT \ Ti−1. Indeed, note that in all passes except the first one the thresholding algorithm always selects an item whose marginal density is at least (1 + )−1 times the best marginal density available. Since t(cid:48)(x) is the density of this item and all items in OPT \ Ti−1 still fit (as x ≤ 1 − c(o1)) we have (1 + )t(cid:48)(x) ≥ maxe∈OPT\Ti−1 ρ (eTi−1) as desired. Hence: 1+ 1 ≤ t(x) + c(e)t(cid:48)(x)(1 + ) e∈OPT\Ti−1 = t(x) + (1 + )t(cid:48)(x)c(OPT \ Ti−1). 1 ≤ f (Ti−1) + f (OPT \ Ti−1 Ti−1) ≤ t(x) + f (eTi−1) . e∈OPT\Ti−1 Since f (eTi−1) = c(e)ρ (eTi−1): 1 ≤ t(x) + = t(x) + ≤ t(x) + f (eTi−1) c(e)ρ (eTi−1) c(e)t(cid:48)(x)(1 + ), (cid:88) (cid:88) (cid:88) (cid:88) e∈OPT\Ti−1 e∈OPT\Ti−1 e∈OPT\Ti−1 (cid:88) 27 The desired differential inequality follows from the observation that c(OPT \ Ti−1) ≤ c(OPT) = 1. For the integral version we integrate the differential inequality between 0 and x with the initial condition t(0) = 0 (formally, apply Proposition A.1 with α = 1 + , β = 1, u = 0, v = x) and get t(x) ≥ 1 − e 2 1+ , as desired. − x B Omitted proofs Fact B.1 For all 0 ≤ x ≤ 1, Let r(x) = (1 − x)e2x−1 and note that r(cid:48)(x) = (1 − 2x)e2x−1 so that r(cid:48)(x) > 0 for 2 is a local maximum and so 2 2 (cid:1) = 1 x ∈(cid:2)0, 1 Proof : (1 − x)e2x−1 ≤ 1 2 Fact B.2 (1 − x)e2x−1 ≤ 1 2 . 2 , 1(cid:3). Hence, it follows that r(cid:0) 1 (cid:3) and r(cid:48)(x) ≤ 0 for x ∈(cid:2) 1 2 for all 0 ≤ x ≤ 1. (cid:18) (cid:18) 2c(o1)−1 1+ ≤ 1 2 1 − c (o1) 1 +  (cid:19) (cid:19) + . e 1 − c (o1) 1 +  2c(o1)−1 1+ ≤ 1 2 e  1+ . e Proof : By Fact B.1,  x 1+x ≤ 2 for 2 1+ ≤ 1 + 2, which follows from the fact that d dx e Hence it suffices to show that e 0 ≤ x ≤ 1. We now describe a generalization to a knapsack constraint of the algorithm of [KMZ+19] that com- putes a constant factor approximation to maximum submodular maximization under a cardinality constraint, using small space and a small number of queries. Theorem B.3 There exists a one-pass streaming algorithm that outputs a (cid:0) 1 3 − (cid:1)-approximation (cid:16) n log K (cid:17) (cid:1) space and O to the submodular maximization under knapsack constraint that uses O(cid:0) K (cid:1) 3 −-approximation. On the other hand, by Theorem 1 in [KMZ+19], Algorithm 4 uses space O(cid:0) K Since Algorithm 4 uses the same threshold as Algorithm 2 in [HKY17], it outputs a Proof : 1 total queries.    and query complexity O . 2 (cid:16) n log K (cid:17)  Hence, by setting  = 1 6, we obtain the following: Corollary B.4 There exists a one-pass streaming algorithm that outputs a 1 6-approximation to the submodular maximization under knapsack constraint that uses O(K) space and O(n log K) total queries. 28 Algorithm 4: Space efficient constant factor approximation Input: Stream of elements E = e1, . . . , en, knapsack capacity K, cost function c(·), non-negative monotone submodular function f, and an approximation parameter  > 0; 3 − (cid:1)-approximation for submodular maximization with a Output: A set S that is a(cid:0) 1 knapsack constraint; τmin, ∆, LB ← 0; for each item ei do if f (ei) > ∆ then e ← ei, ∆ ← f (ei) τmin = max(2LB,2∆) Discard all sets with Sτ with τ < τmin; for τ ∈ {(1 + )iτmin/(1 + ) ≤ (1 + )i ≤ ∆} do 3K ; if τ is a new threshold then if c(Sτ ) < K and ρ (e Sτ ) ≥ τ then Sτ ← ∅ Sτ ← Sτ ∪ {e} and LB ← max{LB, f (Sτ )} return argmax{f (Sτ ), f (e)} 29
1805.06232
5
1805
2019-05-10T08:10:31
On Fair Division of Indivisible Items
[ "cs.DS" ]
We consider the task of assigning indivisible goods to a set of agents in a fair manner. Our notion of fairness is Nash social welfare, i.e., the goal is to maximize the geometric mean of the utilities of the agents. Each good comes in multiple items or copies, and the utility of an agent diminishes as it receives more items of the same good. The utility of a bundle of items for an agent is the sum of the utilities of the items in the bundle. Each agent has a utility cap beyond which he does not value additional items. We give a polynomial time approximation algorithm that maximizes Nash social welfare up to a factor of $e^{1/{e}} \approx 1.445$. The computed allocation is Pareto-optimal and approximates envy-freeness up to one item up to a factor of $2 + \eps$
cs.DS
cs
1 On Fair Division for Indivisible Items∗ BHASKAR RAY CHAUDHURY, MPI for Informatics, Saarland Informatics Campus YUN KUEN CHEUNG, Singapore University of Technology and Design JUGAL GARG, Univ. of Illinois at Urbana-Champaign NAVEEN GARG, IIT Delhi MARTIN HOEFER, Goethe-Universität Frankfurt am Main KURT MEHLHORN, MPI for Informatics, Saarland Informatics Campus We consider the task of assigning indivisible goods to a set of agents in a fair manner. Our notion of fairness is Nash social welfare, i.e., the goal is to maximize the geometric mean of the utilities of the agents. Each good comes in multiple items or copies, and the utility of an agent diminishes as it receives more items of the same good. The utility of a bundle of items for an agent is the sum of the utilities of the items in the bundle. Each agent has a utility cap beyond which he does not value additional items. We give a polynomial time 1/e ≈ 1.445. The computed approximation algorithm that maximizes Nash social welfare up to a factor of e allocation approximates envy-freeness up to one item up to a factor of 2 + ε. For instances without caps, it is approximately Pareto-optimal. We also show that the upper bounds on the optimal Nash social welfare introduced in [6] and [3] have the same value. ACM Reference format: Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn. 2016. On Fair Division for Indivisible Items. 1, 1, Article 1 (January 2016), 22 pages. DOI: 10.1145/nnnnnnn.nnnnnnn 1 INTRODUCTION We consider the task of dividing indivisible goods among a set of n agents in a fair manner. More precisely, we consider the following scenario. We have m distinct goods. Goods are available in several copies or items; there are kj items of good j. The agents have decreasing utilities for the di(cid:29)erent items of a good, i.e., for all i and j assigned to agent i, and m(j, xi) denotes the multiplicity of good j in xi. Of course, An allocation assigns the items to the agents. For an allocation x, xi denotes the multi-set of items i m(j, xi) = kj for all j. The total utility of bundle xi for agent i is given by ui, j,1 ≥ ui, j,2 ≥ . . . ≥ ui, j,kj . ui(xi) =  Each agent has a utility cap ci. The capped utility of bundle xi for agent i is de(cid:27)ned as ui, j, (cid:96) . j 1≤(cid:96)≤m(j,xi) ¯ui(xi) = min(ci , ui(xi)). ∗A preliminary version of this article appeared in FSTTCS 2018. 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 pro(cid:27)t or commercial advantage and that copies bear this notice and the full citation on the (cid:27)rst page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior speci(cid:27)c permission and/or a fee. Request permissions from [email protected]. © 2016 ACM. XXXX-XXXX/2016/1-ART1 $15.00 DOI: 10.1145/nnnnnnn.nnnnnnn , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt 1:2 Mehlhorn Our notion of fairness is Nash social welfare (NSW) [13], i.e., the goal is to maximize the geometric mean (cid:33)1/n (cid:32) 1≤i ≤n NSW(x) = ¯ui(xi) of the capped utilities. All utilities and caps are assumed to be integers. We give a polynomial-time approximation algorithm with approximation guarantee e The problem has a long history. For divisible goods, maximizing Nash Social Welfare (NSW) for any set of valuation functions can be expressed via an Eisenberg-Gale program [8]. Notably, for additive valuations (ci = ∞ for each agent i and kj = 1 for each good j) this is equivalent to a Fisher market with identical budgets. In this way, maximizing NSW is achieved via the well-known fairness notion of competitive equilibrium with equal incomes (CEEI) [12]. 1/e + ε ≈ 1.445 + ε for any positive ε. For indivisible goods, the problem is NP-complete [14] and APX-hard [10]. Several constant- factor approximation algorithms are known for the case of additive valuations. They use di(cid:29)erent approaches. The (cid:27)rst one was pioneered by Cole and Gkatzelis [6] and uses spending-restricted Fisher markets. Each agent comes with one unit of money to the market. Spending is restricted in the sense that no seller wants to earn more than one unit of money. If the price p of a good is higher than one in equilibrium, only a fraction 1/p of the good is sold. Cole and Gkatzelis showed how to compute a spending restricted equilibrium in polynomial time and how to round its allocation to an integral allocation with good NSW. In the original paper they obtained an approximation ratio 1/e ≈ 2.889. Subsequent work [5] improved the ratio to 2. The approximation ratio in [6] is of 2e shown against an upper bound on the optimal Nash social welfare which we refer to as CG-bound. In [5], an alternative bound is introduced and shown to have the same value as the CG-bound. The second approach is via stable polynomials. Anari et al. [1] obtained an approximation factor of e. The third approach, introduced by Barman et al. [3], is via integral allocations that are envy-free up to one good. An allocation is envy-free up to one good if for any two agents i and k there is a good j such that ui(xk − j) ≤ ui(xi), i.e., after removal of one good from k's bundle its utility for i is no larger than the utility of i's bundle for i. Caragiannis et al. [4] have shown that an allocation maximizing NSW is Pareto-optimal and envy-free up to one good. For a price vector p for the goods, the price P(xi) of a bundle is the sum of the prices of the goods in the bundle. An allocation is almost price-envy-free up to one good (ε-p-EF1) if P(xk − j) ≤ (1 + ε)P(xi) for all agents i and k and some good j, where ε is an approximation parameter. An allocation is MBB (maximum bang per buck) if j ∈ xi implies uij/pj = max(cid:96) ui (cid:96)/p(cid:96) for all j and i. Barman et al. [3] studied allocations that are MBB and almost price-envy-free up to one good. They showed that such allocations are 1/e + ε ≈ 1.445 + ε. They almost envy-free up to one good1 and approximate NSW up to a factor e also showed how to compute such an allocation in polynomial time. The approximation ratio in [3] is shown against an upper bound on the optimal Nash social welfare which we refer to as BMV-bound. We show that it has the same value as the CG-bound. There are also constant-factor approximation algorithms beyond additive utilities. Garg et al. [9] studied budget-additive utilities (kj = 1 for all goods j and arbitrary ci). They 1/2e ≈ 2.404-approximation. showed how to generalize the Fisher market approach and obtained an 2e ui(xk − j) = (cid:96)∈xk −j ui (cid:96) ≤ αi (cid:96)∈xk −j p(cid:96) ≤ (1 + ε)αi (cid:96)∈xi p(cid:96) = (1 + ε) 1Consider two bundles xk and xi and assume P(xk − j) ≤ (1 + ε)P(xi) for some j ∈ xk . Let αi = max(cid:96) ui (cid:96)/p(cid:96). Then (cid:96)∈xi ui (cid:96). , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items 1:3 2, respectively. Anari et al. [2] investigated multi-item concave utilities (ci = ∞ for all i and kj arbitrary). They generalized the Fisher market and the stable polynomial approach and obtained approximation factors of 2 and e We show that the price-envy-free allocation approach can handle both generalizations simulta- 1/e + ε ≈ 1.445 + ε. The allocation computed by neously. We obtain an approximation ratio of e our algorithm guarantees ui(xk − j) ≤ (2 + ε)ui(xi) for any two agents i and k, i.e., it approximates envy-freeness up to one item up to a factor of essentially two. For instances without utility caps, it is approximately Pareto-optimal2 The approach via price-envy-freeness does not only yield better approximation ratios and guarantees for individual agents, it is, in our opinion, also simpler to state and simpler to analyze. The paper is structured as follows. In Section 2 we give the algorithm and analyze its approxima- tion ratio (Section 2.3), guarantee to individual agents (Section 2.4), and running time (Section 2.5). In Section 3 we show that the analysis is essentially tight by establishing a lower bound of 1.44 on the approximation ratio of the algorithm. In Section 4 we discuss certi(cid:27)cation of the approximation ratio and in Section 5 we show that for the multi-copy case and the capped case optimal allocations are not necessarily envy-free up to one good. In Section 6 we obtain close-to-one approximation ratios for large markets, where for any agent the value of any good is only an /n-fraction of the value of all goods. In Section 7 we show the equality of the CG- and BMV-bounds. copies of good j. Let M = 2 ALGORITHM AND ANALYSIS Let us recall the setting. Items are indivisible. There are n agents and m goods. There are kj items or j kj be the total number of items. The agents have decreasing utilities for the di(cid:29)erent items of a good, i.e., for all i and j For an allocation x, xi denotes the multi-set of items assigned to agent i, and m(j, xi) denotes the multiplicity of good j in xi. The total utility of bundle xi for agent i is given by ui, j,1 ≥ ui, j,2 ≥ . . . ≥ ui, j,kj . ui(xi) =  ui, j, (cid:96) . j 1≤(cid:96)≤m(j,xi) ¯ui(xi) = min(ci , ui(xi)). Each agent has a utility cap ci. The capped utility of bundle xi for agent i is de(cid:27)ned as Following [9], we assume w.l.o.g. ui, j, (cid:96) ≤ ci for all i, j, and (cid:96). In the algorithm, we ensure this assumption by capping every ui,∗,∗ at ci. All utilities and caps are assumed to be integers. 2.1 A Reduction to Rounded Utilities and Caps Let r ∈ (1, 3/2]. For every non-zero utility ui, j, (cid:96) let vi, j, (cid:96) be the next larger power of r. For zero utilities v and u agree. Similarly, for ci let di be the next larger power of r. It is well-known that it su(cid:28)ces to solve the rounded problem with a good approximation guarantee. Lemma 2.1. Let x approximate the NSW for the rounded problem up to a factor of γ . Then x for each integral allocation y of the goods approximates the NSW for the original problem up to a factor γr. 2The algorithm rounds each non-zero utility to the next larger power of r = 1 + ε. For instances without utility caps, it computes a Pareto-optimal allocation for the rounded utilities. It also computes a scaling factor αi for each agent i such that )/αi . For r = 1, this would imply Pareto-optimality of x alg. For instances without caps, it can e(cid:28)ciently compute a Pareto-optimal solution if all numbers are polynomially bounded. In contrast, even for identical agents with additive utilities and caps, computing a Pareto-optimal solution is strongly NP-hard via a standard reduction from 3-PARTITION. i ui(yi)/αi ≤ r · i ui(x alg i , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:4 Proof. Let x∗ be an optimal allocation for the original problem. We write NSW(x∗, u, c) for the Nash social welfare of the allocation x∗ with respect to utilities u and caps c. De(cid:27)ne NSW(x, u, c), NSW(x∗, v, d), and NSW(x, v, d) analogously. We need to bound NSW(x∗, u, c)/NSW(x, u, c). Since u ≤ v and c ≤ d componentwise, NSW(x∗, u, c) ≤ NSW(x∗, v, d). Since x approximates the NSW for the rounded problem up to a factor γ, NSW(x∗, v, d) ≤ γNSW(x, v, d). Since v ≤ ru and d ≤ rc componentwise, NSW(x, v, d) ≤ rNSW(x, u, c). Thus NSW(x, u, c) ≤ γNSW(x, v, d) NSW(x∗, u, c) NSW(x, v, d)/r = γr . (cid:3) 2.2 The Algorithm Barman et al. [3] gave a highly elegant approximation algorithm for the case of a single copy per good and no utility caps. We generalize their approach. The algorithm uses an approximation parameter ε ∈ (0, 1/4]. Let r = 1 + ε. The nonzero utilities are assumed to be powers of r. The algorithm maintains an integral assignment x, a price pj for each good, and an MBB-ratio3 αi i m(j, xi) = kj for each good j. The prices, MBB-ratios, and multiplicity for each agent. Of course, of goods in bundles are related through the following inequalities: ui, j,m(j,xi)+1 ≤ αi ≤ ui, j,m(j,xi) , pj pj (1) i.e., if ui, j, (cid:96)/pj > αi, then at least (cid:96) copies of j are allocated to agent i and if ui, j, (cid:96)/pj < αi, then less than (cid:96) copies of j are allocated to agent i. If no copy of good j is assigned to i, the upper bound for αi is in(cid:27)nity. If all copies of good j are assigned to i, the lower bound for αi is zero. Note that if αi is equal to its upper bound in (1), we may take one copy of j away from i without violating the inequality as the upper bound becomes the new lower bound. Similarly, if αi is equal to its lower bound in (1), we may assign an additional copy of j to i without violating the inequality as the lower bound becomes the new upper bound. Since (1) must hold for every good j, αi must lie in the intersection of the intervals for the di(cid:29)erent goods j, i.e., ui, j,m(j,xi)+1 max ≤ αi ≤ min ui, j,m(j,xi) . pj j pj The value of bundle xi for i is given by4 Pi(xi) = ui(xi) = 1 αi αi  j  j 1≤(cid:96)≤m(j,xi) ui, j, (cid:96) . (2) De(cid:27)nitions (1) and (2) are inspired by Anari et al [2]. We say that αi is equal to the upper bound for the pair (i, j) if αi is equal to its upper bound in (1) and that αi is equal to the lower bound for the pair (i, j) if αi is equal to its lower bound in (1). An agent i is capped if ui(xi) ≥ ci and is uncapped otherwise. The algorithm starts with a greedy assignment. For each good j, it assigns each copy to the agent that values it most. The price of each good is set to the utility of the assignment of its last copy and all MBB-values are set to one. Note that this setting guarantees (1) for every pair (i, j). Also, all 3In the case of one copy per good, αi = ui, j/pj whenever (the single copy of) good j is assigned to i and αi ≥ ui, (cid:96)/p(cid:96) for all goods (cid:96). Thus αi is the maximum utility per unit of money (maximum bang per buck (MBB)) that agent i can get. j∈xi pj is the total price of the goods in the bundle. We reuse 4In the case of one copy per good, Pi(xi) = ui(xi)/αi = the letter P for the value of a bundle, although Pi(xi) = 1/αi · 1≤(cid:96)≤m(j,xi) ui, j, (cid:96) is no longer the total price of the j goods in the bundle. , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items 1:5 Algorithm 1: Approximate Nash Social Welfare for Multi Item Concave Utilities with Caps :Fair Division Problem given by utilities uij (cid:96), i ≤ n, j ≤ m, (cid:96) ≤ kj, utility caps ci, and Input approximation parameter ε ∈ (0, 1/4]. Let r = 1 + ε. Nonzero uij's and ci's are powers of r. Output:Price vector p and 4ε-p-EF1 integral allocation x 1 for i, j, (cid:96) do 2 3 for j ∈ G do ui, j, (cid:96) ← min(ci , ui, j, (cid:96)) for (cid:96) ∈ [kj] in increasing order do Set pj ← ui0, j,m(j,xi0), where i0 is the agent to which the kj-th copy of j was assigned assign the (cid:96)-th copy of j to i0 = argmaxi ui, j,m(j,xi)+1; if allocation x is ε-p-EF1 then break from the loop and terminate Let i be a least spending uncapped agent Perform a BFS in the tight graph starting at i if the BFS-search discovers an improving path starting in i, let P = (i = a0, ❕1, a1, . . . , ❕h, ah) be a shortest such path then Set (cid:96) ← h while (cid:96) > 0 and Pa(cid:96)(xa(cid:96) − ❕(cid:96)) > (1 + ε)Pi(xi) do remove ❕(cid:96) from xa(cid:96) and assign it to a(cid:96)−1; (cid:96) ← (cid:96) − 1 else (add a good to S) (add an agent to S) Let S be the set of goods and agents that can be reached from i in the tight graph β1 ← mink ∈S; j(cid:60)S αk/(uk, j,m(j,xk)+1/pj) β2 ← mink(cid:60)S; j∈S (uk, j,m(j,xk)/pj)/αk β3 ← 1 r 2Pi(xi) maxk(cid:60)S minj∈xk Pk(xk − j) β4 ← r s, where s is the smallest integer such that r s−1 ≤ Ph(xh)/Pi(xi) < r s and h is the least spending uncapped agent outside S β ← min(β1, β2, max(1, β3), β4) multiply all prices of goods in S by β and divide all MBB-values of agents in S by β if β3 ≤ min(β1, β2, β4) then break from the while-loop (new least spender) (i is happy) 7 for i ∈ A do αi = 1 8 9 while true do 10 11 4 5 6 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 initial prices and MBB-values are powers of r. It is an invariant of the algorithm that prices are powers of r. Only the (cid:27)nal price increase in the main-loop may destroy this invariant. After initialization, the algorithm enters a loop. We need some more de(cid:27)nitions. An agent i is a least spending uncapped agent if it is uncapped and Pi(xi) ≤ Pk(xk) for every other uncapped agent k. An agent i ε-p-envies agent k up to one item if Pk(xk − j) > (1 + ε) · Pi(xi) for every good j ∈ xk. Recall that xk is a multi-set. In the multi-set xk − j, the number of copies of good j is reduced by one, i.e., m(j, xk − j) = m(j, xk) − 1. Therefore Pk(xk − j) = Pk(xk) − uk, j,m(j,xk)/αk. An allocation is ε-p-envy free up to one item (ε-p-EF1) if for every uncapped agent i and every other agent k there is a good j such that Pk(xk − j) ≤ (1 + ε)Pi(xi). , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:6 Fig. 1. An improving path. Agents and goods alternate on the path and the path starts and ends with an agent. For the solid edges (j, i), αi is at its upper bound for the pair (i, j) and for the dashed edges (i, j), αi is at its lower bound for the pair (i, j). We also need the notion of the tight graph. It is a directed bipartite graph with the agents on one side and the goods on the other side. We have a directed edge (i, j) from agent i to good j if αi = uijm(j,xi)+1/pj, i.e., αi is at its lower bound for the pair (i, j). We have a directed edge (j, i) from good j to agent i if αi = uijm(j,xi)/pj, i.e., αi is at its upper bound for the pair (i, j). Note that necessarily m(j, xi) ≥ 1 in the latter case, since otherwise good j does not impose an upper bound for αi. An improving path starting at an agent i is a simple path P = (i = a0, ❕1, a1, . . . , ❕h, ah) in the tight graph starting at i and ending at another agent ah such that Pah(xah − ❕h) > (1 + ε)Pi(xi) and Pa(cid:96)(xa(cid:96) − ❕(cid:96)) ≤ (1 + ε)Pi(xi) for 1 ≤ (cid:96) < h. Let i be the least spending uncapped agent. We perform a breadth-(cid:27)rst search in the tight graph starting at i. If the BFS discovers an improving path starting at i, we use the shortest such path to improve the allocation. Note that if i ε-p-envies some node that is reachable from i in the tight graph then the BFS will discover an improving path. In the main loop, we distinguish cases according to whether BFS discovers an improving path starting at i or not. Assume (cid:27)rst that BFS discovers the improving path P = (i = a0, ❕1, a1, . . . , ❕h, ah). We take ❕h away from ah and assign it to ah−1. If we now have Pah−1(xah−1 + ❕h − ❕h−1) ≤ (1 + ε)Pi(xi) we stop. Otherwise, we take ❕h−1 away from ah−1 and assign it to ah−2. If we now have Pah−2(xah−2 + ❕h−1 − ❕h−2) ≤ (1 + ε)Pi(xi) we stop. Otherwise, .... We continue in this way until we stop or assign ❕1 to a0. In other words, let h(cid:48) < h be maximum such that Pah(cid:48)(xah(cid:48) + ❕h(cid:48)+1 − ❕h(cid:48)) ≤ (1 + ε)Pi(xi). If h(cid:48) exists, then we take a copy of ❕(cid:96) away from a(cid:96) and assign it to a(cid:96)−1 for h(cid:48) < (cid:96) ≤ h. If h(cid:48) does not exist, we do so for 1 ≤ (cid:96) ≤ h. Let us call the above a sequence of swaps. (cid:96) Lemma 2.2. Consider an execution of lines (15) to (17) and let h(cid:48) be the (cid:27)nal value of (cid:96) (this agrees = x(cid:96) with the de(cid:27)nition of h(cid:48) in the preceding paragraph). Let x(cid:48) be the resulting allocation. Then x(cid:48) = xh − ❕h. Also, for 0 ≤ (cid:96) < h(cid:48), x(cid:48) • Pah(xah) ≥ Pah(x(cid:48) • Pah(cid:48)(x(cid:48) • Pa0(x(cid:48) • Pa(cid:96)(x(cid:48) • Pa(cid:96)(x(cid:48) = x(cid:96) + ❕(cid:96)+1 − ❕(cid:96) for h(cid:48) < (cid:96) < h, and x(cid:48) h(cid:48) = xh(cid:48) + ❕h(cid:48)+1, x(cid:48) ah(cid:48) − ❕h(cid:48)) = Pah(cid:48)(xah(cid:48) + ❕h(cid:48)+1 − ❕h(cid:48)) ≤ (1 + ε)Pi(xi) if h(cid:48) ≥ 1 a0 − ❕1) = Pa0(xa0) ≤ (1 + ε)Pi(xi) if h(cid:48) = 0. + ❕(cid:96)+1 − ❕(cid:96)) > (1 + ε)Pi(xi) and Pa(cid:96)(x(cid:48) ) = Pa(cid:96)(xa(cid:96) − ❕(cid:96)) = Pa(cid:96)(xa(cid:96) − ❕(cid:96)) ≤ (1 + ε)Pi(xi) for 0 ≤ (cid:96) < h(cid:48). a(cid:96) (1 + ε)Pi(xi) for h(cid:48) < (cid:96) < h. − ❕(cid:96)+1) = Pa(cid:96)(xa(cid:96) − ❕(cid:96)) ≤ (cid:96) ) > (1 + ε)Pi(xi), ah h a(cid:96) a(cid:96) Proof. Immediate from the above. (cid:3) If i is still the least spending uncapped agent after an execution of lines (15) to (17), we search for another improving path starting from i. We will show below that i can stay the least spending M iterations. Intuitively this holds because for any agent (factor n) and any agent for at most n 2 , Vol. 1, No. 1, Article 1. Publication date: January 2016. ij1i1j2jhih= good= agent= at lower bound= at upper bound On Fair Division for Indivisible Items 1:7 (cid:27)xed length shortest improving path (factor n), we can have at most M iterations for which the shortest improving path ends in this particular agent. We come to the else-case, i.e., BFS does not discover an improving path starting at i. This implies that i does not ε-p-envy any agent that it can reach in the tight graph. We then increase some prices and decrease some MBB-values. Let S be the set of agents and goods that can be reached from i in the tight graph. Lemma 2.3. If a good j belongs to S and αk is at its upper bound for the pair (k, j), then k belongs to S. If an agent k belongs to S and αk is at its lower bound for the pair (k, j), then j belongs to S. t ≥ 1. What is the e(cid:29)ect? Proof. Consider any good j ∈ S. Since j belongs to S, there is an alternating path starting in i and ending in j. If the path contains k, k belongs to S. If the path does not contain k, we can extend the path by k. In either case, k belongs to S. Consider any agent k ∈ S. Since k belongs to S, there is an alternating path starting in i and ending in k. If the path contains j, j belongs to S. If the path does not contain j, we can extend the path by j. In either case, j belongs to S. (cid:3) We multiply all prices of goods in S and divide all MBB-values of agents in S by a common factor • Let uk, j,(j,xk)+1/pj ≤ αk ≤ uk, j,m(j,xk)/pj be the inequality (1) for the pair (k, j). The endpoints do not move if j (cid:60) S and are divided by t for j ∈ S. Similarly, αk does not move if k (cid:60) S and are divided by t if k ∈ S. So in order to preserve the inequality, we must have: If αk is equal to the upper endpoint and pj moves, i.e., j ∈ S, then αk must also move. If αk is equal to the lower endpoint and αk moves then pj must also move. Both conditions are guaranteed by Lemma 2.3. • If k and j are both in S, then αk and the endpoints of the interval for (k, j) move in sync. So • If k (cid:60) S, there might be a j ∈ S such that αk becomes equal to the right endpoint of the • If k ∈ S, there might be a j (cid:60) S such that αk becomes equal to the left endpoint of the • For agents in S, Pk(xk) is multiplied by t. For agents outside S, Pk(xk) stays unchanged. How is the common factor t chosen? There are four limiting events. Either S grows and this may happen by the addition of a good (factor β1) or an agent (factor β2); or Pi(xi) comes close to the largest value of minj∈xk Pk(xk − j) for any other agent (factor β3), or Pi(xi) becomes larger than Ph(xh) for some uncapped agent h outside S (factor β4). Since we want prices to stay powers of r, β4 is chosen as a power of r. The factor β3 might be smaller than one. Since we never want to decrease prices, we take the maximum of 1 and β3. agents and goods reachable from i in the tight graph, stay reachable. interval for (k, j). Then k is added to S. interval for (k, j). Then j is added to S. Lemma 2.4. Prices and MBB-values are powers of r, except maybe at termination. Proof. This is true initially, since prices are utility values and utility values are assumed to be powers of r and since MBB-values are equal to one. If prices and MBB-values are powers of r before a price update, β1, β2, and β4 are powers of r. Thus prices and MBB-values are after the price update, except maybe when the algorithm terminates. (cid:3) We next show that the algorithm terminates with an allocation that is almost price-envy-free up to one item. Lemma 2.5. Assume ε ≤ 1/4. When the algorithm terminates, x is a 4ε-p-EF1 allocation. , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:8 Proof. Let q be the price vector after the price increase and let h be the least spending uncapped agent after the increase; h = i is possible. We (cid:27)rst show that that Qi(xi) ≤ rQh(xh). This is certainly true if h = i. If h (cid:60) S, since the price increase is limited by β4, we have Qi(xi) = βPi(xi) ≤ β4Pi(xi) = r · r s−1 · Pi(xi) ≤ rPh(xh) = rQh(xh). So in either case, we have Qi(xi) ≤ rQh(xh). Moreover, Qh(xh) ≤ Qi(xi) because h is a least spending uncapped agent after the price increase. If the algorithm terminates, we have β3 ≤ β4. Consider any agent k. Then, for k ∈ S, Qk(xk − jk) ≤ (1 + ε)Qi(xi) ≤ (1 + ε) · r · Qh(xh) and, for k (cid:60) S, Qk(xk − jk) = Pk(xk − jk) ≤ β3(1 + ε)rPi(xi) = (1 + ε)rQi(xi) ≤ (1 + ε) · r 2 · Qh(xh). 2 − 1)-q-EF1. Finally, note that (1 + ε)r Thus we are returning an allocation that is ((1 + ε)r 2 = (1 + ε)3 ≤ (1 + 4ε) for ε ≤ 1/4. (cid:3) Remark: We want to point out the di(cid:29)erences to the algorithm by Barman et al. Our de(cid:27)nition of alternating path is more general than theirs since it needs to take into account that the number of items of a particular good assigned to an agent may change. For this reason, we need to maintain the MBB-ratio explicitly. In the algorithm by Barman et al. the MBB ratio of agent i is equal to the maximum utility to price ratio maxj uij/pj and only MBB goods can be assigned to an agent. As a consequence, if a good belongs to S, the agent owning it also belongs to S. In price changes, there is no need for the quantity β2. In the de(cid:27)nition of β3, we added an additional factor r 2 in the denominator. We cannot prove polynomial running time without this factor. Finally, we start the search for an improving path from the least uncapped agent and not from the least agent. 2.3 Analysis of the Approximation Factor The analysis re(cid:27)nes the analysis given by Barman et al. Let (x alg, p, α) denote the allocation and price and MBB vector returned by the algorithm. Recall that x alg is γ-p-EF1 with γ = 4ε with respect to p and (1) holds for every i. We scale all the utilities of agent i and its utility cap by αi, i.e., we replace ui, j, (cid:96) by ui, j, (cid:96)/αi and ci by ci/αi and use ui, j, (cid:96) and ci also for the scaled utilities and scaled utility cap. The scaling does not change the integral allocation maximizing Nash Social Welfare. Inequality (1) becomes ui, j,m(j,x alg i )+1 ≤ 1 ≤ ui, j,m(j,x alg i ) , (3) i.e., the items allocated to i have a utility to price ratio of one or more and the items that are not allocated to i have a ratio of one or less. Also, the value of bundle xi for i is now equal to its utility for i and is given by pj pj  ) = Pi(x alg i ) = ui(x alg i ui, j, (cid:96) . j 1≤(cid:96)≤m(j,x alg ) i (4) All ui,∗,∗ are at most ci. Let Ac and Au be the set of capped and uncapped agents in x alg, let c = Ac and n − c = Au be their cardinalities. We number the uncapped agents such that u1(x ) ≥ . . . ≥ n−c) be the minimum utility of a bundle assigned to an uncapped agent. un−c(x The capped agents are numbered n − c + 1 to n. Let x∗ be an integral allocation maximizing Nash social welfare. n−c). Let (cid:96) = un−c(x ) ≥ u2(x alg 1 alg 2 alg alg , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items We de(cid:27)ne an auxiliary problem with denoted by triples (i, j, (cid:96)), where 1 ≤ (cid:96) ≤ m(j, x agents and is equal to ui, j, (cid:96). Formally, alg i 1:9 j kj goods and one copy of each good. The goods are ). The utility of good (i, j, (cid:96)) is uniform for all (5) where v is the utility function for the auxiliary problem. The cap of agent i is ci. Since v is uniform, we can write v(xi) instead of vi(xi). The capped utility of xi for agent i is ¯vi(xi) = min(ci , v(xi)). Note that v is uniform, but ¯v is not. Let x optaux be an optimal allocation for the auxiliary problem. v∗,(i, j, (cid:96)) = ui, j, (cid:96), i ui(x∗ Lemma 2.6. Let ui be the scaled utilities. Then we have: (1) x alg maximizes the uncapped social welfare, i.e., x alg = arg maxx ) = i ) ≤ (2)  i )(cid:1)1/n ≤(cid:16) (4) NSW(x∗) =(cid:0) (yi)/αi ≤ r ·  i, j,1≤(cid:96)≤m(j,x alg (3) x alg is Pareto-optimal for uncapped utilities. optaux i = NSW(x optaux). i ¯vi(x )/αi. )(cid:17)1/n ) v∗,(i, j, (cid:96)). i ¯ui(x∗ i ui(x alg i i (5) Let u orig be the unrounded original utilities. Then for any integral allocation y of the goods, orig i u i orig i alg i (x i u i ui(xi). i SW alg i for the scaled utilities. We can obtain x∗ Proof. For part (1) consider xSW as the allocation that maximizes the uncapped social welfare Set x ← x alg. Consider any good j. As long as the multiplicities of j in the bundles of x and xSW and xk are not the same, identify two agents i and k, where xi contains more copies of j than xSW contains fewer copies of j than xSW , and move a copy of j from i to k. Each copy taken away has k a utility of at least pj, each copy assigned additionally has a utility of at most pj. Thus the social welfare cannot go up by reassigning. This proves (a). from x alg by moving copies of goods as follows: For part (5), we observe that u the next power of r, 1 ≤ (cid:96) ≤ m(j, x allocation x for the auxiliary problem with ui(x∗ Part (2) is an obvious consequence of part (1). For part (3), we need to show that if agents have no utility caps, then there is no other allocation y that satis(cid:27)es ui(yi) ≥ ui(x ) for all agents i, with strict inequality for at least one agent. This follows directly from part (1). Note that scaling does not a(cid:29)ect the Pareto inequalities, thus part (3) also holds for unscaled uncapped utilities. For part (4), we interpret x alg as an allocation for the auxiliary problem; goods (i, j, (cid:96)) with ) are allocated to agent i. We then move goods exactly as in (1). We obtain an (yi) ≤ ui(yi) since each original non-zero utility is scaled up to (cid:3) We stress that Lemma 2.6 refers to the scaled utilities; x alg does not maximize social welfare for i − bi) ≤ (1 + γ)(cid:96). Note that ui(x i − bi) = For any agent i, let bi ∈ x )) ; 1 ≤ i ≤ n } be the goods in the auxiliary ui(x problem corresponding to the bi's. We now consider allocations for the auxiliary problem that are allowed to be partially fractional. We require that the goods in B are allocated integrally and allow all other goods to be assigned fractionally. For convenience of notation, let ❕i = (i, bi , m(bi , x )). The following lemma is crucial for the analysis. i ) ≤ v(xi) for all i. )/αi by part (c), and ui(x the unscaled utilities. ) − ui,bi,m(bi,x alg be such that ui(x ). Let B = { (i, bi , m(bi , x i ui(yi)/αi ≤ ) ≤ r · u i ui(x orig i orig i alg i alg i alg i alg i alg i alg i (x alg i ). alg i alg alg i Lemma 2.7. There is an optimal allocation for the relaxed auxiliary problem in which good ❕i is allocated to agent i. , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:10 Proof. Assume otherwise. Among the allocations maximizing Nash social welfare for the relaxed auxiliary problem, let x optrel be the one that maximizes the number of agents i that are allocated their own good ❕i. Assume (cid:27)rst that there is an agent i to which no good in B is allocated. Then ❕i is allocated to some agent k di(cid:29)erent from i. Since bi ∈ x ) ≤ ci. The inequality holds since utilities ui,∗,∗ are capped at ci during initialization. We move ❕i from k to i and min(v(❕i), v(x )) value from i to k. This is possible since only divisible goods are allocated to i. If we move v(❕i) from i to k, the NSW does not change. If v(❕i) > v(x ), the product ¯vi(xi) · ¯vk(xk) changes from ) and hence ci ≥ v(❕i) > v(x , v(❕i) = ui,bi,m(bi,x alg optrel i optrel i optrel i alg i i min(ci , v(x optrel i )) · min(ck , v(x = min(ckv(x optrel k optrel i to − ❕i + ❕i)) ), v(x optrel k − ❕i)v(x optrel i ) + v(❕i)v(x )) optrel i min(ci , v(❕i)) · min(ck , v(x optrel k − ❕i + x )) optrel i min(ckv(❕i), v(x optrel k − v(❕i))v(❕i) + v(x optrel i )v(❕i)). The arguments of the min in the lower line are componentwise larger than those of the min in the upper line. We have now modi(cid:27)ed x optrel such that the NSW did not decrease and the number of agents owning their own good increased. The above applies as long as there is an agent owning no good in B. So assume every agent i owns a good in B, but not necessarily ❕i. Let i be such that v(❕i) is largest among all goods ❕i that are not allocated to their i. Then ❕i is allocated to some agent k di(cid:29)erent from i. The value of the good ❕(cid:96) allocated to i is at most v(❕i) since (cid:96) (cid:44) i and by the choice of i. We move ❕i from k to i and min(v(❕i), v(x )) value from i to k. This is possible since v(❕(cid:96)) ≤ v(❕i) and all other goods assigned to i are divisible. We have now modi(cid:27)ed x optrel such that the NSW did not decrease and the number of agents owning their own good increased. We continue in this way until ❕i is allocated to i for every i. (cid:3) Let x optrel be an optimal allocation for the relaxed auxiliary problem in which good ❕i is contained optrel i in the bundle x optrel i for every i. Let α be such that optrel i α(cid:96) = min{ v(x ) ; v(x optrel i ) < ci } is the minimum value of any agent that is uncapped in x optrel. Let α = ∞, if every agent is capped in x optrel. Let A be the set of capped and uncapped agents in x optrel. Let h be such that uh(x optrel c alg optrel i ) ≤ ui(x alg i ). For all i, ui(x alg i ) ≤ v(x optrel i ) + (1 + γ)(cid:96). For i ∈ and A optrel u h ) > α(cid:96) ≥ uh+1(x h+1). Lemma 2.8. For i ≤ h, v(x , ci ≤ α(cid:96) and i (cid:60) [h]. optrel c alg Au ∩ A Proof. Consider any i ≤ h. v(x ) > α(cid:96), then α < ∞ and hence A is a singleton consisting only of ❕i. Assume otherwise, then also some divisible goods are assigned to i. We can move some of them to an agent that is uncapped in x optrel and has value α(cid:96). This increases the NSW, a contradiction. is non-empty. We claim that x ) is obvious, if v(x = {❕i}, i.e., x ) ≤ α(cid:96). If v(x ) ≤ ui(x optrel i optrel i optrel i optrel i optrel i optrel u alg i For the upper bound, we observe that ❕i ∈ x optrel i and ui(x alg i − bi) ≤ (1 + γ)(cid:96). , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items 1:11 optrel c Consider next any i ∈ Au ∩ A . Assume ci > α(cid:96). If x optrel assigns divisible goods to i, we can move some of them to an agent that is uncapped in x optrel and has value α(cid:96). This increases the NSW. Thus x . optrel c This shows ci ≤ α(cid:96). Then also i (cid:60) [h] because otherwise ci < ui(x ) and hence i would be capped in x alg. (cid:3) consists only of ❕i. But then v(❕i) ≤ ui(x ) < ci and i does not belong to A optrel i alg i alg i Lemma 2.9. NSW(x ∗) ≤ NSW(x optrel) ≤(cid:169)(cid:173)(cid:173)(cid:171)(α(cid:96))n−c−h−Au∩Aoptrel c ·  i∈Ac∪(Au∩Aoptrel c ) ci ·  1≤i ≤h ui(x alg i 1 n . )(cid:170)(cid:174)(cid:174)(cid:172) Moreover, ci ≤ α(cid:96) for any i ∈ Au ∩ A optrel c . alg i alg i alg i alg i optrel c optrel c optrel c optrel i optrel i optrel i optrel i optrel i or i ∈ Au \ A Proof. If v(x with i > h, we have v(x ) (cid:44) α(cid:96) then either i ∈ Ac or i ∈ Au ∩ A ) for i ≤ h. So assume i > h. Then v(❕i) ≤ ui(x v(x v(x v(x We conclude that for the agents i ∈ Au \ A that agree with x alg for the agents in Ac ∪ [h] and reassign the value . In the (cid:27)rst case, ) = ci ≤ α(cid:96) and i (cid:60) [h] by Lemma 2.8. In the third case, ) ≤ ci. In the second case, v(x ) ≤ ui(x ) ≤ α(cid:96) and hence all value in ) above α(cid:96) would be by fractional goods. They could be reassigned for an increase in NSW. (cid:3) We next bound NSW(x alg) from below. We consider assignments x for the auxiliary problem ) fractionally. Note that for any i ∈ Au − [h], (cid:96) ≤ ui(x ) ≤ min(ci , α(cid:96)). The former inequality follows from i ∈ Au and the latter inequality follows from the de(cid:27)nition of h and i ∈ Au. We reallocate value so as to move ui(xi) towards the bounds (cid:96) and min(ci , α(cid:96)). As long as there are two agents whose value is not at one of their bounds, we shift value from the smaller to the larger. This decreases NSW. We end when all but one agent have an extreme allocation, either (cid:96) or min(ci , α(cid:96)). One agent ends up with an allocation β(cid:96) with β ∈ [1, α]. as S ∪ T , where the agents i ∈ T end up at ci and the agents in S end up at (cid:96). Also let s and t be the number of agents in Au \ A that end up at (cid:96) and α(cid:96) respectively. Then Let us introduce some more notation. Write Au ∩ A i∈Au−[h] ui(x ) = α(cid:96). optrel i ui(x ci · (cid:96) NSW(x alg) ≥ (cid:32) (cid:32) ci ·  · Note that n − c − h = s + t + 1 + S + T . Therefore ) · (cid:96)s · (α(cid:96))t · (β(cid:96)) · (cid:32)sα + α ≤(cid:169)(cid:173)(cid:171) (cid:33)1/n (cid:33)s +1+S (cid:170)(cid:174)(cid:172)1/n The total mass allocated by x optrel to the agents in Au − [h] is (s + t + 1)α(cid:96) + allocation x alg wastes up to (1 + γ)(cid:96) for each i ∈ Ac ∪ [h] and uses s(cid:96) + tα(cid:96) + β(cid:96) + ci ≤ (Ac + h)(1 + γ)(cid:96) + s(cid:96) + tα(cid:96) + β(cid:96) + (s + t + 1)α(cid:96) +  on the agents in Au − [h]. Therefore NSW(x∗) NSW(x alg) ≤ i∈S s + 1 + S + (cid:33)1/n ci + S(cid:96) α s · α β where we used the inequality between geometric mean and arithmetic mean for the second inequality. i∈S∪T ci. The i∈T ci + S(cid:96) 1≤i ≤h . , ci (cid:96) i∈S optrel c i∈T ci (cid:96) optrel c i∈Ac alg i S β i∈S∪T i∈T , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:12 1 + γ exp(exp(−1/(1 + γ))) 1.00 1.44467 1.01 1.44997 1.02 1.45523 1.03 1.46046 1.04 1.46566 Table 1. The factor exp(exp(−1/(1 + γ))) as a function of 1 + γ . + i∈S sα + α β and hence after rearranging, dividing by (cid:96) and adding α/β on both sides ci (cid:96) ≤ (1 + γ)(Ac + h) + s + S + α β ≤ (1 + γ)(Ac + h) + s + S + 1 ≤ (1 + γ)n. + β − α (cid:32)(cid:18)(1 + γ)(Ac + h) + s + S + 1 Note that β + α/β − α ≤ 1 for β ∈ [1, α], since the expression is one at β = 1 and β = α and it second derivative as function of β is positive. Thus NSW(x optrel) NSW(x alg) ≤ since ((1 + γ)δ)1/δ as a function of δ attains its maximum for δ = 1 1/(1+γ). The value of the maximum is exp(exp(−1/(1 + γ))). Table 1 contains concrete values for small non-negative values of γ. (cid:19)(s +1+S )/n ≤ ee−1/(1+γ ) (cid:19)s +1+S (cid:33)1/n (cid:18) (1 + γ)n s + 1 + S (1+γ)e s + 1 + S Theorem 2.10. Let ε ∈ (0, 1/4], let γ = 4ε, let x alg be the allocation computed by the algorithm for the rounded utilities and caps, and let x∗ be an allocation maximizing Nash social welfare for the rounded utilities and caps. Then ≤ , NSW(x ∗)/NSW(x alg) ≤ ee−1/(1+γ ) . Corollary 2.11. ε ∈ (0, 1/4], let r = 1 + ε, let γ = 4ε, let x alg be the allocation computed by the algorithm for the utilities and caps rounded to powers of r, and let x∗ be an allocation maximizing Nash social welfare for the original utilities and caps. Then NSW(x ∗)/NSW(x alg) ≤ r · ee−1/(1+γ ) . 2.4 Guarantees for Individual Agents The allocation computed by our algorithm maximizes NSW up to a factor 1.45. By Lemma 2.5, it also gives any uncapped agent i the guarantee minj∈xk Pk(xk − j) ≤ (1 + 4ε)Pi(xi) for every other agent k. This guarantee is not meaningful for agent i as the left hand side is in terms of the utility for agent k. We now show that it implies minj∈xk ui(xk − j) ≤ (2 + 4ε)ui(xi), i.e., the utility for i of k's bundle minus one item is essentially bounded by twice the utility of i's bundle for i. The proof shows that the additional utility for i of the items that k has in excess of i up to one item is bounded by (1 + ε)ui(xi). In the case of one copy per good, xk and xi are disjoint and hence any item in xk is in excess of i's possession of the same good. Theorem 2.12. The allocation computed by the algorithm satis(cid:27)es minj∈xk ui(xk−j) ≤ (2+4ε)ui(xi) for any agent k and any uncapped agent i. Proof. Let ❕ be such that Pk(xk − ❕) ≤ (1 + 4ε)Pi(xi). Then more never harms ui(xk − ❕) ≤ ui(xi ∪ xk − ❕) = ui(xi) + m(j,xk∪xi−❕) ui, j, (cid:96) j (cid:96)=m(j,xi)+1 , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items 1:13 αipj since ui, j, (cid:96)/pj ≤ αi for (cid:96) > m(j, xi) ≤ ui(xi) + ≤ ui(xi) + ≤ ui(xi) + j j (cid:96)=m(j,xi)+1 m(j,xk∪xi−❕) m(j,xk−❕) m(j,xk−❕) (cid:96)=1 αipj j (cid:96)=1 αi ≤ ui(xi) + αi Pk(xk − ❕) ≤ ui(x) + αi(1 + 4ε)Pi(xi) = (2 + 4ε)ui(xi) uk, j, (cid:96) αk since uk, j, (cid:96)/pj ≥ αk for k ≤ m(j, xk) de(cid:27)nition of Pk(xk − ❕) since Pk(xk − ❕) ≤ (1 + 4ε)Pi(xi) since ui(xi) = αi Pi(xi). (cid:3) For the case of only a single copy per good, minj∈xk uk(xk − j) ≤ (1 + ε)ui(xi) holds as was shown by Barman et al. [3]; see Footnote 1 for a proof. We do not know whether the factor 2 in the Theorem above is best possible. We show in Section 5 that a factor larger than 1.2 is necessary. M = 2.5 Polynomial Running Time Recall that n is the number of agents, m is the number of goods, there are kj copies of good j, and j kj is the total items. We also de(cid:27)ne U = maxi, j,k uijk/mini, j,k:ui jk (cid:44)0 as the ratio of the maximum to minimum non-zero utility. The analysis follows Barman et al. with one di(cid:29)erence. Lemma 2.14 is new. For its proof, we need the revised de(cid:27)nition of β3. Lemma 2.13. The price of the least spending uncapped agent is non-decreasing. Proof. This is clear for price increases. Consider a sequence of swaps along an improving path P = (i = a0, ❕1, a1, . . . , ❕h, ah), where the agent ah loses a good, the agents a(cid:96), h(cid:48) < (cid:96) < h, lose and gain a good, and the agent ah(cid:48) gains a good. By Lemma 1, all agents a(cid:96) with h(cid:48) < (cid:96) ≤ h have a price of at least (1 + ε)Pi(xi) after the swap. Also the price of agent ah(cid:48) does not decrease. (cid:3) Lemma 2.14. For any agent k, let jk be a highest price item in xk . Then maxk Pk(xk − jk) does not increase in the course of the algorithm as long as this value is above (1 + ε) minuncapped i Pi(xi). Once maxk Pk(xk − jk) ≤ (1 + ε) minuncapped i Pi(xi), the algorithm terminates. Proof. We (cid:27)rst consider price increases and then a sequence of swaps. Consider any price increase which is not the last. Then β4 ≤ β3. Let h be the least uncapped spender after the price increase and q be the price vector after the increase. Then Qh(xh) ≤ Qi(xi) ≤ rQh(xh). For k ∈ S, we have minjQk(xk − j) ≤ (1 + ε)Qi(xi) ≤ (1 + ε)rQh(xh), i.e., agents in S can become violators but we can bound how bad they can become. For the agent k (cid:60) S de(cid:27)ning β3, we have Pk(x(cid:96) − j) = β3(1 + ε)rPi(xi) ≥ (1 + ε)rQi(xi) ≥ (1 + ε)rQh(xh) and hence the worst violator stays outside S. We used the equality r = 1 + ε and the inequality Qi(xi) = βPi(xi) ≤ β3Pi(xi) in this derivation. Consider next a sequence of swaps. We have an improving path from i to k, say P = (i = a0, ❕1, a1, . . . , ❕h, ah = k). Let x(cid:48) be the allocation after the sequence of swaps. Then minj Pk(x(cid:48) k − j) ≤ minj Pk(xk − j) since k loses a good and minj P(cid:96)(x(cid:48) − j) ≤ (1 + ε)Pi(xi) for all (cid:96) ∈ [0, h − 1] by Lemma 2.2. (cid:3) (cid:96) min j , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:14 Lemma 2.15. The number of subsequent iterations with no change of the least spending agent and no price increase is bounded by n M. 2 Proof. Let i be the least spending agent. We count for any other agent k, how often the improving path can end in k. For each (cid:27)xed length of the improving path, this can happen at most M times (for details see [3]). The argument is similar to the argument used in the strongly polynomial algorithms for weighted matchings [7]. (cid:3) Lemma 2.16. If the least spending uncapped agent changes after a price increase, the value of the old least spending uncapped agent increases by a factor of at least r. Proof. The least uncapped spender changes if β = β4 and β4 is at least r. So Pi(xi) increases by (cid:3) at least r. 3 M 2 log r MU . Theorem 2.17. The number of iterations is bounded by n Proof. Divide the execution into two parts. In the (cid:27)rst part, there are agents that own no good, and in the second part every agent owns at least one good and hence all the Pi(xi) are non-zero. In any iteration of the (cid:27)rst part Pi(xi) = 0, where i is a least spending agent. An shortest improving path P = (i = a0, ❕1, a1, . . . , ❕h, ah) starting in i visits agents a1 to ah−1 owning exactly one good and ends in agent ah owning more than one good. The sequence of swaps will take away ❕h from ah and assign ❕i +1 to ai for 0 ≤ i < h. Since every price increase will grow S by either a good or an agent, an improving path will exist after at most n + m iterations. Thus there are only O(n 2) iterations in the (cid:27)rst part. We come to the second part. Divide its execution into maximum subsequences with the same least spender. Consider any (cid:27)xed agent i and the subsequences where i is the least spender. At the end of each subsequence, i receives an additional item, or we have a price increase. In the latter case, Pi(xi) is multiplied by at least r. Consider the subsequences between price increases. At the end of a subsequence i receives an additional item. It may or may not keep this item until the beginning of the next subsequence. If there are more than M subsequences with i being the least spender, there must be two subsequences such that i loses an item between these subsequences. According to Lemma 2.2, the value of i after the swap is at least r times the minimum price of any bundle and hence at least r times the price of bundle i when i was least spender for the last time. Thus Pi(xi) increases by a factor of at least r. M iterations with i being the least spender, Pi(xi) is We have now shown: After at most M · n 2 multiplied by a factor r. Thus there can be at most n r MU such iterations. Multiplication by n yields the bound on the number of iterations. (cid:3) 2 log 2 M 3 A LOWER BOUND ON THE APPROXIMATION RATIO OF THE ALGORITHM We show that the performance of the algorithm is no better than 1.44. Let k, s and K be positive integers with K ≥ k which we (cid:27)x later. Consider the following instance. We have h = s(k − 1) goods of value K and n = h + s goods of value 1. There is one copy of each good. The number of agents is n and all agents value the goods in the same way. The algorithm may construct the following allocation. There are h agents that are allocated a good of value 1 and a good of value K and there are s agents that are allocated a good of value 1. This allocation can be constructed during initialization. The prices are set to the values and the algorithm terminates. , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items 1:15 The optimal allocation will allocate a good of value K to h players and spread the h + s = sk goods of value 1 across the remaining s agents. So s agents get value k each. Thus (cid:19)1/(h+s) (cid:18) Khks (K + 1)h (cid:32)(cid:18) K (cid:19)(k−1)s (cid:33)1/ks (cid:18) K (cid:19)(k−1)/k = K + 1 ks = K + 1 NSW(OPT) NSW(ALG) = 1/k . k The term involving K is always less than one. It approaches 1 as K goes to in(cid:27)nity. The second term 1/k has it maximal value at k = e. However, we are restricted to integral values. We have 21/2 = 1.41 k and 31/3 = 1.442. For k = 3, (K/(K + 1))2/3 = exp( 2 2 3(K +1). So for K = 666, the factor is less than 1 − 1/1000 and therefore NSW(OPT)/NSW(ALG) ≥ 1.440. 3 ln(1 − 1/(K + 1))) ≈ exp(− 2 3(K +1)) ≈ 1 − 4 CERTIFICATION OF THE APPROXIMATION RATIO How can a user of an implementation of the algorithm be convinced that the solution returned has a NSW no more than 1.445 times the optimum? She may read this paper and convince herself that the program indeed implements the algorithm described in this article. This is unsatisfactory [11]. In this section, we describe an alternative certi(cid:27)cate. the auxiliary problem with M = The algorithm returns an allocation x alg, prices pj for the goods, and MBB-ratios αi for the agents. After scaling all utilities and the utility gap of agent i by αi, we have (3). The user needs to understand that this scaling has no e(cid:29)ect on the optimal allocation. As in Section 2.3, we introduce j kj goods and one copy of each good. The goods have uniform utilities. The user needs to understand that the NSW of the auxiliary problem is an upper bound (Lemma 2.6). We are left with the task of convincing the user of an upper bound on the NSW of the auxiliary problem. Fig. 2. The allocation constructed in the proof of Theorem 4.1. The dashed line above agents 1 to n − k indicates the utility caps. The solid rectangles visualize the values of the bundles. Theorem 4.1. Let c1 ≥ c2 ≥ . . . ≥ cn be the utility caps of the agents, let u1 ≥ u2 ≥ . . . ≥ uM be the utilities of the M goods of the auxiliary problem, and let x optaux be an optimal allocation for the auxiliary problem. Then (cid:32) (cid:33)1/n min(ci , ui) · δ n−h−k ·  (cid:1)/(n − h − k) and h and k are such that h < n − k and n−k +1≤i ≤n ci , where δ = (cid:0) NSW(x optaux) ≤ h+1≤j ≤M uj − 1≤i ≤h n−k +1≤i ≤n ci cn−k +1 ≤ δ < cn−k and δ < uh. The right hand side is illustrated in Figure 2. , Vol. 1, No. 1, Article 1. Publication date: January 2016. alphac1nhn−k+1uhu1 Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:16 to agents n − k + 1 to n and to agents 1 to h. The optimal way to distribute value Proof. We insist that the goods 1 to h are allocated integrally and allow the remaining goods to be allocated fractionally. Clearly, we cannot allocate more than ci to any agent, in particular, not h+1≤j ≤M uj to agents h + 1 to n is clearly to allocate δ each to agents h + 1 to n − k which all have a cap of more than δ and to the assign their cap to agents n − k + 1 to n. The items u1 to uh of value more than δ are best assigned to the agents with the largest utility caps. Assume that two such items, say u(cid:96) and uk, are allocated to the same agent. Then one of the (cid:27)rst h agents is allocated no such item; let v be the value allocated to this agent. Moving uk to this agent and value min(uk , v) from this agent in return, does not decrease the NSW. Also, if any fractional items are assigned in addition to the (cid:27)rst h agents, we move them to agents h + 1 to n − k and increase the NSW. This establishes the upper bound. (cid:3) 2 + M). We conjecture that it can be computed in linear time O(n + M). We also conjecture that the bound is never worse than the bound used in the analysis of the algorithm. It can be better as the following example shows. We have two uncapped agents and three goods of value u1 = 3, u2 = 1 and u3 = 1, respectively. The algorithm may assign the (cid:27)rst two goods to the (cid:27)rst agent and the third good to the second agent. The set B in the analysis of the algorithm consists of the (cid:27)rst good and the last good. Then (cid:96) = 1. The optimal allocation allocates 3 to the (cid:27)rst agent and 2 to the second agent. Thus α(cid:96) = 2. The analysis uses the upper bound √4 · 2 for the NSW of the optimal allocation. The theorem above gives the upper bound √3 · 2; note that h = 1, k = 0, and δ = 2. The upper bound can be computed in time O(n 5 ENVY-FREENESS UP TO ONE COPY For the case of additive valuations and one copy of each good, the optimal allocation is envy-free up to one good as shown in [4]. Also the allocation constructed by the algorithm by Barman et al. [3] is envy-free up to one good. In this section, we show that these properties hold neither for the multi-copy case nor for the capped case. Let ε be a small positive real, say  = 0.01, let r = 1 + ε, and let s be the smallest power of r greater or equal to 2r 2. Then 2 < s < 2.04. We (cid:27)rst give an example for the multi-copy uncapped case. There are two agents and two goods. Good 1 has 5 copies, and good 2 has 2 copies. For the (cid:27)rst agent, the utility vector for good 1 is (s, s, 0, 0, 0) and for good 2 is (1, 0). For the second agent, the utility vector for good 1 is (s, s, s, 0, 0) and for good 2 is (s, s). Then at the optimal NSW allocation, the (cid:27)rst agent is allocated two copies of good 1 and none of good 2, while the second agent is allocated three copies of good 1 and two copies of good 2. For this allocation, NSW = (2s · 5s)1/2 = 101/2 s. Note that allocating one copy each of the second good to each agent gives a NSW of ((2s + 1) · 4s)1/2 = (8s 2)1/2 since 4 < 2s. The Clearly, the (cid:27)rst agent envies the second agent even after removing one copy (of either good) from the allocation of the second agent because u1(x2 − ❕) ≥ (2s + 1) > 2s = u1(x1) for any choice of ❕. 2 + 4s)1/2 < (10s Lemma 5.1. In the case of several copies per good, the allocation maximizing NSW is not necessarily envy-free up to one copy. What does the algorithm do? The initial assignment is equal to the optimal assignment and sets p1 = p2 = s and α1 = α2 = 1. Agent 1 is the least spending uncapped agent. The allocation is not ε-p- EF1, since P1(x1) = 2s and P2(x2) = 5s and min❕∈x2 P2(x2 − ❕) = 4s. The constraints on α1 are [0, 1] by the (cid:27)rst good and [1/s, 1] by the second good. The tight graph consists only of agent 1. We enter the else-case of the main loop with S = 1. Then β1 = s > 2, β2 = ∞, β3 = 4s/(2s · r < 2 2/2 ≈ 1/2 and terminate. Now and β4 = r 1+(cid:98)logr 5/2(cid:99) ≥ 5/2 ≥ β3. Thus β = β3. We decrease α1to r 2) = 2/r 2 , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items 1:17 2) · 2s = 4s/r P1(x1) = (2/r 2 and hence (1 + 4ε)P1(x1) ≥ 4s = P2(x2 − ❕) = 4s. The optimal allocation is now 4ε-p-envy free up to one copy. We turn to possible improvements of Theorem 2.12. Since min❕∈x2 u1(x2 − ❕) = 2s + 1 and u1(x1) = 2s, in order to have min❕∈x2 u1(x2 −❕) ≤ (c + ε)u1(x1), we need c ≥ 1 +(1− 2εs)/(2s) ≥ 1.2. 2/2, α2 = s, p1 = p2, the optimal allocation in the example above is Lemma 5.2. With α1 = r 4ε-p-envy free up to one copy. Lemma 5.3. Theorem 2.12 does not hold when the constant 2 is replaced by 1.2. For the linear capped case, again we have two agents, and this time we have four goods with one copy each. The utility vectors of both agents are (s, s, s, s), but the (cid:27)rst agent is capped at 3, while the second agent is uncapped. Then the optimal NSW allocation allocates one good to the (cid:27)rst agent and three goods to the second agent for NSW = (s · 3s)1/2. Note that allocating 2 copies each give a NSW = (3 · 2s)1/2 2)1/2 since s ≥ 2. In the optimal assignment, the (cid:27)rst agent envies the second agent, even after removing one good from the allocation of the second agent. What does the algorithm do? It may construct the optimal assignment during initialization; the prices of all four goods are set to s and both α-values are set to one. Agent 1 is the least spending uncapped agent. The tight graph consists of the edges from agent 1 to the goods owned by agent 2 and from these goods to agent 1. An improving path exists and one of these goods is reassigned to agent 1. The algorithm terminates with an allocation in which both agents own two goods. < (3s Lemma 5.4. In the case of single copies per good but with utility caps, the allocation maximizing NSW is not necessarily envy-free up to one good. 6 LARGE MARKETS Let δ > 0 be a constant. We call a market δ-large if ui, j, (cid:96) ≤ δ · ui(G)/n, where G is the set of all caps. With utility caps, the treatment becomes more clumsy, but does not give additional insights. 1≤(cid:96)≤kj ui, j, (cid:96). For simplicity, we restrict to instances without utility goods. Note that ui(G) = j Theorem 6.1. For a δ-large market in which all non-zero utilities are powers of r = 1 + ε NSW(x ∗)/NSW(x alg) ≤ (1 + 4ε)/(1 − δ). Proof. Let (x alg, p, α) be the allocation, price vector, and scaling factors returned by the algo- rithm. For simplicity we use x = x alg. We scale all utilities ui,∗,∗ by αi. Then αi becomes one and we have for all i and j. Let U = 1≤(cid:96)≤m(j,xi) ui, j, (cid:96). Let x∗ be the allocation maximizing NSW. Then ui, j,m(j,xi)+1 ≤ pj ≤ ui, j,m(j,xi) i ui(x∗ i ui(xi) =  i j i ) ≤ U by Lemma 2.6(a) and hence NSW(x∗) ≤ ((U/n)n)1/n = U/n. We next prove a lower bound on NSW(x alg). Note that ui(G) ≤ U due to Lemma 2.6(a). Thus, ui, j, (cid:96) ≤ δU/n. For any i, we have Pi(xi) = ui(xi). Since the allocation returned by the algorithm is 4ε-p-envy- free up to one copy, we have min❕∈xk uk(xk − ❕) ≤ (1 + 4ε)ui(xi) for every agent k. Let ❕k be the good that minimizes the left hand side. Summing over all k yields and hence uk(xk) −  ui(xi) ≥ U − n(δ/n)U (1 + 4ε)n k k uk(❕k) ≤ (1 + 4ε)n · ui(xi), 1 − δ 1 + 4ε · U n . = , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:18 Thus NSW(x∗) NSW(x alg) ≤ ( U/n i ui(xi))1/n ≤ U/n (cid:16)(cid:16) 1−δ1+4ε · U n (cid:17)n(cid:17)1/n = 1 + 4ε 1 − δ . (cid:3) 7 THE CG- AND BMV-BOUND ARE EQUAL In this section, we restrict the discussion to the case of a single copy per good and no utility constraints. We have n agents and m goods. Cole and Gkatzelis [6] and Barman, Murthy, and Vaish [3] de(cid:27)ned upper bounds on the Nash social welfare of any integral allocation of the goods. We show that the bounds are equivalent. Cole and Gkatzelis [6] de(cid:27)ned their upper bound via spending restricted Fisher markets. Each agent has one unit of money and each good has one unit of supply. Goods can be allocated fractionally and xij is the fraction of good j allocated to agent i. A solution to the market is an allocation x and a price pj for each good j such that j xijpj = 1. uij/pj = αi where αi = max(cid:96) ui (cid:96)/p(cid:96). (2) An agent i spends money only on goods with maximum bang-per-buck i.e., xij > 0 implies (3) Goods with price less than 1 (small goods) are sold completely. Let Ss = {jpj < 1}. Then (4) Exactly one unit of money is spent on each good with price at least 1 (large good). Let (1) Each agent spends all his money i.e., for all j ∈ Ss, S(cid:96) = {jpj ≥ 1}. Then for all j ∈ S(cid:96), (cid:32) i xij = 1. CG-UB := The last constraint is the spending constraint and gives the market its name. Cole and Gkatzelis [6] show that the Nash social welfare of any integral allocation of goods to agents is at most The following bound is implicit in the work of Barman, Murthy, and Vaish [3]. For any scaling vector α = (α1, . . . , αn), de(cid:27)ne uniform utilities uj by uj = maxi uij/αi. For a set S of more than m − n goods, let  a(S) = j∈S uj S − (m − n) = i xijpj = 1. (cid:33)1/n  i pj αi . j∈S(cid:96)  j∈S uj n − S ; note that S − (m − n) = n − (m − S) = n − S. So a(S) is the amount per agent if the total utility of the goods in S is distributed uniformly over n − S agents. Finally, let Sα = { S ; S > m − n and uj > a(S) for j (cid:60) S }. uj · a(S)n−S · (cid:33)1/n αi . i Then the BMV-bound is de(cid:27)ned as follows: (cid:32) the Nash social welfare of any allocation by ( BMV-UB := min α >0 min S ∈Sα j(cid:60)S Lemma 7.1. BMV-UB is an upper bound on the Nash social welfare of any integral allocation. Proof. Scaling the utilities of agent i by αi does not change the optimal allocation and changes i αi)1/n. Replacing uij by uj = maxh uhj for every agent i can only increase Nash social welfare. Allowing to allocate the goods in S fractionally can only increase social welfare. Since S is such that uj > a(S) for j (cid:60) S, the optimal partially fractional , Vol. 1, No. 1, Article 1. Publication date: January 2016. On Fair Division for Indivisible Items 1:19 allocation is to allocate each uj, j (cid:60) S, to a distinct agent and to allocate a(S) to each one of the remaining agents. (cid:3) Lemma 7.2. For (cid:27)xed α, the BMV-bound is minimized for S ∈ Sα satisfying uj > a(S) for j (cid:60) S and uj ≤ a(S) for j ∈ S. This S is unique. Proof. Assume uh > a(S) for some h ∈ S. Let T = S − h. Then < a(S), uha(T)n−T (cid:17)1/(n−S ) (cid:16) since the LHS is the geometric mean of uh and n − T copies of a(T) and the RHS is equal to their arithmetic mean; note that (uh + (n − T )a(T))/(n − S) = a(S). We can determine S greedily. Start with S equal to the set of all goods. As long as there is a j ∈ S such that uj > a(S), remove j from S. For5 such a j, a(S \ j) ≤ a(S) and hence any candidate for removal stays a candidate for removal. So the removal process always ends up with the same S. j∈S uj ≥ uj for all j ∈ S and hence the process stops before (cid:3) Also note that for S = n − 1, a(S) = all goods are removed from S. Lemma 7.3. BMV-UB ≤ CG-UB. Proof. Consider a solution (xij , pj) to the spending restricted Fisher market. The scaling vector for the BMV-UB is now de(cid:27)ned as αi = maxj uij/pj. Let uij = uij/αi be the scaled utilities. Then uij ≤ pj and uij = pj whenever xij > 0. Let uj = maxi uij; then uj = pj since for every j, xij > 0 for at least one i. Since the total money spent is n, one unit is spent on each good in S(cid:96), and pj is spent on good j ∈ Ss, we have n − Ss = n = j∈Ss a(Ss) = u(Ss) pj · a(Ss)n−S(cid:96) · fS(α, u) := (cid:32) j∈S(cid:96) i j(cid:60)S and hence BMV-UB ≤ αi and uj. minimize subject to pj + S(cid:96)  j∈Ss pj n − S(cid:96) = 1. (cid:33)1/n (cid:32) (cid:33)1/n  i αi = pj αi j∈S(cid:96) = CG-UB. Since pj > 1 for j ∈ S(cid:96) and pj ≤ 1 for j ∈ Ss, the BMV-UB is minimized for the set Ss ∈ Sα and hence (cid:3) For a set S of more than m − n goods, let PS be the following minimization problem in variables ln uj +(n − S) ln a(S) + ln αi i uj ≥ uij/αi uj ≥ a(S) for all i and j for j (cid:60) S If PS is feasible, let bS be the optimum objective value and let (α S , uS) be an optimum solution. If S is the set of all goods, αi = 1 for all i and uj = maxi uij is feasible solution. Let S∗ be such that (1) PS∗ is feasible, (2) bS∗ is minimum, and (3) among the S satisfying (1) and (2), S has largest cardinality. 5Let k = n − S . Then a(S \ j) = (u(S) − uj)/(k − 1) ≤ u(S)/k = a(S) i(cid:29) u(S) ≤ kuj i(cid:29) a(S) ≤ uj . , Vol. 1, No. 1, Article 1. Publication date: January 2016. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:20 j > a(S) for j (cid:60) S, uS j ≤ a(S) for j ∈ S, and uS Lemma 7.4. For S = S∗, uS Proof. Assume (cid:27)rst that uS Assume next that uS h Assume uS feasible solution of PT and bT < bS by the proof of Lemma 7.2. for PT and bT = bS, a contradiction to the choice of S. feasible and decreasing the objective. h > a(S) for some h ∈ S. Consider T = S − h. Then (α S , uS) is a = a(S) for some h (cid:60) S. Let T = S ∪ h. Then (α S , uS) is a feasible solution , staying (cid:3) j > a(S) if j (cid:60) S, we may decrease uS j > maxi uij/αi for some j. Since uS = maxi uij/αi. j j Lemma 7.5. Let S = S∗. Then (α S , S) de(cid:27)nes the BMV-bound. BMV) de(cid:27)ne the BMV-bound and let u Proof. Let (α BMV BMV) is a feasible solution of PS BMV and BMV , u , S (α BMV j = maxi uij/α BMV i for all j. Then Therefore fS BMV(α , u BMV BMV) = bS∗ ≤ bS BMV ≤ 1 n 1 n ln BMV-UB. ln BMV-UB. Conversely, let S = S∗, let (α S , uS) be an optimal solution to PS, and let Sα S be the set minimizing the BMV-bound for α S Then Sα S = S∗ by Lemma 7.4 and hence 1 n ln BMV-UB ≤ bS∗ . (cid:3) Lemma 7.6. CG-UB ≤ BMV-UB. Proof. Let S = S∗ and let (α S , uS) be an optimal solution of problem PS. We have shown j ≤ a(S) for j ∈ S, and = maxi uij/αi. Let k = n − S. The KKT conditions are necessary conditions for the optimum. Let zij ≥ 0 for all i and j, and above that (α S , S) de(cid:27)nes the BMV-bound, and that uS uS j yj ≥ 0 for j (cid:60) S be the multipliers. Then we need to have (write ujαi ≥ uij for the inequalities) j > a(S) for j (cid:60) S, uS De(cid:27)ne pj = uS j allocated to agent i. The bang-per-buck ratio of agent i is and call pj the price of good j and xij the fraction of good αi = max j uij pj = i uS α S j /a(S) = a(S)α S j uS i . We now rewrite and interpret the optimality conditions. • Since uS j > a(S) for j (cid:60) S, yj = 0 for j (cid:60) S. , Vol. 1, No. 1, Article 1. Publication date: January 2016. i 1/uS 1 j = a(S) = i = 1/α S zij > 0 ⇒ α S yj > 0 ⇒ uS i j zijα S i + yj zijα S i zijuS j i uS j = uij j = a(S) j /a(S) and xij = a(S)zijα S i for j (cid:60) S for j ∈ S for all i for all i and j for all j (cid:60) S. On Fair Division for Indivisible Items • The (cid:27)rst condition becomes 1 = • The third condition becomes 1 = • The second condition becomes good j (cid:60) S. Note that pj > 1 for such goods. money. allocated, but not overallocated. i xijpj, i.e., exactly one unit of money is spent on each j xijpj, i.e., every agent spends exactly one unit of i xij = 1 for all j ∈ S, i.e. goods in S are completely • xij > 0 implies zij > 0 which in turn implies that α S = αi which means that good j is allocated to i only if it has the maximum bang-per-buck ratio. This shows that the pair (x, p) is a solution to the spending restricted Fisher market and the CG-bound for this solution is uS j = uij. Hence uij/pj = a(S)α S · a(S)n−S · CG-UB ≤ i = i = BMV-UB. α S a(S)α S i uS j uS j i a(S) · i j(cid:60)S j(cid:60)S i 1:21 (cid:3) We have now shown the main theorem of this section. Theorem 7.7. The CG-bound and the BMV-bound have the same value. In [5, Lemma 8] yet another mathematical program is given for the same bound. We include it for completeness. In the optimal solution to this program bij is the amount of money spent by agent i on good j, and qj is the total spending on good j in the spending restricted market. Acknowledgement: We want to thank Hannaneh Akrami for a careful reading of the paper. REFERENCES [1] Nima Anari, Shayan Oveis Gharan, Amin Saberi, and Mohit Singh. Nash social welfare, matrix permanent, and stable polynomials. In ITCS, pages 36:1 -- 36:12, 2017. [2] Nima Anari, Tung Mai, Shayan Oveis Gharan, and Vijay V. Vazirani. Nash social welfare for indivisible items under separable, piecewise-linear concave utilities. In SODA, pages 2274 -- 2290, 2018. [3] Siddharth Barman, Sanath Kumar Krishna Murthy, and Rohit Vaish. Finding fair and e(cid:28)cient allocations. CoRR, abs/1707.04731, 2017. to appear in EC 2018. [4] Ioannis Caragiannis, David Kurokawa, Hervé Moulin, Ariel D. Procaccia, Nisarg Shah, and Junxing Wang. The unreasonable fairness of maximum Nash welfare. In EC, pages 305 -- 322, 2016. [5] Richard Cole, Nikhil R. Devanur, Vasilis Gkatzelis, Kamal Jain, Tung Mai, Vijay V. Vazirani, and Sadra Yazdanbod. Convex program duality, Fisher markets, and Nash social welfare. In EC, pages 459 -- 460, 2017. [6] Richard Cole and Vasilis Gkatzelis. Approximating the Nash social welfare with indivisible items. In STOC, pages [7] J. Edmonds and R.M. Karp. Theoretical improvements in algorithmic e(cid:28)ciency for network (cid:30)ow problems. Journal of 371 -- 380, 2015. the ACM, 19:248 -- 264, 1972. , Vol. 1, No. 1, Article 1. Publication date: January 2016. maximize subject to bi j ij j u qj j j q i      i j bij = qj bij = 1 qj ≤ 1 bij ≥ 0 for all j for i for all j for all i and j. Bhaskar Ray Chaudhury, Yun Kuen Cheung, Jugal Garg, Naveen Garg, Martin Hoefer, and Kurt Mehlhorn 1:22 [8] E. Eisenberg and D. Gale. Consensus of subjective probabilities: The pari-mutuel method. The Annals Math. Statist., [9] Jugal Garg, Martin Hoefer, and Kurt Mehlhorn. Approximating the Nash Social Welfare with Budget-Additive Valuations. In SODA 2018, pages 2326 -- 2340, 2018. [10] Euiwoong Lee. APX-hardness of maximizing Nash social welfare with indivisible items. Inf. Process. Lett., 122:17 -- 20, 30:165 -- 168, 1959. 2017. 161, 2011. [11] R.M. McConnell, K. Mehlhorn, S. Näher, and P. Schweitzer. Certifying algorithms. Computer Science Review, 5(2):119 -- [12] Hervé Moulin. Fair division and collective welfare. MIT Press, 2003. [13] J. Nash. The bargaining problem. Econometrica, 18:155 -- 162, 1950. [14] Nhan-Tam Nguyen, Trung Thanh Nguyen, Magnus Roos, and Jörg Rothe. Computational complexity and approxima- bility of social welfare optimization in multiagent resource allocation. Autonomous Agents and Multi-Agent Systems, 28(2):256 -- 289, 2014. , Vol. 1, No. 1, Article 1. Publication date: January 2016.
1811.04052
1
1811
2018-11-09T18:15:26
Polynomial-time Approximation Scheme for Minimum k-cut in Planar and Minor-free Graphs
[ "cs.DS" ]
The $k$-cut problem asks, given a connected graph $G$ and a positive integer $k$, to find a minimum-weight set of edges whose removal splits $G$ into $k$ connected components. We give the first polynomial-time algorithm with approximation factor $2-\epsilon$ (with constant $\epsilon > 0$) for the $k$-cut problem in planar and minor-free graphs. Applying more complex techniques, we further improve our method and give a polynomial-time approximation scheme for the $k$-cut problem in both planar and minor-free graphs. Despite persistent effort, to the best of our knowledge, this is the first improvement for the $k$-cut problem over standard approximation factor of $2$ in any major class of graphs.
cs.DS
cs
Polynomial-time Approximation Scheme for Minimum k-cut in Planar and Minor-free Graphs MohammadHossein Bateni∗ Alireza Farhadi†‡ MohammadTaghi Hajiaghayi†‡ Abstract The k-cut problem asks, given a connected graph G and a positive integer k, to find a minimum-weight set of edges whose removal splits G into k connected components. We give the first polynomial-time algorithm with approximation factor 2 − ǫ (with constant ǫ > 0) for the k-cut problem in planar and minor-free graphs. Applying more complex techniques, we further improve our method and give a polynomial-time approximation scheme for the k-cut problem in both planar and minor-free graphs. Despite persistent effort, to the best of our knowledge, this is the first improvement for the k-cut problem over standard approximation factor of 2 in any major class of graphs. 1 Introduction In the k-cut problem, given an undirected connected graph with edge weights, the goal is to find a minimum-weight set of edges whose removal splits the graph into k connected components. The problem is also called the k-way cut problem or the multi-component cut. This problem is a natural generalization of the minimum cut problem in which we want to find a minimum-weight set of edges whose removal splits the graph into two components. Goldschmidt and Hochbaum [18] proved that the k-cut problem is NP-hard when k is part of the input. In the same work, they provided an O(nk2 ) algorithm for the k-cut problem which is polynomial for every fixed k. Better algorithms have been proposed in a series of works [20, 36, 22, 35]. As of today, the best algorithm for the minimum k-cut problem is by Thorup [35], and has the running time of O(n2k log n). Despite these improvements, this problem is proven to be W[1]-hard when k is taken as a parameter [14]. This hardness shows that no FPT algorithm parameterized by k can solve this problem unless P = NP. In terms of approximation algorithms, several approximation algorithms are known for this problem [33, 28, 31, 39, 37], however the approximation ratio of none of them is better than 2−o(1). In fact, a recent result by Manurangsi [27] shows that this problem is NP-hard to approximate to within 2 − ǫ factor assuming Small Set Expansion Hypothesis. Also, to the best of our knowledge, prior to this work, there was no approximation algorithm with a ratio better than 2 for any major class of graphs. It is also worth mentioning that a recent work by Gupta et al. [19] showed that using an FPT algorithm the approximation factor of 2 can be beaten in the k-cut problem. They showed that there exists a 2 − ǫ approximation algorithm that runs in time 2O(k6) O(n4). However, their algorithm is not polynomial when k is part of the input. ∗Google Research. Email: [email protected] †University of Maryland. Email: {farhadi, hajiagha}@cs.umd.edu ‡Supported in part by NSF CAREER award CCF-1053605, NSF AF:Medium grant CCF-1161365, NSF BIGDATA grant IIS-1546108, NSF SPX grant CCF-1822738, and two small UMD AI in Business and Society Seed Grant and UMD Year of Data Science Program Grant 1 In this paper, we first show that surprisingly the approximation guarantee of a natural greedy algorithm is 2 − ǫ in planar graphs as well as graphs excluding a fixed minor, for some positive constant ǫ. Later, we show how our method can be extended to derive a PTAS for the k-cut problem in minor-free and planar graphs. This is the first result that beats the approximation factor of 2 in polynomial-time for a major class of graphs. Theorem 1.1. There exists a natural greedy algorithm (Algorithm 1) with the approximation ratio of 2− ǫ in minor-free graphs. Also, the same algorithm achieves the approximation ratio of 1.9968... in planar graphs. The above theorem is proved in Section 3. Then we move on to the result with the better guarantee. The following is proved in Section 4. Theorem 1.2. There is a polynomial-time approximation scheme (PTAS) for the k-cut problem in planar and minor-free graphs. In our algorithm we often find minimum-weight splits (a split is subset of edges whose removal increases the number of connected components. Specifically, a k-way split is a split whose removal increases the number of connected components by k − 1). Also, we work with notions of separation degree and density of splits. Roughly speaking, the separation degree of a split is the number of the components that removal of a split adds to the graph. Additionally, the density of a split is the total weight of the edges in a split divided by its separation degree. Although the density of a minimum split could be twice the density of the optimal solution, we show that the density of splits with a larger separation degree gets very close to the density of the optimal solution in planar and minor-free graphs. Interestingly, the same does not hold in general graphs, where the density of arbitrary large splits may be as much as a factor 2 − o(1) of the density of the optimal solution. For example, in an unweighted complete graph, the density of arbitrary large splits are 2 − o(1) of the density of the optimal solution even if size of the splits are very large. We show that a natural greedy algorithm that repeatedly picks a minimum-density split with a constant separation degree achieves an approximation ratio better than 2. First, in order to introduce and highlight our main ideas, we consider the greedy algorithm which repeatedly picks a minimum-density split with a separation degree of at most 3 and show that its approximation ratio is 2 − ǫ in minor-free graphs. Subsequently, we generalize our method to derive a polynomial-time approximation scheme (PTAS) in planar and minor-free graphs. Saran and Vazirani [33] considers a similar greedy algorithm which successively removes the edges of a minimum cut. They showed that the approximation ratio of the greedy algorithm is 2− 2/k in general graphs. Later, Xiao et al. [37] generalized this method by repeatedly removing the edges of a minimum h-way split. Although they find larger splits, they showed that the approximation ratio of this algorithm is about 2− h/k, and it does not beat the approximation factor of 2 by any constant factor. In our first main result, we show that the approximation ratio of the simple greedy algorithm is better than 2 by a constant factor in minor-free graphs. Our main observation is that in any balanced weighted graph, there exists a matching such that its weight is at least a constant fraction of the total weight of the graph. This result can also be viewed as a generalization of the work of Nishizeki and Baybars [29] in unweighted graphs. Later, we introduce a more profound analysis of our method to derive a PTAS in planar and minor-free graphs. 1.1 Related Works A problem closely related to the k-cut problem is the multiway cut problem. Given a set of k vertices called terminals, in the multiway cut problem, we want to find a minimum-weight cut 2 that separates the terminals from one another. The study of its computational complexity was inaugurated in 1983 by Dahlhaus, Johnson, Papadimitriou, Seymour, and Yannakakis [13]1. They provided a simple 2-approximation algorithm for the multiway cut problem, and proved that the problem is APX-hard for any fixed k ≥ 3. However, in the case of planar graphs, they showed that the problem can be solved in a polynomial time for fixed k but is NP-hard when k is part of the input. Surprisingly, as of today, it is not known whether k-cut problem is NP-hard in planar graphs. The approximation factor of this problem improved in a sequence of works [9, 12, 21]. As of today, the best approximation factor is 1.3438 [21]. In case of planar graphs, a very recent result by Bateni et al. [3] shows there exists a PTAS for the multiway cut problem in planar graphs. Another problem related to the k-cut problem is the Steiner k-cut problem, which generalizes both the k-cut problem and the multiway cut problem. Given an edge-weighted undirected graph G, a subset of vertices T called terminals, and an integer k ≤ T, the objective is to find a minimum-weight set of edges whose removal results in k disconnected components, each containing at least one terminal. The best result known for this problem is a 2− 2/k approximation algorithm due to Chekuri et al. [10]. We remark that the "identity-relaxed" variants of Steiner tree and multiway cut problems, namely k-MST and k-cut, have been elusive to date. The latter problems allow us to pick the iden- tity of k "terminals" to connect or separate, respectively. The initial 2-approximation algorithms for Steiner tree [17] and multiway cut [13] were improved in a series of work [9, 23, 30, 32, 38] culminating in a 1.3863 approximation algorithm [8] for Steiner tree and a 1.3438 approximation algorithm for multiway cut [21]. Nonetheless, no approximation guarantee better than 2 − o(1) is known for k-MST or k-cut. Similarly, in the case of planar graphs, where PTASs are known for Steiner tree [5] and mul- tiway cut [3], their identity-relaxed variants (prior to this work) proved to be more resilient. In particular, the standard spanner construction techniques and the small-treewidth reduction ap- proach developed and successfully applied to a host of network design problems in the last decade [2, 3, 4, 5, 6, 7, 15, 24, 25], seem challenging to use in this context. Recently, Cohen-Addad et al. [11] gave PTASs for k-means and k-median, using the local search method. (In their case, the non-identity-relaxed variant where the k "centers" are known is trivial and not interesting to solve.) 2 Preliminaries Let G = (V, E; w) be an undirected graph where w : E → R+ is an assignment of weights to the edges of G. We use V (G) and E(G) to denote the vertices and edges of the graph G respectively. For each edge e ∈ E, we use w(e) to denote the weight of e. Similarly, for a set of edges E′ ⊆ E, we use w(E′) to denote the total weight of the edges in E′, i.e., w(E′) = Pe∈E′ w(e). A graph G is called normalized if w(E) = 1. We denote the number of (connected) components in G by comp(G). Moreover, we use β(G) = E/V to denote the ratio of the number of edges in G to its number of vertices. A k-way cut is a partition of V into k disjoint, nonempty sets V1, V2, . . . , Vk, called parts. We use (V1, V2, . . . , Vk) to denote the cut. The weight of a k-way cut is the total weight of the edges whose endpoints are in different parts. We denote the weight of the cut by w(V1, V2, . . . , Vk). For any subset S ⊆ E of edges, we use G − S to denote the graph derived from G by removing the edges in S. We say that a edge set S is a k-way split in G if comp(G− S) = (k − 1) + comp(G). 1The work was first known in an unpublished but widely circulated extended abstract. Their complete paper was published in 1994. 3 Algorithm 1: 2 − ǫ Approximation Algorithm for Minor-free Graphs Data: An H-minor-free connected graph G, and integer k 1: C = ∅. 2: while separation degree of C is at most k − 4 do 3: 4: 5: Let G′ = G − C be the graph obtained by removing all the previous cuts from G. {Note that the separation degree of C is equal to the number of connected components in G′.} Let C ′ be a split in G′ whose density is minimum among all splits with the separation degree of at most 3. C = C ∪ C ′. 6: Let G′ = G − C be the graph obtained by removing all the previous cuts from G. 7: Let d be the separation degree of C. 8: Let C ′ be a minimum (k − d + 1)-way split in G′. 9: return C ∪ C ′. Therefore, k-way splits and k-way cuts are equivalent in connected graphs. We define the separation degree of S to be k. We use densG(S) to denote the density of S and define it as densG(S) = w(S)/(k − 1) . A graph G is called H-minor-free if and only if the graph H does not appear as a minor of G; i.e., H cannot be obtained via removing and contracting edges and removing vertices in G. Note that planar graphs are a special case of minor-free graphs as they do not have K5 and K3,3 minors. In this paper, w.o.l.g., we assume that H is a complete graph. The following lemma directly uses a result by Thomason [34] to show that the number of edges in a minor-free graph is almost linear in its number of vertices. The proof is deferred to the appendix. Lemma 2.1. For any H-minor-free graph G, we have β(G) ≤ (γ + o(1))V (H)plnV (H), where γ = 0.319... is an explicit constant. In the paper, we often find minimum-weight splits. The following lemma shows that for any fixed k, a minimum k-way split can be found in a polynomial-time. The proof of this lemma can be found in the appendix. Lemma 2.2. Given a graph G and a parameter k, there exists a polynomial time algorithm that finds a minimum k-way split in G. 3 Beating Approximation Factor of 2 in Minor-free Graphs In this section, we provide a 2− ǫ approximation algorithm for the k-way cut problem in minor- free graphs. Recall that in the k-cut problem, we are given a connected graph, and we want to find a minimum-weight set of edges whose removal splits the graph into k connected components. Our algorithm repeatedly finds a split in our graph and removes its edges to increase the number of connected components. The algorithm consists of two phases. In the first phase, while the number of connected components in the graph is at most k − 4, we find minimum 2-way and 3-way splits, pick the one who has the lowest density and remove its edges. Every time that we remove the edges of a either 2-way split or 3-way split, the number of connected components increases by at most 2. In the second phase of the algorithm, if the current graph has d connected components, we find a minimum (k − d + 1)-way split and remove its edges. Removing edges of this split increases the 4 number of connected components by k − d, therefore our final graph has k connected components. We show that in minor-free graphs, the approximation ratio of this algorithm is better than 2 by a constant factor. Note that for a k ≤ 4, since the number of connected components in the original graph is 1 which is larger than k − 4, the algorithm skips the first phase, and finds a minimum k-way split at its only step. When k > 4, the algorithm repeatedly finds a minimum 2-way split or a minimum 3-way split, and removes its edges. Removing the edges of a 2-way split and a 3-way split increases the number of connected components by 1 and 2 respectively. Therefore, in this case the number of connected components at the end of the first phase is either k − 3 or k − 2. It follows that in this case, the second phase of our algorithm either finds a minimum 3-way split or a minimum 4-way split. First, we show that the density of splits picked by the algorithm in its first phase is less than 2/k fraction of the optimal solution. Particularly, we show that the density of minimum-density split with the separation degree of at most 3 is at most (2 − ǫ)OP T /k where OP T is the weight of the minimum k-way cut, and ǫ is a positive constant depending on V (H). Later we use this theorem to show that the approximation ratio of our algorithm is better than 2. Our main tool is the following lemma which shows that if in a minor-free graph density of every 2-way split is at least (1 + δ)/n for some δ > 0, then the weight of the maximum weighted matching is at least a constant fraction of the total weight of the graph. Lemma 3.1. Given a δ > 0, let G = (V, E; w) be a connected normalized graph with n vertices such that the density of every 2-way split is least (1 + δ)/n, then the weight of a maximum weighted matching in G is at least δ2 16β(G)(1 + δ) . Proof. Let A be the set of vertices in G whose degree is at least d for some integer d. It follows that A ≤ 2E/d. Note that E = nβ(G). Therefore, A ≤ 2nβ(G)/d. Let B = V \ A, then B ≥ n(1− 2β(G)/d). Let EB be the set of edges in E whose both ends are in B, and EA = E \ EB be all other edges. Setting d = 4β(G)(1 + δ)/δ, we claim that w(EB) ≥ δ/2. For the sake of contradiction suppose that w(EB) < δ/2. Then, we have Since G is normalized, we have w(E) = 1. Therefore, w(EA) = w(E) − w(EB) > w(E) − δ/2 . w(EA) > 1 − δ/2 . For every vertex u ∈ B, let Cu be a split that separates u from all other vertices. Then the separation degree of Cu is at least 2. Considering all Cu splits, each edge in EB appears in 2 of these splits, and each edge in EA appears in at most one of them. Thus, X u∈B w(Cu) ≤ 2w(EB) + w(EA) . Note that w(EB) + w(EA) = w(E) = 1. Therefore, we have X u∈B w(Cu) ≤ 2w(EB) + w(EA) = 1 + w(EB) < 1 + δ/2 . (1) On the other hand, the separation degree of every Cu is at least 2. We argue that weight of all of them is at least (1 + δ)/n. If the weight of one of them is less than (1 + δ)/n, then the weight 5 of a minimum 2-way split is also less than (1 + δ)/n as well as its density, which is a contraction. Therefore, we have w(Cu) > X u∈B 1 + δ n B ≥ (1 + δ)(1 − 2β(G)/d) . Substituting d for 4β(G)(1 + δ)/δ, gives us X u∈B w(Cu) ≥ 1 + δ/2 . (2) Inequality (1) together with (2) is a contradiction. Therefore, w(EB) ≥ δ/2. Now we find a weighted matching using the following greedy algorithm. 1. Let T = EB be the set all the edges in EB, and M = ∅ be our current matching. 2. Let e ∈ T be a edge that has the maximum weight among all the edges in T . 3. Add e to the matching, i.e., M = M ∪ {e}. Also, remove e and all the edges which are incident to e from T . 4. While T > 0, repeat steps 2-3. In each step, we pick an edge that has the maximum weight in T , add it to our current matching, and remove all the edges which are incident to this edge from T . Since the degree of every vertex in B is at most d, every time we add an edge to our matching, we remove at most 2d − 1 edges from T . Let e be the edge picked by the algorithm in one of its steps. e has the maximum weight in T , thus the weight of each of the removed edges in this step is at most w(e). Therefore, Replacing d, we have w(M) ≥ w(EB) 2d − 1 ≥ δ/2 2d . w(M) ≥ δ/2 2d = δ2 16β(G)(1 + δ) . Therefore, we have found a matching with the total weight at least δ2 16β(G)(1 + δ) , and it completes the proof. Note that in minor-free graphs by Lemma 2.1, β(G) is at most a constant, therefore we have found a matching with a constant weight in G. (cid:3) Now we are ready to prove that the density of a split whose density is minimum among all the splits with the separation degree of at most 3, is at most (2 − ǫ)/k fraction of the weight of minimum k-way split. Theorem 3.2. Given an H-minor-free graph G and an integer k ≥ 3, let S be a split with the minimum density among all the splits with the separation degree of at most 3, Then for any k-way split Sk, we have densG(S) ≤ where ǫ > 0 is a constant depending on V (H). (2 − ǫ)w(Sk) k , 6 First consider the case that G is connected. Let P1, P2, . . . , Pk be the components in Proof. G − Sk. For each Pi let Ei be set of edges whose both ends are in Pi. We contract all the edges in E1, E2, . . . , Ek to obtain the new graph G′ = (V ′, E′; w′). Also, we replace parallel edges with a single edge with the weight equal to sum of them. The graph G′ has exactly k vertices each corresponding to a component in G − Sk. Furthermore, G′ is H-minor-free since it is derived by edge contradictions from G. Moreover, every split in G′ corresponds to a split with the same separation degree and same weight in G. Let v1, v2, . . . , vk be the vertices of G′, where vi is the vertex corresponding to Pi. For each vertex v in G′, we use cv to denote the weight of the edges incident to v. It follows that for every vertex vi, cvi = w(Pi, V \ Pi). Also, Without loss of generality, we assume that G′ is normalized, i.e., w(Sk) = 1. w(Sk) = Pv∈V (G′) cv 2 . If there exists a 2-way split in G′ with the density of at most (2− ǫ)/k, then the theorem clearly holds. Otherwise, we assume that the density of every 2-way split is greater than (2 − ǫ)/k. For every vertex v in G′, the separation degree of Sv = ({v}, V (G′) \ {v}) is at least 2, and it has a weight of cv. For every vertex v, cv is at least (2− ǫ)/k, otherwise, the weight of a minimum 2-way split is less than (2 − ǫ)/k, and the graph has a 2-way split with the density less than (2 − ǫ)/k which is a contradiction. Graph G′ is a normalized, and the density of every 2-way split is at least (2 − ǫ)/k. Therefore, by setting δ = 1 − ǫ, Lemma 3.1 implies that G′ has a matching with the weight at least α = 16β(G′)(1 + δ) δ2 . Let M be the maximum weighted matching in G′. We have w′(M) ≥ α. Since G′ is connected, we have β(G′) ≥ 1 − 1/k ≥ 2/3 . Setting ǫ = 1/(35β(G′)), it is easy to verify that α ≥ ǫ while β(G′) ≥ 2/3. Thus, the weight of M is at least ǫ. For every edge (a, b) in M, let S(a,b) = ({a},{b}, V (G′) \ {a, b}) be a split that separates a and b from all other vertices and each other. We claim that the weight of at least one of these splits is at most 2(2 − ǫ)/k. For the sake of contradiction, suppose that the weight of all of them is greater than 2(2 − ǫ)/k. Let U be the set of vertices which are not in M. Recall that for every v ∈ U , Sv is a split that separates v from all other vertices and its weight is at least (2 − ǫ)/k. Therefore, X (a,b)∈M w(S(a,b)) + X v∈U w(Sv) > 2(2 − ǫ) k M + (2 − ǫ) k U . We have U = V ′ − 2M = k − 2M. Therefore, X (a,b)∈M w(S(a,b)) + X v∈U w(Sv) > 2 − ǫ k (2M + U) = 2 − ǫ . (3) Every edge which is in the matching appears in one of these splits, and every other edge appears in two of them. Recall that the weight of the matching is at least ǫ. Therefore, X (a,b)∈M w(S(a,b)) + X v∈U w(Sv) ≤ 2w′(E′) − w′(M) ≤ 2 − ǫ , 7 which contradicts (3). Therefore, there exists an edge (a, b) in M such that the weight of S(a,b) is at most 2(2 − ǫ)/k. The separation degree of S(a,b) is at least 3. Therefore, the weight of a minimum 3-way split is at most 2(2 − ǫ)/k, and its density is at most (2 − ǫ)/k. This completes the proof for the case G is connected with ǫ = 1/(35β(G′)) which is a constant by Lemma 2.1. In case G is disconnected, we construct a graph G′ from G as follows: • Add all the edges in G to G′. • Create a new vertex u. • For each component in G, add an edge in G′ with the weight of ∞ from u to an arbitrary vertex in this component. This procedure produces a connected graph G′. Moreover, every k-way split in G is also a k-way split in G′, and minimum splits in G′ are also minimum splits in G since weight of the new edges are ∞, and they are not in any minimum split. Clearly all the newly added edges will be in the same component of G′ − Sk, and the graph obtained by contracting all the edges whose both ends are in the same component will remain H-minor-free. Let G′′ be this graph. Similarly, the theorem holds for ǫ = 1/(35β(G′′)). (cid:3) Now that we know there always exists a 3-way or a 2-way split of "acceptable" density, we show that the density of a split that algorithm picks in its second phase is also "acceptable". Recall that for a k > 4, the separation degree of the split that Algorithm 1 picks in its second phase is either 3 or 4. The following claim shows how the density of minimum splits changes if we increase their separation degree. Lemma 3.3. Given a connected normalized graph G = (V, E; w) with k vertices, δ ≥ 0 and h < k, let S be a h-way split such that densG(S) ≤ (1 + δ)/k. Then, the density of a minimum (h + 1)-way split is at most 1 + δ k + 1 − δ hk . Proof. Let G′ = (V, E′; w) be the graph obtained by removing all the edges in S from G. G′ has h connected components. Also, w(E′) = 1 − w(S). In the following claim we show that there is a 2-way split in G′ with the weight at most 2w(E′)/(k − h + 1). The proof of this claim can be found in the appendix. Claim 3.4. Let G = (V, E; w) be a graph with k vertices and h connected components where h < k, then there exists a 2-way split with the weight of at most 2w(E)/(k − h + 1). Let S′ be a minimum 2-way split in G′. By Claim 3.4, we have Let S′′ = S ∪ S′ be a (h + 1)-way split, then we have w(S′′) = w(S) + w(S′) ≤ w(S)(1 − k − h + 1 ) + 2 k − h + 1 . w(S′) ≤ 2w(E′) k − h + 1 . 2 The weight of S is w(S) = (h − 1) densG(S) ≤ (h − 1)(1 + δ)/k. Recall that h < k. Therefore, 1 − 2/(k − h + 1) ≥ 0, and we have w(S′′) ≤ (h − 1)(1 + δ) k (1 − 2 k − h + 1 ) + 2 k − h + 1 . 8 So, w(S′′) ≤ (h − 1)(1 + δ) k + Thus, the density of S′′ is at most 2 k − h + 1 (1 − (h − 1)(1 + δ) k ) . densG(S′′) = w(S′′) h ≤ (h − 1)(1 + δ) hk + 2 h(k − h + 1) (1 − (h − 1)(1 + δ) k ) . Therefore, densG(S′′) ≤ (h − 1)(1 + δ) hk + 2 h(k − h + 1) ( k − (h − 1)(1 + δ) k ) . Since k − h + 1 ≥ k − (h − 1)(1 + δ), we have densG(S′′) ≤ (h − 1)(1 + δ) hk + 2 hk = 1 + δ k + 1 − δ hk . (cid:3) Now we can prove that the density of minimum 3-way and minimum 4-way splits are also less than 2/k fraction of the optimal solution. Claim 3.5. Given an H-minor-free graph G and any k-way split Sk, the density of minimum 3 and 4-way splits in G are at most (2− ǫ/2)w(Sk )/k and (2− ǫ/3)w(Sk)/k respectively, if the separation degree of Sk is at least 3 and 4 respectively. Proof. As we discussed in the proof of Theorem 3.2, we can assume w.l.o.g. that G is connected. We contract all the edges which are not in Sk to get a new minor-free graph G′ = (V ′, E′, w′). The total weight of the edges in G′ is equal to the weight of Sk. W.l.o.g., we can assume that the graph G′ is normalized, i.e., w(Sk) = w′(E′) = 1. First, we prove our claim for a minimum 3-way split. By Theorem 3.2, there exists a split with a separation degree of at most 3 and density of at most (2 − ǫ)/k in G′. Let S be this split. If the separation degree of S is 3, then our claim is proved. Otherwise, we assume that the separation degree of S is 2. Setting δ = 1 − ǫ, by Lemma 3.3 the density of a minimum 3-way split is at most 1 + δ k + 1 − δ 2k = 2 − ǫ k + ǫ 2k = 2 − ǫ/2 k . Now we consider a minimum 4-way split. We know that there exists a 3-way split with a density of at most (2 − ǫ/2)/k. Setting δ = 1 − ǫ/2, and applying Lemma 3.3, it gives us that the density of a minimum 4-way split is at most 1 + δ k + 1 − δ 3k = 2 − ǫ/2 k + ǫ/2 3k = 2 − ǫ/3 k . (cid:3) Note that in the first phase of Algorithm 1, the algorithm considers the splits whose separation degree is at most 3, and picks the one with the lowest density. Thus, if the algorithm picks a split in its first phase, it is guaranteed that no split with a lower separation degree has a lower density. We call these splits, sparse. Specifically, we define sparse splits as below. Definition 3.6 (Sparse split). In a graph G = (V, E; w), an h-way split S is called sparse if for any h′ ≤ h and h′-way split S′, the following holds. densG(S) ≤ densG(S′) . 9 The following theorem shows that combining some low-density sparse splits, results in a low- density split. Theorem 3.7. Let G = (V, E; w) be a weighted graph, S be a k-way split in G, and a1, a2, . . . al be integers such that Pl i=1 ai < k. Let C1, C2, . . . , Cl be l splits where Ci is a minimum (ai + 1)-way split in Gi = G − Si−1 j=1 Cj. Let Si = S \ Si−1 j=1 Cj be a bi-way split in Gi for every 1 ≤ i ≤ l. Given a δ ≥ 0, suppose that for every Ci, we have densG(Ci) ≤ (1 + δ)w(Si) bi . Also, suppose that Ci is sparse in Gi for every i < l. Then, l densG( [ i=1 Ci) ≤ (1 + δ)w(S) k . Proof. We prove this theorem by the induction on l. When l = 1, the density of C1 is at most (1 + δ)w(S1)/k. Since S1 = S, the theorem holds. For the induction step suppose that l ≥ 2, and the theorem holds for any l − 1 splits. By induction hypothesis, for the last l − 1 splits we have l densG2( [ i=2 l Ci) = densG( [ i=2 Ci) ≤ (1 + δ)w(S2) b2 , since S2 is a b2-way split in G2. It implies that l w( [ i=2 Ci) ≤ (1 + δ)w(S2) b2 l X i=2 ai . Let S′ = S ∩ C1, and S′′ = C1 \ S′. Then, S′ is a (p + 1)-way split in G2 for some 0 ≤ p ≤ a1. Since C1 is a minimum (a1 + 1)-way split, S′′ is a (a1 − p + 1)-way split in G. Also, for the split S2, we have S2 = S \ S′. It follows that S2 is a b2-way split in G2 where b2 ≥ k − p. We prove the induction by considering two cases on p. • If p = 0, then b2 ≥ k and the separation degree of S2 is at least k. Therefore, w( l [ i=1 Ci) ≤ w(C1) + (1 + δ)w(S2) b2 l X i=2 ai (1 + δ)w(S) k a1 + (1 + δ)w(S2) k l X i=2 ai (1 + δ)w(S) k l X i=1 ai . ≤ ≤ l densG( [ i=1 Ci) = w(Sl Pl i=1 Ci) i=1 ai ≤ (1 + δ)w(S) k . It implies that This completes the induction step for this case. 10 • Otherwise, p ≥ 1, i.e., the separation degree of S′ = S ∩ C1 is at least 2. By sparsity of C1, we have densG(C1) ≤ densG(S′) ⇒ w(C1) a1 ≤ w(S′) p . Therefore, w(S′) ≥ w(C1) · p a1 . (4) It follows that the weight of the union of C1, C2, . . . , Cl is l w( [ i=1 Ci) ≤ w(C1) + (1 + δ)w(S2) b2 l X i=2 ai . Since S2 = S − S′, we have w(S2) = w(S) − w(S′). Therefore, (1 + δ)(w(S) − w(S′)) w( Ci) ≤ w(C1) + l [ i=1 b2 l X i=2 ai . By (4), we have w( l [ i=1 Ci) ≤ w(C1) + (1 + δ)(w(S) − w(C1) · p/a1) b2 l X i=2 ai . Let a = Pl Define the function g as i=1 ai. We claim that the weight of the split Sl i=1 Ci is at most a(1 + δ)w(S)/k. which is equal to Then, g(x) = x + (1 + δ)(w(S) − x · p/a1) b2 l X i=2 ai , g(x) = x + (1 + δ)(w(S) − x · p/a1)(a − a1) b2 . l w( [ i=1 Ci) ≤ g(w(C1)) . Since g is linear in x, it is sufficient to show that our claim holds for both ends of g. Note that 0 ≤ w(C1) ≤ a1(1 + δ)w(S)/k. ⋄ For g(0) we have g(0) = (1 + δ)w(S)(a − a1) b2 Since b2 ≥ k − p ≥ k − a1, we have g(0) ≤ (1 + δ)w(S)(a − a1) k − a1 . . It is easy to verify that (a − a1)/(k − a1) ≤ a/k for every a ≤ k. Therefore, which proves our claim. g(0) ≤ (1 + δ)w(S)a k , 11 ⋄ For g(a1(1 + δ)w(S)/k) we have g(a1(1 + δ)w(S)/k) = a1(1 + δ)w(S) k + (1 + δ)(w(S) − (1 + δ)w(S) · p/k)(a − a1) b2 = (1 + δ)w(S)( a1 k + (1 − (1 + δ) · p/k)(a − a1) b2 ) . Note that 1 + δ ≥ 1, therefore, g(a1(1 + δ)w(S)/k) ≤ (1 + δ)w(S)( = (1 + δ)w(S)( a1 k a1 k + + (1 − p/k)(a − a1) b2 ) ((k − p)/k)(a − a1) b2 ) . Also b2 ≥ k − p. Therefore, g(a1(1 + δ)w(S)/k) ≤ (1 + δ)w(S)( ≤ (1 + δ)w(S)( (1 + δ)w(S)a = k a1 k a1 k . + + ((k − p)/k)(a − a1) a − a1 k − p ) k ) Thus, w(Sl i=1 Ci) ≤ a(1 + δ)w(S)/k. It follows that densG(Sl i=1 Ci) ≤ (1 + δ)w(S)/k. We proved the induction step for both cases, and it completes the proof for our theorem. (cid:3) Finally we can establish the approximation guarantee of the greedy algorithm. Theorem 3.8. The approximation ratio of Algorithm 1 is 2 − ǫ/3 in minor-free graphs. Proof. weight of the split returned by the algorithm is the optimal solution. If k ≤ 4, the algorithm finds the minimum k-way split at its only step. Therefore, the Otherwise, we suppose that k > 4. Let SOPT be a minimum k-way split. The algorithm successively finds a split with the separation degree of at most 3 that has a minimum density. The only exception is the last split that it picks which is either a minimum 3 or a minimum 4-way split. Let C1, C2, . . . , Cl be the splits picked by the algorithm, Gi = G − Si−1 j=1 Cj, and Si = SOPT \ Si−1 j=1 Cj be a bi-way split in Gi. By Theorem 3.2, densG(Ci) ≤ (2− ǫ)w(Si)/bi for every i < l. Also by Claim 3.5, densG(Cl) ≤ (2 − ǫ/3)w(Sl)/bl. Also, all the splits C1, C2, . . . , Cl−1 are sparse. Let C = Sl i=1 Ci be the k-cut returned by the algorithm. It follows from Theorem 3.7 that Therefore, densG(C) ≤ (2 − ǫ/3)w(SOPT)/k . Corollary 3.9. The approximation ratio of Algorithm 1 is 1.9968... in planar graphs. w(C) ≤ (2 − ǫ/3)w(SOPT) . (cid:3) 12 Algorithm 2: PTAS for the k-cut Problem in Minor-free Graphs Data: An H-minor-free connected graph G, integer k, and ǫ > 0 1: C = ∅. 2: while separation degree of C is at most k − h(ǫ)(2 + 1/ǫ) do 3: 4: 5: Let G′ = G − C be the graph obtained by removing all the previous cuts from G. {Note that the separation degree of C is equal to the number of connected components in G′.} Let C ′ be a split in G′ whose density is minimum among all splits with the separation degree of at most h(ǫ). C = C ∪ C ′. 6: Let G′ = G − C be the graph obtained by removing all the previous cuts from G. 7: Let d be the separation degree of C. 8: Let C ′ be a minimum (k − d + 1)-way split in G′. 9: return C ∪ C ′. Proof. The ǫ derived from Theorem 3.2 is 1/(35β(G′)) where G′ is a minor of G. If G is a planar graph, then G′ is also planar. Therefore, β(G′) ≤ 3, and Theorem 3.2 holds for ǫ = 1/(35 · 3) = 1/105. Hence, the approximation ratio of Algorithm 1 in planar graphs is 2 − ǫ/3 = 2 − 1/315 which is 1.9968... . (cid:3) Putting together Theorem 3.8 with the bounds established for ǫ in this section yields Theo- rem 1.1: there exists a polynomial-time algorithm for k-cut whose approximation factor for minor- free graphs is a constant factor smaller than 2. The approximation guarantee is 1.9968... in planar graphs. 4 Polynomial Time Approximation Scheme In this section we generalize our method to derive a polynomial time approximation scheme (PTAS) for the k-cut problem in minor-free graphs. Recall that in the last section we showed that approximation ratio of a natural greedy algorithm which successively removes the lowest density split with the separation degree of at most 3 is less than 2. Our main observation for proving this bound was to show that there exists a split with the separation degree of at most 3 such that its density is at most (2 − ǫ)/k fraction of the weight of a minimum k-way cut. We generalize our method, and provide a PTAS for the k-cut problem in minor-free graphs. In this section we show that the density of minimum weighted splits converges to 1/k fraction of the weight of a minimum k-way cut if we consider splits with larger separation degrees. For an ǫ > 0, we first show that there exists a constant h(ǫ) such that there exists a split with the separation degree of at most h(ǫ) and the density of at most (1 + ǫ)OPT/k where OPT is the weight of the optimal solution. To this purpose, we use the separation theorem which shows that in every minor-free graph with n vertices, the removal of O(√n) vertices, can partition the graph into two parts such that each of them has at most 2n/3 vertices. Theorem 4.1 ([1], [26]). Let G be an H-minor-free graph with n vertices, then there exists a separator of size of at most c1√n such that c1 is a constant only depending on V (H), and removal of this separator partitions the graphs into two parts each of which has at most 2n/3 vertices. The following theorem, is our main observation to derive a PTAS for the k-cut problem. 13 Theorem 4.2. Given a minor H, and an ǫ > 0, there exists a constant h(ǫ) such that for any H-minor-free graph G = (V, E; w) and any k ≥ h(ǫ) and k-way split Sk in G, there exists a split with the separation degree of at most h(ǫ) and the density of at most (1 + ǫ)w(Sk)/k . Proof. As we discussed in the proof of Theorem 3.2, we can assume w.l.o.g. that G is connected. We contract all the edges which are not in Sk to get a new minor-free graph G′ = (V ′, E′; w′). The total weight of the edges in G′ is equal to the weight of Sk. W.l.o.g., we can assume that the graph G′ is normalized, i.e., w(Sk) = 1. The following lemma is directly derived from Theorem 4.1 which shows that for any δ > 0, there exists O(kδ) vertices such that removal of them partitions G′ into parts with the size at most 1/δ2. Lemma 4.3. For any H-minor-free graph G with n vertices, there exists a constant c2 such that for any δ > 0, there are c2nδ vertices such that removing them partitions the graph into parts with the size at most 1/δ2. Proof. The proof is almost alike to the proof of the similar lemma in [16]. We recursively find and remove the separator of Theorem 4.1 in each part until its size becomes at most 1/δ2. Let b(n) be the number of vertices removed in an H-minor-free graph with n vertices. The removal of the separator in Theorem 4.1 partitions the graph into two parts such that each of them has at least n/3 vertices. Let nα be the size of the first part, then the size of the other part is at most n(1− α). Therefore, we have b(n) ≤ c1√n + b(nα) + b(n(1 − α)) , where 1/3 ≤ α ≤ 2/3. Also, we have b(n) = 0 , for any n ≤ 1/δ2. It can be shown by induction that b(n) ≤ c2nδ − d√n , for some constants c2 and d. (cid:3) Note that G′ is H-minor-free. Therefore, there exists a constant c2 such that Lemma 4.3 holds for G′. Let δ = ǫ/(c2(1 + ǫ)), by Lemma 4.3, there is a separator of size at most c2kδ such that removing it partitions G′ into several parts, each with the size of at most 1/δ2. Let P1, P2,··· , Pl be these parts where Pi is the set of vertices in the part i. Let Pi = {vi,1, vi,2,··· }, and Ci be the split that separates each vertex in Pi from every other vertex in G′, i.e., Ci = ({vi,1},{vi,2},··· , V ′ \ Pi). Then, the separation degree of Ci is at least Pi + 1. We claim that the weight of at least one of Ci is at most Pi(1 + ǫ)/k. For the sake of the contradiction, suppose that the weight of every Ci is greater than Pi(1 + ǫ)/k. Note that every edge in the splits Ci, is either between two vertices in a same part, or between a vertex of the separator and another vertex. Therefore, each edge appears at most once in these splits. Thus, l X i=1 w′(Ci) ≤ 1 . (5) On the other hand, the weight of every Ci is greater than Pi(1 + ǫ)/k. Therefore, we have l X i=1 w′(Ci) > 1 + ǫ k l X i=1 Pi . 14 Since the size of the separator is at most c2kδ, we have l X i=1 w′(Ci) > 1 + ǫ k l X i=1 Pi 1 + ǫ k ≥ k(1 − c2δ) = (1 + ǫ)(1 − c2δ) . Substituting δ with ǫ/(c2(1 + ǫ)), gives us l X i=1 w′(Ci) > (1 + ǫ)(1 − c2δ) = (1 + ǫ)(1 − ǫ 1 + ǫ ) = 1 . (6) Inequality (5) contradicts (6). Therefore, for at least one of the Ci, its weight is at most Pi(1+ǫ)/k. Let Ci be a split with the weight of at most Pi(1 + ǫ)/k. The separation degree of Ci is at least Pi + 1. Therefore, the weight of a minimum (Pi + 1)-way split is at most Pi(1 + ǫ)/k, and its density is at most (1 + ǫ)/k. Since Pi is at most 1/δ2, the separation degree of this split is at most 1/δ2 + 1 which is a constant. Therefore, there exists a split with a separation degree of at most 1/δ2 + 1 and the density of at most (1 + ǫ)/k which proves the theorem. (cid:3) Based on our observation from Theorem 4.2, we modify Algorithm 1 as follows to derive a PTAS for the k-cut problem. Similar to our 2− ǫ algorithm, Algorithm 2 has two phases. In its first phase while the number of components in our graph is at most k − h(ǫ)(2 + 1/ǫ), it picks and removes a minimum density split with a separation degree of at most h(ǫ). In its second phase, if the current graph has d connected components, it finds and removes a minimum (k − d + 1)-way split. For a k ≤ h(ǫ)(2 + 1/ǫ), since the number of connected components in the original graph is 1 which is larger than k − h(ǫ)(2 + 1/ǫ), the algorithm skips the first phase, and finds a minimum k-way split at its only step. When k > h(ǫ)(2 + 1/ǫ), the algorithm repeatedly finds and removes a minimum density split with a separation degree of at most h(ǫ). Removing the edges of this split increases the number of connected components in our graph by at most h(ǫ) − 1 . Therefore, in this case the number of connected components at the end of the first phase of our algorithm is at most k − h(ǫ)(2 + 1/ǫ) + h(ǫ) − 1 ≤ k − h(ǫ)(1 + 1/ǫ) . It follows that the separation degree of a split picked by the second phase of the algorithm is between h(ǫ)(1 + 1/ǫ) + 1 and h(ǫ)(2 + 1/ǫ). Now, we show that the density of a minimum split with the separation degree of at least h(ǫ)(1 + 1/ǫ) is also small. Lemma 4.4. Given a minor-free graph G and integers s ≥ h(ǫ)(1 + 1/ǫ) and k ≥ s, let S be a minimum s-way split in G. Then, for any k-way split Sk, we have densG(S) ≤ (1 + 2ǫ)w(Sk) k . Proof. As we discussed in the proof of Theorem 3.2, we can assume w.l.o.g. that G is connected. We contract all the edges which are not in Sk to get a minor-free graph G′ = (V ′, E′; w′). The total weight of the edges in G′ is equal to the weight of Sk. W.l.o.g., we can assume that the graph G′ is normalized, i.e., w(Sk) = w′(E′) = 1. Now we want to remove some edges in G′ to increase its number of connected components by s − 1. While the number of components in G′ is at most s − h(ǫ), we find a split with the 15 separation degree of at most h(ǫ) that has the minimum density. Let C1, C2, . . . , Cl be these splits and (a1 + 1), (a2 + 1), . . . , (al + 1) be their separation degree respectively. Let G′ j=1 Cj for every Ci. It follows that G′ j=1 aj)-way split in G′ i = G′−Si−1 j=1 aj connected components and its edges is a (k−Pi−1 i. According to Theorem 4.2 we have i has Pi−1 densG′(Ci) ≤ (1 + ǫ)w′(G′ i) k − Pi−1 j=1 aj . Let C = Sl i=1 Ci, be a s′-way split for G′ where s′ = 1+Pl i=1 ai. Since the number of connected components in G′−C is greater than s−h(ǫ), we have s′ > s−h(ǫ). Therefore, s′ > s−h(ǫ) ≥ h(ǫ)/ǫ. Also, s − s′ < h(ǫ). By applying Theorem 3.7 to the splits C1, C2, . . . , Cl, we have densG′(C) ≤ (1 + ǫ)w′(G′) k = 1 + ǫ k . If s = s′, we have found a split with the density of at most (1 + ǫ)/k and proved the theorem. Otherwise, we can assume that s > s′. By setting δ = ǫ, Lemma 3.3 implies that the density of a minimum (s′ + 1)-way split is at most 1 + ǫ k + 1 − ǫ s′k < 1 + ǫ k + 1 s′k . Since s′ is larger than h(ǫ)/ǫ, the density of a minimum (s′ + 1)-way split is at most 1 + ǫ k + 1 s′k < 1 + ǫ k + ǫ h(ǫ)k = 1 + ǫ(1 + 1/h(ǫ)) k . Repeatedly applying Lemma 3.3 implies that for any a > 0, the density of a minimum (s′ + a)-way split is at most Therefore, the density of a minimum s-way split is at most 1 + ǫ(1 + a/h(ǫ)) k . 1 + ǫ(1 + (s − s′)/h(ǫ)) k < 1 + ǫ(1 + h(ǫ)/h(ǫ)) k = 1 + 2ǫ k . (cid:3) Now we are ready to prove that Algorithm 2 is a PTAS for the k-way cut in minor-free graphs. Theorem 4.5. Given an ǫ > 0, the approximation ratio of Algorithm 2 is 1 + 2ǫ in minor-free graphs. Proof. The analysis is very similar to the that of Theorem 3.8. If k ≤ h(ǫ)(2+ 1/ǫ), the algorithm finds the minimum k-way split at its only step. Therefore, the weight of the split returned by the algorithm is the optimal solution. Otherwise, we suppose that k > h(ǫ)(2 + 1/ǫ). Let SOPT be a minimum k-way split. The algorithm successively finds a split with the separation degree of at most h(ǫ) that has a minimum density. The only exception is the last split that it picks which its separation degree is at least h(ǫ)(1 + 1/ǫ). Let C1, C2, . . . , Cl be the splits picked by the algorithm, Gi = G − Si−1 j=1 Cj, and Si = SOPT \ Si−1 j=1 Cj be a bi-way split in Gi. By Theorem 4.2, densG(Ci) ≤ (1 + ǫ)w(Si)/bi for every i < l. Also 16 by Lemma 4.4, densG(Cl) ≤ (1 + 2ǫ)w(Sl)/bl. Also, all the splits C1, C2, . . . , Cl−1 are sparse. Let C = Sl i=1 Ci be the k-cut returned by the algorithm. It follows from Theorem 3.7 that Therefore, densG(C) ≤ (1 + 2ǫ)w(SOPT)/k . Theorem 4.5 establishes our second main result and proves Theorem 1.2. w(C) ≤ (1 + 2ǫ)w(SOPT) . (cid:3) References [1] Alon, N., Seymour, P., and Thomas, R. (1990). A separator theorem for graphs with an excluded In Proceedings of the twenty-second annual ACM symposium on minor and its applications. Theory of computing, pages 293 -- 299. ACM. [2] Bateni, M., Demaine, E. D., Hajiaghayi, M., and Marx, D. (2016). A ptas for planar group steiner tree via spanner bootstrapping and prize collecting. In Proceedings of the forty-eighth annual ACM symposium on Theory of Computing, pages 570 -- 583. ACM. [3] Bateni, M., Hajiaghayi, M., Klein, P. N., and Mathieu, C. (2012). A polynomial-time approxi- mation scheme for planar multiway cut. In Proceedings of the twenty-third annual ACM-SIAM symposium on Discrete Algorithms, pages 639 -- 655. Society for Industrial and Applied Mathe- matics. [4] Bateni, M., Hajiaghayi, M., and Marx, D. (2011). Approximation schemes for Steiner forest on planar graphs and graphs of bounded treewidth. Journal of the ACM (JACM), 58(5):21. [5] Borradaile, G., Klein, P. N., and Mathieu, C. (2009). A polynomial-time approximation scheme for Steiner tree in planar graphs. ACM Transactions on Algorithms, 5. Special Issue on SODA 2007. [6] Borradaile, G., Klein, P. N., and Mathieu, C. (2015). A polynomial-time approximation scheme for euclidean steiner forest. ACM Transactions on Algorithms (TALG), 11(3):19. [7] Borradaile, G., Le, H., and Wulff-Nilsen, C. (2017). Minor-free graphs have light spanners. In 2017 IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS), pages 767 -- 778. IEEE. [8] Byrka, J., Grandoni, F., Rothvoss, T., and Sanit`a, L. (2013). Steiner tree approximation via iterative randomized rounding. J. ACM, 60(1):6:1 -- 6:33. [9] Calinescu, G., Karloff, H., and Rabani, Y. (1998). An improved approximation algorithm for multiway cut. In Proceedings of the thirtieth annual ACM symposium on Theory of computing, pages 48 -- 52. ACM. [10] Chekuri, C., Guha, S., and Naor, J. (2006). The Steiner k-cut problem. SIAM Journal on Discrete Mathematics, 20(1):261 -- 271. 17 [11] Cohen-Addad, V., Klein, P. N., and Mathieu, C. (2016). Local search yields approximation schemes for k-means and k-median in euclidean and minor-free metrics. In IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS 2016, 9-11 October 2016, Hyatt Re- gency, New Brunswick, New Jersey, USA, pages 353 -- 364. [12] Cunningham, W. H. and Tang, L. (1999). Optimal 3-terminal cuts and linear programming. In IPCO, volume 9, pages 114 -- 125. Springer. [13] Dahlhaus, E., Johnson, D. S., Papadimitriou, C. H., Seymour, P. D., and Yannakakis, M. (1994). The complexity of multiterminal cuts. SIAM Journal on Computing, 23(4):864 -- 894. [14] Downey, R. G., Estivill-Castro, V., Fellows, M., Prieto, E., and Rosamund, F. A. (2003). Cutting up is hard to do: The parameterised complexity of k-cut and related problems. Electronic Notes in Theoretical Computer Science, 78:209 -- 222. [15] Eisenstat, D., Klein, P., and Mathieu, C. (2012). An efficient polynomial-time approximation In Proceedings of the twenty-third annual ACM- scheme for steiner forest in planar graphs. SIAM symposium on Discrete Algorithms, pages 626 -- 638. Society for Industrial and Applied Mathematics. [16] Federickson, G. N. (1987). Fast algorithms for shortest paths in planar graphs, with applica- tions. SIAM Journal on Computing, 16(6):1004 -- 1022. [17] Gilbert, E. N. and Pollak, H. O. (1968). Steiner minimal trees. SIAM Journal on Applied Mathematics, 16(1):1 -- 29. [18] Goldschmidt, O. and Hochbaum, D. S. (1994). A polynomial algorithm for the k-cut problem for fixed k. Mathematics of operations research, 19(1):24 -- 37. [19] Gupta, A., Lee, E., and Li, J. (2018). An fpt algorithm beating 2-approximation for k-cut. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '18, pages 2821 -- 2837, Philadelphia, PA, USA. Society for Industrial and Applied Mathematics. [20] Kamidoi, Y., Yoshida, N., and Nagamochi, H. (2006). A deterministic algorithm for finding all minimum k-way cuts. SIAM Journal on Computing, 36(5):1329 -- 1341. [21] Karger, D. R., Klein, P., Stein, C., Thorup, M., and Young, N. E. (2004). Rounding algorithms for a geometric embedding of minimum multiway cut. Mathematics of Operations Research, 29(3):436 -- 461. [22] Karger, D. R. and Stein, C. (1996). A new approach to the minimum cut problem. Journal of the ACM (JACM), 43(4):601 -- 640. [23] Karpinski, M. and Zelikovsky, A. (1997). New approximation algorithms for the Steiner tree problems. J. Comb. Optim., 1(1):47 -- 65. [24] Klein, P. N. (2006). A subset spanner for planar graphs: with application to subset TSP. In Proceedings of the thirty-eighth annual ACM symposium on Theory of computing, pages 749 -- 756. ACM. [25] Klein, P. N. (2008). A linear-time approximation scheme for TSP in undirected planar graphs with edge-weights. SIAM Journal on Computing, 37(6):1926 -- 1952. 18 [26] Lipton, R. J. and Tarjan, R. E. (1979). A separator theorem for planar graphs. SIAM Journal on Applied Mathematics, 36(2):177 -- 189. [27] Manurangsi, P. (2017). Inapproximability of maximum edge biclique, maximum balanced biclique and minimum k-cut from the small set expansion hypothesis. In LIPIcs-Leibniz Interna- tional Proceedings in Informatics, volume 80. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik. [28] Naor, J. S. and Rabani, Y. (2001). Tree packing and approximating k-cuts. In Proceedings of the Twelfth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '01, pages 26 -- 27, Philadelphia, PA, USA. Society for Industrial and Applied Mathematics. [29] Nishizeki, T. and Baybars, I. (1979). Lower bounds on the cardinality of the maximum match- ings of planar graphs. Discrete Mathematics, 28(3):255 -- 267. [30] Promel, H. J. and Steger, A. (2000). A new approximation algorithm for the Steiner tree problem with performance ratio 5/3. J. Algorithms, 36(1):89 -- 101. [31] Ravi, R. and Sinha, A. (2002). Approximating k-cuts via network strength. In Proceedings of the thirteenth annual ACM-SIAM symposium on Discrete algorithms, pages 621 -- 622. Society for Industrial and Applied Mathematics. [32] Robins, G. and Zelikovsky, A. (2005). Tighter bounds for graph Steiner tree approximation. SIAM J. Discrete Math., 19(1):122 -- 134. [33] Saran, H. and Vazirani, V. V. (1995). Finding k cuts within twice the optimal. SIAM Journal on Computing, 24(1):101 -- 108. [34] Thomason, A. (1984). An extremal function for contractions of graphs. Mathematical Pro- ceedings of the Cambridge Philosophical Society, 95(2):261 -- 265. [35] Thorup, M. (2008). Minimum k-way cuts via deterministic greedy tree packing. In Proceedings of the fortieth annual ACM symposium on Theory of computing, pages 159 -- 166. ACM. [36] Xiao, M. (2008). An improved divide-and-conquer algorithm for finding all minimum k-way cuts. Algorithms and Computation, pages 208 -- 219. [37] Xiao, M., Cai, L., and Yao, A. C.-C. (2011). Tight approximation ratio of a general greedy splitting algorithm for the minimum k-way cut problem. Algorithmica, 59(4):510 -- 520. [38] Zelikovsky, A. (1993). An 11/6-approximation algorithm for the network Steiner problem. Algorithmica, 9(5):463 -- 470. [39] Zhao, L., Nagamochi, H., and Ibaraki, T. (2001). Approximating the minimum k-way cut in a graph via minimum 3-way cuts. Journal of combinatorial optimization, 5(4):397 -- 410. 19 A Omitted proofs Lemma 2.1. For any H-minor-free graph G, we have β(G) ≤ (γ + o(1))V (H)plnV (H), where γ = 0.319... is an explicit constant. Proof. For a graph G, we use η(G) to denote the Hadwiger number of G which is the size of the largest complete graph that is a minor of G. Consider a complete graph H ′ with V (H) vertices. This graph has H as its minor, thus G does not have a minor H ′. Therefore, η(G) < V (H ′) = V (H). It is shown in [34] that for every graph G we have where γ = 0.319... is an explicit constant. This readily gives β(G) ≤ (γ + o(1))(η(G) + 1)pln(η(G) + 1) , β(G) ≤ (γ + o(1))V (H)plnV (H) . (cid:3) Lemma 2.2. Given a graph G and a parameter k, there exists a polynomial time algorithm that finds a minimum k-way split in G. Proof. We reduce the problem of finding a minimum k-way split to the minimum k-way cut problem. Let G be the graph that we want to find a minimum k-way split in it. If G is connected, then the k-way split and k-way cut problems are equivalent. Otherwise, we suppose that G is disconnected. We construct a graph G′ from G as follows: • Add all the edges in G to G′. • Create a new vertex u. • For each component in G, add an edge in G′ with the weight of ∞ from u to an arbitrary vertex in this component. This procedure produces a connected graph G′. Every k-way split in G is also a k-way split in G′, and minimum splits in G′ are also minimum splits in G since the weights of the new edges are ∞, and they are not in any minimum split. Therefore, the problem of finding a minimum k-way split in G is equivalent to finding a minimum k-way cut in G′. Goldschmidt and Hochbaum [18] showed that this problem can be solved in a polynomial-time for a fixed k. (cid:3) Claim 3.4. Let G = (V, E; w) be a graph with k vertices and h connected components where h < k, then there exists a 2-way split with the weight of at most 2w(E)/(k − h + 1). Let U be the set of isolated vertices in G. Since G has h connected components and Proof. h < k, we have U ≤ h − 1. For every vertex v ∈ V \ U , let Sv be a split that separates v from all other vertices, i.e., Sv = ({v}, V \ {v}). Because v is not isolated, the separation degree of Sv is at least 2. Considering all Sv splits, each edge appears in two of them. Thus, Therefore there exists a split Su such that its weight is at most Sv = 2w(E) . X v∈V \U . 2w(E) V \ U 20 Since U ≤ h − 1, w(Su) ≤ 2w(E) V \ U ≤ 2w(E) k − h + 1 . Therefore, the weight of a minimum 2-way split is at most 2w(E)/(k − h + 1). (cid:3) 21
1807.05311
1
1807
2018-07-14T00:17:10
A matching-based heuristic algorithm for school bus routing problems
[ "cs.DS" ]
School bus planning problem (SBPP) has drawn much research attention due to the huge costs of school transportation. In the literature, the SBPP is usually decomposed into the routing and scheduling subproblems due to its complexity. Because of the nature of the decomposition, even if all the subproblems are solved to optimality, the final solution may not be as good as the solution from the integrated model. In this paper, we present a new approach that incorporates the scheduling information (namely the trip compatibility) into the routing stage such that the interrelationship between the subproblems is still considered even in the decomposed problems. A novel two-step heuristic adopting the trip compatibility idea is presented to solve the school bus routing problem. The first step finds an initial solution using an iterative minimum cost matching-based insertion heuristic. Then, the initial trips are improved using a Simulated Annealing and Tabu Search hybrid method. Experiments were conducted on randomly generated problems and benchmark problems in the literature. The result shows that our two-step heuristic improves existing solutions up to 25% on the benchmark problems.
cs.DS
cs
A matching-based heuristic algorithm for school bus routing problems Ali Shafahi1, Zhongxiang Wang2*, Ali Haghani3 1Department of Computer Science, University of Maryland - College Park, MD 20742, Email: [email protected] 2*Department of Civil and Environmental Engineering, University of Maryland - College Park, MD 20742, Email: [email protected] (Corresponding author) 3Department of Civil and Environmental Engineering, University of Maryland - College Park, MD 20742. Phone: (301) 405-1963, Fax: (301) 405-2585. Email: [email protected] Abstract School bus planning problem (SBPP) has drawn much research attention due to the huge costs of school transportation. In the literature, the SBPP is usually decomposed into the routing and scheduling subproblems due to its complexity. Because of the nature of the decomposition, even if all the subproblems are solved to optimality, the final solution may not be as good as the solution from the integrated model. In this paper, we present a new approach that incorporates the scheduling information (namely the trip compatibility) into the routing stage such that the interrelationship between the subproblems is still considered even in the decomposed problems. A novel two-step heuristic adopting the trip compatibility idea is presented to solve the school bus routing problem. The first step finds an initial solution using an iterative minimum cost matching- based insertion heuristic. Then, the initial trips are improved using a Simulated Annealing and Tabu Search hybrid method. Experiments were conducted on randomly generated problems and benchmark problems in the literature. The result shows that our two-step heuristic improves existing solutions up to 25% on the benchmark problems. Keyword: transportation, routing, matching, simulated annealing 1 1. Introduction According to the National Center for Education Statistics, the U.S. spent over $23 billion on public student transportation in 2012-2013 this is about $914 per student (National Center for Education Statistics, 2016). Due to the vast amount of funds being invested in school transportation, improving operational efficiency even a little could result in huge savings. The primary objective of designing a school bus transportation system, from the operator's perspective, is to safely transport all students with minimum cost while satisfying constraints such as maximum ride time, vehicle capacity, and time window. This problem is formulated as a school bus planning problem (SBPP). Due to this importance, many studies have focused on improving the efficiency of school transportation plans. A school transportation plan consists of the routing plan and the scheduling plan. The routing plan is the joint of a set of trips where each trip starts from a school and sequentially visits a set of stops that are exclusive to that school. The scheduling plan is made of a set of routes where each route starts from the depot and sequentially serves a set of compatible trips. An ordered trip pair is compatible if a bus after finishing the preceding trip, has enough deadhead (travel time from the last stop in the preceding trip to the first stop of the successive trip) to reach the first stop of the successive trip before its service start time. The cost of a school transportation plan mainly includes the acquisition cost of a bus, bus driver employment cost, and operations cost (like gas, maintenance, etc.). The first two costs are fully determined by the number of buses used, and the last one highly depends on the total travel time/distance. Therefore, the objective of the SBPP is to minimize the weighted sum of the number of buses and the total travel time/distance. The former is of higher priority than the latter because the acquisition cost of a bus and bus driver employment can easily overwhelm the marginal cost of the travel distance increase. In this study, we develop a two-step heuristic algorithm for solving the school bus routing problem with the consideration of trip compatibility. The first step builds an initial set of trips using an insertion-based heuristic that adds stops to trips by iteratively solving minimum cost matching problems. The second step improves the initial trips by performing chain exchange guided by Simulated Annealing and Tabu Search. This fast heuristic algorithm can generate a set of trips to serve all stops for every single school. Given the trips for all schools, the multi-school bus scheduling can be solved as an assignment problem under the condition that the trip start times are known (Kim et al., 2012). Following this structure, the whole SBPP can be solved. Our solution approach is general and can be used for solving other variants of vehicle routing problems that include routing and scheduling such as dial-a-ride and pickup and drop-off and delivery problem with time window. We show the effectiveness of our proposed methodology on benchmark problems from the literature. The rest of the paper is structured as follows: In section 2, we review some of the literature regarding solution methods for solving school bus routing problem and related variants of vehicle routing problems along with the research gap and our contribution. In section 3, we present our solution algorithm. Section 4 analyzes the results and illustrates the performance of our proposed solution algorithm on randomly generated problems and benchmark problems. Finally, section 5 concludes the paper. 2. Literature Review As pointed by (Park and Kim, 2010), the majority of the school bus planning research decompose the SBPP into subproblems and only focus on one of the subproblems. While a few recent studies such as (Park et al., 2012) and (Bögl et al., 2014) formulated integrated mathematical models for the SBPP. However, due to the complexity of the models, they decomposed those 2 models into sub-problems during the solution process. A conceptual flowchart of routing and scheduling is shown in Figure 1 where bus stop selection and school bell times are assumed to be predetermined. 1.Bus stop location 2.School bell time Routing Surrogate objective Routing Plan Scheduling Schedule Plan Real objective Number of trips Number of buses Figure 1 Flowchart of routing and scheduling As discussed above, the primary objective of the SBPP is to minimize the number of buses used. However, due to the precedence of the routing step, this objective cannot be accounted for in the process of routing. As a consequence, a surrogate objective is required to solve the routing problem. Different surrogate objectives will lead to different routing plans, which will further result in different schedule plans. Traditionally, the surrogate objective for routing is to: 1) minimize the number of trips; or 2) minimize the total travel distance or the travel time (Schittekat et al., 2013; Faraj et al., 2014; Kinable et al., 2014); or 3) a mixture of 1 and 2 (Díaz-Parra et al., 2012; Caceres et al., 2017). Those surrogate objectives also serve as the evaluation criteria in many heuristics like the insertion cost estimation in trip construction algorithms and the exchange move goodness estimation in local search algorithms. Multi-school routing problems are often broken down into a group of single-school routing problems due to the problem size. For solving single-school routing problems, both exact and heuristic algorithms have been proposed and implemented. The exact approaches use mathematical modeling and commercial MIP solvers to solve the problem. They are applied to cases where the single school problem is small and has a limited number of students and stops. The modified assignment problem is one of the first exact approaches. Bektaş and Elmastaş (2007) duplicated the depots as dummy nodes and transformed the school bus routing problem into a graph problem of finding node-disjoint paths. The problem they solved had only 29 stops. Most studies, however, focus on solving larger size problems. Due to the complexity of the routing problem, these studies develop heuristic algorithms for solving the single school routing problem. A popular heuristic approach is to formulate the school bus routing problem as a set partitioning problem and solve it by a restricted column generation approach. This method was adopted by Braca et al. (1997), Riera-Ledesma and Salazar-González (2013) and Kinable et al. (2014). Some other widely used heuristics for solving the school routing problem or the vehicle routing problem in general are the Clarke and Wright saving method, insertion method (Christofides et al., 1979; Bramel and Simchi-levi, 1992; Braca et al., 1997; Corberán et al., 2002), sweep algorithm (Park et al., 2012), Simulated Annealing (SA) (Spada et al., 2015), Deterministic Annealing (Braekers et al., 2014), Tabu Search (TS) (Nanryand Barnes, 2000; Cordeau and Laporte, 2003; Fu et al., 2005; Spada et al., 2015; Pacheco and Martí, 2006; Paquette et al., 2013), Genetic Algorithm (GA) (Thangiah and Nygard, 1992; Prins, 2004; Díaz-Parra et al., 2012; Kang et al., 2015), Ant Colony (Yao et al., 2016) and GRASP (Schittekat et al., 2013; Faraj et al., 2014). GRASP (Greedy 3 Randomized Adaptive Search Procedure) can be considered as an improved version of the Clarke and Wright savings method. When building the greedy saving list, GRASP adds randomness to prevent the heuristic from getting stuck in a local optimum point. Schittekat et al. (2013) and Faraj et al. (2014) both adopted this algorithm. The basic idea of an insertion-based routing algorithm is to add (insert) stops to trips based on some insertion costs. The routing plans will be completed when all the stops are inserted into trips, and no stops remain. Insertion of stops to trips can be done either sequentially or in parallel. The sequential procedure builds one trip at a time while the parallel procedure builds multiple trips together. One example of the sequential procedure is the Location Based Heuristic proposed by Bramel and Simchi-levi (1992). Christofides et al. (1979) proposed a two-phase algorithm to apply sequential procedure followed by a parallel procedure. A similar stop-by-stop routing algorithm is the sweep algorithm, which sequentially inserts a stop based on its polar angle. It was adopted by Park et al. (2012) where at each stop insertion, a neighbor traveling salesman problem was solved, and 2-opt improvement procedure was applied to construct a good trip. They also developed benchmark problems which we use in this study. There are many other heuristic algorithms that apply local search post-improvement steps to improve the trips further. Sometimes these post improvement steps borrow ideas from insertion-based routing and modified swap algorithms. One example is from Corberán et al. (2002), which combined insertions and swaps to improve trips that were initially generated using an insertion-based heuristic. Some other solution algorithms perform the post-improvement step using well-known meta-heuristics such as Tabu Search, Simulated Annealing, Deterministic Annealing and Genetic Algorithm. All of them can guide the direction of local search and avoid getting stuck in local optima. Nanryand Barnes (2000), Cordeau and Laporte (2003), Fu et al. (2005), Pacheco and Martí (2006), and Paquette et al. (2013) applied the Tabu Search to solve school bus routing problem or other related vehicle routing problem like dial-a-ride problem or pickup and dropoff problem. Spada et al. (2005) adopted Simulated Annealing to maximize the level of service given a fixed number of available buses. Braekers et al. (2014) used Deterministic Annealing to solve a multi- depot heterogeneous dial-a-ride problem. Deterministic Annealing is a variant of Simulated Annealing, which accepts a neighbor solution if that solution only worsens the objective value within a threshold and this threshold decreases over time. The most common local search mechanisms include edge exchange and chain exchange. Edge exchange removes some edges from a trip and finds a better reconnection from other trips or sometimes itself. A famous example is a 2-opt algorithm, which can effectively eliminate crossing edges from a trip (Babin et al., 2007). Chain exchange moves vertices instead of edges. A famous chain exchange algorithm is Or-opt (Or 1976). Another approach for solving the routing problem is based on decomposition. It is usually done using clustering methods. Based on the time that clustering is applied, these families of algorithms can be classified into 1) Route First, Cluster Second (RFCS) or 2) Cluster First, Route Second (CFRS) algorithms. In the RFCS algorithm, initially, one long trip is constructed by finding a Hamiltonian cycle. This step is usually referred to as finding a 1-TSP1, and it is done by relaxing the capacity and maximum ride time constraints. In the next step, this trip is partitioned into several smaller trips which satisfy the capacity and maximum ride time constraints. One example of RFCS is Space Filling Curve with Optimal Partitioning from Bowerman et al. (1994). The Cluster First, Route Second (CFRS) algorithm first groups stops into different clusters while making sure the capacity constraints are not violated in each cluster. Then a 1-TSP is solved for each cluster. Some 1 1-TSP: Traveling Salesman Problem with one trip 4 local search steps are added if maximum ride time constraints are violated. CFRS was adopted by Bowerman et al. (1995) to solve urban school bus routing problem with multiple objectives. A new perspective of solving school bus routing problem was presented by Ellegood et al. (2015) using continuous approximation model. The model was tested in the Windsor School District, Missouri with 5 schools and 2301 bus riders. The result shows that the mixed-load plan can save 8.4% expected travel distance than the current operation. Matching algorithms have proven to be suitable for solving large size problems because they could be solved optimally in polynomial time using methods such as the Hungarian method with O(n3) (Munkres, 1957). They have been successfully applied to school transportation planning problems (Forbes et al., 1991; Wark and Holt, 1994; Harvey et al., 2006; and Shafahi et al., 2017a). One downside of the routing and scheduling decomposition strategy, which also exists in the algorithms that fall into this decomposition framework, is that the interrelationship between the subproblems is neglected. Due to the nature of decomposition, optimal trip plan of the routing stage, do not necessarily result in a good scheduling plan. To counter this deficiency, Shafahi et al. (2017b) and Wang et al. (2017) proposed to minimize the number of trips and total travel time while maximizing trip compatibility in the routing stage. Their strategy is shown to produce better routing plans and better scheduling plans. However, their method relied on solving a MIP problem using the branch and bound algorithms implemented in commercial solvers. They can only solve the single school problem with up to 30 stops. In reality, schools have much more stops. Since they did not have an efficient algorithm, their models were not able to solve real-world large-scale problems. In this paper, we develop an efficient heuristic algorithm to solve the school bus routing problem with the consideration of trip compatibility. This 'look ahead' strategy introduces the scheduling information (namely trip compatibility) into the routing stage. With the 'look ahead' information, our algorithm can construct better routing plan with more compatible trips, which will lead to a better scheduling plan using a fewer number of buses. The trip compatibility is considered in both the trip construction stage and the post-improvement stage. 3. Methodology We develop a novel Minimum Cost Matching with Post Improvement (MCMPI) algorithm solve the school bus routing problem with the homogeneous fleet. We assume that students from different schools cannot be assigned to the same trip (i.e., single-load). Furthermore, the school bus depot location, the number of students at each stop, and the school bell times are assumed to be predetermined. A detailed description of this solution algorithm is provided in the next subsection. For illustration purposes, we present our algorithm as an algorithm for afternoon trips in which the bus service start time equals to the school dismissal time, which makes it easier to illustrate the trip compatibility. However, due to symmetries, constructing morning trips is similar to constructing afternoon trips since either of them can be obtained merely by reversing the other one. MCMPI is decomposed into two parts: the minimum cost matching (MCM) trip generation algorithm and the post-improvement (PI) simulated annealing based algorithm. The basic procedure of MCM and PI are described in the next two subsections. 3.1. Minimum Cost Matching Trip Generation Algorithm The minimum cost matching (MCM) trip generation algorithm is an insertion-based routing algorithm where the stop insertion decisions are made by solving minimum cost matching problems. In a multi-school setting, we decompose the problem by school and solve each single- 5 school routing problem one at a time. The inputs to each single school problem are the stops and students of the school and the school dismissal times for all schools. The dismissal times for other schools are used to calculate the compatibility of trips. Since we are solving the problem one school at a time, we can reduce the problem size by considering trip-school compatibilities as opposed to trip-trip compatibilities. If a trip is compatible with another school, then this trip and a trip from the other school can be served by one bus. This compatibility is beneficial regarding reducing the number of buses. It introduced the scheduling information into the routing stage without explicitly solving the scheduling problem. The MCM routing can be either done sequentially or in parallel. The MCM pseudo-code is shown in Algorithm 1 where all notations are summarized in Table 1. A graphical example of MCM in illustrated in Figure 3. Variables 𝑀𝑄𝑖,𝑗 𝑀𝐶𝑖,𝑗 𝑀𝑇𝑖,𝑗 𝑥𝑠,𝑡 yi,j Table 1 Notations for minimum cost matching routing algorithm Description Remaining vehicle capacity of trip j after inserting stop i Trip compatibility criterion of trip j after inserting stop i The travel time of trip j after inserting stop i Binary variable, equals 1 if stop t is directly succeeding stop s one a trip; 0, otherwise, which is updated after the matching problems are solved. Binary variable, equals 1 if the insertion of stop i to trip j is selected; 0, otherwise. Due to the total unimodularity of the matching problem, yi,j can be relaxed to a non-negative continuous variable. Parameters Description Schools SBk Stops 𝑆𝑡𝑜𝑝𝑠𝑗 Nsch Nst MRT Cap N n R r 𝐼𝐶𝑖,𝑗 𝛼𝑄 𝛼𝐶 𝛼𝑇 𝑂𝑗 𝑙𝑖,𝑗 𝐷𝑠,𝑡 𝑃𝑇𝑘 𝐷𝑇𝑖 𝑞𝑖 Set of Schools School dismissal time for school k Set of stops for the school that we are solving the routing problem for A list of stops building trip j Number of schools Number of stops for the current school Maximum ride time Bus capacity Set of trips Number of trips (𝑁) Un-routed (un-assigned) stop set Number of un-routed stops (𝑅) Insertion cost of inserting stop i into trip j Coefficient of the remaining (waste) vehicle capacity in insertion cost Coefficient of trip compatibility in insertion cost The coefficient of travel time in insertion cost The school that trip j belongs to Last stop in trip j after inserting stop i The travel time between node s to t without a pickup and drop off time Student pickup time at school k Student drop-off time at stop i Number of students at stop i 6 Algorithm 1 MCM 1. initialize the number of trips (n) 2. cluster stops into n clusters [by k-means algorithm] 3. find the 'furthest' stop to the school in each cluster 4. initialize the trip set (N) and the un-routed (unassigned) stop set (R) 5. while 𝑅 ≠ ∅ do 5.1 construct the insertion cost matrix 5.2 solve the minimum cost matching problem 5.3 if (feasible insertion exists) then a. update N, R, n, r else b. initialize a new trip to N, update R, n, r 3.1.1. Initialization 𝑞𝑖 𝑖∈𝑆𝑡𝑜𝑝𝑠 Initialization refers to steps 1 – 4 of the MCM algorithm. The MCM algorithm starts with a predefined number of trips. This predefined number should not be set to a high value because the final number of trips of MCM would never go below this value. We experiment with a different initial number of trips. The highest number still should be the lower bound on the actual number of trips. Therefore, we select the value to be equal to ⌈∑ /𝐶𝑎𝑝⌉. The smallest value for the initial number of trips would be 1. For higher values of the initial number of trips, several trips will be initialized simultaneously, making the MCM process a parallel routing process. We call this the Parallel Minimum Cost Matching (PMCM) routing algorithm. On the other extreme case, if the initial number of trips is set to one, only one trip will be initialized, and the algorithm becomes the Sequential Minimum Cost Matching (SMCM) routing. Both PMCM and SMCM initialize trip sets by having the school stop as the first stop and adding a stop that is far from the school location. We set the first stop (second if we are also counting the school stop) to be the furthest stop from the school. The intuition behind this move is that those stops which are furthest away are more influential to the maximum ride time than the closer ones. We want to have trips that do not violate the maximum ride time constraints. So, we should first take care of these stops. When we have more than one initialized trip (PMCM), to prevent assigning stops that are close together but far from the school to different trips, we use a Cluster First, Assign Second scheme. The clustering step makes sure that the 'furthest' stops used for initialization are more scattered. For clustering the stops, we use pair-wise distance and the k-means algorithm from scikit-learn (Pedregosa et al. 2011) where k equals the number of initialized trips (n). Once the clustering is done, we assign the furthest stop in each cluster to each trip. 3.1.2. Trip construction and stop assignment This subsection refers to step 5 of the MCM algorithm. Once the trips are initialized, the remaining task is to insert the remaining (un-routed) stops into trips. To achieve this goal, we iteratively solve matching problems until all stops are inserted. During each matching round, we either insert remaining stop(s) to trips or add a new trip. Which case happens, depends on the whether the insertions are feasible. To solve the matching problem, we construct a hypothetical bi-partite graph. One set of the graph vertices represent the trips, and the other set represents the remaining stops. The weight between vertices 𝑖 and 𝑗 represents the costs associated with adding (inserting) stop 𝑖 to trip 𝑗. An illustration of the bipartite graph is shown in Figure 2 with five remaining stops and two trips. There are in total 10 possible assign (insertion) pairs. After solving 7 the matching problem, two pairs are selected (inserting stop 2 into trip 1 and inserting stop 7 into trip 2) such that the total cost is the minimum. After updating the insertion pairs, we are left with three remaining stops and two trips. Since only one insertion is feasible (inserting stop 1 into trip 1), only this insertion will be selected and updated. The algorithm will continue with two remaining stops and two trips. The costs/weights needed for solving the matching can be stored in a matrix that we call the insertion cost matrix. Section 3.1.2.1 explains in more detail how the costs are calculated. Section 3.1.2.2 explains how to find the best insertion by solving a matching problem under the satisfaction of the feasibility constraint. Un-routed stops Trips Un-routed stops Trips 1 2 4 6 7 r = 5 0 3 0 8 5 n = 2 Update 1 4 6 0 3 2 0 8 7 5 r = 3 n = 2 0 School 1 Bus stop 0 3 Trip Selected insertion Potential insertion Figure 2 Illustration of the bipartite graph for matching problem 3.1.2.1 Constructing the insertion cost matrix. A core task in minimum cost matching is constructing the 𝑟 × 𝑛 insertion cost matrix, which evaluates the cost of inserting a stop i from un-routed stop set R (of size 𝑟) into a trip j in trip set N (of size n). This construction is step 5-1 of the MCM algorithm. For PMCM, the insertion cost is a 𝑟 × 𝑛 matrix while in SMCM, it is a 𝑟 × 1 vector. The insertion cost (IC) depends on factors such as augmented travel time, the number of students (remaining bus capacity), and compatibility and they are defined in Equations (1)-(4). 𝑃𝑇𝑠 𝑠∈𝑆𝑡𝑜𝑝𝑠𝑗 𝑡∈𝑆𝑐ℎ𝑜𝑜𝑙𝑠 𝑠∈𝑆𝑡𝑜𝑝𝑠𝑗∪ 𝑖 ∑ 𝑠∈𝑆𝑡𝑜𝑝𝑠𝑗∪ 𝑖𝑠≠𝑡 𝑞𝑠 ∀𝑖 ∈ 𝑅, 𝑗 ∈ 𝑁 𝑥𝑠,𝑡𝐷𝑠,𝑡 + 𝐷𝑇𝑂𝑗 + ∑ 1{𝑆𝐵𝑂𝑗 + 𝑀𝑇𝑖,𝑗 + 𝐷𝑙𝑖,𝑗,𝑡 ≤ 𝑆𝐵𝑡} (1) (2) ∀𝑖 ∈ 𝑅, 𝑗 ∈ 𝑁(3) 𝐼𝐶𝑖,𝑗 = 𝛼𝑄𝑀𝑄𝑖,𝑗 + 𝛼𝐶𝑀𝐶𝑖,𝑗 + 𝛼𝑇𝑀𝑇𝑖,𝑗 ∀𝑖 ∈ 𝑅, 𝑗 ∈ 𝑁 𝑀𝑄𝑖,𝑗 = 𝐶𝑎𝑝 − ∑ 𝑀𝑇𝑖,𝑗 = ∑ 𝑠∈𝑆𝑡𝑜𝑝𝑠𝑗∪ 𝑖 𝑀𝐶𝑖,𝑗 = 𝑁𝑠𝑐ℎ − ∑ The insertion cost between a stop and a trip is a weighted average of three factors, namely remaining bus capacity, trip compatibility to all other schools and the travel time. The remaining bus capacity defined in Equation (2) is the bus capacity minus the sum of students in the stops in trip j and stop i. The intuition behind this factor is that we prefer to assign a stop to a trip if this assignment helps in filling up the trip (bus). The travel time is the sum of travel time between the nodes (stops and the school) and the student pickup and drop-off times at the school and the stops. The intuition is that we would like to have short trips because of the savings in travel time and the fact that shorter trips could contribute to compatibility. The pickup and drop-off times, 𝑃𝑇𝑠, 𝐷𝑇𝑠, used in Equation (3) are calculated based on regression analysis. We use the results from Braca et al. (1997). ∀𝑖 ∈ 𝑅, 𝑗 ∈ 𝑁 (4) 8 To account for the trip-to-school compatibility, we use an indicator function (1{𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛}) in Equation (4), which equals one if the condition is true and zero otherwise. Since we are minimizing the insertion cost, in Equation (4), the trip compatibility criterion is the total number of schools minus the schools that trip j is compatible with after inserting stop i. This is the first consideration of compatibility in a fast heuristic algorithm. Clearly, the last stop of a trip and the travel time of the trip (defined in Equation (3)) will both affect the compatibility of the trip to other schools. And both the last stop and the travel time depend on the insertion location of a stop in that trip. In this paper, in order to calculate these costs, we augment the trips by inserting the stop in a position of the trip where the travel time of the augmented trip would be minimized. Some constraints like conservation of flow and sub-tour eliminations are not listed because they are implicitly guaranteed when the trips are generated under the insertion-based procedure. We explicitly try to enforce that other constraints such as the maximum ride time and capacity constraints do not get violated by adding a huge violation penalty to the weight between a stop and a trip if the addition of that stop would cause the trip to violate those conditions. 3.1.2.1 Solving the minimum cost matching problem and maintaining feasibility The formulation of the minimum cost perfect matching problem is shown in Equations (5) – (8) with the insertion cost (𝐼𝐶𝑖,𝑗) calculated using Equation (1). For the cases when 𝑟 ≠ 𝑛, we can add dummy stops or trips when needed to make it a perfect matching problem. 𝐼𝐶𝑖,𝑗 ∙ 𝑦𝑖,𝑗 𝑗∈𝑁 Min ∑ ∑ i∈R Subject to ∑ 𝑦𝑖,𝑗 ∑ 𝑦𝑖,𝑗 yi,j ≥ 0, ∀𝑖 ∈ 𝑅, 𝑗 ∈ 𝑁 i∈R j∈N = 1, ∀j ∈ N + 𝐷𝑢𝑚𝑚𝑦𝑇𝑟𝑖𝑝𝑠 = 1, ∀𝑖 ∈ 𝑅 + 𝐷𝑢𝑚𝑚𝑦𝑆𝑡𝑜𝑝𝑠 (5) (6) (7) (8) Objective (5) is to minimize the total sum of the insertion cost. Constraints (6) and (7) are enforcing that exactly one insertion happens for each pair of stop and trip. If an insertion involves the dummy stops or trips, it will be discarded. We use the Hungarian (Munkres) algorithm to solve the minimum cost matching problem. For PMCM, the minimum cost matching problem is to find m assignments of stops to trips such that the total insertion cost is minimized where m≤min(r, n) (before adding the dummy stop or trip). Each matching (assignment) indicates the insertion of one stop to one specific trip. All the stops and trips in these m matches are distinguished. If these matches are feasible, the stops will be inserted into their corresponding trips. The trip set will be updated by these inserted trips, and these routed stops will be removed from the un-routed stop set. This previous step is step 5.2 in the MCM algorithm. The feasibility check (step 5.3 in the MCM algorithm) involves the vehicle capacity and maximum ride time constraints. An insertion is feasible only if both constraints are satisfied. For SMCM, only one stop with the minimum insertion cost will be inserted into the current trip being constructed. At the point when no feasible insertions exist for both PMCM and SMCM, a new trip is initialized by connecting the school to the furthest stop in the un-routed stop set. In PMCM, if all min(r, n) matches are feasible, all of these stops will be inserted simultaneously at one iteration compared to one-stop insertion per iteration for SMCM. Theoretically, PMCM could be faster than SMCM because it could be implemented in distributed settings and run in parallel. On the other hand, we experimentally show that there is no general rule to compare the solution quality of the sequential and parallel routing algorithms. In a not time-dependent application, it is desired to perform both PMCM and SMCM 9 algorithms and select the one with the best solution. These sensitivity analyses are performed in section 4.1 and 4.2. 3.1.3. Example A simple graphical example of PMCM with one school and 11 stops is shown in Figure 3. Assuming the initial number of trips equal to 3, in Figure 3 (a), stops are clustered into three clusters. Then, the furthest stops are selected for each cluster in Figure 3 (b). The trip set is initialized by adding the school stops and these furthest stops in Figure 3 (c). In Figure 3 (d), a minimum cost matching problem is solved, and three feasible matches are obtained. These three stops are inserted into their corresponding trips in Figure 3 (e). At Figure 3 (f), since no feasible insertion exists, a new trip (Trip 4) is initialized, and the algorithm continues. (a) (b) (c) (d) (e) (f) School Un-routed stop Routed stop/selected stop at each step Figure 3 Graphical example of minimum cost matching routing algorithm 10 3.2. Post-Improvement Algorithm The post-improvement (PI) algorithm is applied to the initial solution generated by the minimum cost matching (MCM) routing algorithm. It is a combination of Tabu Search, Simulated Annealing, and the chain exchange algorithm. The generic pseudo-code is shown in Algorithm 2 with notations from both Table 1 and Table 2. Table 2 Notation for post improvement algorithm Description Temperature Terminal temperature Temperature cooling rate Number of iteration that no changes occur Maximum number of iterations that no changes occur Trip set Tabu list Cost of remove for stop p Number of stops in the trip to which stop p belongs Travel time for the trip to which stop p belongs The closeness of stop s with respect to stop p Number of students for the trip to which stop s belongs Trip compatibility of the trip to which stop s belongs Random variables The coefficient of the number of stops in 'cost of remove' The coefficient of the travel time in 'cost of remove' and 'closeness' The coefficient of the number of students in 'closeness' The coefficient of the distance in 'closeness' Vertex exchange list Neighborhood list Maximum number of stops in the neighborhood list Move stop p to the place right after stop pl where p and pl belongs to different trips Surrogate cost of a routing plan Number of trips in a routing plan Trip compatibility of a routing plan The total travel time of a routing plan The coefficient of the number of trips in surrogate cost Coefficient of trip compatibility in surrogate cost The coefficient of total travel time in surrogate cost Notation t 𝑡𝑒𝑛𝑑 𝑡𝑐𝑜𝑜𝑙 it 𝑖𝑡𝑚𝑎𝑥 N TL 𝐶𝑅𝑝 𝐼𝑆𝑝 𝐼𝑇𝑝 𝐼𝑃𝑠,𝑝 𝐼𝑄𝑠 𝐼𝐶𝑠 𝜖 𝛽𝑠 𝛽𝑇 𝛽𝑄 𝛽𝐷 EL NL Nnei move(pl,p) SC TN TC TT 𝛾𝑁 𝛾𝐶 𝛾𝑇 There are two control variables in PI, the temperature t and number of iterations with no changes (it). These two control variables determine whether PI will perform local search (vertex exchange) or accept the current solution and terminate. The local search will be activated only if both of the following conditions are met: 1) temperature t is greater than or equal to the terminal temperature (𝑡𝑒𝑛𝑑) and 2) that the number of iterations with no changes (it) is less than or equal to 𝑖𝑡𝑚𝑎𝑥. 11 Algorithm 2 PI 1. Solve the SBS using the initial routing plan, store as initial scheduling plan (ISP) 2. Initialize t, it, N, TL 3. while (t ≥ tend and it ≤ itmax) do 3.1 construct vertex exchange list (EL) 3.2 for (p in EL) do 3.2.1 construct neighborhood list (NL[p]) of stop p 3.2.2 for (pl in NL[p]) do A. If (move(pl,p) is feasible) then B. If (move(p,pl) is not in the Tabu list) then C. If (move(pl,p) is acceptable at t) then D. Implement move(pl,p), update N, TL, it = 0, Break; 3.3 it += 1; t = t* t_cool 4. Solve the SBS using the new routing plan, store as new scheduling plan (NSP) 5. If (Number of buses of NSP < number of buses of ISP) then 5.1 Return NSP Else 5.2 Return ISP 3.2.1. Vertex exchange list The underlying mechanism for the vertex exchange operator is that when moving some stops from short trips to long trips, some short trips will become empty and then are deleted. As a result, the trip set will be reduced, and the route scheduling problem is more likely to come up with a solution with fewer buses. More accurately, other attributes like travel time and trip compatibility also contribute to the 'goodness' of a routing plan. The complete surrogate cost to evaluate the 'goodness' of a move will be discussed in section 3.2.3. The vertex exchange operator starts with constructing the vertex exchange list based on their 'cost of removal' as defined in Equation (9): 𝐶𝑅𝑝 = 𝛽𝑠𝐼𝑆𝑝 + 𝛽𝑇𝐼𝑇𝑝 + 𝜖 (9) where 𝐼𝑆𝑝, 𝐼𝑇𝑝 are the number of stops and travel time of the trip to which stop p belongs, and 𝛽𝑠, 𝛽𝑇 are the associated coefficients. The travel time is calculated the same way as in Equation (3) and it includes the pickup and drop-off time. The 'cost of removal' of a stop describes some measure of the negative likelihood of reaching a better routing plan after removing this stop. The vertex exchange list is the set of all stops arranged in the increasing order of their 'cost of removal'. The PI algorithm will try to move a stop in vertex exchange list sequentially to its neighbors such that some short trips will become empty and deleted. It is desired to first move the stops belonging to shorter trips (with respect to the number of stops and travel time). The short trips after removing these stops are more likely to be deleted. In this way, the total number of trips will likely decrease and the number of buses in the scheduling stage is more likely to be reduced. Because all the stops in the same trip will have the same number of stops and travel time, 𝜖 is used to introduce some randomness to help to determine the sequence of these stops in the exchange list. 3.2.2. Neighborhood list For each stop p in the vertex exchange list, its neighborhood list (NL) contains the stops 12 that are close to stop p such that stop p has a higher probability to be inserted after them. The stops in the neighborhood list are sorted in the ascending order of the 'closeness' (IP) as follows: (10) 𝐼𝑃𝑠,𝑝 = 𝛽𝑄𝐼𝑄𝑠 + 𝛽𝑇𝐼𝑇𝑠 + 𝛽𝐷𝐷𝑠,𝑝 ∀𝑠 ∈ 𝑆𝑡𝑜𝑝𝑠\𝑆𝑡𝑜𝑝𝑠𝑝 where 𝐼𝑄𝑠, 𝐼𝑇𝑠, 𝐷𝑠,𝑝 are the number of students, the travel time of the trip to which stop s belongs, and the distance between stop s and p, and 𝛽𝑄, 𝛽𝐷, 𝛽𝑇 are the associated coefficients. Equation (10) states that stop p a has a higher probability to be inserted after a stop s which is close to stop p and belongs to the trip that has few students and has a short travel time. It is inefficient to check the feasibility of every pair of vertex move and it is undesirable to insert stop s into a faraway trip even if it is feasible. Therefore, the size of the neighborhood is limited by Nnei (<Nst) and all the stops in the neighborhood will be examined sequentially until one move is feasible and acceptable or until we reach the end of the list. The neighborhood does not contain the stops that are in the same trip with stop p since the main goal of the vertex exchange is to move stop p to another trip such that the old trip of stop p might be deleted. For each stop pl in the neighborhood list (NL) of stop p, PI checks whether move (p, pl) is in the Tabu list and that whether move (pl, p) is feasible. The feasibility check consists of the maximum ride time and vehicle capacity constraints. PI only considers the feasible move of which its reversed move is not accepted before. This idea is from Tabu Search and implemented to avoid frequent reversed moves. In the PI algorithm, the acceptance of a move is based on the Simulated Annealing criteria where a move is still acceptable even if it yields a worse cost function. It means that move (pl, p) and move (p, pl) may be both acceptable. One consequence is that once a move is removed from TL, it is very likely to be implemented again even if it yields a worse cost function. Hence, the maximum forbidden iteration should be large enough to prevent the frequent removal of forbidden moves. 3.2.3. Surrogate cost As explained in the introduction, the real estimate of the goodness of a routing plan is the number of buses used after solving a route scheduling problem, which is unknown during trip generating stage. The surrogate cost (SC) is used to assess the goodness of the routing plan and the goodness of a move without solving route scheduling problem. We adopt the proposed surrogate cost function from Shafahi et al. (2017b). This is presented in Equation (11): 𝑆𝐶 = 𝛾𝑁𝑇𝑁 − 𝛾𝐶𝑇𝐶 + 𝛾𝑇𝑇𝑇 (11) where 𝑇𝑁, 𝑇𝐶, 𝑇𝑇 are the total number of trips, trip compatibilities and travel time of a routing plan with coefficients 𝛾𝑁, 𝛾𝐶, 𝛾𝑇 . Total trip compatibility is the sum of trip-to-trip compatibility which is similar to Equation (4) except that the trip-to-school compatibility is replaced by trip-to-trip compatibility. The total travel time is the sum of the travel time and the pickup and drop-off time as calculated in Equation (3). The surrogate cost implies that a routing plan is a good one if the number of trips and total travel time is small while the trip compatibility is as large as possible. This is the instance that trip-compatibility appears in our proposed heuristic algorithm. Still, Equation (11) is just a surrogate estimate of the goodness of a routing plan, it is possible that a routing plan with smaller SC needs more buses than another one with higher SC. PI adopts the acceptance criterion from Simulated Annealing in Equation (12) to help to jump local optima by introducing some randomness. 13 𝑃(𝑎𝑐𝑐𝑒𝑝𝑡 𝑎 𝑚𝑜𝑣𝑒) = 1/(1 + e(𝑆𝐶𝑛𝑒𝑤−𝑆𝐶𝑜𝑙𝑑)/𝑡 ) (12) Equation (12) ensures that when the new surrogate cost after a move is smaller than the old one (which is preferred), this move will be accepted. On the other hand, if the new surrogate cost is larger than the old one (which is undesired), the probability of accepting this move is small if the difference between two surrogate costs is large and the temperature is small. PI will be iteratively implemented until either the maximum number of iterations without change reaches or the temperature drops below the terminal temperature. 3.2.4. Example An illustrative example of PI is presented in Figure 4. Assume that at the current iteration, the parameters are 𝑡 = 10, 𝑖𝑡 = 2, 𝑇𝐿 = {(1,4)}. There are three trips connecting five stops for school a. In Figure 4 (a), PI first constructs the vertex exchange list (EL) as {5,3,1,4,2}. For the first stop (5) in the NL, find its neighborhood list NL[5]={4, 2, 1} with 𝑁𝑛𝑒𝑖 = 3. Starting from the first move(4,5), it satisfies all conditions (A: feasibility, B: its reverse mode is not in the Tabu list, C: it is acceptable given the surrogate cost estimate). Then stop 5 is removed from trip 3 to the position right after stop 4 in trip 2. Trip 3 becomes empty and is deleted while trip 2 is augmented to {3,4,5}. This iteration is terminated, and control parameters are updated: 𝑡 = 10 × 0.9 = 9; 𝑖𝑡 = 0; 𝑇𝐿 = {(1,4), (4,5)}. Note that in this iteration, one stop is moved, and one trip is deleted, the it (number of iterations that no change occurs) count is reset to zero. Trip 1 Trip 2 Trip 1 Trip 2' Trip 3 (a) 1. 𝑡 = 10, 𝑖𝑡 = 2, 𝑇𝐿 = {(1,4)} 2. While 𝑡 ≥ 𝑡𝑒𝑛𝑑 𝑎𝑛𝑑 𝑖𝑡 ≤ 𝑖𝑡𝑚𝑎𝑥 do 2.1 EL = {5, 3, 1, 4, 2} 2.2 for (5 in EL) do 2.2.1 NL[5] = {4, 2, 1} 2.2.2 for (4 in NL[5]) do (b) move(4,5) satisfies conditions (A, B, C) Implement move(4,5), update TP; 𝑇𝐿 = {(1,4), (4,5)};Break; 2.3 𝑡 = 10 × 0.9 = 9; 𝑖𝑡 = 0 1. 𝑡 = 9, 𝑖𝑡 = 0, 𝑇𝐿 = {(1,4), (4,5)} 2. While 𝑡 ≥ 𝑡𝑒𝑛𝑑𝑎𝑛𝑑 𝑖𝑡 ≤ 𝑖𝑡𝑚𝑎𝑥 do 2.1 EL = {1, 2, 3, 4, 5} 2.2 for (1 in EL) do 2.2.1 NL[1] = {3, 4, 5} C. move(3,1) is not acceptable at temp B. move(1,4) is in in the TL A. move(5,1) is infeasible for (2,3,4,5 in EL), no move is accepted 2.3 𝑡𝑒𝑚𝑝 = 9 × 0.9 = 8.1; 𝑖𝑡𝑒𝑟 = 1 (a) (b) School a 1 Bus stop Trip Figure 4 Illustration of Post Improvement Algorithm 14 At the next iteration, PI re-constructs the vertex exchange list (EL) as {1, 2, 3, 4, 5}. For the first stop, 1, PI finds its neighborhood list NP[1]={3,4,5}. PI finds none of the moves between stop 1 and stops 3, 4, and 5 is feasible or acceptable. PI then tries to remove stop 2. The process is repeated, and no move is accepted for stop 2, 3, 4, and 5. This iteration terminates without any change. The temperature cools down, and iteration count is incremented by one (𝑡 = 9 × 0.9 = 8.1; 𝑖𝑡 = 1). PI continues for the next iteration. Notice that due to the randomness of constructing vertex exchange list and the randomness of accepting criterion, some unacceptable moves might become acceptable at different iterations. Therefore, it is worthy to continue the search even if no change occurs at one iteration. 4. Computational Results We conduct different experiments. First, we conduct experiments on randomly generated examples to compare the solution quality and efficiency of the proposed MCMP heuristic with the exact method and to compare the performance of the Sequential Minimum Cost Matching routing (SMCM) with the Parallel Minimum Cost Matching routing (PMCM). Then, a preliminary experiment and a sensitivity analysis experiment are conducted on a benchmark problem. In the end, we use PMCM to solve all the benchmark problems from Park et al. (2012). We compare the state-of-the-art solutions on the benchmark problems with the solutions from our PMCM (number of buses) algorithm both with and without the post-improvement step under the best meta- parameter settings obtained from the sensitivity analysis study. As mentioned before, routing is only a part of the school bus planning problem; the main criterion is the number of buses obtained from solving the scheduling problem. In all the following experiments, after generating routing plans from different algorithms, all the routing plans were treated as the input for the scheduling problem. The scheduling problems were solved using Kim et al. (2012)'s formulation, which was an assignment problem under the assumption of the homogeneous fleet and fixed trip start times. The number of buses (NB) is the main criterion used to evaluate the goodness of a routing plan. Thanks to the optimality of the scheduling problems, the number of buses outputted by solving the scheduling problem is an accurate and fair criterion for the different routing plans. The MCM and PI algorithms were implemented in Python 2.7., after setting up the problem as a minimum cost matching problem, the minimum cost matching problem was solved using SciPy optimization tool, and the scheduling problem was solved using Gurobi. All the experiments were run on a computer with i7 CPU 870 @ 2.93 GHz and 8GB RAM. 4.1. Randomly generated problems 4.1.1. Random problem data generation A set of test problems were randomly generated with various sizes of schools and stops. For each test problem, all nodes (including stops and schools) were assumed to be located within a 2-dimensional square with the length of 40 miles (211,200 ft). The locations of all nodes are designated using their longitude and latitude, which were both randomly generated as a uniformly distributed random variable between 0 and 211220. Then, we applied the K-means algorithm with the number of clusters equal to the number of schools and found the centroid of each cluster. The closest node to each cluster centroid was selected to be the school location, and the rest of the nodes were treated as bus stops and were assigned to their closest school. The number of students at each stop was randomly generated as a uniformly distributed random variable between 1 and 20. The bus capacity was assumed to be 66 and the maximum ride time was assumed to be 90 minutes. The bell times for the schools are random uniform variable between 12:00 PM and 16:00 PM and 15 they are integer multiple of 15 minutes (i.e., 2:00 PM, 3:15 PM). The distance is Euclidean. The bus runs at a constant speed of 20 miles per hour. The parameters were set to be 𝛼𝑄 = 𝛼𝐶 = 𝛼𝑇 = 1 for both SMCM and PMCM. Pickup (Equation (24)) and drop off (Equation (25)) time came from the regression model developed by Braca et al. (1997). PTk = 29.0 + 1.9ns, ∀𝑘 ∈ 𝑆𝑐ℎ𝑜𝑜𝑙𝑠 DTi = 19.0 + 2.6𝑞𝑖, ∀i ∈ Stops where PTk, DTi are the pickup and drop off durations at schools and stops in seconds, and 𝑛𝑠, 𝑞𝑠 are the number of student at the schools and the stops. Note that the original regression from Braca et al. (1997) was for the morning trips where students were picked up from stops and dropped off at schools. In our afternoon trip setting, we consider the pickup time from stops to be similar to the drop-off time at stops and the drop-off time at the school equal to the pickup time from schools. 4.1.2. Running time of SMCM and PMCM and exact method (24) (25) The first experiment sheds light on the necessity of fast heuristic to solve single-school bus routing problems. This experiment tests how the running time of the exact method and MCM would increase in response to the increase of the problem size. In this experiment, the number of schools is set to two and the number of stops increases from 20 to 60. The approaches used are: 1) EXA: Directly solve the single school routing problem (from Shafahi et al., 2017b) to optimality by commercial solver; 2) SMCM: Solve the single school routing problem by sequential minimum cost matching algorithm without post improvement; 3) PMCM: Solve the single school routing problem by parallel minimum cost matching algorithm without post improvement. To obtain NB, the scheduling problem is solved given the routing plans generated by these methods. The result is shown in Table 3 and Figure 5. In small cases (scenario 1, 3 and 4), both SMCM and PMCM can find solutions as good as the exact method (with respect to the number of buses) in much shorter time (as low as 0.16% in scenario 4). The difference arises when the problem size gets bigger. The EXA can find solutions using a fewer number of buses than the PMCM and SMCM at the expense of huge running time (scenario 5 and 7). The difference between the SMCM and PMCM is also observed. Out of eight scenarios, the SMCM finds the solutions using the same number of buses as the EXA in five scenarios where the PMCM only has four. Still, the solutions from the PMCM and SMCM are both quite good. The SMCM can find solutions using at most one more buses than the exact method, and the PMCM only uses at most two more buses. The total travel time from the PMCM and SMCM is higher than the EXA. But the travel time is much less important than the number of buses. Such difference can be ignored in large scenarios where the exact method is nearly unsolvable. The running time of the exact method becomes a critical problem with the increase of the problem size. The running time for heuristic barely increases with the increase of the problem size. But the running time for the exact methods increases exponentially. With such exponential trend, the problem can easily become unsolvable using exact methods in fact, if the number of stops is increased to 100, even for this still small size 16 problem, the exact method cannot find the optimal solution within 5 days. This showcases the necessity of fast heuristics for solving large single-school problems. Scenario # of schools # of stops EXA PMCM SMCM NB NT TT RT NB NT TT RT NB NT TT RT Table 3 Solution summary for exact method, PMCM and SMCM 1 2 20 4* 4 313 2.36 4* 4 446 0.07 4* 4 443 0.13 2 2 24 2* 5 327 4.60 3 5 468 0.10 3 5 488 1.45 3 2 28 3* 5 375 155 3* 5 474 0.68 3* 5 566 1.84 4 2 32 4* 6 393 191 4* 6 535 0.61 4* 6 560 0.30 5 2 36 3* 6 433 143 5 6 618 0.11 4 7 660 0.26 6 2 40 4* 8 540 610 5 9 724 0.50 4* 8 763 0.48 7 2 50 5* 8 488 1654 7 8 762 1.02 6 8 806 0.63 8 2 60 9* 10 721 4464 9* 10 921 0.22 9* 10 1013 0.79 Note: * minimum number of buses; NB: Number of buses; NT: Number of trips; TT: Total travel time (minutes); RT: Running time (second) Figure 5 Running time comparison between the EXAA, PMCM, and SMCM 4.1.3. SMCM and PMCM on large size problems After showing the heuristic algorithms are much faster than the exact method on small size problems, in this subsection, want to answer the question of whether the heuristic algorithm still efficient to solve large size problems. The test problems are generated using a similar method described in section 4.1.1 except that the problem size goes up to 300 schools and 6000 stops. The result of the comparison between SMCM and PMCM is shown in Table 4. Out of 11 test scenarios, SMCM found a better result (in terms of fewer number of buses) six times compared to two times 17 when PMCM found a better result. However, the difference was not significant; the differences were no bigger than 10%. Also, there were three scenarios that SMCM and PMCM found the results using the same number of buses. Therefore, with respect to the minimum number of buses, SMCM had a slightly better result than PMCM, but it is not significant. When considering the efficiency, PMCM outperforms SMCM. The running time for PMCM is around half of the running time for SMCM especially for larger cases where the initial fixed running time for loading the problem had a smaller impact on the overall running time. Both SMCM and PMCM were pretty efficient. The largest problem with 300 schools, 6000 stops, and over 1000 trips can be solved within 6 minutes. In the next subsection, we further compare these two algorithms on more realistic benchmark problems. Table 4 Comparison between SMCM and PMCM Scenario # of schools # of stops 1 2 3 4 5 6 7 8 9 10 11 2 4 6 8 10 20 50 100 150 200 300 60 120 180 240 300 600 1000 2000 3000 4000 6000 NT1 15 24 34 39 49 102 181 364 528 734 1065 SMCM NB2 15 18* 21* 26 32 52* 71* 116 132* 176 201* RT3 NT 14 0.53 28 0.74 37 1.15 42 1.55 53 2.14 111 4.89 191 10.83 384 36.34 570 89.59 167.96 788 376.27 1151 PMCM NB 14* 19 23 26 32 56 73 116 139 174* 209 Difference RT Diff2 %3 0.52 7% 0.91 6% 0.63 10% 0.75 0% 0.96 0% 2.34 8% 6.00 3% 21.61 0% 48.47 5% 88.54 1% 197.30 4% 1 1 2 0 0 4 2 0 7 2 8 *: best result with respect to the minimum number of buses; 1NT: Number of trips; 2NB: Number of buses; 3RT: running time for routing problem (seconds); 2 Diff = # 𝑏𝑢𝑠𝑒𝑠 (𝑆𝑀𝐶𝑀) − # 𝑏𝑢𝑠𝑒𝑠 (𝑃𝑀𝐶𝑀); 3% = Diff / min{#𝑏𝑢𝑠𝑒𝑠 (𝑆𝑀𝐶𝑀), #𝑏𝑢𝑠𝑒𝑠 (𝑃𝑀𝐶𝑀)} × 100%. 4.2. Preliminary experiment for benchmark problems The benchmark problems solved in this paper were developed by Park et al. (2012). There are two sets of test scenarios: 1) RSRB, where stops and schools are randomly distributed and 2) CSCB, where stops and schools are gathered together. There are eight test problems in RSRB up to 100 schools, 2000 stops and 31939 students and 16 test problems in CSCB up to 100 schools, 2000 stops and 27945 students. The maximum ride time (MRT) was set to be either 2700 seconds (45 minutes) or 5400 seconds (90 minutes). All 24 test problems were solved using two different maximum ride times, making it 48 separate test cases in total. The bus fleet is assumed to be homogeneous with the fixed capacity of 66. The distance is assumed to be grid (Manhattan) distance with a constant bus speed of 20 miles per hour. The pickup and drop off time were the same as those in Equations (24) and (25). All Park et al. (2012)'s results were adopted using the corrected version of Aug 10th, 2012. The preliminary experiment was made between SMCM and PMCM without Post Improvement algorithm using the same naïve parameters setting ( 𝛼𝑄 = 𝛼𝐶 = 𝛼𝑇 = 1 ). The experiments were limited to the first five scenarios for both RSRB and CSCB under the maximum ride time (MRT) of 4500 seconds. The result is summarized in Table 5. The major criterion is the same as before, the number of buses (NB) and the efficiency (running time, RT). The comparison was made between the solution from Park et al. (2012) (abbreviated as Park) with single-load and 18 the solution that Park et al. (2012) reported using Braca et al. (1997) algorithm (abbreviated as Braca). It can be seen that SMCM and PMCM had very similar results for the number of buses and the difference was within 4 buses. When compared to the solution from Braca and Park, both SMCM and PMCM can find better results than the existing methods for about half of the cases even under the naïve parameter setting. This shows the potential of MCM algorithm. The running time for MCM was higher than Park because 1) MCM was coded in Python while Park algorithm was coded in C, which is inherently faster than Python; and 2) our code is not optimized since the running time is not a critical issue for a planning problem. Still, it can be seen that under the same coding structure and language, PMCM was much faster than SMCM. Therefore, the detailed computational tests in the next section use PMCM due to its efficiency and the somewhat similar solution quality as SMCM. Table 5 Preliminary experiment of SMCM and PMCM on benchmark problems # of SMCM Park PMCM Scenario RSRB01 RSRB02 RSRB03 RSRB04 RSRB05 CSCB01 CSCB02 CSCB03 CSCB04 CSCB05 schools 6 12 12 25 25 6 12 12 25 25 # of stops 250 250 500 500 1000 250 250 500 500 1000 Braca NB1 31 29 61 60 86 33 26 50 67 134 NB 31 30 61 56 106 35 27 52 57 115 RT2 NT3 NB 0.5 32 27+* 0.5 52+* 0.8 56+ 0.9 92* 1.5 34* 0.5 0.5 30 0.7 58 54*+ 0.9 119+ 1.6 60 68 126 140 234 69 67 133 150 291 RT NT 2.9 56 1.4 71 6.2 124 3.7 138 24.7 235 69 4.3 3.2 66 8.7 127 4.8 159 31.7 308 NB 31 31 49+* 54+* 92* 34* 28 53 54*+ 116+ RT 0.6 0.9 2.2 2.4 4.8 0.9 0.9 2.9 3.1 6.6 Note: 1NB: Number of buses; 2RT: running time without route scheduling problem (seconds); 3NT: Number of trips; *: if the result was better than Park et al. (2012); +: the result was better than Braca et al. (1997). 4.3. Benchmark problems 4.3.1. Sensitivity analysis Clearly, parameters have a significant impact on the algorithms. In this section, we experiment with different values of the meta-parameters of both the minimum cost matching (MCM) and the post-improvement (PI) algorithm. A way of choosing a good combination of these meta-parameters is conducting sensitivity analysis. Due to the huge combination of different parameters in MCM and PI, only a set of parameters candidates were tested. The sensitivity analysis shown in Table 6 was conducted based on RSRB01 with MRT=2700 seconds. The most influential meta-parameters in MCM (ParaMCM) were coefficient for the remaining vehicle capacity (𝛼𝑄) , trip compatibility (𝛼𝐶) and travel time (𝛼𝑇) for evaluating insertion cost in Equation (1). Eight sets of meta-parameters for ParaMCM were tested in the form of (𝛼𝑄: 𝛼𝐶: 𝛼𝑇). And the most important meta-parameters in post improvement (ParaPI) were the coefficients for the total number of trips (𝛾𝑁), trip compatibilities (𝛾𝐶) and travel time (𝛾𝑇) in the surrogate cost estimation (Equation (11)). Four sets of meta-parameter values were examined in the shape of (𝛾𝑁: 𝛾𝐶: 𝛾𝑇). In total, 32 different combinations of meta-parameter sets were examined. The criterion was still the number of buses (NB). Under each meta-parameter set test, the solution from pure PMCM and solution from PMCMPI (implementing PI after PMCM) were both reported. Other parameters were set to be 𝛽𝑠 = 10000, 𝛽𝑄 = 100, 𝛽𝐷 = 10, 𝛽𝑇 = 1, 𝑡𝑖𝑛𝑖𝑡𝑖𝑎𝑙 = 100 × 𝑛, 𝑡𝑒𝑛𝑑 = 10, 𝑡𝑐𝑜𝑜𝑙 = 0.9, 𝑖𝑡max = 10, 𝜖~𝑈𝑛𝑖(0,100), 𝑁𝑛𝑒𝑖 = 20 . Note that the trip 19 compatibility calculation (Equation (4)) requires the fixed scalar school bell time such that the start time of the trip equals to the dismissal time of the school. In the benchmark problem from Park et al. (2012), the school dismissal (or for morning bell) time is a time window and the start of the trip is a variable within that time window. In our implementation of MCMPI, we assumed that the start of each school equals to the early school bell time and the trip compatibility is a rough estimate of the real trip compatibility. The actual trip start time is calculated in the process of solving the route scheduling problem. Table 6 Sensitivity analysis of MCM and PI ParaPI1 NB2 (300:20:1) (200:100:1) (100:100:1) (200:10:1) (100:10:1) (1:1:1) (10:10:1) (10:100:1) Para MCM 5 (10000:1250:1) PMCM3 50 38 36 33 33 34 34 35 PI4 34 33 35 31* 34 34 34 35 PMCM (1000:125:1) PI 34 33 34 33 34 35 34 34 49 39 34 37 34 35 34 34 PMCM (100:125:1) PI 36 33 35 33 34 35 34 34 51 38 35 37 33 35 34 34 PMCM (10:10:1) PI 35 34 35 35 35 33 34 34 50 39 36 38 35 33 34 34 Note: 1parameters for PI in the form of (𝛾𝑁: 𝛾𝐶: 𝛾𝑇), 2NB: number of buses; 3PMCM: number of buses of the solution generated by PMCM; 4PI: number of buses of the solution generated by PMCM followed by PI; 5ParaMCM: parameter of MCM in the form of (𝛼𝑄: 𝛼𝐶: 𝛼𝑇);*: best solution By changing the meta-parameters, MCM and PI perform quite differently. For example, under the same ParaPI (𝛾𝑁: 𝛾𝐶: 𝛾𝑇 = 100: 125: 1), changing ParaMCM will lead to the solution changing from 33 buses to 51 buses. On the other hand, by changing ParaPI, the number of buses can be saved with respect to PMCM will also be changed. Because the parameters for MCM and PI are not independent, the cross-examination is a logical way of choosing an appropriate combination of parameters. Table 6 shows that the best solution (with 31 buses) was obtained when 𝛼𝑄: 𝛼𝐶: 𝛼𝑇 = 200: 10: 1 and 𝛾𝑁: 𝛾𝐶: 𝛾𝑇 = 10000: 1250: 1. This set of parameters was used in all other test scenarios. 4.3.2. Experiment setup PMCM was adopted to generate trips for all test scenarios compared to the solution reported by Park et al. (2012). Then, PI was implemented to hopefully further improve the solution from PMCM. There are three major sets of comparisons: 1) solutions from PMCM are compared to the existing solutions (Park et al., 2012), for both difference in the number of buses and relative bus saving percentage; 2) solutions from PMCMPI are compared to the existing solutions; and 3) performance of PI, which is the improvement of PMCMPI with respect to the solutions from PMCM. The results of these three sets of comparisons are summarized Table 7 and Table 8. Both PMCM and PMCMPI were run for ten iterations, and only the best result was reported. Because Park et al. (2012) reported better results than Braca et al. (1997) for almost all cases, in this paper, we only compare the number of buses from PMCM and PMCMPI to those reported by Park et al. (2012). 20 4.3.3. Result The improvement of PMCM and PI with respect to Park et al. (2012) (abbreviated as Park) can be observed in Table 7 (where maximum ride time is set to be 2700 seconds) and Table 8 (maximum ride time is set to be 2700 seconds). Among 24 test scenarios, PMCM found better or equal results than Park 20 times. The maximum bus saving ratio of PMCM with respect to Park was 13%. This saving was more significant for large cases like CSCB07 where 201 buses can be reduced to 175 buses. Thirteen percentage bus saving, in this case, equals 26 buses. The solution from PMCMPI was even better than PMCM. Once the post-improvement was added (PMCMPI), Park algorithm only outperforms PMCMPI in one scenario (CSCB11). The highest saving ratio can reach 19% compared to Park at CSCB07, and the highest number of buses saved reaches 27, which is a significant improvement. On average, PMCM can save 5.7 buses which roughly equals 5% compared to Park. Moreover, by applying PI, such saving went to 7.3 buses, which roughly equals 7% of the total number of buses. PI can improve the solution from PMCM by additional 2%. Similar results can be seen with MRT=5400 cases and the bus saving (exact number and percentage) is shown in Figure 6. Figure 6 Bus saving compared to Park (MRT=5400 seconds (i.e., 90 minutes)) 21 # of schools # of stops Park NB2 NT1 RT3 NT NB Table 7 Computation result of PMCM and PMCMPI for benchmark with MRT=2700 PMCM PMCMPI PMCM2Park4 PMCMPI2Park7 PI2PMCM8 NB % NB 4 3 7 1 12 13 6 22 3 0 4 6 1 1 27 13 6 1 -2 2 6 12 1 26 7.3 11% 9% 11% 1% 10% 13% 3% 12% 8% 0% 6% 8% 1% 1% 13% 7% 19% 3% -3% 3% 4% 9% 0% 13% 7% % 6% 3% 5% 0% 1% 2% 1% 2% 3% 0% 3% 0% 2% 2% 1% 1% 4% 3% 3% 1% 1% 0% 2% 2% 2 1 3 0 1 2 2 3 1 0 2 0 3 3 1 1 1 1 2 1 2 0 4 3 1.6 2% Scenario RSRB01 RSRB02 RSRB03 RSRB04 RSRB05 RSRB06 RSRB07 6 12 12 25 25 50 50 RSRB08 100 CSCB01 CSCB02 CSCB03 CSCB04 CSCB05 CSCB06 CSCB07 6 12 12 25 25 50 50 CSCB08 100 CSCB09 CSCB10 CSCB11 CSCB12 CSCB13 CSCB14 CSCB15 6 12 12 25 25 50 50 CSCB16 100 Average 250 250 500 500 1000 1000 2000 2000 250 250 500 500 1000 1000 2000 2000 250 250 500 500 1000 1000 2000 2000 77 88 154 192 315 366 637 807 85 96 176 214 398 471 724 840 82 116 158 181 347 431 708 846 35 32 66 68 124 103 185 178 39 33 66 72 135 138 201 183 32 33 58 77 165 137 247 208 0.6 0.5 0.8 1 1.6 1.7 2.6 3.1 0.5 0.5 0.8 1 1.8 2 2.9 3.4 0.4 0.6 0.7 1 2 2.1 3.3 3.6 73 85 156 192 303 349 599 775 83 96 181 219 390 458 730 841 80 112 164 198 353 438 703 809 33 30 62 67 113 92 181 159 37 33 64 66 137 140 175 171 27 33 62 76 161 125 250 185 RT 1.3 1.3 2.5 2.7 10.6 11.2 38.1 54.6 2.1 1.5 5.6 3.9 14.3 11.7 87.8 87.6 1.3 1.7 7.7 6.9 20.2 17.6 82.0 76.1 NT NB RT NB5 71 85 158 192 31 29 59 67 52.3 35.8 66.7 78.0 304 112 143.7 351 90 122.9 593 179 168.0 778 156 269.8 82 95 179 215 36 33 62 66 16.1 19.0 38.7 35.5 393 134 79.6 454 137 120.0 725 174 214.3 839 170 244.6 81 111 163 198 26 32 60 75 17.1 29.9 41.6 37.1 351 159 143.3 436 126 117.8 697 246 182.2 811 182 215.7 2 2 4 1 11 11 4 19 2 0 2 6 -2 -2 26 12 5 0 -4 1 4 12 -3 23 5.7 %6 6% 6% 6% 1% 9% 11% 2% 11% 5% 0% 3% 8% -1% -1% 13% 7% 16% 0% -7% 1% 2% 9% -1% 11% 5% Note: 1NT: Number of trips; 2NB: number of buses; 3RT: running time (seconds); 4PMCM2Park: bus saving of PMCM w.r.t Park; 5NB: NBPark – NBPMCM; 6%: PMCM2Park / NBPark×100%; 7PMCMPI2Park: bus saving of PMCMPI w.r.t. Park; 8PI2PMCM: bus saving of PMCMPI w.r.t. PMCM 22 # of schools # of stops NT1 NB2 RT3 NT NB Table 8 Computation result of PMCM and PMCMPI for benchmark with MRT=5400 Park PMCM PMCMPI PMCM2Park4 PMCMPI2Park7 PI2PMCM8 Scenario RSRB01 RSRB02 RSRB03 RSRB04 RSRB05 RSRB06 RSRB07 6 12 12 25 25 50 50 RSRB08 100 CSCB01 CSCB02 CSCB03 CSCB04 CSCB05 CSCB06 CSCB07 6 12 12 25 25 50 50 CSCB08 100 CSCB09 CSCB10 CSCB11 CSCB12 CSCB13 CSCB14 CSCB15 6 12 12 25 25 50 50 CSCB16 100 Average 250 250 500 500 1000 1000 2000 2000 250 250 500 500 1000 1000 2000 2000 250 250 500 500 1000 1000 2000 2000 65 72 129 149 268 275 554 714 72 66 133 151 341 384 560 619 78 86 118 133 284 329 577 582 31 30 61 56 106 82 159 158 35 27 52 57 115 123 164 156 26 30 50 55 135 117 215 158 0.5 0.5 0.8 0.9 1.5 1.6 2.4 2.9 0.5 0.5 0.7 0.9 1.6 1.9 2.6 2.9 0.4 0.5 0.7 0.9 1.7 1.9 2.8 2.9 55 69 120 132 232 225 456 588 68 59 126 140 299 330 498 560 69 78 104 120 255 306 486 489 RT 0.7 1.0 2.3 3.2 7.6 9.9 31 29 50 50 88 81 154 141 35.7 50.2 34 25 50 48 119 113 152 142 25 27 44 52 130 98 195 158 1.2 0.9 2.1 5.2 9.0 7.8 33.3 40.4 0.8 1.2 2.4 4.0 11.5 17.4 54.2 52.5 NT NB RT NB5 56 69 118 131 232 226 457 587 69 60 124 145 301 331 495 557 70 77 105 119 254 306 484 493 29 26 46 48 85 78 143 133 33 25 48 52 113 110 146 138 21 24 43 52 124 101 191 152 21.3 18.9 37.9 33.9 122.8 126.8 276.0 281.6 19.0 16.0 39.4 37.1 93.7 83.6 312.0 238.7 21.4 16.9 56.4 48.2 166.3 80.8 358.7 206.8 0 1 11 6 18 1 5 17 1 2 2 9 -4 10 12 14 1 3 6 3 5 19 20 0 6.8 %6 0% 3% 18% 11% 17% 1% 3% 11% 3% 7% 4% 16% -3% 8% 7% 9% 4% 10% 12% 5% 4% 16% 9% 0% 7% NB 2 4 15 8 21 4 16 25 2 2 4 9 2 13 18 18 5 6 7 3 11 19 24 6 % 6% 13% 25% 14% 20% 5% 10% 16% 6% 7% 8% 16% 2% 11% 11% 12% 19% 20% 14% 5% 8% 16% 11% 4% NB 2 3 4 2 3 3 11 8 1 0 2 0 6 3 6 4 4 3 1 0 6 0 4 6 % 6% 10% 8% 4% 3% 4% 7% 6% 3% 0% 4% 0% 5% 3% 4% 3% 16% 11% 2% 0% 5% 0% 2% 4% 10.2 12% 3.4 5% Note: 1NT: Number of trips; 2NB: number of buses; 3RT: running time (seconds); 4PMCM2Park: bus saving of PMCM w.r.t Park; 5NB: NBPark – NBPMCM; 6%: PMCM2Park / NBPark×100%; 7PMCMPI2Park: bus saving of PMCMPI w.r.t. Park; 8PI2PMCM: bus saving of PMCMPI w.r.t. PMC 23 In loose MRT scenarios (MRT=5400), the bus savings are significant (Table 8 and Figure 6). The highest bus saving for PMCM occurred at CSCB15 where 20 buses can be saved, which equals 9% of total buses. The highest bus saving ratio can reach 18% just due to PMCM. On average, PMCM can saves 6.8 buses compared to Park, which is a 7% improvement. The results of PMCMPI were even better. The average bus saving of PMCMPI was 12%, which is equivalent to 10.2 bus saving. The highest bus saving reached 25% at RSRB03 where 15 buses can be reduced out of 61 buses. At larger case like RSRB08, 16% improvement saves 25 buses. Thanks to the larger feasible region resulted by loosening the MRT constraints, PI played a more critical role in routing than in stricter MRT condition. On average, PI can reduce buses by 5% (which equals to about 3.4 buses) from PMCM. The significant performance of the MCMPI over the benchmark solutions comes from the 'look ahead' idea of incorporating the scheduling information into the routing problem. With the consideration of trip compatibility, the routing plan is more likely to provide a scheduling plan than the traditional methods. 5. Conclusion In this paper, an insertion based Minimum Cost Matching with Post Improvement (MCMPI) algorithm was proposed to solve multi-school bus routing problems. It adopts the idea of incorporating trip compatibility into the routing problem. Different experiments were conducted to compare different variations of the algorithm. We showed that the heuristic algorithm can find solutions with higher quality than the exact methods in much shorter time. In large size problems, where the exact method cannot find good solutions, the heuristic algorithm still performs efficiently. Other experiments were conducted based on the benchmark problems from Park et al. (2012). The results show that the proposed Minimum Cost Matching (MCM) heuristic algorithm could save up to 25% of buses compared to Park et al. (2012). On average, the newly proposed algorithms can save 7% and 12% of buses at strict Maximum Ride Time (MRT=2700 seconds) conditions and loose MRT (=5400 seconds) cases, respectively. Moreover, the post-improvement (PI) can further improve the solution from MCM by up to 16%. This study opens avenues for future research on school bus routing. One of them is to incorporate sources of unreliability such as travel time uncertainties in the routing process. Another one is finding the optimal initial number of trips required for the MCM. Another significant step could be incorporating the school bell/dismissal time problem in routing and solving these two problems together since the school bell times affect the trip compatibilities. References: Babin, G., Deneault, S. and Laporte, G., 2007. Improvements to the Or-opt heuristic for the symmetric travelling salesman problem. Journal of the Operational Research Society, 58(3), pp.402-407. Bektaş, T. and Elmastaş, S., 2007. Solving school bus routing problems through integer programming. Journal of the Operational Research Society, 58(12), pp.1599-1604. Bögl, M., Doerner, K.F., and Parragh, S.N., 2015. The school bus routing and scheduling problem with transfers. Networks, 65(2), pp.180-203. Bowerman, R., Calamai, P.H. and Hall, G.B., 1994. The spacefilling curve with optimal partitioning heuristic for the vehicle routing problem. European Journal of Operational Research, 76(1), pp.128-142. 24 Bowerman, R., Hall, B., and Calamai, P., 1995. A multi-objective optimization approach to urban school bus routing: Formulation and solution method. Transportation Research Part A: Policy and Practice, 29(2), pp.107-123. Braca, J., Bramel, J., Posner, B. and Simchi-Levi, D., 1997. A computerized approach to the New York City school bus routing problem. IIE Transactions, 29(8), pp.693-702. Braekers, K., Caris, A. and Janssens, G.K., 2014. Exact and meta-heuristic approach for a general heterogeneous dial-a-ride problem with multiple depots. Transportation Research Part B: Methodological, 67, pp.166-186. Bramel, J. and Simchi-Levi, D. (1992) A location based heuristic for general routing problems. Working Paper, Department of Industrial Engineering and Operations Research, Columbia University. Caceres, H., Batta, R. and He, Q., 2017. School bus routing with stochastic demand and duration constraints. Transportation Science. Christofides, N., Mingozzi, A. and Toth, P., 1979. Vehicle routing problem. In N. Combinatorial Optimization. Wiley. Chichester, 313-338 Corberán, A., Fernández, E., Laguna, M. and Marti, R.A.F.A.E.L., 2002. Heuristic solutions to the problem of routing school buses with multiple objectives. Journal of the operational research society, 53(4), pp.427-435. Cordeau, J.F. and Laporte, G., 2003. A tabu search heuristic for the static multi-vehicle dial-a-ride problem. Transportation Research Part B: Methodological, 37(6), pp.579-594. Díaz-Parra, O., et al., 2012, November. A vertical transfer algorithm for the school bus routing problem. In Nature and Biologically Inspired Computing (NaBIC), 2012 Fourth World Congress on (pp. 66-71). IEEE. Ellegood, W.A., Campbell, J.F. and North, J., 2015. Continuous approximation models for mixed load school bus routing. Transportation Research Part B: Methodological, 77, pp.182-198. Faraj, M.F., Sarubbi, J.F.M., Silva, C.M., Porto, M.F. and Nunes, N.T.R., 2014, October. A real geographical application for the school bus routing problem. In Intelligent Transportation Systems (ITSC), 2014 IEEE 17th International Conference on (pp. 2762-2767). IEEE. Forbes, M., Holt, J., Kilby, P. and Watts, A., 1991. A matching algorithm with application to bus operations. Australian Journal of Combinatorics, 4, pp.71-85. Fu, Z., Eglese, R., and Li, L.Y., 2005. A new tabu search heuristic for the open vehicle routing problem. Journal of the Operational Research Society, 56(3), pp.267-274. Harvey, N.J., Ladner, R.E., Lovász, L. and Tamir, T., 2006. Semi-matchings for bipartite graphs and load balancing. Journal of Algorithms, 59(1), pp.53-78. Kang, M., et al., 2015. Development of a genetic algorithm for the school bus routing problem. International Journal of Software Engineering and Its Applications, 9(5), pp.107-126. Kim, B.I., Kim, S. and Park, J., 2012. A school bus scheduling problem. European Journal of Operational Research, 218(2), pp.577-585. Kinable, J., Spieksma, F.C., and Vanden Berghe, G., 2014. School bus routing-a column generation approach. International Transactions in Operational Research, 21(3), pp.453-478. Munkres, J. 1957. Algorithms for the Assignment and Transportation Problems, Journal of the Society for Industrial and Applied Mathematics, 5(1):32–38, 1957 March. Nanry, W.P. and Barnes, J.W., 2000. Solving the pickup and delivery problem with time windows using reactive tabu search. Transportation Research Part B: Methodological, 34(2), pp.107- 121. 25 National Center for Education Statistics. (2016). National Center for Education Statistics: Fast Facts. Retrieved from https://nces.ed.gov/fastfacts/display.asp?id=67 Or, I., Traveling Salesman-Type Combinatorial Problems and Their Relation to the Logistics of Regional Blood Banking. Ph.D. Thesis, Department of Industrial Engineering and Management Sciences, Northwestern University, Evanston, IL, 1976. Pacheco, J. and Martí, R., 2006. Tabu search for a multi-objective routing problem. Journal of the Operational Research Society, 57(1), pp.29-37. Paquette, J., Cordeau, J.F., Laporte, G. and Pascoal, M.M., 2013. Combining multicriteria analysis and tabu search for dial-a-ride problems. Transportation Research Part B: Methodological, 52, pp.1-16. Park, J., and Kim, B.I., 2010. The school bus routing problem: A review. European Journal of operational research, 202(2), pp.311-319. Park, J., Tae, H. and Kim, B.-I., 2012. A post-improvement procedure for the mixed load school bus routing problem. European Journal of Operational Research, 217(1), pp.204-213. Pedregosa et al. (2011). Scikit-learn: Machine Learning in Python. JMLR 12, pp. 2825-2830. Prins, C., 2004. A simple and effective evolutionary algorithm for the vehicle routing problem. Computers & Operations Research, 31(12), pp.1985-2002. Riera-Ledesma, J. and Salazar-González, J.J., 2013. A column generation approach for a school bus routing problem with resource constraints. Computers & Operations Research, 40(2), pp.566-583. Schittekat, P., Kinable, J., Sörensen, K., Sevaux, M., Spieksma, F. and Springael, J., 2013. A metaheuristic for the school bus routing problem with bus stop selection. European Journal of Operational Research, 229(2), pp.518-528. Shafahi, A., Aliari, S., and Haghani, A., 2017a. Balanced scheduling of school bus trips using a perfect matching heuristic. arXiv preprint arXiv:1708.09338. Shafahi, A., Wang, Z. and Haghani, A., 2017b. Solving the School Bus Routing Problem by Maximizing Trip Compatibility. Transportation Research Record: Journal of the Transportation Research Board, No. 2667. DOI: 10.3141/2667-03. Spada, M., Bierlaire, M. and Liebling, T.M., 2005. Decision-aiding methodology for the school bus routing and scheduling problem. Transportation Science, 39(4), pp.477-490. Thangiah, S.R., and Nygard, K.E., 1992, March. School bus routing using genetic algorithms. In Aerospace Sensing (pp. 387-398). International Society for Optics and Photonics. Wang, Z., Shafahi, A., and Haghani, A., 2017. SCDA: School Compatibility Decomposition Algorithm for Solving the Multi-School Bus Routing and Scheduling Problem. arXiv preprint arXiv: 1711.00532 Wark, P. and Holt, J., 1994. A repeated matching heuristic for the vehicle routing problem. Journal of the Operational Research Society, pp.1156-1167. Yao, B., Cao, Q., Wang, Z., Hu, P., Zhang, M. and Yu, B., 2016. A two-stage heuristic algorithm for the school bus routing problem with mixed load plan. Transportation Letters, 8(4), pp.205-219. 26
1811.04300
1
1811
2018-11-10T20:06:19
Efficiently Approximating Edit Distance Between Pseudorandom Strings
[ "cs.DS" ]
We present an algorithm for approximating the edit distance $\operatorname{ed}(x, y)$ between two strings $x$ and $y$ in time parameterized by the degree to which one of the strings $x$ satisfies a natural pseudorandomness property. The pseudorandomness model is asymmetric in that no requirements are placed on the second string $y$, which may be constructed by an adversary with full knowledge of $x$. We say that $x$ is \emph{$(p, B)$-pseudorandom} if all pairs $a$ and $b$ of disjoint $B$-letter substrings of $x$ satisfy $\operatorname{ed}(a, b) \ge pB$. Given parameters $p$ and $B$, our algorithm computes the edit distance between a $(p, B)$-pseudorandom string $x$ and an arbitrary string $y$ within a factor of $O(1/p)$ in time $\tilde{O}(nB)$, with high probability. Our algorithm is robust in the sense that it can handle a small portion of $x$ being adversarial (i.e., not satisfying the pseudorandomness property). In this case, the algorithm incurs an additive approximation error proportional to the fraction of $x$ which behaves maliciously. The asymmetry of our pseudorandomness model has particular appeal for the case where $x$ is a \emph{source string}, meaning that $\operatorname{ed}(x, y)$ will be computed for many strings $y$. Suppose that one wishes to achieve an $O(\alpha)$-approximation for each $\operatorname{ed}(x, y)$ computation, and that $B$ is the smallest block-size for which the string $x$ is $(1/\alpha, B)$-pseudorandom. We show that without knowing $B$ beforehand, $x$ may be preprocessed in time $\tilde{O}(n^{1.5}\sqrt{B})$, so that all future computations of the form $\operatorname{ed}(x, y)$ may be $O(\alpha)$-approximated in time $\tilde{O}(nB)$. Furthermore, for the special case where only a single $\operatorname{ed}(x, y)$ computation will be performed, we show how to achieve an $O(\alpha)$-approximation in time $\tilde{O}(n^{4/3}B^{2/3})$.
cs.DS
cs
Efficiently Approximating Edit Distance Between Pseudorandom Strings William Kuszmaul∗ 8 1 0 2 v o N 0 1 ] S D . s c [ 1 v 0 0 3 4 0 . 1 1 8 1 : v i X r a Abstract We present an algorithm for approximating the edit distance ed(x, y) between two strings x and y in time parameterized by the degree to which one of the strings x satisfies a natural pseudorandomness property. The pseudorandomness model is asymmetric in that no requirements are placed on the second string y, which may be constructed by an adversary with full knowledge of x. We say that x is (p, B)-pseudorandom if all pairs a and b of disjoint B-letter substrings of x satisfy ed(a, b) ≥ pB. Given parameters p and B, our algorithm computes the edit distance between a (p, B)-pseudorandom string x and an arbitrary string y within a factor of O(1/p) in time O(nB), with high probability. If x is generated at random, then with high probability it will be (Ω(1), O(log n))-pseudorandom, allowing us to compute ed(x, y) within a constant factor in near linear time. For strings x of varying degrees of pseudorandomness, our algorithm offers a continuum of runtimes. Our algorithm is robust in the sense that it can handle a small portion of x being adversarial (i.e., not satisfying the pseudorandomness property). In this case, the algorithm incurs an additive approximation error proportional to the fraction of x which behaves maliciously. The asymmetry of our pseudorandomness model has particular appeal for the case where x is a source string, meaning that ed(x, y) will be computed for many strings y. Suppose that one wishes to achieve an O(α)-approximation for each ed(x, y) computation, and that B is the smallest block-size for which the string x is (1/α, B)-pseudorandom. We show that without knowing B beforehand, x may be preprocessed in time O(n1.5√B), so that all future compu- tations of the form ed(x, y) may be O(α)-approximated in time O(nB). Furthermore, for the special case where only a single ed(x, y) computation will be performed, we show how to achieve an O(α)-approximation in time O(n4/3B 2/3). 1 Introduction The edit distance ed(x, y) between two strings x and y over an alphabet Σ is the minimum number of insertions, deletions, and substitutions of characters needed to transform x to y. The textbook dynamic- programming algorithm for edit distance runs in time O(n2) [23, 20, 22], and conditional lower bounds suggest that no algorithm can do more than a sub-polynomial factor better [5, 6] (unless the Strong Exponential Time Hypothesis fails). The difficulty of computing edit distance poses a significant challenge for applications involving large ∗Massachusetts Institute of Technology, Cambridge MA, email: [email protected]. Supported by an MIT Akamai Fellowship and a Fannie & John Hertz Foundation Fellowship In computational biology, for example, edit strings. distance is an important tool for comparing differences between genetic sequences [19, 1, 20]. Rather than re- lying on the quadratic-time algorithm, such applica- tions have often resorted to the use of fast heuristics [12, 19, 10, 1, 17]. On the theoretical side, extensive work has been done towards algorithms that circumvent the quadratic lower bound, either by approximating edit distance, or by making assumptions on the input [3, 4, 7, 21, 14, 15, 2, 8, 11, 13]. One of the most notable successes in this direction is the algorithm of Landau and Myers [15] with runtime parameterized by the edit distance, computing ed(x, y) in time O(n + ed(x, y)2). The algorithm runs in linear time when the edit distance is small (say, less than √n), and offers a continuum of runtimes for larger edit distances. Another celebrated result is the approximation algorithm of Andoni et al. [3], which approximates edit distance within a factor of (log n)O(1/ǫ) in time O(n1+ǫ). A recent breakthrough by Chakraborty et al. [7] gives the first approximation algorithm to achieve a sub-logarithmic approximation ratio in strongly subquadratic time. Their algorithm computes a constant approximation for edit distance in time O(n12/14). It remains unknown whether a sub-logarithmic approximation for edit distance can be computed in close to linear time. It was recently shown by Andoni and Krauthgamer [2] that better tradeoffs could be achieved if certain ran- domness assumptions are placed on x and y. In partic- ular, they introduce the smoothed complexity model, in which x and y are binary strings which are assumed to be partly determined by a random process: Given two initial strings x◦ and y◦ with longest common sub- sequence A, x and y are defined by perturbing each letter of x◦ and y◦ with probability p, except that A is perturbed in the same way inside each of the two strings. Given two strings x and y which are constructed in this manner, the algorithm of [2] can be used to com- ǫp log 1 ǫp(cid:17)-approximation for ed(x, y) in time pute an O(cid:16) 1 O(cid:16)n1+ǫ/ped(x, y)(cid:17). For constant p and small ǫ < 1, this gives a constant approximation in close to linear (or potentially sublinear) time. Our Contribution We consider an asymmetric randomness model for edit distance, in which one of the strings x is presumed to satisfy natural randomness properties, but in which the string y may be constructed by an adversary (with full knowledge of x). We show for a random string x ∈ Σn and an arbitrary string y ∈ Σn, there is an approximation algorithm that computes ed(x, y) up to a constant factor in near linear time, with high probability. Rather than requiring that the string x is truly ran- dom, our algorithm also works for any string x satisfy- ing the following property: There is some constant c > 1 such that for any two disjoint substrings a and b in x of length c log n, the edit distance between a and b is at least log n. By relaxing the above property, one can define a natural notion of pseudorandomness for a string x. Specifically, we say that x is (p, B)-pseudorandom if all pairs a and b of disjoint B-letter substrings of x satisfies ed(a, b) ≥ pB. Given parameters p and B, our main result is an algorithm that computes the edit distance between a (p, B)-pseudorandom string x and an arbitrary string y within a factor of O(1/p) in time O(nB), with high probability (Section 3). An interesting feature of our algorithm is that it al- lows for substantial speedups over the quadratic-time algorithm (as well as the O(n12/14)-time approxima- tion algorithm of [7]) even for strings x exhibiting rel- atively limited pseudorandomness. For example, if x is (Ω(1), nǫ)-pseudorandom, then we can recover a con- stant approximation for ed(x, y) in time O(n1+ǫ). The asymmetry of our pseudorandomness model seems particularly appealing for applications in which one string x is treated as a source string, and in which the edit distance ed(x, y) is then computed for a large collection of strings y. In particular, one can first determine values of p and B for which x is (p, B)-pseudorandom, and then use our algorithm with parameters p and B to approximate ed(x, y) for any string y. In Section 4, we present an algorithm for determining the values of B and p with which to run our approximation algorithm on a string x. In particular, suppose we wish to obtain an α-approximation for each computation ed(x, y), and that B is the smallest (power- of-two) block size for which the string x is (1/α, B)- pseudorandom. Then without knowing B beforehand, we can perform an O(n1.5(√B + α))-time preprocessing step on x, so that any edit distance computation ed(x, y) can later be O(α)-approximated in time O(nB). We also consider the special case where we wish to perform only a single computation ed(x, y), but we do not know beforehand the minimum (power-of-two) block size B for which x is (1/α, B)-pseudorandom; for this case we present an algorithm which runs in time O(n4/3B2/3). Our approximation algorithm is robust to a small portion of x being determined by an adversary, rather than satisfying the pseudorandomness property, and the algorithm does not require us to know which portions of x have been affected by the adversary. In this case, the algorithm incurs an additive approximation error proportional to the fraction of x which has been constructed adversarially. Relationship to the Smoothed Complexity Model Interestingly, the smoothed complexity model [2] can be viewed as a special case of our pseudorandom- ness model. In particular, the string x in the smoothed complexity model will be (p, O( 1 p log n))-pseudorandom with high probability (see Lemma 2.2 of [2]). Our algo- rithm can therefore be used in the smoothed complexity model to obtain an O(n/p)-time algorithm with approx- imation ratio O(1/p). Both our algorithm and the algorithm of [2] use substring matching between x and y as an important al- gorithmic component, where two substrings are said to match if their edit distance is relatively small. Substring matching also plays an important role in a number of the practical heuristics for computing edit distance, in- cluding the widely used PatternHunter tool [17]. The prominent role of the technique within both our algo- rithm and the algorithm of [2] helps provide theoretical motivation for why the technique has had such empir- ical success in practice. The empirical success of the technique may also be an indicator that real-world in- puts satisfy some variant of (p, B)-pseudorandomness. Evaluating to what degree this is the case would be an important direction of future work. Beyond the use of substring matching, the tech- niques used in [2] largely differ from ours. In particular, it seems difficult to extend the techniques used in [2] to our pseudorandomness model without using space (and time) exponential in p · B. Related Work on Average-Case Analysis for Approximate String Matching In the Approximate String Matching Problem, we are given a string x ∈ Σn, a pattern p of length at most n, and a threshold k. The goal is to output all positions i in x such that there exists some j > i for which ed(xi ··· xj , p) < k. It was shown by Landau et al. [16] that the Approximate String Matching Problem can be solved in time O(nk) using space O(n). Additional space improvements have been pre- sented for the case where x is selected at random from Σn. Notably, an algorithm due to Myers [18] achieves space O(k) for random x. Improvements in runtime have also been presented. In particular, an al- gorithm due to Chang and Lampe [9] achieves runtime the subproblem. O(nk/pΣ). For strings x and y of length n, selected from a constant-size alphabet Σ, no known algorithm for Ap- proximate String Matching achieves a strongly sub- quadratic running time, even for x selected at random. Consequently, there is relatively little overlap between the setting considered in this paper and past work on Approximate String Matching. The remaining subproblems are known as live sub- problems, and require a more sophisticated analysis. For each block xi in x, we denote by φ(i) the index of the block in y closest to where the optimal alignment T maps xi. (i.e., the alignment T maps the block xi to roughly where yj sits in y.) One of the key insights is that each live subproblem A must satisfy the following property: 2 Technical Overview In this section, we present a brief technical overview of our approximation algorithm and of our algorithms for parameter detection. Approximation Algorithm for x a (p, B)- Pseudorandom String In Section 3, we present our approximation algorithm for computing the edit dis- tance between a (p, B)-pseudorandom string x and an arbitrary string y. A rough summary of our approxi- mation algorithm is as follows: We break the strings x and y into blocks of size Θ(B), and define a notion of a block xi from x edit matching with a block yj from y. In order to find a sequence of edits from x to y, we perform the following process recursively. We select a random pivot block xi from the blocks in the mid- dle half of x. If the pivot either edit matches with no blocks in y, or edit matches with more than one block in y, then we consider it to be invalid, and we sample another random pivot until we find a valid one, giving up after 100 log n consecutive failures. If, on the other hand, the pivot edit matches with exactly one block yj in y, then we break the strings at xi and yj, respectively, and recursively try to align the two strings in each of the two halves. The base case for our algorithm occurs when either the strings x and y differ in size from each other by enough to force their edit distance to be large, or when x = 0. Our algorithm outputs a non-crossing matching between the blocks of x and the blocks of y, where two blocks are only permitted to be matched if they edit match. By considering only sequences of edits which roughly respect the matchings between blocks, we are then able to efficiently find a sequence of edits from x to y. In analyzing the algorithm, we consider an optimal alignment T between x and y, and based on T we define two types of subproblems: live subproblems and dead subproblems. Dead subproblems are those which are either between vastly differently sized subtrings u and v, or which are between substrings u and v which are for the most part not aligned with one-another by T . These subproblems prove simple to analyze because any mistakes the algorithm makes on a dead subproblem can be easily accounted for by the inherent misalignment in • The Pivot Pairing Property: If the algorithm selects a block xi as block pivot, then the block yφ(i) must appear in the substring of y considered by the subproblem. If a pivot block xi edit matches with its counterpart yφ(i), then any live subproblem which selects xi will be guaranteed to perform well. Using the (p, B)- pseudorandomness property of x, we are able to show that at most O( 1 p ed(x, y)) of the letters in x reside in blocks xi that do not edit match with their counterpart yφ(i). The blocks containing these letters, which we will call dirty blocks, are the blocks which place our algorithm at risk of exhibiting a large approximation ratio. The Pivot Pairing Property has the following im- portant consequence for dirty blocks: For each dirty block xi, any live subproblem A which uses xi as a pivot block, must pair xi with one of at most two blocks yj1 and yj2 , where j1 is the largest value j1 < φ(i) for which xi edit matches with yj, and j2 is the smallest value j2 > φ(i) for which xi edit matches with yj2 . Since each dirty block has only two potential partners for it to pair with inside any live subproblem, there are, in total, only O( 1 pB ed(x, y)) pairs (xi, yj) for which the algorithm is at risk of at some point selecting xi as a pivot and erroneously matching it with yj. Call such a pair a dirty pair. In order to analyze the distortion of our algorithm, we consider each dirty pair (xi, yj), and bound the expected damage to the algorithm's output incurred by the pair. For a given live subproblem A that is at risk of pairing xi as a pivot with yj, let r denote the number of blocks in the substring of x considered by A. We show that because A is a live subproblem, it must contain Ω(r) valid pivot block options, meaning that xi has a probability of at most O(1/r) of being selected. If the block xi is selected as a pivot and is matched with the block yj, then we are able to bound the damage incurred to the algorithm (in terms of number of edits added to the final alignment) by O(B · φ(i) − j), the number of letters which lie between where the optimal alignment T maps xi and where our algorithm places xi within y. It follows that the expected damage incurred by the pair (xi, yj) to our subproblem A is at most O(cid:18) 1 r · B · φ(i) − j(cid:19) . Using the Pivot Pairing Property, we can show that the size r must be at least σ = Ω(φ(i) − j), since the subproblem must involve both yj and yφ(i). Moreover, for each range of the form Rl = [2lσ, 2l+1σ], there can be at most a constant number of subproblems A that contain xi and have a size r lying in the range. For each range Rl, it follows that the expected damage incurred by the pair (xi, yj) to live subproblems for which r ∈ Rl is at most O(cid:18) 1 2lσ · B · φ(i) − j(cid:19) = O(cid:18) 1 2l B(cid:19) . Summing over l, we find that the total expected damage incurred by (xi, yj) is at most O Xl≥0 1 2l B  = O(B). Summing over the O( 1 pB ed(x, y)) dirty pairs (xi, yj), the total expected error in our algorithm's estimate for edit distance can be bounded by O(cid:18) 1 pB ed(x, y) · B(cid:19) = O(cid:18) 1 p ed(x, y)(cid:19) , as desired. We break the full presentation and analysis of the algorithm into two parts: • The first part is an approximation algorithm for a combinatorial matching problem in which the blocks in the strings x and y have been replaced with abstract objects (essentially characters), and in which a comparison function f (i, j) determines whether the blocks xi and yj may be matched with one another. The algorithm and analysis for this problem essentially follow the outline above. • The second part is a reduction from approximat- ing ed(x, y) between two strings (one of which is (p, B)-pseudorandom) to the combinatorial match- ing problem. The reduction breaks the string x into parts x1, x2, . . . of size 6B and breaks the string y into parts y1, y2, . . . of size 3B. Roughly speak- ing, we say that xi edit matches with yj if there is a 6B-letter substring a containing yj for which ed(xi, a) ≤ O( 1 p B), and if the same is not true for yj−1. 6B and n The reduction encounters two technical subtleties. The first is that, although the strings x and y are the same length initially, they are mapped by the reduction to strings of length n 3B , respec- tively. As a result, every alignment in the result- ing matching problem must leave at least half of the blocks in y unmatched. This is resolved by defining an asymmetric cost model for alignments in the problem which we reduce to; in particular, a block yi only pays for being unmatched if the three blocks to each of its immediate left and right are also unmatched. The second subtlety is the han- dling of the case where some fraction of the blocks in x have been modified by an adversary, rather than satisfying the (p, B)-pseudorandomness prop- erty within x. The reduction is designed to hide this aspect of the problem from the combinatorial matching problem which we reduce to, by ensur- ing that the optimal cost for the matching problem is given by O(cid:16) 1 p ed(x, y) + M (x)(cid:17), where M (x) is the number of letters in x which lie in adversarially designed blocks. Parameter Detection In Section 4, we turn our attention to parameter detection. In particular, con- sider a source string x and suppose we wish to compute an O(α)-approximation for ed(x, y) for a large number of strings y. Define B to be the smallest power-of-two block-size for which x is (1/α, B)-pseudorandom. With- out knowing B beforehand, we show how to preprocess x in time O(n1.5(√B + α)) in order so that all future computations of ed(x, y) can be O(α)-approximated in time O(nB). One way to do to this would be to find the first Bi = 2iα for which x is (1/α, Bi)-pseudorandom, which would take roughly quadratic time per Bi. The key observation to improve upon this is that, since we are willing to spend time O(nB) to approximate each value ed(x, y), if it turns out that ed(x, y) ≤ √nB, then we may use the O(n + ed(x, y)2)-time algorithm of [15] in order to exactly compute ed(x, y) in the desired time bound. By exploiting this trick, we can tolerate our ap- proximation algorithm for ed(x, y) having additive er- ror of √nB. Consequently, rather than finding the first Bi for which x is (1/α, Bi)-pseudorandom, we can in- stead check for the weaker condition that x is (1/α, Bi)- pseudorandom with the exception of blocks containing at most O(√nB) letters in x. Using random sampling, this can be done in time O(n1.5(√B + α)), as desired. In a similar manner, for the case where only a single computation ed(x, y) is to be performed, we obtain an O(α)-approximation in time O(n4/3B2/3). 3 Edit Distance Between Pseudorandom Strings Let 0 < p < 1 and B ∈ N be parameters. Throughout the section, we will use Σ to denote the alphabet over which strings are taken. We will present a randomized algorithm that computes the edit distance between a (p, B)-pseudorandom string x ∈ Σn and an arbitrary string y ∈ Σn within a factor of O(1/p) in time O(nB). Additionally, our algorithm will be able to handle a small portion of x behaving maliciously. In the following definition, we define a quantity M (x) which captures the degree to which x is not (p, B)-pseudorandom. Definition 3.1. Consider x ∈ Σn, and break it into blocks x1, x2, . . . , x⌈n/6B⌉ of size 6B. If n is not a mul- tiple of 6B, then pad the final block with null characters so that it is length 6B. We say a block xi in x is p- unique if each B-letter substring of xi has edit distance distance at least pB from each B-letter substring in x that does not intersect xi. Define the quantity M (x) (which will often be abbreviated by M ) to be the number of letters in x (including null characters padded on the end) that are not in p-unique blocks. The goal of the section is to prove the following theorem: Theorem 3.1. Let n ∈ N be a string-length parameter, p ∈ (0, 1) be a parameter such that 1 p ∈ N, and B ∈ N be a block-size parameter. Consider as inputs a string x ∈ Σn and an arbitrary string y ∈ Σn. Then there exists a randomized algorithm which in time O(n·B) finds a sequence of t edits between x and y, where t is no greater than (3.1) in expectation. O(cid:18) 1 p ed(x, y) + M (x)(cid:19) , Notice that by repeatedly applying Theorem 3.1 O(log n) times, and taking the smallest returned se- quence of edits, one can further ensure that Equation (3.1) will hold with high probability. An important corollary of Theorem 3.1 is for the case where x is fully random. Corollary 3.2. There is an algorithm which, given a random string x ∈ Σn, and an arbitrary string y ∈ Σn, finds a sequence of O(ed(x, y)) edits between x and y in time O(n), with high probability. Proof. This follows from Theorem 3.1, and the fact that x will be (Ω(1), O(log n))-pseudorandom with high probability (See 2.2 of [2]). (cid:3) For the rest of the section, we will assume without loss of generality that n is a multiple of 6B. Notice that by padding x with null characters, one can ensure that the last block is of length 6B without increasing M (x), and furthermore, if one places the same padding on y, then the edit distance between the padded strings will be the same as between the original strings. For the rest of the section, let n, p, B, x, y be as de- fined in Theorem 3.1, and assume that 6B n. In order to prove Theorem 3.1, we will reduce it to a combinato- rial problem which we call the Clean Alignment Prob- lem. Formally, Theorem 3.1 can be viewed as presenting a O(nB)-time solution to the Pseudorandom Edit Dis- tance Problem, defined as follows. • The Pseudorandom Edit Distance Problem (PEDP): Given x ∈ Σn and an arbitrary y ∈ Σn, recover a sequence of t edits from x to y for t satisfying E[t] ≤ O(1/p · ed(x, y) + M (x)). We will reduce PEDP to the Clean Alignment Problem, defined below. Specifically, any algorithm for the Clean Alignment Problem which runs in time T (n) will imply an algorithm for PEDP which runs in time O(T (n) · B). • The Clean Alignment Problem: Consider strings x and y of possibly different lengths. Let f : [x] × [y] → {0, 1} be a comparison function If f (i, j) = 1, we say that xi edit for x and y. matches with yj. An alignment A (i.e., a non-crossing matching) between the letters of x and the letters of y is said to be an edit-matching alignment if every edge (xi, yj) ∈ A satisfies f (i, j) = 1. The cost of an alignment is defined asymmetrically: The x- portion cost of A is the number of letters in x to be unmatched by A; the y-portion cost is the number of i for which yi, yi+1, . . . , yi+6 are all unmatched by A. The cost of A is the sum of the x-portion and y-portion costs. An edit-matching alignment is said to be clean if for all (xi, yj) ∈ A, xi is the only letter in x which edit matches with yj, and yj is the only letter in y which edit matches with xi. Given x, y, and f , the goal of the Clean Alignment Problem is to recover a (not necessarily clean) edit-matching alignment between x and y whose expected cost is within a constant factor of the optimal cost of a clean edit-matching alignment. We remark that the difficulty of the Clean Align- ment Problem comes from the fact that the function f in the Clean Alignment Problem needs not satisfy any nat- ural properties (such as e.g., some form of transitivity). Thus the only way to determine whether f (i, j) = 1 for two letters xi and yj, is to explicitly evaluate f (i, j). In order for an algorithm to run in time O(n), as desired, it must very selectively determine for which values of i and j to query f (i, j). The reader may notice that the Clean Alignment Problem is completely determined by f , x, and y. That is, the actual contents of x and y are irrelevant. Nonetheless, for ease of presentation, we include x and y as inputs. For examples of a comparison function f , and of clean edit-matching alignments, see Figure 1. The remainder of the section is outlined as follows. In Subsection 3.1 we present an algorithm for the Clean Alignment Problem which runs in near linear time. In Subsection 3.2, we then present a reduction from PDEP to the Clean Alignment Problem, completing the proof of Theorem 3.1. 3.1 The Clean Alignment Problem In this sec- tion we present an approximation algorithm for the Clean Alignment Problem. The algorithm is given by Algorithm 1, and the key properties of the algorithm are stated in Theorem 3.3. For this section, consider u, v ∈ Σ≤n (meaning they are of length at most n over the alphabet Σ), and let Π(u, v) denote the edit-matching alignment given by the output of Algorithm 1 on u and v. Moreover, let T be an optimal clean edit-matching alignment between u and v. Theorem 3.3. Algorithm 1 can be evaluated in time O(n). Moreover, if t is the cost of T , then the the expected number of edges in T \ Π(u, v) is at most O(t), in expectation. Note that removing an edge from an edit-matching alignment can increase each of the u-portion and the v- portions of the cost by at most 1 each. Thus Theorem 3.3 implies that Algorithm 1 achieves constant multi- plicative error, in expectation, for the Clean Alignment Problem. Corollary 3.4. Algorithm 1 solves the Clean Align- ment Problem in time O(n). approximation ratio O(log n), in expectation. The key difference between Algorithm 1 and the embedding of [11] is that Algorithm 1 is permitted to try O(log n) options for pivots in order to find a "good" one, while the embedding of [11] (by virtue of being oblivious to y) is forced to blindly select a pivot. Surprisingly, this minor difference allows for the more sophisticated analysis of Algorithm 1 below, resulting in a constant expected approximation ratio. Before analyzing Algorithm 1, we first introduce several conventions for talking about the algorithm's subproblems. Definition 3.6. Consider a subproblem A which in- volves a substring ui ··· uj of u and a substring vk ··· vl of v. We call ui ··· uj the u-chunk of A and vk ··· vl the v-chunk of A. Definition 3.7. We say that the pivot options for A are the ui's in the middle half of A's u-chunk (i.e., 4u ≤ i ≤ ⌈ 3 1 4u⌉). Moreover, we say a pivot option ui is a valid pivot if f (i, j) = 1 for exactly one vj in the v-chunk of A. Definition 3.8. For any subproblem A, we define T ∩ A to be the set of edges in T which go between the u- chunk and v-chunk of A. That is, T ∩ A is formally T ∩ {(ui, vj) ui ∈ a, vj ∈ b}, where a is the u-chunk and b is the v-chunk of A. We classify subproblems into two types, live sub- problems and dead subproblems. Dead subproblems will act essentially as base cases in the analysis of the algorithm. Live subproblems, on the other hand, will prove far more interesting to analyze. Definition 3.9. We call a subproblem with u-chunk a and v-chunk b dead if at least one of the following holds: • b ≥ 8a + 12 or a ≥ 2b. • a = 0. • At least a/10 elements of a are not matched by T to an element of b. Otherwise, we call the subproblem live. Remark 3.5. Algorithm 1 is motivated in part by our previous work on efficiently embedding Ulam distance (edit distance over permutations) into Hamming space In with (optimal) expected distortion O(log n) [11]. particular, a similar analysis to that of [11] could be employed in order to prove that Algorithm 1 has One important property of live subproblems is that they have many valid options for the algorithm to select as a pivot. Lemma 3.10. For a live subproblem A, at least 4/5 of A's pivot options are valid pivots. y: y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 x: x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 (a) An edge is drawn between xi and yj if f (i, j) = 1. Edges which are eligible to be used in a clean edit-matching alignment are colored blue. This occurs only when the edge is not incident to any other edges. y: y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 x: x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 (b) A clean edit-matching alignment of cost 15. The x-portion cost is 13 because 13 nodes are left unmatched in x. The y-portion cost is 2 because there are two edge-free contiguous intervals in y of size seven. y: y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 x: x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 (c) A clean edit-matching alignment of cost 14. The x-portion cost is 13 because 13 nodes are left unmatched in x. The y-portion cost is 1 because one edge-free contiguous interval in y of size seven. Figure 1: Two examples of clean edit-matching alignments. Proof. Let a be the u-chunk and b be the v-chunk of A. By the definition of a live subproblem, fewer than 1/10 of the elements in a fail to be matched by T to an element of b. Since at least 1/2 of the elements of a are pivot options, at least .8 of the pivot options must be matched by T to an element of b. Because T is a clean edit-matching alignment, any pivot-option which is matched by T to an element of b must be a valid pivot. (cid:3) When the algorithm decides on a pivot on which to split a subproblem A, the quality of that pivot can be captured by what we refer to as the cost increase of A: Definition 3.11. For a live subproblem A with sub- problems B and C, we define the cost increase c(A) of A as follows. If the algorithm fails to select a pivot, or selects a pivot ui in A and matches it with some vj for which (ui, vj) ∈ T , then the cost increase is c(A) = 0. Otherwise the cost increase is c(A) = T ∩ A − T ∩ B − T ∩ C. That is, c(A) is the num- ber of edges in T that are cut by the selection of the subproblems B and C. The key technical challenge in the section will be to bound the cost increases summed over all live subproblems. We begin by presenting three properties of live subproblems which will be useful in the analysis. These properties rely on the notion of a position map, defined as follows. Definition 3.12. The position map φ : [u] → [v] maps positions in u to the position in v to which they are assigned by the alignment T . Formally, if ul is edit matched to some vk by T , we define φ(l) = k, and otherwise we recursively define φ(l) = φ(l − 1) (or φ(l) = 1 if l = 1). Lemma 3.13. Suppose a live subproblem A selects some ui as a pivot and matches ui to some vj. Then the following three properties hold: 1. The cost increase of A will be at most φ(i)− j + 1. 2. The letter vφ(i) is contained in A's v-chunk. 3. The size of A's u-chunk is at least max(cid:18)1, φ(ui) − j − 11 8 (cid:19) . Proof. We begin by proving the first property. Since every edge (ur, vs) ∈ T ∩ A either satisfies r ≥ i and Algorithm 1 Approximation Algorithm for The Clean Alignment Problem Input: Strings u, v ∈ Σ≤n, comparison function f . Output: An edit-matching alignment between u and v. 1. If v ≥ 8u + 12 or u ≥ 2v, return ∅. 2. If u = 0, return ∅. 3. For 100 log n attempts: 4um. 4u ≤ i ≤l 3 (a) Randomly sample a letter ui satisfying 1 (b) In time O(v), construct the set S = {j f (i, j) = 1}. (c) If S is of size one, containing a single element j, then: i. Initialize an output set O containing the single edge (ui, vj) ii. Recurse on u1 ··· ui−1 and v1 ··· vj−1, and add the resulting edges to O. iii. Recurse on ui+1 ··· uu and vj+1 ··· vv, and add the resulting edges to O. iv. Return O. 4. Return ∅. s ≥ φ(i) or r < i and s < φ(i), all edges (ur, vs) in the set (T ∩ A) \ ((T ∩ B) ∪ (T ∩ C)) must satisfy the property that s is between j and φ(i) inclusive. The number c(A) of such edges can therefore be at most φ(i) − j + 1. To prove the second property, suppose for contra- diction that vφ(i) is not contained in A's v-chunk. Then because φ is weakly increasing, it must be that vφ(k) is not in A's v-chunk for at least 1/4 of the uk's in A's u-chunk. But this would mean that the subproblem A is dead, a contradiction. Finally, to prove the third property, notice that the second property forces the size of A's v-chunk to be at least φ(ui) − j + 1. By the definition of a live subproblem, it follows that the size of A's u-chunk must be at least max(cid:18)1, φ(ui) − jq − 11 8 (cid:19) , as desired. (cid:3) Next we present the key technical lemma of the section, in which we bound the sum of the cost increases of all live subproblems. Lemma 3.14. Let t be the cost of the optimal clean edit- matching T . Let S be the sum of the cost increases over all live subproblems. Then E[S] ≤ O(t). Proof. Rather than attributing the cost increase c(A) to the subproblem A, we will instead attribute the cost to ui, where ui is the pivot selected within the subproblem. If a letter ui is edit matched by T , then no non-zero cost increase will ever be attributed to it, since the only way ui can be selected as a pivot is if it is to be correctly matched with vφ(i). (Recall, in particular, that T is a clean edit-matching alignment.) If, on the other hand, ui is unmatched by T , then we will prove that the expected sum of cost increases attributed to it is O(1). Since there are O(t) such ui's (recall t is the cost of T ), this will complete the proof. For the rest of the proof, consider some ui not matched by T . By the second part of Lemma 3.13, in order for a subproblem A to attribute its cost increase to ui, it must be that ui is in A's u-chunk and vφ(i) is in A's v-chunk. Moreover, because vφ(i) is in A's v-chunk, there are at most two options for the letter vj which the algorithm pairs ui with -- namely, vj must either the first letter vj1 to vφ(i)'s left for which f (i, j1) = 1, or it must be the first such letter vj2 to vφ(i)'s right. We say that the cost increase of A is attributed to the (ui, vj1 ) pair if j = j1, and is attributed to the (ui, vj2 ) pair if j = j2. For the rest of the proof, we will consider jq for some q ∈ {1, 2}, and show that the total cost increases attributed to the pair (ui, vjq ) is at most O(1), in expectation. Define Rl to be the range [(10/9)lσ, (10/9)l+1σ], for l ≥ 0 and for σ = max(cid:18)1, φ(i) − jq − 11 8 (cid:19) . 1 For each Rl, there is at most one live subprob- lem A whose u-chunk both has a size in the range Rl and contains ui. Moreover, by Lemma 3.10, the prob- ability that the subproblem picks ui as a pivot is at most O(cid:16) (10/9)lσ(cid:17). Since any live subproblem which at- tributes its cost increase to the pair (ui, vjq ) must have its u-chunk be of a size at least σ (by the third part of Lemma 3.13), the u-chunk's size must be in one of the ranges Sl. It follows that the expected number of subproblems which attribute their cost increase to the pair (ui, vjq ) is at most O ∞ Xl=0 1 (10/9)lσ! ≤ O(cid:18) 1 σ(cid:19) = O(cid:18) 1 φ(i) − jq(cid:19) . By the first part of Lemma 3.13, each such subproblem has cost increase O(φ(i)− jq). It follows that the total cost attributed to the pair (ui, vjq ) is at most O(1), in expectation, completing the proof. (cid:3) Lemma 3.14 shows that the algorithm behaves well on live subproblems. In order to show that the same is true for dead subproblems, we introduce the notions of induced and surplus costs. Definition 3.15. The induced cost of a subproblem A with u-chunk a and v-chunk b is the cost of the clean edit-matching alignment between a and b obtained by restricting T to the two substrings (i.e., the alignment with edges T ∩ A). The surplus cost of the subproblem is the number of edges in T between a and b that do not appear in the algorithm's output (i.e., (cid:12)(cid:12)(cid:12) (T ∩ A) \ Π(u, v)(cid:12)(cid:12)(cid:12) The ratio of a subproblem's induced cost to its surplus cost is a natural measure of how well Π performs on the subproblem. The next lemma shows that, in this regard, Algorithm 1 behaves well on dead subproblems. ). Lemma 3.16. The surplus cost of the return value of a dead subproblem is at most O(c), where c is the induced cost of the subproblem. Proof. Let a be the u-chunk and b be the v-chunk of a dead subproblem. is 0, and is thus trivially at most O(c). If a = 0, then the surplus cost of the subproblem In the remaining cases, we will show that the induced cost c is at least Ω(a), making the surplus cost O(c) trivially. If at least 1/10 of the elements of a are not matched by T to an element of b, then the induced cost c is at least a/10, as desired. Similarly, if a ≥ 2b, then at least half of the elements of a will not be matched by an T , implying that the induced cost c is at least a/2. If b ≥ 8a + 12, then the b-portion cost of any edit-matching alignment between a and b must be at least a. In particular, the number of edges in such an alignment can be at most a, and each edge can be contained in at most 7 contiguous substrings of length 7 in b. As a result, at most 7a of the contiguous substrings of length 7 in b can contain a letter incident to an edge. Since b contains at least 8a contiguous substrings of length 7, the b-portion cost of any edit matching alignment must be at least a. (cid:3) Combining Lemmas 3.14 and 3.16, we are now prepared to prove Theorem 3.3. Proof. [Proof of Theorem 3.3] It is straightforward to prove that Algorithm 1 runs in time O(n). For the rest of the proof we focus on the cost of the edit-matching alignment Π given by the algorithm. Specifically, we wish to show that the number of edges in T \ Π is at most O(t) in expectation. Consider a live subproblem A. By Lemma 3.10, each of the 100 log n attempts at selecting a pivot will succeed with probability at least .8, and with probability greater than 1 − 1 n100 , a pivot will end up being selected. Since there are O(n) subproblems in the entire algorithm, with probability at least 1 − O(cid:0) 1 n99(cid:1), every live subproblem will succeed in one of its 100 log n attempts to spawn recursive children. Noting that the number of edges in T \Π(u, v) is at most O(n), it follows that the cases where some live subproblem fails to spawn children have negligible impact on E[T \ Π(u, v)]. For the rest of the proof, we will condition on all live subproblems succeeding at spawning children. Recall that c(A) denotes the cost increase of a live subproblem A. For a live subproblem A with children subproblems B and C, we also define the induced cost increase c′(A) to be the induced cost of B plus the induced cost of C minus the induced cost of A. Note that c′(A) ≤ 2c(A), since the increases in induced cost between A and its subproblems B and C can be attributed to the removals of edges. (Recall that the removal of an edge from an edit-matching alignment increases each of the u-portion cost and v-portion cost by at most one.) Let I be the sum of the cost increases over all live subproblems, and I ′ be the sum of the induced cost increases over all live subproblems. Note that the induced cost of the root subproblem is precisely the cost t of the optimal clean edit-matching alignment T . Call a dead subproblem fresh if its parent subproblem is live. Then the sum of the induced costs of all fresh dead subproblems is exactly t + I ′. By Lemma 3.16, it follows that the sum S of the surplus costs of all fresh dead subproblems is at most O(t + I ′). Since I ′ ≤ 2I, we have that S ≤ O(t + I). Observe that T \ Π(u, v) is precisely I, the sum of the cost increases over all live subproblems, plus S, the sum of the surplus costs over all fresh dead subproblems. Thus T \ Π(u, v) ≤ O(I + S) ≤ O(t + I). By Lemma 3.14, E[I] ≤ O(t), completing the proof. (cid:3) 3.2 Reduction to The Clean Alignment Prob- lem In this section, we prove the following theorem: Theorem 3.17. Suppose there is an algorithm for the Clean Alignment Problem that runs in time O(n). Then there is an algorithm for the Pseudorandom Edit Dis- tance Problem which runs in time O(nB). Before proving Theorem 3.17, we combine it with Corollary 3.4 in order to complete the proof of Theorem 3.1, establishing an efficient solution to the Pseudoran- dom Edit Distance Problem. it Proof. [Proof of Theorem 3.1] By Theorem 3.17, suffices to present a solution to the Clean Alignment Problem which runs in time O(n). Corollary 3.4 gives such a solution. (cid:3) The reduction which we will use to prove Theorem 3.17 can be easily stated: Recall that x1, x2, . . . , xn/6B breaks x into blocks of length 6B. Let y1, . . . , yn/3B be y broken into blocks of size 3B. Let r be the starting index r = (j − 1) · 3B + 1 of the block yj−1. We say that xi partially edit matches with yj if there is some s = r + t · pB/100 with t ∈ {0, . . . , 300/p − 1} such that ys ··· ys+6B−1 has edit distance no greater than pB/8 from xi. That is, xi partially edit matches yj if there is a 6B-letter substring a of y such that (1) a's start position appears in yj−1; (2) a's zero-indexed start position is a multiple of pB/100; and (3) ed(a, xi) ≤ pB/8. Note that xi can only partially edit match with yj for values of j ≥ 2. We say that xi (fully) edit matches with yj if xi partially matches with yj but does not partially match with yj−1. In order to prove Theorem 3.17, we will show that in order to solve the Pseudorandom Edit Distance Problem on x and y, it suffices to solve the Clean Alignment Problem on (x1, . . . , xn/6B) and (y1, . . . , yn/3B), with f (i, j) defined to indicate whether xi and yj edit match. We begin by deriving several important properties of this definition of edit matching. Recall that a block xi is p-unique if its B-letter substrings are all of edit distance at least pB from the B-letter substrings not intersecting xi. Lemma 3.18. Suppose xi and xj both partially edit match with yk. Then neither xi nor xj are p-unique. Proof. Since xi partially edit matches with yk, there is a substring a of xi which is within pB/8 edits of yk (because xi must be within pB/8 edits of a string containing yk) . Similarly, there is a substring b of xj which is within pB/8 edits of yk. By the triangle inequality, ed(a, b) ≤ pB/4. It follows that the first B letters of a are within pB/2 edits of the first B letters of b. (Indeed, if we consider an optimal sequence of edits from a to b restricted to the first B letters of a, then that sequence of edits must result in a string of length no more than ed(a, b) ≤ pB/4 away from B.) Therefore, neither xi nor xj are p-unique. (cid:3) For the rest of the subsection, fix an optimal substitution-free sequence of edits A between x and y. (That is, A consists only of insertions and deletions.) We will sometimes view A as a sequence of edits, and other times consider it as a non-crossing matching between the letters in x and those in y such that each edge must be between two letters of the same value; the insertions and deletions correspond with letters which are left unmatched. As such, we will often refer to A as an alignment, rather than a sequence of edits. Assign each edit in A to a block xi in which it occurs (deciding boundary cases arbitrarily), and define ci to be the number of edits attributed to each block xi. Notice, in particular, that Pi ci = ed(x, y), that each xi is transformed by A into some substring of y via ci edits, and that the concatenation of the resulting substrings of y forms all of y. Similarly, attribute to the blocks of y costs di such that Pi di = ed(x, y) and such that each yi is transformed by di edits into some substring of x. We will use these values ci and di to aid us in our analysis for the rest of the section. We continue by stating another important property of edit matching blocks. We call xj polygamous if it partially edit matches with some yk and yl for which k and l differ by more than one. Otherwise, xj is said to be monogamous, even if it fails to partially edit match with any yk. The next lemma bounds the number of polygamous xj's. Lemma 3.19. The number of letters in polygamous xi's is at most O(cid:16) 1 p ed(x, y) + M (x)(cid:17). Proof. Since only M (x) letters in x reside in non- p-unique blocks, it suffices to show that the num- ber of letters in polygamous p-unique xi's is at most O( 1 p ed(x, y)). Since Pi ci = Pi di = ed(x, y), at most O( 1 pB ed(x, y)) of the ci's and di's can be greater than pB/100. By Lemma 3.18, each yk can be partially edit matched with at most one p-unique xj . Hence the number of letters in p-unique xj 's which either satisfy cj > pB/100 or partially match with some yk for which dk > pB/100, is at most O( 1 pB ed(x, y)). It therefore suffices to bound the number of p- unique xj 's satisfying the following property: xj is polygamous with some yk and yl such that cj, dk, dl ≤ pB/100. We will show that no such xj 's exist, complet- ing the proof. Suppose for contradiction that such an xj exists, and assume without loss of generality that k < l. Let yk be the first third of the block yk, and yl be the final third of the block yl. There must be a substring w1 of x which is aligned by A to yk in at most pB/100 edits. Similarly there must be a substring w2 of x which is aligned by A to yl in at most pB/100 edits. Define w1 and w2 to be minimal such substrings (meaning the first and final letters of each of w1 and w2, respectively, must be incident to edges in A mapping to letters in yk and yl, respectively). Because yk and yl are separated by 7B letters, w1 and w2 cannot both intersect xi, since this would cause ci to be at least B. Let t ∈ {1, 2} be such that wt does not intersect xi. Because xi partially edit matches with yk and yl, it must be that yk and yl are each within pB/8 edits of some substrings b1 and b2 of xi. (Recall, in particular, that if xi partially edit matches to a block, then xi must be within pB/8 edits of a string containing that block.) Thus wt must each be within edit distance pB/8 + pB/100 ≤ pB/4 of a substring b ∈ {b1, b2} of xi. Since min(ed(wt, yk), ed(wt, yl)) ≤ pB/100 and min(ed(b, yk), ed(b, yl)) ≤ pB/8, it must be that wt is of length within pB/100 of B and b is of length within pB/8 of B. It follows that there is a B-letter substring of xi within edit distance pB/100 + pB/8 + pB/4 < pB of a B-letter substring not intersecting xi. This prevents xi from being p-unique, a contradiction. (cid:3) Armed with the preceding lemmas, the next lemma presents the basic mechanism through which a solution to the Clean Alignment Problem can be transformed into a solution to the Pseudorandom Edit Distance Problem. (Note that the lemma does not use the fact that the output of the Clean Alignment Problem is an alignment rather than a matching; in fact it turns out the non-crossing property of the output is not necessary for our reduction.) Lemma 3.20. Let E be a set of disjoint edges between {xi} and {yi} such that for all e = (xi, yj) ∈ E, xi edit matches with yj. Let t be the number of letters in x which reside in a block unmatched by E. Then in time O(Bn log n), one can recover from E a sequence of xi's. p ed(x, y) + M + t(cid:17) edits from x to y. O(cid:16) 1 p ed(x, y)(cid:17) Proof. Because Pi ci = ed(x, y), all but O(cid:16) 1 of the letters in x are contained in xi's satisfying ci ≤ pB/100. Moreover, by Lemma 3.19, at most p ed(x, y) + M(cid:17) letters are contained in polygamous O(cid:16) 1 Now consider a monogamous xi for which ci ≤ pB/100. We claim that xi must partially edit match to a yj which is within fewer than 6B positions of where xi is mapped to by A (meaning each letter in xi that is matched by A is matched to a letter within fewer than 6B positions of yj). In particular, if A transforms xi into a substring of y beginning at some yk, then because ci ≤ pB/100, it must be that ed(xi, yk ··· yk+6B−1) ≤ pB/50. If we define k′ to be k rounded down to the nearest position whose zero- indexed position is a multiple of pB/100, then it follows that ed(xi, yk′ ··· yk′+6B−1) ≤ pB/25. If we define k′′ to be k′ rounded up to the next multiple of 3B, then xi partially edit matches with yk′′/3B. By construction of yk′′/3, each letter in xi that is matched by A is matched to a letter within fewer than 6B positions of yk′′/3B. Since xi partially edit matches with yj and xi is monogamous, the unique yj ′ to which xi edit matches must satisfy j′ ∈ {j − 1, j}. This, in turn, means that every letter in xi which is matched by A to a letter in y is matched to a letter in y within fewer than 9B positions of yj ′ p ed(x, y) + M(cid:17) of the letters in x reside in blocks xi which are monog- amous and satisfy ci ≤ pB/100. Moreover, of these letters, all but at most t of them reside in a block xi which is edit matched by E. Hence, with the exception of xi's containing a total of at most O( 1 p ed(x, y)+M +t) letters, every xi is edit matched by E to a single yj, and any edges in the alignment A between a letter in xi and a letter in y have to concern a letter in y within fewer than 9B positions of yj. Recall that all but at most O(cid:16) 1 Define j to be k′′/3B. . Consider the set T of edges between letters in x and y, where an edge (xr, ys) is included if xr is in some xi which is matched by E to some yj within fewer than 9B positions of ys. Note that T contains at most O(nB) edges. We have shown that the intersection between T and the edges in the alignment A yields an alignment which matches all but at most O(ed(x, y)+M +t) letters of x (and thus also of y since y = x). Applying Lemma 3.1 of [2], which finds the optimal alignment restricted to a set T of edges in time O(T log n), it follows that we can recover a sequence of O(ed(x, y) + M + t) edits from x to y in time O(Bn log n). (cid:3) To complete the proof of Theorem 3.17 using Lemma 3.20, it suffices to show that any optimal clean edit-matching alignment between (x1, . . . , xn/6B) and (y1, . . . , yn/3B) leaves no more than O(ed(x, y) + M ) letters unmatched. We begin by analyzing the cost of an optimal (possi- bly crossing) edit matching. An edit matching between (x1, . . . , xn/6B) and (y1, . . . , yn/3B) is a matching whose edges are between edit-matched xi's and yj's. The cost of an edit matching is defined in the same asymmetric manner as the cost of an edit-matching alignment. Lemma 3.21. Let T be a minimum-cost edit matching between (x1, . . . , xn/6B) and (y1, . . . , yn/3B). Then the cost of T is at most O 1 p ed(x, y) + M B ! . Proof. Recall that any block xi with ci ≤ pB/100 partially edit matches to some yj, and thus also edit matches to some yj. (See the proof of Lemma 3.20.) It follows that all but O(cid:16) 1 match with some yj. pB ed(x, y)(cid:17) of the blocks xi edit pB ed(x, y) + M/B(cid:17) of By Lemma 3.18, all but O(cid:16) 1 the xi's edit match with some yj that doesn't edit match with any other xi′ It follows that there is an edit matching between (x1, . . . , xn/6B) and (y1, . . . , yn/3B) 's. matched. The x-portion cost of such an edit matching T is at in which all but O(cid:16) 1 most O(cid:16) 1 plied to T to recover a sequence of O(cid:16) 1 pB ed(x, y) + M/B(cid:17) of the xi's are pB ed(x, y) + M/B(cid:17). Lemma 3.20 can be ap- p ed(x, y) + M(cid:17) edits from x to y. Recall that the sequence of edits re- covered by Lemma 3.20 removes any letters in y which are not within fewer than 9B positions of some yi that is matched by T . Hence, given any seven adjacent yi's left unmatched by T (corresponding with 21B unmatched letters), the middle yi of the seven must incur 3B ed- its in the process described by Lemma 3.20. Since only O(cid:16) 1 p ed(x, y) + M(cid:17) edits can be incurred in total, the y-portion cost of T cannot exceed O 1 p ed(x, y) + M B ! . This completes the proof of the lemma. (cid:3) The preceding lemma bounds the cost of a minimum-cost edit matching. The next lemma will allow us to bound the cost of a minimum-cost edit- matching alignment. In particular, the lemma shows that in any edit matching, the crossings can be elimi- nated by removing only edges that are incident to an xi with one of three properties: xi is either polyga- mous, non-p-unique, or satisfies ci ≥ pB/100. Since one can bound the number of such xi's, it follows that we can transform any edit matching into an edit-matching alignment by removing only a small number of edges. Lemma 3.22. Suppose that for i < j and k ≤ l, xi edit matches with xl and xj edit matches with xk. Then either max(ci, cj) ≥ pB/100, or at least one of xi or xj are either polygamous or non-p-unique. Proof. If both ci and cj are smaller than pB/100, then the alignment A tells us how to partially edit match xi and xj each to some yq and yr with q ≤ r (as done in the proof of Lemma 3.20). If q = r,then by Lemma 3.18, neither xi nor xj are p-unique. If q < r and both xi and xj are monogamous, then since k ≤ l, it follows that k = l. But by Lemma 3.18, this prevents either xi or xj from being p-unique. Therefore, if both ci and cj are less than pB/100, then at least one of xi or xj are either polygamous or non-p-unique. (cid:3) Finally, we can now bound the cost of an optimal clean edit-matching alignment. Lemma 3.23. Let T be a minimum-cost clean edit- matching and (y1, . . . , yn/3B). Then the cost of T is at most between (x1, . . . , xn/6B) alignment O 1 p ed(x, y) + M B ! . B (cid:17). the cost of T0 By is no greater than Proof. Consider an optimal edit-matching T0. Lemma 3.21, p ed(x,y)+M To obtain T , remove from T0 any edges involving some xi such that either ci < pB/100, xi is polygamous, O(cid:16) 1 pB (cid:17) or xi is non-p-unique. This removes at most O(cid:16) ed(x,y) xi's with ci < pB/100, at most O(cid:16) 1 pB ed(x, y) + M/B(cid:17) xi's which are polygamous (Lemma 3.19), and at most M/B xi's which are not p-unique. Since each edge-removal can increase the x-portion and y-portion costs each by at most one, the cost of T is at most p ed(x,y)+M B O(cid:16) 1 (cid:17). By Lemma 3.22, T has no crossings. Moreover, because T does not match any polygamous xi's, and because by Lemma 3.18 T does not match any yj's that edit match to more than one xi, T is a clean edit- matching alignment. (cid:3) Theorem 3.17 follows easily from the preceding lemmas. Proof. [Proof of Theorem 3.17] We will assume without loss of generality that p ≥ 1/B, since otherwise we may replace p with 1/B without changing the definition of p-unique blocks. Suppose there is an algorithm for the Clean Align- ment Problem that runs in time O(n) and returns a clean edit-matching alignment whose cost is within a factor of O(1) of optimal, in expectation. For a given i and j, determining whether xi edit matches yj can be done in time O(cid:0)B2(cid:1). In particular, we need only compute the edit distances between xi and O(1/p) substrings of y. Denote these substrings by a1, . . . , aq. For each as, we wish to determine whether ed(xi, as) ≤ pB/8. Using the exact algorithm of [15], which computes ed(u, v) in time O(u +v + ed(u, v)2), determining whether ed(xi, as) ≤ pB/8 can be done in time O(cid:16)B + (pB)2(cid:17) ≤ O(pB2). Performing O(1/p) such computations in order to determine whether xi edit matches with yj therefore takes time O(B2). Thus the algorithm for the Clean Alignment Prob- lem can be employed to find a clean edit-matching alignment between (x1, . . . , xn/6B) and (y1, . . . , yn/3B) in time The cost t of this alignment will have expected value at most O(cid:0)(n/B)B2(cid:1) = O (nB) . O 1 ! , p ed(x, y) + M B by Lemma 3.23. By Lemma 3.20, one can then recover in time O(Bn log n) a sequence of t′ edits from x to y satisfying E[t′] ≤ O(cid:18) 1 p ed(x, y) + M(cid:19) , as desired. (cid:3) Remark 3.24. When p2 ≥ 1 B , we can use the bound O(B + (pB2)) ≤ O(p2B2) (rather than bounding the quantity by pB2) in order to prove a slightly better runtime of O(p · nB). 4 Determining parameters p and B In this section, we consider the situation where the pa- rameters p and B are not known beforehand. Through- out the section, for a string x, and parameters p and B, we define Mp,B(x) (often abbreviated by Mp,B) to be the quantity M (x) defined in Section 3 (in which the parameters p and B were implicit). We consider two settings. In the first setting, we are given two strings x and y and wish to compute ed(x, y) within a factor of O(α) as fast as possible. Theorem 4.1 gives an algorithm for this problem which runs in time O(n4/3B2/3), where B is the smallest block size for which the string x is (α, B)-pseudorandom. Theorem 4.1. Let x and y be strings in Σn. Let α > 1 be an approximation threshold, and suppose there is a power-of-two block-size B for which the string x is (1/α, B)-pseudorandom. Then without knowing B beforehand, one can still (with high probability) ap- proximate ed(x, y) within a factor of O(α) in time O(n4/3B1/3). Moreover, (1/α, B)- pseudorandom, it suffices that M1/α,B(x) < n2/3 · B1/3. rather being than x In the second setting we consider, one is given a source string x which one intends to compare with many other strings y. Defining α and B as before, we present an O(n1.5(√B + α))-time algorithm for preprocessing x, so that any edit distance computation ed(x, y) can later be α-approximated in time O(nB). Theorem 4.2. Let x be a string in Σn. Let α > 1 be an approximation threshold, and suppose there is a power- of-two block-size B for which the string x is (1/α, B)- pseudorandom. Then without knowing B beforehand, one can (with high probability) construct an algorithm S in time O(n1.5(√B + α)) so that S is an O(nB)-time algorithm for approximating ed(x, y) within a factor of O(α) (with high probability) for arbitrary strings y ∈ Σn. (1/α, B)- pseudorandom, it suffices that M1/α,B(x) < n1/2 · B1/2. Moreover, rather being than x The proofs of Theorems 4.1 and 4.2 will rely on the following lemma: Lemma 4.3. Consider a string x of length n, and a parameter B ∈ N such that B is a power of two. Then for any threshold nǫ and value p = 1 2j , there is an algorithm which runs in time O(n2−ǫ(B + 1/p2)), and which with high probability returns true if Mp/2,B ≤ nǫ/2, and false if Mp,B > 2nǫ. the algorithm may return true or false arbitrarily.) (Otherwise, Proof. We will assume without loss of generality that n is a multiple of 6B, since otherwise x can be padded with null characters to be a length divisible 6B, without changing Mp,B. Let x1 ··· xn/6B be the 6B-letter blocks that make up x. Let c be a sufficiently large constant. The algorithm uses a simple random sampling approach. We randomly sample s = cn1−ǫ log n blocks xi1 , . . . , xis from x. For each of these blocks xil , we will perform a test on xil which returns true if xil is (p/2)-unique, returns false if xil is not p-unique, and may return either true or false otherwise. (We will describe how this test, which we call the uniqueness test, works at the end of the proof.) Let r be the number of xil 's for which the uniqueness test returns false. Because the uniqueness test returns true whenever xil is (p/2)-unique, Mp/2,B = Mp/2,B · c log n . E[r] ≤ s · n nǫ Thus if Mp/2,B ≤ nǫ/2, then E[r] ≤ c 2 log n, which by a Chernoff bound means that (for c large enough) with high probability r < c log n. On the other hand, because the uniqueness test returns false whenever xil is not p- unique, E[r] ≥ s · Mp,B n = Mp,B · c log n nǫ . Thus if Mp,B ≥ 2nǫ, then E[r] ≥ 2c log n, which by a Chernoff bound means that (for c large enough) r > c log n with high probability. It follows that by returning whether r ≤ c log n, our algorithm will with high probability return true if Mp/2,B ≤ nǫ/2, and return false if Mp,B > 2nǫ. In the remainder of the proof, we describe the uniqueness test for a given block xil , and evaluate the runtime of the algorithm. The uniqueness test for xil examines every B-letter substring a in x such that a does not intersect xil and such that a ends in a position divisible by pB 8 ; and also examines each B- letter substring b in x that is contained entirely in xil and ends in a position divisible by pB 8 . For each such pair a and b, the algorithm uses the low-distance regime algorithm of [15] to determine in time O(B + p2B2) whether ed(a, b) ≤ pB/2. The uniqueness test returns true if and only if ed(a, b) ≤ pB/2 for all such a and b. Notice that if xl is (p/2)-unique, then the uniqueness test will necessarily return true. Moreover, if the uniqueness test returns true, then for every B- letter substring a′ in x not intersecting xl, and every B-letter substring b′ in xl, it must be that ed(a, b) ≤ pB/2 + 4 pB 8 ≤ pB, meaning that xl is p-unique. Hence the uniqueness test satisfies both properties required from it. Finally, we evaluate the runtime of our algorithm. Since there are O(n/(pB)) options for a and O(1/p) options for b in each uniqueness test, each uniqueness test runs in time O(cid:18) n pB · 1 p · (B + p2B2)(cid:19) ≤ O(nB + n/p2). Since our algorithm runs O(n1−ǫ) uniqueness tests, the full runtime is O(n2−ǫ(B + 1/p2)). (cid:3) Using Lemma 4.3, we now prove Theorem 4.1. Proof. [Proof of Theorem 4.1] Assume without loss of generality that α is a power of two. To accomplish the desired time bound, we run two algorithms in parallel. The first algorithm is the low-distance regime algorithm of [15] which runs in time O(n + ed(x, y)2). The second algorithm considers values Bi = α · 2i for i = 0, 1, 2, . . ., and applies Lemma 4.3 to each Bi with p = 2 α and nǫ = 2n2/3 · α2/3 · (Bj + α2)1/3; upon finding a Bj for which Lemma 4.3 returns true, the algorithm approximates ed(x, y) in time O(n · Bj) by treating x as (2/α, Bj)- pseudorandom. If the low-distance regime algorithm finishes first, If the second then we can return ed(x, y) exactly. algorithm terminates first, then we continue to run the low-distance regime algorithm until it has run for time Θ(n4/3 · α2 · (Bj + α2)2/3), and only if the low- distance regime algorithm does not terminate in that time window do we use the output of the second algorithm. Because p = 2 α and nǫ = 2n2/3 · α2/3 · (Bj + α2)1/3, the second algorithm's runtime will be (4.2) O(n2−ǫ(Bj + 1/p2)) = O(n4/3(Bj + α2)2/3/α2/3) ≤ O(n4/3(B2/3 ≤ O(n4/3B2/3 j + α2/3)) ). j Notice that Lemma 4.3 guarantees with high probability that Bj ≤ B (because M1/α,B < n2/3 · B1/3), meaning that with high probability our algorithm achieves run- time O(n4/3B2/3), as desired. To prove the accuracy of our algorithm, consider the case where the output is determined by the second algorithm. By Lemma 4.3, with high probability, M2/α,Bj ≤ 2nǫ = 4n2/3 · α2/3 · (Bj + α2)1/3. By (the high-probability version of) Theorem 3.1, it follows that the second algorithm will find a sequence of t edits for some t satisfying (4.3) t ≤ O(α ed(x, y) + n2/3 · α2/3 · (Bj + α2)1/3), with high probability. Moreover, because the low- distance regime algorithm did not finish in the time O(n4/3(Bj + α2)2/3/α2/3), it must be that ed(x, y) ≥ n2/3 · (Bj + α2)1/3/α1/3. Plugging this into Equation (4.3), we get that t ≤ O(α ed(x, y)), as desired. (cid:3) Finally, we prove Theorem 4.2. Proof. [Proof of Theorem 4.2] We assume without loss of generality that α is a power of two. Our preprocessing step goes as follows. We consider values Bi = α2i for i = 0, 1, 2, . . ., and apply Lemma 4.3 to each Bi with p = 2 α and nǫ = 2n1/2 · (Bj + α2)1/2; upon finding a Bj for which Lemma 4.3 returns true, we have completed the preprocessing step. Note that the preprocessing step takes time O(n2−ǫ(Bj + α2)) is practical for real-world inputs. In particular, for what parameters p and B do real-world inputs tend to be (almost) (p, B)-pseudorandom? • On the theoretical side, it is interesting to note that in the smoothed complexity model the algorithm of [2] achieves sublinear runtime for strings x and y of sufficiently large edit distance apart. Can such a result be replicated in our pseudorandomness model? Acknowledgments The author would like to thank Moses Charikar for his mentoring and advice throughout the project. The author would also like to thank Ofir Geri for many useful conversations, and Michael A. Bender for his advice during the writing pro- cess. This research was supported in part by NSF Grants = O(n1.5qBj + α2), and since with high probability Bj will be at most B (by Lemma 4.3 and because of the fact that M1/α,B < n1/2· B1/2), it follows that with high probability the runtime of the preprocessing step is at most O(n1.5√B + α2), as desired. Given a string y, we can then approximate ed(x, y) as follows. We first run the low-distance regime algo- rithm of [15] for time Θ(n· Bj), and if it completes then we return its output. Otherwise, we may conclude that (4.4) ed(x, y) ≥pnBj. In the latter case, we treat x as (2/α, Bj)-pseudorandom and generate an estimate for ed(x, y) in time O(n · Bj) (using the high-probability version of Theorem 3.1). By Lemma 4.3, we know that with high probability M2/α,Bj ≤ 2nǫ = 4n1/2 · (Bj + α2)1/2. By Theorem 3.1, it follows that with high probability the number of edits t which we find between the strings x and y will satisfy t ≤ O(cid:16)α ed(x, y) + n1/2 · (Bj + α2)1/2(cid:17) ≤ O(cid:16)α ed(x, y) + α · n1/2 · B1/2 j (cid:17) . By (4.4), we get t ≤ O(α ed(x, y)), as desired. 5 Conclusion In this paper, we have proposed a natural model of pseudorandomness for strings which allows for edit distance to be efficiently approximated. We conclude by presenting two directions for future work. (cid:3) • One important direction for future work is to inves- tigate the degree to which the algorithm presented 1314547 and 1533644. References [1] Stephen F. Altschul, Thomas L. Madden, Alejandro A. Schaffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman. Gapped blast and psi-blast: a new generation of protein database search programs. Nucleic acids research, 25(17):3389 -- 3402, 1997. [2] Alexandr Andoni and Robert Krauthgamer. The smoothed complexity of edit distance. ACM Trans- actions on Algorithms (TALG), 8(4):44, 2012. [3] Alexandr Andoni, Robert Krauthgamer, and Krzysztof Onak. Polylogarithmic approximation for edit distance and the asymmetric query complexity. In Proceedings of the 51st Annual Symposium on Foundations of Computer Science (FOCS), pages 377 -- 386, 2010. [4] Alexandr Andoni and Krzysztof Onak. Approximating edit distance in near-linear time. SIAM J. Comput., 41(6):1635 -- 1648, 2012. [5] Arturs Backurs and Piotr Indyk. Edit distance cannot be computed in strongly subquadratic time (unless seth is false). In Proceedings of the 47th Annual Symposium on Theory of Computing (STOC), pages 51 -- 58, 2015. [6] Karl Bringmann and Marvin Kunnemann. Quadratic conditional lower bounds for string problems and dy- namic time warping. In Foundations of Computer Sci- ence (FOCS), 2015 IEEE 56th Annual Symposium on, pages 79 -- 97, 2015. [7] Diptarka Chakraborty, Debarati Das, Elazar Golden- berg, Michal Kouck`y, and Michael Saks. Approxi- mating edit distance within constant factor in truly sub-quadratic time. In Proceedings of the 59th An- nual Symposium on Foundations of Computer Science (FOCS), pages 979 -- 990, 2018. [8] Diptarka Chakraborty, Elazar Goldenberg, and Michal Kouck`y. Streaming algorithms for computing edit distance without exploiting suffix trees. arXiv preprint arXiv:1607.03718, 2016. [9] William I Chang and Jordan Lampe. Theoretical and empirical comparisons of approximate string matching algorithms. In Annual Symposium on Combinatorial Pattern Matching, pages 175 -- 184, 1992. [10] Kun-Mao Chao, William R. Pearson, and Webb Miller. Aligning two sequences within a specified diagonal band. Bioinformatics, 8(5):481 -- 487, 1992. [11] Moses Charikar, Ofir Geri, Michael P. Kim, and William Kuszmaul. On estimating edit distance: Alignment, dimension reduction, and embeddings. In 45th International Colloquium on Automata, Lan- guages, and Programming (ICALP), pages 34:1 -- 34:14, 2018. [12] Dan Gusfield. Algorithms on strings, trees and se- quences: computer science and computational biology. Cambridge University Press, 1997. [13] Bernhard Haeupler, Aviad Rubinstein, and Amir- behshad Shahrasbi. Near-linear time insertion-deletion codes and (1+ε)-approximating edit distance via in- dexing. arXiv preprint arXiv:1810.11863, 2018. [14] Piotr Indyk. Algorithmic aspects of geometric em- beddings (tutorial). In Proceedings of the 42nd An- nual Symposium on Foundations of Computer Science (FOCS), pages 10 -- 33, 2001. [15] Gad M. Landau, Eugene W. Myers, and Jeanette P. Schmidt. Incremental string comparison. SIAM Jour- nal on Computing, 27(2):557 -- 582, 1998. [16] Gad M Landau and Uzi Vishkin. Fast parallel and serial approximate string matching. Journal of algo- rithms, 10(2):157 -- 169, 1989. [17] Bin Ma, John Tromp, and Ming Li. Patternhunter: faster and more sensitive homology search. Bioinfor- matics, 18(3):440 -- 445, 2002. [18] Eugene Wimberly Myers. Incremental alignment algo- rithms and their applications. University of Arizona, Department of Computer Science, 1986. [19] Gonzalo Navarro. A guided tour to approximate string matching. ACM computing surveys (CSUR), 33(1):31 -- 88, 2001. [20] Saul B. Needleman and Christian D. Wunsch. A general method applicable to the search for similarities in the amino acid sequence of two proteins. Journal of molecular biology, 48(3):443 -- 453, 1970. [21] Rafail Ostrovsky and Yuval Rabani. Low distortion embeddings for edit distance. J. ACM, 54(5):23, 2007. [22] Taras K. Vintsyuk. Speech discrimination by dynamic programming. Cybernetics, 4(1):52 -- 57, 1968. [23] Robert A. Wagner and Michael J. Fischer. The string- to-string correction problem. J. ACM, 21(1):168 -- 173, 1974.
1711.01853
1
1711
2017-11-06T12:21:22
Lisco: A Continuous Approach in LiDAR Point-cloud Clustering
[ "cs.DS", "cs.RO" ]
The light detection and ranging (LiDAR) technology allows to sense surrounding objects with fine-grained resolution in a large areas. Their data (aka point clouds), generated continuously at very high rates, can provide information to support automated functionality in cyberphysical systems. Clustering of point clouds is a key problem to extract this type of information. Methods for solving the problem in a continuous fashion can facilitate improved processing in e.g. fog architectures, allowing continuous, streaming processing of data close to the sources. We propose Lisco, a single-pass continuous Euclidean-distance-based clustering of LiDAR point clouds, that maximizes the granularity of the data processing pipeline. Besides its algorithmic analysis, we provide a thorough experimental evaluation and highlight its up to 3x improvements and its scalability benefits compared to the baseline, using both real-world datasets as well as synthetic ones to fully explore the worst-cases.
cs.DS
cs
Lisco: A Continuous Approach in LiDAR Point-cloud Clustering Hannaneh Najdataei, Yiannis Nikolakopoulos, Vincenzo Gulisano, Marina Papatriantafilou Chalmers University of Technology Gothenburg, Sweden {hannajd,ioaniko,vinmas,ptrianta}@chalmers.se 7 1 0 2 v o N 6 ] S D . s c [ 1 v 3 5 8 1 0 . 1 1 7 1 : v i X r a Abstract-The light detection and ranging (LiDAR) tech- nology allows to sense surrounding objects with fine-grained resolution in a large areas. Their data (aka point clouds), gen- erated continuously at very high rates, can provide information to support automated functionality in cyberphysical systems. Clustering of point clouds is a key problem to extract this type of information. Methods for solving the problem in a continuous fashion can facilitate improved processing in e.g. fog architectures, allowing continuous, streaming processing of data close to the sources. We propose Lisco, a single- pass continuous Euclidean-distance-based clustering of LiDAR point clouds, the data processing pipeline. Besides its algorithmic analysis, we provide a thorough experimental evaluation and highlight its up to 3x improvements and its scalability benefits compared to the baseline, using both real-world datasets as well as synthetic ones to fully explore the worst-cases. that maximizes the granularity of Keywords-streaming, clustering, pointcloud, LiDAR I. INTRODUCTION Active sensors that are able to measure properties of the surrounding environment with very fine-grained time resolution are utilized more and more in cyber-physical systems, such as autonomous vehicles, digitalized auto- mated industrial environments and more. These sensors can produce large streams of readings, with the LiDAR (light detection and ranging) sensor being a prominent example. A LiDAR sensor commonly mounts several lasers on a rotating column; at each rotation step, these lasers shoot light rays and, based on the time the reflected rays take to reach back the sensor, they produce a stream of distance readings at high rates, in the realm of million of readings per second. As common in big data applications, one of the challenges in leveraging the information carried by such large streams is the need for efficient methods that can rapidly distill the valuable information from the raw measurements [5], [8], [17], [28]. A common problem in the analysis of the LiDAR sensor data is clustering of the raw distance measurements, in order to detect objects surrounding the sensor [22]. This can, for instance, enable the detection of surrounding obstacles and prevent accidents (e.g. avoiding pedestrians in autonomous driving) or study the motion feasibility of objects in factories' production paths [1]. Challenges and contributions The processing time incurred by clustering of raw mea- surements (aka point clouds) represents one of the main challenges in this context because of the high rates and the need for the clustering outcome to be available in a timely manner for it to be useful. Furthermore, the accuracy of the clustering is challenging as well, since readings from objects that are at different distances from the sensor can vary a lot in density. A key performance enabler for high-rate data streaming analysis is the pipelining of its composing tasks. Neverthe- less, common state-of-the art approaches for clustering of LiDAR data (cf [27], [21], [24] and more detail in § VII elaborating on related work) first organize the points to be clustered (e.g. sorting them so that points close in space are also close in the data structure maintaining them) and only then perform the clustering by querying the organized data (e.g. by running neighbor-query as discussed in § II). By doing this, they introduce a batch based processing that affects the clustering performance. To overcome this, we target a single-pass analysis that will enable fine-grained pipelining in processing the data. We propose a new method that achieves LiDAR data-point clustering, called Lisco, that allows to boost processing throughput by maximizing the internal pipelining of the analysis steps, through a key idea that can exploit the inner ordering of the data generated by a LiDAR sensor. In more detail, we make the following contributions: 1) We introduce Lisco, a new algorithm for Euclidean- distance-based clustering of LiDAR point clouds, that maximizes the granularity of the data processing pipeline, without the need for supporting sorting data structures. 2) We provide a fully implemented prototype and we discuss Lisco's complexity in connection to the state- of-the-art Euclidean-distance-based clustering method in the Point Cloud Library (PCL), which we adopt as baseline due to its known accuracy, efficiency and wide use-base [22].1 3) We perform a thorough comparative evaluation, using both real-world datasets as well as synthetic ones to fully explore the worst-cases and the spectrum of trade-offs. We achieve a significant improvement, up to 3 times faster than the baseline and we also show significant scalability benefits. 1Available through: http://pointclouds.org The rest of the paper is organized as follows. § II overviews the LiDAR sensor, the data it produces and clustering-related techniques that exist for such data. § III presents the main idea, the outline and argues about the properties of the proposed Lisco method, while the algorithmic implementation is given in § IV. We evaluate the proposed method in § VI. Finally, we discuss related work and conclude in § VII and § VIII, respectively. II. PRELIMINARIES In this section, we give details about the key properties of LiDAR sensors and the data they generate. We also provide a detailed problem description and evaluation criteria of solutions. Finally, we briefly describe the Euclidean-distance based clustering method in PCL, which we use as baseline as explained in the introduction. A. LiDAR - sensor and data The light detection and ranging (LiDAR) technology allows sensing surrounding objects with fine-grained resolu- tion in a large areas. The LiDAR sensor mounts L lasers in a column, each measuring the distance from the target by means of the time difference from emitted and reflected light pulses. The column of lasers performs R rotations per second, each consisting of S steps, producing a set of n points, also called point cloud. The number of points reported by the LiDAR sensor for each rotation can be lower than L×S, since some of the emitted pulses might not hit any obstacle. We refer to the angle in the x-y plane between two consecutive steps2 as ∆α (e.g. measured in radians) and to the elevation angle from the x-y plane between two consecutive lasers as ∆θ. Each point p is described through attributes (cid:104)d, l, s(cid:105) where d, l, s are the measured distance, the laser index and the step index. The measured distance, d, is a value greater than or equal to 0. Value 0 for d shows no reflection in the point. In the following, we use the notation px to refer to attribute x of point p (i.e., pd refers to the distance reported for point p). Let us consider in the following examples that L = 8 and S = 8. We visually present the points by unfolding them as a 2D matrix, where each column contains L rows and each rotation step is a column. We assume that new data is delivered from the physical sensor with the granularity of one rotation step (Figure 1). B. Problem formulation: from point clouds to clusters Given a set of points corresponding to LiDAR measure- ments, we want to identify disjoint groups of them that can be potential objects in the environment surrounding the sen- sor. A natural criterion, commonly used in the literature and 2If the horizontal angle between steps is not constant and lasers are not perfectly aligned in the x-y plane, then ∆α refers to the minimum such angle. Similarly, if the vertical angle between lasers is not constant, ∆θ refers to the minimum such angle. applications, is the distance between points. In particular, adopting the problem definition in [20] (Chapter 4), which we paraphrase here for ease of reference: Definition 1. [Euclidean-distance based clustering] Given n points in 3D space, we seek to partition them into some (un- known) number of clusters C using the Euclidean-distance metric, such that every cluster contains at least a predefined number of points (minP ts), that is ∀j,Cj ≥ minP ts, and all clusters are disjoint, that is Ci ∩ Cj = ∅,∀i (cid:54)= j. Two points pi and pj should be clustered together if their Euclidean distance pi − pj2 is at most , with  being a predefined threshold. To facilitate the presentation of the baseline algorithm and our proposed one, we introduce the -neighborhood of a point p: the set of points of the input whose Euclidean distance from p is at most . A set of points closed under the union of their -neighborhoods is characterized as noise if its cardinality is less than minP ts. It should be noticed that, when clustering data from scenarios like the vehicular one, a pre-processing task is usually defined to filter out points that refer to the ground, since many objects laying on it would be otherwise clustered together. Since ground removal can be implemented as a non expensive and continuous filtering operation [10] (e.g. by removing points below a certain threshold, as we do in § VI) we do not further discuss it in the remainder. C. Euclidean-distance based clustering in PCL PCL [22] provides a set of tools based on a collection of state-of-the-art algorithms to process 3D data, including filtering, clustering, surface reconstruction and more. In this section we review its method for cluster extraction, which is an Euclidean-distance based clustering and we use it as a baseline. For brevity we call this algorithm PCL E Cluster in the rest of this document. PCL E Cluster works on batches of data points. It first builds a kd-tree to facilitate finding the nearest neighbors of points. Subsequently, it proceeds as described by algorithm 1 to extract the clusters. Algorithm 1 Main loop of PCL E Cluster 1: clusters = ∅ 2: for p ∈ P do Q = ∅ 3: if p.status (cid:54)= processed then 4: 5: 6: 7: 8: 9: 10: q.status = 'processed' N = GetNeighbors(q, ) Q.addAll(N) Q.add(p) for q ∈ Q do if size(Q) ≥ minPts then clusters.add(Q) Starting from any arbitrary unprocessed point p, the in an empty list, Q (line 5). Then, algorithm adds it Figure 1: Top and side views for the LiDAR's emitted light pulses showing steps and lasers, together with the resulting 2D view. In the 2D view, non-reflected pulses are white while reflected ones are coloured. PCL E Cluster adds all the points of the -neighborhood of each member of Q to it. After processing all members of the list Q, if its size is greater than or equal to minPts, the list is returned a cluster. The algorithm continues with the next unprocessed point, to explore another cluster. The procedure is terminated when all input points have been processed. We discuss the computational complexity of algorithm 1 in § V. Thus, in order to discover the -neighborhood of point p, by leveraging the sorted delivering of tuples from the LiDAR sensor step after step, it is enough to explore a neighbor mask centered in p, as shown in Figure 2.C. In this way, we eliminate the need for a search-optimized data structure like kd-trees, and we allow the algorithm to process data as they are received from the sensor. III. Lisco We present in this section Lisco. We first discuss the intuition behind the algorithm, i.e. a continuous, single- pass approach in clustering in contrast to existing batch based methods as discussed in § II. Subsequently, we focus on the challenges and trade-offs that continuous clustering introduces. A. Towards continuous clustering Based on the clustering requirements as introduced in Definition 1, each point p reported by the LiDAR sensor is temporarily clustered with each neighbor point p(cid:48) within distance  from p. A cluster of points is eventually delivered if it contains at least minPts points, otherwise its points are characterized as noise. As discussed in § II-C, implementa- tions such as the one provided by PCL limit the pipelining of the analysis because of processing stages that cannot be executed concurrently. More concretely, they first traverse all the points to populate a supporting data structure that facilitates finding the points in the -neighborhood of each point p (a kd-tree in the case of PCL) and subsequently they traverse a second time all the points to cluster them. As shown in Figure 2, the intuition behind Lisco is that the search space for the -neighborhood of point p can be translated into a set of readings given by certain steps (Figure 2.A) and lasers (Figure 2.B) around p, and within a certain distance range from the LiDAR's emitting sensors. It should be noted that these constraints describe a region of space that may also contain points whose distance from p is greater than . Nevertheless, if points within distance  from p exist, they will be returned by one of these steps and lasers and will fall within the given distance range, as we further explain in § V. B. Coping with the challenges of continuous clustering The continuous one-pass analysis of Lisco introduces sev- eral challenges that are not found in batch based approaches. Here we discuss and explain how they are addressed in Lisco in the following. 1) Partial view of neighbor mask: Algorithm 2 shows how the neighbor mask is computed, i.e. the number of previous and subsequent steps σ and the number of upper and lower lasers λ that possibly contain points within distance  from p. As discussed in § II, ∆α and ∆θ refer to the minimum angle differences between two consecutive steps and lasers, respectively. Algorithm 2 Given point p, compute the number of previous steps σ and upper and lower lasers λ bounding at least all the points within distance  from p. 1: procedure getNeighborMask(p) 2: 3: 4: λ ← (cid:100) arcsin(/pd)/∆θ(cid:101) σ ← (cid:100) arcsin(/pd)/∆α(cid:101) return λ, σ for l ∈ 1, . . . , L do Algorithm 3 Main loop of Lisco 1: subclusters = ∅ 2: upon event reception of step s do 3: 4: 5: 6: 7: 8: upon event all steps processed do 9: 10: p = M [l, s] if pd > 0 then λ, σ = getNeighborMask(p) cluster(p,σ,λ,subclusters) for subcluster ∈ subclusters do if size(subcluster) ≥ minPts then return subcluster ObjectS stepsppdΔαObjectppdΔθL lasersL lasersObjectS stepsA. Top viewB. Side viewC. 2D view Figure 2: Top and side views (A and B) showing which steps and lasers, respectively, to include in the neighbor mask (C) for the latter to contain at least all the points within distance  from p. The main loop of Lisco, Algorithm 3, processes points in M, the 2D matrix of input points (described in § II), in step and laser order (Line 4). Each point is processed only if its distance is greater than 0 (that is, if the LiDAR's pulse has been reflected for the point's step and laser index) (Line 5). Once all the points have been processed, all the clusters containing at least minPts points are delivered. As it can be noticed, the parameter minPts does not have an effect in the complexity of the algorithm, since it is only used to filter the delivered clusters at the very end of the clustering process. We describe how clusters are discovered and managed within the function cluster in the following. Given points p1 and p2 within distance , p1's neighbor mask will contain p2 and vice versa. To avoid comparing each pair of neighboring points twice, is enough to consistently traverse half the neighbor mask. Lisco explores the half containing the λ lasers above and below p and the σ steps on p's left side. This allows for points in p's step to be processed as soon as they are delivered (points on p's right side are yet to be delivered upon reception of p's step points). Take into account that, for a minority of steps, not all the points on p's left side lay on columns with a lower index than p's (i.e., they are not stored on the left side of the M matrix). For instance, if a point in column 2 should be compared with 3 columns on the left (λ = 3), then it should be compared with columns S-1, S and 1. In such a case, some comparisons must be postponed until such steps are delivered. A point p(cid:48) on the left side of p and within distance  lays on a lower index than p if 0 ≤ ps − p(cid:48) s ≤ σ. s + σ > S, then p(cid:48) is on the left side On the other hand, if p(cid:48) and within distance  from points in steps 1, . . . , ps + σ− S. In both cases, the clustering semantics defined in § II require p and p(cid:48) to be compared, as we do in Algorithm 4. it 2) Continuous cluster management: A second challenge brought by the continuous nature of Lisco is that subclusters evolve as more steps arrive. Hence, a cluster identified once all the points in a rotation are processed might be the union of several previously discovered subclusters, as seen in Figure 3. Figure 3.A shows the subclusters found when Figure 3: Example showing how the points of two subclus- ters, that evolve concurrently in Lisco's continuous analysis, may end up in the same cluster at a subsequent step. half of the points in the rotation have been processed. In the example, 5 points have been clustered in C1 and 4 points have been clustered in C2. The other non-colored points have not been clustered since they had no neighbors within distance . Figure 3.B shows the clusters found when all the points in the rotation have been processed. At this stage, the points previously clustered in different subclusters are now clustered together. The point marked with x represents the point that has one neighbor in each of the two disjoint subclusters found by Lisco. Once x is processed, these two subclusters should be merged. Based on this observation, we introduce the following informal notions to facilitate the detailed description of Lisco. A subcluster is a set of points that have been clustered together during the processing of the previously received steps of the input. A cluster is a set of at least minPts points that have been clustered together once all the steps of the input have been processed, i.e. a subcluster with cardinality at least minPts is characterized as a cluster after all the steps have been processed. Finally, we consider each subcluster to have a unique identifier called head. Based on the above, one can notice that a subcluster can contain points that previously belonged to two or more sub- clusters. Because subclusters are found continuously while the points of a rotation are being processed, the clustering algorithm requires methods to: (1) retrieve the head of the S stepsL lasersL lasersS stepsB. Side viewC. 2D viewεSphere containing p's neighbors (within distance ε)Steps that can report points within distance ε from pεLasers that can report points within distance ε from ppppNeighbor mask covering at least all the points within distance ε from pA. Top viewDistance range containing points within distance ε from pA. 4 out of 8 steps have been received, 2 clusters C1 and C2 have been identified so farC2C1xCB. 8 out of 8 steps have been received, 1 clusters C is eventually found points belonging to a subcluster and (2) merge two subclus- ters together in order for the final cluster to be delivered as a single item. In order to do this, we use in Algorithm 4 (overviewing the clustering process applied to each incoming point p) the functions Head H = getH(Point p) and merge(Head H1,Head H2). Once two subclusters are merged invoking function merge, we expect the function getH to return the same head for any point of the two subclusters. Without loss of generality, we assume this head to be H1 in the following. Because of this we define a third function setH(point p,Head H). Finally, we define the function createH() to allow for newly discovered subclusters to be instantiated. Algorithm 4 Given point p, cluster it together with all the points already received from the LiDAR sensor that are within distance  from it. 1: procedure cluster(p,λ,σ,subclusters) s ≤ σ ∨ 1 ≤ p(cid:48) for p(cid:48)(0 ≤ ps − p(cid:48) 2: d ≤  do l ≤ λ ∧ pd − p(cid:48) H1=getH(p) H2=getH(p') if H1 (cid:54)= H2 ∧ p − p(cid:48)2 ≤  then s ≤ ps + σ − S) ∧ pl − p(cid:48) 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: if H1 = ∅ ∧ H2 = ∅ then H = createH() setH(p,H) setH(p(cid:48),H) subclusters.add(H) else if H1 = ∅ ∧ H2 (cid:54)= ∅ then else if H1 (cid:54)= ∅ ∧ H2 = ∅ then else setH(p,H2) setH(p(cid:48),H1) subclusters.remove(H2) merge(H1,H2)) As shown in Algorithm 4, four different cases should be checked for two points within distance  that do not belong to the same subcluster: • Line 6: None of the two points belongs to a subcluster. In this case, a new subcluster head is created and set for both points • Line 11: Point p does not belong to a subcluster while point p(cid:48) does. In such a case, point p will refer to the same head as point p(cid:48). • Line 13: Point p belongs to a subcluster while point p(cid:48) does not. In such a case, point p(cid:48) will refer to the same head as point p. • Line 15: Both points p and p(cid:48) have been clustered but to different subclusters. In such a case these two subclusters are merged together. IV. ALGORITHMIC IMPLEMENTATION We discuss the details of the algorithmic implementation of Lisco in this section. Data points are kept in a 2D matrix, M. The number of rows and columns in the matrix is equal to the number of lasers and steps respectively. Upon reception of a column of points from LiDAR, which contains the reflected points of all lasers in one step, we store them in the corresponding col- umn of the matrix. By using the laser and the step number, all the attributes of a point can be extracted in constant time. Each entry in M holds the attributes of the corresponding point and a pointer (initially set to NULL) to the head of its subcluster. The head of a subcluster is defined as the point with the lowest indices in lexicographical order of steps and lasers during the creation of a new subcluster. When two subclusters are merged, the head from the subcluster with the largest number of members is maintained. Subclusters is a hash map used in order to keep track of subclusters and their corresponding members. It is im- plemented as a linked list of arrays, where each key is the header of a subcluster and its members are stored in the array. If the size of a subcluster exceeds the size of the array, a new array is linked to the tail of the current array, so that subclusters can grow without restriction. At the end of the clustering procedure, we use subclusters to traverse through subcluster heads. Each subcluster that has more than minPts members is announced as a cluster, otherwise it is characterized as noise. To keep of Lisco's time complexity low (discussed in § V) we aim at efficient time complexity of the main methods used in our algorithms. As shown in Algorithm 2, function getNeighborMask is executed in constant number of steps, since it boils down to a fixed number of numerical operations. Similarly, functions createH and setH can be also implemented to incur in O(1) complexity, as we discuss in the following. The algorithmic implementation of getH and merge induces the following trade-off. On the one hand, merge can be implemented to induce O(1) time-cost; this can be done by maintaining a hierarchy of subclusters being part of the same subcluster while incurring a higher cost for the getH, linear in the number of subclusters. Figure 4 shows how some of the points clustered together once all the data is processed point to head H1 via head H2. For these points the getH method has a cost higher than that of the points directly pointing to H1, which depends on the chains induced by the data structure to maintain the hierarchy. In the proposed implementation we opt for an O(1) cost for method getH and a higher cost for merge, as seen in Figure 5 and § V. The reason, as can be seen in Algorithm 4 and based also on our empirical evaluation in § VI, is that getH is executed twice for pairs of points being compared, while merge is executed significantly less often. In detail, the implementations of the functions used in Algorithm 4 are as follows: - createH: This function gets two points that do not belong to any subcluster, and returns the one with the lower index- pair for step and laser. Since the returned point will be head of a subcluster, a new node is created in the subclusters Claim 1. If two points p and p(cid:48) are in the -neighborhood of each other they will either be in the same cluster at the end of Lisco procedure or be characterized as noise, in the same way as given in Definition 1. Proof: (sketch) Consider that, w.l.o.g. p is processed second. As argued in paragraph getNeighborMask in the previous section, p(cid:48) will be found that it belongs in the -neighborhood of p. This implies that they will be merged/inserted in the same subcluster. Unless that subclus- ter in the end is found to contain fewer points than M inP ts, it will be return as a final cluster in the end of the main loop of Lisco. B. Complexity In this section, we discuss the complexity analysis of Lisco and compare it with PCL E Cluster. index (kd-tree) and using it Regarding PCL E Cluster, the required processing work volume is similar to the DBSCAN algorithm, i.e. building a spatial to execute region queries for each point, resulting in an overall expected time complexity of O(nlogn) processing steps [4], [19], [25]. Claim 2. Lisco's time complexity is linear in the number of points, multiplied by a factor that depends on the size of the clusters in the set of data points. In the worst-case where there is a big cluster of O(n) points, it can take O(nlogn) processing steps for Lisco to complete. Proof: (sketch) Overall, the time complexity of Lisco is the number of iterations in the main loop (i.e. n, as the number of points), times the work in each iteration, i.e. for each point (i) finding its -neighborhood, and (ii) working with each point in the neighborhood. Part (i) from above, induces an asymptotically constant cost, depending on , as it is performed through the compar- isons implied by the masking operation getNeighborMask. Part of the -neighborhood of a point p, i.e. the points with smaller step index, is compared with p through step 2 of Algorithm 4 on behalf of p, while for each of the remaining points p(cid:48) in p's -neighborhood, p will be identified as part of the -neighborhood of p(cid:48) when the respective step is executed on behalf of p(cid:48). Regarding part (ii), functions' createH and setH algo- rithmic implementation incurs a constant number of process- ing steps each, as we explain in § IV. Moreover, as explained in the aforementioned section, getH induces O(1) time- cost, as a point can identify its head in O(1) (e.g. with a direct link). This incurs a cost that is O(x) for merge, where x is the size of the smaller subcluster, since the merging itself needs to update the head for all the points of the smaller one of the subclusters being merged. Since the merge function chooses the subcluster with the bigger number of points as the base subcluster, in the worst- case the clustering has a huge subcluster of O(n) points, and an unlikely scenario for constructing it, might require Lisco Figure 4: Possible implementation in which the merge method is made O(1) by hierarchically linking heads of subclusters belonging to the same subcluster. Notice that the complexity of getH is no longer O(1) but linear in the number of subclusters for some of the points. Figure 5: Possible implementation in which the getH method can run in O(1) steps by having all points directly linked with the subcluster head. Notice the head of all the points of subcluster C2 has been updated when the subcluster has been merged with subcluster C1. and the head is mapped to it. - setH: This function sets the pointer of a point to the head point. By calling this function, we are adding a point to a subcluster with an identified head. The point also needs to be added as the last element in the array of the mapped head. - getH: This function reads the pointer to get the head point. If two points are in the same subcluster, they get the same head point as the result of this function. - merge: If two points belong to different subclusters, Lisco merges the two subclusters by calling this function. It chooses the subcluster with bigger number of members as the base subcluster, and merges the other one by changing the head of its members to the base subcluster's head. After merging subclusters, it is also necessary to remove the merged subcluster's head from the subclusters hash map and append its array to the base subcluster's array. V. ANALYSIS A. Correctness Based on Lisco's functionality and algorithmic imple- mentation, we discuss here why Lisco's outcome satisfies Definition 1. A. The subclusters have different headsB. After merging, one subcluster's head (H1) points to the other (H2)xH2H1H1H2A. The subclusters have different headsH2H1H1B. After merging, all the points are directly linked to the headx to merge roughly equally-sized subclusters at each of the merge operations leading to the big subcluster – any other combination of subclusters would lead at most to an equal cost as the one described. Since halving O(n) points can be made at most O(logn) times, we can observe that the worst-case total number of merge-related processing steps will be dominated by a sequence of O(nlogn) steps, which will be the dominating cost in the worst case complexity of Lisco. VI. EVALUATION In this section, we present our experimental methodology and results of Lisco and compare them with those of PCL E Cluster algorithm. Since the clustering outcomes of PCL E Cluster and Lisco are the same, we do not need to compare the clusters and we can focus on the completion time for each approach. A. Evaluation setup we use To run PCL E Cluster the EuclideanClusterExtraction class from PCL library, which is designed to cluster 3D point clouds and is implemented in C++. We also implemented Lisco in C++11 and compiled both of algorithms with gcc-4.8.4 using the -O3 optimization flag. All the experiments have been run on the same system running Linux with 2.00GHz Intel(R) Xeon(R) E5-2650 processor and 64GB Ram. B. Data We used both synthetic and real-world datasets. The real- world dataset has been collected from the Ford Campus dataset [18] and the synthetic ones have been generated using the Webots simulator [15]. We use synthetic datasets to explore the effect of data (e.g. different total number of points that have been collected by the LiDAR, different densities and distances of objects) on the performance of algorithms. There are five scenarios for synthetic datasets. SCEN1 and SCEN2 have the same and few number of objects but we changed the position of the objects to near and far from LiDAR. Near objects reflect more points while far objects reflect fewer points with a larger gap between two nearby points. Similarly, SCEN2 and SCEN3 have the same number of objects (number of objects are more than previous scenarios) and we only changed the position of the objects. Finally, SCEN5 represents a high density environment with a lot of objects. Figure 6 shows five simulated environments for several scenarios. In all the environments, a VelodyneHDL64E is used to collect data points and generate a dataset within one physical rotation. the synthetic datasets. Since we used the same specifications for the LiDAR in all scenarios, the number of steps and lasers for one physical rotation is the same, so the total number of Table I summarizes the properties of points (including NULL points and ground points) is the same and it is equal to 72000. After removing the ground points and eliminating NULL points, we get a number of reflected points. As shown in the table, with the same number of objects in the environment (e.g. SCEN1 and SCEN2), if we change the position of objects to near or far, we get different numbers of reflected points. Name SCEN1 SCEN2 SCEN3 SCEN4 SCEN5 # Points after removing NULL points and ground points 26891 16218 39028 18229 64518 Table I: Properties of synthetic datasets and the effect of number of objects and their distances from LiDAR on number of points after ground removal. C. Performance evaluation The execution time is measured from the time-instant the first data point of the dataset is received until the time instant when the clustering algorithm has processed all data points of one full physical rotation. A higher value of  implies a larger -neighborhood of a point, hence the clustering algorithm needs more time to search in the neighborhood. 1) Synthetic datasets: Figure 7 shows the average ex- ecution time with confidence level 99% on 20 runs with different values of  and constant value of minPts = 10. Since the maximum margin of error for a confidence level 99% is small, we can not distinguish them clearly in the figure. We chose a range [0.1 − 1] meters for , so that for example if  = 0.4, all the objects that their closest points have at least 40 centimetres distance from each other, should be detected as separated objects. While clustering with smaller values of  find at least one cluster for each object, bigger values increase the probability of clustering distinct objects together. For example, with  = 1 for SCEN3, all the cars at each side of the black car, are clustered together which leads to incorrect segmentation. As expected, by increasing the value of the , the execu- tion time increases for both algorithms. As it can be seen, when the number of points is high, regardless of the value of the , Lisco is always faster than PCL. Only for a dataset with a relatively small number of points and when  is set to a high value PCL has slightly better performance than Lisco (figure 7 SCEN2 and SCEN4). The effect of number of points is also shown in figure 8. As discussed in § V building a kd-tree and using it to find nearest neighbors in PCL becomes a bottleneck when the number of points is high. 2) Real-world dataset: This Ford Campus dataset is collected by an autonomous ground vehicle testbed, with a Velodyne HDL-64E LiDAR scanner [18]. The vehicle path trajectory in this dataset contains several large and small objects (e.g. buildings, vehicles, pedestrians, vegetation, (a) SCEN1 - The simulated sparse environment in which objects are close to the Li- DAR which is located on the black car (b) SCEN2 - The simulated sparse environment in which objects are far from the Li- DAR which is located on the black car (c) SCEN3 - The simulated dense environment in which objects are close to the Li- DAR which is located on the black car (d) SCEN4 - The simulated dense environment in which objects are far from LiDAR which is located on the black car (e) SCEN5 - The simulated room for high density envi- ronment. The LiDAR is lo- cated on the purple column Figure 6: Different scenarios for simulated environments. Figure 7: The average execution time on synthetic datasets with confidence level 99% over 20 runs for minPts = 10 and different values of  Figure 8: Scalability of Lisco and PCL with respect to the number of points Figure 9: The average execution time of running PCL and Lisco over 2280 rotations of real-world dataset for minPts = 10 and different values of  etc.). We have tested PCL E Cluster and Lisco on 2280 rotations of this dataset and compare their execution times with confidence level 99%. Figure 9 shows the results of the comparison for  values 0.3, 0.4, and 0.7. Among all the rotations, the minimum number of reflected points after ground removal is 5000, the maximum is 75550, and the average is 50225. As shown in the figure, Lisco outperforms PCL E Cluster in real-world datasets. In real-world data, generally there are more objects around the LiDAR and therefore there are more reflected points besides the ground. Since Lisco processes points upon receiving them from LiDAR, it can save more time and it has thus better throughput. 00.51 (m)00.20.40.60.8Execution Time (sec)SCEN100.51 (m)00.050.10.150.2SCEN200.51 (m)01234SCEN300.51 (m)00.050.10.150.20.25SCEN400.51 (m)051015SCEN5PCLLisco246#points10402468Execution Time (sec)PCLLisco0.30.40.7 (m)00.20.40.60.811.2Execution Time (sec)PCLLisco VII. OTHER RELATED WORK Data clustering has been studied for several decades and existing algorithms have been categorized into four classes: density-based, partition-based, hierarchy-based, and grid based [9]. Due to their ability in finding arbitrarily shaped clusters without requiring to know the number of the clusters a priori, density-based methods are widely used in different applications. Well-known algorithms of this class include DBSCAN [4] and OPTICS [2]. However, to use these algorithms in big data applications and overcome their performance bottleneck in dealing with extremly large datasets, there are several attempts to parallelize DBSCAN [13], [19]. In parallel models, the clustering procedure is divided into three steps: 1) data distribution (e.g. using kd- tree) 2) local clustering (which is splitted on several ma- chines) 3) merging of local clusters. Although the efficiency is improved by splitting the clustering on several machines, pipelining of steps has not being studied yet. Rusu et al. [21] introduce an Euclidean-distance-based clustering which is a partition-based clustering method that produces arbitrarily shaped clusters. This approach is de- signed for unorganized data points. So, to facilitate searching for nearest neighbors, first a kd-tree is built over the dataset and then clustering is being performed. In other works [24], [27], an octree is used to identify the neighbors before starting the clustering procedure. Since LiDAR data points are implicitly ordered, organiz- ing them (e.g. in a tree) may be avoided, similar to the spirit of this paper. Specifically, the characteristics of the sensor data can be used to establish neighborhood relations between points [12], [16]. Klasing [12] et al. proposed a clustering method for 2D laser scans that rotate with an independent motor to cover a 3D environment. While the proposed method compares points across different scans similarly to the problem studied in this work, the semantics of Definition 1 are not enforced resulting to a lower accuracy. Moosmann et al. [16] proposed an approach to turn the scan into an undirected graph to retrieve the neighborhood information of each point during clustering, but they have not studied pipelining building the graph and clustering. Zermas et al. [29] recently proposed a clustering method specific to the structure of LiDAR data points. This approach processes one scan-line (a layer (rotation) of points that are produced from the same laser) at a time and merges nearby clusters from different scan-lines. However, the entire rotation is needed as the algorithm does more than one pass over the data. Also, this approach, similarly to previous works, still relies on a kd-tree for some necessary nearest neighbor searches. Moreover, the neighborhood criterion for points clustered in the same scan-line does not take into account the distance of the point from the sensor, and thus does not guarantee the semantics of Definition 1. Clustering LiDAR data points are being used in wide range of applications [11], [14], [23]. Among all, au- tonomous vehicle applications are one of the most challeng- ing since they need fast and accurate results [3], [10], [26], [29]. In [3], a set of voxelisation and meshing segmentation methods are presented. Wang et al. [26] first separates data into foreground and background. then a clustering procedure is conducted only on the foreground segments. VIII. CONCLUSIONS AND FUTURE WORK This work is about one of the challenges in common big data applications, namely leveraging the information carried by high-rate streams through efficient methods that can rapidly distill the valuable information from the raw measurements. A common problem in the analysis of LiDAR sensor data, that generate date at rates of megabytes per second, is clustering of the raw distance measurements, in order to facilitate detection of objects surrounding the sensor. Lisco represents a streaming approach to process the LiDAR points while the data is being collected. This characteristic helps to facilitate extraction of clusters in a continuous fashion and contribute to real-time processing. By keeping track of the different subcluster heads, Lisco can deliver subclusters to the user at anytime by request, i.e. provide continuous information. Important follow-up questions include the parallelization of Lisco's processing pipeline to take advantage of comput- ing architectures for the corresponding deploy environments. This necessitates algorithmic implementations in a variety of processing architectures, such as manycores/GPUs, SIMD systems, single board devices and high-end servers, to explore Lisco's properties in a broad range of cloud and fog architectures and evaluate its impact on applications that can be deployed on such systems. In addressing such questions it will be useful to leverage the benefits of efficient fine- grained synchronization methods in streaming-centered and bulk-operations-enabled data structures, as proposed in [6]– [8], [17]. REFERENCES [1] Annual report, point cloud achievements, profile project, department of production. Technical report, Fraunhofer- Chalmers Research Center for Industrial Mathematics (FCC), 2015. [http://www.fcc.chalmers.se/mediadir/2014/09/fcc vb 2015.pdf; accessed 18-August-2017]. [2] Mihael Ankerst, Markus M Breunig, Hans-Peter Kriegel, and Jorg Sander. Optics: ordering points to identify the clustering structure. In ACM Sigmod record, volume 28, pages 49–60. ACM, 1999. [3] Bertrand Douillard, James Underwood, Noah Kuntz, Vsevolod Vlaskine, Alastair Quadros, Peter Morton, and Alon Frenkel. On the segmentation of 3d lidar point In Robotics and Automation (ICRA), 2011 IEEE clouds. International Conference on, pages 2798–2805. IEEE, 2011. [4] Martin Ester, Hans-Peter Kriegel, Jorg Sander, Xiaowei Xu, et al. A density-based algorithm for discovering clusters in large spatial databases with noise. In Kdd, pages 226–231, 1996. [5] Zhang Fu, Magnus Almgren, Olaf Landsiedel, and Marina Papatriantafilou. Online temporal-spatial analysis for detec- tion of critical events in cyber-physical systems. In Big Data (Big Data), 2014 IEEE International Conference on, pages 129–134. IEEE, 2014. [6] Vincenzo Gulisano, Yiannis Nikolakopoulos, Daniel Ceder- man, Marina Papatriantafilou, and Philippas Tsigas. Effi- cient data streaming multiway aggregation through concurrent algorithmic designs and new abstract data types. CoRR, abs/1606.04746, 2016. [7] Vincenzo Gulisano, Yiannis Nikolakopoulos, Marina Papatri- antafilou, and Philippas Tsigas. Scalejoin: A deterministic, disjoint-parallel and skew-resilient stream join. IEEE Trans- actions on Big Data, 2016. [8] Vincenzo Gulisano, Yiannis Nikolakopoulos, Ivan Walulya, Marina Papatriantafilou, and Philippas Tsigas. Deterministic real-time analytics of geospatial data streams through scale- In Proceedings of the 9th ACM International gate objects. Conference on Distributed Event-Based Systems, DEBS '15, pages 316–317, New York, NY, USA, 2015. ACM. [9] Jiawei Han, Jian Pei, and Micheline Kamber. Data mining: concepts and techniques. Elsevier, 2011. [10] Michael Himmelsbach, Felix V Hundelshausen, and H-J Wuensche. Fast segmentation of 3d point clouds for ground vehicles. In Intelligent Vehicles Symposium (IV), 2010 IEEE, pages 560–565. IEEE, 2010. [11] Klaas Klasing, Dirk Wollherr, and Martin Buss. A clustering method for efficient segmentation of 3d laser data. In Robotics and Automation, 2008. ICRA 2008. IEEE International Con- ference on, pages 4043–4048. IEEE, 2008. [12] Klaas Klasing, Dirk Wollherr, and Martin Buss. Realtime segmentation of range data using continuous nearest neigh- In Robotics and Automation, 2009. ICRA'09. IEEE bors. International Conference on, pages 2431–2436. IEEE, 2009. [13] Sonal Kumari, Poonam Goyal, Ankit Sood, Dhruv Kumar, Sundar Balasubramaniam, and Navneet Goyal. Exact, fast and scalable parallel dbscan for commodity platforms. In Pro- ceedings of the 18th International Conference on Distributed Computing and Networking, page 14. ACM, 2017. [14] Wenkai Li, Qinghua Guo, Marek K Jakubowski, and Maggi Kelly. A new method for segmenting individual trees from the lidar point cloud. Photogrammetric Engineering & Remote Sensing, 78(1):75–84, 2012. [15] Olivier Michel. Cyberbotics ltd. webots: professional mobile robot simulation. International Journal of Advanced Robotic Systems, 1(1):5, 2004. [16] Frank Moosmann, Oliver Pink, and Christoph Stiller. Seg- mentation of 3d lidar data in non-flat urban environments In Intelligent Vehicles using a local convexity criterion. Symposium, 2009 IEEE, pages 215–220. IEEE, 2009. [17] Yiannis Nikolakopoulos, Marina Papatriantafilou, Peter Brauer, Martin Lundqvist, Vincenzo Gulisano, and Philippas Tsigas. Highly concurrent stream synchronization in many- In Proceedings of the Third ACM core embedded systems. International Workshop on Many-core Embedded Systems, MES '16, pages 2–9, New York, NY, USA, 2016. ACM. [18] Gaurav Pandey, James R McBride, and Ryan M Eustice. Ford campus vision and lidar data set. The International Journal of Robotics Research, 30(13):1543–1552, 2011. [19] Mostofa Ali Patwary, Diana Palsetia, Ankit Agrawal, Wei- keng Liao, Fredrik Manne, and Alok Choudhary. A new scalable parallel dbscan algorithm using the disjoint-set data In Proceedings of the International Conference structure. on High Performance Computing, Networking, Storage and Analysis, page 62. IEEE Computer Society Press, 2012. [20] Radu Bogdan Rusu. Semantic 3d object maps for everyday manipulation in human living environments. KI-Kunstliche Intelligenz, 24(4):345–348, 2010. [21] Radu Bogdan Rusu, Nico Blodow, Zoltan Csaba Marton, and Michael Beetz. Close-range scene segmentation and recon- struction of 3d point cloud maps for mobile manipulation in In Intelligent Robots and Systems, domestic environments. 2009. IROS 2009. IEEE/RSJ International Conference on, pages 1–6. IEEE, 2009. [22] Radu Bogdan Rusu and Steve Cousins. 3d is here: Point cloud library (pcl). In Robotics and Automation (ICRA), 2011 IEEE International Conference on, pages 1–4. IEEE, 2011. [23] Aparajithan Sampath and Jie Shan. Segmentation and recon- struction of polyhedral building roofs from aerial lidar point clouds. IEEE Transactions on geoscience and remote sensing, 48(3):1554–1567, 2010. [24] Anh-Vu Vo, Linh Truong-Hong, Debra F Laefer, and Michela Bertolotto. Octree-based region growing for point cloud segmentation. ISPRS Journal of Photogrammetry and Remote Sensing, 104:88–100, 2015. [25] Ingo Wald and Vlastimil Havran. On building fast kd-trees for ray tracing, and on doing that in o (n log n). In Interactive Ray Tracing 2006, IEEE Symposium on, pages 61–69. IEEE, 2006. [26] Dominic Zeng Wang, Ingmar Posner, and Paul Newman. What could move? finding cars, pedestrians and bicyclists in 3d laser data. In Robotics and Automation (ICRA), 2012 IEEE International Conference on, pages 4038–4044. IEEE, 2012. [27] H Woo, E Kang, Semyung Wang, and Kwan H Lee. A new segmentation method for point cloud data. International Journal of Machine Tools and Manufacture, 42(2):167–178, 2002. [28] Nikos Zacheilas, Vana Kalogeraki, Yiannis Nikolakopoulos, Vincenzo Gulisano, Marina Papatriantafilou, and Philippas Tsigas. Maximizing determinism in stream processing under latency constraints. In Proceedings of the 11th ACM Inter- national Conference on Distributed and Event-based Systems, DEBS '17, pages 112–123, New York, NY, USA, 2017. ACM. [29] Dimitris Zermas, Izzat Izzat, and Nikolaos Papanikolopoulos. Fast segmentation of 3d point clouds: A paradigm on lidar In Robotics and data for autonomous vehicle applications. Automation (ICRA), 2017 IEEE International Conference on, pages 5067–5073. IEEE, 2017.
1303.5479
2
1303
2013-06-11T19:17:12
Bottom-k and Priority Sampling, Set Similarity and Subset Sums with Minimal Independence
[ "cs.DS" ]
We consider bottom-k sampling for a set X, picking a sample S_k(X) consisting of the k elements that are smallest according to a given hash function h. With this sample we can estimate the relative size f=|Y|/|X| of any subset Y as |S_k(X) intersect Y|/k. A standard application is the estimation of the Jaccard similarity f=|A intersect B|/|A union B| between sets A and B. Given the bottom-k samples from A and B, we construct the bottom-k sample of their union as S_k(A union B)=S_k(S_k(A) union S_k(B)), and then the similarity is estimated as |S_k(A union B) intersect S_k(A) intersect S_k(B)|/k. We show here that even if the hash function is only 2-independent, the expected relative error is O(1/sqrt(fk)). For fk=Omega(1) this is within a constant factor of the expected relative error with truly random hashing. For comparison, consider the classic approach of kxmin-wise where we use k hash independent functions h_1,...,h_k, storing the smallest element with each hash function. For kxmin-wise there is an at least constant bias with constant independence, and it is not reduced with larger k. Recently Feigenblat et al. showed that bottom-k circumvents the bias if the hash function is 8-independent and k is sufficiently large. We get down to 2-independence for any k. Our result is based on a simply union bound, transferring generic concentration bounds for the hashing scheme to the bottom-k sample, e.g., getting stronger probability error bounds with higher independence. For weighted sets, we consider priority sampling which adapts efficiently to the concrete input weights, e.g., benefiting strongly from heavy-tailed input. This time, the analysis is much more involved, but again we show that generic concentration bounds can be applied.
cs.DS
cs
Bottom-k and Priority Sampling, Set Similarity and Subset Sums with Minimal Independence∗ Mikkel Thorup AT&T Labs —Research and University of Copenhagen [email protected] February 6, 2014 Abstract We consider bottom-k sampling for a set X , picking a sample Sk (X ) consisting of the k elements that are smallest according to a given hash function h. With this sample we can estimate the frequency f = Y /X of any subset Y as Sk (X ) ∩ Y /k . A standard application is the estimation of the Jaccard similarity f = A ∩ B /A ∪ B between sets A and B . Given the bottom-k samples from A and B , we construct the bottom-k sample of their union as Sk (A ∪ B ) = Sk (Sk (A) ∪ Sk (B )), and then the similarity is estimated as Sk (A ∪ B ) ∩ Sk (A) ∩ Sk (B )/k . We show here that even if the hash function is only 2-independent, the expected relative error is O(1/√f k). For f k = Ω(1) this is within a constant factor of the expected relative error with truly random hashing. For comparison, consider the classic approach of repeated min-wise hashing, where we use k inde- pendent hash functions h1 , ..., hk , storing the smallest element with each hash function. For min-wise hashing, there can be a constant bias with constant independence, and this is not reduced with more repetitions k . Recently Feigenblat et al. showed that bottom-k circumvents the bias if the hash function is 8-independent and k is sufficiently large. We get down to 2-independence for any k . Our result is based on a simple union bound, transferring generic concentration bounds for the hashing scheme to the bottom-k sample, e.g., getting stronger probability error bounds with higher independence. For weighted sets, we consider priority sampling which adapts efficiently to the concrete input weights, e.g., bene fiting strongly from heavy-tailed input . This time, the analysis is much more involved, but again we show that generic concentration bounds can be applied. 1 Introduction according to 1 ) is a basic algorithmic tool The concept of min-wise hashing (or the “MinHash algorithm ” suggested by Broder et al. [6, 8] for problems related to set similarity and containment. After the initial application of this algorithm in the early Altavista search engine to detecting and clustering similar docu- ments, the scheme has reappeared in numerous other applications1 and is now a standard tool in data mining where it is used for estimating similarity [6, 8, 9], rarity [13], document duplicate detection [7, 21, 23, 38], etc [2, 4, 10, 31]. ∗A short preliminary version of this paper was presented at STOC’13 [35]. 1See http://en.wikipedia.org/wiki/MinHash 1 In an abstract mathematical view, we have two sets, A and B , and we are interested in understanding their overlap in the sense of the Jaccard similarity f = A∩B A∪B . In order to do this by sampling, we need sampling correlated between the two sets, so we sample by hashing. Consider a hash function h : A ∪ B → [0, 1]. For simplicity we assume that h is fully random, and has enough precision that no collisions are expected. The main mathematical observation is that Pr[argminh(A) = argminh(B )] is precisely f = A ∩ B (cid:14) A ∪ B . Thus, we may sample the element with the minimal hash from each set, and use them in [argmin h(A) = argmin h(B )] for an unbiased estimate of f . Here, for a logical statement S , [S ] = 1 if S is true; otherwise [S ] = 0. For more concentrated estimators, we use repetition with k independent hash functions, h1 , ..., hk . For each set A, we store M k (A) = (argmin h1 (A), ..., argmin hk (A)), which is a sample with replacement from A. The Jaccard similarity between sets A and B is now estimated as M k (A) ∩ M k (B )/k where M k (A) ∩ M k (B ) denotes the number of agreeing coordinates between M k (A) and M k (B ). We shall refer to this approach as repeated min-wise or k×min. For our discussion, we consider the very related application where we wish to store a sample of a set X that we can use to estimate the frequency f = Y X of any subset Y ⊆ X . The idea is that the subset Y is not known when the sample from X is made. The subset Y is revealed later in the form of a characteristic function that can tell if (sampled) elements belong to Y . Using the k×min sample M k (X ), we estimate the frequency as M k (X ) ∩ Y /k where M k (X ) ∩ Y denotes the number of samples from M k (X ) in Y . Another classic approach for frequency estimation is to use just one hash function h and use the k elements from X with the smallest hashes as a sample Sk (X ). This is a sample without replacement from X . As in [12], we refer to this as a bottom-k sample. The method goes back at least to [20]. The frequency of Y in X is estimated as Y ∩ Sk (X )/k . Even though surprisingly fast methods have been proposed to compute k×min [3], the bottom-k signature is much simpler and faster to compute. In a single pass through a set, we only apply a single hash function h to each element, and use a max-priority queue to maintain the k smallest elements with respect to h. It is standard1 to use bottom-k samples to estimate the Jaccard similarity between sets A and B , for this is exactly the frequency of the intersection in the union. First we construct the bottom-k sample Sk (A∪B ) = Sk (Sk (A) ∪ Sk (B )) of the union by picking the k elements from Sk (A) ∪ Sk (B ) with the smallest hashes. Next we return Sk (A) ∩ Sk (B ) ∩ Sk (A ∪ B )/k . Stepping back, for subset frequency, we generally assume that we can identify samples from the subset. In the application to set similarity, it important that the samples are coordinated via hash functions, for this is what allows us to identify samples from the intersection as being sampled in both sets. In our mathematical analysis we will focus on the simpler case of subset frequency estimation, but it the application to set similarity that motivates our special interest in sampling via hash functions. Limited independence The two approaches k×min and bottom-k are similar in spirit, starting from the same base 1×min = bottom-1. With truly random hash functions, they have essentially the same rela- tive standard deviation (standard deviation divided by expectation) bounded by 1/√f k where f is the set similarity or subset frequency. The two approaches are, however, very different from the perspective of pseudo-random hash functions of limited independence [37]: a random hash function h is d-independent if the hash values of any d given elements are totally random. With min-wise hashing, we have a problem with bias in the sense of sets in which some elements have a better than average chance of getting the smallest hash value. It is known that 1 + o(1) bias requires ω(1)-independence [28]. This bias is not reduced by repetitions as in k×min. However, recently Porat et al. [19] proved that the bias for bottom-k vanishes for large enough k ≫ 1 if we use 8-independent hashing. 2 Essentially they get an expected relative error of O(1/√f k), and error includes bias. For f k = Ω(1), this is only a constant factor worse than with truly random hashing. Their results are cast in a new framework of “ d-k-min-wise hashing”, and the translation to our context is no t immediate. In this paper, we prove that bottom-k sampling preserves the expected relative error of O(1/√f k) Results with 2-independent hashing, and this holds for any k including k = 1. We note that when f k = o(1), then 1/√f k = ω(1), so our result does not contradict a possible large bias for k = 1. We remark that we also get an O(1/p(1 − f )k) bound on the expected relative error. This is important if we estimate the dissimilarity 1 − f of sets with large similarity f = 1 − o(1). For the more general case of weighted sets, we consider priority sampling [18] which adapts near- optimally to the concrete input weights [33], e.g., benefiti ng strongly from heavy-tailed input. We show that 2-independent hashing suffices for good concentration. Our positive finding with 2-independence contrasts recent n egative results on the insufficiency of low independence, e.g., that linear probing needs the 5-independence [28] that was proved sufficient by Pagh et al. [27]. Implementation For 2-independent hashing we can use the fast multiplication-shift scheme from [14], e.g., if the elements are 32-bit keys, we pick two random 64-bit numbers a and b. The hash of key x is computed with the C-code (a ∗ x + b) >> 32, where ∗ is 64-bit multiplication which as usual discards overflow, and >> is a right shift. This is 10-20 times faster than the fastest known 8-independent hashing based on a degree 7 polynomial tuned for a Mersenne prime field [36]2 . Practical relevance We note that Mitzenmacher and Vadhan [24] have proved that 2-independence gen- erally works if the input has enough entropy. However, the real world has lots of low entropy data. In [36] it was noted how consecutive numbers with zero entropy made linear probing with 2-independent hashing extremely unreliable. This was a problem in connection with denial-of-service attacks using consecutive IP- addresses. For our set similarity, we would have similar issues in scenarios where small numbers are more common, hence where set intersections are likely to be fairly dense intervals of small numbers whereas the difference is more likely to consists of large random outliers. Figure 1 presents an experiment showing what happens if we try to estimating such dissimilarity with 2-independent hashing. Stepping back, the result Mitzenmacher and Vadhan is that 2-independence works for sufficiently ran- dom input. In particular, we do not expect problems to show up in random tests. However, this does not imply that 2-independent hashing can be trusted on real data unless we have specific reasons to believe that the input has high entropy. In Figure 1, bottom-k performs beautifully with 2-independent hashing, but no amount of experiments can demonstrate general reliability. However, the mathematical result of this paper is that bottom-k can indeed be trusted with 2-independent hashing: the expected relative error is O(1/√f k) no matter the structure of the input. Techniques To appreciate our analysis, let us first consider the trivial case where we are given a non- random threshold probability p and sample all elements that hash below p. As in [17] we refer to this as threshold sampling. Since the hash of a element x is uniform in [0, 1], this samples x with probability p. The sampling of x depends only on the hash value of x, so if, say, the hash function is d-independent, then the 2See Table 2 in [36] for comparisons with different key lengths and computers between multiplication-shift (TwoIndep), and tuned polynomial hashing (CWtrick). The table considers polynomials of degree 3 and 4, but the cost is linear in the degree, so the cost for degree 7 is easily extrapolated. 3 k×min 90% fractile single experiment 10% fractile real value 20000 40000 60000 80000 100000 0.008 0.007 0.006 0.005 0.004 0.003 0.002 0.001 0 0 bottom-k 90% fractile single experiment 10% fractile real value 20000 40000 60000 80000 100000 0.008 0.007 0.006 0.005 0.004 0.003 0.002 0.001 0 0 Figure 1: Experiment with set consisting of 100300 32-bit keys. It has a “core” consisting of the consecutive numbers 1, ...100000. In addition it has 300 random “outliers”. Using k samples from the whole set, we want 300 to estimate the frequency of the outliers. The true frequency is 100300 ≈ 0.003. We used k = 1, ..., 100000 in k×min and bottom-k and made one hundred experiments. For each k , we sorted the estimates, plotting the 10th and 90th value, labeled as 10% and 90% fractile in the figures. We also plotted the results from a single experiment. For readability, only one in every 100 values of k is plotted. Both schemes converge, but due to bias, k×min converges to a value that is 70% too large. Since bottom-k does sampling without replacement, it becomes exact when the number of samples is the size of the whole set. The bias is a function of the structure of the subset within the whole set, e.g., the core set must have a negative bias complimenting the positive bias of the outliers. It is therefore not possible to correct for the bias if one only has the sample available. 4 number of samples is the sum of d-independent 0-1 variables. This scenario is very well understood (see, e.g., [15, 32]). We could set p = k/n, and get an expected number of k samples. Morally, this should be similar to a bottom-k sample, which is what we get if we end up with exactly k samples, that is, if we end up with h(k) < p ≤ h(k+1) where h(i) denotes the ith smallest hash value. What complicates the situation is that h(k) and h(k+1) are random variables depending on all the random hash values. An issue with threshold sampling is that the number of samples is variable. This is an issue if we have bounded capacity to store the samples. With k expected samples, we could put some limit K ≫ k on the number of samples, but any such limit introduces dependencies that have to be understood. Also, if we have room for K samples, then it would seem wasteful not fill it with a full bot tom-K sample. Our analysis of bottom-k samples is much simpler than the one in [19] for 8-independent hashing with k ≫ 1. With a union bound we reduce the analysis of bottom-k samples to the trivial case of threshold sampling. Essentially we only get a constant loss in the error probabilities. With 2-independent hashing, we then apply Chebyshev’s inequality to show that the expected relative error is O(1/√f k). The error probability bounds are immediately improved if we use hash functions with higher independence. It is already known from [5] that we can use a 2-independent bottom-k sample of a set to estimate its size n with an expected error of O(√n). The estimate is simply the inverse of the k th smallest sample. Applying this to two Θ(n)-sized sets and their union, we can estimate A, B , A∪B and A∩B = A+B −A∪B each with an expected error of O(√n). However, A ∩ B may be much smaller than O(√n). If we instead multiply our estimate of the similarity f = A ∩ B /A ∪ B with the estimate of A ∪ B , the resulting estimate of A ∩ B is (1 ± O(1/pf k)f (A ∪ B ± O(√n)) = A ∩ B ± O(pA ∩ B ). The analysis of priority sampling for weighted sets is much more delicate, but again, using union bounds, we show that generic concentration bounds apply. 2 Bottom-k samples We are given a set of X of n elements. A hash function maps the elements uniformly and collision free into [0, 1]. Our bottom-k sample S consists of the k elements with the lowest hash values. The sample is used to estimate the frequency f = Y /X of any subset Y of X as Y ∩ S /k . With 2-independent hashing, we will prove the following error probability bound for any r ≤ ¯r = √k/3: Pr hY ∩ S − f k > rpf ki ≤ 4/r2 . The result is obtained via a simple union bound where stronger hash functions yield better error probabilities. With d-independence with d an even constant, the probability bound is O(1/rd ). It is instructive to compare d-independence with the idea of storing d independent bottom-k samples, each based on 2-independence, and use the median estimate. Generally, if the probability of a certain deviation is p, the deviation probability for the median is bounded by (2ep)d/2 , so the 4/r2 from (1) becomes (2e4/r2 )d/2 < (5/r)d , which is the same type of probability that we get with a single d-independent hash function. The big advantage of a single d-independent hash function is that we only have to store a single bottom-k sample. If we are willing to use much more space for the hash function, then we can use twisted tabulation hashing [29] which is very fast, and then we get exponential decay in r though only down to an arbitrary polynomial of the space used. (1) 5 In order to show that the expected relative error is O(1/√f k), we also prove the following bound for f k ≤ 1/4: Pr[Y ∩ S ≥ ℓ] = O(f k/ℓ2 + pf /ℓ). Proposition 1 For bottom-k samples based on 2-independent hashing, a fraction f subset is estimated with an expected relative error of O(1/√f k). From (1) and (2) we get (2) Proof The proof assumes (1) and (2). For the case f k > 1/4, we will apply (1). The statement is equivalent to saying that the sample error Y ∩ S − f k in expectation is bounded by O(√f k). This follows immediately from (1) for errors below ¯r√f k = kpY /n. However, by (1), the probability of a larger error is bounded by 4/¯r2 = O(1/k). The maximal error is k , so the contribution of larger errors to the expected error is O(1). This is O(√f k) since f k > 1/4. We will now handle the case f k ≤ 1/4 using (2). We want to show that the expected absolute error is O(√f k). We note that only positive errors can be bigger than f k , so if the expected error is above 2f k , the expected number of samples from Y is proportional to the expected error. We have √f k ≥ 2f k , so for the expected error bound, it suffices to prove that the expected n umber of samples is Y ∩ S = O(√f k). Using (2) for the probabilities, we now sum the contributions over exponentially increasing sample sizes. ⌊lg k⌋Xi=0 (cid:0)2i+1 Pr[Y ∩ S ≥ 2i ](cid:1) ⌊lg k⌋Xi=0 O (cid:16)2i (f k/22i + pf /2i )(cid:17) = = O (cid:16)f k + pf (1 + lg k)(cid:17) = O (cid:16)pf k(cid:17) . E[Y ∩ S ] ≤ 2.1 A union upper bound f k . (3) Y ∩ S > First we consider overestimates. For positive parameters a and b to be chosen, we will bound the probability of the overestimate Define the threshold probability 1 + b 1 − a k n(1 − a) Note that p is defined deterministically, independent of any samples. I t is easy to see that the overestimate (3) implies one of the following two threshold sampling events: (A) The number of elements from X that hash below p is less than k . We expected pn = k/(1 − a) elements, so k is a factor (1 − a) below the expectation. (B) Y gets more than (1 + b)pY hashes below p, that is, a factor (1 + b) above the expectation. p = . 6 To see this, assume that both (A) and (B) are false. When (A) is false, we have k hashes from X below p, so the largest hash in S is below p. Now if (B) is also false, we have at most (1 + b)pY = (1 + b)/(1 − a) · f k elements from Y hashing below p, and only these elements from Y could be in S . This contradicts (3). By the union bound, we have proved Proposition 2 The probability of the overestimate (3) is bounded by PA + PB where PA and PB are the probabilities of the events (A) and (B), respectively. (4) Upper bound with 2-independence Addressing events like (A) and (B), let m be the number of elements in the set Z considered, e.g., Z = X or Z = Y . We study the number of elements hashing below a given threshold p ∈ [0, 1]. Assuming that the hash values are uniform in [0, 1], the mean is µ = mp. Assuming 2-independence of the hash values, the variance is mp(1 − p) = (1 − p)µ and the standard deviation is σ = p(1 − p)µ. By Chebyshev’s inequality, we know that the probability of a deviation by rσ is bounded by 1/r2 . Below we will only use that the relative standard deviation σ bounded by 1/√µ. For any given r ≤ √k/3, we will fix a and b to give a combined error probability of 2/r2 . More precisely, we will fix a = r/√k and b = r/√f k. This also fixes p = k/(n(1 − a)). We note for later that a ≤ 1/3 and a ≤ b. This implies (1 + b)/(1 − a) ≤ (1 + 3b) = 1 + 3r/pf k. In connection with (A) we study the number of elements from X hashing below p. The mean is pn ≥ k so the relative standard deviation is less than 1/√k . It follows that a relative error of a = r/√k corresponds to at least r standard deviations, so PA = Pr [#{x ∈ X h(x) < p} < (1 − a)np] < 1/r2 . In connection with (B) we study the number of elements from Y hashing below p. Let m = Y . The mean is pm = km/(n(1 − a)) and the relative standard deviation less than 1/√pm < 1/pkm/n. It follows than a relative error of b = r/pkm/n is more than r standard deviations, so PB = Pr [#{y ∈ Y h(y) < p} > (1 + b)mp] < 1/r2 . By Proposition 2 we conclude that the probability of (3) is bounded by 2/r2 . Rewriting (3) with (4), we conclude that Pr hY ∩ S > f k + 3rpf ki ≤ 2/r2 . This bounds the probability of the positive error in (1). The above constants 3 and 2 are moderate, and they can easily be improved if we look at asymptotics. Suppose we want good estimates for subsets Y of frequency at least fmin , that is, Y ≥ fmin X . This time, we set a = r/√f k , and then we get PA ≤ f /r2 . We also set b = r/√f k preserving PB ≤ 1/r2 . Now for any Y ⊆ X with Y > f n, we have Pr [Y ∩ S > (1 + ε)f k ] = (1 + f )/r2 r/√k + r/√f k 1 + r/√f k where ε = 1 − r/√k 1 − r/√k − 1 = With f = o(1) and k = ω(1), the error is ε = (1 + o(1))r/√f k, and the error probability is Pε = (1 + f )/r2 = (1 + o(1))/r2 . Conversely, this means that if we for subsets of frequency f and a relative positive error ε want an error probability around Pε , then we set r = p1/Pε and k = r2/(f ε2 ) = 1/(f Pε ε2 ). 7 . (5) (6) 2.2 A union lower bound We have symmetric bounds for underestimates: Y ∩ S < 1 − b′ 1 + a′ f k . (7) This time we define the threshold probability p′ = k n(1+a′ ) . It is easy to see that the overestimate (3) implies one of the following two events: (A′ ) The number of elements from X below p′ is at least k . We expected p′n = k/(1 + a′ ) elements, so k is a factor (1 + a′ ) above the expectation. (B′ ) Y gets less than (1 − b′ )pY hashes below p′ , that is, a factor (1 − b′ ) below the expectation. To see this, assume that both (A′ ) and (B′ ) are false. When (A′ ) is false, we have less than k hashes from X below p′ , so S must contain all hashes below p′ . Now if (B) is also false, we have at least (1 − b)p′ Y = (1 − b)/(1 + a) · f k elements from Y ⊆ X hashing below p′ , hence which must be in S . This contradicts (7). By the union bound, we have proved Proposition 3 The probability of the underestimate (7) is bounded by PA′ + PB ′ where PA′ and PB ′ are the probabilities of the events (A′ ) and (B′ ), respectively. Lower bound with 2-independence Using Proposition 3 we will bound the probability of underestimates, complementing our previous probability bounds for overestimates from Section 2.1. We will provide bounds for the same overall relative error as we did for the overestimates; namely 1 + b 1 − a − 1 = (a + b)/(1 − a) However, for the events (A′ ) and (B′ ) we are going to scale up the relative errors by a factor (1 + a), that is, we will use a′ = a(1 + a) and b′ = b(1 + a). The overall relative negative error from (7) is then ε = 1 − b′ ε′ = 1 − 1 + a′ = (a′ + b′ )/(1 + a′ ) < (1 + a)(a + b)/(1 + a′ ) < (a + b) < ε. Even with this smaller error, we will get better probability bounds than those we obtained for the overesti- mates. For (A) we used 1/√k as an upper bound on the relative standard deviation, so a relative error of a was counted as sA = a√k standard deviations. In (A′ ) we have mean µ′ = np′ = k/(1 + a′ ), so the relative standard deviation is bounded by 1/pk/(1 + a′ ) = √1 + a + a2/√k . This means that for (A′ ), we can count a relative error of a′ = a(1 + a) as A = a(1 + a)√k/p1 + a + a2 s′ = sA(1 + a)/p1 + a + a2 > sA 2 ≤ 1/s2 A , and now we can bound PA′ by 1/s′ standard deviations. In Section 2.1 we bounded PA by 1/s2 A . A The scaling has the same positive effect on our probability bounds for (B′ ). That is, in Section 2.1, a relative 8 error of b was counted as sB = b√f k standard deviations. With (B′ ) our relative error of b′ = b(1 + a) is counted as B = b(1 + a)pf k/p1 + a + a2 s′ = sB (1 + a)/p1 + a + a2 > sB 2 ≤ 1/s2 standard deviations, and then we can bound PB ′ by 1/s′ B . Summing up, our negative relative error B 2 + ε′ is smaller than our previous positive error ε, and our overall negative error probability bound 1/s′ A 2 is smaller than our previous positive error probability bound 1/sA 1/s′ 2 + 1/sB 2 . We therefore translate B (5) to Pr hY ∩ S < f k − 3rpf ki ≤ 2/r2 . which together with (5) establishes (1). Likewise (6) translates to Pr [Y ∩ S − f k > εf k)] ≤ 2(1 + f )/r2 1 + r/√f k where ε = 1 − r/√k − 1. As for the positive error bounds we note that with f = o(1) and k = ω(1), the error is ε = (1 + o(1))r/√f k and the error probability is Pε = (2 + o(1))/r2 . Conversely, this means that if we for a target relative error ε want an error probability around Pε , then we set r = p2/Pε and k = r2/(f ε2 ) = 2/(f Pε ε2 ). 2.3 Rare subsets (8) (9) We now consider the case where the expected number f k of samples from Y is less than 1/4. We wish to prove (2) Pr[Y ∩ S ≥ ℓ] = O(f k/ℓ2 + pf /ℓ). For some balancing parameter c ≥ 2, we use the threshold probability p = ck/n. The error event (A) is that less than k elements from X sample below p. The error event (B) is that at least ℓ elements hash below p. As in Proposition 2, we observe that ℓ bottom-k samples from Y implies (A) or (B), hence that Pr[Y ∩ S ≥ ℓ] ≤ PA + PB . The expected number of elements from X that hash below p is ck . The error event (A) is that we get less than k , which is less than half the expectation. This amounts to at least √ck/2 standard deviations, so by Chebyshev’s inequality, the probability of (A) is PA ≤ 1/(√ck/2)2 = 4/(ck). The event (B) is that at least ℓ elements from Y hash below p, while the expectation is only f ck . As- suming that ℓ ≥ 2f ck , the error is by at least (ℓ/2)/√f ck standard deviations. By Chebyshev’s inequality, the probability of (B) is PB ≤ 1/((ℓ/2)/√f ck)2 = 4f ck/ℓ2 . Thus PA + PB ≤ 4/(ck) + 4f ck/ℓ2 . We wish to pick c for balance, that is, 4/ck = 4f ck/ℓ2 ⇐⇒ c = ℓ/(pf k) However, we have assumed that c ≥ 2 and that ℓ ≥ 2f ck . The latter is satisfied because 2f kℓ/(√f k) = 2√f ℓ and f ≤ 1/4. Assuming that c = ℓ/(√f k) ≥ 2, we get PA + PB ≤ 8/(k(ℓ/(pf k))) = 8pf /ℓ. 9 2f ck = When ℓ/(√f k) < 2, we set c = 2. Then PA + PB ≤ 2/k + 8f k/ℓ2 ≤ 16f k/ℓ2 . Again we need to verify that ℓ ≥ f ck = 2f k , but that follows because ℓ ≥ 1 and f k ≤ 1/4. We know that at one of the above two cases applies, so we conclude that P [Y ∩ S ≥ ℓ] ≤ PA + PB = O(f k/ℓ2 + pf /ℓ), completing the proof of (2). 3 Priority sampling We now consider the more general situation where we are dealing with a set I of weighted items with wi denoting the weight of item i ∈ I . Let P I = Pi∈I wi denote the total weight of set I . Now that we are dealing with weighted items, we will use priority sampling [18] which generalizes the bottom-k samples we used for unweighted elements. Each item or element i is identified by a unique key which is hashed uniformly to a random number hi ∈ (0, 1). The item is assigned a priority qi = wi/hi > wi . In practice, hash values may have some limited precision b, but we assume that b is large enough that the resulting rounding can be ignored. We assume that all priorities end up distinct and different from the weights. If not, we could break ties based on an ordering of the items. The priority sample S of size k contains the k samples of highest priority, but it also stores a threshold τ which is the (k + 1)th highest priority. Based on this we assign a weight estimate bwi to each item i. If i is not sampled, bwi = 0; otherwise bwi = max{wi , τ }. A basic result from [18] is that E[ bwi ] = wi if the hash function is truly random (in [18], the hi were described as random numbers, but here they are hashes of the keys). We note that priority sampling generalize the bottom-k sample we used for unweighted items, for if all weights are unit, then the k highest priorities correspond to the k smallest hash values. In fact, priority sampling predates [12], and [12] describes bottom-k samples for weighted items as a generalization of priority sampling, picking the first k items according to an arbitrary randomized function of the weights. The original objective of priority sampling [18] was subset sum estimation. A subset J ⊆ I of the items is selected, and we estimate the total weight in the subset as bwJ = P{ bwi i ∈ J ∩ S }. By linearity of expectation, this is an unbiased estimator. A cool application from [18] was that as soon as the signature of the Slammer worm [25] was identified, we could inspect the p riority samples from the past to track its history and identify infected hosts. An important point is that the Slammer worm was not known when the samples were made. Samples are made with no knowledge about which subsets will later turn out to be of interest. Trivially, if we want to estimate the relative subset weight P J/ P I and we do not know the exact total, we can divide bwJ with the estimate bwI of the total. As with the bottom-k sampling for unweighted items, we can easily use priority sampling to estimate the similarity of sets of weighted items: given the priority sample from two sets, we construct the priority sample of their union, and estimate the intersection as a subset. This is where it is important that we use a hash function so that the sampling from different sets is coordinated, e.g., we could not use iterative sampling procedures like the one in [11]. In the case of histogram similarity, it is natural to allow the same item to have different weights in different sets. More specifically, allowing zero weights, every possible item ha s a weight in each set. For the similarity we take the sum of the minimum weight for each item, and divide it by the sum of the maximum weight for each item. This requires a special sampling that we shall return to in Section 3.9. 10 Priority sampling is not only extremely easy to implement on-line with a standard min-priority queue; it also has some powerful universal properties in its adaption to the concrete input weights. As conjec- tured in [18] and proved in [33], given one extra sample, priority sampling has smaller variance sum Pi Var[ bwi ] than any off-line unbiased sampling scheme tailored for the concrete input weights. In par- ticular, priority sampling benefits strongly if there are do minant weights wi in the input, estimated precisely as bwi = max{wi , τ } = wi . In the important case of heavy tailed input distributions [1], we thus expect most of the total weight to be estimated without any error. The quality of a priority sample is therefore often much better than what can be described in terms of simple parameters such as total weight, number of items, etc. The experiments in [18] on real and synthetic data show how priority sampling often gains orders of magnitude in estimate quality over competing methods. The quality of a priority estimate depends completely on the distribution of weights in the input, and often we would like to know how much we can trust a given estimate. What we really want from a sample is not just an estimate of a subset sum, but a confidence interv al [34]: from the information in the sample, we want to derive lower and upper bounds that capture the true value with some desired probability. Some applications of such concervative bounds are given in [16]. What makes priority sampling tricky to analyze is that the priority threshold τ is a random variable depending on all the random priorities. It may be very likely that the threshold τ ends up smaller than some dominant weight wi , but it could also be bigger, so we do have variance on all weight estimates bwi . All current analysis of priority sampling [18, 33, 34] is heavily based on true randomness, assuming that the priorities are independent random variables, e.g., the unbiasedness proof from [18] that E[ bwi ] = wi starts by fixing the priorities qj of all the other items j 6= i. However, in this paper, we want to use hash functions with independence as low as 2, and then any such analysis breaks down. In fact, bias may now be introduced. To see this, consider the following extreme case of 2-independent hashing of n keys: divide (0, 1] into n subintervals Ii = (i/n, (i+ 1)/n]. With probability 1− 1/n, the keys are all mapped to different random subintervals, and with probability 1/n, all keys are mapped to the same random subinterval. Within the subintervals, the hashing is totally random. This scheme is clearly 2-independent, but highly restricted for n > 2. As a simple example of bias, consider a priority sample of k = 2 out of n = 3 unit weight keys. A messy computer calculation shows that the expected weight estimates are 1.084. Relation to threshold sampling Generalizing the pattern for unweighted sets, our basic goal is to relate the error probabilities with priority sampling to the much simpler case of threshold sampling for weighted items. In threshold sampling, we are not given a predefined sa mple size. Instead we are given a fixed threshold t. We use exactly the same random priorities as in priority sampling, but now an item is sampled if and only if qi > t. The weight estimate is i = (cid:26) 0 if qi ≤ t bw t max{wi , t} if qi > t In statistics, threshold sampling is known as Poisson sampling with probability proportional to size [30]. The name threshold sampling is taken from [17]. The bw t i notation from (10) is well-defined also when t is a variable, and if priority sampling leads to threshold τ , then the priority estimate for item i is bwi = bwτ i . With a fixed threshold t, it is trivial to see that the estimates are unbiased, that is, E[ bw t i ] = wi ; for if wi ≥ t, we always have bw t i = wi , and if wi < t, then E[ bw t i ] = t Pr[qi > t] = t Pr[hi < wi /t] = wi . (10) 11 The unbiasedness with fixed threshold t only requires that each hi is uniform in (0, 1). No independence is required. This contrasts the bias we may get with the variable priority threshold τ with limited dependence. With threshold sampling, concentration bounds for subset sum estimates are easily derived. For a subset J ⊆ I , the threshold estimate Pi∈J bwi is naturally divided in an exact part for large weights and a variable part for small weights: Xi∈J,wi≥t bw t i = Xi∈J,wi≥t wi Xi∈J,wi<t bw t i = t Xi∈J,wi<t Xi , where Xi = [hi < wi/t] ∈ {0, 1}. Each Xi depends on hi only, so if the hi are d-independent, then so are the hi . Let X = Pi∈J,wi<t Xi and µ = E[X ] = Pi∈J,wi<t wi/t. As in the unweighted case, if the hash function is 2-independent, then Var[X ] < µ, and by Chebyshev’s inequality Pr[X − µ ≥ r√µ] ≤ 1/r2 . Informally speaking, for bounded errors and modulo constant factors, our main result is that concentra- tion bounds for threshold sampling apply to priority sampling as if the variable priority threshold was fixed. As in the unweighted case, the result is obtained by a union bound over threshold sampling events. In the unweighted case, we only needed to consider the four threshold sampling error events (A), (B), (A’), and (B’). However, now with weighted items, we are going to reduce a priority sampling error event to the union of an unbounded number of threshold sampling error events that happen with geometrically decreasing probabilities. (11) 3.1 Notation and definitions Before formally presenting our priority sampling results, we introduce some notation and definitions. Fractional subsets and inner products It is both convenient and natural to generalize our estimates from regular subsets to fractional subsets, where for each i ∈ I , there is a fraction fi ∈ [0, 1] specifying that item i contributes fiwi to the weight of fractional subset. A regular subset corresponds to the special case where fi ∈ {0, 1}. We are now interested in inner products between the fraction vector f = (fi )i∈I and the vectors of weights or weight estimates. Our goal is to estimate f w = Pi∈I fiwi . With threshold t, we estimate f w as f bw t = Pi∈I fi bw t i = Pi∈S fi bw t i . With fixed threshold t, we have E[ bw t i ] = wi , so E[fi bw t i ] = fiwi and E[f bw t ] = f w. As an example, suppose we sampled grocery bills. For each bill sampled, we could check the fraction spent on candy, and based on that estimate the total amount spent on candy. To emulate a standard subset J , we let f be the characteristic function of J , that is, fi = 1 if i ∈ J ; otherwise fi = 0. In fact, we will often identify a set with its characteristic vector, so the weight of J can be written as J w and estimated as J bw t . Using inner products will simplify a lot of notation in our analysis. The generalization to fractional subsets comes for free in our analysis which is all based on concentration bounds for sums of random variables Xi ∈ [0, 1]. Notation for small and sampled weights With threshold t, we know that variability in the estimates is from items i with weight below t. We will generally use a subscript <t to denote the restriction to items i 12 with weights wi < t, e.g., I<t = {i ∈ I wi < t}, w<t = (wi )i∈I<t , and f w<t = Pi∈I<t fiwi . Notice that f w<t does not include i with wi ≥ t even if fiwi < t. Above we defined w<t to denote the vector (wi )i∈I<t of weights below t, and used it for the inner product f w<t = Pi∈I<t fiwi . When it is clear from the context that we need a number, not a vector, we will use w<t to denote the sum of these weights, that is, w<t = Pi∈I<t wi = 1w<t where 1 is the all 1s vector. Since fi ≤ 1 for all i, we always have f w<t ≤ w<t . We shall use subscript ≤t , ≥t , and >t to denote the corresponding restriction to items with weight ≤ t, ≥ t, and > t, respectively. We also introduce a superscript t notation to denote the restriction to items sampled with threshold t, that is, items i with qi > t, so I t <t denotes the set of items with weights below t that ended up sampled. Identifying this set with its characteristic vector, we can write our estimate with threshold t as f bw t = f w≥t + t(f I t <t ). Error probability functions As mentioned earlier, we will reduce the priority sampling error event to the union of an unbounded number of threshold sampling error events that happen with geometrically decreasing probabilities. Our reduction will hold for most hash functions, including 2-independent hash functions, but to make such a claim clear, we have to carefully describe what properties of the hash functions we rely on. Assume that the threshold t is fixed. With reference to (12), the variability in our estim ate is all from <t = Xi∈I<t f I t Xi , where Xi = fi [hi < wi/t] ∈ [0, 1]. As for the regular subsets in (11), let X = Pi∈I<t Xi and µ = E[X ]. We are interested in an error probability function ℘ such that for µ > 0, δ > 0, if µ = E[X ], then (13) Pr[X − µ > δµ] ≤ ℘(µ, δ). The error probability function ℘ that we can use depends on the quality of the hash function. For example, if the hash function is 2-independent, then Var[X ] ≤ µ, and then by Chebyshev’s inequality, we can use ℘Chebyshev (µ, δ) = 1/(δ2 µ). (14) (12) In the case of full randomness, for δ ≤ 1, we could use a standard 2-sided Chernoff bound (see, e.g., [26]) ℘Chernoffδ≤1 (µ, δ) = 2 exp(−δ2µ/3). (15) For most of our results, it is more natural to think of δ as a function of µ and some target error probability P ∈ (0, 1), defining δ(µ, P ) such that (16) µ(µ, δ(µ, P )) = P . Returning to threshold sampling with threshold t, by (12) the error is f bw t − f w = t(f I t <t ) − f w<t . Hence Pr[f bw t − f w > δ(f w<t /t, P )f w<t ] ≤ P . (17) When we start analyzing priority sampling, we will need to relate the probabilities of different threshold sampling events. This places some constraints on the error probability function ℘. Mathematically, it is convenient to allow ℘ to attain values above 1, but only values below 1 are probabilistically interesting. 13 Definition 4 An error probability function ℘ : R≥0 × R≥0 → R≥0 is well-behaved if (a) ℘ is continuous and strictly decreasing in both arguments. (b) If with the same absolute error we decrease the expectancy, then the probability goes down. Formally if µ′ < µ and µ′δ ′ ≥ µδ , then ℘(µ′ , δ ′ ) < ℘(µ, δ). We also have an optional condition for cases where we only care for δ ≤ 1 as in (15) (c) If δ ≤ 1 and ℘(µ, δ) < P (c) for some constant P (c) depending on ℘, then ℘(µ, δ) falls at least ℘ ℘ proportionally to µδ2 . Formally, if δ0 , δ1 ≤ 1, ℘(µ0 , δ0 ) < 1, and µ0δ2 0 < µ1 δ2 1 , then µ0 δ2 0 µ1 δ2 1 ℘(µ0 , δ0 ) ≥ ℘(µ1 , δ1 ). (18) We will use condition (c) to argue that probabilities of different events fall geometrically. The condition is trivially satisfied with our 2-independent Chebyshev bou nd (14), so we can just set P (c) ℘Chebyshev = 1. The restrictions in (c) are necessary for the Chernoff bound (15), ℘Chernoffδ≤1 = 2 exp(−δ2 µ/3), which only falls fast enough for δ2 µ/3 ≥ 1, hence with ℘Chernoffδ≤1 (µ, δ) ≤ P (c) Chernoffδ≤1 = 2/e. As a further illustration, ℘ with 4-independence, we have the 4th moment bound µ+3µ2 (see, e.g., [22, Lemma 4.19]). For µ ≥ 1, (δµ)4 µδ2 (cid:17)2 this is upper bounded by ℘4th-momentµ≥1 (µ, δ) = (cid:16) 2 . For δ ≤ 1, the condition µ ≥ 1 is satisfied if ℘4th momentµ≥1 (µ, δ) ≤ 4, so we can just use P (c) ℘4th moment = 1. Threshold con fidence intervals In the case of threshold sampling with a fixed threshold t, we get some trivial confidence intervals for the true value f w. The sample gives us the exact value f w≥t for weights at least as big as t, and an estimate f bw t <t for those below. Setting f bw− <t = min{x (1 + δ(x/t, P ))x ≥ f bw t ≥t} f bw+ <t = max{x (1 − δ(x/t, P ))x ≤ f bw t ≥t} <t(cid:3) ≥ 1 − 2P . Pr (cid:2)f w≥t + f bw− <t ≤ f w ≤ f w≥t + f bw+ We are going to show that similar bounds can be obtained for priority sampling. 3.2 Priority sampling: the main result we get We are now ready to present our main technical result. We are considering a random priority sample of size k , and let τ denote the resulting priority threshold. The sample size k and the target error probability P are both fixed in advance of the random sampling. Theorem 5 Let the error probability function ℘ satisfy Definition 4 including (c). With target error proba- bility P ≤ P (c) ℘ , let δ = 6 δ(f w<τ /(3τ ), P ). If δ ≤ 2, then Pr[f bwτ − f w > δf w<τ ] ≤ 6P . 14 The above constants are not optimized, but with O-notation, some of our statements would be less clear. Ignoring the constants and the restriction δ ≤ 2, we see that our error bound for priority sampling with threshold τ is of the same type as the one in (17) for threshold sampling with fixed threshold t = τ . The proof of Theorem 5 is rather convoluted. We consider a single priority sampling event with k samples and priority threshold τ . It assigns a random priority qi to each item, and this defines a sample for any given threshold t. In particular, τ ≥ t if and only if we get at least k + 1 samples with threshold t. Note that Pr[τ = t] = 0 for any given t. We define tmax = min{ t Pr[τ ≥ t] ≤ P } tmin = max{ t Pr[τ < t] ≤ P } By definition, Pr[τ 6∈ [tmin , tmax )] ≤ 2P . By union, to prove Theorem 5, it suffices to show that the following good event errors with probability at most 4P : (19) (20) (21) ∀t ∈ [tmin , tmax ) : δ = δ(f w<t /(3t), P ) ≤ 1/3 =⇒ f bw t − f w > 6δf w<t Note that our variable δ is 6 times smaller than the one in the statement of Theorem 5. This parameter change will be more convenient for the analysis. What makes (21) very tricky to prove is that δ(f w<t /(3t), P ) can vary a lot for different t ∈ [tmin , tmax ). Priority con fidence intervals The format of Theorem 5 makes it easy to derive confidence inte rvals like those for threshold sampling. A priority sample with priority threshold τ gives us the exact value f w≥τ for weights at least as big as τ , and an estimate f bwτ <τ for those below. For an upper bound on f w<τ , we compute <τ = max{x δ = 6 δ(x/(3τ ), P )) ∧ (1 − δ)x ≤ f bwτ f bw+ ≥τ }. Note that here in the upper bound, we only consider δ ≤ 1, so we do not need to worry about the restriction δ < 2 in Theorem 5. For a lower bound on f w<τ , we use <τ = min{x δ = 6 δ(x/(3τ ), P )) ≤ 2 ∧ (1 + δ)x ≥ f bwτ f bw− ≥τ }. Here in the lower bound, the restriction δ = 6 δ(x/(3τ ), P )) ≤ 2 prevents us from deriving a lower bound x = f bw− ≥τ /3. In such cases, we use the trivial lower bound x = f bw− <τ ≤ f bwτ <τ = 0 which in distance from f bwτ <τ is at most 1.5 times bigger. Now, by Theorem 5, Pr (cid:2)f w≥τ + f bw− <τ (cid:3) ≥ 1 − 12P . <τ ≤ f w ≤ f w≥τ + f bw+ In cases where the exact part f w≥τ of an estimate is small compared with the variable part f bwτ ≥τ , we may be interested in a non-zero lower bound f bw− <τ even if it is smaller than f bwτ ≥τ /3. To do this, we need bounds for larger δ . Large errors We are now going to present bounds that works for arbitrarily large relative errors δ . We assume a basic error probability function ℘ satisfying Definition 4 (a) and (b) while (c) may not be satisfi ed. The bounds we get are not as clean as those from Theorem 5. In particular, they involve tmax from (19). Since we are only worried about errors δ > 1, we only have to worry about positive errors. 15 Theorem 6 Set Then ℓ = lg⌈(tmax /τ )⌉ δ = δ(f w<τ /τ , P /ℓ2 ). Pr[f bwτ <τ > (2 + 2δ)f w<τ ] < 3P . Complementing Theorem 5, we only intend to use Theorem 6 for large errors where (2 + 2δ) = O(δ). We wish to provide a probabilistic lower bound for f w<τ . Unfortunately, we do not know tmax which depends on the whole weight vector (wi )i∈I . However, based our priority sample, it is not hard to generate a probabilistic upper bound tmax on tmax such that Pr[tmax < tmax ] ≤ P . We set ℓ = ⌈lg(tmax /τ )⌉ 2 ) ∧ 2(1 + δ )x ≥ f bwτ f bw− <τ = min{x δ = δ(x/τ , P /ℓ <τ }. Pr (cid:2)f w<τ ≥ f bw− <τ (cid:3) ≥ 1 − 4P . <τ be the value we would have obtained if we had computed f bw− To see this, let f bw∗ <τ using the real tmax . Our error event is that tmax < tmax or f w<τ < f bw∗ <τ . The former happens with probability at most P , and Theorem 6 states that the latter happens with probability at most 3P . Hence none of these error events happen with probability at least 1 − 4P , but then tmax ≥ tmax , implying f bw− <τ ≤ f bw∗ <τ ≤ f w<τ . Theorem 5, our main result, is proved in Sections 3.3 –3.5. Th eorem 6, which is much easier, is proved in Section 3.6. In Section 3.7 we show how to compute the tmax used for confidence lower bound with Theorem 6. Finally, in Section 3.8 we will argue that we for typical weight distributions expect to get ℓ = 1. Then by Theorem 6, (22) (23) 3.3 The priority threshold To prove Theorem 5 we need a handle on the variable priority threshold. With priority sampling we specify the number k of samples, and use as threshold τ the (k + 1)th priority. Recall for any threshold t that the subscript ≤t indicates restriction to items with weight below t. To relate this notation to a priority sample of some specified size k , we let k≤t denote k minus the number of items with weight bigger than t. We define k<t accordingly. With threshold t, the expected number of samples is E [I t ] = k − k≤t + w≤t /t = k − k<t + w<t /t. The last equality is because weights wi = t cancel out. The ideal threshold We define the ideal threshold t∗ to be the one leading to an expected number of exactly k samples, that is w≤t∗ = t∗ k≤t∗ . Lemma 7 tk≤t − w≤t is strictly increasing in t, so (a) t∗ is uniquely defined, (b) w≤t > k≤t t for any t < t∗ , and (c) w≤t < k≤t t for any t > t∗ . 16 Proof If t increases without passing any weight value, then k≤t and w≤t are not changed, and the statement is trivial. When t reaches the value of some weight wi , then both tk≤t and w≤t are increased by the same value wi (if there are j weights with value wi , the increase is by jwi ). We would like to claim that the priority sampling threshold τ is concentrated around t∗ , but this may be far from true. To illustrate what makes things tricky to analyze, consider the case where, say, we have k − 1 weights of size t∗ , and then a lot of small weights that sum to t∗ . In this case we get an upper bound on τ which is close to t∗ , but we do not get any good lower bound on τ even if we have full randomness. On the other hand, in this case, it is only little weight that is affected by the downwards variance in τ . 3.4 Tightening the gap The following lemmas give us a much tighter understanding of t ∈ [tmin , tmax ). Lemma 8 If t ≥ t∗ then t(1 + δ(w≤t /tmax , P )) ≥ tmax . Proof Let δ = δ(w≤t /tmax , P ) and T = (1 + δ)t. Assume for a contradiction that T < tmax . By Lemma 7 (c), since t ≥ t∗ , we have w≤t ≤ tk≤t , so k≤t ≥ w≤t /t = (1 + δ)w≤t /T For the priority threshold to be as big as T we need I T ≤t ≥ k≤t + 1 and E[I T ≤t ] = w≤t/T , so Pr[τ ≥ T ] ≤ ℘(w≤t /T , δ) ≤ ℘(w≤t /tmax , δ) = P . But this contradicts the minimality of tmax from (19). Lemma 9 If t ∈ [tmin , t∗ ) then t ≥ (1 − δ(w≤t /t, P ))t∗ . Proof Let δ = δ(w≤t /t, P ). The proof is by contradiction against our maximal lower bound tmin from (20). The priority threshold is smaller than t if I t ≤t ≤ k≤t . The expectancy is E[I t ≤t ] = w≤t /t. Suppose for a contradiction that (1 − δ)w≤t /t > k≤t . Then Pr[τ < t] < ℘(w≤t /t, δ) = P , implying that t ≥ tmin is a lower bound. If t > tmin this contradicts the maximality of tmin . Otherwise, t′ > t with no weights in (t, t′ ], that is, w≤t′ = w≤t and k≤t′ = k≤t . By we pick an infinitesimally larger er δ ′ = δ(w≤t′ /t′ , P ) > δ , and then we still Definition 4 (a), we get a corresponding infinitesimally larg have (1 − δ ′ )w≤t′ /t′ > k≤t′ , implying that t′ > t = tmin is a lower bound contradicting the maximality of tmin . Thus we conclude that (1 − δ)w≤t /t ≤ k≤t , or equivalently, t ≥ (1 − δ)w≤t /k≤t . Finally by Lemma 7 (b), since t < t∗ , we have w≤t/k≤t ≥ t∗ . This completes the proof that t ≥ (1 − δℓ )t∗ . In order to give a joint analysis for t bigger and smaller than t∗ , we make a conservative combination of Lemma 8 and 9. Lemma 10 Suppose [t− , t+ ) = [tmin , t∗ ) or [t− , t+ ) = [t∗ , tmax ). δ(w≤t /t+ , P ))t+ . If t ∈ [t− , t+ ) then t ≥ (1 − 17 Proof Let δ = δ(w≤t /t+ , P ). If [t− , t+ ) = [t∗ , tmax ), by Lemma 8, t ≥ t+/(1 + δ) ≥ (1 − δ)t+ . If [t− , t+ ) = [tmin , t∗ ), by Lemma 9, t ≥ (1 − δ(w≤t /t, P ))t+ > (1 − δ)t+ . The last inequality uses that δ(w≤t /t, P ) ≤ δ . This is because w≤t /t ≥ w≤t /t+ , so by Definition 4 (a), ℘(w≤t /t, δ) ≥ ℘(w≤t /t+ , δ) = P . Loosing a factor 2 in the error probability to cover t bigger or smaller than t∗ , our good event (21) reduces to (24) ∀t ∈ [t− , t+ ) : δ = δ(f w<t /(3t), P ) ≤ 1/3 =⇒ f bw t − f w > 6δf w<t By Lemma 10, the bound on δ implies that t ≥ (2/3)t+ . Therefore (24) is implied by ∀t ∈ [t− , t+ ) : δ = δ(f w<t /(2t+ ), P ) ≤ 1/3 =⇒ f bw t − f w ≤ 6δf w<t . (25) One advantage of dealing with f bw<t/t+ instead of f bw<t/t is that f bw<t/t+ is proportional to f bw<t hence increasing in t whereas f bw<t/t may not be monotone in t. Then δ(f w<t′ − /(2t+ ), P ) is decreasing in t. If δ(f w<t− /(2t+ ), P ) > 1/3, we let t′− be the smallest value such that δ(f w<t′ − /(2t+ ), P ) ≤ 1/3; otherwise we set t′− = t− . Then (25) is equivalent to ∀t ∈ [t′− , t+ ) : δ = δ(f w<t /(2t+ ), P ) =⇒ f bw t − f w ≤ 6δf w<t . 3.5 Dividing into layers We now define a sequence t0 > t1 > · · · > tL+1 of decreasing thresholds with t0 = t+ and tL+1 = t′− . For ℓ = 0, .., L we require (27) f w≤tℓ+1 ≥ f w<tℓ /2. For ℓ < L, we pick tℓ+1 smallest possible satisfying (27). Then (26) f w<tℓ+1 < f w<tℓ /2. We arrive ℓ = L when f w≤t′− ≥ f w<tℓ /2, and then we set tL+1 = t′− . For each “layer” ℓ ≤ L, we define δℓ = δ(f w<tℓ /(2t+ ), P ), (29) noting that this is the same value as we would use for t = tℓ in (26). By definition, for all ℓ ≤ L, we have ℘(f w<tℓ /(2t+ ), δℓ ) = P . Since tℓ > t′− , we have δℓ ≤ 1/3 ≤ 1, so it follows from Definition 4 (c) that there is a constant C such that f w<tℓ δ2 ℓ = C for all ℓ ≤ L. For ℓ = 1, ..., L, by (28), we have f w<tℓ < f w<tℓ−1 /2. Therefore δℓ > √2 δℓ−1 δℓf w<tℓ < δℓ−1 f w<tℓ−1 /√2 This will correspond to an effect where the relative errors are geometrically increasing while the absolute errors are geometrically decreasing. Another important thing to notice is that by (27), f w≤tℓ+1 ≥ f w<tℓ /2, so δ(f w<tℓ+1 /t+ , P ) ≤ δ(f w<tℓ /(2t+ ), P ) = δℓ . Therefore, by Lemma 10, tℓ+1 ≥ (1 − δℓ )t+ . (32) (28) (30) (31) 18 Good layers For each layer ℓ < L, our good event will be that for weights in [tℓ+1 , tℓ ), the relative estimate error is bounded by 2δℓ . Formally [tℓ+1 ,tℓ ) − f w[tℓ+1 ,tℓ ) (cid:12)(cid:12)(cid:12) ∀t ∈ [tℓ+1 , t+ ) : (cid:12)(cid:12)(cid:12)f bw t ≤ 2δℓ f w[tℓ+1 ,tℓ ) Above, the subscript [tℓ+1 ,tℓ ) denotes the restriction to items i with weights wi ∈ [tℓ+1 , tℓ ). The last layer L is special in that we want to consider all weights below tL . Here the good event is that ∀t ∈ [tL+1 , t+ ) : (cid:12)(cid:12)f bw t <tL − f w<tL (cid:12)(cid:12) ≤ 3δL f w<tL To prove Theorem 5, we are going to prove two statements. • Assume that all layers are good satisfying (33) and (34). If for any t ∈ (t′− , t+ ] we add up the errors from all relevant layers, then the total error is bounded by 6δ(f w<t /(2t+ ), P )f w<t , so (26) satisfied. • If Pℓ is the probability that a layer ℓ fails, then the Pℓ are geometrically increasing and PL = O(P ), so by union, the probability that any layer fails is O(P ). (33) (34) f bw t − f w ≤ ≤ Adding layer errors Assuming that all layers are good satisfying (33) and (34), we pick an arbitrary threshold t ∈ [t′− , t+ ). We which to bound the estimate error f bw t − f w. Let h be the layer such that t ∈ [th−1 , th ). We can only have estimate errors from weights below t < th , so L−1Xℓ=h (cid:12)(cid:12)(cid:12)f bw t [tℓ+1 ,tℓ ) − f w[tℓ+1 ,tℓ ) (cid:12)(cid:12)(cid:12) + (cid:12)(cid:12)f bw t <tL − f w<tL (cid:12)(cid:12) L−1Xℓ=h 2δℓw[tℓ+1 ,tℓ ) + 3δL f w<tL L−1Xℓ=h By (30), the δℓ are increasing, so in the above sum, every f w<tℓ appears with a positive coefficient. It follows that we could only get a larger sum if (28) was more than tight with f w<tℓ = f w<tℓ−1 /2 for ℓ ≤ L. Then we would have f w<tℓ − f w<tℓ+1 = f w<tℓ /2 and corresponding to (31), δℓ f w<tℓ = δℓ−1f w<tℓ−1 /√2. Thus we get 2δℓ (f w<tℓ − f w<tℓ+1 ) + 3δL f w<tL = L−1Xℓ=h f bw t − f w ≤ L−1Xℓ=h ≤ < 3δhf w<th 2δℓ (f w<tℓ − f w<tℓ+1 ) + 3δL f w<tL δhf w<th /√2 + 3δh f w<th /√2 L−h ℓ−h 19 (35) (36) Therefore i=1 1/√2 = 1/(1 − 1/√2) < 3. The last inequality exploits that P∞ Since t ≤ th , we have δ(f w<t /(2t+ ), P ) ≥ δ(f w<th /(2t+ ), P ) = δh . Also, t > th+1 , so by (27), f w<t ≥ f w≤th+1 ≥ f w<th /2, so δ(f w<t /(2t+ ), P ) f w<t ≥ δhf w<th /2. f bw t − f w ≤ 3δhf w<th ≤ 6 δ(f w<t /(2t+ ), P ) f w<t . Thus we conclude that (26) follows from (33) and (34). Intermediate layer error probabilities We now consider the intermediate layers ℓ = 0, ..., L − 1. We want to show that the probability Pℓ of violating (33) increases geometrically with ℓ, yet remains bounded by P . First we consider the upper bound part of (33) ∀t ∈ [tℓ+1 , t+ ) : f bw t [tℓ+1 ,tℓ ) ≤ (1 + 2δℓ )f w[tℓ+1 ,tℓ ) . We claim that it can never be violated. The worst that can happen is that every item i in the layer gets sampled, and the estimate is at most fit+ . However, the items all have weight at least tℓ+1 and by (32), tℓ+1 ≥ (1 − δℓ )t+ . The increase is thus by at most a factor t+/tℓ+1 ≤ 1/(1 − δℓ ), which for δℓ ≤ 1/3 is at most (1 + 2δℓ ). Thus (35) is satisfied regardless of the random choices. We now consider the lower bound part of (33) ∀t ∈ [tℓ+1 , t+ ) : f bw t [tℓ+1 ,tℓ ) ≥ (1 − 2δℓ )f w[tℓ+1 ,tℓ ) . This event could happen. To bound the probability, we will focus on the loss f w[tℓ+1 ,tℓ ) − f bw t [tℓ+1 ,tℓ ) . When bounding the loss, we do not consider the gain from possible overestimates of sampled items. We only consider the actual losses fiwi from unsampled items i. Conservatively, we consider an item i lost if qi ≤ t+ . This includes any item unsampled with some threshold t ≤ t+ . The loss for every threshold t ≤ t+ is thus bounded as [tℓ+1 ,tℓ ) ≤ Xi:wi∈[tℓ+1 ,tℓ ) f w[tℓ+1 ,tℓ ) − f bw t [qi ≤ t+ ]fiwi . We know that wi ≥ tℓ+1 ≥ (1 − δℓ )t+ . Therefore Pr[qi ≤ t+ ] = Pr[hi ≥ wi/t+ ] ≤ Pr[hi ≥ tℓ+1/t+ ] = 1 − tℓ+1/t+ ≤ δℓ . The expected loss from layer ℓ is thus bounded by Xi:wi∈[tℓ+1 ,tℓ ) For (36) to fail, we need a loss that is twice this big, that is, 2δℓ f w[tℓ+1 ,tℓ ) . We know that items i’s loss contribution [qi ≤ t+ ]fiwi depends only on hi and that it is at most t+ . The probability of violating (36) is therefore bounded by ℘(δℓ f w[tℓ+1 ,tℓ )/t+ , 1) ≤ ℘(δℓ f w<tℓ /(2t+ ), 1). Let µℓ = δℓf w<tℓ /(2t+ ). Then Pℓ = ℘(µℓ , 1) is our bound on the error probability. From (31), we know that δℓ f w<tℓ < δℓ−1 f w<tℓ−1 /√2, so µℓ < µℓ−1/√2. It follows from Definition 4 (c) that ℘(µℓ , 1) > √2 ℘(µℓ−1 , 1), so the Pℓ are geometrically increasing, and their sum is bounded by 3PL−1 . δℓfiwi = δℓf w[tℓ+1 ,tℓ ) . 20 Finally, by definition (29), ℘(f w<tL−1 /(2t+ ), δL−1 ) = P . To compare P with PL−1 , by Definition 4 (c), we compare f w<tL−1 /(2t+ )δ2 L−1 with µL−112 = δL−1f w<tL−1 /(2t+ ), and conclude that PL−1 ≤ δL−1P ≤ P /3. The probability that any intermediate layer ℓ < L fails (36) is thus at most P . Since (36) was always satisfied, we conclude that (34) is satisfied for al l layers ℓ < L with probability P . /(1 − δL ). The last layer We now consider items i with weights below tL . On the upper bound side, the good event (34) states that ∀t ∈ [tL+1 , t+ ) : f bw t (37) <tL ≤ (1 + 3δL )f w<tL . We will show that (37) fails with probability less than P . For an upper bound on the estimate with any threshold t ∈ [tL+1 , t+ ), we include item i if qi > tL+1 , and if so, we give it at an estimate of fi t+ which is bigger than the sampled estimate with threshold t ≤ t+ . The result is at most a factor t+/tL+1 bigger than in the sampled estimate with threshold tL+1 , and by (32), tL+1 ≥ (1 − δL )t+ . Thus, regardless of the random choices made, we conclude that <tL ≤ f bwtL+1 ∀t ∈ [tL+1 , t+ ) : f bw t ≤tL Consider the following error event: f bwtL+1 (38) > (1 + δL )f w≤tL ≤tL The maximal item contribution to f bwtL+1 is bounded by tL ≤ t+ , so the probability of (38) is bounded by ≤tL ℘(f w≤tL /t+ , δL ) ≤ ℘(f w≤tL /(2t+ ), δL )/2 = P /2. If (38) does not happen, then since δL ≤ 1/3, ∀t ∈ [tL+1 , t+ ) : f bw t <tL ≤ (1 + δL )f w≤tL /(1 − δL ) ≤ (1 + 3δL )f w≤tL , which is the statement of (37). We conclude that (37) fails with probability at most P /2. We now consider the lower bound side of (34) which states that ∀t ∈ [tL+1 , t+ ) : f bw t <tL ≥ (1 − 3δL )f w<tL The analysis is very symmetric to the upper bound case. For a lower bound for weights wi < tL with any threshold t ∈ [tL+1 , t+ ), we only include i if qi > t+ , and if so, we only give i the estimate fi tL+1 which is smaller than the sampled estimate with threshold t > tL+1 . Our samples are exactly the same as those we would get with threshold t+ , and our estimates are smaller by a factor tL+1/t+ ≥ (1 − δL ), so we conclude that regardless of the random choices, <tL ≥ f bwt+ ∀t ∈ [tL+1 , t+ ) : f bw t <tL (1 − δL ) We now consider the error event: f bwt+ ≤tL < (1 − δL )f w≤tL The maximal item contribution to f bwt+ is t+ , so as for (38), we get that the probability of (40) is bounded ≤tL by ℘(f w≤tL /t+ , δL ) ≤ P /2. If (40) does not happen, then since δL ≤ 1/3, ∀t ∈ [tL+1 , t+ ) : f bw t <tL ≥ (1 − δL )f w≤tL (1 − δL ) > (1 − 2δL )f w≤tL , which implies (39). We conclude that (37) fails with probability at most P /2. Including the probability of an upper bound error (38), we get that (34) fails with probability at most P . (39) (40) 21 Summing up Above we proved that the probability that (33) failed for any layer ℓ < L was at most P . We also saw that (34) failed with probability P. If none of them fail, we proved that (26) and hence (24) was satisfied, so (24) fails with probability at most 2P . However, for (21) we need (24) both for [t− , t+ ) = [tmin , t∗ ) and for [t− , t+ ) = [t∗ , tmax ), so (21) fails with probability at most 4P . Finally, we need to consider both the case that τ > tmax and τ ≤ tmin . Either of these events happens with probability at most P , so we conclude that the overall error probability is at most 6P . If no error happened and δ = δ(f w<t /(3t), P ) ≤ 1/3, then f bw t − f w > 6δf w<t . This completes the proof of Theorem 5. 3.6 Large errors The limitation of Theorem 5 is that it can only be used to bound the probability that the estimate error f bwτ − f w is bigger than 2f w<τ . Note that errors above f w<τ can only be overestimates. We will now target larger errors and prove the statement of Theorem 6: Set ℓ = ⌈lg(tmax /τ )⌉ δ = δ(f w<τ /τ , P /ℓ2 ). Then Pr[f bwτ <τ > (2 + 2δ)f w<τ ] < 3P Proof of Theorem 6 Since we are targeting arbitrarily large relative errors δ , for the probability function ℘, we can only assume conditions (a) and (b) in Definition 4. We will use some of the same ideas as we used for the last layer in Section 3.5, but tuned for our situation. We will study intervals based on tℓ = tmax /2ℓ for ℓ = 1, 2, .... Interval ℓ is for thresholds t ∈ [tℓ , tℓ−1 ) = [tℓ , 2tℓ ), so t < tmax belongs to interval ℓ = ⌈lg(tmax /t)⌉. To define the error for interval ℓ, set δℓ = ℘(f w<tℓ /tℓ , P /ℓ2 ). The good non-error event for interval ℓ is that f bwtℓ <tℓ ≤ (1 + δℓ )f w<tℓ . By definition, the probability that (41) is violated is at mos t P /ℓ2 , so the probability of failure for any ℓ is bounded by P∞ ℓ=1 P /ℓ2 ≤ P π2/6 < 1.65P . The probability that τ = tmax is zero, so by (19), the event (42) τ < tmax . (41) is violated with probability at most P . Our total error probability is thus bounded by 2.65P < 3P . Below we assume no errors, that is, (41) holds for all ℓ and so does (42). Consider an arbitrary threshold t ∈ (0, tmax ) and let ℓ be such that t ∈ [tℓ , 2tℓ ). We can only have errors for weights wi < t, so we want an upper bound on f bw t <t . The basic idea for an upper bound is to say that we sample all items with priority above tℓ , just as in the estimate f bwtℓ , but instead of giving sampled item <tℓ i estimate max{wi , tℓ}, it gets value max{wi , t} which is at most t/tℓ < 2 times bigger. Thus, regardless of the random choices, <t < 2f bwtℓ f bwt <t . 22 Assuming no error as in (41), we get <t = f w[tℓ ,t] + f bwtℓ f bwtℓ <tℓ ≤ f w<t + δℓf w<tℓ . For the further analysis, we need a general lemma. Lemma 11 For thresholds t′ , t, and relative errors δ ′ , δ , if t′ < t and ℘(f w<t′ /t′ , δ<t′ ) = ℘(f w≤t/t, δ≤t ), then δ ′ f w<t′ < δf w<t . Hence, for any fixed target error probability Q in (17), the target error decreases together with the threshold t. δ(f w<t /t, Q)f w<t Proof We will divide the decrease from t to t′ into a series of atomic decreases. The first atomic “decrease is from f w≤t to f w<t . This makes no difference unless there are weights equal to t so that f w<t < f w≤t . Assume this is the case and suppose ℘(f w<t/t, δ<t ) = ℘(f w≤t/t, δ≤t ). Since f w≤t/t < f w<t/t, it follows directly from (b) that δ<t f w<t/t < δ≤tw≤t /t, hence that δ<t f w<t < δ≤tw≤t . The other atomic decrease we consider is from f w<t to f w≤t′ where t′ < t and with no weights in (t′ , t), hence with f w≤t′ = f w<t . Suppose ℘(f w≤t′ /t′ , δ≤t′ ) = ℘(f w<t /t, δ<t ). Since t′ < t, f w≤t′ /t′ > f w<t/t, so by (a), δ≤t′ < δ<t′ . It follows that δ≤t′ f w≤t′ < δ<t f w<t . Alternating between these two atomic decreases, we can implement an arbitrary decrease in the threshold as required for the lemma. Let δ = δ(w<t /t, P /ℓ2 ) By Lemma 11, since t > tℓ , we have δℓ f w<tℓ < δf w<t , so f bwtℓ <t ≤ f w<t + δℓf w<tℓ < f w<t + δf w<tℓ . <t < 2f bwtℓ ∀t ∈ (0, tmax ) : f bw t <t < 2(1 + δ)f w<t , This completes the proof of Theorem 6. We thus conclude 3.7 Upper bounding the upper bound (43) Theorem 6 uses the threshold upper bound tmax which is a value that depends on all the input weights, and these are not known if we only have a sample. As described in Section 3.2, to get confidence bounds out of Theorem 6, it suffices if we based on our sample can compute a pr obabilistic upper bound tτ max on the upper bound tmax such that t τ max ≥ tmax with probability at least 1 − P . For better confidence lower bounds, we want tmax to be small. Theorem 12 Define δ↓ ≤τ ), δ↑ ≤τ )) = P and ℘(k≤τ /(1+δ↑ ≤τ and δ↑ ≤τ such that ℘(k≤τ /(1−δ↓ ≤τ ), δ↓ ≤τ )) = P . Let 1 + δ↑ ≤τ 1 − δ↓ ≤τ (44) Then Pr[t τ max < tmax ] ≤ P t τ max = τ . 23 ” Proof Our first step will be to compute a probabilistic upper bound w τ ≤τ on w≤τ such that (45) w τ ≤τ ≥ w≤τ . with probability at least 1 − P . We are going to define w t ≤t for any possible threshold t as a function of only ≤t = k≤t /(1 − δ↓ the values of t and k≤t . We define µ t ≤t ), and ≤t = t k≤t/(1 − δ↓ w≤t = t µ t ≤t ). The lemma below states that w τ ≤τ does give us the desired probabilistic upper bound on w≤τ . Lemma 13 For the random priority threshold τ , the probability that w≤τ > w τ ≤τ is at most P , so (45) holds true with probability at least 1 − P . Proof For any given set of input weights consider a threshold t such that w t ≤t ≤ w≤t . We claim that the random priority threshold τ is expected no smaller than t. Note that τ < t if and only if I t ≤t ≤ k≤t . Since ≤t . Moreover, k≤t = (1 − δ↓ ≤t )µ t ≤t ] = w≤t /t ≥ µ t w t ≤t ≤ w≤t , we have E[I t ≤t , so ≤t ≤ (1 − δ↓ Pr[τ ≤ t] = Pr[I t ≤t ≤ k≤t ] = Pr[I t ≤t )µ t ≤t ] ≤t ), δ↓ ≤t ) = ℘(k≤t /(1 − δ↓ ≤ ℘(µ≤t , δ↓ ≤t ) ≤ P . Let t+ be the maximal value such that w t+ ≤t+ ≤ w≤t+ . The probability that τ ≤ t+ is at most P , and if τ > t+ , then w τ ≤τ > w≤τ . If the maximal value t+ does not exist, we define instead t+ as the limit where ≤t ≤ w≤t for t < t+ while w t+ w t ≤t+ > w≤t+ . The probability that τ < t+ is at most P , and if τ ≥ t+ , we again have w τ ≤τ > w≤τ . Lemma 14 For any threshold t, tmax ≤ (1 + δ↑ ≤t )w≤t /k≤t . Proof Consider any two thresholds t and T . Then I T ≤t is the number of weights below t with threshold ≤t ≥ k≤t . Let T = (1 + δ↑ ≤t )w≤t /k≤t . Then E[I T above T , and τ ≥ T implies I T ≤t ] ≤ w≤t /T = k≤t /(1 + δ↑ ≤t ) with equality if T ≥ t. It follows that Pr[τ ≥ T ] ≤ Pr[I T ≤t ≥ k≤t ] ≤ P . Hence T ≥ tmax . Assuming (45), with t = τ , we get ≤τ )w≤τ /k≤τ ≤ (1 + δ↑ tmax ≤ (1 + δ↑ ≤τ )τ /(1 − δ↓ ≤τ )w≤τ /k≤τ = (1 + δ↑ ≤t ). By Lemma 13, (45) holds true with probability 1 − P . This completes the proof of Theorem 12. 24 3.8 What to trust, and what to expect All our theorems about confidence intervals are trustworthy in the sense that they hold true for any set of input weights. We will now discuss what to expect if the input follows a reasonable distribution. As we shall formalize below, we expect a typical priority sample to consist of only a few large weights above the priority threshold, and a majority of small weights that are significantly smaller than the priority threshold. This will imply that our estimated threshold upper bound t τ max is very close to the priority threshold τ . This view has consequences for what we would consider worth optimizing for in our confidence inter- vals, e.g., one could try getting better confidence interval s for cases where the sampled items have weight below but close to the threshold (information that is currently ignored, and not even contained in the sample), but since we do not expect many such items, we do not optimize for this case. As our formal model, we assume that each weight wi is drawn independently from a Pareto distributions, that is, for a positive real parameter α = Ω(1), and any real x ≥ 1, we have the survival function F (x) = Pr[wi ≥ x] = 1/xα . Then all weights are at least 1. For α → ∞, all weights are 1. As α decreases, we get more heavy weights. The mean is infinite for α ≤ 1, and the variance is infinite for α ≤ 2. The probability density function f is the derivative of 1 − F (x), so f (x) = α/xα+1 . (47) We are going to use n such input weights as input to a priority sample of size k , where 1 ≪ k ≪ n. The priority sampling events assigns priorities qi = wi /ri , ri ∈ U (0, 1) to each item, and in the analysis, we will study these weights and priorities relative to any given threshold t. For any such given threshold t, we assume that our error probability function ℘ from (13) holds for the number of samples i, qi > t, for the combined event where we first assign the weights wi independently and second assign the hi and hence the qi based on a hash of each i. We assume that the number of priority samples k is so large that for some small error ε = o(1) and target error probability P , we have (46) ℘(Ω(k), O(ε)) = o(P ). (48) The basic idea is that the number k of samples is so large, that we do not expect significant error s for the sample as a whole. However, we might still have significant er rors in estimation of small subsets. More precisely, our analysis will imply the following result. Theorem 15 Let tk be the threshold leading to an expected number of k samples, and let τ be the actual priority threshold, that is, the (k + 1)th largest priority when all random choices are made. Then, with probability 1 − o(P ), we have τ = (1 ± O(ε))tk = (1 ± o(1))tk . Moreover, we have k≤τ = Ω(k) small weight samples, most of which are from weights below τ /2. Proof As a first simple observation, since all weights at least 1, the expected number of samples with threshold t is at least n/t. It follows that k ≥ n/tk , hence that tk ≥ n/k = ω(1). The following analysis is for an arbitrary threshold t, not just t = tk . We want to study the expected number of large weights wi > t that are sampled for sure, and the expected number of small weight samples (49) 25 (50) wi ≤ t < qi . By linearity of expectation, this is n times the probability of these events for any given item i. By (46), Pr[wi > t] = 1/tα . Using the probability density function (47), we get Pr[wi ≤ t < qi ] = Z t f (x) · x/t dx 1 = α/t · Z t 1/xα dx 1 1 − α (cid:2)x1−α (cid:3) t α/t = 1 α (t1−α − 1)/t 1 − α α (1/tα − 1/t) 1 − α This should be compared with the probability of a large weight sample wi ≥ t which was 1/tα . For α < 1, the low weight sample probability is Ω(1/tα ), and for α > 1/2 we start expecting more low weight samples than large weights. For α > 1, the sampled weights dominate in that we expect more than 1/t if them. Above we assumed α 6= 1. For α = 1, continuing from (51), we get Pr[wi ≤ t, qi > t] = 1/t · [ln x] t 1 = 1/t · ln t which means that the small weight samples are dominant by a factor of ln t for α = 1. For continuity, it is easily verified that (54) also converges to (ln t)/t for α → 1. For simplicity, we assume below that α 6= 1. The total expected number of samples is (54) = = (51) (52) (53) 1/tα − α/t 1 − α k > tk such that sα (t+ t+ k ) = k/(1 + ε) where ε = o(1) is the error By definition, sα (tk ) = k . Define k , we need at least k + 1 samples t+ from (48). To get priority threshold τ ≥ t+ k . By (48), this happens with k < (1 + ε)1/α tk , and if α > 0, t+ probability o(P ). If α < 1, then t+ k < (1 + ε)tk . Since α = Ω(1), we conclude in both cases that sα (t) = t+ k < (1 + O(ε))tk . A symmetric argument shows that τ ≥ (1 − O(ε))tk with probability 1 − o(P ). Thus τ = (1 ± O(ε))tk with probability 1 − o(P ). Next we need to argue that with probability 1 − o(P ), the number k≤τ of sampled small weights in the priority sample is Ω(k). We may assume that τ ≤ t+ k , so k≤τ is at least as big as the number of sampled k , the expected number of samples with threshold t+ t+ small weights with threshold t+ k is k . By definition of k/(1 + ε), and we know for any given threshold, that the expected number of small weight samples is at least a constant fraction of the expected total, so we expect Ω(k) small weight samples with threshold t+ k . By (48), this implies that their actual number is Ω(k) with probability 1 − o(P ). Thus k≤τ = Ω(k) with probability 1 − o(P ). Finally, among the sampled small weights wi ≤ τ < qi , we want to see what fraction is below τ /2. As usual, in our analysis, we first consider given thresholds rather than the variable priority threshold. Generally, for given thresholds t0 ≤ t1 , and any given value of wi ≤ t0 , Pr[qi > t1 wi ] = Pr[qi > t0 wi ] · t0/t1 . 26 Hence α 1 − α (t1−α 0 − 1)/t1 . Pr[wi ≤ t0 , qi > t1 ] = Pr[wi ≤ t0 < q0 ] · t0/t1 = For α = Ω(1) and t1 ≥ t0 = ω(1), we get Pr[wi ≤ t0 , qi > t1 ] > (t0 /t1 )1−Ω(1) · Pr[wi ≤ t1 , qi > t1 ]. k = (1 + o(1)t− k where t+ k ≤ τ ≤ t+ We know that with probability 1 − o(P ), that t− k . A weight wi is in the k and under-sampled if qi ≥ t+ priority sample if qi > τ . We say weight wi is over-sampled if qi ≥ t− k . The over-sampled weights wi ≤ t+ k include all weights wi ≤ τ in the priority sample, and the under-sampled weights wi ≤ t− k /2 are all included among the weights wi ≤ τ /2 in the priority sample. The expected number of over-sampled weights wi ≤ t+ k is α k , qi > t− n · Pr[wi ≤ t+ k )1−α − 1)/t− ((t+ k ] ≤ n · k . 1 − α while the expected number of under-sampled weights wi ≤ t− k /2 is α k /2)1−α − 1)/t+ ((t− k , qi > t− n · Pr[wi ≤ t+ k . k ] = n · 1 − α With α = Ω(1), (56) is within a factor 1/2 + Ω(1) of (55). Moreover, from our analysis of k≤τ , we know that (55) and hence (56) is Ω(k). It follows from (48) that with probability 1 − o(P ), the expected bounds (55) and (56) end up both satisfied within a factor 1 ± o(1). Then, among the priority sampled small weights wi ≤ τ , at least half have weight below τ /2. We now return to our confidence bounds for large errors. By The orem 15, with probability 1 − o(P ), we get ≤τ , δ↓ k≤τ = Ω(k). Hence by (48), we get δ↑ ≤τ = O(ε) = o(1) in Theorem 12, so (55) (56) t τ max = (1 + o(1))τ and then ℓ = 1 in (22). 3.9 Histogram similarity We will now discuss estimators for the similarity of weighted sets. First consider the simple case where each key has a unique weight. The similarity is then just the total weight of the intersection divided by the weight of the union, and we estimate these two quantities independently. As in the bottom-k sample for unweighted items, we note that given the size-k priority sample of two sets A and B , we can easily construct the size-k priority sample of their union, and identify which of these samples come from the intersection. Our analysis for subset sums now applies directly. In the case of histogram similarity, it is natural to allow the same item to have different weights in different sets. More specifically, allowing zero weights, e very possible item has a weight in each set. For the similarity we take the sum of the minimum weight for each item, and divide it by the sum of the maximum weight for each item. Formally, we are considering two sets A and B . Item i has weight w A in A and i = max{w A in B . Let w max weight w B i , w B = min{w A i } and w min i , w B i }. The histogram similarity is i i i w min/w max = (Pi w min )/(Pi w max ). i i This would seem a perfect application of our fractional subsets with wi = w max /w max and fi = w min . i i i i and w B The issue is as follows. From our priority samples over the w A , we can easily get the priority i 27 sample for the wi = w max . However, for the items i sampled, we would typically not have a sample with i w min , and then we cannot compute fi . i Our solution is to keep the instances of an item i in A and B separate as twins i A and i B with priorities q A i = w A i /hi and q B i = w B i /hi . Note that it is the same hash value hi we use to determine these two i = q B i = w B priorities. If w A , we get q A , and then we break the tie in favor of i A . The priority sample i i for the union A ∪ B consists of the split items with the k highest priorities, and the priority threshold τ is the k + 1 biggest among all priorities. Estimation is done as usual: for C ∈ {A, B }, if i C is sampled, bw C i = max{w C i , τ }. The important point here is the interpretation of the results. If w A i ≥ w B , then the i priority of i A is higher than that of i B . Thus, in our sample, when we see an item i C , C ∈ {A, B }, we count it for the union bw max if it is not preceded by its twin; otherwise we count it for the intersection bw min . The resulting estimators bw min and bw max will no longer be unbiased even with truly random hashing. To see this, note that with sample size k = 1, we always get bw min = 0. However, for our concentration bounds, we only lose a constant factor. The point is that the current analysis is using union bounds over threshold sampling events, using the fact that each hash value hi contributes at most 1 to the number of items with priorities above a given threshold t. Now hi affects at most 2 twins, but this is OK since all we really need is that the contribution of each random variable is bounded by a constant. The only effect on Theorem 5 is that we replace the relative error 6 δ(f w<τ /(3τ ), P ) with 6 δ(f w<τ /(6τ ), P ). References [1] R. Adler, R. Feldman, and M. Taqqu. A Practical Guide to Heavy Tails. Birkhauser, 1998. [2] Y. Bachrach, R. Herbrich, and E. Porat. Sketching algorithms for approximating rank correlations in collaborative filtering systems. In Proc. 16th SPIRE, pages 344–352, 2009. [3] Y. Bachrach and E. Porat. Fast pseudo-random fingerprint s. CoRR, abs/1009.5791, 2010. [4] Y. Bachrach, E. Porat, and J. S. Rosenschein. Sketching techniques for collaborative filtering. In Proc. 21st IJCAI, pages 2016–2021, 2009. [5] Z. Bar-Yossef, T. S. Jayram, R. Kumar, D. Sivakumar, and L. Trevisan. Counting distinct elements in a data stream. In International Workshop on Randomization and Approximation Techniques in Computer Science (RANDOM), pages 1–10, 2002. [6] A. Z. Broder. On the resemblance and containment of documents. In Proc. Compression and Com- plexity of Sequences (SEQUENCES), pages 21–29, 1997. [7] A. Z. Broder. Identifying and filtering near-duplicate d ocuments. In Proc. 11th CPM, pages 1–10, 2000. [8] A. Z. Broder, M. Charikar, A. M. Frieze, and M. Mitzenmacher. Min-wise independent permutations. Journal of Computer and System Sciences, 60(3):630–659, 2000. Announced at STOC’98. [9] A. Z. Broder, S. C. Glassman, M. S. Manasse, and G. Zweig. Syntactic clustering of the web. Computer Networks, 29:1157–1166, 1997. [10] E. Cohen, M. Datar, S. Fujiwara, A. Gionis, P. Indyk, R. Motwani, J. D. Ullman, and C. Yang. Finding interesting associations without support pruning. IEEE Trans. Knowl. Data Eng., 13(1):64–78, 2001. 28 [11] E. Cohen, N. Duffield, H. Kaplan, C. Lund, and M. Thorup. E fficient stream sampling for variance- optimal estimation of subset sums. SIAM Journal on Computing, 40(5):1402–1431, 2011. Announced at SODA’09. [12] E. Cohen and H. Kaplan. Summarizing data using bottom-k sketches. In Proc. 26th PODC, pages 225–234, 2007. [13] M. Datar and S. Muthukrishnan. Estimating rarity and similarity over data stream windows. In Proc. 10th ESA, pages 323–334, 2002. [14] M. Dietzfelbinger. Universal hashing and k-wise independent random variables via integer arithmetic without primes. In Proc. 13th STACS, pages 569–580, 1996. [15] M. Dietzfelbinger, J. Gil, Y. Matias, and N. Pippenger. Polynomial hash functions are reliable (ex- tended abstract). In Proc. 19th ICALP, pages 235–246, 1992. [16] N. Duffield, C. Lund, and M. Thorup. Charging from sample d network usage. SIGCOMM Internet Measurement Workshop, pages 245–256, 2001. In Proc. 1st ACM [17] N. Duffield, C. Lund, and M. Thorup. Learn more, sample le ss: control of volume and variance in network measurements. IEEE Transactions on Information Theory, 51(5):1756–1775, 2005. [18] N. Duffield, C. Lund, and M. Thorup. Priority sampling fo r estimation of arbitrary subset sums. J. ACM, 54(6):Article 32, 2007. Announced at SIGMETRICS’04. [19] G. Feigenblat, E. Porat, and A. Shiftan. Exponential space improvement for minwise based algorithms. In Proc. FSTTCS, pages 70–85, 2012. [20] J. M. Hellerstein, P. J. Haas, and H. J. Wang. Online aggregation. In Proc. SIGMOD, pages 171–182, 1997. [21] M. R. Henzinger. Finding near-duplicate web pages: a large-scale evaluation of algorithms. In Proc. 29th SIGIR, pages 284–291, 2006. [22] C. P. Kruskal, L. Rudolph, and M. Snir. A complexity theory of efficient parallel algorithms. Theor. Comput. Sci., 71(1):95–132, 1990. [23] G. S. Manku, A. Jain, and A. D. Sarma. Detecting near-duplicates for web crawling. In Proc. 16th WWW, pages 141–150, 2007. [24] M. Mitzenmacher and S. P. Vadhan. Why simple hash functions work: exploiting the entropy in a data stream. In Proc. 19th ACM/SIAM Symposium on Discrete Algorithms (SODA), pages 746–755, 2008. [25] D. Moore, V. Paxson, S. Savage, C. Shannon, S. Staniford, and N. Weaver. Inside the slammer worm. IEEE Security and Privacy Magazine, 1(4):33–39, 2003. [26] R. Motwani and P. Raghavan. Randomized algorithms. Cambridge University Press, 1995. [27] A. Pagh, R. Pagh, and M. Ru zi ´c. Linear probing with con stant independence. SIAM Journal on Computing, 39(3):1107–1120, 2009. Announced at STOC’07. 29 [28] M. P atras¸cu and M. Thorup. On the k-independence required by linear probing and minwise indepen- dence. In Proc. 36th ICALP, Part I, LNCS 6198, pages 715–726, 2010. [29] M. P atras¸cu and M. Thorup. Twisted tabulation hashin g. In Proc. 23nd SODA, pages 209–228, 2013. [30] C.-E. S arndal, B. Swensson, and J. Wretman. Model Assisted Survey Sampling. Springer, 1992. [31] S. Schleimer, D. S. Wilkerson, and A. Aiken. Winnowing: Local algorithms for document fingerprint- ing. In Proc. SIGMOD, pages 76–85, 2003. [32] J. P. Schmidt, A. Siegel, and A. Srinivasan. Chernoff-Hoeffding bounds for applications with limited independence. SIAM Journal on Discrete Mathematics, 8(2):223–250, 1995. Announced at SODA’93. [33] M. Szegedy. The DLT priority sampling is essentially optimal. In Proc. 38th STOC, pages 150–158, 2006. [34] M. Thorup. Confidence intervals for priority sampling. In Proc. SIGMETRICS, pages 252–263, 2006. [35] M. Thorup. Bottom-k and priority sampling, set similarity and subset sums with minimal indepen- dence. In Proc. 45th STOC, pages 371–378, 2013. [36] M. Thorup and Y. Zhang. Tabulation-based 5-independent hashing with applications to linear probing and second moment estimation. SIAM Journal on Computing, 41(2):293–331, 2012. Announced at SODA’04 and ALENEX’10. [37] M. N. Wegman and L. Carter. New classes and applications of hash functions. Journal of Computer and System Sciences, 22(3):265–279, 1981. Announced at FOCS’79. [38] H. Yang and J. P. Callan. Near-duplicate detection by instance-level constrained clustering. In Proc. 29th SIGIR, pages 421–428, 2006. 30
1502.07167
1
1502
2015-02-25T14:08:13
Linear complexity SimRank computation based on the iterative diagonal estimation
[ "cs.DS", "math.NA", "math.NA" ]
This paper presents a deterministic linear time complexity IDE-SimRank method to approximately compute SimRank with proved error bound. SimRank is a well-known similarity measure between graph vertices which relies on graph topology only and is built on intuition that "two objects are similar if they are related to similar objects". The fixed point equation for direct SimRank computation is the discrete Lyapunov equation with specific diagonal matrix in the right hand side. The proposed method is based on estimation of this diagonal matrix with GMRES and use this estimation to compute singe-source and single pairs queries. These computations are executed with the part of series converging to the discrete Lyapunov equation solution.
cs.DS
cs
Linear complexity SimRank computation based on the iterative diagonal estimation I.V. Oseledets Skolkovo Institute of Science and Technology, Novaya St., 100, Skolkovo, 143025, Russia Institute of Numerical Mathematics, Russian Academy of Sciences, Gubkina St., 8, Moscow, 119333 [email protected] G.V. Ovchinnikov Skolkovo Institute of Science and Technology, Novaya St., 100, Skolkovo, 143025, A. M. Katrutsa Skolkovo Institute of Science and Technology, Novaya St., 100, Skolkovo, 143025, Russia Institute for Design Problems in Microelectronics, Russian Academy of Sciences, prosp. 60-letiya Oktyabrya, 9, Moscow, Russia [email protected] Moscow Institute of Physics and Technology, Institutskiy Lane 9, Dolgoprudny, 141700, Russia Russia [email protected] ABSTRACT This paper presents a deterministic linear time complexity IDE-SimRank method to approximately compute SimRank with proved error bound. SimRank is a well-known simi- larity measure between graph vertices which relies on graph topology only and is built on intuition that "two objects are similar if they are related to similar objects". The fixed point equation for direct SimRank computation is the dis- crete Lyapunov equation with specific diagonal matrix in the right hand side. The proposed method is based on es- timation of this diagonal matrix with GMRES and use this estimation to compute singe-source and single pairs queries. These computations are executed with the part of series con- verging to the discrete Lyapunov equation solution. Keywords SimRank, graph, similarity measure, Lyapunov equation, in- exact GMRES 1. INTRODUCTION This paper presents a new method to efficiently compute the SimRank [?] which is a topologically induced similarity measure between two given vertices of a graph. Similarity measures for graphs are useful in many appli- cations such as relation mining [?], document-by-document querying [?, ?] and many others. A major problem in Sim- Rank computation is the high storage and time complexity of the direct iterative process converging to SimRank. Sev- eral schemes have been presented for the approximate com- putation of the SimRank which are based on different con- cepts [?, ?, ?]. In this paper we propose a two-step method for the approximation of the SimRank. The first and 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 20XX ACM X-XXXXX-XX-X/XX/XX ...$15.00. most expensive step is the computation where we iteratively estimate the diagonal of the SimRank matrix. After that the SimRank scores can be computed by the approximate solution of the discrete Lyapunov equation. Such approach has been considered in [?]. The difference is that instead of using Gauss-Seidel method combined with Monte-Carlo computations to estimate the diagonal we use numerical lin- ear algebra techniques. We prove that the linear system for the diagonal has bounded condition number, and we have an O(n) matrix-by-vector product with guaranteed accu- racy, thus inexact GMRES method is the method of choice. Using the theory of IGMRES we get a provable O(n) com- plexity algorithm for the computation of SimRank scores. The final SimRank approximation is a sparse matrix. We also provide an efficient practical algorithm for the compu- tation of SimRank. 2. PROBLEM STATEMENT Let G = (V, E) be a graph, where V is a set of vertices and E is a set of edges. The order of the graph is the number of vertices V = n. Similarity measures between graph vertices are very useful in some applications. One of the approach to define such similarity measure is SimRank [?]. In the foundation of SimRank definition lies idea that "two objects are similar if they are referenced by the similar objects". It is proposed that vertex similarity lies between 0 and 1 with vertex being maximally similar to itself with similarity 1. By s(a, b) denote the SimRank between vertices a and b defined as   1, 0, if a = b if I(a) = ∅ or I(b) = ∅ s(a, b) = c I(a)I(b) I(a)Xi=1 I(b)Xj=1 s(Ii(a), Ij (b)), otherwise, (1) where I(v) is the set of in-neighbours of vertex v, constant c ∈ (0, 1). Denote by S a SimRank matrix, where (i, j)-th element is SimRank between i-th and j-th vertices. To find the SimRank matrix S, one writes s(a, b) for all pairs (a, b) of vertices and obtains linear system of n2 equations which has unique solution [?]. Let A be an adjacency matrix of the graph G normalized by columns: and nXi=1 Aij = 1, j = 1, . . . , n, W = √cA. The SimRank matrix S is the solution of the following equa- tion: S = W ⊤SW − diag(W ⊤SW ) + I = W ⊤SW + D, (2) and D is the diagonal matrix D = − diag(W ⊤SW ) + I. Equation (2) is typically solved by a fixed-point iteration S0 = I, Sk+1 = cA⊤SkA − c diag(A⊤SkA) + I, (3) where diag(P ) is an operator that maps given matrix P to the diagonal matrix with diagonal entries equal the diagonal entries of the matrix P . The iteration (3) converges if c < 1. Direct usage of (3) requires O(n2) memory cells and O(n3) operations for one iteration, thus is infeasible for real-world graphs. In this paper we propose a new Iterative Diagonal Estimation method (IDE-SimRank method) that approxi- mately computes the SimRank in O(n) time and memory. 3. IDE-SIMRANK METHOD In this section we describe IDE-SimRank method and give theoretical foundation which proves the reasoning and accu- racy of our method. From (2) it is easy to get a linear system with n unknowns. Since diag S = I by definition, and S = W ⊤SW + D, where D is a diagonal matrix, we get I = diag(W ⊤SW ) + D = F (D), (4) where F (D) is a linear operator that maps a diagonal matrix (i.e., a vector of length n) to a diagonal matrix (also a vector of length n), and is defined as and Note that the equation (4) was used in the paper [?] un- der the name Linearized SimRank. The difference in our approach is that we use sparse matrix arithmetic and in- exact iterative method for its solution (compared to the Gauss-Seidel method combined with Monte-Carlo estima- tion to compute S(D)). 3.1 Estimation of condition number of F (D) Let vec(·) be an operator that maps an n × n matrix to a vector of length n2 taking column-by-column. Denote by P v = vec(D(v)) an operator that maps a vector v of length n to a vector of length n2, where D(v) is a diagonal matrix with v on the diagonal. Now by a slight abuse of notation let F and S act on a vector d of length n. Then, the matrix corresponding to the operator F (d) can be written using Kronecker products as F = I + P ⊤(W ⊤ ⊗ W ⊤)(I − W ⊤ ⊗ W ⊤)−1P = P ⊤(I − W ⊤ ⊗ W ⊤)−1P. (6) The matrix P is the submatrix of the n2×n2 identity matrix, thus F is a submatrix of the matrix (I − W ⊤ ⊗ W ⊤)−1. The matrix F is the submatrix of the inverse M -matrix, thus it is also the inverse M -matrix (see [?]), i.e. it is non- singular. Moreover, its condition number can be bounded. Theorem 1. κ(F )1 ≤ 2(1 + c) (1 − c)2 . Proof. For simplicity, introduce the matrix Z = W ⊤ ⊗ W ⊤. The matrix Z is nonnegative and kZk1 = c. Since F is a submatrix of the matrix (I − Z)−1, there exists an n2 × n2 permutation matrix Q such that C D(cid:21) , Q(I − Z)Q⊤ =(cid:20)A B ∗ F(cid:21) . Q(I − Z)−1Q⊤ =(cid:20)∗ ∗ F (D) = D + diag(W ⊤S(D)W ), (5) and S(D) is the solution of the discrete Lyapunov equation S(D) = W ⊤S(D)W + D. So, to evaluate F (D) for a given D we have to solve the discrete Lyapunov equation and take only the diagonal of the solution. This can not be done exactly in O(n) complexity, but it is possible to do approximate computation of F (D) with guaranteed accuracy. Moreover,the operator F (D) is well-conditioned, so it is natural to use iterative methods with inexact matrix-by-vector products to solve (4). Inexact GMRES [?] is typically a method of choice. In order to get a working method, we need two components: 1. Estimates for the condition number of the linear oper- ator F (D). 2. Algorithm for the computation of F (D) with a given accuracy ε. (and estimate of its complexity). Using well-known formulas for block matrix inversion, the matrix F −1 can be written as the Schur complement F −1 = D − BA−1C, Consequently, the 1-norm of F −1 is bounded in the following way: kF −1k1 ≤ kDk1 + kBk1kA−1k1kCk1 The matrices D, B, C are submatrices of the matrix I − Z, therefore their norms are bounded by kI−Zk1 ≤ (1+c) (the norms of the submatrices can not exceed the norm of the matrix). To estimate kA−1k1 note that A is also a principal submatrix of (I − Z), thus it can be represented as where kbZk1 ≤ c, therefore using the standard Neumann series argument (I − bZ), kA−1k1 ≤ 1 1 − c . Finally, kF −1k1 ≤ (1 + c) + (1 + c)2 1 − c = 2(1 + c) 1 − c . It is obvious that where ηk solves δk ≤ ηk, , which can be solved as ηk+1 = (1 + c)ηk + τ, ηk = τ + ((1 + c)k − 1) c . The final result is obtained by using a well-known estimate on the remainder of the Neumann series. It is easy to get the upper bound on the complexity. The number of terms in the SimRank series to get the accuracy ε can be estimated as logc ε−1. At each step, the diagonal of the matrix (W ⊤)kDW k has to be computed. Let m be an average degree of the vertex. Then the sparsity of W k is bounded by mk, and the evaluation reduces to the evaluation of the column norms of the matrix W kD1/2. In practice, however, this bound is a significant overestimation. 3.3 Putting it all together The GMRES algorithm is summarized in Algorithm 2 [?], and it is assumed that the matrix-by-vector product is ex- act. All other operations can be easily implemented in O(n) complexity. Algorithm 2: GMRES algorithm for the solution of the linear system Data: Matrix A, right-hand side b, initial guess x0, stopping tolerance ε. Result: Approximate solution xm: kAxm − bk ≤ ε 1 Start: compute r0 = b − Ax0, v1 = r0/kr0k, V1 = v1, β = kbk. 2 Iterations: 3 Orthogonalize: vk+1 = Avk − Vkhk, where hk = V T 4 Normalize: vk+1 = vk+1/kvk+1k. kvk+1k (cid:21), 5 Update: Vk+1 = (Vk vk+1), Hk =(cid:20) Hk−1 where the first column in Hk is omitted when k = 1. hk 0 k Av. 6 Solve the least squares problem yk = arg miny kβe1 − Hkyk. 7 xm = x0 + Vmym. 8 Restart: compute krmk = kb − Axmk. Stop if krmk ≤ ε. Otherwise: x0 = xm, v1 = rm/krmk and start Iterations again. If the matrix-by-vector products are inexact, the following Theorem gives the error bound. Theorem 3. [?] After m steps of the inexact GMRES procedure, the following estimation for norm of approximate and real residues holds: if for any i ≤ m krm − rmk ≤ ε k Eik ≤ σm(Hm) mkrmk ε, where σm(Hm) is a minimal singular value of the Hessenberg matrix corresponding to GMRES process and Ei is an error corresponding to matvec on the i-th iteration. The matrix F is the submatrix of (I − Z)−1, thus kFk1 ≤ k(I − Z)−1k1 ≤ 1 1 − c and this completes the proof. 3.2 Fast approximate matrix-by-vector prod- uct The key component for the efficient solution of the sys- tem (4) is the fast evaluation of F (D) for a given D. The main computational cost comes from the solution of the dis- crete Lyapunov equation of the form S = W ⊤SW + D, where D is a diagonal matrix. The solution can be written as S = ∞Xk=0 (W ⊤)kDW k = = SK + RK , KXk=0 (W ⊤)kDW k + RK = (7) where kRKk1 ≤ cK . The truncated series SK gives an ap- proximation to S(D) with guaranteed accuracy. Algorithm 1 presents fast approximate matvec algorithm used further in GMRES. In this algorithm the operator diagonal(·) maps given n× n matrix to its n× 1 diagonal. Note, that to get O(n) complexity we have introduced thresholding: the elements smaller than τ are zeroed out, and all computations are implement in sparse matrix arithmetic. Algorithm 1: Fast approximate matvec algorithm Data: Scaled adjacency n × n matrix W , given n × 1 vector x, threshold τ , number of iterations K. Result: Approximate result of matvec y 1 y0 = x 2 X0 = diag(x) 3 for k = 1 . . . K do 4 5 6 7 Xk = W ⊤Xk−1W d = diagonal(Xk) Threshold to zero all elements of d, which absolute values are less than given threshold τ . yk = yk−1 + d 8 end 9 y = yK The error of the matrix-by-vector product can be esti- mated by the following theorem. Theorem 2. The result of Algorithm 1 satisfies ky − yKk∞ ≤ τ (1 + c)K − 1 c + cK . (8) Proof. Suppose that bXk is the result of Algorithm 1 for τ = 0 after k steps, and Then, Xk = bXk + Ek, kEkkC = δk. δk+1 ≤ δk + cδk + τ. 4. COMPARISON WITH EXISTING METH- ODS SimRank algorithm computes similarities between vertices of the input graph G = (V, E). Here we compute a single- source SimRank and a one-pair SimRank. The single-source SimRank is the vector with SimRank scores between given vertex a ∈ V and all other vertices b ∈ V . The one-pair SimRank is the similarity measure s(a, b) between two given vertices a and b. The proposed method has memory requirement O(n) and computational complexity O(n) of the pre-computation step. Moreover, we compute the sparse approximation to the full SimRank matrix. For the readers convenience computational and memory complexities of the previously proposed methods are pre- sented Table 1 and 2. Table 1: Complexities of the single-pair SimRank algorithms Paper [?] [?] [?] This Query O(kN ) O(r4) O(kE2) O(n) Time Precomputation O((N + d)n) O(r4n2) Not needed O(n) Memory O(nN ) O(n2) O(n) O(n2r2 + r4) Table 2: Complexities of the single-source SimRank algo- rithms Time Precomputation Memory Query O(RkS) O(nk(R + P Q)) O(m + nP ) Paper [?] [?] This O(1) O(kdk) O(1) O(dk) O(1) Some papers like [?], [?], [?], [?] consider a solution of the exact Sylvester equation without any estimation as SimRank approximation. However, this approach has two fundamen- tal problems. The first problem is that the exact solution of discrete Lyapunov equation is only an approximation to the initial SimRank definition, so this solution leads to ad- ditional errors. We treat this problem by estimation of the diagonal item in discrete Lyapunov equation and get the cor- rect approximate discrete Lyapunov equation for SimRank. The second problem is to solve Sylvester equation as pro- posed in [?] one needs invert adjacency matrix of the graph which is unstable and leads to loss of sparsity. Instead of invert the matrix of linear operator we use iterative method GMRES with fast approximate matvec implementation. 5. NUMERICAL EXPERIMENTS 5.1 Synthetic test To confirm the O(n) complexity of the proposed method, we generate random adjacency matrices with fixed number of nonzero elements in every column and compute SimRank for corresponding graphs. The dependence of time on n is shown on Figure 1. The other parameters are threshold τ = 10−4, the scale parameter c = 0.6 and number of iteration K = 50. Here nnz is a number of non-zero elements in every column. The computational cost increases when the adjacency matrix becomes more dense, which is natural. nnz = 10 nnz = 20 nnz = 30 25 20 15 10 5 c e s , e m T i 0 1000 1500 2000 2500 3000 3500 4000 4500 5000 Number of vertices, n Figure 1: Dependence of time to solve linear system on n for randomly generated graphs with different number of non- zeros The similar plot for dependence of memory to solve the linear system on the number of vertices n is presented in Figure 2. The other parameters are the same: threshold τ = 10−4, the scale parameter c = 0.6 and number of iteration K = 50. Here nnz is a number of non-zero elements in every column. The plot shows that the required memory linearly or sub-linearly depends on the number of vertices in the graph. But if the adjacency matrix of the graph is enough sparse, then the required memory is constant and does not depend on the number of vertices. nnz = 30 nnz = 20 nnz = 10 200 150 100 50 B M , y r o m e M 0 1000 1500 2000 2500 3000 3500 4000 4500 5000 Number of vertices, n Figure 2: Dependence of memory to solve linear system on n for randomly generated graphs with different number of non-zeros 5.2 DIMACS10 collection In this section we experimentally study the approximation accuracy of our method. The experiments are carried out on graphs from DIMACS10 Challenge Collection1. The list of the considered graphs is presented in Table 3. Table 3: NDCG accuracy for single-source query to the graphs from DIMACS10 Challenge Collection Name chesapeake data delaunay n10 delaunay n11 delaunay n12 delaunay n13 uk vsp data and seymourl n 39 2851 1024 2048 4096 8192 4824 9167 nnz 340 30186 6112 12254 24528 49094 13674 111732 nnz/n 1− NDCG@n 8.72 10.59 5.97 5.98 5.99 5.99 2.83 12.19 1.3 · 10−9 3.1 · 10−8 2 · 10−9 1.2 · 10−8 4 · 10−8 2.5 · 10−7 2.74 · 10−7 10−8 Table 3 presents 1−NDCG@n measure for convenience. To compute the NDCG@n measure we make q = 100 ran- dom queries to SimRank and SimRank approximation for every graph except chesapeake graph (q = 39). After that we have two vectors s and s of correct SimRank scores and approximate SimRank scores between query and all other graph vertices. The NDCG measure [?] is defined by the following equation: NDCG = 1 Z nXi=1 2reli − 1 log2(i + 1) , where i is an index of concept, according to the sorted ap- proximate SimRank scores s, reli = si is the ground-truth SimRank score between the query and the i-th vertex, and Z is a normalization constant. The other parameters are c = 0.6, K = 50 and τ = 10−3. Also nnz is the total num- ber of non-zero elements in the adjacency matrix, nnz/n is the average degree of vertex. 5.3 Experiment with Wikipedia We used Simple English Wikipedia corpus to find semantic relatedness between concepts. The undirected graph corre- sponding to Simple Wikipedia corpus has 150495 vertices and 4454023 edges. The direct SimRank matrix computa- tion of such large graph is infeasible. Therefore, we assess the quality of our SimRank approximation method not with approximation error but with rationality of the obtained similar concepts. We use the following parameters in the experiment: c = 0.6, number of iteration k = 10, τ = 10−4. Table 4 shows some examples of similar concepts extracted from Simple English Wikipedia corpus by the proposed Sim- Rank approximation algorithm. Each column hasthe queried concept in the top and the most similar concepts to the queried one in the other rows. Every column is sorted ac- cording to SimRank scores given by SimRank matrix ap- proximation. We do not display these scores because of the space limitation: the scores differ in 4-th or 5-th significant figures. 10−4 10−5 10−6 10−7 10−8 10−9 10−10 10−11 10−12 10−13 10−14 n @ G C D N − 1 delaunay n10, n = 1024 delaunay n11, n = 2048 delaunay n12, n = 4096 delaunay n13, n = 8192 data, n = 2851 uk, n = 4824 10−15 10−6 10−5 10−4 10−3 Threshold, τ 10−2 10−1 Figure 3: Dependence NDCG on the thresholds for graph from DIMACS10 collection delaunay n10, n = 1024 delaunay n11, n = 2048 delaunay n12, n = 4096 delaunay n13, n = 8192 data, n = 2851 uk, n = 4824 9 8 7 6 5 4 3 2 1 c e s , e m T i 0 10−6 10−5 10−4 10−3 Threshold, τ 10−2 10−1 Figure 4: Dependence of time to solve linear system on the thresholds for graph from DIMACS10 collection An important research direction is the study of hyper- graphs, when the adjacency matrix is replaced by the adja- cency tensor. We plan to investigate this issue. Also, the computation of the SimRank by summing of the Neumann series can be improved by using more advanced iterative method, like the IGMRES approach considered here, but it requires a lot of technical work. 7. ACKNOWLEDGEMENTS The authors thank D. Kolesnikov for fruitful discussions. 6. CONCLUSIONS AND FUTURE WORK 1https://www.cise.ufl.edu/research/sparse/matrices/DIMACS10/ τ = 10−5 τ = 10−4 τ = 10−3 100 10−1 10−2 10−3 10−4 10−5 e u d i s e R 10−6 1 2 3 4 5 Iteration 6 7 8 Figure 5: Convergence of the GMRES with different thresh- olds τ Table 4: Similar concepts according to proposed SimRank approximation algorithm Matthew GNU Richard Stallman Linux operating sys- tem Hurd Debian linux Linux (kernel) *nix Pole- of Earth South Aitken basin Frame referance Interplanetary internet Supernova 1987A Probotector Near Object Earth Liquid Plasma (matter) Matters theory Particle matter Hematological of Blude Human blood
1805.10902
2
1805
2018-11-21T10:00:40
Evolutionary Algorithms and Submodular Functions: Benefits of Heavy-Tailed Mutations
[ "cs.DS" ]
A core feature of evolutionary algorithms is their mutation operator. Recently, much attention has been devoted to the study of mutation operators with dynamic and non-uniform mutation rates. Following up on this line of work, we propose a new mutation operator and analyze its performance on the (1+1) Evolutionary Algorithm (EA). Our analyses show that this mutation operator competes with pre-existing ones, when used by the (1+1) EA on classes of problems for which results on the other mutation operators are available. We show that the (1+1) EA using our mutation operator finds a (1/3)-approximation ratio on any non-negative submodular function in polynomial time. We also consider the problem of maximizing a symmetric submodular function under a single matroid constraint and show that the (1+1) EA using our operator finds a (1/3)-approximation within polynomial time. This performance matches that of combinatorial local search algorithms specifically designed to solve these problems and outperforms them with constant probability. Finally, we evaluate the performance of the (1+1)EA using our operator experimentally by considering two applications: (a) the maximum directed cut problem on real-world graphs of different origins, and with up to 6.6 million vertices and 56 million edges and (b) the symmetric mutual information problem using a four month period air pollution data set. In comparison with uniform mutation and a recently proposed dynamic scheme our operator comes out on top on these instances.
cs.DS
cs
Evolutionary Algorithms and Submodular Functions: Benefits of Heavy-Tailed Mutations Tobias Friedrich1,2, Andreas Gobel1, Francesco Quinzan1, and Markus Wagner2 1 Hasso Plattner Institute, Potsdam, Germany 2 University of Adelaide, Adelaide, Australia Abstract. A core feature of evolutionary algorithms is their mutation operator. Recently, much attention has been devoted to the study of mutation operators with dynamic and non-uniform mutation rates. Following up on this line of work, we propose a new mutation operator and analyze its performance on the (1+1) Evolutionary Algorithm (EA). Our analyses show that this mutation operator competes with pre-existing ones, when used by the (1+1) EA on classes of problems for which results on the other mutation opera- tors are available. We show that the (1+1) EA using our mutation operator finds a (1/3)- approximation ratio on any non-negative submodular function in polynomial time. We also consider the problem of maximizing a symmetric submodular function under a single ma- troid constraint and show that the (1+1) EA using our operator finds a (1/3)-approximation within polynomial time. This performance matches that of combinatorial local search algo- rithms specifically designed to solve these problems and outperforms them with constant probability. Finally, we evaluate the performance of the (1+1) EA using our operator experimentally by considering two applications: (a) the maximum directed cut problem on real-world graphs of different origins, and with up to 6.6 million vertices and 56 million edges and (b) the symmetric mutual information problem using a four month period air pollution data set. In comparison with uniform mutation and a recently proposed dynamic scheme our operator comes out on top on these instances. Keywords: Evolutionary algorithms, mutation operators, submodular functions, matroids. 1 Introduction A key procedure of the (1+1) EA that affects its performance is the mutation operator, i.e., the operator that determines at each step how the potential new solution is generated. In the past several years there has been a huge effort, both from a theoretical and an experimental point of view, towards understanding how this procedure influences the performance of the (1+1) EA and which is the optimal way of choosing this parameter (e.g., see [1,2]). The most common mutation operator on n-bit strings is the static uniform mutation operator. This operator, unifp, flips each bit of the current solution independently with probability p(n). This probability, p(n), is called static mutation rate and remains the same throughout the run of the algorithm. The most common choice for p(n) is 1/n; thus, mutated solutions differ in expectation in one bit from their predecessors. Witt [3] shows that this choice of p(n) is optimal for all pseudo- Boolean linear functions. Doerr et al. [4] further observe that changing p(n) by a constant factor can lead to large variations of the overall run-time of the (1+1) EA. They also show the existence of functions for which this choice of p(n) is not optimal. Static mutation rates are not the only ones studied in literature. Jansen et al. [5] pro- pose a mutation rate which at time step t flips each bit independently with probability 2(t−1) mod ((cid:100)log2 n(cid:101)−1)/n. Doerr et al. [6] observe that this mutation rate is equivalent to a mu- tation rate of the form α/n, where α is chosen uniformly at random (u.a.r.) from the set {2(t−1) mod ((cid:100)log2 n(cid:101)−1) t ∈ {1, . . . ,(cid:100)log2 n(cid:101)}}. Doerr et al. [7,8] have proposed a simple on-the-fly mechanism that can approximate optimal mutation rates well for two unimodal functions. 2 Doerr et al. [6] notice that the choice of p(n) = 1/n is a result of over-tailoring the mutation rates to commonly studied simple unimodal problems. They propose a non-static mutation oper- ator fmutβ, which chooses a mutation rate α ≤ 1/2 from a power-law distribution at every step of the algorithm. Their analysis shows that for a family of "jump" functions introduced below, the run-time of the (1+1) EA yields a polynomial speed-up over the optimal time when using fmutβ. Friedrich et al. [9] propose a new mutation operator. Their operator cMut(p) chooses at each step with constant probability p to flip 1-bit of the solution chosen uniformly at random. With the remaining probability 1 − p, the operator chooses k ∈ {2, . . . , n} uniformly at random and flips k bits of the solution chosen uniformly at random. This operator performs well in optimizing pseudo-Boolean functions, as well as combinatorial problems such as the minimum vertex cover and the maximum cut. Experiments suggest that this operator outperforms the mutation operator of Doerr et al. [6] when run on functions that exhibit large deceptive basins of attraction, i.e., local optima whose Hamming distance from the global optimum is in Θ(n). As evolutionary algorithms are used extensively in real world applications, it is important to extend the theoretical analysis of their performance to the more general classes of functions. To improve the performance of (1+1) EA in more complex landscapes and inspired by the recent results of Doerr et al. [6] and Friedrich et al. [9] we propose a new mutation operator pmutβ. Our operator mutates n-bit string solutions as follows. At each step, pmutβ chooses k ∈ {1, . . . , n} from a power-law distribution. Then k bits of the current solution are chosen uniformly at random and then flipped. During a run of the (1+1) EA using pmutβ, the majority of mutations consist of flipping a small number of bits, but occasionally a large number, of up to n bit flips can be performed. In comparison to the mutations of fmutβ, the mutations of pmutβ have a considerably higher likelihood of performing larger than (n/2)-bit jumps. Run-Time Comparison on Artificial Landscapes Our analysis of the (1+1) EA using pmutβ starts by considering artificial landscapes. More specifically, in Section 3.1 we show that the (1+1) EA using pmutβ manages to find the optimum of any function within exponential time. When run on the OneMax function, the (1+1) EA with pmutβ finds the optimum solution in expected polynomial time. In Section 3.2 we consider the problem of maximizing the n-dimensional jump function Jumpm,n(x), first introduced by Droste et al. [10]. We show that for any value of the parame- ters m, n with m constant or n − m, the expected run time of the (1+1) EA using pmutβ remains polynomial. This is not the case for the (1+1) EA using unifp, for which Droste et al. [10] showed a run time of Θ(nm +n log n) in expectation. Doerr et al. [6] are able to derive polynomial bounds for the expected run-time of the (1+1) EA using their mutation operator fmutβ, but in their results limit the jump parameter to m ≤ n/2. Optimization of Submodular Functions Our main focus in this article is to study the per- formance of the (1+1) EA when optimizing submodular functions. Submodularity is a property that captures the notion of diminishing returns. Thus submodular functions find applicability in a large variety of problems. Examples include: maximum facility location problems [11], maximum cut and maximum directed cut [12], restricted SAT instances [13]. Submodular functions under a single matroid constraint arise in artificial intelligence and are connected to probabilistic fault diagnosis problems [14,15]. Submodular functions exhibit additional properties in some cases, such as symmetry and mono- tonicity. These properties can be exploited to derive run time bounds for local randomized search heuristics such as the (1+1) EA. In particular, Friedrich and Neumann [16] give run time bounds for the (1+1) EA and GSEMO on this problem, assuming either monotonicity or symmetry. We show (Section 4.1) that the (1+1) EA with pmutβ on any non-negative, submodular function gives a 1/3-approximation within polynomial time. This result matches the performance of the local search heuristic of Feige et al. [17] designed to target non-negative, submodular functions in particular. An example of a natural non-negative submodular function that is neither symmetric nor monotone is the utility function of a player in a combinatorial auction (see e.g. [18]). We 3 Table 1: Upper bounds on the run time for the (1+1) EA with mutation pmutβ, with parameter β > 1. The expected run time in the unconstrained case is given in Section 4.1, whereas the improved upper-bound in Section 4.2. The expected run time bounds for the (1+1) EA in the constrained case are discussed in Section 5. Previous run time bounds for deterministic local search algorithms are discussed in Feige et al. [17] and Lee et al. [15]. We remark that local operations for the deterministic local search correspond to favorable moves in the analysis of the (1+1) EA. Hence, they are the same unit of measurement. further show (Section 4.2) that the (1+1) EA outperforms the local search of Feige et al. [17] at least with constant probability (w.c.p.). Additionally we evaluate the performance of the (1+1) EA on the maximum directed cut problem using pmutβ experimentally, on real-world graphs of different origins, and with up to 6.6 million vertices and 56 million edges. Our experiments show that pmutβ outperforms unifp and the uniform mutation operator on these instances. This analysis appears in Section 6.1 In section 5 we consider the problem of maximizing a symmetric submodular function under a single matroid constraint. Our analysis shows that the (1+1) EA using pmutβ finds a 1/3- approximation within polynomial time. Our analysis can be easily extended to show that the same results apply to the (1+1) EA when using the uniform mutation operator or unifp. To establish our results empirically, in Section 6.2 we consider the symmetric mutual informa- tion problem under a cardinality constraint. We consider an air pollution data set during a four month interval and use the (1+1) EA to identify the highly informative random variables of this data set. We observe that pmutβ performs better than the uniform mutation operator and unifp for a small time budged and a small cardinality constraint, but for a large cardinality constraint all mutation operators have similar performance. A comparison of the previously known performance of deterministic local search algorithms on submodular functions and our results on the (1+1) EA can be found in Table 1. 2 Preliminaries 2.1 The (1+1) EA and Mutation Rates. We study the run time of the simple (1 + 1) Evolutionary Algorithm under various configurations. This algorithm requires a bit-string of fixed length n as input. An offspring is then generated by the mutation operator, an operator that resembles asexual reproduction. The fitness of the solution is then computed and the less desirable result is discarded. This algorithm is elitist in the sense that the solution quality never decreases throughout the process. Pseudo-code for the (1+1) EA is given in Algorithm 1. In the (1+1) EA the offspring generated in each iteration depends on the mutation operator. The standard choice for the Mutation(·) is to flip each bit of an input string x = (x1, . . . , xn) inexpectation<latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit>inexpectation<latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit>single-objectiveevolutionaryalgorithm<latexit sha1_base64="yMOvLtn1DqM5F8LCCo54nrImqJU=">AAACJ3icbVDLSgMxFM34tr6qLt0Ei+DGMiOCurLgxqWCVaFTyp30to3mMSaZYhn6OW78FTciKrr0T0wfC18HAofzINyTpIJbF4YfwcTk1PTM7Nx8YWFxaXmluLp2YXVmGFaZFtpcJWBRcIVVx53Aq9QgyETgZXJzPPAvu2gs1+rc9VKsS2gr3uIMnJcaxaNYJvout1y1Be7o5BqZ413sx7cZNGlM47gwSmBXi2zQAdOjINracNeR/UaxFJbDIehfEo1JiYxx2ig+x03NMonKMQHW1qIwdfUcjONMYL8QZxZTYDfQxpqnCiTaej48tE+3vNKkLW38U44O1e+NHKS1PZn4pATXsb+9gfifV8tc66Cec5VmDhUbfdTKBHWaDlajTW78MKLnCTB/OWeUdcAAc37bgh8h+n3yX1LdLR+Wo7O9UmV7vMYc2SCbZJtEZJ9UyAk5JVXCyD15JC/kNXgInoK34H0UnQjGnXXyA8HnF9rfp9Y=</latexit><latexit sha1_base64="yMOvLtn1DqM5F8LCCo54nrImqJU=">AAACJ3icbVDLSgMxFM34tr6qLt0Ei+DGMiOCurLgxqWCVaFTyp30to3mMSaZYhn6OW78FTciKrr0T0wfC18HAofzINyTpIJbF4YfwcTk1PTM7Nx8YWFxaXmluLp2YXVmGFaZFtpcJWBRcIVVx53Aq9QgyETgZXJzPPAvu2gs1+rc9VKsS2gr3uIMnJcaxaNYJvout1y1Be7o5BqZ413sx7cZNGlM47gwSmBXi2zQAdOjINracNeR/UaxFJbDIehfEo1JiYxx2ig+x03NMonKMQHW1qIwdfUcjONMYL8QZxZTYDfQxpqnCiTaej48tE+3vNKkLW38U44O1e+NHKS1PZn4pATXsb+9gfifV8tc66Cec5VmDhUbfdTKBHWaDlajTW78MKLnCTB/OWeUdcAAc37bgh8h+n3yX1LdLR+Wo7O9UmV7vMYc2SCbZJtEZJ9UyAk5JVXCyD15JC/kNXgInoK34H0UnQjGnXXyA8HnF9rfp9Y=</latexit><latexit sha1_base64="yMOvLtn1DqM5F8LCCo54nrImqJU=">AAACJ3icbVDLSgMxFM34tr6qLt0Ei+DGMiOCurLgxqWCVaFTyp30to3mMSaZYhn6OW78FTciKrr0T0wfC18HAofzINyTpIJbF4YfwcTk1PTM7Nx8YWFxaXmluLp2YXVmGFaZFtpcJWBRcIVVx53Aq9QgyETgZXJzPPAvu2gs1+rc9VKsS2gr3uIMnJcaxaNYJvout1y1Be7o5BqZ413sx7cZNGlM47gwSmBXi2zQAdOjINracNeR/UaxFJbDIehfEo1JiYxx2ig+x03NMonKMQHW1qIwdfUcjONMYL8QZxZTYDfQxpqnCiTaej48tE+3vNKkLW38U44O1e+NHKS1PZn4pATXsb+9gfifV8tc66Cec5VmDhUbfdTKBHWaDlajTW78MKLnCTB/OWeUdcAAc37bgh8h+n3yX1LdLR+Wo7O9UmV7vMYc2SCbZJtEZJ9UyAk5JVXCyD15JC/kNXgInoK34H0UnQjGnXXyA8HnF9rfp9Y=</latexit><latexit sha1_base64="yMOvLtn1DqM5F8LCCo54nrImqJU=">AAACJ3icbVDLSgMxFM34tr6qLt0Ei+DGMiOCurLgxqWCVaFTyp30to3mMSaZYhn6OW78FTciKrr0T0wfC18HAofzINyTpIJbF4YfwcTk1PTM7Nx8YWFxaXmluLp2YXVmGFaZFtpcJWBRcIVVx53Aq9QgyETgZXJzPPAvu2gs1+rc9VKsS2gr3uIMnJcaxaNYJvout1y1Be7o5BqZ413sx7cZNGlM47gwSmBXi2zQAdOjINracNeR/UaxFJbDIehfEo1JiYxx2ig+x03NMonKMQHW1qIwdfUcjONMYL8QZxZTYDfQxpqnCiTaej48tE+3vNKkLW38U44O1e+NHKS1PZn4pATXsb+9gfifV8tc66Cec5VmDhUbfdTKBHWaDlajTW78MKLnCTB/OWeUdcAAc37bgh8h+n3yX1LdLR+Wo7O9UmV7vMYc2SCbZJtEZJ9UyAk5JVXCyD15JC/kNXgInoK34H0UnQjGnXXyA8HnF9rfp9Y=</latexit>deterministiclocalsearch<latexit sha1_base64="tVcKW3vZuadYl5TeIQBqLi2rqSU=">AAACE3icbVC7SgNBFJ31GeMramkzGISAEHZFULuAjWUEYwLZJcxObpIh81hmZsWw5CNs/BUbCxVbGzv/xkmyhSYeGDiccy9n7okTzoz1/W9vaXlldW29sFHc3Nre2S3t7d8ZlWoKDaq40q2YGOBMQsMyy6GVaCAi5tCMh1cTv3kP2jAlb+0ogUiQvmQ9Rol1Uqd0EopYPWRdsKAFky6Q0XEYFmcyV5RwbIBoOhiHnVLZr/pT4EUS5KSMctQ7pa+wq2gqQFrKiTHtwE9slBHtQjiMi2FqICF0SPrQdlQSASbKpkeN8bFTurintHvS4qn6eyMjwpiRiN2kIHZg5r2J+J/XTm3vIsqYTFILks6CeinHVuFJQ7jLNFDLR44Qqpn7K6YDogl1FZmiKyGYP3mRNE6rl9Xg5qxcq+RtFNAhOkIVFKBzVEPXqI4aiKJH9Ixe0Zv35L14797HbHTJy3cO0B94nz+2v59a</latexit><latexit sha1_base64="tVcKW3vZuadYl5TeIQBqLi2rqSU=">AAACE3icbVC7SgNBFJ31GeMramkzGISAEHZFULuAjWUEYwLZJcxObpIh81hmZsWw5CNs/BUbCxVbGzv/xkmyhSYeGDiccy9n7okTzoz1/W9vaXlldW29sFHc3Nre2S3t7d8ZlWoKDaq40q2YGOBMQsMyy6GVaCAi5tCMh1cTv3kP2jAlb+0ogUiQvmQ9Rol1Uqd0EopYPWRdsKAFky6Q0XEYFmcyV5RwbIBoOhiHnVLZr/pT4EUS5KSMctQ7pa+wq2gqQFrKiTHtwE9slBHtQjiMi2FqICF0SPrQdlQSASbKpkeN8bFTurintHvS4qn6eyMjwpiRiN2kIHZg5r2J+J/XTm3vIsqYTFILks6CeinHVuFJQ7jLNFDLR44Qqpn7K6YDogl1FZmiKyGYP3mRNE6rl9Xg5qxcq+RtFNAhOkIVFKBzVEPXqI4aiKJH9Ixe0Zv35L14797HbHTJy3cO0B94nz+2v59a</latexit><latexit sha1_base64="tVcKW3vZuadYl5TeIQBqLi2rqSU=">AAACE3icbVC7SgNBFJ31GeMramkzGISAEHZFULuAjWUEYwLZJcxObpIh81hmZsWw5CNs/BUbCxVbGzv/xkmyhSYeGDiccy9n7okTzoz1/W9vaXlldW29sFHc3Nre2S3t7d8ZlWoKDaq40q2YGOBMQsMyy6GVaCAi5tCMh1cTv3kP2jAlb+0ogUiQvmQ9Rol1Uqd0EopYPWRdsKAFky6Q0XEYFmcyV5RwbIBoOhiHnVLZr/pT4EUS5KSMctQ7pa+wq2gqQFrKiTHtwE9slBHtQjiMi2FqICF0SPrQdlQSASbKpkeN8bFTurintHvS4qn6eyMjwpiRiN2kIHZg5r2J+J/XTm3vIsqYTFILks6CeinHVuFJQ7jLNFDLR44Qqpn7K6YDogl1FZmiKyGYP3mRNE6rl9Xg5qxcq+RtFNAhOkIVFKBzVEPXqI4aiKJH9Ixe0Zv35L14797HbHTJy3cO0B94nz+2v59a</latexit><latexit sha1_base64="tVcKW3vZuadYl5TeIQBqLi2rqSU=">AAACE3icbVC7SgNBFJ31GeMramkzGISAEHZFULuAjWUEYwLZJcxObpIh81hmZsWw5CNs/BUbCxVbGzv/xkmyhSYeGDiccy9n7okTzoz1/W9vaXlldW29sFHc3Nre2S3t7d8ZlWoKDaq40q2YGOBMQsMyy6GVaCAi5tCMh1cTv3kP2jAlb+0ogUiQvmQ9Rol1Uqd0EopYPWRdsKAFky6Q0XEYFmcyV5RwbIBoOhiHnVLZr/pT4EUS5KSMctQ7pa+wq2gqQFrKiTHtwE9slBHtQjiMi2FqICF0SPrQdlQSASbKpkeN8bFTurintHvS4qn6eyMjwpiRiN2kIHZg5r2J+J/XTm3vIsqYTFILks6CeinHVuFJQ7jLNFDLR44Qqpn7K6YDogl1FZmiKyGYP3mRNE6rl9Xg5qxcq+RtFNAhOkIVFKBzVEPXqI4aiKJH9Ixe0Zv35L14797HbHTJy3cO0B94nz+2v59a</latexit>approximationguarantee<latexit sha1_base64="iuuSlKOuXiBtB6kWhcw1oPjClPI=">AAACFHicbVBNSwMxEM3Wr1q/qh69BIvQg5RdEdRbwYvHCtYWukvJptM2NJssSVZalv4JL/4VLx5UvHrw5r8x3e5BW18IPN6bYWZeGHOmjet+O4WV1bX1jeJmaWt7Z3evvH9wr2WiKDSp5FK1Q6KBMwFNwwyHdqyARCGHVji6nvmtB1CaSXFnJjEEERkI1meUGCt1y6d+FMpxSuJYyTGLMnXq+6W5PEiIIsIATH1sX7dccWtuBrxMvJxUUI5Gt/zl9yRNIhCGcqJ1x3NjE6REGUY5TEt+oiEmdEQG0LFUkAh0kGZXTfGJVXq4L5X9wuBM/d2RkkjrSRTaSrv3UC96M/E/r5OY/mWQMhEnBgSdD+onHBuJZxHhHlNADZ9YQqhidldMhzYIamyQJRuCt3jyMmme1a5q3u15pV7N0yiiI3SMqshDF6iOblADNRFFj+gZvaI358l5cd6dj3lpwcl7DtEfOJ8/Ma2fjg==</latexit><latexit sha1_base64="iuuSlKOuXiBtB6kWhcw1oPjClPI=">AAACFHicbVBNSwMxEM3Wr1q/qh69BIvQg5RdEdRbwYvHCtYWukvJptM2NJssSVZalv4JL/4VLx5UvHrw5r8x3e5BW18IPN6bYWZeGHOmjet+O4WV1bX1jeJmaWt7Z3evvH9wr2WiKDSp5FK1Q6KBMwFNwwyHdqyARCGHVji6nvmtB1CaSXFnJjEEERkI1meUGCt1y6d+FMpxSuJYyTGLMnXq+6W5PEiIIsIATH1sX7dccWtuBrxMvJxUUI5Gt/zl9yRNIhCGcqJ1x3NjE6REGUY5TEt+oiEmdEQG0LFUkAh0kGZXTfGJVXq4L5X9wuBM/d2RkkjrSRTaSrv3UC96M/E/r5OY/mWQMhEnBgSdD+onHBuJZxHhHlNADZ9YQqhidldMhzYIamyQJRuCt3jyMmme1a5q3u15pV7N0yiiI3SMqshDF6iOblADNRFFj+gZvaI358l5cd6dj3lpwcl7DtEfOJ8/Ma2fjg==</latexit><latexit sha1_base64="iuuSlKOuXiBtB6kWhcw1oPjClPI=">AAACFHicbVBNSwMxEM3Wr1q/qh69BIvQg5RdEdRbwYvHCtYWukvJptM2NJssSVZalv4JL/4VLx5UvHrw5r8x3e5BW18IPN6bYWZeGHOmjet+O4WV1bX1jeJmaWt7Z3evvH9wr2WiKDSp5FK1Q6KBMwFNwwyHdqyARCGHVji6nvmtB1CaSXFnJjEEERkI1meUGCt1y6d+FMpxSuJYyTGLMnXq+6W5PEiIIsIATH1sX7dccWtuBrxMvJxUUI5Gt/zl9yRNIhCGcqJ1x3NjE6REGUY5TEt+oiEmdEQG0LFUkAh0kGZXTfGJVXq4L5X9wuBM/d2RkkjrSRTaSrv3UC96M/E/r5OY/mWQMhEnBgSdD+onHBuJZxHhHlNADZ9YQqhidldMhzYIamyQJRuCt3jyMmme1a5q3u15pV7N0yiiI3SMqshDF6iOblADNRFFj+gZvaI358l5cd6dj3lpwcl7DtEfOJ8/Ma2fjg==</latexit><latexit sha1_base64="iuuSlKOuXiBtB6kWhcw1oPjClPI=">AAACFHicbVBNSwMxEM3Wr1q/qh69BIvQg5RdEdRbwYvHCtYWukvJptM2NJssSVZalv4JL/4VLx5UvHrw5r8x3e5BW18IPN6bYWZeGHOmjet+O4WV1bX1jeJmaWt7Z3evvH9wr2WiKDSp5FK1Q6KBMwFNwwyHdqyARCGHVji6nvmtB1CaSXFnJjEEERkI1meUGCt1y6d+FMpxSuJYyTGLMnXq+6W5PEiIIsIATH1sX7dccWtuBrxMvJxUUI5Gt/zl9yRNIhCGcqJ1x3NjE6REGUY5TEt+oiEmdEQG0LFUkAh0kGZXTfGJVXq4L5X9wuBM/d2RkkjrSRTaSrv3UC96M/E/r5OY/mWQMhEnBgSdD+onHBuJZxHhHlNADZ9YQqhidldMhzYIamyQJRuCt3jyMmme1a5q3u15pV7N0yiiI3SMqshDF6iOblADNRFFj+gZvaI358l5cd6dj3lpwcl7DtEfOJ8/Ma2fjg==</latexit>submodularmaximization<latexit sha1_base64="8vO/fESb9dA1k2hSVSrA3b8vwXY=">AAACBnicbVDLSsNAFJ34rPUVdSnIYBG6KokI6q7gxmUFYwttKZPJpB06kwnzkNbQnRt/xY0LFbd+gzv/xmmahbYeuHA4517uvSdMGVXa876dpeWV1bX10kZ5c2t7Z9fd279TwkhMAiyYkK0QKcJoQgJNNSOtVBLEQ0aa4fBq6jfviVRUJLd6nJIuR/2ExhQjbaWee9ThoRhlyoRcRIYhCTkaUU4fcn/ScytezcsBF4lfkAoo0Oi5X51IYMNJojFDSrV9L9XdDElNMSOTcscokiI8RH3StjRBnKhulv8xgSdWiWAspK1Ew1z9PZEhrtSYh7aTIz1Q895U/M9rGx1fdDOapEaTBM8WxYZBLeA0FBhRSbBmY0sQltTeCvEASYS1ja5sQ/DnX14kwWntsubfnFXq1SKNEjgEx6AKfHAO6uAaNEAAMHgEz+AVvDlPzovz7nzMWpecYuYA/IHz+QPgD5oT</latexit><latexit sha1_base64="8vO/fESb9dA1k2hSVSrA3b8vwXY=">AAACBnicbVDLSsNAFJ34rPUVdSnIYBG6KokI6q7gxmUFYwttKZPJpB06kwnzkNbQnRt/xY0LFbd+gzv/xmmahbYeuHA4517uvSdMGVXa876dpeWV1bX10kZ5c2t7Z9fd279TwkhMAiyYkK0QKcJoQgJNNSOtVBLEQ0aa4fBq6jfviVRUJLd6nJIuR/2ExhQjbaWee9ThoRhlyoRcRIYhCTkaUU4fcn/ScytezcsBF4lfkAoo0Oi5X51IYMNJojFDSrV9L9XdDElNMSOTcscokiI8RH3StjRBnKhulv8xgSdWiWAspK1Ew1z9PZEhrtSYh7aTIz1Q895U/M9rGx1fdDOapEaTBM8WxYZBLeA0FBhRSbBmY0sQltTeCvEASYS1ja5sQ/DnX14kwWntsubfnFXq1SKNEjgEx6AKfHAO6uAaNEAAMHgEz+AVvDlPzovz7nzMWpecYuYA/IHz+QPgD5oT</latexit><latexit sha1_base64="8vO/fESb9dA1k2hSVSrA3b8vwXY=">AAACBnicbVDLSsNAFJ34rPUVdSnIYBG6KokI6q7gxmUFYwttKZPJpB06kwnzkNbQnRt/xY0LFbd+gzv/xmmahbYeuHA4517uvSdMGVXa876dpeWV1bX10kZ5c2t7Z9fd279TwkhMAiyYkK0QKcJoQgJNNSOtVBLEQ0aa4fBq6jfviVRUJLd6nJIuR/2ExhQjbaWee9ThoRhlyoRcRIYhCTkaUU4fcn/ScytezcsBF4lfkAoo0Oi5X51IYMNJojFDSrV9L9XdDElNMSOTcscokiI8RH3StjRBnKhulv8xgSdWiWAspK1Ew1z9PZEhrtSYh7aTIz1Q895U/M9rGx1fdDOapEaTBM8WxYZBLeA0FBhRSbBmY0sQltTeCvEASYS1ja5sQ/DnX14kwWntsubfnFXq1SKNEjgEx6AKfHAO6uAaNEAAMHgEz+AVvDlPzovz7nzMWpecYuYA/IHz+QPgD5oT</latexit><latexit sha1_base64="8vO/fESb9dA1k2hSVSrA3b8vwXY=">AAACBnicbVDLSsNAFJ34rPUVdSnIYBG6KokI6q7gxmUFYwttKZPJpB06kwnzkNbQnRt/xY0LFbd+gzv/xmmahbYeuHA4517uvSdMGVXa876dpeWV1bX10kZ5c2t7Z9fd279TwkhMAiyYkK0QKcJoQgJNNSOtVBLEQ0aa4fBq6jfviVRUJLd6nJIuR/2ExhQjbaWee9ThoRhlyoRcRIYhCTkaUU4fcn/ScytezcsBF4lfkAoo0Oi5X51IYMNJojFDSrV9L9XdDElNMSOTcscokiI8RH3StjRBnKhulv8xgSdWiWAspK1Ew1z9PZEhrtSYh7aTIz1Q895U/M9rGx1fdDOapEaTBM8WxYZBLeA0FBhRSbBmY0sQltTeCvEASYS1ja5sQ/DnX14kwWntsubfnFXq1SKNEjgEx6AKfHAO6uAaNEAAMHgEz+AVvDlPzovz7nzMWpecYuYA/IHz+QPgD5oT</latexit>unconstrained<latexit sha1_base64="SspJVoGf8wR8lFTzsYZMYjZW8A8=">AAAB/HicbVDLSgMxFL3js9bX+Ni5CRahqzIjgroruHFZwbGFdiiZTNqGZpIhyYh1KP6KGxcqbv0Qd/6NaTsLbT1w4XDOvcm9J0o508bzvp2l5ZXVtfXSRnlza3tn193bv9MyU4QGRHKpWhHWlDNBA8MMp61UUZxEnDaj4dXEb95TpZkUt2aU0jDBfcF6jGBjpa572Eki+ZBngkihjcL2mXjcdStezZsCLRK/IBUo0Oi6X51YkiyhwhCOtW77XmrCHCvDCKfjcifTNMVkiPu0banACdVhPt1+jE6sEqOeVLaEQVP190SOE61HSWQ7E2wGet6biP957cz0LsKciTQzVJDZR72MIyPRJAoUM0WJ4SNLMFHM7orIACtMjA2sbEPw509eJMFp7bLm35xV6tUijRIcwTFUwYdzqMM1NCAAAo/wDK/w5jw5L8678zFrXXKKmQP4A+fzBwN7lbQ=</latexit><latexit sha1_base64="SspJVoGf8wR8lFTzsYZMYjZW8A8=">AAAB/HicbVDLSgMxFL3js9bX+Ni5CRahqzIjgroruHFZwbGFdiiZTNqGZpIhyYh1KP6KGxcqbv0Qd/6NaTsLbT1w4XDOvcm9J0o508bzvp2l5ZXVtfXSRnlza3tn193bv9MyU4QGRHKpWhHWlDNBA8MMp61UUZxEnDaj4dXEb95TpZkUt2aU0jDBfcF6jGBjpa572Eki+ZBngkihjcL2mXjcdStezZsCLRK/IBUo0Oi6X51YkiyhwhCOtW77XmrCHCvDCKfjcifTNMVkiPu0banACdVhPt1+jE6sEqOeVLaEQVP190SOE61HSWQ7E2wGet6biP957cz0LsKciTQzVJDZR72MIyPRJAoUM0WJ4SNLMFHM7orIACtMjA2sbEPw509eJMFp7bLm35xV6tUijRIcwTFUwYdzqMM1NCAAAo/wDK/w5jw5L8678zFrXXKKmQP4A+fzBwN7lbQ=</latexit><latexit sha1_base64="SspJVoGf8wR8lFTzsYZMYjZW8A8=">AAAB/HicbVDLSgMxFL3js9bX+Ni5CRahqzIjgroruHFZwbGFdiiZTNqGZpIhyYh1KP6KGxcqbv0Qd/6NaTsLbT1w4XDOvcm9J0o508bzvp2l5ZXVtfXSRnlza3tn193bv9MyU4QGRHKpWhHWlDNBA8MMp61UUZxEnDaj4dXEb95TpZkUt2aU0jDBfcF6jGBjpa572Eki+ZBngkihjcL2mXjcdStezZsCLRK/IBUo0Oi6X51YkiyhwhCOtW77XmrCHCvDCKfjcifTNMVkiPu0banACdVhPt1+jE6sEqOeVLaEQVP190SOE61HSWQ7E2wGet6biP957cz0LsKciTQzVJDZR72MIyPRJAoUM0WJ4SNLMFHM7orIACtMjA2sbEPw509eJMFp7bLm35xV6tUijRIcwTFUwYdzqMM1NCAAAo/wDK/w5jw5L8678zFrXXKKmQP4A+fzBwN7lbQ=</latexit><latexit sha1_base64="SspJVoGf8wR8lFTzsYZMYjZW8A8=">AAAB/HicbVDLSgMxFL3js9bX+Ni5CRahqzIjgroruHFZwbGFdiiZTNqGZpIhyYh1KP6KGxcqbv0Qd/6NaTsLbT1w4XDOvcm9J0o508bzvp2l5ZXVtfXSRnlza3tn193bv9MyU4QGRHKpWhHWlDNBA8MMp61UUZxEnDaj4dXEb95TpZkUt2aU0jDBfcF6jGBjpa572Eki+ZBngkihjcL2mXjcdStezZsCLRK/IBUo0Oi6X51YkiyhwhCOtW77XmrCHCvDCKfjcifTNMVkiPu0banACdVhPt1+jE6sEqOeVLaEQVP190SOE61HSWQ7E2wGet6biP957cz0LsKciTQzVJDZR72MIyPRJAoUM0WJ4SNLMFHM7orIACtMjA2sbEPw509eJMFp7bLm35xV6tUijRIcwTFUwYdzqMM1NCAAAo/wDK/w5jw5L8678zFrXXKKmQP4A+fzBwN7lbQ=</latexit>13"n<latexit sha1_base64="dsQis42JJQMIaG3CdzWy46wNwYw=">AAACC3icbVC9TsMwGPxS/kr5KzCyWFRIXagSQAK2SiyMRSK0UhNVjuu0Vh0nsp1KVZQHYOFVWBgAsfICbLwNbpsBWk6ydL67T/Z3QcKZ0rb9bZVWVtfWN8qbla3tnd296v7Bg4pTSahLYh7LToAV5UxQVzPNaSeRFEcBp+1gdDP122MqFYvFvZ4k1I/wQLCQEayN1KvWvFBikjl5dp6jUzS/eWMsaaIYj0Weidyk7IY9A1omTkFqUKDVq355/ZikERWacKxU17ET7WdYakY4zSteqmiCyQgPaNdQgSOq/Gy2TI5OjNJHYSzNERrN1N8TGY6UmkSBSUZYD9WiNxX/87qpDq/8jIkk1VSQ+UNhypGO0bQZ1GeSEs0nhmAimfkrIkNs+tCmv4opwVlceZm4Z43rhnN3UWvWizbKcATHUAcHLqEJt9ACFwg8wjO8wpv1ZL1Y79bHPFqyiplD+APr8weIMptx</latexit><latexit sha1_base64="dsQis42JJQMIaG3CdzWy46wNwYw=">AAACC3icbVC9TsMwGPxS/kr5KzCyWFRIXagSQAK2SiyMRSK0UhNVjuu0Vh0nsp1KVZQHYOFVWBgAsfICbLwNbpsBWk6ydL67T/Z3QcKZ0rb9bZVWVtfWN8qbla3tnd296v7Bg4pTSahLYh7LToAV5UxQVzPNaSeRFEcBp+1gdDP122MqFYvFvZ4k1I/wQLCQEayN1KvWvFBikjl5dp6jUzS/eWMsaaIYj0Weidyk7IY9A1omTkFqUKDVq355/ZikERWacKxU17ET7WdYakY4zSteqmiCyQgPaNdQgSOq/Gy2TI5OjNJHYSzNERrN1N8TGY6UmkSBSUZYD9WiNxX/87qpDq/8jIkk1VSQ+UNhypGO0bQZ1GeSEs0nhmAimfkrIkNs+tCmv4opwVlceZm4Z43rhnN3UWvWizbKcATHUAcHLqEJt9ACFwg8wjO8wpv1ZL1Y79bHPFqyiplD+APr8weIMptx</latexit><latexit sha1_base64="dsQis42JJQMIaG3CdzWy46wNwYw=">AAACC3icbVC9TsMwGPxS/kr5KzCyWFRIXagSQAK2SiyMRSK0UhNVjuu0Vh0nsp1KVZQHYOFVWBgAsfICbLwNbpsBWk6ydL67T/Z3QcKZ0rb9bZVWVtfWN8qbla3tnd296v7Bg4pTSahLYh7LToAV5UxQVzPNaSeRFEcBp+1gdDP122MqFYvFvZ4k1I/wQLCQEayN1KvWvFBikjl5dp6jUzS/eWMsaaIYj0Weidyk7IY9A1omTkFqUKDVq355/ZikERWacKxU17ET7WdYakY4zSteqmiCyQgPaNdQgSOq/Gy2TI5OjNJHYSzNERrN1N8TGY6UmkSBSUZYD9WiNxX/87qpDq/8jIkk1VSQ+UNhypGO0bQZ1GeSEs0nhmAimfkrIkNs+tCmv4opwVlceZm4Z43rhnN3UWvWizbKcATHUAcHLqEJt9ACFwg8wjO8wpv1ZL1Y79bHPFqyiplD+APr8weIMptx</latexit><latexit sha1_base64="dsQis42JJQMIaG3CdzWy46wNwYw=">AAACC3icbVC9TsMwGPxS/kr5KzCyWFRIXagSQAK2SiyMRSK0UhNVjuu0Vh0nsp1KVZQHYOFVWBgAsfICbLwNbpsBWk6ydL67T/Z3QcKZ0rb9bZVWVtfWN8qbla3tnd296v7Bg4pTSahLYh7LToAV5UxQVzPNaSeRFEcBp+1gdDP122MqFYvFvZ4k1I/wQLCQEayN1KvWvFBikjl5dp6jUzS/eWMsaaIYj0Weidyk7IY9A1omTkFqUKDVq355/ZikERWacKxU17ET7WdYakY4zSteqmiCyQgPaNdQgSOq/Gy2TI5OjNJHYSzNERrN1N8TGY6UmkSBSUZYD9WiNxX/87qpDq/8jIkk1VSQ+UNhypGO0bQZ1GeSEs0nhmAimfkrIkNs+tCmv4opwVlceZm4Z43rhnN3UWvWizbKcATHUAcHLqEJt9ACFwg8wjO8wpv1ZL1Y79bHPFqyiplD+APr8weIMptx</latexit>O✓1"n3logn◆<latexit sha1_base64="Ere2UY71SGC3prHIbLoxQM4Um0g=">AAACJHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYFFVwIbtxZwarQqSWT3mmDmWRI7hTKMD/jxl9x48KKCzd+i2ntwteBwOGcc7m5J0qlsOj7797U9Mzs3PzCYmlpeWV1rby+cW11Zjg0uJba3EbMghQKGihQwm1qgCWRhJvo/mzk3/TBWKHVFQ5SaCWsq0QsOEMntcsnYcKwx5nMLwoaSoiRVsPYMJ4HRR72mYHUCqlVQdXdvgvoLlU0NKLbQ7rbLlf8mj8G/UuCCamQCert8jDsaJ4loJBLZm0z8FNs5cyg4BKKUphZSBm/Z11oOqpYAraVj68s6I5TOjTWxj2FdKx+n8hZYu0giVxydJP97Y3E/7xmhvFRKxcqzRAU/1oUZ5KipqPKaEcY4CgHjjBuhPsr5T3mOkJXbMmVEPw++S9p7NWOa8HlQeW0OmljgWyRbVIlATkkp+Sc1EmDcPJAnsgLGXqP3rP36r19Rae8ycwm+QHv4xNuJqSv</latexit><latexit sha1_base64="Ere2UY71SGC3prHIbLoxQM4Um0g=">AAACJHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYFFVwIbtxZwarQqSWT3mmDmWRI7hTKMD/jxl9x48KKCzd+i2ntwteBwOGcc7m5J0qlsOj7797U9Mzs3PzCYmlpeWV1rby+cW11Zjg0uJba3EbMghQKGihQwm1qgCWRhJvo/mzk3/TBWKHVFQ5SaCWsq0QsOEMntcsnYcKwx5nMLwoaSoiRVsPYMJ4HRR72mYHUCqlVQdXdvgvoLlU0NKLbQ7rbLlf8mj8G/UuCCamQCert8jDsaJ4loJBLZm0z8FNs5cyg4BKKUphZSBm/Z11oOqpYAraVj68s6I5TOjTWxj2FdKx+n8hZYu0giVxydJP97Y3E/7xmhvFRKxcqzRAU/1oUZ5KipqPKaEcY4CgHjjBuhPsr5T3mOkJXbMmVEPw++S9p7NWOa8HlQeW0OmljgWyRbVIlATkkp+Sc1EmDcPJAnsgLGXqP3rP36r19Rae8ycwm+QHv4xNuJqSv</latexit><latexit sha1_base64="Ere2UY71SGC3prHIbLoxQM4Um0g=">AAACJHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYFFVwIbtxZwarQqSWT3mmDmWRI7hTKMD/jxl9x48KKCzd+i2ntwteBwOGcc7m5J0qlsOj7797U9Mzs3PzCYmlpeWV1rby+cW11Zjg0uJba3EbMghQKGihQwm1qgCWRhJvo/mzk3/TBWKHVFQ5SaCWsq0QsOEMntcsnYcKwx5nMLwoaSoiRVsPYMJ4HRR72mYHUCqlVQdXdvgvoLlU0NKLbQ7rbLlf8mj8G/UuCCamQCert8jDsaJ4loJBLZm0z8FNs5cyg4BKKUphZSBm/Z11oOqpYAraVj68s6I5TOjTWxj2FdKx+n8hZYu0giVxydJP97Y3E/7xmhvFRKxcqzRAU/1oUZ5KipqPKaEcY4CgHjjBuhPsr5T3mOkJXbMmVEPw++S9p7NWOa8HlQeW0OmljgWyRbVIlATkkp+Sc1EmDcPJAnsgLGXqP3rP36r19Rae8ycwm+QHv4xNuJqSv</latexit><latexit sha1_base64="Ere2UY71SGC3prHIbLoxQM4Um0g=">AAACJHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYFFVwIbtxZwarQqSWT3mmDmWRI7hTKMD/jxl9x48KKCzd+i2ntwteBwOGcc7m5J0qlsOj7797U9Mzs3PzCYmlpeWV1rby+cW11Zjg0uJba3EbMghQKGihQwm1qgCWRhJvo/mzk3/TBWKHVFQ5SaCWsq0QsOEMntcsnYcKwx5nMLwoaSoiRVsPYMJ4HRR72mYHUCqlVQdXdvgvoLlU0NKLbQ7rbLlf8mj8G/UuCCamQCert8jDsaJ4loJBLZm0z8FNs5cyg4BKKUphZSBm/Z11oOqpYAraVj68s6I5TOjTWxj2FdKx+n8hZYu0giVxydJP97Y3E/7xmhvFRKxcqzRAU/1oUZ5KipqPKaEcY4CgHjjBuhPsr5T3mOkJXbMmVEPw++S9p7NWOa8HlQeW0OmljgWyRbVIlATkkp+Sc1EmDcPJAnsgLGXqP3rP36r19Rae8ycwm+QHv4xNuJqSv</latexit>O✓1"n3log⇣n"⌘+n◆<latexit sha1_base64="/2nCY3Zuwf/SWdCWtLiyw40xTZk=">AAACU3icbVHLahsxFNVMkzRxHnXbZTciJuAQMDNJoe0u0E13TSFOAh7H3JHv2MIaaZDuGMwwH9kuCv2SbrKI/EhInFwQHM6DKx2lhZKOouhfEL7Z2Nx6u73T2N3bP3jXfP/hypnSCuwKo4y9ScGhkhq7JEnhTWER8lThdTr5Ptevp2idNPqSZgX2cxhpmUkB5KlBc5LkQGMBqvpZ80RhRrydZBZEFddVMgWLhZPK6Jrr2zNvMKMHF1/a9JotsXI0Jn7MT3wiSZHgkRo0W1EnWgx/CeIVaLHVXAyaf5KhEWWOmoQC53pxVFC/AktSKKwbSemwADGBEfY81JCj61eLUmp+5Jkhz4z1RxNfsE8TFeTOzfLUO+cVuHVtTr6m9UrKvvYrqYuSUIvloqxUnAyfN8yH0qIgNfMAhJX+rlyMwXdF/h8avoR4/ckvQfe0860T//rcOm+v2thmn9gha7OYfWHn7Ae7YF0m2G/2P2BBEPwN7sIw3Fhaw2CV+cieTbh/Dyf4spI=</latexit><latexit sha1_base64="/2nCY3Zuwf/SWdCWtLiyw40xTZk=">AAACU3icbVHLahsxFNVMkzRxHnXbZTciJuAQMDNJoe0u0E13TSFOAh7H3JHv2MIaaZDuGMwwH9kuCv2SbrKI/EhInFwQHM6DKx2lhZKOouhfEL7Z2Nx6u73T2N3bP3jXfP/hypnSCuwKo4y9ScGhkhq7JEnhTWER8lThdTr5Ptevp2idNPqSZgX2cxhpmUkB5KlBc5LkQGMBqvpZ80RhRrydZBZEFddVMgWLhZPK6Jrr2zNvMKMHF1/a9JotsXI0Jn7MT3wiSZHgkRo0W1EnWgx/CeIVaLHVXAyaf5KhEWWOmoQC53pxVFC/AktSKKwbSemwADGBEfY81JCj61eLUmp+5Jkhz4z1RxNfsE8TFeTOzfLUO+cVuHVtTr6m9UrKvvYrqYuSUIvloqxUnAyfN8yH0qIgNfMAhJX+rlyMwXdF/h8avoR4/ckvQfe0860T//rcOm+v2thmn9gha7OYfWHn7Ae7YF0m2G/2P2BBEPwN7sIw3Fhaw2CV+cieTbh/Dyf4spI=</latexit><latexit sha1_base64="/2nCY3Zuwf/SWdCWtLiyw40xTZk=">AAACU3icbVHLahsxFNVMkzRxHnXbZTciJuAQMDNJoe0u0E13TSFOAh7H3JHv2MIaaZDuGMwwH9kuCv2SbrKI/EhInFwQHM6DKx2lhZKOouhfEL7Z2Nx6u73T2N3bP3jXfP/hypnSCuwKo4y9ScGhkhq7JEnhTWER8lThdTr5Ptevp2idNPqSZgX2cxhpmUkB5KlBc5LkQGMBqvpZ80RhRrydZBZEFddVMgWLhZPK6Jrr2zNvMKMHF1/a9JotsXI0Jn7MT3wiSZHgkRo0W1EnWgx/CeIVaLHVXAyaf5KhEWWOmoQC53pxVFC/AktSKKwbSemwADGBEfY81JCj61eLUmp+5Jkhz4z1RxNfsE8TFeTOzfLUO+cVuHVtTr6m9UrKvvYrqYuSUIvloqxUnAyfN8yH0qIgNfMAhJX+rlyMwXdF/h8avoR4/ckvQfe0860T//rcOm+v2thmn9gha7OYfWHn7Ae7YF0m2G/2P2BBEPwN7sIw3Fhaw2CV+cieTbh/Dyf4spI=</latexit><latexit sha1_base64="/2nCY3Zuwf/SWdCWtLiyw40xTZk=">AAACU3icbVHLahsxFNVMkzRxHnXbZTciJuAQMDNJoe0u0E13TSFOAh7H3JHv2MIaaZDuGMwwH9kuCv2SbrKI/EhInFwQHM6DKx2lhZKOouhfEL7Z2Nx6u73T2N3bP3jXfP/hypnSCuwKo4y9ScGhkhq7JEnhTWER8lThdTr5Ptevp2idNPqSZgX2cxhpmUkB5KlBc5LkQGMBqvpZ80RhRrydZBZEFddVMgWLhZPK6Jrr2zNvMKMHF1/a9JotsXI0Jn7MT3wiSZHgkRo0W1EnWgx/CeIVaLHVXAyaf5KhEWWOmoQC53pxVFC/AktSKKwbSemwADGBEfY81JCj61eLUmp+5Jkhz4z1RxNfsE8TFeTOzfLUO+cVuHVtTr6m9UrKvvYrqYuSUIvloqxUnAyfN8yH0qIgNfMAhJX+rlyMwXdF/h8avoR4/ckvQfe0860T//rcOm+v2thmn9gha7OYfWHn7Ae7YF0m2G/2P2BBEPwN7sIw3Fhaw2CV+cieTbh/Dyf4spI=</latexit>O✓1"n4logn"◆<latexit sha1_base64="p2XahCp9h18oJ4UGMDeq2ZwQtRg=">AAACOHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYK6k5w484KVoVOLZn0ThvMJENyRyjD/JYb/8Kd4MaFilu/wLTOwteBwOGce7k5J0qlsOj7j97U9Mzs3PzCYmVpeWV1rbq+cWF1Zji0uZbaXEXMghQK2ihQwlVqgCWRhMvo5njsX96CsUKrcxyl0E3YQIlYcIZO6lVbYcJwyJnMTwsaSoiR1mkYG8bzoMjDW2YgtUJqVajrphvQg9JVP10aGjEYIt3tVWt+w5+A/iVBSWqkRKtXfQj7mmcJKOSSWdsJ/BS7OTMouISiEmYWUsZv2AA6jiqWgO3mk+QF3XFKn8bauKeQTtTvGzlLrB0lkZsc57S/vbH4n9fJMD7o5kKlGYLiX4fiTFLUdFwj7QsDHOXIEcaNcH+lfMhcMejKrrgSgt+R/5L2XuOwEZw1a0f1so0FskW2SZ0EZJ8ckRPSIm3CyR15Ii/k1bv3nr037/1rdMordzbJD3gfn1cjrf8=</latexit><latexit sha1_base64="p2XahCp9h18oJ4UGMDeq2ZwQtRg=">AAACOHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYK6k5w484KVoVOLZn0ThvMJENyRyjD/JYb/8Kd4MaFilu/wLTOwteBwOGce7k5J0qlsOj7j97U9Mzs3PzCYmVpeWV1rbq+cWF1Zji0uZbaXEXMghQK2ihQwlVqgCWRhMvo5njsX96CsUKrcxyl0E3YQIlYcIZO6lVbYcJwyJnMTwsaSoiR1mkYG8bzoMjDW2YgtUJqVajrphvQg9JVP10aGjEYIt3tVWt+w5+A/iVBSWqkRKtXfQj7mmcJKOSSWdsJ/BS7OTMouISiEmYWUsZv2AA6jiqWgO3mk+QF3XFKn8bauKeQTtTvGzlLrB0lkZsc57S/vbH4n9fJMD7o5kKlGYLiX4fiTFLUdFwj7QsDHOXIEcaNcH+lfMhcMejKrrgSgt+R/5L2XuOwEZw1a0f1so0FskW2SZ0EZJ8ckRPSIm3CyR15Ii/k1bv3nr037/1rdMordzbJD3gfn1cjrf8=</latexit><latexit sha1_base64="p2XahCp9h18oJ4UGMDeq2ZwQtRg=">AAACOHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYK6k5w484KVoVOLZn0ThvMJENyRyjD/JYb/8Kd4MaFilu/wLTOwteBwOGce7k5J0qlsOj7j97U9Mzs3PzCYmVpeWV1rbq+cWF1Zji0uZbaXEXMghQK2ihQwlVqgCWRhMvo5njsX96CsUKrcxyl0E3YQIlYcIZO6lVbYcJwyJnMTwsaSoiR1mkYG8bzoMjDW2YgtUJqVajrphvQg9JVP10aGjEYIt3tVWt+w5+A/iVBSWqkRKtXfQj7mmcJKOSSWdsJ/BS7OTMouISiEmYWUsZv2AA6jiqWgO3mk+QF3XFKn8bauKeQTtTvGzlLrB0lkZsc57S/vbH4n9fJMD7o5kKlGYLiX4fiTFLUdFwj7QsDHOXIEcaNcH+lfMhcMejKrrgSgt+R/5L2XuOwEZw1a0f1so0FskW2SZ0EZJ8ckRPSIm3CyR15Ii/k1bv3nr037/1rdMordzbJD3gfn1cjrf8=</latexit><latexit sha1_base64="p2XahCp9h18oJ4UGMDeq2ZwQtRg=">AAACOHicbVDLSgMxFM34tr6qLt0Ei1A3ZUYK6k5w484KVoVOLZn0ThvMJENyRyjD/JYb/8Kd4MaFilu/wLTOwteBwOGce7k5J0qlsOj7j97U9Mzs3PzCYmVpeWV1rbq+cWF1Zji0uZbaXEXMghQK2ihQwlVqgCWRhMvo5njsX96CsUKrcxyl0E3YQIlYcIZO6lVbYcJwyJnMTwsaSoiR1mkYG8bzoMjDW2YgtUJqVajrphvQg9JVP10aGjEYIt3tVWt+w5+A/iVBSWqkRKtXfQj7mmcJKOSSWdsJ/BS7OTMouISiEmYWUsZv2AA6jiqWgO3mk+QF3XFKn8bauKeQTtTvGzlLrB0lkZsc57S/vbH4n9fJMD7o5kKlGYLiX4fiTFLUdFwj7QsDHOXIEcaNcH+lfMhcMejKrrgSgt+R/5L2XuOwEZw1a0f1so0FskW2SZ0EZJ8ckRPSIm3CyR15Ii/k1bv3nr037/1rdMordzbJD3gfn1cjrf8=</latexit>fitnessevaluations<latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit>fitnessevaluations<latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit>fitnessevaluations<latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit><latexit sha1_base64="62k93RtZjAkmGkx3j7hBl9Q3BXw=">AAACAnicbVBNS8NAEN3Ur1q/ot70sliEnkoignorePFYwdhCG8pmO2mXbjZhd1MsoeDFv+LFg4pXf4U3/43bNAdtfTDweG+GmXlBwpnSjvNtlVZW19Y3ypuVre2d3T17/+Bexamk4NGYx7IdEAWcCfA00xzaiQQSBRxaweh65rfGIBWLxZ2eJOBHZCBYyCjRRurZR90oiB+ykGkBSmEYE57mlpr27KpTd3LgZeIWpIoKNHv2V7cf0zQCoSknSnVcJ9F+RqRmlMO00k0VJISOyAA6hgoSgfKz/IcpPjVKH4exNCU0ztXfExmJlJpEgemMiB6qRW8m/ud1Uh1e+hkTSapB0PmiMOVYx3gWCO4zCVTziSGESmZuxXRIJKHaxFYxIbiLLy8T76x+VXdvz6uNWpFGGR2jE1RDLrpADXSDmshDFD2iZ/SK3qwn68V6tz7mrSWrmDlEf2B9/gCNv5g6</latexit>inexpectation<latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit><latexit sha1_base64="0F1oFW2iMf4pa0wz2P5CtqfxE8Q=">AAAB/XicbVBNSwMxFHzrZ61fq+LJS7AIPZVdEdRbwYvHCq4ttEvJpmkbmmSXJCstS8G/4sWDilf/hzf/jel2D9o6EBhm3iNvJko408bzvp2V1bX1jc3SVnl7Z3dv3z04fNBxqggNSMxj1YqwppxJGhhmOG0limIRcdqMRjczv/lIlWaxvDeThIYCDyTrM4KNlbrucUdE8ThjEtFxQonJ5WnXrXg1LwdaJn5BKlCg0XW/Or2YpIJKQzjWuu17iQkzrAwjnE7LnVTTBJMRHtC2pRILqsMsP3+KzqzSQ/1Y2ScNytXfGxkWWk9EZCcFNkO96M3E/7x2avpXoc2WpIZKMv+on3JkYjTrAvWYspH5xBJMFLO3IjLEChNjGyvbEvzFyMskOK9d1/y7i0q9WrRRghM4hSr4cAl1uIUGBEAgg2d4hTfnyXlx3p2P+eiKU+wcwR84nz9aJ5Xc</latexit>w.p.atleast'0.25<latexit sha1_base64="wDs4YKIX+qLuIlLx6Uex42BRSNY=">AAACCXicbVA9TwJBEN3zE/ELtbRZJSZUlzuiUTsSG0tMREiAkL1lgA27d+funEou1Db+FRsLNbb+Azv/jctHoeBLJnl5byYz84JYCoOe9+0sLC4tr6xm1rLrG5tb27md3RsTJZpDhUcy0rWAGZAihAoKlFCLNTAVSKgG/YuRX70DbUQUXuMghqZi3VB0BGdopVbuoKGC6CG9d2OXMqQSmEE6pA0jFNxSzy2etHJ5z/XGoPPEn5I8maLcyn012hFPFITIJTOm7nsxNlOmUXAJw2wjMRAz3mddqFsaMgWmmY5fGdIjq7RpJ9K2QqRj9fdEypQxAxXYTsWwZ2a9kfifV0+wc9ZMRRgnCCGfLOokkmJER7nQttDAUQ4sYVwLeyvlPaYZR5te1obgz748TypF99z1r47zpcI0jQzZJ4ekQHxySkrkkpRJhXDySJ7JK3lznpwX5935mLQuONOZPfIHzucPOx+Yyg==</latexit><latexit sha1_base64="wDs4YKIX+qLuIlLx6Uex42BRSNY=">AAACCXicbVA9TwJBEN3zE/ELtbRZJSZUlzuiUTsSG0tMREiAkL1lgA27d+funEou1Db+FRsLNbb+Azv/jctHoeBLJnl5byYz84JYCoOe9+0sLC4tr6xm1rLrG5tb27md3RsTJZpDhUcy0rWAGZAihAoKlFCLNTAVSKgG/YuRX70DbUQUXuMghqZi3VB0BGdopVbuoKGC6CG9d2OXMqQSmEE6pA0jFNxSzy2etHJ5z/XGoPPEn5I8maLcyn012hFPFITIJTOm7nsxNlOmUXAJw2wjMRAz3mddqFsaMgWmmY5fGdIjq7RpJ9K2QqRj9fdEypQxAxXYTsWwZ2a9kfifV0+wc9ZMRRgnCCGfLOokkmJER7nQttDAUQ4sYVwLeyvlPaYZR5te1obgz748TypF99z1r47zpcI0jQzZJ4ekQHxySkrkkpRJhXDySJ7JK3lznpwX5935mLQuONOZPfIHzucPOx+Yyg==</latexit><latexit sha1_base64="wDs4YKIX+qLuIlLx6Uex42BRSNY=">AAACCXicbVA9TwJBEN3zE/ELtbRZJSZUlzuiUTsSG0tMREiAkL1lgA27d+funEou1Db+FRsLNbb+Azv/jctHoeBLJnl5byYz84JYCoOe9+0sLC4tr6xm1rLrG5tb27md3RsTJZpDhUcy0rWAGZAihAoKlFCLNTAVSKgG/YuRX70DbUQUXuMghqZi3VB0BGdopVbuoKGC6CG9d2OXMqQSmEE6pA0jFNxSzy2etHJ5z/XGoPPEn5I8maLcyn012hFPFITIJTOm7nsxNlOmUXAJw2wjMRAz3mddqFsaMgWmmY5fGdIjq7RpJ9K2QqRj9fdEypQxAxXYTsWwZ2a9kfifV0+wc9ZMRRgnCCGfLOokkmJER7nQttDAUQ4sYVwLeyvlPaYZR5te1obgz748TypF99z1r47zpcI0jQzZJ4ekQHxySkrkkpRJhXDySJ7JK3lznpwX5935mLQuONOZPfIHzucPOx+Yyg==</latexit><latexit sha1_base64="wDs4YKIX+qLuIlLx6Uex42BRSNY=">AAACCXicbVA9TwJBEN3zE/ELtbRZJSZUlzuiUTsSG0tMREiAkL1lgA27d+funEou1Db+FRsLNbb+Azv/jctHoeBLJnl5byYz84JYCoOe9+0sLC4tr6xm1rLrG5tb27md3RsTJZpDhUcy0rWAGZAihAoKlFCLNTAVSKgG/YuRX70DbUQUXuMghqZi3VB0BGdopVbuoKGC6CG9d2OXMqQSmEE6pA0jFNxSzy2etHJ5z/XGoPPEn5I8maLcyn012hFPFITIJTOm7nsxNlOmUXAJw2wjMRAz3mddqFsaMgWmmY5fGdIjq7RpJ9K2QqRj9fdEypQxAxXYTsWwZ2a9kfifV0+wc9ZMRRgnCCGfLOokkmJER7nQttDAUQ4sYVwLeyvlPaYZR5te1obgz748TypF99z1r47zpcI0jQzZJ4ekQHxySkrkkpRJhXDySJ7JK3lznpwX5935mLQuONOZPfIHzucPOx+Yyg==</latexit>favorablemoves<latexit sha1_base64="IDo12ehjc9IvtjaXt9WiccKiR1M=">AAAB/nicbVBNSwMxFMzWr1q/VgUvXoJF6KnsiqDeCl48VnBtoS3lbZptQ5PNkmSLZe3Bv+LFg4pXf4c3/41puwdtHQgMM294LxMmnGnjed9OYWV1bX2juFna2t7Z3XP3D+61TBWhAZFcqmYImnIW08Aww2kzURREyGkjHF5P/caIKs1kfGfGCe0I6McsYgSMlbruUVuE8iGLYCQV2BAWckT1pOuWvao3A14mfk7KKEe96361e5KkgsaGcNC65XuJ6WSgDCOcTkrtVNMEyBD6tGVpDILqTja7f4JPrdLDkVT2xQbP1N+JDITWYxHaSQFmoBe9qfif10pNdNnJWJykhsZkvihKOTYST8vAPaYoMXxsCRDF7K2YDEABMbayki3BX/zyMgnOqldV//a8XKvkbRTRMTpBFeSjC1RDN6iOAkTQI3pGr+jNeXJenHfnYz5acPLMIfoD5/MHG++WRw==</latexit><latexit sha1_base64="IDo12ehjc9IvtjaXt9WiccKiR1M=">AAAB/nicbVBNSwMxFMzWr1q/VgUvXoJF6KnsiqDeCl48VnBtoS3lbZptQ5PNkmSLZe3Bv+LFg4pXf4c3/41puwdtHQgMM294LxMmnGnjed9OYWV1bX2juFna2t7Z3XP3D+61TBWhAZFcqmYImnIW08Aww2kzURREyGkjHF5P/caIKs1kfGfGCe0I6McsYgSMlbruUVuE8iGLYCQV2BAWckT1pOuWvao3A14mfk7KKEe96361e5KkgsaGcNC65XuJ6WSgDCOcTkrtVNMEyBD6tGVpDILqTja7f4JPrdLDkVT2xQbP1N+JDITWYxHaSQFmoBe9qfif10pNdNnJWJykhsZkvihKOTYST8vAPaYoMXxsCRDF7K2YDEABMbayki3BX/zyMgnOqldV//a8XKvkbRTRMTpBFeSjC1RDN6iOAkTQI3pGr+jNeXJenHfnYz5acPLMIfoD5/MHG++WRw==</latexit><latexit sha1_base64="IDo12ehjc9IvtjaXt9WiccKiR1M=">AAAB/nicbVBNSwMxFMzWr1q/VgUvXoJF6KnsiqDeCl48VnBtoS3lbZptQ5PNkmSLZe3Bv+LFg4pXf4c3/41puwdtHQgMM294LxMmnGnjed9OYWV1bX2juFna2t7Z3XP3D+61TBWhAZFcqmYImnIW08Aww2kzURREyGkjHF5P/caIKs1kfGfGCe0I6McsYgSMlbruUVuE8iGLYCQV2BAWckT1pOuWvao3A14mfk7KKEe96361e5KkgsaGcNC65XuJ6WSgDCOcTkrtVNMEyBD6tGVpDILqTja7f4JPrdLDkVT2xQbP1N+JDITWYxHaSQFmoBe9qfif10pNdNnJWJykhsZkvihKOTYST8vAPaYoMXxsCRDF7K2YDEABMbayki3BX/zyMgnOqldV//a8XKvkbRTRMTpBFeSjC1RDN6iOAkTQI3pGr+jNeXJenHfnYz5acPLMIfoD5/MHG++WRw==</latexit><latexit sha1_base64="IDo12ehjc9IvtjaXt9WiccKiR1M=">AAAB/nicbVBNSwMxFMzWr1q/VgUvXoJF6KnsiqDeCl48VnBtoS3lbZptQ5PNkmSLZe3Bv+LFg4pXf4c3/41puwdtHQgMM294LxMmnGnjed9OYWV1bX2juFna2t7Z3XP3D+61TBWhAZFcqmYImnIW08Aww2kzURREyGkjHF5P/caIKs1kfGfGCe0I6McsYgSMlbruUVuE8iGLYCQV2BAWckT1pOuWvao3A14mfk7KKEe96361e5KkgsaGcNC65XuJ6WSgDCOcTkrtVNMEyBD6tGVpDILqTja7f4JPrdLDkVT2xQbP1N+JDITWYxHaSQFmoBe9qfif10pNdNnJWJykhsZkvihKOTYST8vAPaYoMXxsCRDF7K2YDEABMbayki3BX/zyMgnOqldV//a8XKvkbRTRMTpBFeSjC1RDN6iOAkTQI3pGr+jNeXJenHfnYz5acPLMIfoD5/MHG++WRw==</latexit>O✓1"n3+n◆<latexit sha1_base64="bfobfK3AyRoTPadqw6VG4Cezv7k=">AAACKnicbVBNSysxFM2oz4/6nlZdugkWofKgzKig7kQ37lSwKnRquZPeaYOZzJDcEcow/8eNf8WFLlTc+kNMaxd+XUg4nHMuyTlRpqQl33/xJian/kzPzM5V5v/+W1isLi2f2zQ3ApsiVam5jMCikhqbJEnhZWYQkkjhRXR9ONQvbtBYmeozGmTYTqCnZSwFkKM61YMwAeoLUMVxyUOFMfE6D2MDogjKIrwBg5mVKtUl11db/L+7izBCAuc2stcnvtGp1vyGPxr+EwRjUGPjOelUH8JuKvIENQkF1rYCP6N2AYakUFhWwtxiBuIaethyUEOCtl2MspZ83TFdHqfGHU18xH7eKCCxdpBEzjlMZr9rQ/I3rZVTvNsupM5yQi0+HopzxSnlw+J4VxoUpAYOgDDS/ZWLPriiyNVbcSUE3yP/BM3Nxl4jON2u7dfHbcyyVbbG6ixgO2yfHbET1mSC3bJ79sSevTvv0XvxXj+sE954Z4V9Ge/tHctWpuY=</latexit><latexit sha1_base64="bfobfK3AyRoTPadqw6VG4Cezv7k=">AAACKnicbVBNSysxFM2oz4/6nlZdugkWofKgzKig7kQ37lSwKnRquZPeaYOZzJDcEcow/8eNf8WFLlTc+kNMaxd+XUg4nHMuyTlRpqQl33/xJian/kzPzM5V5v/+W1isLi2f2zQ3ApsiVam5jMCikhqbJEnhZWYQkkjhRXR9ONQvbtBYmeozGmTYTqCnZSwFkKM61YMwAeoLUMVxyUOFMfE6D2MDogjKIrwBg5mVKtUl11db/L+7izBCAuc2stcnvtGp1vyGPxr+EwRjUGPjOelUH8JuKvIENQkF1rYCP6N2AYakUFhWwtxiBuIaethyUEOCtl2MspZ83TFdHqfGHU18xH7eKCCxdpBEzjlMZr9rQ/I3rZVTvNsupM5yQi0+HopzxSnlw+J4VxoUpAYOgDDS/ZWLPriiyNVbcSUE3yP/BM3Nxl4jON2u7dfHbcyyVbbG6ixgO2yfHbET1mSC3bJ79sSevTvv0XvxXj+sE954Z4V9Ge/tHctWpuY=</latexit><latexit sha1_base64="bfobfK3AyRoTPadqw6VG4Cezv7k=">AAACKnicbVBNSysxFM2oz4/6nlZdugkWofKgzKig7kQ37lSwKnRquZPeaYOZzJDcEcow/8eNf8WFLlTc+kNMaxd+XUg4nHMuyTlRpqQl33/xJian/kzPzM5V5v/+W1isLi2f2zQ3ApsiVam5jMCikhqbJEnhZWYQkkjhRXR9ONQvbtBYmeozGmTYTqCnZSwFkKM61YMwAeoLUMVxyUOFMfE6D2MDogjKIrwBg5mVKtUl11db/L+7izBCAuc2stcnvtGp1vyGPxr+EwRjUGPjOelUH8JuKvIENQkF1rYCP6N2AYakUFhWwtxiBuIaethyUEOCtl2MspZ83TFdHqfGHU18xH7eKCCxdpBEzjlMZr9rQ/I3rZVTvNsupM5yQi0+HopzxSnlw+J4VxoUpAYOgDDS/ZWLPriiyNVbcSUE3yP/BM3Nxl4jON2u7dfHbcyyVbbG6ixgO2yfHbET1mSC3bJ79sSevTvv0XvxXj+sE954Z4V9Ge/tHctWpuY=</latexit><latexit sha1_base64="bfobfK3AyRoTPadqw6VG4Cezv7k=">AAACKnicbVBNSysxFM2oz4/6nlZdugkWofKgzKig7kQ37lSwKnRquZPeaYOZzJDcEcow/8eNf8WFLlTc+kNMaxd+XUg4nHMuyTlRpqQl33/xJian/kzPzM5V5v/+W1isLi2f2zQ3ApsiVam5jMCikhqbJEnhZWYQkkjhRXR9ONQvbtBYmeozGmTYTqCnZSwFkKM61YMwAeoLUMVxyUOFMfE6D2MDogjKIrwBg5mVKtUl11db/L+7izBCAuc2stcnvtGp1vyGPxr+EwRjUGPjOelUH8JuKvIENQkF1rYCP6N2AYakUFhWwtxiBuIaethyUEOCtl2MspZ83TFdHqfGHU18xH7eKCCxdpBEzjlMZr9rQ/I3rZVTvNsupM5yQi0+HopzxSnlw+J4VxoUpAYOgDDS/ZWLPriiyNVbcSUE3yP/BM3Nxl4jON2u7dfHbcyyVbbG6ixgO2yfHbET1mSC3bJ79sSevTvv0XvxXj+sE954Z4V9Ge/tHctWpuY=</latexit>O✓1"n4logn◆<latexit sha1_base64="55QH0J5tuMBEkUwwxLzSe1b6hkY=">AAACJXicbVDLSgMxFM34tr6qLt0Ei1A3ZUYEdSEIbtypYG2hU0smvdMGM8mQ3BHKMF/jxl9x40JFcOWvmD4WWj0QOJxzLjf3RKkUFn3/05uZnZtfWFxaLq2srq1vlDe3bq3ODIc611KbZsQsSKGgjgIlNFMDLIkkNKL786HfeABjhVY3OEihnbCeErHgDJ3UKZ+GCcM+ZzK/LGgoIUZapWFsGM+DIg8fmIHUCqlVQdXdoUvoHlU0NKLXR7rfKVf8mj8C/UuCCamQCa465dewq3mWgEIumbWtwE+xnTODgksoSmFmIWX8nvWg5ahiCdh2PjqzoHtO6dJYG/cU0pH6cyJnibWDJHLJ4VF22huK/3mtDOPjdi5UmiEoPl4UZ5KipsPOaFcY4CgHjjBuhPsr5X3mOkLXbMmVEEyf/JfUD2onteD6sHJWnbSxRHbILqmSgByRM3JBrkidcPJInskrefOevBfv3fsYR2e8ycw2+QXv6xvRnaTa</latexit><latexit sha1_base64="55QH0J5tuMBEkUwwxLzSe1b6hkY=">AAACJXicbVDLSgMxFM34tr6qLt0Ei1A3ZUYEdSEIbtypYG2hU0smvdMGM8mQ3BHKMF/jxl9x40JFcOWvmD4WWj0QOJxzLjf3RKkUFn3/05uZnZtfWFxaLq2srq1vlDe3bq3ODIc611KbZsQsSKGgjgIlNFMDLIkkNKL786HfeABjhVY3OEihnbCeErHgDJ3UKZ+GCcM+ZzK/LGgoIUZapWFsGM+DIg8fmIHUCqlVQdXdoUvoHlU0NKLXR7rfKVf8mj8C/UuCCamQCa465dewq3mWgEIumbWtwE+xnTODgksoSmFmIWX8nvWg5ahiCdh2PjqzoHtO6dJYG/cU0pH6cyJnibWDJHLJ4VF22huK/3mtDOPjdi5UmiEoPl4UZ5KipsPOaFcY4CgHjjBuhPsr5X3mOkLXbMmVEEyf/JfUD2onteD6sHJWnbSxRHbILqmSgByRM3JBrkidcPJInskrefOevBfv3fsYR2e8ycw2+QXv6xvRnaTa</latexit><latexit sha1_base64="55QH0J5tuMBEkUwwxLzSe1b6hkY=">AAACJXicbVDLSgMxFM34tr6qLt0Ei1A3ZUYEdSEIbtypYG2hU0smvdMGM8mQ3BHKMF/jxl9x40JFcOWvmD4WWj0QOJxzLjf3RKkUFn3/05uZnZtfWFxaLq2srq1vlDe3bq3ODIc611KbZsQsSKGgjgIlNFMDLIkkNKL786HfeABjhVY3OEihnbCeErHgDJ3UKZ+GCcM+ZzK/LGgoIUZapWFsGM+DIg8fmIHUCqlVQdXdoUvoHlU0NKLXR7rfKVf8mj8C/UuCCamQCa465dewq3mWgEIumbWtwE+xnTODgksoSmFmIWX8nvWg5ahiCdh2PjqzoHtO6dJYG/cU0pH6cyJnibWDJHLJ4VF22huK/3mtDOPjdi5UmiEoPl4UZ5KipsPOaFcY4CgHjjBuhPsr5X3mOkLXbMmVEEyf/JfUD2onteD6sHJWnbSxRHbILqmSgByRM3JBrkidcPJInskrefOevBfv3fsYR2e8ycw2+QXv6xvRnaTa</latexit><latexit sha1_base64="55QH0J5tuMBEkUwwxLzSe1b6hkY=">AAACJXicbVDLSgMxFM34tr6qLt0Ei1A3ZUYEdSEIbtypYG2hU0smvdMGM8mQ3BHKMF/jxl9x40JFcOWvmD4WWj0QOJxzLjf3RKkUFn3/05uZnZtfWFxaLq2srq1vlDe3bq3ODIc611KbZsQsSKGgjgIlNFMDLIkkNKL786HfeABjhVY3OEihnbCeErHgDJ3UKZ+GCcM+ZzK/LGgoIUZapWFsGM+DIg8fmIHUCqlVQdXdoUvoHlU0NKLXR7rfKVf8mj8C/UuCCamQCa465dewq3mWgEIumbWtwE+xnTODgksoSmFmIWX8nvWg5ahiCdh2PjqzoHtO6dJYG/cU0pH6cyJnibWDJHLJ4VF22huK/3mtDOPjdi5UmiEoPl4UZ5KipsPOaFcY4CgHjjBuhPsr5X3mOkLXbMmVEEyf/JfUD2onteD6sHJWnbSxRHbILqmSgByRM3JBrkidcPJInskrefOevBfv3fsYR2e8ycw2+QXv6xvRnaTa</latexit>O✓1"n2logn"◆<latexit sha1_base64="77PmcL6u/Gy7FjOWLAapHr7bwGA=">AAACOXicbVA9SwNBFNzz2/gVtbRZDEJswp0IaifY2KlgVMjFsLd5lyzu7R677wLhuN9l46+ws7CxULH1D7iJV2h0YGGYeY+3M1EqhUXff/Kmpmdm5+YXFitLyyura9X1jSurM8OhybXU5iZiFqRQ0ESBEm5SAyyJJFxHdycj/3oAxgqtLnGYQjthPSViwRk6qVO9CBOGfc5kflbQUEKMtE7D2DCeB0UeDpiB1AqpVUHV7Z6b0L3SVhN2aESvj3S3U635DX8M+pcEJamREued6mPY1TxLQCGXzNpW4KfYzplBwSUUlTCzkDJ+x3rQclSxBGw7H0cv6I5TujTWxj2FdKz+3MhZYu0widzkKKid9Ebif14rw/iwnQuVZgiKfx+KM0lR01GPtCsMcJRDRxg3wv2V8j5zxaBru+JKCCYj/yXNvcZRI7jYrx3XyzYWyBbZJnUSkANyTE7JOWkSTu7JM3klb96D9+K9ex/fo1NeubNJfsH7/AK+ea4n</latexit><latexit sha1_base64="77PmcL6u/Gy7FjOWLAapHr7bwGA=">AAACOXicbVA9SwNBFNzz2/gVtbRZDEJswp0IaifY2KlgVMjFsLd5lyzu7R677wLhuN9l46+ws7CxULH1D7iJV2h0YGGYeY+3M1EqhUXff/Kmpmdm5+YXFitLyyura9X1jSurM8OhybXU5iZiFqRQ0ESBEm5SAyyJJFxHdycj/3oAxgqtLnGYQjthPSViwRk6qVO9CBOGfc5kflbQUEKMtE7D2DCeB0UeDpiB1AqpVUHV7Z6b0L3SVhN2aESvj3S3U635DX8M+pcEJamREued6mPY1TxLQCGXzNpW4KfYzplBwSUUlTCzkDJ+x3rQclSxBGw7H0cv6I5TujTWxj2FdKz+3MhZYu0widzkKKid9Ebif14rw/iwnQuVZgiKfx+KM0lR01GPtCsMcJRDRxg3wv2V8j5zxaBru+JKCCYj/yXNvcZRI7jYrx3XyzYWyBbZJnUSkANyTE7JOWkSTu7JM3klb96D9+K9ex/fo1NeubNJfsH7/AK+ea4n</latexit><latexit sha1_base64="77PmcL6u/Gy7FjOWLAapHr7bwGA=">AAACOXicbVA9SwNBFNzz2/gVtbRZDEJswp0IaifY2KlgVMjFsLd5lyzu7R677wLhuN9l46+ws7CxULH1D7iJV2h0YGGYeY+3M1EqhUXff/Kmpmdm5+YXFitLyyura9X1jSurM8OhybXU5iZiFqRQ0ESBEm5SAyyJJFxHdycj/3oAxgqtLnGYQjthPSViwRk6qVO9CBOGfc5kflbQUEKMtE7D2DCeB0UeDpiB1AqpVUHV7Z6b0L3SVhN2aESvj3S3U635DX8M+pcEJamREued6mPY1TxLQCGXzNpW4KfYzplBwSUUlTCzkDJ+x3rQclSxBGw7H0cv6I5TujTWxj2FdKz+3MhZYu0widzkKKid9Ebif14rw/iwnQuVZgiKfx+KM0lR01GPtCsMcJRDRxg3wv2V8j5zxaBru+JKCCYj/yXNvcZRI7jYrx3XyzYWyBbZJnUSkANyTE7JOWkSTu7JM3klb96D9+K9ex/fo1NeubNJfsH7/AK+ea4n</latexit><latexit sha1_base64="77PmcL6u/Gy7FjOWLAapHr7bwGA=">AAACOXicbVA9SwNBFNzz2/gVtbRZDEJswp0IaifY2KlgVMjFsLd5lyzu7R677wLhuN9l46+ws7CxULH1D7iJV2h0YGGYeY+3M1EqhUXff/Kmpmdm5+YXFitLyyura9X1jSurM8OhybXU5iZiFqRQ0ESBEm5SAyyJJFxHdycj/3oAxgqtLnGYQjthPSViwRk6qVO9CBOGfc5kflbQUEKMtE7D2DCeB0UeDpiB1AqpVUHV7Z6b0L3SVhN2aESvj3S3U635DX8M+pcEJamREued6mPY1TxLQCGXzNpW4KfYzplBwSUUlTCzkDJ+x3rQclSxBGw7H0cv6I5TujTWxj2FdKz+3MhZYu0widzkKKid9Ebif14rw/iwnQuVZgiKfx+KM0lR01GPtCsMcJRDRxg3wv2V8j5zxaBru+JKCCYj/yXNvcZRI7jYrx3XyzYWyBbZJnUSkANyTE7JOWkSTu7JM3klb96D9+K9ex/fo1NeubNJfsH7/AK+ea4n</latexit>fitness<latexit sha1_base64="z9EcW+gxjsxwP3lY9d+fbRza8AA=">AAAB9HicbVDLSgNBEJyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAEsPspDcZMo9lZlYNS/7DiwcVr36MN//GSbIHTSxoKKq66e6KEs6M9f1vr7Cyura+UdwsbW3v7O6V9w/ujEo1hZAqrnQrIgY4kxBaZjm0Eg1ERBya0ehq6jcfQBum5K0dJ9AVZCBZzCixTrrviEg9ZTGzEoyZ9MoVv+bPgJdJkJMKytHolb86fUVTAdJSToxpB35iuxnRllEOk1InNZAQOiIDaDsqiQDTzWZXT/CJU/o4VtqVtHim/p7IiDBmLCLXKYgdmkVvKv7ntVMbX3QzJpPUgqTzRXHKsVV4GgHuMw3U8rEjhGrmbsV0SDSh1gVVciEEiy8vk/C0dlkLbs4q9WqeRhEdoWNURQE6R3V0jRooRBRp9Ixe0Zv36L14797HvLXg5TOH6A+8zx+5WJLG</latexit><latexit sha1_base64="z9EcW+gxjsxwP3lY9d+fbRza8AA=">AAAB9HicbVDLSgNBEJyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAEsPspDcZMo9lZlYNS/7DiwcVr36MN//GSbIHTSxoKKq66e6KEs6M9f1vr7Cyura+UdwsbW3v7O6V9w/ujEo1hZAqrnQrIgY4kxBaZjm0Eg1ERBya0ehq6jcfQBum5K0dJ9AVZCBZzCixTrrviEg9ZTGzEoyZ9MoVv+bPgJdJkJMKytHolb86fUVTAdJSToxpB35iuxnRllEOk1InNZAQOiIDaDsqiQDTzWZXT/CJU/o4VtqVtHim/p7IiDBmLCLXKYgdmkVvKv7ntVMbX3QzJpPUgqTzRXHKsVV4GgHuMw3U8rEjhGrmbsV0SDSh1gVVciEEiy8vk/C0dlkLbs4q9WqeRhEdoWNURQE6R3V0jRooRBRp9Ixe0Zv36L14797HvLXg5TOH6A+8zx+5WJLG</latexit><latexit sha1_base64="z9EcW+gxjsxwP3lY9d+fbRza8AA=">AAAB9HicbVDLSgNBEJyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAEsPspDcZMo9lZlYNS/7DiwcVr36MN//GSbIHTSxoKKq66e6KEs6M9f1vr7Cyura+UdwsbW3v7O6V9w/ujEo1hZAqrnQrIgY4kxBaZjm0Eg1ERBya0ehq6jcfQBum5K0dJ9AVZCBZzCixTrrviEg9ZTGzEoyZ9MoVv+bPgJdJkJMKytHolb86fUVTAdJSToxpB35iuxnRllEOk1InNZAQOiIDaDsqiQDTzWZXT/CJU/o4VtqVtHim/p7IiDBmLCLXKYgdmkVvKv7ntVMbX3QzJpPUgqTzRXHKsVV4GgHuMw3U8rEjhGrmbsV0SDSh1gVVciEEiy8vk/C0dlkLbs4q9WqeRhEdoWNURQE6R3V0jRooRBRp9Ixe0Zv36L14797HvLXg5TOH6A+8zx+5WJLG</latexit><latexit sha1_base64="z9EcW+gxjsxwP3lY9d+fbRza8AA=">AAAB9HicbVDLSgNBEJyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAEsPspDcZMo9lZlYNS/7DiwcVr36MN//GSbIHTSxoKKq66e6KEs6M9f1vr7Cyura+UdwsbW3v7O6V9w/ujEo1hZAqrnQrIgY4kxBaZjm0Eg1ERBya0ehq6jcfQBum5K0dJ9AVZCBZzCixTrrviEg9ZTGzEoyZ9MoVv+bPgJdJkJMKytHolb86fUVTAdJSToxpB35iuxnRllEOk1InNZAQOiIDaDsqiQDTzWZXT/CJU/o4VtqVtHim/p7IiDBmLCLXKYgdmkVvKv7ntVMbX3QzJpPUgqTzRXHKsVV4GgHuMw3U8rEjhGrmbsV0SDSh1gVVciEEiy8vk/C0dlkLbs4q9WqeRhEdoWNURQE6R3V0jRooRBRp9Ixe0Zv36L14797HvLXg5TOH6A+8zx+5WJLG</latexit>evaluations<latexit sha1_base64="Bjc+B/L46oI6sWtSSqo80fMdAvo=">AAAB+nicbVDLSsNAFJ34rPUV69LNYBG6KokI6q7gxmUFYwttKJPppB06jzAzKS0hv+LGhYpbv8Sdf+M0zUJbD1w4nHMv994TJYxq43nfzsbm1vbObmWvun9weHTsntSetEwVJgGWTKpuhDRhVJDAUMNIN1EE8YiRTjS5W/idKVGaSvFo5gkJORoJGlOMjJUGbq3PIznLyBSxtJB0PnDrXtMrANeJX5I6KNEeuF/9ocQpJ8JghrTu+V5iwgwpQzEjebWfapIgPEEj0rNUIE50mBW35/DCKkMYS2VLGFiovycyxLWe88h2cmTGetVbiP95vdTEN2FGRZIaIvByUZwyaCRcBAGHVBFs2NwShBW1t0I8RgphY+Oq2hD81ZfXSXDZvG36D1f1VqNMowLOwDloAB9cgxa4B20QAAxm4Bm8gjcnd16cd+dj2brhlDOn4A+czx9rPZTO</latexit><latexit sha1_base64="Bjc+B/L46oI6sWtSSqo80fMdAvo=">AAAB+nicbVDLSsNAFJ34rPUV69LNYBG6KokI6q7gxmUFYwttKJPppB06jzAzKS0hv+LGhYpbv8Sdf+M0zUJbD1w4nHMv994TJYxq43nfzsbm1vbObmWvun9weHTsntSetEwVJgGWTKpuhDRhVJDAUMNIN1EE8YiRTjS5W/idKVGaSvFo5gkJORoJGlOMjJUGbq3PIznLyBSxtJB0PnDrXtMrANeJX5I6KNEeuF/9ocQpJ8JghrTu+V5iwgwpQzEjebWfapIgPEEj0rNUIE50mBW35/DCKkMYS2VLGFiovycyxLWe88h2cmTGetVbiP95vdTEN2FGRZIaIvByUZwyaCRcBAGHVBFs2NwShBW1t0I8RgphY+Oq2hD81ZfXSXDZvG36D1f1VqNMowLOwDloAB9cgxa4B20QAAxm4Bm8gjcnd16cd+dj2brhlDOn4A+czx9rPZTO</latexit><latexit sha1_base64="Bjc+B/L46oI6sWtSSqo80fMdAvo=">AAAB+nicbVDLSsNAFJ34rPUV69LNYBG6KokI6q7gxmUFYwttKJPppB06jzAzKS0hv+LGhYpbv8Sdf+M0zUJbD1w4nHMv994TJYxq43nfzsbm1vbObmWvun9weHTsntSetEwVJgGWTKpuhDRhVJDAUMNIN1EE8YiRTjS5W/idKVGaSvFo5gkJORoJGlOMjJUGbq3PIznLyBSxtJB0PnDrXtMrANeJX5I6KNEeuF/9ocQpJ8JghrTu+V5iwgwpQzEjebWfapIgPEEj0rNUIE50mBW35/DCKkMYS2VLGFiovycyxLWe88h2cmTGetVbiP95vdTEN2FGRZIaIvByUZwyaCRcBAGHVBFs2NwShBW1t0I8RgphY+Oq2hD81ZfXSXDZvG36D1f1VqNMowLOwDloAB9cgxa4B20QAAxm4Bm8gjcnd16cd+dj2brhlDOn4A+czx9rPZTO</latexit><latexit sha1_base64="Bjc+B/L46oI6sWtSSqo80fMdAvo=">AAAB+nicbVDLSsNAFJ34rPUV69LNYBG6KokI6q7gxmUFYwttKJPppB06jzAzKS0hv+LGhYpbv8Sdf+M0zUJbD1w4nHMv994TJYxq43nfzsbm1vbObmWvun9weHTsntSetEwVJgGWTKpuhDRhVJDAUMNIN1EE8YiRTjS5W/idKVGaSvFo5gkJORoJGlOMjJUGbq3PIznLyBSxtJB0PnDrXtMrANeJX5I6KNEeuF/9ocQpJ8JghrTu+V5iwgwpQzEjebWfapIgPEEj0rNUIE50mBW35/DCKkMYS2VLGFiovycyxLWe88h2cmTGetVbiP95vdTEN2FGRZIaIvByUZwyaCRcBAGHVBFs2NwShBW1t0I8RgphY+Oq2hD81ZfXSXDZvG36D1f1VqNMowLOwDloAB9cgxa4B20QAAxm4Bm8gjcnd16cd+dj2brhlDOn4A+czx9rPZTO</latexit>local<latexit sha1_base64="V7lgilbK6sJ92KabLxvEzKrMD8w=">AAAB8nicbVDLSgNBEOyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAdgmzk0kyZB7LzKwYlvyGFw8qXv0ab/6Nk2QPmljQUFR1092VpJwZ6/vfXmltfWNzq7xd2dnd2z+oHh49GJVpQkOiuNKdBBvKmaShZZbTTqopFgmn7WR8M/Pbj1QbpuS9naQ0Fngo2YARbJ0URSJRTzlXBPNpr1rzG/4caJUEBalBgVav+hX1FckElZZwbEw38FMb51hbRjidVqLM0BSTMR7SrqMSC2rifH7zFJ05pY8GSruSFs3V3xM5FsZMROI6BbYjs+zNxP+8bmYHV3HOZJpZKsli0SDjyCo0CwD1mabE8okjmGjmbkVkhDUm1sVUcSEEyy+vkvC8cd0I7i5qzXqRRhlO4BTqEMAlNOEWWhACgRSe4RXevMx78d69j0VryStmjuEPvM8f+ESRwQ==</latexit><latexit sha1_base64="V7lgilbK6sJ92KabLxvEzKrMD8w=">AAAB8nicbVDLSgNBEOyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAdgmzk0kyZB7LzKwYlvyGFw8qXv0ab/6Nk2QPmljQUFR1092VpJwZ6/vfXmltfWNzq7xd2dnd2z+oHh49GJVpQkOiuNKdBBvKmaShZZbTTqopFgmn7WR8M/Pbj1QbpuS9naQ0Fngo2YARbJ0URSJRTzlXBPNpr1rzG/4caJUEBalBgVav+hX1FckElZZwbEw38FMb51hbRjidVqLM0BSTMR7SrqMSC2rifH7zFJ05pY8GSruSFs3V3xM5FsZMROI6BbYjs+zNxP+8bmYHV3HOZJpZKsli0SDjyCo0CwD1mabE8okjmGjmbkVkhDUm1sVUcSEEyy+vkvC8cd0I7i5qzXqRRhlO4BTqEMAlNOEWWhACgRSe4RXevMx78d69j0VryStmjuEPvM8f+ESRwQ==</latexit><latexit sha1_base64="V7lgilbK6sJ92KabLxvEzKrMD8w=">AAAB8nicbVDLSgNBEOyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAdgmzk0kyZB7LzKwYlvyGFw8qXv0ab/6Nk2QPmljQUFR1092VpJwZ6/vfXmltfWNzq7xd2dnd2z+oHh49GJVpQkOiuNKdBBvKmaShZZbTTqopFgmn7WR8M/Pbj1QbpuS9naQ0Fngo2YARbJ0URSJRTzlXBPNpr1rzG/4caJUEBalBgVav+hX1FckElZZwbEw38FMb51hbRjidVqLM0BSTMR7SrqMSC2rifH7zFJ05pY8GSruSFs3V3xM5FsZMROI6BbYjs+zNxP+8bmYHV3HOZJpZKsli0SDjyCo0CwD1mabE8okjmGjmbkVkhDUm1sVUcSEEyy+vkvC8cd0I7i5qzXqRRhlO4BTqEMAlNOEWWhACgRSe4RXevMx78d69j0VryStmjuEPvM8f+ESRwQ==</latexit><latexit sha1_base64="V7lgilbK6sJ92KabLxvEzKrMD8w=">AAAB8nicbVDLSgNBEOyNrxhfUY9eBoOQU9gVQb0FvHiM4JpAdgmzk0kyZB7LzKwYlvyGFw8qXv0ab/6Nk2QPmljQUFR1092VpJwZ6/vfXmltfWNzq7xd2dnd2z+oHh49GJVpQkOiuNKdBBvKmaShZZbTTqopFgmn7WR8M/Pbj1QbpuS9naQ0Fngo2YARbJ0URSJRTzlXBPNpr1rzG/4caJUEBalBgVav+hX1FckElZZwbEw38FMb51hbRjidVqLM0BSTMR7SrqMSC2rifH7zFJ05pY8GSruSFs3V3xM5FsZMROI6BbYjs+zNxP+8bmYHV3HOZJpZKsli0SDjyCo0CwD1mabE8okjmGjmbkVkhDUm1sVUcSEEyy+vkvC8cd0I7i5qzXqRRhlO4BTqEMAlNOEWWhACgRSe4RXevMx78d69j0VryStmjuEPvM8f+ESRwQ==</latexit>operations<latexit sha1_base64="Zf8kcHyJIhqFpNn49JldaPGWgMI=">AAAB+XicbVBNS8NAEJ34WetXqkcvi0XoqSQiqLeCF48VjC20pWy2m3bpbjbsbtQS+1O8eFDx6j/x5r9xm+agrQ8GHu/NMDMvTDjTxvO+nZXVtfWNzdJWeXtnd2/frRzcaZkqQgMiuVTtEGvKWUwDwwyn7URRLEJOW+H4aua37qnSTMa3ZpLQnsDDmEWMYGOlvlvpilA+ZjKhKlf0tO9WvbqXAy0TvyBVKNDsu1/dgSSpoLEhHGvd8b3E9DKsDCOcTsvdVNMEkzEe0o6lMRZU97L89Ck6scoARVLZig3K1d8TGRZaT0RoOwU2I73ozcT/vE5qootexuIkNTQm80VRypGRaJYDGjBFieETSzBRzN6KyAgrTIxNq2xD8BdfXibBaf2y7t+cVRu1Io0SHMEx1MCHc2jANTQhAAIP8Ayv8OY8OS/Ou/Mxb11xiplD+APn8wejZ5Rd</latexit><latexit sha1_base64="Zf8kcHyJIhqFpNn49JldaPGWgMI=">AAAB+XicbVBNS8NAEJ34WetXqkcvi0XoqSQiqLeCF48VjC20pWy2m3bpbjbsbtQS+1O8eFDx6j/x5r9xm+agrQ8GHu/NMDMvTDjTxvO+nZXVtfWNzdJWeXtnd2/frRzcaZkqQgMiuVTtEGvKWUwDwwyn7URRLEJOW+H4aua37qnSTMa3ZpLQnsDDmEWMYGOlvlvpilA+ZjKhKlf0tO9WvbqXAy0TvyBVKNDsu1/dgSSpoLEhHGvd8b3E9DKsDCOcTsvdVNMEkzEe0o6lMRZU97L89Ck6scoARVLZig3K1d8TGRZaT0RoOwU2I73ozcT/vE5qootexuIkNTQm80VRypGRaJYDGjBFieETSzBRzN6KyAgrTIxNq2xD8BdfXibBaf2y7t+cVRu1Io0SHMEx1MCHc2jANTQhAAIP8Ayv8OY8OS/Ou/Mxb11xiplD+APn8wejZ5Rd</latexit><latexit sha1_base64="Zf8kcHyJIhqFpNn49JldaPGWgMI=">AAAB+XicbVBNS8NAEJ34WetXqkcvi0XoqSQiqLeCF48VjC20pWy2m3bpbjbsbtQS+1O8eFDx6j/x5r9xm+agrQ8GHu/NMDMvTDjTxvO+nZXVtfWNzdJWeXtnd2/frRzcaZkqQgMiuVTtEGvKWUwDwwyn7URRLEJOW+H4aua37qnSTMa3ZpLQnsDDmEWMYGOlvlvpilA+ZjKhKlf0tO9WvbqXAy0TvyBVKNDsu1/dgSSpoLEhHGvd8b3E9DKsDCOcTsvdVNMEkzEe0o6lMRZU97L89Ck6scoARVLZig3K1d8TGRZaT0RoOwU2I73ozcT/vE5qootexuIkNTQm80VRypGRaJYDGjBFieETSzBRzN6KyAgrTIxNq2xD8BdfXibBaf2y7t+cVRu1Io0SHMEx1MCHc2jANTQhAAIP8Ayv8OY8OS/Ou/Mxb11xiplD+APn8wejZ5Rd</latexit><latexit sha1_base64="Zf8kcHyJIhqFpNn49JldaPGWgMI=">AAAB+XicbVBNS8NAEJ34WetXqkcvi0XoqSQiqLeCF48VjC20pWy2m3bpbjbsbtQS+1O8eFDx6j/x5r9xm+agrQ8GHu/NMDMvTDjTxvO+nZXVtfWNzdJWeXtnd2/frRzcaZkqQgMiuVTtEGvKWUwDwwyn7URRLEJOW+H4aua37qnSTMa3ZpLQnsDDmEWMYGOlvlvpilA+ZjKhKlf0tO9WvbqXAy0TvyBVKNDsu1/dgSSpoLEhHGvd8b3E9DKsDCOcTsvdVNMEkzEe0o6lMRZU97L89Ck6scoARVLZig3K1d8TGRZaT0RoOwU2I73ozcT/vE5qootexuIkNTQm80VRypGRaJYDGjBFieETSzBRzN6KyAgrTIxNq2xD8BdfXibBaf2y7t+cVRu1Io0SHMEx1MCHc2jANTQhAAIP8Ayv8OY8OS/Ou/Mxb11xiplD+APn8wejZ5Rd</latexit>symmetric,underasinglematroidconstraint<latexit sha1_base64="YGPDKvTdtRtuI95Vg75MkCR/o7M=">AAACLXicbVBNSxxBEO0xfq5fazzm0rgEPMgyI4J6EySQ4wquK+wsS01P7drYH2N3jbgM+4u8+FeSg2AScvVvpPfjkGgKCh6vXlH1XlYo6SmOX6KFD4tLyyura7X1jc2t7frOxytvSyewLayy7joDj0oabJMkhdeFQ9CZwk52ez6Zd+7ReWnNJY0K7GkYGjmQAihQ/fqXVGf2ofIjrZGcFAe8NDk6DtxLM1Q4TtPaTKKBnJU5F9Z4ciANjdO7EnKe8rRfb8TNeFr8PUjmoMHm1erXv6e5FaVGQ0KB990kLqhXgSMpwtFaWnosQNzCELsBGtDoe9XU7ph/DkzOB9aFNsSn7N8bFWgfDGVBGZ6+8W9nE/J/s25Jg5NeJU1REhoxOzQoFSfLJ9nxXDoUpEYBgHAy/MrFDTgQFBKuhRCSt5bfg/Zh87SZXBw1zvbnaayyT2yP7bOEHbMz9pW1WJsJ9si+sR/sZ/QUPUe/ot8z6UI039ll/1T0+ge37amr</latexit><latexit sha1_base64="YGPDKvTdtRtuI95Vg75MkCR/o7M=">AAACLXicbVBNSxxBEO0xfq5fazzm0rgEPMgyI4J6EySQ4wquK+wsS01P7drYH2N3jbgM+4u8+FeSg2AScvVvpPfjkGgKCh6vXlH1XlYo6SmOX6KFD4tLyyura7X1jc2t7frOxytvSyewLayy7joDj0oabJMkhdeFQ9CZwk52ez6Zd+7ReWnNJY0K7GkYGjmQAihQ/fqXVGf2ofIjrZGcFAe8NDk6DtxLM1Q4TtPaTKKBnJU5F9Z4ciANjdO7EnKe8rRfb8TNeFr8PUjmoMHm1erXv6e5FaVGQ0KB990kLqhXgSMpwtFaWnosQNzCELsBGtDoe9XU7ph/DkzOB9aFNsSn7N8bFWgfDGVBGZ6+8W9nE/J/s25Jg5NeJU1REhoxOzQoFSfLJ9nxXDoUpEYBgHAy/MrFDTgQFBKuhRCSt5bfg/Zh87SZXBw1zvbnaayyT2yP7bOEHbMz9pW1WJsJ9si+sR/sZ/QUPUe/ot8z6UI039ll/1T0+ge37amr</latexit><latexit sha1_base64="YGPDKvTdtRtuI95Vg75MkCR/o7M=">AAACLXicbVBNSxxBEO0xfq5fazzm0rgEPMgyI4J6EySQ4wquK+wsS01P7drYH2N3jbgM+4u8+FeSg2AScvVvpPfjkGgKCh6vXlH1XlYo6SmOX6KFD4tLyyura7X1jc2t7frOxytvSyewLayy7joDj0oabJMkhdeFQ9CZwk52ez6Zd+7ReWnNJY0K7GkYGjmQAihQ/fqXVGf2ofIjrZGcFAe8NDk6DtxLM1Q4TtPaTKKBnJU5F9Z4ciANjdO7EnKe8rRfb8TNeFr8PUjmoMHm1erXv6e5FaVGQ0KB990kLqhXgSMpwtFaWnosQNzCELsBGtDoe9XU7ph/DkzOB9aFNsSn7N8bFWgfDGVBGZ6+8W9nE/J/s25Jg5NeJU1REhoxOzQoFSfLJ9nxXDoUpEYBgHAy/MrFDTgQFBKuhRCSt5bfg/Zh87SZXBw1zvbnaayyT2yP7bOEHbMz9pW1WJsJ9si+sR/sZ/QUPUe/ot8z6UI039ll/1T0+ge37amr</latexit><latexit sha1_base64="YGPDKvTdtRtuI95Vg75MkCR/o7M=">AAACLXicbVBNSxxBEO0xfq5fazzm0rgEPMgyI4J6EySQ4wquK+wsS01P7drYH2N3jbgM+4u8+FeSg2AScvVvpPfjkGgKCh6vXlH1XlYo6SmOX6KFD4tLyyura7X1jc2t7frOxytvSyewLayy7joDj0oabJMkhdeFQ9CZwk52ez6Zd+7ReWnNJY0K7GkYGjmQAihQ/fqXVGf2ofIjrZGcFAe8NDk6DtxLM1Q4TtPaTKKBnJU5F9Z4ciANjdO7EnKe8rRfb8TNeFr8PUjmoMHm1erXv6e5FaVGQ0KB990kLqhXgSMpwtFaWnosQNzCELsBGtDoe9XU7ph/DkzOB9aFNsSn7N8bFWgfDGVBGZ6+8W9nE/J/s25Jg5NeJU1REhoxOzQoFSfLJ9nxXDoUpEYBgHAy/MrFDTgQFBKuhRCSt5bfg/Zh87SZXBw1zvbnaayyT2yP7bOEHbMz9pW1WJsJ9si+sR/sZ/QUPUe/ot8z6UI039ll/1T0+ge37amr</latexit>8>>>>>><>>>>>>:<latexit sha1_base64="hOIS0FtrQQ6BEW9JrVOqiqHjoB4=">AAACKHicbVBNSwMxEM36WdevqkcvwSL0VHZFUG8FLx4rWFvolpJNZ9vQbHZJZoWy9O948a94UVDp1V9i2u5BWx8JPN6bmWRemEph0POmztr6xubWdmnH3d3bPzgsHx0/miTTHJo8kYluh8yAFAqaKFBCO9XA4lBCKxzdzvzWE2gjEvWA4xS6MRsoEQnO0Eq9cj2QECENcjcIYSBUzrRm40kuJ24QrBxQ/aLADbQYDJHWeuWKV/PmoKvEL0iFFGj0yu9BP+FZDAq5ZMZ0fC/Frh2LgkuwgzMDKeMjNoCOpYrFYLr5fNMJPbdKn0aJtlchnau/O3IWGzOOQ1sZMxyaZW8m/ud1Moyuu7lQaYag+OKhKJMUEzqLjfaFBo5ybAnjWti/Uj5kmnG04bo2BH955VXSvKjd1Pz7y0q9WqRRIqfkjFSJT65IndyRBmkSTp7JK/kgn86L8+Z8OdNF6ZpT9JyQP3C+fwAveqTb</latexit><latexit sha1_base64="hOIS0FtrQQ6BEW9JrVOqiqHjoB4=">AAACKHicbVBNSwMxEM36WdevqkcvwSL0VHZFUG8FLx4rWFvolpJNZ9vQbHZJZoWy9O948a94UVDp1V9i2u5BWx8JPN6bmWRemEph0POmztr6xubWdmnH3d3bPzgsHx0/miTTHJo8kYluh8yAFAqaKFBCO9XA4lBCKxzdzvzWE2gjEvWA4xS6MRsoEQnO0Eq9cj2QECENcjcIYSBUzrRm40kuJ24QrBxQ/aLADbQYDJHWeuWKV/PmoKvEL0iFFGj0yu9BP+FZDAq5ZMZ0fC/Frh2LgkuwgzMDKeMjNoCOpYrFYLr5fNMJPbdKn0aJtlchnau/O3IWGzOOQ1sZMxyaZW8m/ud1Moyuu7lQaYag+OKhKJMUEzqLjfaFBo5ybAnjWti/Uj5kmnG04bo2BH955VXSvKjd1Pz7y0q9WqRRIqfkjFSJT65IndyRBmkSTp7JK/kgn86L8+Z8OdNF6ZpT9JyQP3C+fwAveqTb</latexit><latexit sha1_base64="hOIS0FtrQQ6BEW9JrVOqiqHjoB4=">AAACKHicbVBNSwMxEM36WdevqkcvwSL0VHZFUG8FLx4rWFvolpJNZ9vQbHZJZoWy9O948a94UVDp1V9i2u5BWx8JPN6bmWRemEph0POmztr6xubWdmnH3d3bPzgsHx0/miTTHJo8kYluh8yAFAqaKFBCO9XA4lBCKxzdzvzWE2gjEvWA4xS6MRsoEQnO0Eq9cj2QECENcjcIYSBUzrRm40kuJ24QrBxQ/aLADbQYDJHWeuWKV/PmoKvEL0iFFGj0yu9BP+FZDAq5ZMZ0fC/Frh2LgkuwgzMDKeMjNoCOpYrFYLr5fNMJPbdKn0aJtlchnau/O3IWGzOOQ1sZMxyaZW8m/ud1Moyuu7lQaYag+OKhKJMUEzqLjfaFBo5ybAnjWti/Uj5kmnG04bo2BH955VXSvKjd1Pz7y0q9WqRRIqfkjFSJT65IndyRBmkSTp7JK/kgn86L8+Z8OdNF6ZpT9JyQP3C+fwAveqTb</latexit><latexit sha1_base64="hOIS0FtrQQ6BEW9JrVOqiqHjoB4=">AAACKHicbVBNSwMxEM36WdevqkcvwSL0VHZFUG8FLx4rWFvolpJNZ9vQbHZJZoWy9O948a94UVDp1V9i2u5BWx8JPN6bmWRemEph0POmztr6xubWdmnH3d3bPzgsHx0/miTTHJo8kYluh8yAFAqaKFBCO9XA4lBCKxzdzvzWE2gjEvWA4xS6MRsoEQnO0Eq9cj2QECENcjcIYSBUzrRm40kuJ24QrBxQ/aLADbQYDJHWeuWKV/PmoKvEL0iFFGj0yu9BP+FZDAq5ZMZ0fC/Frh2LgkuwgzMDKeMjNoCOpYrFYLr5fNMJPbdKn0aJtlchnau/O3IWGzOOQ1sZMxyaZW8m/ud1Moyuu7lQaYag+OKhKJMUEzqLjfaFBo5ybAnjWti/Uj5kmnG04bo2BH955VXSvKjd1Pz7y0q9WqRRIqfkjFSJT65IndyRBmkSTp7JK/kgn86L8+Z8OdNF6ZpT9JyQP3C+fwAveqTb</latexit>atleastw.c.p.<latexit sha1_base64="XoFQSS4DmXcbFod/xoE6ummhJa8=">AAAB/nicbVBNS8NAEN3Ur1q/ooIXL4tF6CkkIqi3ghePFYwttKFstpt26W4SdidqiT34V7x4UPHq7/Dmv3Hb5qCtDwYe780wMy9MBdfgut9WaWl5ZXWtvF7Z2Nza3rF39251kinKfJqIRLVCopngMfOBg2CtVDEiQ8Ga4fBy4jfvmNI8iW9glLJAkn7MI04JGKlrH3RkmDzkBLBgRAO+d6iTOuOuXXUddwq8SLyCVFGBRtf+6vQSmkkWAxVE67bnphDkRAGngo0rnUyzlNAh6bO2oTGRTAf59P4xPjZKD0eJMhUDnqq/J3IitR7J0HRKAgM9703E/7x2BtF5kPM4zYDFdLYoygSGBE/CwD2uGAUxMoRQxc2tmA6IIhRMZBUTgjf/8iLxT5wLx7s+rdZrRRpldIiOUA156AzV0RVqIB9R9Iie0St6s56sF+vd+pi1lqxiZh/9gfX5A5wflU0=</latexit><latexit sha1_base64="XoFQSS4DmXcbFod/xoE6ummhJa8=">AAAB/nicbVBNS8NAEN3Ur1q/ooIXL4tF6CkkIqi3ghePFYwttKFstpt26W4SdidqiT34V7x4UPHq7/Dmv3Hb5qCtDwYe780wMy9MBdfgut9WaWl5ZXWtvF7Z2Nza3rF39251kinKfJqIRLVCopngMfOBg2CtVDEiQ8Ga4fBy4jfvmNI8iW9glLJAkn7MI04JGKlrH3RkmDzkBLBgRAO+d6iTOuOuXXUddwq8SLyCVFGBRtf+6vQSmkkWAxVE67bnphDkRAGngo0rnUyzlNAh6bO2oTGRTAf59P4xPjZKD0eJMhUDnqq/J3IitR7J0HRKAgM9703E/7x2BtF5kPM4zYDFdLYoygSGBE/CwD2uGAUxMoRQxc2tmA6IIhRMZBUTgjf/8iLxT5wLx7s+rdZrRRpldIiOUA156AzV0RVqIB9R9Iie0St6s56sF+vd+pi1lqxiZh/9gfX5A5wflU0=</latexit><latexit sha1_base64="XoFQSS4DmXcbFod/xoE6ummhJa8=">AAAB/nicbVBNS8NAEN3Ur1q/ooIXL4tF6CkkIqi3ghePFYwttKFstpt26W4SdidqiT34V7x4UPHq7/Dmv3Hb5qCtDwYe780wMy9MBdfgut9WaWl5ZXWtvF7Z2Nza3rF39251kinKfJqIRLVCopngMfOBg2CtVDEiQ8Ga4fBy4jfvmNI8iW9glLJAkn7MI04JGKlrH3RkmDzkBLBgRAO+d6iTOuOuXXUddwq8SLyCVFGBRtf+6vQSmkkWAxVE67bnphDkRAGngo0rnUyzlNAh6bO2oTGRTAf59P4xPjZKD0eJMhUDnqq/J3IitR7J0HRKAgM9703E/7x2BtF5kPM4zYDFdLYoygSGBE/CwD2uGAUxMoRQxc2tmA6IIhRMZBUTgjf/8iLxT5wLx7s+rdZrRRpldIiOUA156AzV0RVqIB9R9Iie0St6s56sF+vd+pi1lqxiZh/9gfX5A5wflU0=</latexit><latexit sha1_base64="XoFQSS4DmXcbFod/xoE6ummhJa8=">AAAB/nicbVBNS8NAEN3Ur1q/ooIXL4tF6CkkIqi3ghePFYwttKFstpt26W4SdidqiT34V7x4UPHq7/Dmv3Hb5qCtDwYe780wMy9MBdfgut9WaWl5ZXWtvF7Z2Nza3rF39251kinKfJqIRLVCopngMfOBg2CtVDEiQ8Ga4fBy4jfvmNI8iW9glLJAkn7MI04JGKlrH3RkmDzkBLBgRAO+d6iTOuOuXXUddwq8SLyCVFGBRtf+6vQSmkkWAxVE67bnphDkRAGngo0rnUyzlNAh6bO2oTGRTAf59P4xPjZKD0eJMhUDnqq/J3IitR7J0HRKAgM9703E/7x2BtF5kPM4zYDFdLYoygSGBE/CwD2uGAUxMoRQxc2tmA6IIhRMZBUTgjf/8iLxT5wLx7s+rdZrRRpldIiOUA156AzV0RVqIB9R9Iie0St6s56sF+vd+pi1lqxiZh/9gfX5A5wflU0=</latexit> 4 Algorithm 1: The (1+1) EA input: a fitness function f : 2V → R≥0; output: an (approximate) global maximum of the function f ; // sample initial solution choose x ∈ {0, 1}n uniformly at random; while convergence criterion not met do // apply mutation operator y ← Mutation(x); // perform selection if f (y) ≥ f (x) then x ← y; return x; independently with probability 1/n. In a slightly more general setting, the mutation operator unifp(·) flips each bit of x independently with probability p/n, where p ∈ [0, n/2]. We refer to the parameter p as mutation rate. Uniform mutations can be further generalized, by sampling the mutation rate p ∈ [0, n/2] at each step according to a given probability distribution. We assume this distribution to be fixed throughout the optimization process. Among this class of mutation rates, is the power-law mutation fmutβ of Doerr et al. [6]. fmutβ chooses the mutation rate according to a power-law distribution on [0, 1/2] with exponent β. More formally, denote with X the r.v. (random variable) that returns the mutation rate at a given step. The power-law operator fmutβ uses a probability distribution Dβ (cid:96) s are known in the literature as generalized harmonic numbers. Interestingly, generalized harmonic numbers can be approximated with the Riemann Zeta function as ζ(β) = lim(cid:96)→+∞ H β (cid:96) . In particular, harmonic numbers H β n/2 are always upper-bounded by a constant, for increasing problem size and for a fixed β > 1. n/2 s.t. Pr (X = k) = H β n/2k−β, where H β (cid:96) =(cid:80)(cid:96) jβ . The H β j=1 1 2.2 Non-uniform Mutation Rates. In this paper we consider an alternative approach to the non-uniform mutation operators described above. For a given probability distribution P = [1, . . . , n] → R the proposed mutation operator samples an element k ∈ [1, . . . , n] according to the distribution P , and flips exactly k-many bits in an input string x = (x1, . . . xn), chosen uniformly at random among all possibilities. This frame- work depends on the distribution P , which we always assume fixed throughout the optimization process. Based on the results of Doerr et al. [6], we study a specialization of our non-uniform framework that uses a distribution of the form P = Dβ n. We refer to this operator as pmutβ, and pseudocode is given in Algorithm 2. This operator uses a power-law distribution on the probability of performing exactly k-bit flips in one iteration. That is, for x ∈ {0, 1}n and all k ∈ {1, . . . , n}, Pr(cid:0)H(cid:0)x, pmutβ(x)(cid:1) = k(cid:1) = (H β We remark that with this operator, (1) for any two points x, y ∈ {0, 1}n, the probability Although both operators, fmutβ and pmutβ, are defined in terms of a power-law distribution their behavior differs. We note that, for any choice of the constant β > 1 and all x ∈ {0, 1}n, disadvantages of these two operators in Sections 3. Pr(cid:0)y = pmutβ(x)(cid:1) only depends on their Hamming distance H (x, y). Pr (H (x, fmutβ(x)) = 0) > 0, while Pr(cid:0)H(cid:0)x, pmutβ(x)(cid:1) = 0(cid:1) = 0. We discuss the advantages and −1k −β n ) 5 Algorithm 2: The mutation operator pmutβ(x) input: a pseudo-Boolean array x; output: a mutated pseudo-Boolean array y; y ← x; choose k ∈ [1, . . . , n] with distribution Dβ n; flip k-bits of y chosen uniformly at random; return y; 2.3 Submodular functions and matroids. Submodular set function functions intuitively capture the notion of diminishing returns -- i.e. the more you acquire the less your marginal gain. More formally, the following definition holds. Definition 1. A set function f : 2V → R≥0 is submodular if it holds f (S) + f (T ) ≥ f (S ∪ T ) + f (S ∩ T ) for all S, T ⊆ V . We remark that in this context V is always a finite set. It is well-known that the defining axiom in Definition 1 is equivalent to the requirement f (S ∪ {x}) − f (S) ≥ f (T ∪ {x}) − f (T ), for all S, T ⊆ V such that S ⊆ T and x ∈ T \ S (see eg. Welsh [19]). S ⊆ V . base set V , as in the following definition. We say that a set function f : 2V → R≥0 is symmetric if it holds f (S) = f (V \ S) for all In some cases, feasible solutions are characterized as the independent sets of a matroid with (2) Definition 2. Given a set V , a matroid M = (V,I) with base set V consists of a collection of subsets I of V with the following properties: • ∅ ∈ I; • if T ∈ I, then S ∈ I for all subsets S ⊆ T ; • if S, T ∈ I and S ≤ T, then there exists a point x ∈ T \ S s.t. S ∪ {x} ∈ I; From the axioms in Definition 2, it follows that two maximal independent sets always have the same number of elements. This number is called the rank of a matroid. It is possible to generalize this notion, as in the following definition. Definition 3. Consider a matroid M = (V,I). For any subset S ⊆ V , the rank function r(C) returns the size of the largest independent set in S - i.e. r(S) = arg maxT⊆S{T : T ∈ I}. 2.4 Markov's Inequality. We introduce a basic probabilistic inequality that is useful in the run time analysis in Section 4.2. This simple tool is commonly referred to as Markov's Inequality. We use the following variation of it. Lemma 4 (Markov). Let X be a random variable, where X ∈ [0, 1]. Then it holds for all 0 ≤ c ≤ E [X]. Pr (X ≤ c) ≤ 1 − E [X] 1 − c , For a discussion of Lemma 4, see eg. Mitzenmacher and Upfal [20, Theorem 3.1]. 6 2.5 The Multiplicative Drift Theorem. The Multiplicative Drift theorem is a powerful tool to analyze the expected run time of randomized algorithms such as the (1+1) EA. Intuitively, for a fitness function f : 2V → R≥0 we view the run time of the (1+1) EA as a Markov chain {Xt}t≥0, where Xt depends on the f -value reached at time-step t. The Multiplicative Drift theorem gives an upper-bound on the expected value of the first hitting time T = inf{t : Xt = 0}, provided that the change of the average value of the process {Xt}t≥0 is within a multiplicative factor of the previous solution. The following theorem holds. Theorem 5 (Theorem 3 in Doerr et al. [21]). Let {Xt}t≥0 be a random variable describing a Markov process over a finite state space S ⊆ R. Let T be the random variable that denotes the earliest point in time t ∈ N0 such that Xt = 0. Suppose that there exist δ > 0, cmin > 0, and • E[Xt − Xt+1 Xt] ≥ δXt; • Xt ∈ [cmin, cmax] ∪ {0}; for all t < T . Then it holds E[T ] ≤ 2 cmax > 0 such that δ ln(cid:16)1 + cmax cmin(cid:17). 3 Artificial Landscapes 3.1 General upper bounds for the (1+1) EA. In this section we bound from above the run time of the (1+1) EA using the mutation operator pmutβ on any fitness function f : {0, 1}n → R. It is well-known that the (1+1) EA using uniform mutation on any such fitness function has expected run time at most nn. This upper-bound is tight, in the sense that there exists a function f s.t. the expected run time of the (1+1) EA using uniform mutation to find the global optimum of f is Ω(nn). For a discussion on these bounds see Droste et al. [10]. Doerr et al. [6] prove that on any fitness function f : {0, 1}n → R the (1+1) EA using the mutation operator fmutβ has run time at most O(cid:16)H β n/22nnβ(cid:17). Similarly, we derive a general upper bound on the run time of the (1+1) EA using mutation pmutβ. Lemma 6. On any fitness function f : {0, 1}n → R the (1+1) EA with mutation pmutβ finds the n en/enβ(cid:1) fitness evaluations, with the constant implicit in optimum solution after expected O(cid:0)H β the asymptotic notation independent of β. Proof Without loss of generality we assume n to be even. We proceed by identifying a general lower bound on the probability of reaching any point from any other point. To this end, let x, y ∈ {0, 1}n be any two points and let k = H (x, y) be their Hamming distance. Then the probability of reaching the point y in one iteration from x is k(cid:19)−1 Pr(cid:0)y = pmutβ(x)(cid:1) =(cid:18)n Pr(cid:0)H(cid:0)x, pmutβ(x)(cid:1) = k(cid:1) . n )−1k−β ≥ (H β n )−1n−β for all choices of x ∈ {0, 1}n and k = 1, . . . , n. Using a known lower bound of the binomial coefficient we have that From (1) we have that it holds Pr(cid:0)H(cid:0)x, pmutβ(x)(cid:1) = k(cid:1) = (H β −n/2 ≥ e n )−1e−n/en−β, for any choice of x and y. We can roughly estimate run time as a geometric distribution with probability of success (cid:3) from which it follows that Pr(cid:0)y = pmutβ(x)(cid:1) ≥ (H β Pr(cid:0)y = pmutβ(x)(cid:1). Hence, we conclude by taking the inverse of the estimate above, which yields an upper-bound on the probability of convergence on any fitness function. n/2(cid:19)−1 ≥(cid:18) n k(cid:19)−1 (cid:18)n ≥ (2e) −n/e, 7 We consider the OneMax function, defined as OneMax(x1, . . . , xn) = x1 = (cid:80)n j=1 xj. This simple linear function of unitation returns the number of ones in a pseudo-Boolean input string. The (1+1) EA with mutation operators unifp and fmutβ finds the global optimum after O (n log n) fitness evaluations (see [22,10,6]). It can be easily shown that the (1+1) EA with mutation operator pmutβ achieves similar performance on this instance. Lemma 7. The (1+1) EA with mutation pmutβ finds the global optimum of the OneMax after n n log n(cid:1) fitness evaluations, for all β > 1 and with the constant implicit in the expected O(cid:0)H β asymptotic notation independent of β. Proof We use the fitness level method outlined in Wegener [23]. Define the levels Ai = {x ∈ n )−1, for all i = 1, . . . , n. Then {0, 1}n : f (x) = i}, and consider the quantities si = (n − i)(nH β each si is a lower-bound on the probability of reaching a higher fitness in one iteration. Denote with Tpmutβ (f ) the run time of the (1+1) EA with mutation pmutβ on the function f =OneMax. By the fitness level theorem, we obtain an upper-bound on the run time as Tpmutβ (f ) ≤ n−1(cid:88)i=0 and the claim follows. 1 si ≤ H β n n(cid:90) n−1 0 dx n − x ≤ H β n n log n (cid:3) 3.2 A comparison with static uniform mutations. Droste et al. [10] defined the following jump function. Jumpm,n(x) = m + x1 if x1 ≤ n − m; m + x1 if x1 = n; n − x1 otherwise. For 1 < m < n this function exhibits a single local maximum and a single global maximum. The first parameter of Jumpm,n determines the Hamming distance between the local and the global optimum, while the second parameter denotes the size of the input. We present a general upper-bound on the run time of the (1+1) EA on Jumpm,n with mutation operator pmutβ. Then, following the footsteps of Doerr et al. [6], we compare the performance of pmutβ with static mutation operators on jump functions for all m ≤ n/2. Lemma 8. Consider a jump function f = Jumpm,n and denote with Tpmutβ (f ) the expected run time of the (1+1) EA using the mutation pmutβ on the function f . Tpmutβ (f ) = H β were the constant implicit in the asymptotic notation is independent of m and β. n(cid:0) n m(cid:1)O(cid:0)mβ(cid:1), Proof We use the fitness level method. Define the levels Ai = {x ∈ {0, 1}n : f (x) = i} for all i = 1, . . . , n, and consider the quantities (n − i)(nH β (H β i(nH β n )−1, 0 ≤ i ≤ n − m − 1; m(cid:1)−1 (cid:0) n n )−1m−β, i = n − m; n )−1, n − m + 1 ≤ i ≤ n − 1; Then each si is a lower bound for the probability of reaching a higher fitness in one iteration from the level Ai. By the fitness level theorem we obtain an upper bound on the run time as si = m(cid:19)H β Tpmutβ (f ) ≤(cid:18) n ≤(cid:18) n m(cid:19)H β n mβ + n mβ + 2nH β n−m−1(cid:88)i=0 n(cid:90) n nH β n n − i dx x m + n−1(cid:88)i=n−m+1 =(cid:18) n m(cid:19)H β nH β n i n mβ + 2nH β n ln n m , for any choice of β > 1. Since we have that 1 < m < n and m ≥ 2, then it follows that 8 2nH β n ln and the lemma follows. n m ≤ 2nH β n(cid:18) n m(cid:19), n ln n ≤ 2H β (cid:3) Note that the upper-bound on the run time given in Lemma 8 yields polynomial run time on all functions Jumpm,n with m constant for increasing problem size and also with n − m constant for increasing problem size. Following the analysis of Doerr et al. [6], we can compare the run time of the (1+1) EA with mutation pmutβ with the (1+1) EA with uniform mutations, on the jump function Jumpm,n for m ≤ n/2. Corollary 9. Consider a jump function f = Jumpm,n with m ≤ n/2 and denote with Tpmutβ (f ) the run time of the (1+1) EA using the mutation pmutβ on the function f . Similarly, denote with Topt(f ) the run time of the (1+1) EA using the best possible static uniform mutation on the function f . Then it holds Tpmutβ (f ) ≤ cmβ−0.5 H β n Topt(f ), for a constant c independent of m and β. The result above holds because Doerr et al. [6] prove that the best possible optimization time for a static mutation rate a function f = Jumpm,n with m ≤ n/2 is lower-bounded as 1/2 nm/mm (n/(n − m))n−m ≤ Topt(f ). 4 The Unconstrained Submodular Maximization Problem We study the problem of maximizing a non-negative submodular function f : 2V → R≥0 with no side constraints. More formally, we study the problem argmaxC⊆V f (C). (3) This problem is APX-complete. That is, this problem is NP-hard and does not admit a poly- nomial time approximation scheme (PTAS), unless P = NP (see Nemhauser and Wolsey [24]). We denote with opt any solution of Problem (3), and we denote with n the size of V . 4.1 Heavy-tailed mutations are useful. We prove that the (1+1) EA with mutation pmutβ is a (1/3 − ε/n)-approximation algorithm for Problem 3. In our analysis we assume neither monotonicity nor symmetry. We approach this problem by searching for (1 + α)-local optima, which we define below. Definition 10. Let f : 2V → R≥0 be any submodular function. A set S ⊆ V is a (1 + α)-local optimum if it holds (1 + α)f (S) ≥ f (S \ {u}) for all u ∈ S, and (1 + α)f (S) ≥ f (S ∪ {v}) for all v ∈ V \ S, for a constant α > 0. This definition is useful in the analysis because it can be proved that either (1+α)-local optima or their complement always yield a good approximation of the global maximum, as in the following theorem. Theorem 11 (Theorem 3.4 in Feige et al. [17]). Consider a non-negative submodular function f : 2V → R≥0 and let S be a (1 + ε/n2)-local optimum as in Definition 10. Then either S or V \ S is a (1/3 − ε/n)-approximation of the global maximum of f . gf,ε(U ) ≥ δ(cid:16)opt + ε It follows that opt n (cid:17) ⇒ f (U ) ≥ δ(cid:16)opt + ε opt n ≥ δopt − ε opt n , opt n (cid:17) − ε opt . n f (U ) ≥ δopt − (1 − δ)ε 9 It is possible to construct examples of submodular functions that exhibit (1 + ε/n2)-local optima with arbitrarily bad approximation ratios. Thus, (1 + ε/n2)-local optima alone do not yield any approximation guarantee for Problem (3), unless the fitness function is symmetric. We can use Theorem 11 to estimate the run time of the (1+1) EA using mutation pmutβ to maximize a given submodular function. Intuitively, it is always possible to find a (1 + ε/n2)-local optimum in polynomial time using single bit-flips. It is then possible to compare the approximate local solution S with its complement V \ S by flipping all bits in one iteration. We do not perform the analysis on a given submodular function f directly, but we consider a corresponding potential function gf,ε instead. We define potential functions as in the following lemma. Lemma 12. Consider a non-negative submodular function f : 2V → R≥0. Consider the function gf,ε(U ) = f (U ) + ε opt n , for all U ⊆ V . The following conditions hold (1) gf,ε(U ) is submodular. (2) gf,ε(U ) ≥ ε opt/n, for all subsets U ⊆ V . (3) Suppose that a solution U ⊆ V is a δ-approximation for gf,ε, for a constant 0 < δ < 1. Then U is a (δ − ε/n)-approximation for f . Proof (1) The submodularity of gf,ε(U ) follows immediately from the fact that f (U ) is submodular, together with the fact that the term εopt/n is constant. (2) The property follows directly from the definition of gf,ε(U ), together with the assumption that f is non-negative. (3) Fix a subset U ⊆ V that is an δ-approximation for gf,ε. Then we have that where the last inequality follows from the assumption that 0 < δ < 1. The lemma follows. (cid:3) ε n3 log n Using potential functions and their properties, we can prove the following result. Theorem 13. The (1+1) EA with mutation pmutβ is a (1/3− ε/n)-approximation algorithm for Problem (3). Its expected run time is O(cid:0) 1 ε + nβ(cid:1). approximation of gf,ε (as in Lemma 12) within expected O(cid:0) 1 approximation of f within O(cid:0)nβ + 1 Proof We prove that for all ε > 0, the (1+1) EA with mutation pmutβ finds a (1/3 − ε/n)- then use this knowledge to conclude that the (1+1) EA with mutation pmutβ finds a (1/3− 2ε/n)- We divide the run time in two phases. During (Phase 1), the (1+1) EA finds a (1 + ε/n2)-local optimum of gf,ε. During (Phase 2) the algorithm finds a (1/3 − ε/n)-approximation of the global optimum of gf using the heavy-tailed mutation. (Phase 1) We use the multiplicative increase method. Denote with xt the solution found by the (1+1) EA at time step t, for all t ≥ 0. Then for any solution xt it is always possible to make an improvement of (1 + ε/n2)gf,ε(xt) on the fitness in the next iteration, by adding or removing a single vertex, unless xt is already a (1 + ε/n2)-local optimum. We refer to any single bit-flip that yields such an improvement of a fitness as favorable bit-flip. We give an upper-bound on the number of favorable bit-flips k to reach a (1 + ε/n2)-local optimum, by solving the following equation ε(cid:1) fitness evaluations and the theorem follows. ε + nβ(cid:1) fitness evaluations. We ε n3 log n ε n3 log n opt (cid:16)1 + n2(cid:17)k opt n ≤ opt + ε n ⇔(cid:16)1 + where we have used that that for the initial solution x0, gf,ε(x0) ≥ εopt/n (see Lemma 12(2)). From solving this inequality it follows that the (1+1) EA with mutation pmutβ reaches a (1 + ε(cid:1) favorable bit-flips. Since the probability of ε/n2)-local maximum after at most k = O(cid:0) 1 n2(cid:17)k ε n2 log n + 1, ε n ε ≤ ε ε 10 ε(cid:1). ε n3 log n initial phase as O(cid:0) 1 n )−1n−1 = Ω(1/n), then the expected waiting performing a single chosen bit-flip is at least (H β time for a favorable bit-flip to occur is O (n), we can upper-bound the expected run time in this (Phase 2) Assume that a (1 + ε/n2)-local optimum has been found. Then from Theorem 11 follows that either this local optimum or its complement is a (1/3 − ε/n)-approximation of the global maximum. Thus, if the solution found in Phase 1 does not yield the desired approximation ratio, a n-bit flip is sufficient to find a (1/3 − ε/n)-approximation of the global optimum of gf . n )−1n−β = Ω(n−β) by (1). After an additional The probability of this event to occur is at least (H β (cid:3) phase of expected O(cid:0)nβ(cid:1) fitness evaluations the (1+1) EA with mutation pmutβ reaches the desired approximation of the global maximum. 4.2 An improved upper-bound on the run time. We prove that the (1+1) EA with mutation pmutβ yields an improved upper-bound on the run time over that of Theorem 13, at least with constant probability. This upper-bound yields an improvement over the run time analysis of a standard deterministic Local Search (LS) algorithm (see Theorem 3.4 Feige et al. [17]), at least with constant probability. Theorem 14 (Theorem 2.1 in Feige et al. [17]). Let f : 2V → R≥0 be a submodular function, and denote with R ⊆ V a set chosen uniformly at random. Then E [f (R)] ≥ opt/4. We exploit this result to obtain an improved upper-bound on the run time. Intuitively, the initial solution sampled by the (1+1) EA yields a constant-factor approximation guarantee at least with constant probability. We can use this result to prove the following theorem. Theorem 15. The (1+1) EA with mutation pmutβ is a (1/3− ε/n)-approximation algorithm for Problem (3) after O(cid:0) 1 ε n3 + nβ(cid:1) fitness evaluations, at least w.c.p. Proof This proof is similar to that of Theorem 13. We denote with xt a solution reached by the (1+1) EA at time step t. We first prove that the definition of submodularity implies that, with high probability the initial solution x0 yields a constant-factor approximation guarantee. We then perform a run time analysis as in Theorem 13, by counting the expected time until the fittest individual is chosen for selection, and a local improvement of at least (1 + /n2) is made, assuming that the initial solution yields a constant-factor approximation guarantee. Denote with R ⊆ V a set chosen uniformly at random and fix a constant δ > 1. We combine Theorem 14 with Lemma 4, by choosing X = f (R)/opt and obtain, Pr(cid:18)f (R) ≤ opt(cid:19) = Pr(cid:18)X ≤ f (R)/opt, to obtain that E [X] ≥ 1/4. We have, 1 4δ 1 4δ(cid:19) ≤ 1 − 1/4 1 − 1/4δ = 3δ 4δ − 1 , where the last inequality by applying Theorem 14 and linearity of expectation to the r.v. X = 1 4δ 1 4δ Pr(cid:18)x0 > opt(cid:19) ≥ 1 − Pr(cid:18)f (R) ≤ opt(cid:19) ≥ 1 − In the following, for a fixed constant δ > 1, we perform the run time analysis as in Theorem 13 conditional on the event A = {x0 > opt/4δ}, which occurs at least w.c.p. Again, we divide the run time in two phases. During Phase 1, the (1+1) EA finds a (1 + ε/n2)- local optimum of f . During Phase 2 the algorithm finds a (1/3− ε/n)-approximation of the global optimum of f using the heavy-tailed mutation. (Phase 1) For any solution xt it is always possible to make an improvement of (1 + ε/n2)f (xt) on the fitness in the next iteration, by adding or removing a single vertex -- the favorable bit-flip, 3δ 4δ − 1 . unless xt is already a (1 + ε/n2)-local optimum. Again, we give an upper-bound on the number of favorable bit-flips k to reach a (1 + ε/n2)-local optimum, by solving the following equation 11 ε ε n2(cid:17)k ≤ 4δ, bit-flip is at least (H β n2(cid:17)k opt 4δ ≤ opt ⇐⇒(cid:16)1 + (cid:16)1 + ε n2(cid:1) favorable moves. Since the probability of performing a single chosen from which it follows that the (1+1) EA with mutation pmutβ reaches a (1+ ε/n2)-local maximum n )−1n−1 = Ω(1/n), then the expected waiting time for a favorable bit-flip to after at most k = O(cid:0) 1 occur is O (n), we can upper-bound the expected run time in this initial phase as O(cid:0) 1 (Phase 2) We conclude applying the heavy-tailed mutation step: If the solution found in Phase 1 does not yield the desired approximation ratio, a n-bit flip is sufficient to find a (1/3 − ε/n)-approximation of the global optimum of f . The probability of this event to occur is at least (H β evaluations the (1+1) EA with mutation pmutβ performs an n-nit flip, thus reaching the desired (cid:3) approximation ratio. n )−1n−β = Ω(n−β) by (1). After an additional phase of expected O(cid:0)nβ(cid:1) fitness ε n3(cid:1). 5 Symmetric Submodular Functions under a Matroid Constraint. In this section we consider the problem of maximizing a non-negative submodular function f : 2V → R≥0 under a single matroid constraint M = (V,I). More formally, we study the problem argmaxC∈If (C). (4) We denote with opt any solution of Problem (4), and we denote with n the size of V . Note that this definition of opt differs from that of Section 4. We approach this problem, by maximizing the following fitness function zf (C) =(cid:26) f (C) if C ∈ I; r(C) − C otherwise; (5) with r the rank function as in Definition 3. If a solution C is unfeasible, then zf (C) returns a negative number, whereas if C is feasible, then zf (C) outputs a non-negative number. When studying additional constraints on the solution space the problem becomes more in- volved, so we require a different notion of local optimality. Definition 16. Let f : 2V → R≥0 be a submodular function, let M = (V,I) be a matroid and let α > 0. A set S ∈ I is a (1 + α)-local optimum if the following hold. • (1 + α)f (S) ≥ f (S \ {u}) for all u ∈ S; • (1 + α)f (S) ≥ f (S ∪ {v}) for all v ∈ V \ S s.t. S ∪ {v} ∈ I; • (1 + α)f (S) ≥ f ((S \ {u}) ∪ {v}) for all u ∈ S and v ∈ V \ S s.t. (S \ {u}) ∪ {v} ∈ I. We prove that, in the case of a symmetric submodular function, a (1 + α)-local optimum as in Definition 16 yields a constant-factor approximation ratio. To this end, We make use of the following well-known result. Theorem 17 (Theorem 1 in Lee et al. [15]). Let M = (V,I) be a matroid and I, J ∈ I be two independent sets. Then there is a mapping π : J \ I → (I \ J) ∪ {∅} such that • (I \ {π(b)}) ∪ {b} ∈ I for all b ∈ J \ I; • (cid:12)(cid:12)π−1(e)(cid:12)(cid:12) ≤ 1 for all e ∈ I \ J. Lemma 18. Consider a non-negative symmetric submodular function f : 2V → R≥0, a matroid M = (V,I) and let S be a (1 + ε/n2)-local optimum as in Definition 16. Then S is a (1/3 − /n)- approximation for Problem (4). A mild revision of Lemma 1 and Theorem 3 in Lee et al. [15], the following lemma holds. 12 Proof Fix a constant ε > 0 and a set C ∈ I. Consider a mapping π : C \ S → (S \ C) ∪ {∅} as in Theorem 17. Since S is a (1 + ε/n2)-local optimum it holds (cid:16)1 + for all b ∈ C \ S. Thus, it holds ε n2(cid:17) f (S) ≥ f ((S \ {π(b)}) ∪ b); (6) f ((S ∪ {b}) − f (S) ≤ f ((S \ {π(b)}) ∪ {b}) − f (S \ {π(b)}) ≤(cid:16)1 + ε n2(cid:17) f (S) − f (S \ {π(b)}), where the first inequality follows from (2), and the second one follows from (6). Summing these inequalities for each b ∈ C \ S and using submodularity as in (2) we obtain, f (S ∪ C) − f (S) ≤ (cid:88)b∈C\S ≤ (cid:88)b∈C\S(cid:104)(cid:16)1 + [f (S ∪ {b}) − f (S)] ε n2(cid:17) f (S) − f (S \ {π(b)})(cid:105) . Consider a given order of the elements in b ∈ C \ S, i.e. C \ S = {b1, . . . , bk}. Then it holds ε (cid:88)b∈C\S(cid:104)(cid:16)1 + k(cid:88)j=2 ≤ [f (S) − f (S \ {π(bj)})] + k n2(cid:17) f (S) − f (S \ {π(b)})(cid:105) = k(cid:88)j=1 {π(b(cid:96))}(cid:33) f(cid:32)(S ∩ C) {π(b(cid:96))}(cid:33) − f(cid:32)(S ∩ C) j−1(cid:91)(cid:96)=1 j(cid:91)(cid:96)=1 k(cid:88)j=2 n2 f (S) ≤(cid:16)1 + n(cid:17) f (S) − f (S ∩ C) ε n2 f (S) + f ((S ∩ C) ∪ {π(b1)}) − f (S ∩ C) + k ε ε where the first inequality follows from (2) and the second inequality follows by taking the telescopic sum together with the fact that k ≤ n. Thus, it follows that Since f is symmetric, f (S) = f (V \ S) and we have that, ε n(cid:17) f (S) ≥ f (S ∪ C) + f (S ∩ C), 2(cid:16)1 + n(cid:17) f (S) ≥ f (S) + f (S ∪ C) + f (S ∩ C) 3(cid:16)1 + ε ≥ f (C \ S) + f (C ∩ S) ≥ f (C). The claim follows by choosing C = opt. (cid:3) We use Lemma 18 to perform a run time analysis of the (1+1) EA. We consider the case of the pmutβ mutation, although our proof easily extends to the standard uniform mutation and fmutβ. We experimentally compare these operators in Section 6.2. We perform the analysis by estimating the expected run time until a (1 + ε/n2)-local optimum is reached, and apply Lemma 18 to obtain the desired approximation guarantee. Our analysis yields an improved upper-bound on the run time over that of Friedrich and Neumann [16]. The following theorem holds. Theorem 19. The (1+1) EA with mutation pmutβ is a (1/3− ε/n)-approximation algorithm for Problem (4). Its expected run time is O(cid:0) 1  n4 log n ε(cid:1). Proof We perform the analysis assuming that a fitness function as in (5) is used. We divide the run time in two phases. During (Phase 1) the (1+1) EA finds a feasible solution, whereas in (Phase 2) it finds a (1 + ε/n2)-local optimum, given that an independent set has been found. 13 (Phase 1) Assuming that the initial solution is not an independent set, then the (1+1) EA maximizes the function r(C)−C, until a feasible solution is found. This is equivalent to minimizing the function C− r(C). We estimate the run time using the multiplicative drift theorem (Theorem 5). Denote with xt a solution found by the (1+1) EA after t steps, consider the Markov chain Xt = xt − r(xt) and consider the first hitting time T = min{t : Xt = 0}. Then it holds Xt ∈ {0} ∪ [1, n]. Moreover, since the probability of removing a single chosen bit-flip from the current en . Theorem 5 now yields, E [T ] ≤ 2en log(1 + n). solution is 1/en, we have, E [Xt − Xt+1 Xt] ≥ Xt We conclude that we can upper-bound the run time in this initial phase as O (n log n). (Phase 2) We estimate the run time in this phase with the multiplicative increase method. Assuming that a feasible solution is reached, then all subsequent solutions are feasible, since zf (C) ≥ 0 for all feasible solutions and zf (C) < 0 for all infeasible solutions. To estimate the run time in this phase we do not perform the analysis on f directly but we consider the potential function gf,ε from Lemma 12 (recall that in this case opt is not the global optimum of f , but the highest f -value among all feasible solutions). We prove that for all ε > 0, the (1+1) EA with mutation pmutβ finds a (1/3 − ε/n)-approximation of gf,ε(S) = f (S) + opt ε , ε(cid:1) fitness evaluations. We apply Lemma 12(3) and conclude that the within expected O(cid:0) 1 (1+1) EA with mutation pmutβ finds a (1/3 − 2ε/n)-approximation of f within O(cid:0) 1 ε(cid:1) ε n3 log n Denote with yt the solution found by the (1+1) EA at time step t + (cid:96), for all t ≥ 0, with (cid:96) the number of steps in Phase 1. In other words, y0 is the first feasible solution found by the (1+1) EA, and yt is the solution found after additional t steps. Again, the solutions yt are independent sets for all t ≥ 0. For any solution yt it is always possible to make an improvement of (1 + ε/n2)gf,ε(yt) on the fitness in the next iteration, by adding or removing a single vertex, or by swapping two bits, unless yt is already a (1 + ε/n)-local optimum. Again, we refer to any single bit-flip or swap that yields such an improvement of a fitness as favorable move. We give an upper-bound on the number of favorable moves k to reach a (1 + ε/n)-local optimum, by solving the following equation fitness evaluations. ε n4 log n ε opt ε n2(cid:17)k opt n ≤ opt + ε n ⇔(cid:16)1 + (cid:16)1 + where we have used that that for the initial solution y0, gf,ε(y0) ≥ εopt/n (see Lemma 12(2)). From solving the inequality it follows that the (1+1) EA reaches a (1 + ε/n)-local maximum after at most k = O(cid:0) 1 ε(cid:1) favorable moves. Since the probability of performing a single n 2−βn−2, then the expected waiting time for a favorable chosen bit-flip or a swap is at least H−β bit-flip to occur is at most O(cid:0)n2(cid:1), hence we can upper-bound the expected run time in Phase 2 as O(cid:0) 1 (cid:3) n2(cid:17)k ε n4 log n ε n2 log n ε n ε ≤ + 1, ε(cid:1). 6 Experiments 6.1 The Maximum Directed Cut problem. Given a directed graph G = (V, E), we consider the problem of finding a subset U ⊆ V of nodes such that the sum of the outer edges of U is maximal. This problem is the maximum directed cut problem (Max-Di-Cut) and is a known to be NP-complete. For each subset of nodes U ⊆ V , consider the set ∆(U ) = {(e1, e2) ∈ E : e1 ∈ U and e2 /∈ U} of all edges leaving U . We define the cut function f : 2V −→ R≥0 as The Max-Di-Cut can be approached by maximizing the cut function as in (7). Note that this function is non-negative. Moreover, it is always submodular and, in general, non-monotone (see f (U ) = ∆(U ) . (7) 14 e.g. Feige et al. [17] and Friedrich et al. [16]). Hence, this approach to the Max-Di-Cut can be formalized as in Problem (3) in Section 4. We select the 123 large instances used by Wagner et al. [25]; the number of vertices ranges from about 379 to over 6.6 million, and the number of edges ranges from 914 to over 56 million. All 123 instances are available online [26]. The instances come from a wide range of origins. For example, there are 14 collaboration networks (ca-*, from various sources such as Citeseer, DBLP, and also Hollywood productions), five infrastructure networks (inf-*), six interaction networks (ia-*, e.g. about email exchange), 21 general social networks (soc-*, e.g., Flickr, LastFM, Twitter, Youtube), 44 subnets of Facebook (socfb-*, mostly from different American universities), and 14 web graphs (web-*, showing the state of various subsets of the Internet at particular points in time). We take these graphs and run Algorithm 1 with seven mutation operators: fmutβ and pmutβ with β ∈ {1.5, 2.5, 3.5} and unif1.3 We use an intuitive bit-string representation based on vertices, and we initialize uniformly at random. Each edge has a weight of 1. For each instance-mutation pair, we perform 100 independent runs (100 000 evaluations each) and with an overall computation budget of 72 hours per pair. Out of the initial 123 instances 67 finish their 100 repetitions per instance within this time limit.4 We report on these 67 in the following. We use the average cut size achieved in the 100 runs as the basis for our analyses. Firstly, we rank the seven approaches based on the average cut size achieved (best rank is 1, worst rank is 7). Table 2 shows the average rank achieved by the different mutation approaches. unif1 performs best at the lower budget and worst at the higher budget, which we take as a strong indication that few bit-flips are initially helpful to quickly improve the cut size, while more flips are helpful later in the search to escape local optima. At the higher budget, both fmutβ and pmutβ perform better than unif1, independent of the parameter chosen. In particular, pmutβ clearly performs better than fmutβ at both budgets, however, while pmutβ with β = 1.5 performs best at 10 000 iterations, pmutβ with β = 3.5 performs best when the budget is 100 000 iterations. average rank mutation t = 10, 000 t = 100, 000 fmut1.5 fmut2.5 fmut3.5 pmut1.5 pmut2.5 pmut3.5 unif 1 5.9 4.6 4.0 3.0 1.8 1.1 6.7 4.1 5.7 6.6 2.4 3.0 4.0 2.1 Table 2: Average ranks (based on mean cut size) of at t = 10 000 and t = 100 000 iterations (lower ranks are better). To investigate the relative performance difference and the statistical significance thereof, we perform a Nemenyi two-tailed test (see Figure 1). This test performs all-pairs comparisons on Friedman-type ranked data. The results are as expected and consistent with the average ranks reported in Table 2. Across the 67 instances, the achieved cut sizes vary significantly (see Table 3). For example, the average gap between the worst and the best approach is 42.1% at 10 000 iterations and it still is 7.4% at 100 000 iterations. Also, when we compare the best fmutβ and pmutβ configurations (as per Table 3), then we can see that (i) pmutβ is better or equal to fmutβ, and (ii) the performance 3 In contrast to our earlier work [27], we are comparing against unif 1, which performs at least one flip, thus making it a fairer comparison. 4 Source categories of the 67 instances: 2x bio-*, 6x ca-*, 5x ia-*, 2x inf-*, 1x soc-*, 40x socfb-*, 4x tech-*, 7x web-*. The largest graph is socfb-Texas84 with 36 364 vertices and 1 590 651 edges. 15 (a) 10 000 evaluations (b) 100 000 evaluations Fig. 1: Critical Distance (CD) diagram based on a Nemenyi two-tailed test using the average rankings. CD (top left) shows the critical distance. Distances larger than CD corresponds to a statistical significant difference in the ranking. Relationships within a critical distance are marked with a horizontal bar. min gap mean gap max gap total 0.8% 13.0% 42.1% t = 10k pmut1.5 vs fmut1.5 1.1% 2.3% 4.7% total 0.0% 1.9% 7.4% t = 100k pmut3.5 vs fmut3.5 0.0% 0.8% 6.3% Table 3: Summary of cut-size differences. "total" refers to the gap between the best and worst performing mutation out of all seven. The two highlighted pairs compare the best fmutβ and pmutβ values listed in Table 2. advantage of pmutβ over fmutβ is 2.3% and 0.8% on average, with a maximum of 4.7% and 6.3% (i.e., for 10 000 and 100 000 evaluations). To investigate the extent to which mutation performance and instance features are correlated, we perform a 2D projection using a principle component analysis of the instance feature space based on the features collected from [26]. We then consider the performance of the seven mutation operators at a budget of 100,000 evaluations, and we visualize it in the 2D space (see Figure 2). In these projections, the very dense cluster in the top left is formed exclusively by the socfb-* instances, and the ridge from the very top left to the bottom left is made up of (from top to bottom) ia-*, tech-*, web*, and ca-* instances. The "outlier" on the right is web-BerkStan, due to its extremely high values of the average vertex degree, the number of triangles formed by three edges (3-cliques), the maximum triangles formed by an edge, and the maximum i-core number, where an i-core of a graph is a maximal induced subgraph and each vertex has degree at least i. Interestingly, the performance seems to be correlated with the instance features and thus, indirectly, with their origin. For example, we can see in Figure 2a that unif1 does not reach a cut size that is within 1% of the best observed average for many of the socfb-* instances (shown as many black dots in the tight socfb*-cluster). In contrast to this, pmut3.5's corresponding Figure 2b shows only red dots, indicating that it always performs within 1% of the best-observed. Lastly, we summarize the results in Figure 2c based on the concept of instance difficulty. Here, the color denotes the number of instances that achieve a cut size within 1% of the best observed average. Interestingly, many ia-*, ca-*, web-* and tech-* instances are solved well by many mutation operators. In contrast to this, many socfb-* instances are blue, meaning that are solved well by just very few mutation operators -- in particular, by our pmut3.5. 6.2 The Symmetric Mutual Information problem. We study an instance of the general feature selection problem: Given a set of observations, find a subset of relevant features (variables, predictors) for use in model construction. We consider the following framework. Suppose that n time series X (1), . . . , X (n) are given, each one representing a sequence of temporal observations. For each sequence X (i), define the corresponding temporal variation as a sequence Y (i) with Y (i) We perform feature selection of the variables Y (i), assuming that the joint probability distri- bution p(Y (1), . . . , Y (n)) is Gaussian. Specifically, given a cardinality constraint k, we search for j = X (i) j − X (i) j−1. 16 (a) unif 1 footprint (b) pmut3.5 footprint (c) Instance difficulty Fig. 2: Mutation operator footprints (left and middle plots): instances are marked red if the mu- tation are at most 1% away from the best-observed performance. Instance difficulty (right-most plot): the color encodes the number of algorithms that perform within 1% of the oracle perfor- mance. Note: a principle component analysis is used for the projection of the instances from the feature space into 2D. a subset S ∈ [n] of size at most k s.t. the corresponding series χS := {Y (i) : i ∈ S} are optimal predictors for the overall variation in the model. Variations of this setting are found in many applications (see eg. Singh et al. [28], Zhu and Stein [29], and Zimmerman [30]) We use the mutual information as an optimization criterion for identifying highly informative random variables among the {Y (i)} (see Calseton and Zidek [31]). For a subset S ∈ [n], we define the corresponding mutual information as MI (S) = − 1 2(cid:88)i (1 − ρ2 i ), (8) where the ρi are the canonical correlations between χS and χV \S. It is well-known that the mutual information as in (8) is a symmetric non-negative submodular function (see Krause et al. [32]). Note also that a cardinality constraint k is equivalent to a matroid constraint, with independent sets all subsets S ∈ [n] of cardinality at most k. Hence, this approach to feature selection consists of maximizing a non-negative symmetric submodular function under a matroid constraint, as in Problem (4). Following the framework outlined in Section 5, we approach this problem by maximizing the following fitness function zMI(S) =(cid:26) MI (S) if S ≤ k; k − S otherwise; (9) We apply this methodology to perform feature selection on an air pollution dataset (see Rhode and Muller [33]).5 This dataset consists of hourly air NO2 data from over 1500 sites, during a four month interval from April 5, 2014 to August 5, 2014. For a fixed cardinality constraint k = 200, . . . , 850, we let the (1+1) EA with various mutation rates run for a fixed time budget at 1K, 2.5K, and 5K fitness evaluations. For each set of parameters, we perform 100 runs and take the sample mean over all resulting fitness values. We consider the (1+1) EA with uniform mutation, pmutβ and fmutβ with β = 1.5, 2.5, 3.5. The results are displayed in Figure 3. We observe that for a small time budget and small k, heavy tailed-mutations outperform the standard uniform mutation and the fmutβ. We observe that for large k all mutation operators achieve similar performance. These results suggest that for small time budget, and small k, larger jumps are beneficial, whereas standard mutation operators may be sufficient to achieve a good approximation of the optimum, given more resources. 5 This dataset is publicly available at www.berkleyearth.org. 17 Fig. 3: Solution quality achieved by the (1+1) EA with various mutation rates on a fitness function as in (9), for fixed cardinality constraint k, and varying time budget. We consider the (1+1) EA with uniform mutation, pmutβ and fmutβ with β = 1.5, 2.5, 3.5. Each dot corresponds to the sample mean of 100 independent runs. 7 Conclusions In the pursuit of optimizers for complex landscapes that arise in industrial problems, we have identified a new mutation operator. This operator allows for good performance of the classical (1+1) EA when optimizing not only simple artificial test functions, but the whole class of non- negative submodular functions and symmetric submodular functions under a matroid constraint. As submodular functions find applications in a variety of natural settings, it is interesting to consider the potential utility of heavy tailed operators as building blocks for optimizers of more complex landscapes, where submodularity can be identified in parts of these landscapes. Acknowledgment Markus Wagner has been supported by ARC Discovery Early Career Researcher Award DE160100850. References 1. A. E. Eiben, R. Hinterding, Z. Michalewicz, Parameter control in evolutionary algorithms, IEEE Transactions on Evolutionary Computation 3 (2) (1999) 124 -- 141. 2. A. E. Eiben, J. E. Smith, Introduction to evolutionary computation, Natural Computing Series, Springer, 2003. 3. C. Witt, Worst-case and average-case approximations by simple randomized search heuristics, in: STACS, 2005, pp. 44 -- 56. 4. B. Doerr, T. Jansen, D. Sudholt, C. Winzen, C. Zarges, Mutation rate matters even when optimizing monotonic functions, Evolutionary Computation 21 (1) (2013) 1 -- 27. 5. T. Jansen, I. Wegener, Real royal road functions -- where crossover provably is essential, Discrete Ap- plied Mathematics 149 (1-3) (2005) 111 -- 125. 6. B. Doerr, H. P. Le, R. Makhmara, T. D. Nguyen, Fast genetic algorithms, in: GECCO, 2017, pp. 777 -- 784. 7. C. Doerr, M. Wagner, Simple on-the-fly parameter selection mechanisms for two classical discrete black-box optimization benchmark problems, in: Proc. of GECCO, 2018, pp. 943 -- 950. 8. C. Doerr, M. Wagner, Sensitivity of parameter control mechanisms with respect to their initialization, in: A. Auger, C. M. Fonseca, N. Louren¸co, P. Machado, L. Paquete, D. Whitley (Eds.), Proc. of PPSN, 2018, pp. 360 -- 372. 9. T. Friedrich, F. Quinzan, M. Wagner, Escaping large deceptive basins of attraction with heavy-tailed mutation operators, in: Proc. of GECCO, 2018, pp. 293 -- 300. lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll0·10+01·10+32·10+3400600800size of the cardinality constraint [k]fitness value [sample mean]Timbe Budget = 1Klllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll0·10+01·10+32·10+3400600800size of the cardinality constraint [k]fitness value [sample mean]Timbe Budget = 2.5Klllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll1.0·10+31.5·10+32.0·10+32.5·10+3400600800size of the cardinality constraint [k]fitness value [sample mean]mutation operatorlllllllllllllllllllllllllllllllllllllllllllllllllfmut, b = 1.5fmut, b = 2.5fmut, b = 3.5pmut, b = 1.5pmut, b = 2.5pmut, b = 3.5uniform Timbe Budget = 5K 18 10. S. Droste, T. Jansen, I. Wegener, On the analysis of the (1+1) evolutionary algorithm, Theoretical Computer Science 276 (1-2) (2002) 51 -- 81. 11. A. A. Ageev, M. Sviridenko, An 0.828-approximation algorithm for the uncapacitated facility location problem, Discrete Applied Mathematics 93 (2-3) (1999) 149 -- 156. 12. M. X. Goemans, D. P. Williamson, Improved approximation algorithms for maximum cut and satis- fiability problems using semidefinite programming, Journal of the ACM 42 (6). 13. J. Hastad, Some optimal inapproximability results, Jornal of the ACM 48 (4) (2001) 798 -- 859. 14. A. Krause, C. Guestrin, Near-optimal observation selection using submodular functions, in: AAAI, 2007, pp. 1650 -- 1654. 15. J. Lee, V. S. Mirrokni, V. Nagarajan, M. Sviridenko, Non-monotone submodular maximization under matroid and knapsack constraints, in: STOC, 2009, pp. 323 -- 332. 16. T. Friedrich, F. Neumann, Maximizing submodular functions under matroid constraints by evolution- ary algorithms, Evolutionary Computation 23 (4) (2015) 543 -- 558. 17. U. Feige, V. S. Mirrokni, J. Vondr´ak, Maximizing non-monotone submodular functions, SIAM Journal of Computing 40 (4) (2011) 1133 -- 1153. 18. B. Lehmann, D. J. Lehmann, N. Nisan, Combinatorial auctions with decreasing marginal utilities, Games and Economic Behavior 55 (2) (2006) 270 -- 296. 19. D. J. Welsh, Matroid theory, Courier Corporation, 2010. 20. M. Mitzenmacher, E. Upfal, Probability and Computing: Randomized Algorithms and Probabilistic Analysis, 2005. 21. B. Doerr, D. Johannsen, C. Winzen, Multiplicative drift analysis, Algorithmica 64 (4) (2012) 673 -- 697. 22. H. Muhlenbein, How genetic algorithms really work: Mutation and hillclimbing, in: PPSN, 1992, pp. 15 -- 26. 23. I. Wegener, Theoretical aspects of evolutionary algorithms, in: ICALP, 2001, pp. 64 -- 78. 24. G. L. Nemhauser, L. A. Wolsey, Best algorithms for approximating the maximum of a submodular set function, Math. Oper. Res. 3 (3) (1978) 177 -- 188. 25. M. Wagner, T. Friedrich, M. Lindauer, Improving local search in a minimum vertex cover solver for classes of networks, in: CEC, 2017, pp. 1704 -- 1711. 26. R. A. Rossi, N. K. Ahmed, The Network Data Repository with Interactive Graph Analytics and Visualization (Website), http://networkrepository.com (2015). 27. T. Friedrich, A. Gobel, F. Quinzan, M. Wagner, Heavy-tailed mutation operators in single-objective combinatorial optimization, in: Proc. of PPSN, 2018, pp. 134 -- 145. 28. A. Singh, A. Krause, C. Guestrin, W. J. Kaiser, Efficient informative sensing using multiple robots, J. Artif. Intell. Res. 34 (2009) 707 -- 755. 29. Z. Zhu, M. L. Stein, Spatial sampling design for prediction with estimated parameters, Journal of Agricultural, Biological, and Environmental Statistics 11 (1) (2006) 24 -- 44. 30. D. L. Zimmerman, Optimal network design for spatial prediction, covariance parameter estimation, and empirical prediction, Environmetrics 17 (6) 635 -- 652. 31. W. F. Caselton, J. Zidek, Optimal monitoring network designs, Statistics & Probability Letters 2 (4) (1984) 223 -- 227. 32. A. Krause, A. P. Singh, C. Guestrin, Near-optimal sensor placements in gaussian processes: Theory, efficient algorithms and empirical studies, Journal of Machine Learning Research 9 (2008) 235 -- 284. 33. R. A. Rhode, R. A. Muller, Air pollution in china: Mapping of concentrations and sources, PLoS One 10 (8) (2015) e0135749.
1902.08266
1
1902
2019-02-21T21:03:22
Local Computation Algorithms for Spanners
[ "cs.DS", "cs.DM" ]
A graph spanner is a fundamental graph structure that faithfully preserves the pairwise distances in the input graph up to a small multiplicative stretch. The common objective in the computation of spanners is to achieve the best-known existential size-stretch trade-off efficiently. Classical models and algorithmic analysis of graph spanners essentially assume that the algorithm can read the input graph, construct the desired spanner, and write the answer to the output tape. However, when considering massive graphs containing millions or even billions of nodes not only the input graph, but also the output spanner might be too large for a single processor to store. To tackle this challenge, we initiate the study of local computation algorithms (LCAs) for graph spanners in general graphs, where the algorithm should locally decide whether a given edge $(u,v) \in E$ belongs to the output spanner. Such LCAs give the user the `illusion' that a specific sparse spanner for the graph is maintained, without ever fully computing it. We present the following results: -For general $n$-vertex graphs and $r \in \{2,3\}$, there exists an LCA for $(2r-1)$-spanners with $\widetilde{O}(n^{1+1/r})$ edges and sublinear probe complexity of $\widetilde{O}(n^{1-1/2r})$. These size/stretch tradeoffs are best possible (up to polylogarithmic factors). -For every $k \geq 1$ and $n$-vertex graph with maximum degree $\Delta$, there exists an LCA for $O(k^2)$ spanners with $\widetilde{O}(n^{1+1/k})$ edges, probe complexity of $\widetilde{O}(\Delta^4 n^{2/3})$, and random seed of size $\mathrm{polylog}(n)$. This improves upon, and extends the work of [Lenzen-Levi, 2018]. We also complement our results by providing a polynomial lower bound on the probe complexity of LCAs for graph spanners that holds even for the simpler task of computing a sparse connected subgraph with $o(m)$ edges.
cs.DS
cs
Local Computation Algorithms for Spanners Merav Parter∗ Ronitt Rubinfeld † Ali Vakilian ‡ Anak Yodpinyanee ‡ Abstract A graph spanner is a fundamental graph structure that faithfully preserves the pairwise distances in the input graph up to a small multiplicative stretch. The common objective in the computation of spanners is to achieve the best-known existential size-stretch trade-off efficiently. Classical models and algorithmic analysis of graph spanners essentially assume that the algorithm can read the input graph, construct the desired spanner, and write the answer to the output tape. However, when considering massive graphs containing millions or even billions of nodes not only the input graph, but also the output spanner might be too large for a single processor to store. To tackle this challenge, we initiate the study of local computation algorithms (LCAs) for graph spanners in general graphs, where the algorithm should locally decide whether a given edge (u, v) ∈ E belongs to the output (sparse) spanner or not. Such LCAs give the user the "illusion" that a specific sparse spanner for the graph is maintained, without ever fully computing it. We present several results for this setting, including: • For general n-vertex graphs and for parameter r ∈ {2, 3}, there exists an LCA for (2r− 1)- spanners with (cid:101)O(n1+1/r) edges and sublinear probe complexity of (cid:101)O(n1−1/2r). These O(k2) spanners with (cid:101)O(n1+1/k) edges, probe complexity of (cid:101)O(∆4n2/3), and random seed size/stretch trade-offs are best possible (up to polylogarithmic factors). • For every k ≥ 1 and n-vertex graph with maximum degree ∆, there exists an LCA for of size polylog(n). This improves upon, and extends the work of [Lenzen-Levi, ICALP'18]. We also complement these constructions by providing a polynomial lower bound on the probe complexity of LCAs for graph spanners that holds even for the simpler task of computing a sparse connected subgraph with o(m) edges. To the best of our knowledge, our results on 3 and 5-spanners are the first LCAs with sublinear (in ∆) probe-complexity for ∆ = nΩ(1). 1 Introduction One of the fundamental structural problems in graph theory is to find a sparse structure which preserves the pairwise distances of vertices. In many applications, it is crucial for the sparse structure to be a subgraph of the input graph; this problem is called the spanner problem. For an input graph G = (V, E), a k-spanner H ⊆ G (for k ≥ 1) satisfies that for any v, u ∈ V , the distance from v to u in H is at most k times the distance from v to u in G, where k is referred to as the stretch of the spanner. Furthermore, to reduce the cost of the solution, it is desired to output a minimum size/weight such subgraph H. The notion of spanners was introduced by Peleg ∗Weizmann IS. [email protected] †CSAIL, MIT and TAU. [email protected] ‡CSAIL, MIT. {vakilian,anak}@mit.edu 1 and Schaffer [35] and has been used widely in different applications such as routing schemes [4, 34], synchronizers [36, 3], SDD's [41] and spectral sparsifiers [22]. It is folklore that for every n-vertex graph G, there exists a (2k − 1)-spanner H ⊆ G with O(n1+1/k) edges. In particular, if the girth conjecture of Erdos [17] is true, then this size-stretch trade-off is optimal. Spanners have been considered in many different models such as distributed algorithms [11, 12, 5, 13, 14, 37, 16] and dynamic algorithms [15, 6, 8, 7]. Local computation of small stretch spanners. When the graph is so large that it does not fit into the main memory, the existing algorithms are not sufficient for computing a spanner. Instead, we aim at designing an algorithm that answers queries of the form "is the edge (u, v) in the spanner?" without computing the whole solution upfront. One way to get around this issue is to consider the Local Computation Algorithms (LCAs) model (also known as the Centralized Local model ), introduced by Rubinfeld et al. [39] and Alon et al. [2]. There can be many different plausible k-spanners; however, the goal of LCAs for the k-spanner problem is to design an algorithm that, given access to primitive probes (i.e. Neighbor, Degree and Adjacency probes) on the input graph G, for each query on an edge e ∈ E(G) consistently with respect to a unique k-spanner H ⊆ G (picked by the LCA arbitrarily), outputs whether e ∈ H. The performance of the LCA is measured based on the quality of solution (i.e. number of edges in H) and the probe complexity (the maximum number of probes per each query) of the algorithm1. In other words, an LCA gives us the "illusion" as if we have query access to a precomputed k-spanner of G. The study of LCAs with sublinear probe complexity for nearly linear size spanning subgraphs (or sparsifiers) is initiated by Levi et al. [27, 28] for some restricted families of graphs such as minor- closed families. However, their focus is mainly on designing LCAs that preserve the connectivity while allowing the stretch factor to be as large as n. Moreover, in their work, the input graph is sparse (has O(n) edges), while the classical k-spanner problem becomes relevant only when the input graph is dense (with superlinear number of edges). Recently, Lenzen and Levi [25] designed the first sparsifier LCA in general graphs with (1 + ε)n edges, stretch O(log2 n · poly(∆/ε)) and probe complexity of O(poly(∆/ε) · n2/3), where ∆ is the maximum degree of the input graph. In this work, we show that sublinear time LCAs for spanners are indeed possible in several cases. We give: (I) 3 and 5-spanners for general graphs with optimal trade-offs between the number of edges and the stretch parameter (up to polylogarithmic factors), and (II) general k-spanners, either in the dense regime (when the minimum degree is at least n1/2−1/(2k)) or in the sparse regime (when the maximum degree is n1/12−ε). Broader scope and agenda: local computation algorithms for dense graphs. LCAs have been established by now for a large collection of problems, including Maximal Independent Set, Maximum Matching, and Vertex Cover [39, 2, 31, 18, 33, 38, 30]. These algorithms typically suffer from a probe complexity that is exponential in ∆ and thus are efficient only in the sparse regime when ∆ = O(1). To this end, obtaining LCAs even with a polynomial dependency in ∆ is a major open problem for many classical local graph problems, as noted in [32, 30, 19]. For instance, recently Ghaffari and Uitto [19] obtained an LCA for the MIS problem with probe complexity of ∆O(log log ∆) · log n improving upon a long line of results. Their result also illustrates the connection between LCAs with good dependency on ∆, and algorithms for the massively parallel computation model with sublinear space per machine. Recently, [30] and [25] provided LCAs with probe complexities polynomial in ∆ for the problems of (1− ε)-maximum matching and sparse connected subgraphs, respectively. Note that in the context of spanners, such algorithms are still inefficient when the maximum degree is 1We may also measure the time complexity of an LCA. In our LCAs, the time complexities are clearly only a factor of poly(log n) higher than the corresponding probe complexities, so we focus our analysis on probe complexities. 2 polynomial in n, which is precisely the setting where graph sparsification is applied. 1.1 Additional related work: spanners in many other related settings Local distributed algorithms. The construction of spanners in the distributed local model, where messages are unbounded, has been studied extensively in both the randomized and the deterministic settings [5, 16, 11, 12, 13, 14, 37]: the state of the art of both randomized and deterministic constructions is O(k) rounds. Dynamic algorithms for graph spanners. In the dynamic setting, the goal is to maintain a spanner in a setting where edges keep on being inserted or deleted. The main complexity measure is the update time which is the computation time needed to fix the current spanner upon a single edge insertion or deletion. Most of the dynamic algorithms for spanners maintain an auxiliary clustering structure that aids this modification of current spanner. [8] provided the first dynamic algorithms with sublinear worst-case update time for 3-spanners and 5-spanners. Recently, [7] showed a general deamortization technique that provides worst-case update time of (cid:101)O(1) with high probability, for any fixed stretch value of k. It would be interesting to see if those recent tools can be useful in the local centralized setting as well. Note that in the LCA setting there is a polynomial lower bound even without the stretch constraint, thus our setting is provably harder. Streaming algorithms. In the setting of dynamic streaming, the input graph is presented online as a long stream of insertions and deletions to its edges. For spanners, the goal is to maintain a sparse spanner for the graph using small space and few passes over the stream. Ahn et al. [1] showed the first a sketch-based algorithm for spanners in this setting, yielding (klog2 5 − 1)-spanner with (cid:101)O(n1+1/k) edges and O(log k) passes. Kapralov and Woodruff [23] showed an alternative tradeoff yielding O(2k)-spanner with (cid:101)O(n1+1/k) edges using only two passes. In dynamic streaming, one can keep the entire solution and the challenge is to update the solution though the pass over the stream. In contrast, in the LCA model, one cannot afford keeping the entire solution (i.e., already the number of vertices is too large) but the input graph remains as is. 1.2 Our results and techniques In this paper we initiate the study of LCAs for graph spanners in general graphs which concerns with the following task: How can we decide quickly (e.g., sublinear in n time) if a given edge e belongs to a sparse spanner (with fixed stretch) of the input graph, without preprocessing and storing any auxiliary information? In the design of LCAs for graph problems, the set of defined probes to the input graph plays an important role. Here we consider the following common probes: Neighbor probes ("what is the ith neighbor of u"?), Degree probes ("what is deg(u)?") and Adjacency probes ("are u and v neighbors"?) [20, 21]. We emphasize that the answer to an Adjacency probe on an ordered pair (cid:104)u, v(cid:105) is the index of v in Γ(u) if2 the edge exists and ⊥ otherwise. Note that if the maximum degree in the input graph is O(1), each Adjacency probe can be implemented by O(1) number of Neighbor probes. The problem of designing LCAs for spanners is closely related to designing LCAs for sparse connected subgraphs with (1 + ε)n edges which was first introduced by [27]. With the exception of[25], a long line of results for this problem usually concerns special sparse graph families, rather than general graphs. A summary of these results with a comparison to our results is provided in Table 1. 2Γ(u) denotes the neighbor set of u, whereas Γ+(u) = Γ(u) ∪ {u}. 3 Reference Graph Family # Edges Stretch Factor Bounded Degree Graphs (1 + ε)n Expanders (1 + ε)n Subexponential growth (1 + ε)n − − − Probe Complexity √ Ω( n) √ O( √ O( n) n) s k r o W r o i r P [27] [26] [28] [29] [25] k Theorem 1.1 Minor-free Minor-free Expansion (1/ log n)1+o(1) General General r o W s i h T Theorem 3.5 Min degree O(n1/2−1/(2k)) Theorem 1.2 Max degree O(n1/12−ε) Theorem 1.3 General (1 + ε)n (1 + ε)n (1 + ε)n (1 + ε)n (cid:101)O(n1+1/r) (cid:101)O(n1+1/k) (cid:101)O(n1+1/k) o(m) poly(∆, 1/ε) O((log ∆)/ε) poly(∆, 1/ε) poly(∆, 1/ε) super-exponential in 1/ε O(log2 n · poly(∆/ε)) 2r − 1 (r ∈ {2, 3}) 5 O(k2) any k ≤ n super-exponential in 1/ε O(n2/3 · poly(∆/ε)) (cid:101)O(n1−1/(2r)) (cid:101)O(n1−1/(2k)) (cid:101)O(n1−4) Ω(min{√ n, n2/m}) Table 1: Table of results on LCAs for the spanner problem. The symbol (cid:48)−(cid:48) indicates that the stretch is not analyzed. The input graph is a simple graph with n vertices, m edges, maximum degree ∆, and belongs to the indicated graph family. (cid:101)O hides a factor of poly(log n, k). 1.2.1 LCAs for 3 and 5-Spanners for General Graphs Our first contribution is the local construction of 3 and 5-spanners for general graphs, while achiev- ing the optimal trade-offs between the number of edges and the stretch factors (up to polylogarith- mic factors)3. In particular, our LCAs have n1−ε probe complexity even when the input graph is dense with ∆ = Ω(n); note that in such a case, given a query edge (u, v), the LCA should return yes or no without being able to inspect the neighbor lists Γ(u) and Γ(v). In what follows we show how to manipulate the common distributed construction by Baswana and Sen [5] to yield LCAs for 3-spanners and 5-spanners with sublinear probe complexity. The common distributed approach. Most distributed spanner constructions are based on thinning the graph via clustering: construct a random set S of centers by adding each vertex to S independently with some fixed probability. For each vertex v sufficiently close to a center in S, include the edges of the shortest path connecting v to its closest member s ∈ S: this induces a cluster around each center s ∈ S, where every pair of vertices in the same cluster are connected by a short path. Then, add edges connecting pairs of neighboring clusters to ensure the desired stretch factor. The following algorithm constructs a 3-spanner H ⊆ G with (cid:101)O(n3/2) edges. First, add to H all edges incident to vertices of degree at most n. Second, pick a collection S of centers by sampling each vertex independently with probability Θ(log n/ n picks a single neighboring center s ∈ S ∩ Γ(v) (which exists w.h.p.) as its center, then adds (v, s) to √ H, forming a collection of S = O( n) clusters (stars) around these centers. Lastly, every vertex u adds only one edge to each of its neighboring clusters -- note that this last step may add edges whose endpoints are both non-centers. This results in a 3-spanner: For omitted edge (u, v) in G, if u and v are in the same cluster, then they have a path of length 2 through their shared center s. If u and v are in different clusters, an edge from u to some other vertex w in v's cluster would have been chosen, providing the path (cid:104)u, w, s, v(cid:105) of desired stretch 3 connecting u and v, where s n). Each vertex v of degree at least √ √ √ 3Indeed, the girth conjecture of Erdos is resolved for these stretch factors; see e.g.,[43]. 4 n. √ of size (cid:101)O(n3/2) and probe complexity of (cid:101)O(n3/4): the LCA is given an edge (u, v) and must answer is v's center. The challenge and key ideas. Recall that our goal is to design an LCA for 3-spanners H ⊆ G √ whether (u, v) ∈ E(H). First, if deg(u) or deg(v) is at most n, then the algorithm can immediately say YES. This requires only two Degree probes for the endpoints u, v. Hence, the interesting case is where both u and v have degrees at least √ We start by sampling each vertex into the center set S with probability of p = Θ(log n/ n), thus w.h.p. guaranteeing that each high-degree vertex has at least one sampled neighbor. For clarity of explanation, assume that given the ID of a vertex v, the LCA algorithm can decide (with no further probes) whether v is sampled. Upon selecting the set of centers S, the above mentioned distributed algorithm has two degrees of freedom (which our LCA algorithm will enjoy). First, for a high-degree vertex v, there could be potentially many sampled neighbors in S: the distributed algorithm lets v join the cluster of an arbitrarily sampled neighbor. The second degree of freedom is in connecting a high-degree vertex to neighboring clusters. In the distributed algorithm, a vertex connects to an arbitrarily chosen neighbor in each of its neighboring clusters. Since the answers of the LCA algorithm should be consistent, it is important to carefully fix these decisions to allow small probe complexity. √ probe complexity of such a construction, consider a query edge (u, v) where deg(u), deg(v) ≥ √ The naıve approach for 3-spanners and its shortcoming. The most naıve approach is as follows: for each v, traverse the list Γ(v) in a fixed order and pick the first neighbor that satisfies the required conditions. That is, a vertex joins the cluster of its first sampled neighbor (center) and connects to its first representative neighbor in each of its neighboring clusters. To analyze the n. By probing for the first n neighbors of u and v, one can compute the cluster centers cu and cv of u and v with high probability. The interesting case is where u and v belong to different clusters. In such a case, the LCA algorithm should say YES only if v is the first neighbor of u that belongs to the cluster of cv. To check if this condition holds, the algorithm should probe for each of the neighbors w of u that appears before v in Γ(u), and say NO if there exists such earlier neighbor w that belongs to the cluster of cv. Here, it remains to show how this cluster-membership testing procedure is implemented. A cluster-membership test, for a pair (cid:104)s, w(cid:105) with s ∈ S, must return YES iff w belongs to the cluster of the center s. The above mentioned algorithm thus makes O(deg(v)) cluster-membership √ tests for each w preceding u in Γ(v) and s = cv. Since each center is sampled with probability p = log n/ n) w.h.p., leading √ n, the probe complexity of a single cluster-membership test is O( to a total probe complexity of O(deg(v) · √ n). √ Idea (I) -- Multiple centers for efficient cluster-membership test. The key idea in our solution is to pick the cluster centers in a way that allows answering each cluster-membership test for a pair (cid:104)s, w(cid:105) using a single Neighbor probe! Towards this goal, we let each high-degree vertex join multiple clusters, instead of just one. In particular, for a vertex w, we look at the subset n neighbors in Γ(w). We then let w join the clusters of all sampled Γ1(w) consisting of its first neighbors in Γ1(w)∩ S. Since each vertex is a center with probability p, this implies that, w.h.p., w joins Θ(p·Γ1(w)) = Θ(log n) many clusters. Though this approach adds a multiplicative O(log n) factor to the size of our spanner, it will pay off dramatically in terms of the probe complexity of our LCA. In particular, this modification enables the algorithm to test cluster-membership with a single Adjacency probe: the vertex w belongs to the cluster of s, if the index of s in w's neighbor- n (the index is returned by the Adjacency probe on u and s). This idea alone list is at most decreases the probe complexity of our LCA to (cid:101)O(deg(w)). √ 5 Idea (II) -- Neighborhood partitioning. The multiple center technique above allows our LCA to handle edges adjacent to a vertex u of degree at most n3/4. For deg(u) > n3/4, our LCA cannot afford to look at all neighbors of u. To this end, we partition the neighbors of u into blocks of size n3/4 each. Rather than adding only one edge between u to each neighboring cluster, we make the decision on which edges to keep for each block independently, by scanning only the block containing v and keeping (u, v) if v belongs to the cluster that was not previously seen in this block. Though this leads to an increase in the number of edges by a factor of deg(u)/n3/4 ≤ n1/4, we can now keep the probe complexity down to (cid:101)O(n3/4) as we only need to scan the block containing v given (cid:101)O(n3/2), we use the fact that O(n1/4 log n) sampled vertices are enough to hit the neighborhoods vertex is O(S · deg(u)/n3/4) = (cid:101)O(n3/2), as desired. Overview of the LCA for 5-spanners. For 5-spanners, the desired number of edges is (cid:101)O(n4/3). deg(u) = (cid:101)O(n1/3). The common distributed construction for 5-spanners computes O(n2/3) clusters of all vertices with degree more than n3/4 with high probability. Since for each block of size n3/4 in the neighborhood of u the algorithm adds O(S) edges, the total number of edges added per This allows us to immediately add to the spanner all edges incident to low-degree vertices u with the query (u, v) instead of u's entire neighbor-list. To keep the size of the spanner small, e.g., by sampling each center independently with probability Θ(log n/n1/3). By letting each high-degree vertex (i.e., with deg(u) = Ω(n1/3)) join the cluster of one of its sampled neighbors, the spanner contains a collection of O(n2/3) (vertex-disjoint) clusters that, w.h.p., cover all high-degree vertices. Finally, each pair of neighboring clusters C1, C2 are connected by adding an edge (u, v) ∈ (C1 × C2) ∩ E to the spanner H. It is straightforward to verify that H is a 5-spanner of size (cid:101)O(n4/3). Designing LCAs for the 5-spanner problem turns out to be significantly more challenging than the 3-spanner case. The reason is that deciding whether an edge (u, v) is in the 5-spanner requires information from the second neighborhoods of v and u, which is quite cumbersome when one cannot even read the entire neighborhood of a vertex. Our solution extends the 3-spanner construction in two ways: some of the edges added to our 5-spanner are between cluster pairs, instead of edges between a vertex and a cluster as in the 3-spanner solution. Another set of edges added to the 5-spanner is between pairs of vertex and cluster, but unlike the 3-spanner case, these clusters have now radius two. Idea (III) -- Cluster partitioning (bucketing). The standard clustering-based construction of 5-spanners adds an edge between every pair of neighboring clusters (stars). This clustering- based construction cannot be readily implemented with the desired probe complexity. To see why, consider clusters centered at s and t, containing u and v respectively. A naıve attempt spends deg(s) · deg(t) probes for vertices between these clusters, as to consistently pick a unique edge between the two clusters. One of our tools extends the idea of neighborhood partitioning from 3-spanner into cluster partitioning. Each of the O(n2/3) clusters is partitioned into balanced buckets of size Θ(n1/3).4 The algorithm then picks only one edge between any pair of neighboring buckets. Since the number of buckets can be shown to be (cid:101)O(n2/3), the spanner size still remains (cid:101)O(n4/3). Unlike partitioning neighbor-lists, partitioning a cluster requires the full knowledge of its members -- which are no longer nicely indexed in a list. To be able to efficiently partition a clusters, the algorithm allows only vertices with degree at most n5/6 to be chosen as cluster centers. The benefit of this restriction is that one can inspect the entire neighborhood of a center in O(n5/6). The drawback of this approach is that it only clusters vertices that have sufficiently many neighbors (i.e., at least n1/3) with degree less than n5/6. The remaining vertices are handled via their high-degree neighbors (i.e., of degree 4Note that each cluster may have at most one bucket of size o(n1/3). 6 at least n5/6) as described next. Idea (IV) -- Representatives. Using the neighborhood-partitioning idea from 3-spanner, all vertices with degree at least n5/6 can be clustered by sampling (cid:101)O(n1/6) cluster centers. By parti- tioning the neighborhood of each high-degree vertex into disjoint blocks each of size (cid:101)O(n5/6), one of (cid:101)O(n5/6) while using (cid:101)O(n4/3) edges. To take care of vertices of degrees less than n5/6 that have can construct a 3-spanner for all edges incident to these high-degree vertices with probe complexity many high-degree neighbors, we let them join the cluster of their high-degree neighbors, hence creating clusters of depth 2. We implement our LCA by first picking S = (cid:101)O(n1/6) centers. Consider the query edge (u, v) To choose which cluster to join (in the second level), our vertex, which has many high-degree neighbors, simply chooses and connects itself to one or more high-degree neighbors, called its rep- resentatives. To determine the representatives of a vertex u, we simply pick Θ(log n) random neighbors of u, and w.h.p. one of them will have high-degree, and hence is chosen as u's represen- tative. where deg(u), deg(v) ≥ n1/3 and u has many high-degree neighbors. Here, u has Θ(log n) repre- sentatives, each of which has Θ(log n) centers in S w.h.p., so u belongs to O(log2 n) clusters. As in the 3-spanner case, we keep (u, v) if v is the first neighbor of u in the cluster that v belongs to. We find the representatives of each neighbor of u by making O(log n) probes, and for all these deg(u) · O(log n) = (cid:101)O(n5/6) representatives, check if they belong to any of v's O(log2 n) clusters with (cid:101)O(n5/6) total probes. LCA for (2r − 1)-spanners with (cid:101)O(n1+1/r) edges and probe complexity (cid:101)O(n1−1/(2r)) for r ∈ {2, 3}. Theorem 1.1 (3 and 5-spanners). For every n-vertex simple undirected graph G, there exists an Moreover, the algorithm only uses a seed of O(log2 n) random bits. In fact, if G has minimum degree ω(n1/3), we may apply the 5-spanner construction (with modified parameters) to obtain 5-spanners with even smaller number of edges as indicated in Table 1 (Theorem 3.5): this minimum degree assumption indeed allows even sparser spanners, bypassing the girth conjecture that holds for general graphs. 1.2.2 LCA for O(k2)-spanners Our second contribution is the local construction of O(k2)-spanners with O(n1+1/k) edges for any k ≥ 1, which has sub-linear probe complexity for graphs of maximum degree ∆ = O(n1/12−ε). Our approach improves upon and extends the recent work of Lenzen and Levi [25]. The work of [25] aims at locally constructing a spanning subgraph with O(n) edges, but the stretch parameter of their subgraph might be as large as O(poly(∆) log2 n). In addition, this construction requires a random seed of polynomial size. In our construction, we reduce the stretch parameter of the constructed subgraph to O(k2), independent of both n and ∆, while using only (cid:101)O(n1+1/k) edges. In addition, we implement our randomized constructions using poly(log n) independent random bits, whereas [25] uses poly(n) bits. We remark that for the LCAs with large stretch parameter considered in [25], our techniques can still be applied to exponentially reduce the required amount of random bits, and save a factor of ∆ in the probe complexity. Theorem 1.2 (O(k2)-spanners). For every integer k ≥ 1 and every n-vertex simple undirected graph G with maximum degree ∆, there exists a (randomized) LCA for O(k2)-spanner with (cid:101)O(n1+1/k) edges and probe complexity (cid:101)O(∆4n2/3). Moreover, the algorithm only uses O(log2 n) random bits. The high level structure is as in [25]: for a given stretch parameter k, partition the edges in G into the sparse set Esparse and the dense set Edense. Roughly speaking, the sparse set Esparse 7 only consists of edges (u, v) for which the k-neighborhood in G of either u or v contains at most O(n2/3) vertices. For this sparse region in the graph, we can simulate a standard distributed algorithm for spanners [5, 10] (using only a poly-logarithmic number of random bits), with small probe complexity. This yields an LCA handling the sparse edges with O(∆2n2/3) probe complexity. To take care of the dense edges, we sample a collection of O(n2/3 log n) centers and partition the (dense) vertices into Voronoi cells around these centers. The main challenge is in connecting the Voronoi cells, keeping in mind that taking an edge between every pair of cells adds too many edges to the spanner. To get around it, the main contribution of [25] was in designing a set of rules for connecting bounded-size sub-structures in Voronoi cells, called clusters. The high-level description of the rules are as follows5: mark a random subset of O(n1/3 log n) Voronoi cells (among the n2/3 Voronoi cells), then connect6 them according to the following rules using (cid:101)O(n) edges each. Rule (1): connect every marked Voronoi cells to each of its neighboring Voronoi cells. Rule (2): if a Voronoi cell has no neighboring marked Voronoi cells, then connect it to all its neighboring Voronoi cells as well. Rule (3): For each pair of (not necessarily adjacent) Voronoi cell a and marked Voronoi cell c sharing common neighboring Voronoi cells Γ(a) ∩ Γ(c), keep an edge from a to a single Voronoi cell b∗ ∈ Γ(a) ∩ Γ(c) (i.e., b∗ has the minimum ID in Γ(a)∩ Γ(c)). This last rule handles the edges of (unmarked) Voronoi cells that have some neighboring marked Voronoi cell. Idea (V) -- Establishing the O(k2) stretch guarantee. In our implementation, the radius of each Voronoi cell is O(k) (as opposed to O(∆ log n) in [25]). Thus, it suffices to show that the spanner path from Voronoi cell supervertices a to b only visits O(k) other Voronoi cells. To this end, we impose a random ordering of the Voronoi cells, by assigning them distinct random ranks. We then make the following modification to Rule (3): add an edge from a to b if there exists a marked Voronoi cell c such that the rank r(b) of b is among the O(n1/k log n) lowest ranks in Γ(a) ∩ Γ(c), restricted to those discovered by the LCA. This modified rule allows us to extend the inductive connectivity argument of [25] to show that every pair of adjacent cells are connected by a path that goes through O(k) cells -- since each cell has radius O(k), the final stretch is O(k2). Idea (VI) -- Graph connectivity with bounded independence. One of our key technical contributions is in showing that one can implement the above randomized random rank assignment using small number of random bits. We show that the ranks of Voronoi cells can be computed using T = Θ(k) hash functions h1,··· , hT chosen uniformly at random form a family of O(log n)-wise independent hash functions of the form {0, 1}log n → {0, 1}O((log n)/k). We define our rank function as a concatenation of hi's on the ID of the Voronoi cell's center: for the Voronoi cell centered at v, r(v) = h1(ID(v)) ◦ . . . ◦ hT (ID(v)). We then carefully adopt the inductive stretch argument to this randomized rank assignment with limited independence so that in the ith step, our analysis only relies on the hash function hi. 1.2.3 Lower Bounds To establish the lower bound, we construct two distributions over undirected d-regular graph in- stances that contain a designated edge e. For graphs in the first family, it holds that after removing e, w.h.p., they remain connected while in the second family, removing e disconnects the endpoints of e and leave them in separate connected components. We show that for the edge e, any LCA that 5Here, we state a simplified version of the rules. In particular, the rules are expressed in terms of clusters whose exact definitions are skipped for now. Refer to the longer version of our paper for the precise definitions of the rules. 6We connect two vertex sets by adding the unique lexicographically-first edge between the two vertex sets (if any exists) based on the vertex IDs of the endpoints. 8 makes o(min{√ n, n/d}) = o(min{√ n, n2/m}) probes can only distinguish whether the underlying graph is from the first family or the second family with probability 1/2 + o(1). Our approach mainly follows from the analysis of Kaufman et al. [24], on the lower bound construction of [27]. While [24] studies a rather different problem of bipartiteness testing, we √ consider similar probe types and obtain a similar lower bound as those of [24]. On the other hand, the construction of [27] shows the probe complexity of Ω( n) for LCAs for spanning graphs that only use Neighbor probes, not Adjacency probes. Theorem 1.3 (Lower Bound). Any local randomized LCA that computes, with success probability at least 2/3, a spanner of the simple undirected m-edge input graph G with o(m) edges, has probe complexity Ω(min{√ n, n2/m}). 1.3 Discussion We study LCAs for spanners and provide new tools for dealing with large degrees in the local model. We believe these tools should pave the way toward the design of new LCAs for dense graphs. We leave a number of remaining open questions, perhaps the most compelling of which is: Can we provide for general graphs, an LCA for (2k − 1) spanners, (cid:101)O(n1+1/k) edges and probe complexity (cid:101)O(n1−1/(2k))? Our tools already solve the problems in the dense regime or in the sparse regime7, but there is still an unknown regime to be explored. Aside for the LCA setting, our constructions raise some interesting thoughts regarding the notion of optimally in graph spanners. It is folklore to believe that with a budget of n1+1/k edges for our spanner, the best stretch that one can obtain is (2k − 1). However, a deeper look in the girth conjecture of Erdos reveals that this tightness holds only when the degrees are of the edge endpoints are at most c· n1/k. If one does not care about constant factors in the spanner size, then we can just pick these tight edges into the spanner and have a stretch 1 for them. We then ask: for a given budget of n1+1/k, what is the best stretch that can be obtained for an edge (u, v)? As we see in this paper, once the degrees of u or v are high, a stretch much better than 2k − 1 can be provided. It would be interesting to further understand the tradeoff between stretch, spanner size and the density of the input graph. 1.4 Model Definition and Preliminaries Graph notation. Throughout, we consider simple unweighted undirected graphs G = (V, E) on n = V vertices and m = E edges. Each vertex v is labeled by a unique O(log n)-bit value ID(v)8. For u ∈ V , let Γ(u, G) = {v : (u, v) ∈ E} be the neighbors of u, deg(u, G) = Γ(u, G) be its degree, and define Γ+(u, G) = Γ(u, G) ∪ {u}. Denote VI = {v ∈ V : deg(v, G) ∈ I} where I is an interval. For u, v ∈ V , let dist(u, v, G) be the shortest-path distance between u and v in G. Let Γk(u, G) = {v : dist(u, v, G) ≤ k} be the kth-neighborhood of u, and denote its size degk(u, G) = Γk(u, G). For subsets V1, V2 ⊆ V , let E(V1, V2) = E ∩ (V1 × V2). The parameter G may be omitted for the input graph. a fixed ordering, Γ(u) = {v(cid:48) 1, . . . , v(cid:48) ily sorted by vertex IDs). Many of the algorithms in this paper are based on partitioning the neighbor-list into balanced-size blocks. For ∆ ∈ [n] and u ∈ V such that deg(u) ≥ ∆, let deg(u)}; this ordering may be arbitrarily (e.g., not necessar- We assume that the input graph has an adjacency list representation: each neighbor set has 7Up to having stretch of O(k2) in the latter. Refer to Table 1 for more details on our results in those regimes. 8We do not require IDs to be a bijection V → [n] as in other LCA papers. 9 Γ∆,1(u), . . . , Γ∆,Θ(deg(u)/∆)(u) be blocks of neighbors obtained by partitioning Γ(u) into consec- utive parts. Each block is of size ∆, except possibly for the last block that is allowed to contain up to 2∆ vertices. Local Computation Algorithms. We adopt the definition of LCAs by Rubinfeld et al. [39]. A local algorithm has access to the adjacency list oracle OG which provides answers to the following probes (in a single step): • Neighbor probes: Given a vertex v ∈ V and an index i, the ith neighbor of v is returned if i ≤ deg(v). Otherwise, ⊥ is returned. The orderings of neighbor sets are fixed in advance, but can be arbitrary. • Degree probes: Given a vertex v ∈ V , return deg(v). This probe type is defined for con- venience, and can alternatively be implemented via a binary search using O(log n) Neigh- bor probes. • Adjacency probes: Given an ordered pair (cid:104)u, v(cid:105), if v ∈ Γ(u) then the index i such that v is the ith neighbor of u. Otherwise, ⊥ is returned. Definition 1.4 (LCA for Graph Spanners). An LCA A for graph spanners is a (randomized) algorithm with the following properties. A has access to the adjacency list oracle OG of the input graph G, a tape of random bits, and local read-write computation memory. When given an input (query) edge (u, v) ∈ E, A accesses OG by making probes, then returns YES if (u, v) is in the spanner H, or returns NO otherwise. This answer must only depend on the query (u, v), the graph G, and the random bits. For a fixed tape of random bits, the answers given by A to all possible edge queries, must be consistent with one particular sparse spanner. The main complexity measures of the LCA for graph spanners are the size and stretch of the output spanner, as well as the probe complexity of the LCA, defined as the maximum number of probes that the algorithm makes on OG to return an answer for a single input edge. Informally speaking, imagine m instances of the same LCA, each of which is given an edge of G as a query, while the shared random tape is broadcasted to all. Each instance decides if its query edge is in the subgraph by making probes to OG and inspecting the random tape, but may not communicate with one another by any means. The LCA succeeds for the input graph G and the random tape if the collectively-constructed subgraph is a desired spanner. All the algorithms in this paper are randomized and, for any input graph, succeed with high probability 1− 1/nc over the random tape. Paper Organization. In Section 2 and 3 we describe our results for 3 and 5-spanners in general graphs. For simplicity, we first describe all our randomized algorithms as using full independence, then in Section 5, we explain how these algorithms can be implemented using a seed of poly- logarithmic number of random bits). Next, in Section 4 we show the LCA of the O(k2)-spanners. Finally, in Section 6, we provide a lower bound result for a simpler task of computing a spanning subgraph with the specified probes. Clarification. Throughout we use the term "spanner construction" when describing how to con- struct our spanners. These construction algorithms are used only to define the unique spanner, based on which the LCA makes its decisions: we never construct the full, global spanner at any point. 2 LCA for 3-Spanners In this section, we present the 3-spanner LCA with probe complexity of (cid:101)O(n3/4). We begin in Section 2.1 by establishing some observations that allow us to "take care" of different types of edges 10 separately based on the degrees of their endpoints. In Section 2.2-2.3 we provide constructions that take care of each type of edges; the analysis of stretch, probe complexity and spanner size for each case is included in their respective sections. We establish our final LCA for 3-spanners in Section 2.4. 2.1 Edge classification Definition 2.1 (Subgraphs taking care of edges). For stretch parameter k and set of edges E(cid:48) ⊆ E, we say that the subgraph H(cid:48) ⊆ G takes care of E(cid:48) if for every (u, v) ∈ E(cid:48), dist(u, v, H(cid:48)) ≤ k. Observe that if we have a collection of subgraphs Hi's such that every edge in (u, v) ∈ E is taken care by at least one Hi, then the union H of the Hi's constitutes a k-spanner for G. Observation 2.2 (Spanner construction by combining subgraphs). For a collection of subsets E1, . . . , E(cid:96) ⊆ E where ∪i∈[(cid:96)]Ei = E, if Hi is a subgraph of G that takes care of Ei, then H = ∪i∈[(cid:96)]Hi is a k-spanner of G. Further, if we have an LCA Ai for computing each Hi (i.e., deciding whether the query edge (u, v) ∈ Hi and reporting YES or NO accordingly), we may construct a final LCA that runs every Ai and answer YES precisely when at least one of them does so. The performance of our overall LCA (number of edges, probes, or random bits) can then be bounded by the respective sum over that of Ai's. Note that Hi may contain edges of E that are not in Ei, thus it is necessary that the overall LCA invokes every Ai even if Ai does not take care of the query edge. Graph partitioning. A vertex v is low-degree if deg(v) ≤ √ n, it is high-degree if deg(v) ≥ √ n and it is super-high degree if deg(v) ≥ n3/4. Our LCA for 3-spanner assigns each edge of E into one or more of the subsets Elow, Ehigh, or Esuper based on the degrees of its endpoints, where Ehigh = {(u, v) ∈ E √ Elow = {(u, v) ∈ E min{deg(u), deg(v)} ≤ √ n < min{deg(u), deg(v)} ≤ n3/4}, and Esuper = E \ (Elow ∪ Ehigh). n}, Because vertices of degree at most n) = O(n3/2) incident edges in total, we may afford to keep all these edges, letting Hlow = (V, Elow). Thus, an LCA simply needs to check the degrees of both endpoints (via Degree probes), and answer YES precisely when both (or in fact, even one) have degrees at most n. From now on, assume that deg(u), deg(v) ≥ √ √ n. √ n have O(n · √ 2.2 3-spanner for the edges Ehigh √ n log n) by sampling vertex v ∈ V into S independently √ We pick a random center set S of size O( n). For now, we assume that given an ID of a vertex v, we can with probability p = Θ((log n)/ decide in O(1) time if v ∈ S. At the end of the section, we describe how to implement this using a seed of O(log n) random bits. For each endpoint v of Ehigh, let S(v) = Γ(cid:48)(v) ∩ S where Γ(cid:48)(v) is the √ n neighbors of v in Γ(v). By Chernoff bound we have that S(v) = Θ(log n) (and set of the first in particular, S(v) is non-empty). We call S(v) the multiple-center set of v. The algorithm adds to Hhigh the edges (v, s) connecting v to each of its centers s ∈ S(v). This adds a total of O(n log n) edges. Next, for every v with deg(v) = O(n3/4), the algorithm traverses its neighbor list Γ(v) = {u1, . . . , u(cid:96)} and adds the edges (ui, v) ∈ Ehigh to the spanner Hhigh only if ui belongs to a new cluster; i.e., ui has a center s ∈ S(ui) that no previous neighbor uj, j < i, has as its center in S(uj). √ n log n) Since the algorithm adds an edge whenever a new center is revealed and there are O( centers, the total number of edges added to the spanner is O(n3/2 log n). 11 We next describe the LCA that, given an edge (u, v) ∈ Ehigh, says YES iff (u, v) ∈ Hhigh. We √ assume throughout that deg(v) ≤ deg(u), so deg(v) = O(n3/4). First, by probing for the first n neighbors of u and v, one can compute the center-sets S(u) and S(v) each containing O(log n) centers in S. Next, the algorithm probes for all of v's neighbors Γ(v) = {u1, . . . , uj = u, . . . , u(cid:96)}. For every neighbor ui appearing before u in Γ(v), i.e., for every i < j, and for every center s ∈ S(u), the algorithm makes a cluster-membership test for s and ui. This cluster-membership test can be answered by making a single Adjacency probe on the pair (cid:104)ui, s(cid:105), namely s ∈ S(ui) only if s is n neighbors of ui. Eventually, the algorithm Ahigh answers YES only if there exists among the first √ i=1 S(ui). It is straightforwards to verify that the probe complexity is s(cid:48) ∈ S(u) such that s(cid:48) /∈(cid:83)j−1 (cid:101)O(deg(u) + √ n) = O(n3/4). Finally, we show that Hhigh is indeed a 3-spanner. For every edge (u, v) not added to the spanner, let s ∈ S(u) and let ui be the first vertex in Γ(v) satisfying s ∈ S(ui). By construction, (ui, v) ∈ Hhigh and also the edges (ui, s) and (u, s) are in the spanner Hhigh, providing a path of length 3 in Hhigh. See Figure 1 for an illustration of Hhigh. Figure 1: Illustration for the local construction of Hhigh. 2.3 3-spanner for the edges Esuper We proceed by describing the construction of the 3-spanner Hsuper that takes care of the edges Esuper. Let S(cid:48) be a collection of O(n1/4 log n) centers obtained by sampling each v ∈ V indepen- dently with probability p(cid:48) = Θ((log n)/n3/4). For each vertex v, define its center set S(cid:48)(v) to be the members of S(cid:48) among the first n3/4 neighbors of v, and if deg(v) ≤ n3/4, then S(cid:48)(v) = S(cid:48) ∩ Γ(v). First, as in the construction of Hhigh, the algorithm connects each v to each of its centers by adding the edges (u, s) for every u and s ∈ S(cid:48)(u) to the spanner Hsuper. Consider a vertex v and divide its neighbor list into consecutive blocks Γ1(v), . . . , Γ(cid:96)(v), each of size n3/4 (expect perhaps for the last block). In every block Γi(v) = {ui,1, . . . , ui,(cid:96)(cid:48)}, the algorithm adds the edge (v, ui,j) to the spanner Hsuper only if ui,j belongs to a new cluster with respect to all other vertices that appear before it in that block. Formally, the edge (v, ui,j) is added iff q≤j−1 S(cid:48)(ui,q). This completes the description of the √ construction. Observe that within each block, the LCA adds an edge for each new center. W.h.p., there are O(n/n3/4) = O(n1/4) blocks and S(cid:48) = O(n1/4 log n) centers, so O( n log n) edges are added for each v, yielding a spanner of size O(n3/2 log n). there exists s ∈ S(cid:48)(ui,j) such that s /∈ (cid:83) 12 𝑢𝑢𝑢𝑢𝑖𝑖𝑣𝑣cluster-membership testcheck if 𝑠𝑠∈𝑆𝑆𝑢𝑢𝑖𝑖𝑠𝑠𝑢𝑢,𝑣𝑣∈𝐸𝐸high?Γ𝑣𝑣size =Θ(log𝑛𝑛)size ≤𝑛𝑛3/4⋯⋯⋯compute thecenter set 𝑆𝑆𝑢𝑢𝑆𝑆𝑢𝑢 exists s /∈(cid:83) The LCA Asuper is very similar to Ahigh: the main distinction is that given an edge (u, v) with deg(u) ≥ n3/4, the algorithm Asuper will probe only for the block Γi(v) = {ui,1, . . . , ui,j = u, ui,(cid:96)(cid:48)} to which v belongs, ad will make its decision only based on that block. By probing for the degree of v, and the index j such that u is the jth neighbor of v, one can compute the block Γi(v) by making n3/4 Neighbor probes. In addition, by probing for the first n3/4 neighbors of both u and v, one can compute the multiple-center sets S(cid:48)(u) and S(cid:48)(v). Finally, the algorithm applies a cluster-membership test for each pair s ∈ S(cid:48)(u) and ui,q for q ≤ j − 1. It returns YES only if there q≤j−1 S(cid:48)(ui,q). Hence, the number of probes made by the LCA is w.h.p. bounded by Γi(v) · S(cid:48)(u) = O(n3/4 log n). We now show that Hsuper is a 3-spanner for the edges Hsuper. Let (u, v) be such that deg(u) ≥ n3/4 and let Γi(v) be the block in Γ(v) to which u belongs. Since deg(u) ≥ n3/4, w.h.p. S(cid:48)(u) = Θ(log n). Assume that (u, v) /∈ Hsuper. Fix s ∈ S(cid:48)(u) and let ui,q be the first vertex in Γi(v) that belongs to the cluster of s. Since (u, v) /∈ Hsuper, such a vertex ui,q is guaranteed to exist. The spanner Hsuper contains the edges (s, u), (s, ui,q) and (v, ui,q), thus containing a path of length 3 between u and v. See Figure 2 for an illustration of Hsuper. Figure 2: Illustration for the local construction of Hsuper. 2.4 The Final LCA Given an edge (u, v) the algorithm says YES if one of the following holds: • deg(u), deg(v) ≤ √ • u ∈ S(v) ∪ S(cid:48)(v) (or vice versa). • the local algorithm Ahigh says YES on edge (u, v). • the local algorithm Asuper says YES on edge (u, v). This completes the 3-spanner LCA from Theorem 1.1. n. Missing piece: computing centers in the LCA model. In the LCA model, we do not generate the entire set S (or S(cid:48)) up front. Instead, we may verify whether v ∈ S on-the-fly using v's ID by, e.g., applying a random map (chosen according to the given random tape) from v's ID to {0, 1} with expectation p. In fact, this hitting set argument does not require full independence -- the discussion on reducing the amount of random bits is given in Section 5, but for now we formalize it as the following observation. 13 𝑢𝑢𝑢𝑢𝑖𝑖,𝑞𝑞𝑣𝑣cluster-membership testcheck if 𝑠𝑠∈𝑆𝑆′𝑢𝑢𝑖𝑖,𝑞𝑞𝑠𝑠𝑢𝑢,𝑣𝑣∈𝐸𝐸super?size =Θ(log𝑛𝑛)⋯⋯⋯⋯⋯(ignore other blocks)#blocks ≤⁄𝑛𝑛𝑛𝑛⁄34=𝑛𝑛⁄14Γ𝑖𝑖𝑣𝑣size =𝑂𝑂𝑛𝑛⁄34compute thecenter set 𝑆𝑆′𝑢𝑢𝑆𝑆′𝑢𝑢 Observation 2.3 (Local Computation of Centers). Let S be a center set obtained by placing each vertex into S independently with probability p = Θ(log n/∆). W.h.p., S forms a hitting set for the collection of neighbor sets of all vertices of degree at least ∆. Further, under the LCA model, we may check whether v ∈ S locally without making any probes. 3 LCA for 5-Spanners We now consider LCAs for 5-spanners, aiming for spanners of size (cid:101)O(n4/3) with probe complexity (cid:101)O(n5/6). We start by noting that the construction of Hsuper for the 3-spanners in fact gives for every r ≥ 1, a 3-spanner of size (cid:101)O(n1+1/r) for the subset of edges (u, v) with min{deg(u), deg(v)} ≥ S(cid:48) = (cid:101)O(n1/(2r)) centers, and use block size n1−1/(2r). The probe complexity for querying the spanner is (cid:101)O(n1−1/(2r)). For 5-spanner, by taking r = 3, one takes care of all edges (u, v) with n1−1/(2r): this is achieved by instead setting the threshold for super-high degree at n1−1/(2r), pick max{deg(u), deg(v)} ≥ n5/6. Let ∆low = n1/r, ∆med = n1/2−1/(2r) and ∆super = n1−1/(2r). For the purpose of constructing 5-spanners for general graphs, we let r = 3, simplifying the thresholds to ∆low = ∆med = n1/3 and ∆super = n5/6.) Again, we may afford to keep all edges incident to some vertex of degree at most ∆low. For integers a ≤ b, let V[a,b] = {v ∈ V (G) deg(v) ∈ [a, b]}. We will design a subgraph H ⊆ G that will take care of the remaining edges Emed = E(V[∆med,∆super], V[∆med,∆super]). Definition 3.1 (Deserted and Crowded vertices). A vertex v ∈ V[∆med,∆super] is deserted if at least half of its neighbors in Γ∆med,1(v) are of degree at most ∆super; i.e., Γ∆med,1(v) ∩ V[1,∆super] ≥ ∆med/2. Otherwise, the vertex is crowded. Criteria for edges. We aim to take care of edges for which both endpoints are in V[∆med,∆super]. To categorize our edges for the purpose of constructing 5-spanners, we need the following partition of these vertices. Let Vdsrt (resp., Vcrwd) be the set of deserted (resp., crowded) vertices in V[∆med,∆super]. Given a vertex, we can verify whether it is in any of these sets using O(∆med) probes by checking the degrees of v and each vertex in Γ∆med,1(v). We then assign each (u, v) ∈ E into one of the four cases {low, bckt, rep, super} as given in the table below. It is straightforward to verify that when ∆low = ∆med (namely when we choose r = 3, which also yields the required performance), these four cases take care of all edges in E. We note that Hrep assumes that Hsuper is included: Erep is taken care by Hrep ∪ Hsuper, not by Hrep alone. Subset Criteria # Edges Probe Complexity O(n · ∆low) = O(n1+ 1 r ) O(1) O((∆super + ∆2 med) log2 n) = O(n1− 1 2r log2 n) O(∆super log3 n) = O(n1− 1 O(∆super log n) = O(n1− 1 2r log3 n) 2r log n) Elow Ebckt Erep Esuper (u, v) ∈ E(V, V[1,∆low]) (u, v) ∈ E(Vdsrt, Vdsrt) (u, v) ∈ E(V[∆med,∆super], Vcrwd) O( n2 · log n) = O(n1+ 1 r log n) O( n2 log2 n ) = O(n1+ 1 r log2 n) ∆2 med (u, v) ∈ E(V, V[∆super,n)) ∆super O( n3 log n ∆2 super ) = O(n1+ 1 r log n) Table 2: Edge categorization for the construction of 5-spanners. LCA for Ebckt: the cluster partitioning method. The algorithm is as follows. 14 • Only vertices of degree at most ∆super are chosen to be in S with probability p = Θ((log n)/∆med). Since at least half the vertices in Γ∆med,1(v) for any v ∈ Vdsrt have degree smaller than ∆super, we have that w.h.p. S(v) = Θ(log n) the cluster-membership test can be done with constant number of probes. Let us denote by C(s) = {s} ∪ {v : s ∈ S(v)} the cluster of center s. • The partitioning of clusters into buckets is defined in a consistent way (regardless of the given query edge); for instance, create a list of vertices in the cluster, sort them according to their IDs, divide the list into buckets of size ∆med possibly except for the last one. Note that we partition C(s) and C(t) separately -- we do not combine their elements. Similarly, once we obtain buckets containing u and v, the order in which we check the adjacency of u(cid:48) and v(cid:48) must be consistent. To this end, define the ID of an edge (u, v) as (ID(u),ID(v)), where the comparison between edge IDs is lexicographic. Thus, this step only adds the edge of minimum ID between the two clusters. • We also set the precondition (u, v) ∈ E(V[∆med,n), V[∆med,n)), and consistently only allow can- didate pairs (u(cid:48), v(cid:48)) ∈ E(V[∆med,n), V[∆med,n)), to ensure that the lexicographically first edge of this exact specification is added if one exists. We do not restrict to Ebckt, which require both endpoints to be deserted vertices, because checking whether (u(cid:48), v(cid:48)) ∈ Ebckt would take Θ(∆med) probes instead of constant probes. We restrict to edges whose endpoints have de- grees at least ∆med instead of considering the entire E so that S would be well-defined. is added to S with probability p = Local construction of Hbckt. Each v ∈ V[1,∆super] Θ(log n/∆med). (A) If u ∈ S(v) or v ∈ S(u), answer YES. (B) If (u, v) ∈ E(V[∆med,n), V[∆med,n)): • Compute S(u) and S(v) by iterating through Γ∆med,1(u) and Γ∆med,1(v). • For each pair of s ∈ S(u) and t ∈ S(v): -- Partition each of the clusters C(s) and C(t) into buckets of size (mostly) ∆med. Denote the buckets containing u and v by Bucket(u, s) and Bucket(v, t), respectively. -- Iterate through each pair of u(cid:48) ∈ Bucket(u, s) and v(cid:48) ∈ Bucket(v, t) and check if (u(cid:48), v(cid:48)) ∈ E(V[∆med,n), V[∆med,n)). Answer YES if the edge of minimum ID found is (u(cid:48), v(cid:48)) = (u, v). n ≤ ∆super ≤ n, there exists a subgraph Hbckt ⊆ G such that Lemma 3.2. For 1 ≤ ∆med ≤ √ w.h.p.: (i) Hbckt has O( n2 log2 n (ii) Hbckt takes care of Ebckt; that is, for every (u, v) ∈ Hbckt, dist(u, v, Hbckt) ≤ 5, and (iii) for a given edge (u, v) ∈ E, one can test if (u, v) ∈ Hbckt by making O((∆super + ) edges, ∆2 med ∆2 med) log2 n) probes. s∈S C(s) ≤ S +(cid:80) the total number of buckets. The total size of clusters (cid:80) Proof. (i) Size. In (A) we add S(v) = Θ(log n) edges for each v ∈ Vdsrt, which constitutes to O(n log n) edges in total. In (B), we add one edge between each pair of buckets. We now compute S(v) = O(n log n), so there can be up to O((n log n)/∆med) full buckets of size ∆med. As buckets are formed by partitioning S clusters, there are up to S = Θ((n log n)/∆med) remainder buckets of size less than ∆med. Thus, there are Θ((n log n)/∆med) buckets, and O(((n log n)/∆med)2) edges are added in (B). (ii) Stretch. Suppose that (u, v) is omitted. Fix centers s ∈ S(u) and t ∈ S(v), then the lexicographically-first edge (u(cid:48), v(cid:48)) ∈ E(Bucket(u, s), Bucket(v, t)) must have been added to Hbckt, forming the path (cid:104)u, s, u(cid:48), v(cid:48), t, v(cid:105) (or shorter, if there are repeated vertices), yielding dist(u, v, Hbckt) ≤ 5. v∈V[∆med,n) 15 (iii) Probes. Computing S(u) and S(v) takes O(∆med) probes. For each pairs of centers, we scan through the entire neighbor-lists Γ(s) and Γ(t) and collect all vertices in their respective clusters. This takes O(∆super) probes each because we restrict to centers of degree at most ∆super. Given the clusters, we identify the buckets containing u and v each of size O(∆med). We then check through candidates (u(cid:48), v(cid:48)) between these buckets, taking O(∆2 med) Adjacency probes. So, each pair of med) total probes. We repeat the process for S(u)·S(v) = O(log2 n) centers requires O(∆super +∆2 pairs of centers w.h.p., yielding the claimed probe complexity. Figure 3: Illustration for the local construction of Hbckt. Green lines show the partition of clusters into buckets. 1, . . . , x(cid:48) i : i ∈ Rv and deg(x(cid:48) deg(v)}, then define Reps(v) = {x(cid:48) LCA for Erep: the Representative method. We first explain the computation of the repre- sentative set Reps(v) for a croweded vertex v ∈ Vcrwd, i.e., a collection of neighbors of v that have degree at least n5/6. Using the random bits and the vertex ID, we sample a set Rv of Θ(log n) (not necessarily distinct) indices in [∆med] at random (for details, see Sec. 5). Denote the neighbor-list i) ≥ ∆super}. Then since of v by {x(cid:48) at least half of the vertices in Γ∆med,1(v) are of degree at least ∆super, w.h.p. Reps(v) (cid:54)= ∅. For consistency, we allow the same definition for Reps(v) for any v ∈ V[∆med,n) as well, even if it may result in empty sets of representatives. Hence computing Reps(v) takes O(log n) probes9. Let Esuper = {(u, v) ∈ E max{deg(u), deg(v)} ≥ n5/6} and apply the 3-spanner algorithm algorithm of Sec. 2 to construct a subgraph Hsuper that takes care of the edges Esuper. To construct Hsuper the algorithm (fully described10 in Sec. 2) samples a set S(cid:48) of centers by picking each v ∈ V independently with probability O(log n/n5/6). For every v with deg(v) ≥ n5/6, let S(cid:48)(v) be the sampled neighbors in S(cid:48) ∩ Γ1(v) where Γ1(v) is the first block of size n5/6 in Γ(v). This allows us to check membership to a cluster of s ∈ S(cid:48) using a single adjacency probe. The idea would be to extend the 1-radius clusters of S(cid:48) by one additional layer consisting of the crowded vertices connected to the cluster via their representatives. For convenience, for a crowded v, define RS(v) = ∪x(cid:48)∈Reps(v)S(cid:48)(x(cid:48)), the set of (multiple) centers of any of v's representatives. Observe that by adding the edge (v, x(cid:48)) to Hrep for every x(cid:48) ∈ Reps(v), it yields that dist(v, s, Hrep ∪ Hsuper) ≤ 2 for any s ∈ RS(v). 9The naıve solution traverses the entire ∆med first neighbors of v which is too costly. 10Upon replacing the degree threshold of n3/4 with n5/6. 16 𝑣𝑣′𝑡𝑢,𝑣∈𝐸bckt?Γ+𝑡C𝑡Γ+𝑠adjacency test to find and keep the edge with minimum ID𝑢′𝑢𝑠C𝑠(repeatfor every pair of centers of 𝑢,𝑣)size ≤𝑛5/6size ≤𝑛5/6total #buckets =𝑂𝑛log𝑛𝑛1/3= 𝑂𝑛 23Bucket𝑢,𝑠bucket size ≤𝑛1/3Bucket𝑣,𝑡 Consider the query (u, v), and suppose that v = v(cid:48) i) \ ∪j<iRS(v(cid:48) j}j<i, Reps(v(cid:48) j where x ∈ Reps(v(cid:48) i is the ith neighbor in u's neighbor-list, deg(u)}. We then add (u, v) to Hrep if and only if v introduces a new center j) (cid:54)= ∅. To verify this condition locally, j). Then, we discard (u, v) if for every j) and s ∈ S(cid:48)(x); the last condition takes Γ(u) = {v(cid:48) through some representative; that is, RS(v(cid:48) we first compute RS(v), and for each of {v(cid:48) center s ∈ RS(v), there exists x and v(cid:48) constant probes to verify. This gives the full LCA for constructing Hrep below. Local construction of Hrep. Each v ∈ V is added to S(cid:48) with probability p = Θ((log n)/∆super). (A) If v ∈ V[∆med,∆super] and u ∈ Reps(v), answer YES. (B) If u, v ∈ V[∆med,∆super]: • Compute RS(v). • Denote the neighbor-list of u by {v(cid:48) • For each vertex w ∈ {v(cid:48) • For each s ∈ RS(v), iterate to check for a vertex x in any of the Reps(w)'s obtained above, deg(u)}; identify i such that v = v(cid:48) i. i−1}, if w ∈ V[∆med,∆super], compute Reps(w). such that s ∈ S(cid:48)(x). Answer YES if there exists a vertex s where no such x exists. 1, . . . , v(cid:48) 1, . . . , v(cid:48) 1, . . . , v(cid:48) Figure 4: Procedure for the local construction of Hrep. and Lemma 3.3. For 1 ≤ ∆med ≤ ∆super ≤ n, there exists a subgraph Hrep ⊆ G such that w.h.p.: in (A) we add at most (cid:80) (i) Hrep has O(n2/∆super · log n) edges, (ii) Hrep∪Hsuper takes care of Erep; that is, for every (u, v) ∈ Erep, dist(u, v, Hrep∪Hsuper) ≤ 3, (iii) for a given edge (u, v) ∈ E, one can test if (u, v) ∈ Hrep by making O(∆super log3 n) probes. Reps(v) ≤ n · O(log n) = Proof. (i) Size. W.h.p., O(n log n). Similarly to the analysis of Hhigh, in (B) we add S(cid:48) = O((n log n)/∆super) edges per vertex u, so E(Hrep) = O(n2/∆super · log n). (ii) Stretch. This claim follows from the argument given in the overview, and is similar to the analysis of Hhigh. (iii) Probes. Computing RS(v) takes O(log n) · ∆super = O(∆super log n) (recall that we only check Γ∆super,1 of each reprsentative). Note also that RS(v) = O(log2 n) since v has O(log n) representative, each of which belongs to Θ(log n) clusters. Computing Reps for each neighbor j}j<i of u takes O(log n) probes each, which is O(∆super log n) in total since deg(u) ≤ ∆super. w ∈ {v(cid:48) This also introduces up to ∆super · O(log n) representatives in total. Checking whether each of the O(log2 n) centers in RS(v) is a center of each of these O(∆super log n) representative takes, in total w.h.p., O(∆super log3 n) probes. v∈V[∆med,∆super] Final 5-spanner results. To obtain an LCA for 5-spanners, we again invoke all of our LCAs for the four cases. Applying Lemma 3.2 and 3.3, we obtain the following LCA result for 5-spanner in general graphs. Theorem 3.4. For every n-vertex simple undirected graph G = (V, E) there exists an LCA for 5-spanner with O(n4/3 log2 n) edges and probe complexity O(n5/6 log3 n). Again, by combining results for larger degrees, we obtain an LCA for 5-spanners with smaller sizes on graphs with minimum degree at least n1/2−1/(2r). 17 Figure 5: Illustration for the local construction of Hrep. Theorem 3.5. For every r ≥ 1 and n-vertex simple undirected graph G = (V, E) with minimum degree at least n1/2−1/(2r), there exists a (randomized) LCA for 5-spanner with O(n1+1/r log2 n) edges and probe complexity of O(n1−1/(2r) log3 n). 4 LCA for O(k2) Spanners In this section, we prove Theorem 1.2 by showing LCAs for O(k2) spanners and (cid:101)O(n1+1/k) edges. cost of increasing the number of spanner edges from Θ(n) to (cid:101)O(n1+1/k). Second, we show how to The solution is inspired by the result of Lenzen and Levi [25] and it is extended in two major aspects. First, we improve upon the stretch factor of the constructed spanner from O(log n · (∆ + log n)) down to O(k2) for any k ≥ 1, thereby removing the dependencies on ∆ and n completely, at the implement a key part of their algorithm using a collection of k bounded independence hash functions to reduce the number of random bits (kept at each machine) from linear to only polylogarithmic in n. We also remark that the probe complexity in our construction is improved by a factor of ∆ compared to [25]. 4.1 High-level Overview We now provide some preliminaries and an outline of our O(k2)-spanner construction. Throughout the main part of this section, we fix two parameters L = Θ(n1/3) and p = Θ(log n/L). We only need to consider k = O(log n) because, by the size-stretch tradeoff of spanners, any k = Ω(log n) yields a spanner of (roughly) linear size, (cid:101)O(n1+1/k) = (cid:101)O(n). We note that LCAs in this section Sparse and dense vertices. We first sample a collection S of O((n log n)/L) = (cid:101)O(n2/3) centers, only make use of the Neighbor probes. which is implemented locally by having each vertex elect itself as a center with probability p. We remark that we never explicitly enumerate the entire set S, but only rely on the fact that we may locally determine whether a given vertex v is a center based on its ID and the randomness, without 18 𝑣𝑣𝑣𝑣𝑗𝑗′𝑢𝑢cluster-membership testcheck if 𝑠𝑠∈𝑆𝑆′𝑥𝑥for some 𝑥𝑥∈Reps(𝑣𝑣𝑗𝑗′)𝑥𝑥′𝑢𝑢,𝑣𝑣∈𝐸𝐸rep?Γ𝑢𝑢size =Θ(log2𝑛𝑛)size ≤𝑛𝑛5/6⋯⋯⋯𝑠𝑠𝑥𝑥⋯⋯Reps𝑣𝑣Reps𝑣𝑣𝑗𝑗′size =Θlog𝑛𝑛computeReps𝑣𝑣computeReps𝑣𝑣𝑗𝑗′compute all thecenter sets 𝑆𝑆′𝑥𝑥′of 𝑥𝑥′∈Reps(𝑣𝑣)𝑅𝑅𝑆𝑆𝑣𝑣 using any probes. Next, we partition our vertices into sparse and dense vertices with respect to the center set S based on their distances to the respective closest centers: a vertex v is considered sparse if it is at distance more than k away from all centers, and it is dense otherwise. By a hitting set argument, if the kth-neighborhood of v is of size at least L, then it most likely contains a center, making v a dense vertex. This observation suggests that to verify that a vertex is dense, we do not necessarily need to find some center in v's potentially large kth-neighborhood: it also suffices to confirm that the neighborhood itself is large. Definition 4.1 (Sparse and dense). A vertex v is sparse in G if Γk(v, G) ∩ S = ∅ and otherwise, it is dense. Denote the sets of sparse vertices and dense vertices by Vsparse and Vdense, respectively. We next partition the edge set of G into Esparse = E(V, Vsparse) and Edense = E(Vdense, Vdense), then take care11 of them by constructing Hsparse ⊆ Esparse and Hdense ⊆ Edense, so that H = Hsparse ∪ Hdense gives a spanner for all edges of G. See Table 3 for a summary of the properties of each spanner. Subset Criteria Spanner Edges # Edges Probe Complexity Esparse at least one endpoint is sparse Edense both endpoints are dense Hsparse H (I) dense H (B) dense O(kn1+1/k) O(n) O(∆2L2) O(∆2L2) O(n1+1/k log4 n) O(p∆4L3 log n) Table 3: Edge categorization for the construction of O(k2)-spanners, with respective spanner sizes and probe complexities. The outline of the construction is given as follows. For convenience, tables of various probe complexities for computing Hsparse and Hdense are provided: Table 4 (page 22) and Table 5 (page 24), respectively. Taking care of Esparse. (Section 4.2) Attempting to leverage the clustering approach, we need to partition our vertices based on their distances to S. However, some vertices can be very far from all centers: connecting them to their respective closest centers would still incur a large stretch factor. We observe that every sparse vertex v has a small kth-neighborhood: degk(v, G) = Γk(v, G) = O(L) (hence the name "sparse"). Thus, we may test whether some vertex v is sparse by simply examining up to O(L) vertices closest to it, using O(∆L) probes. To take care of sparse vertices' incident edges Esparse, we can then afford to identify the query edge's endpoints' kth-neighborhoods and simulate a k-round distributed (2k − 1)-spanner algorithm on the subgraph Gsparse = (V, Esparse). We locally obtain our spanner Hsparse of Gsparse using O(∆2L2) probes. Partitioning of dense vertices into Voronoi cells. (Section 4.3.1) In the subgraph induced by dense vertices Gdense = (Vdense, Edense), all vertices are at distance at most k from some center. We partition them into Voronoi cells by connecting each of them to its closest center. We show that each dense vertex can find its shortest path to its center in O(∆L) probes. Building on this subroutine, we straightforwardly connect vertices within each Voronoi cell to their center via these shortest paths, forming a Voronoi tree of depth at most k, which in turn bounds the diameter of every Voronoi cell in our spanner by 2k. In particular, our construction improves upon the 11As a reminder, to "take care" of an edge (u, v), we ensure that in the constructed spanner, there is a u-v path whose length is at most the desired stretch factor. See Definition 2.1 for its formal definition. 19 construction of [25] that provides a diameter bound of O(∆ + log n). We denote by H (I) of Voronoi tree edges, as each tree spans vertices inside the same Voronoi cell. dense the set Refining Voronoi cells into small clusters. (Section 4.3.2) Naturally as our next step, we would like to consider our Voronoi cells as "supervertices," and connect them via an O(k)-spanner with respect to this "supergraph". However, determining the connectivity in this supergraph is impossible in sub-linear probes, as a Voronoi cell may contain as many as Θ(n) vertices. To handle this issue, we define a local rule based on the subtree sizes of the Voronoi tree, which refines our Voronoi cells. We show that this rule partitions the dense vertices into (cid:101)O(n/L) clusters of size O(L) each, such that each vertex can identify its entire cluster using O(∆3L2) probes. dense, using (cid:101)O(∆4L2) probes: the union Hdense = H (I) Connecting between Voronoi cells through clusters. (Section 4.3.3) We then formalize local criteria for connecting Voronoi cells (through clusters), forming the set of spanner edges between clusters, H (B) dense is the desired spanner of Gdense. For any omitted edge between clusters, H (B) dense contains a path connecting the endpoints' Voronoi cells that, w.h.p., visits only O(k) other Voronoi cells along the way. Since each Voronoi cell has a 2k-diameter spanning Voronoi tree in H (I) dense, Hdense achieves the desired O(k2) stretch factor. The rules for choosing H (B) dense are based on marking (cid:101)O(n1/3) random Voronoi cells along with the clusters therein, then adding at most (cid:101)O(n1/k) edges per each pair of cluster and marked cluster, using a total of (cid:101)O(n1+1/k) edges. Sections 4.3.4-4.3.5 formalize these ideas into an efficient LCA, dense ∪ H (B) then show the desired properties of the constructed Hdense and wrap up the proof, respectively. Reducing the required amount of independent random bits. For simplicity, our analysis in this section uses a linear number of independent random bits. This assumption for the above construction is deferred to Section 5, where we provide an implementation using only O(log2 n) independent random bits. 4.2 LCA for computing a (2k − 1)-spanner Hsparse for Esparse Checking if a vertex is sparse or dense. We first propose a variant of the breadth-first search (BFS) algorithm that, when executed starting from a vertex v, either finds v's center or verifies that v is sparse. We justify the necessity to employ a different BFS variant from that of the prior works, namely [28, 25], as follows. In these prior works, the BFS algorithm explores all vertices in an entire level of the BFS tree in each step until some center is encountered, and chooses the center with the lowest ID among them. This distance tie-breaking rule via ID directly ensures that the set of vertices choosing the same center induces a connected component in G12. We have shown before that it suffices to explore L vertices closest to a dense vertex v in order to discover some center. However, to choose v's center via the above approach, we must explore the entire last level of the BFS tree in order to apply the tie-breaking rule: this last level may contain as many as Θ(∆L) vertices. Instead, we aim to further reduce a factor of ∆ from the probe complexity by designing a BFS algorithm that picks the first center it discovers as v's center: this center may not be the lowest-ID center in that level. The desired connectivity guarantee does not trivially follow under this rule, and will be further discussed in Section 4.3.1; for now we focus on Gsparse. We provide our BFS variant as follows. Note that Q denotes a first-in first-out queue, and D denotes the set of discovered vertices. We say that the BFS algorithm discovers a vertex w when 12If v chooses s at distance d as its center, and another vertex u is at distance d(cid:48) < d from s, then u must (u, G), and there are no other centers in also choose s because s is the center of minimum ID in Γd(v, G) ⊃ Γd(cid:48) Γd−1(v, G) ⊃ Γd(cid:48)−1(u, G). 20 w is added to D. BFS variant of a search for centers starting at vertex v Q.enqueue(v), D.add(v) while Q is not empty u ← Q.dequeue probe for all neighbors Γ(u, G) of u for each w ∈ Γ(u, G) \ D in the increasing order of IDs Q.enqueue(w), D.add(w) (cid:66) w is discovered Figure 6: BFS variant for finding centers. Denote by Dk L(v) would be the set D upon termination.) Note that Dk L(v) the set of the first L vertices discovered by the BFS variant, restricting to vertices at distance at most k from v. (Equivalently speaking, if we adjust the BFS algorithm above so that it also terminates as soon as we have discovered L vertices or dequeued a vertex at distance L(v, G) ⊆ Γk(v, G), and k from v, then Dk the containment is strict when degk(v, G) > L. BFS probe complexity. Recall that each vertex elects itself as a center with probability pcenter = (ccenter log n)/L. We choose a sufficiently large constant ccenter so that, by the hitting set argument, L(v, G) = L. That is, w.h.p., every vertex v with w.h.p., Dk degk(v, G) ≥ L must be dense. Equivalently: Observation 4.2. W.h.p., for every sparse vertex v, degk(v, G) < L. L(v, G) ∩ S (cid:54)= ∅ for every v with Dk This observation leads to a subroutine for verifying whether a vertex v is sparse or dense based L(v, G): on Dk Claim 4.3. v is sparse if and only if both of the following holds: Dk ∅. Proof. (Sparse) If v is sparse (Γk(v, G)∩ S = ∅), then by Obs. 4.2, degk(v, G) < L, so Dk Γk(v, G) and both conditions follow. Dk L(v, G) = (Dense) If v is dense (Γk(v, G) ∩ S (cid:54)= ∅), we assume L(v, G) < L and Dk L(v, G) ∩ S = Γk(v, G) ∩ S (cid:54)= ∅. L(v, G)∩S = L(v, G) < L, then Dk To compute Dk L(v, G) = Γk(v, G) and hence Dk L(v, G) we must discover (up to) L distinct vertices. Recall that we always probe for all neighbors of a vertex at a time. Observe that for any positive integer (cid:96), among the neighbor sets of (cid:96)−1 vertices in the same connected component of size at least (cid:96), at least one must necessarily contain an (cid:96)th vertex from the component. Inductively, probing for all neighbors of (cid:96) − 1 vertices during the BFS algorithm must reveal at least (cid:96) vertices unless the entire component containing v is exhausted. Hence, we conclude that we only need to probe for all neighbors of L − 1 vertices during our BFS in order to compute Dk Local simulation of a distributed spanner algorithm. We construct a (2k − 1)-spanner Hsparse ⊆ Esparse via a local simulation of a k-round distributed algorithm for constructing spanners on the subgraph Gsparse. Since we also want the randomized algorithm to operate on O(log n)-wise independence random bits, we will use the distributed construction of Baswana and Sen [5] with bounded independence [10]: L(v, G), requiring O(∆L) probes in total. Theorem 4.4 (From [5, 10]). There exists a randomized k-round distributed algorithm for comput- ing a (2k−1)-spanner H with O(kn1+1/k) edges for the unweighted input graph G. More specifically, 21 Subroutine Probe complexity determine whether v is a center none L(v, G), and test whether v ∈ Vsparse or v ∈ Vdense O(∆L) O(∆2L) compute Dk for (u, v) ∈ Esparse, compute Γk(u, G) and Γk(v, G) test (u, v) ∈ Esparse whether (u, v) ∈ Hsparse O(∆2L2) Table 4: Probe complexities of various subroutines used for computing Hsparse. for every (u, v) ∈ H, at the end of the k-round procedure, at least one of the endpoints u or v (but not necessarily both) has chosen to include (u, v) in H. Moreover, this algorithm only requires O(log n)-wise independence random bits. For a query edge (u, v), we first verify that at least one of u or v is sparse; otherwise we handle it later during the dense case. Without loss of generality, assume that v is sparse. To simulate the distributed algorithm on Gsparse for vertex v, we first learn its kth-neighborhood Γk(v, G), and collect all the induced edges therein. We then verify every vertex in Γk(v, G) whether it is dense or sparse, so that we can determine the edges that also appear in Esparse, and simulate the distributed algorithm as if it is executed on Gsparse accordingly. According to the description of the distributed algorithm's behavior, for a query edge (u, v), we need to simulate this algorithm on both u and v, requiring the knowledge of both Γk(u, G) and Γk(v, G). Since v is sparse and Γk(u, G) ⊆ Γk+1(v, G), we have Γk(u, G) ≤ Γk+1(v, G) ≤ ∆ · Γk(v, G) < ∆L by Obs. 4.2. So, we need O(∆2L) Neighbor probes to compute the subgraph of G induced by Γk(u, G) and Γk(v, G). We must also test up to O(∆L) vertices to determine whether they are sparse or not, so our simulation process requires O(∆2L2) probes in total. We conclude the analysis of our LCA for computing Hsparse as the following lemma; see Table 4 for a summary of probe complexities. Lemma 4.5 (Hsparse properties and probe complexity). For any stretch factor k ≥ 1, there exists an LCA that w.h.p., given an edge (u, v) ∈ E, decides whether (u, v) ∈ Hsparse using probe complexity O(∆2L2), where Hsparse is a k-spanner of Gsparse with O(kn1+1/k) edges. 4.3 LCA for computing an O(k2)-spanner Hdense for Edense Recall that Vdense = V \ Vsparse is the collection of dense vertices characterized as Γk(v, G) ∩ S (cid:54)= ∅, and can be verified by computing Dk L(v, G) with O(∆L) probes. We will now take care of Edense = E(Vdense, Vdense) by constructing an O(k2)-spanner Hdense ⊆ Edense so that H = Hsparse ∪ Hdense becomes the desired spanner of G. To do so, we follow the general approach of Lenzen and Levi [25] with several keys modifications along the way. Table 5 keeps track of the probe complexities for various useful operations for constructing Hdense. In the following, we show how to partition the dense vertices into Voronoi cells, and connect vertices in each cell via a low-depth tree structure in Section 4.3.1. We then show how to subdivide Voronoi cells into clusters of size O(L) in Section 4.3.2, and discuss how we connect them into the desired spanner in Sections 4.3.3-4.3.5. We denote the set of spanner edges connecting vertices inside dense∪H (B) Voronoi cells by H (I) dense. dense, and edges connecting between clusters by H (B) dense, so Hdense = H (I) 22 4.3.1 Partitioning of dense vertices into Voronoi cells We partition the dense vertices into S = O((n log n)/L) = O(n2/3 log n) Voronoi cells with respect to centers si ∈ S, where each dense vertex v chooses the first center si that it discovers when executing the proposed BFS variant. We denote by c(v) the center of v, and Vor(s) the Voronoi cell centered at s, consisting of all vertices that choose s as its center. Order of vertex discovery in BFS. Clearly, the vertices are discovered in increasing distance from v. We claim that the distance ties are broken according to their lexicographically-first shortest path from v (with respect to vertex IDs).13 More formally, let π(v, u) denote the lexicographically- first shortest path from v to u in G, and π(v, u) denote its length (namely dist(v, u, G), the number of edges in the shortest v-u path). We claim that the BFS from v discovers u before u(cid:48) if either π(v, u) < π(v, u(cid:48)), or π(v, u) = π(v, u(cid:48)) and π(v, u) ≺ π(v, u(cid:48)): assuming the induction hypothesis that vertices at the same distance d from v are discovered (enqueued) in this lexicographical order, we dequeue them in the same order, then enqueue the neighbors of each vertex in the order of their IDs, proving the hypothesis for distance d + 1. Connectedness of each Voronoi cell on G. To prove that every Vor(si) induces a connected component in G, consider a vertex v and its shortest path π(v, c(v)) = (cid:104)v0 = v, v1, . . . , vd−1, vd = c(v)(cid:105): we show that all vertices in this path are in Vor(si). Assume the contrary: let u = vi be the first vertex on π(v, c(v)) choosing a different center c(u) via π(u, c(u)) = (cid:104)vi = u, v(cid:48) d = c(u)(cid:105); note that π(u, c(u)) = d − i + 1 because there is no center in Γd−1(v, G) ⊃ Γd−i(u, G). Then we have that (cid:104)vi, v(cid:48) i+1, . . . , v(cid:48) d = c(u)(cid:105) ≺ π(v, c(v)), a contradiction. Construction of depth-k trees spanning Voronoi cells. We straightforwardly connect each v to its center s = c(v) via the edges of π(v, s). Observe that due to the lexicographic condition, the vertex after v on π(v, s) must be the vertex of the minimum ID in Γ(v, G) ∩ Γπ(v,s)−1(s, G); that is, each vertex v ∈ Vor(s) has a fixed "next vertex" to reach s. Consequently, the union of edges in π(v, s) for every v ∈ Vor(s) forms a tree rooted at s, where every level d contains vertices at distance exactly d away from s. d(cid:105) ≺ (cid:104)vi, vi+1, . . . , vd(cid:105), yielding (cid:104)v0 = v, . . . , vi = u, v(cid:48) i+1, . . . , v(cid:48) d−1, v(cid:48) i+1, . . . , v(cid:48) Due to the resulting tree structure, we henceforth refer to the constructed subgraphs spanning the Voronoi cells as Voronoi trees. The union of these trees forms the spanner edge set H (I) dense. As our BFS variant for finding a center terminates after exploring radius k, our Voronoi trees are also of depth at most k, or diameter at most 2k, as desired. Lastly, by augmenting our proposed BFS variant to record the BFS tree edges, we can also retrieve the Voronoi tree path π(v, s) using O(∆L) probes. In particular, (u, v) is a Voronoi tree edge if u is on π(v, c(v)) or v is on π(u, c(u)), implying the following lemma. Lemma 4.6 (H (I) dense properties and probe complexity). There exists a partition of dense vertices v ∈ Vdense into O((n log n)/L) Voronoi cells {Vor(s)}s∈S according to their respective first-discovered centers c(v) under the provided BFS variant. The set of edges H (I) dense, defined as the collection of lexicographically-first shortest paths π(v, c(v)), forms Voronoi trees, each of which spans its corre- sponding Voronoi cell and has diameter at most 2k. Further, there exists an LCA that w.h.p., given an edge (u, v) ∈ E, decides whether (u, v) ∈ H (I) dense using O(∆L) probes. 13Between paths of the same length d, (cid:104)v0, . . . , vd(cid:105) ≺ (cid:104)u0, . . . , ud(cid:105) if, for the minimum index i such that vi (cid:54)= ui, ID(vi) < ID(ui). 23 Subroutine verify that v ∈ Vdense, choose c(v), and compute π(v, c(v)) verify if a given edge (u, v) is a Voronoi tree edge (i.e., (u, v) ∈ H (I) dense) compute all children of v in the Voronoi tree T (c(v)) verify whether v is heavy or light, and determine T (v) when v is light Probe complexity O(∆L) O(∆2L) O(∆2L2) O(∆3L2) compute the entire cluster containing v given an entire cluster A, compute c(∂A) and E(A, Vor(s)) for any s ∈ c(∂A) O(∆2L2) test (u, v) ∈ Edense whether (u, v) ∈ Hdense Table 5: Probe complexities of various subroutines used for computing Hdense. This table addresses u, v ∈ Vdense, but these probe complexities do not assume that the LCA originally knows that u and v are dense. O(p∆4L3 log n) 4.3.2 Refinement of the Voronoi cell partition into clusters We now further partition the Voronoi cells into clusters, each of size O(L). Our cluster structure is based on the construction of [25] but has two major differences. First, whereas in [25] the Voronoi cells are partitioned into Θ(∆n/L) clusters, in our algorithm we need the number of clusters to be independent of ∆, and more specifically bounded by O((n log n)/L). Second, unlike the clusters in [25] that are always connected in G, each of our clusters may not necessarily induce a connected subgraph of G; they are still connected in the spanner via H (I) dense, namely by the Voronoi tree of diameter at most 2k. Refinement of Voronoi cells into clusters. For s ∈ S, let T (s) denote the Voronoi tree spanning Vor(s). We extend this notation for non-centers, so that T (v) ⊆ T (s) denote the subtree of T (s) rooted at v ∈ Vor(s). For every v ∈ Vor(s), let p(v) denote the parent of v in T (s), and T (v) be the number of vertices in the subtree. We define heavy and light vertices as follows. Definition 4.7 (Heavy and light vertices). A dense vertex v is heavy if T (v) > L and otherwise, it is light. We are now ready to define the cluster of v ∈ Vor(s) using the heavy and light classification. all vertices in Vor(s) form the cluster centered at s. (a) s is light: That is, the Voronoi cell containing v, Vor(s), contains at most L vertices. Then, (b) v is heavy: Then the cluster of v is the singleton cluster {v}. (c) s is heavy and v is light: Let u be the first heavy vertex on π(v, s), and W = {w : p(w) = u and w is light} be the set of u's light children on the Voronoi tree. Consistently ordering the vertices W = {w1, . . . , w(cid:96)} (e.g., according to the adjacency-list order from u), we iterate through these wi's, grouping T (wi)'s into clusters of sizes between L and 2L; the last remaining cluster is allowed to have size strictly less than L. See Figure 7 for an illustration of this rule. Clearly each cluster contains at most 2L = O(L) vertices, and any pair of vertices in the same cluster has a path of length at most 2k on T (s) because they belong to the same Voronoi cell. Next, we show that the number of clusters resulting from this refinement is not asymptotically larger than the number of Voronoi cells. Claim 4.8. The number of clusters is O((n log n)/L) = O(n2/3 log n). Proof. Recall that there are S = O((n log n)/L) Voronoi cells: this bounds the number of clusters of type (a). Observe that in any fixed level, among all Voronoi trees, there can be at most n/L 24 Figure 7: Illustration for cluster partitioning rule (c). The interesting part of the Voronoi tree T (s) is shown: heavy vertices are denoted with double borderlines, and thick edges are edges of π(v, s). Shaded areas are clusters: observe that heavy vertices form singleton clusters, while many clusters do not induce a connected subgraph of T (s). In this example, u is the first heavy ancestor of v, so we compute all light children W = {w1, . . . , w6} of u, along with their subtree sizes T (wi)'s. (For the heavy children, it suffices to only verify that they are heavy.) We group these T (wi)'s into clusters of sizes in [L, 2L], except possibly for the remainder cluster (T (w5) ∪ T (w6) in this case). Here, v's cluster is T (w3) ∪ T (w4). heavy vertices because these heavy vertices' subtrees are disjoint. Since the Voronoi tree has depth k, there are at most kn/L heavy vertices, bounding the number of clusters of type (b). We only subdivide the subtrees of heavy vertices into clusters, and within each such subtree, all clusters, except for at most one, have size at least L. Hence, there can be up to n/L clusters of size at least L, and kn/L clusters of smaller sizes (one for each heavy parent), establishing the bound for clusters of type (c). Thus, there are in total at most O((n log n)/L) + (2k + 1)n/L = O((n log n)/L) clusters (as we only consider k = O(log n)). Probe complexity for identifying a vertex's cluster. Recall that via our BFS variant we can find the center s and the path π(v, s) for a dense vertex v ∈ Vor(s) using O(∆L) probes. We begin by establishing the probe complexity for deciding whether v is light or heavy. Observe that we can find all children of v on T (s) using O(∆2L) probes: run the BFS on all neighbors of v, then any w with center s such that π(w, s) passes through v is a child of v. Using this subroutine, we traverse the subtree T (v) to compute T (v) if v is light, or stop after L+1 and declare that v is heavy. Since O(L) vertices are investigated, the probe complexity for this process is O(L)· O(∆2L) = O(∆2L2). We can then compute v's cluster as follows. If v is heavy then we have {v} as the cluster of type (b). Otherwise, we follow the path π(v, s) up the Voronoi tree, one vertex at a time, and check each vertex's subtree size until we reach some heavy ancestor u of v; if there is no such u then the entire Vor(s) is the cluster of type (a). During this process of traversing up the Voronoi tree, we also record every computed subtree size, so that we do not need to revisit any subtree. Hence, finding the first heavy ancestor u essentially only requires visiting O(L) descendants of u, which only takes O(∆2L2) probes. Once we detect u, we check each of u's children if it is light, and compute its subtree size correspondingly. Using this information, we determine all subtrees that form the cluster of type (c) containing v, as desired. This last case dominates the probe complexity: since we must 25 >𝐿>𝐿>𝐿⋯heavy vertexlight vertexcluster𝑢𝑠⋯⋯𝑣𝑤1𝑤2𝑤3𝑤4𝑤5𝑤6 check whether each of u's children is heavy or light, our algorithm require ∆· O(∆2L2) = O(∆3L2) probes to identify v's entire cluster. The following lemma concludes the properties of the cluster partitioning of dense vertices. Lemma 4.9 (Probe complexity for computing clusters). There exists a refinement of the Voronoi cell partition into O((n log n)/L) clusters of size O(L) each. Further, there exists an LCA that w.h.p., given a dense vertex, compute all vertices in the cluster containing v using O(∆3L2) probes. 4.3.3 Overview: connecting Voronoi cells The supergraph intuition. To establish some intuition for connecting the Voronoi cells while maintaining a low stretch factor, let us imagine constructing an LCA for a supergraph, where each now act as the centers in this supergraph. In the constructed spanner, we keep superedges between adjacent Voronoi cells according to the following three rules. Rule (1): we keep all superedges incident to a marked supervertex. There are of Voronoi cells are merged into a single superedge. Leveraging the classic clustering approach, to compute a spanner on this supergraph, we mark each supervertex independently with probability of the S = (cid:101)O(n/L) = (cid:101)O(n2/3) Voronoi cells is a supervertex, and all edges between the same pair p = n−1/3, so roughly (cid:101)O(pn/L) = (cid:101)O(n1/3) supervertices are marked. These marked supervertices (cid:101)O(n2/3) supervertices in total, and (cid:101)O(n1/3) supervertices are marked, contributing to (cid:101)O(n) total neighbors: if they had more than (cid:101)O(n1/3) neighboring Voronoi cells, then w.h.p., one of them would (cid:101)O(n) via the same analysis as that of rule (1). have been marked. Lastly, rule (3): for each (not necessarily adjacent) pair of a supervertex a and a marked supervertex c, we keep a superedge from a to a single common neighbor b∗ ∈ Γ(a) ∩ Γ(c) -- by consistently choosing b∗ with the lowest ID, for instance. The number of added superedges is superedges. Rule (2): we can also keep incident superedges of supervertices without any marked We claim that connectivity is preserved: consider an omitted superedge (a, b). Since rule (2) does not keep (a, b), b has some marked neighbor c. By rule (3), there exists some b∗ ∈ Γ(a)∩ Γ(c) with lower ID than b, such that (a, b∗) is kept by the LCA. Recall that c is marked, so combining with rule (1), the spanner path (cid:104)a, b∗, c, b(cid:105) connects a and b, as desired. Thus, an LCA, given a query (a, b), keeps this superedge if there exists a supervertex c ∈ Γ(b) where b has the minimum ID among Γ(a) ∩ Γ(c), producing a 3-spanner of the supergraph with (cid:101)O(n) superedges. However, such a supergraph-level approach cannot be implemented efficiently under the cluster refinement in the original input graph. Recall the original graph before the Voronoi cell contraction: the LCA is only given a vertex (query edge's endpoint) in the Voronoi cell, and we cannot afford to enumerate all vertices in the entire Voronoi cell (supervertex b) and identify all of its neighboring Voronoi cells (supervertex c) -- finding the Voronoi cell b∗ of minimum ID is outright impossible in sub-linear probes. Nonetheless, we construct an LCA based on this approach despite incomplete information of the supergraph. Local implementation based on clusters. Employing the developed cluster refinement, as we mark a Voronoi cell, we also mark the clusters therein. We will show that the number of clusters (resp., marked clusters), do not significantly increase from the number of Voronoi cells (resp., marked Voronoi cells); hence, we may still add an edge from every cluster that is (1) marked, or (2) not adjacent to any marked clusters, to all adjacent Voronoi cells, modularly imitating the corresponding supergraph rules while still using (cid:101)O(n) edges. Nonetheless, attempting to implement rule (3) poses a problem because the LCA can only see the clusters containing the query edge's endpoints (while keeping the desired probe complexity). From them, we can only find out the Voronoi cells neighboring these clusters -- not all Voronoi cells neighboring to the current Voronoi 26 cell may be visible to the LCA. Due to this limitation, we cannot implement rule (3) which requires knowing all of b and c's neighboring Voronoi cells. To resolve this problem, [25] observes that the desired connectivity is still preserved if the LCA implements a variation of rule (3) that only checks the neighboring Voronoi cells of the queried cluster in b and a canonical cluster in c. Recall that the LCA must answer "is the superedge (a, b) in the spanner?" We need to show that a and b are connected under this rule, so if the LCA keeps (a, b) then we are done. Otherwise (a, b) is omitted, which implies that there exists a marked Voronoi cell c and a Voronoi cell b(cid:48) ∈ Γ(a)∩ Γ(c) with ID(b(cid:48)) < ID(b), such that there exists a path (cid:104)b, c, b(cid:48)(cid:105) in the spanner thanks to rule (1). Hence, it suffices to show that a and b(cid:48) are connected in the spanner. Since the supergraph contains the superedge (a, b(cid:48)) (because b(cid:48) ∈ Γ(a)), we will inductively rely on how the LCA ensures connectivity between a and b(cid:48) when it handles the query (a, b(cid:48)). So far, we have only managed to defer the original burden of proving the connectivity between a and b to the LCA's answer to the question "is the superedge (a, b(cid:48)) in the spanner?" Again, even if b(cid:48) indeed has the minimum ID among Γ(a) ∩ Γ(c), the LCA may not perceive this fact when it cannot see all of b(cid:48)'s neighboring Voronoi cells, notably c. Still, we have progress: the Voronoi cell b(cid:48) in question has a lower ID than b. Thus we may repeat this same argument inductively on the ID of a's neighbor, which strictly decreases at each step -- this argument will eventually terminate (albeit possibly in as many as Θ(S) steps), establishing the desired connectivity guarantee. Moreover, [25] enhances the LCA further by assigning random ranks on the Voronoi cells instead of using IDs directly, showing that a's neighbor's rank is halved at each inductive step in expectation, so the stretch of the constructed spanner (on this supergraph) is, w.h.p., O(log n). Figure 8: Illustration accompanying the example of clusters connection rule (3): Large and small ovals denote Voronoi cells and clusters; marked Voronoi cells and clusters therein are marked with stars. Dashed edges are query edges we consider in the example -- their labels shows the names of the endpoints (vertices) inside the clusters they connect. Illustrated example. Consider Figure 8. All solid edges are added by rule (1). We focus on rule (3), so to prevent an application of rule (2), we add solid grey lines to indicate that all incident 27 ab′cbb*dc′ clusters are adjacent to some marked Voronoi cells. Let ID(b) > ID(b(cid:48)) > ID(b∗) > ID(d). The "supergraph-level" Voronoi cell connection rule (3) would add (x, y) and (x(cid:48), y(cid:48)) because b∗ and d are Voronoi cells of minimum IDs in Γ(a) ∩ Γ(c) and Γ(a) ∩ Γ(c(cid:48)), respectively. Instead, consider now the cluster connection rule (3). • Query edge (x(cid:48), y(cid:48)): The LCA applies the cluster connection rule (3) w.r.t. c(cid:48) and keeps (x(cid:48), y(cid:48)). • Query edge (u, v): This edge may be omitted because the LCA finds the Voronoi cell b(cid:48) also adjacent to c with lower ID than b, so rule (3) w.r.t. c does not keep this edge. The inductive argument turns to consider (u(cid:48), v(cid:48)) (not (x, y), even if b∗ actually has the lowest ID among Γ(a) ∩ Γ(c)). • Query edge (u(cid:48), v(cid:48)): This edge may also be omitted because the LCA cannot reach c from v(cid:48) despite the fact that c ∈ Γ(b); hence it cannot apply rule (3) w.r.t. c. Note that (u(cid:48), v(cid:48)) is engaged in another application of rule (3) w.r.t. the (undepicted) other marked endpoint of the grey edge incident to v(cid:48)'s cluster -- (u(cid:48), v(cid:48)) may indeed be kept by this application, and if not, the inductive argument will continue. • Query edge (x, y): This edge is kept, but not because b∗ is the minimum-ID Voronoi cell of Γ(a) ∩ Γ(c): the LCA exploring the graph from y could not have found c. Instead, it finds c(cid:48), but still cannot find d. Apparently, b∗ becomes the Voronoi cell of minimum ID among Γ(a) ∩ Γ(c(cid:48)) that it actually finds (here, the only one, in fact). Hence, the LCA applies rule (3) w.r.t. c(cid:48) and keeps (x, y). Reducing the stretch factor. Unlike the scenario of [25], we aim for an O(k2)-spanner of size (cid:101)O(n1+1/k) (in the original graph); in particular, we are allowed an extra factor of (cid:101)O(n1/k) in the Voronoi cell c), and we add edges from the cluster in a to (cid:101)Θ(n1+1/k) lowest-rank Voronoi cells b, number of edges. So, between each pair of a cluster (in Voronoi cell a) and a marked cluster (in instead of just the lowest-rank one. This adjustment reduces the ranks in the inductive argument much more rapidly: w.h.p., the argument terminates in only O(k) steps, yielding an O(k)-spanner on this supergraph. Since each Voronoi cell has diameter at most 2k, as we expand back our supervertices into Voronoi cells, we obtain the desired O(k2) stretch factor. 4.3.4 Implementation details and probe complexity analysis Marked Voronoi cells and clusters. Recall that we randomly choose a set S of O((n log n)/L) centers, and mark each Voronoi cell center independently with probability p = 1/L = n−1/3. For each marked center si, we also mark all the clusters in Vor(si). We claim that the number of marked clusters is not significantly more than the number of marked centers. Claim 4.10. The number of marked clusters is O((pn log2 n)/L) = O(n1/3 log2 n). L L ) total marked clusters. L ) clusters, then for any value x > 0, there are O( n log n xL ) Voronoi xL ) marked Voronoi cells with at most ) such clusters. Applying the argument for O(log n) different values Proof. Since there are O( n log n cells with t ∈ [x, 2x] clusters. So, we have at most O( pn log n 2x clusters, yielding O( pn log n of x yields O( pn log2 n Random ranks. We assign each center s ∈ S an independent random rank r(s) ∈ [0, 1) (e.g., a random hash function applied to their IDs): these random ranks implicitly impose a random ordering of the centers. We sometimes refer to the rank of a Voronoi cell's center simply as the rank of that Voronoi cell. We remark that in Section 5.2, we will show that Θ(log n)-independence random bits suffice for our purpose of choosing centers and assigning random ranks: our algorithm can be implemented with O(log2 n) random bits. 28 Adjacent clusters and Voronoi cells. The following definitions are as in [25]. We say that clusters A and B are adjacent if there exists u ∈ A and v ∈ B which are neighbors. In the same manner, cluster A is adjacent to Vor(s) if there exists B ∈ Vor(s) such that A and B are adjacent. For a cluster A, let Vor(A) denote the Voronoi cell containing A. Define the adjacent centers of a cluster A as c(∂A) = {c(v) : Γ(v) ∩ A (cid:54)= ∅} \ {c(A)}. Roughly speaking, this is a partial collection of neighboring Voronoi cell centers of Vor(A), restricted to those visible to the LCA from A. Connecting clusters and Voronoi cells. By "connecting" two adjacent subsets of vertices A and B, we refer to the process of adding the edge of minimum ID in E(A, B) to H (B) dense, where the ID of an edge (u, v) ∈ E(A, B) is given by (ID(u), ID(v)). The comparison is lexicographic: first compare against ID(u), break ties with ID(v). For every marked cluster C, define the cluster of clusters of C, denoted by C(C), as the set of all clusters consisting of C and all other clusters which are adjacent to C. A cluster B ∈ C(C) is participating in C(C) if the edge of minimum ID in E(B, Vor(C)) also belongs to E(B, C). That is, if we want to connect the cluster B to a certain marked Voronoi cell by choosing the edge (u, v) of minimum ID (where u ∈ B and v is in that Voronoi cell), then "B is participating in C(C)" means that, C is the (unique) cluster in the Voronoi cell containing v. Constructing H (B) dense. Adjacent clusters are connected in Hdense using the following rules, where A and B denote the clusters containing the two respective endpoints of the query edges (u, v). It suffices to apply these rules when u and v belong to different Voronoi cells, c(u) (cid:54)= c(v); otherwise H (I) dense spans them already. Note that these conditions as written are not symmetric: we must also verify them with the roles of the u and v (e.g., A and B) switched. Global construction of H (B) (1) Every marked cluster is connected to each of its adjacent clusters. (2) Each cluster B that is not participating in any cluster-of-clusters (i.e., no cell adjacent to B dense for edges between clusters. is marked), is connected to each of its adjacent Voronoi cells. (3) For each pair of cluster A and marked cluster C, consider the centers of clusters adjacent to both A and C, namely c(∂A) ∩ c(∂C). If the rank r(s) of the center s ∈ c(∂A) ∩ c(∂C) is among the q = Θ(n1/k log n) lowest ranks of centers in c(∂A) ∩ c(∂C), then A is connected to Vor(s). Figure 9: Procedure for the global construction of H (B) dense. The local algorithm and its probe complexity. We now describe the local algorithm that decides whether a query edge (u, v) ∈ H (B) dense. Using the subroutines constructed so far, assume that the LCA has verified that (u, v) ∈ Edense, identified their centers c(u) (cid:54)= c(v), and computed the entire respective clusters A and B, using O(∆3L2) probes according to Lemma 4.9. We then verify the global rules of H (B) dense if any of the following condition holds. dense in a local fashion, answering YES indicating that (u, v) ∈ H (B) As we have already computed the entire clusters A and B, we may verify condition (1) by checking all incident edges of A for those with the other endpoints in B. For condition (2), we compute the set c(∂A) of Voronoi cell centers c(w) for neighboring vertices w of A; note that c(∂A) ≤ ∆L. Then we check whether any of them is marked using O(∆L) probes each. The edge of minimum ID in E(A, Vor(B)) is among these O(∆L) edges incident to A, allowing us to check whether (u, v) = E(A, Vor(B)) as well. Overall condition (2) can be verified with O(∆2L2) probes. 29 Local construction of Hdense for edges between clusters. (1) A is a marked cluster and (u, v) has the minimum edge ID amongst the edges in E(A, B). (2) B is not adjacent to any of the marked clusters, and (u, v) has the minimum edge ID among all edges in E(B, Vor(A)). (3) There exists a marked cluster C such that all of the following holds: • B is participating in C(C), • The rank of c(B) is amongst the q = Θ(n1/k log n) lowest ranks in c(∂A) ∩ c(∂C), • The edge (u, v) has the minimum ID among all the edges in E(A, Vor(B)). Figure 10: Procedure for the local construction of H (B) dense. For condition (3), we instead consider the neighboring vertices of B and compute their cen- ters. During the process, we also keep track of the edge of minimum ID in E(B, Vor(si)) of each encountered marked center si. There are up to ∆L neighboring Voronoi cells of B in total, but w.h.p., only O(p · ∆L · log n) of them are marked. For each marked Vor(si), starting from the recorded endpoint in there, we compute the entire cluster Ci such that B is participating C(Ci) using O(∆3L2) probes. Then, we compute the centers' IDs of all neighboring vertices of Ci, namely c(∂C), spending another O(∆2L2) probes for each Ci. Combining with c(∂A) computed earlier, we can deduce if the rank of c(B) is sufficiently low that E(A, Vor(B)) must be added. In total, we require O(p∆L log n) · (O(∆3L2) + O(∆2L2)) = O(p∆4L3 log n) probes, as desired: Lemma 4.11 (H (B) decides whether (u, v) ∈ H (B) in Section 4.3.4. dense probe complexity). There exists an LCA that w.h.p., given an edge (u, v) ∈ E, dense is as defined dense using probe complexity O(p∆4L3 log n), where H (B) 4.3.5 Proof of connectivity, stretch, and size analysis Stretch and size analysis of Hdense. Denote by GVor the supergraph obtained from G by merging vertices within each Voronoi tree into a supervertex (e.g., by contracting H (I) dense), and by HVor its subgraph obtained by applying the same operation in the spanner Hdense (e.g., the same edges as H (B) dense but joining corresponding supervertices instead). Since we add strictly more edges than the algorithm of [25] does, the connectivity follows by the exact same argument (see Lemma 4 of [25]); for completeness, we provide it here (with only slightly modifications). See Figure 11 for an illustration. dense). HVor preserves the connectivity of the Voronoi cells: if Lemma 4.12 (Connectivity by H (B) Vor and Vor0 are connected in GVor, they remain connected in HVor. Proof. Consider clusters A ⊆ Vor and B = B0 ⊆ Vor0 such that the edge e of minimum ID in E(Vor, Vor0) is in E(A, B0). If B0 is not adjacent to any marked cell, then by condition (2) there is an edge between Vor and Vor0 in HVor. Hence, we assume that B0 is adjacent to a marked cell Vor(cid:48). Let C0 ⊆ Vor(cid:48) If the rank r(s0) is among the q lowest ranks of the centers c(∂A)∩ c(∂C0), then e is added to H (B) dense by condition (3). Otherwise, Vor0 is connected to Vor(cid:48) 0 in dense by condition (1), since C0 ⊆ Vor(cid:48) HVor as the edge of minimum ID in E(B, C0) is added to H (B) is marked. Let Vor1 be the cell whose center has the minimum rank in c(∂A) ∩ c(∂C0), and let 0 be the cluster such that B0 is participating in C(C0). Let s0 be the center of Vor0. 0 30 Figure 11: Illustration for the proof of connectivity and stretch for Hdense: Dashed red edges show the edges of interest at each inductive step, where the top one joining clusters A and B0 represents the original query. Solid black edges show the path of length 2T + 1 = O(k) in HVor between Vor and Vor0. B1 ⊆ Vor1 be the cluster such that the edge of minimum ID in E(A, Vor1) is in E(A, B1). Again by condition (1), Vor1 is also connected to Vor(cid:48) 0 in HVor. At that point, it suffices to show that Vor is connected to Vor1 in HVor, where the rank of Vor1 is strictly smaller than the rank of Vor0. We may proceed with the proof by induction, with the hypothesis that all Vori's are connected in HVor. Since the ranks of Vori's are strictly decreasing, the inductive argument halts after T < S steps: at this point, A is connected to BT ⊆ VorT in HVor, as desired. We next claim that stretch of the our spanner Hdense is O(k2), while [25] provides a stretch factor of O(log n · (∆ + log n)). The second factor of O(∆ log n) has been reduced down to O(k) thanks to the new partitioning criteria and algorithms described so far. To remove the remaining factor of O(log n), we leverage the fact we may add a factor of O(n1/k log n) more edges to the spanner Hdense, allowing the ranks in the inductive argument to decrease more rapidly. For simplicity, we assume now that the ranks of the centers are fully independent. In Section 5.2 (Theorem 5.5) we extend the following claim to the case where the ranks of the centers are formed by short random seed of O(log2 n) bits. Lemma 4.13 (Stretch guarantee by H (B) uniformly at random from [0, 1), then w.h.p., the stretch of HVor w.r.t. GVor is O(k). dense). If the ranks of the centers are assigned independently, Proof. The connectivity proof in Lemma 4.12 uses an inductive argument, where each step in the induction, increases the length of the path in GVor by 2. Thus it suffices to show that the induction of Lemma 4.12 halts, w.h.p., after O(k) steps. In comparison, in Lemma 4 of [25], the induction uses O(log n) steps and hence the stretch in HVor is also O(log n). Observe that while the construction of GVor heavily relies on the IDs of vertices, the rank assignment of vertices is random and independent of GVor. Again, let A ⊆ Vor, B = B0 ⊆ Vor0 be two adjacent clusters of interest. Folowing the argument of Lemma 4.12, at each step i ≥ 0, we consider Vori which by the inductive hypothesis satisfies the following. 31 𝐵0Vor𝐴Vor𝐶0Vor𝐵1𝐶1𝐵𝑇⋮⋮VorVorVor0′01′1𝑇 (a) A and Vori are adjacent. (b) The distance between Vor0 and Vori in HVor is at most 2i. (c) The rank of c(Vori) is the minimum rank among those of all centers in the collection {c(∂A) ∩ c(∂Cj)}j<i. It is straightforward to verify that these conditions hold for the base case i = 0. For the inductive step, hypothesis (a) holds because we choose Vori with center si ∈ c(∂A) ∩ c(∂Ci−1), so Vori is adjacent to Vor. It is also connected to the marked cluster Ci−1, which in turn is connected to Bi−1 in Vori−1 by rule (1), thereby proving condition (b). Lastly, condition (c) follows, because c(Vori) is the center of minimum rank in the set of centers c(∂A) ∩ c(∂Ci−1), which contains c(Vori−1). It remains to show that the induction terminates after O(k) steps with high probability. Let ri = r(c(Vori)). We claim that in each step, either the process terminates or, w.h.p., chooses a center of rank ri+1 ≤ ri/n1/k. Suppose that the process does not terminate at step i. Observe that at this point, all ranks ever "revealed" by our algorithm so far are of the centers in condition (c): no rank lower than ri has been encountered. Then in the beginning of step i, there are at least q cluster centers in c(∂A) ∩ c(∂Ci) whose ranks are uniformly distributed in [0, ri) (since we assume that ranks are chosen independently). For each of these q = Θ(n1/k log n) unrevealed ranks, the probability that the rank is at most ri/n1/k is at least n−1/k. By the Chernoff bound we obtain that, w.h.p., at least one of these ranks turns out to be at most ri/n1/k. Similarly, w.h.p., no center has rank below Θ(1/(n log n)). Thus, the algorithm terminates in logn1/k (n log n) = Θ(k) steps, as desired. Next, we proceed to bounding the size of H (B) dense. Lemma 4.14 (Size of H (B) edges. dense). W.h.p., H (B) dense contains O( pn2+1/k log4 n L2 + n log2 n pL ) = O(n1+1/k log4 n) Proof. Recall that there are O((n log n)/L) = O(n2/3 log n) clusters and ((pn log2 n)/L) = O(n1/3 log2 n) marked clusters, bounding the number of edges from condition (1) by O((pn2 log3 n)/L2) = O(n log3 n). For condition (3), the algorithm adds O(n1/k log n) edges for each such pair, which is O((pn2+1/k log4 n)/L2) = O(n1+1/k log4 n) edges in total. Lastly for conditon (2), every cluster that is not participating in any cluster of clusters (i.e., not adjacent to any marked Voronoi cell) w.h.p. has O((log n)/p) = O(n1/3 log n) adjacent Voronoi cells, because these cells are independently marked with probability p = n−1/3. (On the other hand, clusters are not marked independently, so in condition (2) we add one edge from A to every adjacent Voronoi cell, rather than every adjacent cluster.) Hence, the number of edges added by condition (c) is O((n log2 n)/(pL)) = O(n log2 n). Putting everything together. Recall that our overall spanner is H = Hsparse ∪ Hdense where Hdense = H (I) dense. Combining all results so far in this section, we achieve at our main result, Theorem 1.2, as follows. dense ∪ H (B) Proof of Theorem 1.2. (i) Size. The size of Hsparse, H (I) dense are O(kn1+1/k), O(n) and O(n1+1/k log4 n) due to Lemma 4.5, Lemma 4.6 (from the fact that H (B) dense is a forest), and Lemma 4.14, respectively. More precisely, for parameters L and p, we present a spanner with O(kn1+1/k + pn2+1/k log4 n (ii) Stretch. The case of Hsparse taking care of Esparse is immediate by Lemma 4.5, hence we focus on Hdense. The stretch argument follows by Lemma 4.13 for H (B) dense together with the fact that in dense and H (B) pL ) edges. + n log2 n L2 32 each Voronoi cell we have a Voronoi tree of depth O(k) in H (I) dense by 4.6. That is, between two adjacent Voronoi cells, the spanner has a path of length O(k) in the Voronoi graph HVor. Within each Voronoi cell (supervertex in GVor) there exists a path of length 2k connecting any pair of vertices. Thus, there is a path of length O(k2) in Hdense between any pair of neighboring dense vertices. (iii) Probes. The LCA can verify whether (u, v) ∈ Esparse, and if so, check if (u, v) ∈ Hsparse using O(∆L) probes by Lemma 4.5 using O(∆2L2) total probes. Otherwise, Lemma 4.6 allows the LCA to verify whether u and v belongs to the same Voronoi cell, and if so, check whether (u, v) ∈ H (I) dense using O(∆2L2) probes. Lastly for u and v from different Voronoi cells, the LCA can check whether (u, v) ∈ H (B) dense using O(p∆4L3 log n) probes via Lemma 4.11. Substituting L = n1/3 and p = 1/L yields the desired result. O(n1/12−). Theorem 1.2 implies that there exists an LCA with sub-linear probe complexity for any ∆ = In fact, we remark that by using the argument of Lemma 4.13, we can achieve a spanner H with (cid:101)O(n1+1/k + nq) edges with stretch O(k logq n) = O((k log n)/ log q). As a reminder, the theorem above does not show that the LCA uses a polylogarithmic number of independent random bits. To complete the proof of Theorem 1.2, Section 5.2 describes the required adaptation for working with only O(log2 n) random bits. A summary of the differences between our algorithm and the algorithm of Lenzen and Levi [25]. Our algorithm can be considered as an extension of [25] that provides a trade-off between the stretch factor and the size of the subgraph. In particular, we show that the stretch factor's dependency on ∆ and n can be removed completely. We conclude by summarizing several key differences between our approaches. • In [25], the distinction between dense and sparse vertices depends on a radius (cid:96) sampled uniformly at random from a given range that depends on ∆. In our construction, the radius is k, the stretch parameter. • In [25], the sparse and dense graphs are vertex disjoint and the parameter (cid:96) guarantees that the number of edges between these graphs is small. In contrast, in our construction the sparse and dense graphs share vertices and in fact, these graphs are only edge-disjoint. • The BFS algorithm of [25] for detecting a center explores an entire level of the BFS tree in each step, choosing the closest center with minimum ID. We provide a more efficient variant that explores the neighborhood of one vertex at a time, and chooses the closest center with lexicographically-first shortest path, improving the probe complexity by a factor of ∆. • For the sparse case, [25] uses the distributed algorithm of Elkin and Neiman [16], whereas we use the algorithm of Baswana and Sen [5] since it has been proved to work with O(log n)-wise independence [10]. • For the dense case, in [25], the radius of the Voronoi cells is (cid:96) = Θ(∆ + log n) and in our case, • The number of clusters in [25] depends on (cid:96) and ∆. In our construction, the number of • We allow O(n1/k log n) edges between a cluster and neighboring clusters of a given marked • The algorithm of [25] uses random seed of size O(∆· n2/3). However, our algorithm only uses clusters is (cid:101)O(n2/3), each containing O(n1/3) vertices. it is k. clusters, whereas [25] only adds a single such edge. a poly-logarithmic number of random bits. 33 5 Bounded Independence In this section, we show that all our LCA constructions succeed w.h.p. using Θ(log n)-wise inde- pendent hash functions which only require Θ(log2 n) random bits. We use the following standard notion of d-wise independent hash functions as in [42]. In particular, our algorithms use the explicit construction of H by [42], with the parameters as stated in Lemma 5.2. Definition 5.1. For N, M, d ∈ N such that d ≤ N , a family of functions H = {h : [N ] → [M ]} is d-wise independent if for all distinct x1, ..., xd ∈ [N ], the random variables h(x1), ..., h(xd) are independent and uniformly distributed in [M ] when h is chosen randomly from H. Lemma 5.2 (Corollary 3.34 in [42]). For every γ, β, d ∈ N, there is a family of d-wise independent functions Hγ,β = such that choosing a random function from Hγ,β takes d · max{γ, β} random bits, and evaluating a function from Hγ,β takes time poly(γ, β, d). (cid:110) h : {0, 1}γ → {0, 1}β(cid:111) Then, we exploit the following result to show the concentration of d-wise independent random variables: Fact 5.3 (Theorem 5(III) in [40]). If X is a sum of d-wise independent random variables, each of which is in the interval [0, 1] with µ = E(X), then: • (I) For δ ≤ 1 and d ≤ (cid:98)δ2µe−1/3(cid:99), it holds that Pr[X − µ ≥ δµ] ≤ e−(cid:98)d/2(cid:99). • (II) For δ ≥ 1 and d = (cid:100)δµ(cid:101), it holds that: Pr[X − µ ≥ δµ] ≤ e−δµ/3. Bounded independence for hitting set procedures. Most of our algorithms are based on the following hitting set procedure. For a given threshold ∆ ∈ [1, n], each vertex flips a coin with probability p = (c log n)/∆ of being head and the set of all vertices with head outcome join the set of centers S. Assuming the outcome of coin flips are fully independent, by the Chernoff bound, the followings hold w.h.p.: (HI) There are Θ(pn) sampled vertices S. (HII) For each vertex of degree at least ∆, it has Θ(log n) centers among its first ∆ neighbors. Here we show that to satisfy properties (HI) and (HII), it is sufficient to assume that the outcomes of the coin flips are d-wise independent. By Lemma 5.2, to simulate d-wise independent coin flips for all vertices, the algorithm only requires t = Θ(d(log n + log 1/p)) random bits: more precisely, setting γ = Θ(log n) and β = log 1/p (for simplicity, lets assume that log 1/p is an integer), there exits a family of d-wise independent functions H = such that a random function h ∈ H can be specified by a string of random bits of length t. In other words, each function h ∈ H maps the ID of each vertex to the outcome of its coin flip according to a coin with bias p. Then, from a string R of t random bits, the algorithm picks a function hR ∈ H at random to simulate the coin flips of the vertices accordingly: the outcome of the coin flip of v is head if hR(ID(v)) = 0 (which happens with probability p) and the coin flips are d-wise independent. Setting d = c log n for some constant c > 1, we prove the following: (cid:110) h : {0, 1}Θ(log n) → {0, 1}log(1/p)(cid:111) Claim 5.4. If the coin flips are d-wise independent then properties (HI) and (HII) holds. Further- more, the sequence of n d-wise independent coin flips can be simulated using a string of O(log2 n) random bits. 34 5.1 Construction of representatives in Section 3 The analysis above (for hitting set procedures) also extends to the process of computing Reps. Each crowded vertex chooses values c log n random indices (of its neighbor-list) in [∆med], each of which has probability 1/2 of hitting a neighbor of degree at least ∆super. Let {Zi}i∈[c log n] be indicators for these events and Z denote their sum, then the expected sum E(Z) ≥ (c/2) log n. Imposing d-wise independence, Fact 5.3(I) implies that w.h.p., Z > 0, so the representative set is non-empty. We apply the union bound to show that Reps(v) (cid:54)= ∅ for every v ∈ Vcrwd, as desired. 5.2 Bounded independence for Section 4 To define the (cid:96) = (cid:100)log n(cid:101)-bit random rank r(v), we will use a collection of k hash functions (where k is the stretch parameter). Letting N = (cid:100)log n/k(cid:101), each function hi : {0, 1}(cid:96) → {0, 1}N is an O(log n)-wise independent hash function for i ∈ {1, . . . , k}. To do so, we view the rank r(v) as consisting of k blocks, each with N bits. Specifically, let r(v) = [b1, . . . , b(cid:96)] ∈ {0, 1}(cid:96) and let Ri(v) = [b(i−1)·N , . . . , bi·N−1] be the ith block of N bits in r(v). For every center v, define Ri(v) = hi(ID(v)) and r(v) = R1(v) ◦ R2(v) ◦ . . . ◦ Rk(v) . The collection of these h1, . . . , hk functions are obtained by a uniform sampling from a family H = {h : {0, 1}(cid:96) → {0, 1}N} of O(log n)-wise independent hash functions. Our goal is prove Lemma 4.13 using these ranks instead of fully independent random ranks. Lemma 5.5 (Stretch guarantee by H (B) the above construction, then w.h.p., the stretch of HVor w.r.t. GVor is O(k). Proof. Note that GVor is independent of the rank assignment. Consider any pair of adjacent cells Vor, Vor1 (i.e., neighbors in GVor) and let A ⊆ Vor, B ⊆ Vor1 be two adjacent clusters of interest in dense). If the ranks of the centers are generated according to these Voronoi cells. At the beginning all vertices are unrevealed and throughout the process some of them will get revealed by exposing one N -size block Rj of their rank. Let q = (cid:100)c log n · n1/k(cid:101) for some large enough constant c, as used by our spanner construction algorithm. In each inductive step i, we either halt or we reveal the ith block Ri(v) in the ranks of at least q oblivious unrevealed centers v. At that point, we will also reveal the ith block in the rank of all the centers w with Ri(w) (cid:54)= ¯0 (where ¯0 = [0, . . . , 0]). We now describe this induction process in details. At the beginning of step i ≥ 0, we look at c(Vori) which by induction assumption satisfies the following. (a) A and Vori are adjacent. (b) The distance between Vor0 and Vori in HVor is at most 2i. (c) The rank of c(Vori) is the minimum rank among those of all centers in the collection {c(∂A) ∩ c(∂Cj)}j<i. Observe that all vertices whose ranks are revealed are precisely those included in property (c). In particular, we will show property (c) as a result of two sub-properties: (c1) The first i blocks in the rank of c(Vori) are all zeros. (c2) For every center v whose rank is revealed, there is exists j ≤ i such that Rj(v) (cid:54)= ¯0. For the base case, at the beginning of step i, all claims hold. Assume that the claims hold up to the beginning of step i ≥ 1. We will show that either we halt at that step or that all properties hold at the beginning of step i + 1. By property (c2), each revealed center v at the beginning of step i has at least one non-zero block among the first i blocks 35 of r(v). Or, in other words, the first i blocks in the ranks of all the unrevealed vertices at the beginning of step i, are all-zeros. We may assume that there is a marked cluster Ci such that Bi (the cluster in Vori such that the edge of minimum ID in E(A, Vori) is in E(A, Bi)) participates in C(Ci) (as otherwise, we halt). If there are less than q unrevealed centers in c(∂A)∩ c(∂Ci), then the process terminates: by property (c), all revealed centers have a strictly larger rank than c(Vori). Otherwise, (i.e., there are at least q unrevealed centers in c(∂A) ∩ c(∂Ci)), we probe the ith block (using the hash function hi) in the rank of these q unrevealed centers in c(∂A) ∩ c(∂Ci). We let Vori+1 be a cell with a center si+1 = c(Vori+1) satisfying that si+1 ∈ c(∂A) ∩ c(∂Ci) and Ri(si+1) = ¯0. If there are several such centers that satisfy these two conditions, we pick one arbitrarily. We now claim: Claim 5.6. W.h.p., there exists at least one si+1 ∈ c(∂A) ∩ c(∂Ci) such that Ri(si+1) = ¯0. Proof. Let S(cid:48) a subset of q unrevealed centers in c(∂A) ∩ c(∂Ci). For every sj ∈ S(cid:48), let Xj ∈ {0, 1} be the event that Ri(sj) = ¯0. Since Ri(sj) = hi(ID(sj)), we have that E(Xj) = 1/2N and E(X) = j=1 Xj. Since the Xj variables are O(log n)-independent, using the Chernoff bound from Fact 5.3(I), we obtain that w.h.p. X ≥ 1 and hence there exists sj ∈ S(cid:48) that satisfies the above. The claim follows. q/2N = Θ(log n) where X =(cid:80)q The proofs of the first two properties remain unchanged. Property (3a) holds by induction and by the selection of Vori+1. In particular, by induction, all the first i blocks of the rank r(si+1) are all zeros (as si+1 is unrevealed at the beginning of step i) and we select si+1 since Ri(si+1) = ¯0. Property (c2) holds by induction and by the fact that the ith-block in the ranks of all those centers that got revealed in step i is nonzero. By combining (c1) and (c2), property (c) holds as well since si+1 has the minimum rank among all those that got revealed so far. Finally, we claim that w.h.p., the process terminates after O(k) induction steps. We will show that by claiming that in every step i, at least a (1− c(cid:48) · n−1/k) fraction of the remaining unrevealed centers are revealed for some constant c(cid:48) > 0. Let Ui be the number of unrevealed centers at the beginning of step i. Hence, U1 = n. If we did not halt at step i, it means that Ui ≥ q = Ω(log n·n1/k). We now bound the number U Zi of unrevealed centers at the beginning of step i whose ith block is all-zero. The probability of having an all-zero block for a single center is 1/2N and hence in expectation there are Ui/2N such centers. Since Ui ≥ q, and since the ranks are O(log n)-wise independent, using Chernoff bound of Fact 5.3(I), with get that w.h.p. U Zi ∈ [c1· Ui/2N , c2· Ui/2N ] for some constants 0 < c1 < c2. Hence, w.h.p., Ui+1 = Ui − U Zi ≥ (1 − c(cid:48)/2N )Ui. Overall, after O(k) induction steps, there are at most q unrevealed vertices and at that point we halt. The lemma follows. 6 Lower Bounds In this section, we establish lower bounds for the problem of locally constructing a spanner consisting of an asymptotically sub-linear number of edges from the input graph. Our results largely follows from the analysis of [24] on the lower bound construction of [27]; a compact version of this proof is given here for completion. For simplicity, we assume that each vertex occupies a unique ID from {1, . . . , n}; this assumption may only strengthen our lower bound. We define an instance of a d-regular graph on n vertices as a perfect matching between cells of a table of size n × d: a matching between the cells (u, i) and (v, j) indicates that v is the ith neighbor of u and u is the jth neighbor of v. An edge can be then expressed as a quadruple (u, i, v, j); note that the endpoints are always interchangeable. For consistency with this notation, we let the Neighbor probe with parameter (cid:104)u, i(cid:105) for i ≤ deg(u) 36 n, n return (v, j) (instead of only v) -- this change can only provide more information to the algorithm. We say that an instance G and the edge (u, i, v, j) are compatible if G contains (u, i, v, j). Our lower bounds are established for sufficiently large n ≡ 2 mod 4 and odd integer d. (x,a,y,b) and D− The overall argument. First, we construct two distributions D+ (x,a,y,b) over undi- rected d-regular graph instances for x, y ∈ V and a, b ∈ [d]. Any graph instance G+ in the support of D+ (x,a,y,b) contains the edge (x, a, y, b) such that with high probability, removing this edge does not disconnect x and y. In particular, D+ (x,a,y,b) is the uniform distribution over all instances compatible with (x, a, y, b). On the other hand, any graph instance G− in the support of D− (x,a,y,b) contains the edge (x, a, y, b) such that removing this edge disconnects x and y (leaving them in separate connected components). We show that when given the query (x, a, y, b), any deterministic LCA A that only makes o(min{√ d}) probes can only distinguish whether the underlying graph is a graph randomly (x,a,y,b) or D− drawn from D+ (x,a,y,b) with probability o(1). We prove this claim by defining two (x,a,y,b) and P− (x,a,y,b) which interact with A and generate a random subgraph from processes P + (x,a,y,b) and D− D+ (x,a,y,b) respectively. We then argue that for each probe the answers that these two processes return are nearly identically distributed, and so are their probe-answer histories. Aiming for an overall success probability of 2/3, A must keep the edge (x, a, y, b) in its spanner 3 (1 − o(1)) > 1/2. Since an instance in D+ with probability 2 (x,a,y,b) is chosen uniformly at random, then for more than half of the instances in the support of D+ (x,a,y,b), which are exactly the instances compatible with (x, a, y, b), A returns YES on query (x, a, y, b). Applying this argument for all possible edges (quadruples (x, a, y, b)), we obtain that A returns YES on at least half of all compatible instance-query pairs. Consequently, over the uniform distribution over all instances, in expectation any deterministic algorithm A must return YES on more than m/2 edges. Employing Yao's principle, using o(min{√ we conclude that any (randomized) LCA cannot compute a spanning subgraph with o(m) edges n, n/d}) probes. 6.1 Analysis of the probe-answer histories Similarly to the work of [27]. we construct our distributions as follow. • Distribution D+ (x,a,y,b). D+ (x,a,y,b) is a uniform distribution over all d-regular graph instances, conditioned that (x, a, y, b) is in the instance. More precisely, the edges of G in the family is determined by the following process. Consider a two-dimensional table of size n × d which is called matching table and is denoted by M . Any perfect matching between cells in this table corresponds to a graph in D+ (x,a,y,b). Note that the generated graphs are not necessarily simple. • Distribution D− (x,a,y,b). Let V = V0 (cid:93) V1 be a random partition of the vertex set into two equal sets such that x ∈ S and y ∈ T . Now consider two matching tables of each of size n/2 × d denoted by M1 and M2. For a graph G in this family, besides the edge (x, a, y, b), the rest of edges are determined by choosing a random perfect matching within each of M1 and M2 (over the remaining cells). Thus, (x, a, y, b) is the only edge connecting between M1 and M2. For brevity we drop the subscript (x, a, y, b) for now as it is clear from the context. For sufficiently large values of d = Ω(1), w.h.p, each instance G from D+ is connected even when (x, y) is removed (see e.g., [9]). On the other hand, removing (x, y) from any G− ∈ D− clearly disconnects x and 37 y. Thus, unless a deterministic algorithm A can determine whether it is given (x, a, y, b) of an instance from D+ or D−, it must return YES on (x, a, y, b) for a (2/3)-fraction of these instances. For simplicity we assume that A has a knowledge of the construction (including the degree d), and never makes a probe that does not reveal any new information. Let L denote the number of probes made by the algorithm, and Q denote the set of probes performed by A. Observe that A is a deterministic mapping from the probe-answer histories (cid:104)(q1, a1),··· , (qt, at)(cid:105) (cid:55)→ qt+1 for t < L and to {YES, NO} for t = L. Each probe qi is either a Neighbor probe or an Adjacency probe. Next, similarly to [24], we define two processes P + and P− which interact with an arbitrary t and D− algorithm A and respectively construct a random graph from D+ and D−. Defining D+ to be the distribution of the probe-answer histories of the interaction of P + and P− respectively with A after t probes, we show that if L = o(min{√ n, n/d}), then the statistical distance of D+L and D− • Let Rs be the set of all graphs in the support of Ds. Let Rs L is o(1). We now give the formal description of P s for s ∈ {+,−}: (u,i,v,j) be the set of all graphs in the support of Ds that are compatible (u, v) and (u, i, v, j) respectively. In the former case, we require at least one matching (u, i(cid:48), v, j(cid:48)) for some i(cid:48), j(cid:48) ∈ [d] between cells in the rows of u and v in the matching table; however, in the latter case, we only allow a fixed to denote the set of all graphs in the support of Ds matching (u, i, v, j). We also write Rs that are not compatible with u, v. t denotes the set of all graphs in the support of Ds that are compatible with the first t probes and answers. is an Adjacency probe of the form (cid:104)ut, vt(cid:105): We choose whether to add an (ut,vt) ∩ Rs If so, we match a sample (it, it) = (i, j) with probability t−1, and answer at = it. Otherwise, -- If qt is a Neighbor probe of the form (cid:104)ut, it(cid:105): For each v ∈ V and jt ∈ {1, . . . , d}, we choose a cell to match with (ut, it): sample the answer at = (vt, jt) with probability Rs (ut,it,vt,jt) ∩ Rs edge between u and v with probability Rs pair of cells between the rows of u and v: Rs (ut,it,vt,jt) ∩ Rs we simply set Rs (ut,it,vt,jt) ∩ Rs t = Rs t−1 and answer at = ⊥. (x,a,y,b), for any t > 0, Rs • Starting from Rs t−1 set Rs ∩ Rs t−1/Rs t−1 and set Rs (ut,it,vt,jt) ∩ Rs • After L probes, return a random graph uniformly sampled from RsL. t−1/Rs t = Rs t−1/Rs t−1. (u,v) and Rs t = Rs t−1. (ut,vt) t (u,v) 0 = Rs -- If qt Lemma 6.1 (Lemma 10 in [24]). For any deterministic algorithm A, the process P s (s ∈ {+,−}) when interacting with A, uniformly generates a graph from the support of Ds (x,a,y,b). t , the set of all graphs in Ds as Rs Next, we show that the probability that A can detect an edge with Adjacency probe (asking probe q = (u, v) for which the answer is positive; an edge exists between u and v) after performing only o(n/d) is small. We can define Rs where B is the set of edges that the graphs in Rs t must contain (namely, all pairs of cells (u, i, v, j) created in some previous probes) and D is the set of edges that the graphs in Rs t must not contain (namely, all pairs (u, v) disallowed by Adjacency probes with negative answer). Assuming that the algorithm makes L = o(n/d) probes, we establish the following lemmas that will be useful in bounding the difference between the distributions of probe-answer histories generated by the two processes. In particular, assume the number of conditions B,D = o(n/d), and the initial conditions (x, a, y, b) ∈ B and (x, y) /∈ D, in the following three lemmas. Lemma 6.2. For every (u, i, v, j) (cid:54)= (x, a, y, b), = O( 1 Rs B,D B,D nd ). (u,i,v,j)∩Rs Rs B,D 38 Proof. For process P +, the proof is the same as the proof of the similar statement in Lemma 11 of [24]. Here, we show that the argument holds for P−. R− (u,i,v,j) ∩ R− B,D R− B,D = R− · (u,i,v,j) ∩ R− B R− (u,i,v,j) ∩ R− (cid:18) 1 (u,i,v,j) ∩ R− R− R− B B · 1 · O(1) = O (cid:19) B,D , · R− B R− B,D ≤ 1 Ω(nd) nd where the bounds on R− (u,i,v,j)∩R− B R− B and R− B R− B,D are shown in Claim 6.3 and 6.4. Claim 6.3. For every (u, i, v, j) (cid:54)= (x, a, y, b), R− (u,i,v,j)∩R− B R− B ≤ 2 nd . Proof. If u and v belong to different partitions or at least one of them is already matched in B, then R− (u,i,v,j) = ∅. Otherwise, let w denote the lower bound on the number of unmatched cells in the matching table containing rows of u and v in any instance of R− B. Recall that the number of matched cells is bounded by o(nd), so w ≥ nd − 2B − 1 ≥ (1 − o(1)) · nd. The probability that cells (u, i) is matched to (v, j) is given by R− (u,i,v,j) ∩ R− B R− B = 1 w − 1 ≤ 2 nd for sufficiently large n and d. Claim 6.4. R− B R− B,D = O(1). Proof. As we consider (u, v) (cid:54)= (x, y), we have B R− (u,i,v,j) (u,v) ∩ R− B R− B i,j∈[d] R− R− B (cid:80) i,j∈[d] R− (u,i,v,j) ∩ R− B R− B (cid:18) d (cid:19) n . ≤ d2 · 2 nd = O = (cid:0)(cid:83) B ∩(cid:0)(cid:84) Then by the union bound, R− R− R− B,D B = r≤D R− er R− B,D ≤ (cid:1) ∩ R− B \(cid:0)(cid:83) R− (cid:1) = (cid:1) r≤D R− er R− B,D ≥ 1 − (cid:88) (cid:16) n = 1 − o r∈[D] d er ∩ R− B (cid:19) R− B (cid:18) d R− (cid:17) · O n = 1 − o(1). Hence, R− B R− B,D = O(1). Recall again the assumption that A does not make probes that do not reveal any new in- formation about the instance. Now, we are ready to formally prove the following claim on the Adjacency probes, that with L = o(n/d) probes, A is unlikely to obtain any positive answer. Lemma 6.5. Let A be an arbitrary deterministic algorithm interacting with process P s (s ∈ {+,−}) and that has probed o(n/d) times. The probability that A detects an edge with an Adjacency probe of the form (cid:104)ut, vt(cid:105) during the interaction is o(1). 39 (cid:83) ≤ (cid:88) pt = (ut,it,v,j) ∩ Rs v∈Vt−1,j∈[d](Rs Rs t−1 t−1) (ut,it,v,j) ∩ Rs (Rs t−1) v∈Vt−1,j∈[d] Rs t−1 (cid:18) 1 (cid:19) nd (cid:18) 1√ n (cid:19) . = O ≤ 2t · d · O Proof. Consider an arbitrary step t in the interaction of A and P s in which the algorithm performs an Adjacency probe. Since, t = o(n/d), by the description of P s and applying Lemma 6.2, the (cid:80) probability that the answer to qt is not ⊥ is bounded by: (ut,it,vt,jt) ∩ R− it,jt∈[d] R− t−1 R− t−1 (ut,vt) ∩ R− R− t−1 R− t−1 (cid:18) 1 ≤ d2 · O (cid:18) d (cid:19) (cid:19) = O ≤ nd n . Since the total number of probes is o(d/n), by the union bound, the probability that A detects an edge with an Adjacency probe during its interaction with P s is o(1). √ Next, we similarly show that if L = o( n), A is likely to obtain a new vertex from every √ Neighbor probe it performs. Lemma 6.6. Let A be an arbitrary deterministic algorithm interacting with process P s (s ∈ {+,−}) n) times. With probability 1 − o(1), all Neighbor probes of A receive and that has probed o( distinct vertices in their answers. Proof. Consider step t in the interaction of A and P s and let Vt−1 denote the set of vertices seen by A so far (i.e., participate in some qt(cid:48) or at(cid:48) where t(cid:48) ≤ t − 1); thus Vt−1 ≤ 2t. In what follows we bound the probability pt that at (the answer to of the form (ut, it)) corresponds to a vertex v which belong to Vt−1. √ where the last inequality is implied by Lemma 6.2. Hence, if the total number of probes is o( with probability 1 − o(1) the answer to every Adjacency probe introduces a new vertex n), t denotes the distribution over the Next, we prove the main result of this section. Lets Ds L is o(1). n, n/d}), the statistical distance probe-answer histories of t rounds of the interaction of A and P s. Lemma 6.7. For any arbitrary deterministic A and L = o(min{√ between D+L and D− Proof. Let Π be the set of all valid probe-answer histories of length L and let Π(cid:48) ⊂ Π denote the set of all histories in which every Adjacency probe returns ⊥ and no Neighbor probe returns an already-discovered vertex. Observe that conditioned on π ∈ Π(cid:48), the answers to all Adjacency probes by both P− and P + are ⊥. Moreover, the answers to each Neighbor probe by both processes are chosen uniformly at random among all cells from the rows corresponding to the set of all vertices not visited so far, which is the same for the both processes. That is, D+L (π) and D− L (π) are proportional to each other for every probe-answer history π ∈ Π. Hence the difference between the probe-answer histories for π ∈ Π(cid:48) in both processes are bounded simply by the difference in their total probabilities: (cid:88) (cid:88) D+L (π) − (cid:88) D+L (π) − D− L (π) = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:88) π∈Π(cid:48) D+L (π) − (cid:88) π∈Π(cid:48) π∈Π\Π(cid:48) π∈Π\Π(cid:48) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) D− L (π) D− L (π) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) . π∈Π(cid:48) 40 histories when L = min{√ n, n/d}: L (π) = D+L (π) − D− (cid:88) π∈Π (cid:88) D+L (π) − D− L (π) Putting everything together, we bound the difference between the distributions of probe-answer π∈Π(cid:48) (cid:88) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ 2 ≤ 2 π∈Π\Π(cid:48) D− L (π) L (π) + D+L (π) − D− (cid:88) (cid:88) D+L (π) − (cid:88) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) + 2 (cid:88) D+L (π) π∈Π\Π(cid:48) π∈Π\Π(cid:48) π∈Π\Π(cid:48) π∈Π\Π(cid:48) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) D− L (π) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = o(1). where the last equation follows as a result of Lemma 6.5 and Lemma 6.6. Finally we turn to complete the proof of Thm. 1.3 which holds also for simple graphs. Proof of Theorem 1.3. As outlined earlier, for the 1 − o(1) fraction of the instances in D+ (x,a,y,b), a 3 (1 − o(1)) > 1/2 deterministic A must keep the edge (x, a, y, b) in its spanner with probability 2 because, due to Lemma 6.7, with probability 1 − o(1) it cannot distinguish whether the given instance is from D+ (x,a,y,b) is the uniform distribution over instances compatible with (x, a, y, b), then for more than half of these instances, A returns YES on query (x, a, y, b). Applying this argument for all (x, a, y, b), we obtain that A returns YES on at least half of all compatible instance-query pairs. Nonetheless, our generated instances in D+ often contains parallel edges and self-loops. (x,a,y,b). Since D+ (x,a,y,b) or D− (x,a,y,b), D− (x,a,y,b) In order to remove these non-simple graphs, as similarly noted in [24], we observe that our constructed graphs only have O(d2) parallel edges and O(d) self-loops in expectation. Thus, we may simply fix each instance by modifying O(d2) matchings so that all instances become simple (assuming sufficiently large n and d). Observe that by doing so, the connectivity of the graph strictly increases: the required condition of D+ (x,a,y,b) that x and y must be connected even when (x, a, y, b) is absent is still upheld. Similarly, for D− (x,a,y,b) the modifications must still respect the restriction that no edge other than (x, a, y, b) has endpoints on different tables, so that removing (x, a, y, b) disconnects them. Due to similarly arguments as Lemma 6.5 and Lemma 6.6, the probability that A detects these modifications are o(1), and therefore Lemma 6.7 still holds under these changes, as long as the query to A itself is not one of the modified edges. On the other hand, if a modified edge is given as a query to A, then we do not assume anything about the algorithm's answer for this edge. As the modified edges constitute a fraction of up to O(d2)/nd = O(d/n) of the total number of edges on each instance on average, the fraction of instance-query pairs where A answers YES can be potentially reduced by at most a fraction of O(d/n): this still leaves a fraction of 2 n ) > 1/2 for sufficiently small d = O(n). That is, even when restricted to simple graphs, we still obtain that A returns YES on at least half of all compatible instance-query pairs Over the uniform distribution over all instances, in expectation any deterministic algorithm A must return YES on more than m/2 edges. Employing Yao's principle, we conclude that any 2/3 using o(min{√ (randomized) LCA cannot compute a spanning subgraph with o(m) edges with success probability n, n/d}) probes. Substituting d = 2m/n yields the desired bound. 3 (1− o(1))− O( d Acknowledgements. MP is supported by Minerva Foundation (124042) and ISF-2084/18. RR is supported by the NSF grants CCF-1650733, CCF-1733808, IIS-1741137 and CCF-1740751. 41 AV is supported by the NSF grant CCF-1535851. AY is supported by the NSF grants CCF-1650733, CCF-1733808, IIS-1741137 and the DPST scholarship, Royal Thai Government. References [1] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Graph sketches: sparsification, span- ners, and subgraphs. In Proc. 31st ACM Sympos. on Principles of Database Systems (PODS), pages 5 -- 14, 2012. [2] Noga Alon, Ronitt Rubinfeld, Shai Vardi, and Ning Xie. Space-efficient local computation In Proc. 23rd ACM-SIAM Sympos. Discrete Algs. (SODA), pages 1132 -- 1139, algorithms. 2012. [3] Baruch Awerbuch and David Peleg. Network synchronization with polylogarithmic overhead. In Proc. 31st Annu. IEEE Sympos. Found. Comput. Sci. (FOCS), pages 514 -- 522, 1990. [4] Baruch Awerbuch and David Peleg. Routing with polynomial communication-space trade-off. SIAM J. Discrete Math., 5(2):151 -- 162, 1992. [5] Surender Baswana and Sandeep Sen. A simple and linear time randomized algorithm for computing sparse spanners in weighted graphs. Random Structures and Algorithms, 30(4): 532 -- 563, 2007. [6] Surender Baswana, Sumeet Khurana, and Soumojit Sarkar. Fully dynamic randomized algo- rithms for graph spanners. ACM Transactions on Algorithms (TALG), 8(4):35, 2012. [7] Aaron Bernstein, Sebastian Forster, and Monika Henzinger. A deamortization approach for dynamic spanner and dynamic maximal matching. In Proc. 30th ACM-SIAM Sympos. Discrete Algs. (SODA), pages 1899 -- 1918, 2019. [8] Greg Bodwin and Sebastian Krinninger. Fully dynamic spanners with worst-case update time. In Proc. 24th Annu. European Sympos. Algorithms (ESA), pages 17:1 -- 17:18, 2016. [9] B´ela Bollob´as. Random Graphs. Number 73. Cambridge University Press, 2001. [10] Keren Censor-Hillel, Merav Parter, and Gregory Schwartzman. Derandomizing local dis- tributed algorithms under bandwidth restrictions. pages 11:1 -- 11:16, 2017. [11] Bilel Derbel and Cyril Gavoille. Fast deterministic distributed algorithms for sparse spanners. Theoretical Computer Science, 2008. [12] Bilel Derbel, Cyril Gavoille, and David Peleg. Deterministic distributed construction of linear stretch spanners in polylogarithmic time. In Proc. 21st Int. Symp. Dist. Comp. (DISC), pages 179 -- 192, 2007. [13] Bilel Derbel, Cyril Gavoille, David Peleg, and Laurent Viennot. On the locality of distributed sparse spanner construction. pages 273 -- 282, 2008. [14] Bilel Derbel, Cyril Gavoille, David Peleg, and Laurent Viennot. Local computation of nearly additive spanners. In Proc. 23rd Int. Symp. Dist. Comp. (DISC), 2009. [15] Michael Elkin. Streaming and fully dynamic centralized algorithms for constructing and main- taining sparse spanners. ACM Transactions on Algorithms (TALG), 7(2):20, 2011. 42 [16] Michael Elkin and Ofer Neiman. Efficient algorithms for constructing very sparse spanners and emulators. In Proc. 28th ACM-SIAM Sympos. Discrete Algs. (SODA), pages 652 -- 669, 2017. [17] Paul Erdos. On some extremal problems in graph theory. Israel Journal of Mathematics, 3 (2):113 -- 116, 1965. [18] Guy Even, Moti Medina, and Dana Ron. Deterministic stateless centralized local algorithms for bounded degree graphs. In Proc. 22nd Annu. European Sympos. Algorithms (ESA), pages 394 -- 405, 2014. [19] Mohsen Ghaffari and Jara Uitto. Sparsifying distributed algorithms with ramifications in massively parallel computation and centralized local computation. Proc. 30th ACM-SIAM Sympos. Discrete Algs. (SODA), 2019. [20] Oded Goldreich. A brief introduction to property testing. In Studies in Complexity and Cryptography. Miscellanea on the Interplay between Randomness and Computation, pages 465 -- 469. Springer, 2011. [21] Oded Goldreich, Shafi Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. Journal of the ACM (JACM), 45(4):653 -- 750, 1998. [22] Michael Kapralov and Rina Panigrahy. Spectral sparsification via random spanners. In Pro- ceedings of the 3rd Innovations in Theoretical Computer Science Conference, pages 393 -- 398, 2012. [23] Michael Kapralov and David Woodruff. Spanners and sparsifiers in dynamic streams. In Proc. 33rd Int. Sympos. on Princ. of Dist. Comp. (PODC), pages 272 -- 281, 2014. [24] Tali Kaufman, Michael Krivelevich, and Dana Ron. Tight bounds for testing bipartiteness in general graphs. SIAM Journal on computing, 33(6):1441 -- 1483, 2004. [25] Christoph Lenzen and Reut Levi. A centralized local algorithm for the sparse spanning graph problem. In Proc. 45th Int. Colloq. Automata Lang. Prog. (ICALP), pages 87:1 -- 87:14, 2018. [26] Reut Levi and Dana Ron. A quasi-polynomial time partition oracle for graphs with an excluded minor. ACM Transactions on Algorithms (TALG), 11(3):24, 2015. [27] Reut Levi, Dana Ron, and Ronitt Rubinfeld. Local algorithms for sparse spanning graphs. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM, pages 826 -- 842, 2014. [28] Reut Levi, Dana Ron, and Ronitt Rubinfeld. A local algorithm for constructing spanners in minor-free graphs. arXiv preprint arXiv:1604.07038, 2016. [29] Reut Levi, Guy Moshkovitz, Dana Ron, Ronitt Rubinfeld, and Asaf Shapira. Constructing near spanning trees with few local inspections. Random Structures & Algorithms, 50(2):183 -- 200, 2017. [30] Reut Levi, Ronitt Rubinfeld, and Anak Yodpinyanee. Local computation algorithms for graphs of non-constant degrees. Algorithmica, 77(4):971 -- 994, 2017. 43 [31] Yishay Mansour and Shai Vardi. A local computation approximation scheme to maximum In Approximation, Randomization, and Combinatorial Optimization. Algorithms matching. and Techniques, pages 260 -- 273. 2013. [32] Yishay Mansour, Aviad Rubinstein, Shai Vardi, and Ning Xie. Converting online algorithms to local computation algorithms. pages 653 -- 664. 2012. [33] Yishay Mansour, Boaz Patt-Shamir, and Shai Vardi. Constant-time local computation algo- rithms. In International Workshop on Approximation and Online Algorithms, pages 110 -- 121, 2015. [34] David Peleg. Distributed Computing: A Locality-sensitive Approach. SIAM, 2000. [35] David Peleg and Alejandro A Schaffer. Graph spanners. Journal of graph theory, 13(1):99 -- 116, 1989. [36] David Peleg and Jeffrey D Ullman. An optimal synchronizer for the hypercube. SIAM Journal on computing, 18(4):740 -- 747, 1989. [37] Seth Pettie. Distributed algorithms for ultrasparse spanners and linear size skeletons. Dis- tributed Computing, 22(3):147 -- 166, 2010. [38] Omer Reingold and Shai Vardi. New techniques and tighter bounds for local computation algorithms. Journal of Computer and System Sciences, 82(7):1180 -- 1200, 2016. [39] Ronitt Rubinfeld, Gil Tamir, Shai Vardi, and Ning Xie. Fast local computation algorithms. In Innovations in Computer Science - ICS 2010, pages 223 -- 238, 2011. [40] Jeanette P Schmidt, Alan Siegel, and Aravind Srinivasan. Chernoff-hoeffding bounds for applications with limited independence. SIAM J. Discrete Math., 8(2):223 -- 250, 1995. [41] Daniel A Spielman and Shang-Hua Teng. Spectral sparsification of graphs. SIAM Journal on Computing, 40(4):981 -- 1025, 2011. [42] Salil P. Vadhan. Pseudorandomness. Foundations and Trends in Theoretical Computer Science, 7(1-3):1 -- 336, 2012. [43] Rephael Wenger. Extremal graphs with no c4's, c6's, or c10's. Journal of Combinatorial Theory, Series B, 52(1):113 -- 116, 1991. 44
1212.0106
1
1212
2012-12-01T12:53:29
Fixed-parameter tractability of satisfying beyond the number of variables
[ "cs.DS" ]
We consider a CNF formula $F$ as a multiset of clauses: $F=\{c_1,..., c_m\}$. The set of variables of $F$ will be denoted by $V(F)$. Let $B_F$ denote the bipartite graph with partite sets $V(F)$ and $F$ and with an edge between $v \in V(F)$ and $c \in F$ if $v \in c$ or $\bar{v} \in c$. The matching number $\nu(F)$ of $F$ is the size of a maximum matching in $B_F$. In our main result, we prove that the following parameterization of {\sc MaxSat} (denoted by $(\nu(F)+k)$-\textsc{SAT}) is fixed-parameter tractable: Given a formula $F$, decide whether we can satisfy at least $\nu(F)+k$ clauses in $F$, where $k$ is the parameter. A formula $F$ is called variable-matched if $\nu(F)=|V(F)|.$ Let $\delta(F)=|F|-|V(F)|$ and $\delta^*(F)=\max_{F'\subseteq F} \delta(F').$ Our main result implies fixed-parameter tractability of {\sc MaxSat} parameterized by $\delta(F)$ for variable-matched formulas $F$; this complements related results of Kullmann (2000) and Szeider (2004) for {\sc MaxSat} parameterized by $\delta^*(F)$. To obtain our main result, we reduce $(\nu(F)+k)$-\textsc{SAT} into the following parameterization of the {\sc Hitting Set} problem (denoted by $(m-k)$-{\sc Hitting Set}): given a collection $\cal C$ of $m$ subsets of a ground set $U$ of $n$ elements, decide whether there is $X\subseteq U$ such that $C\cap X\neq \emptyset$ for each $C\in \cal C$ and $|X|\le m-k,$ where $k$ is the parameter. Gutin, Jones and Yeo (2011) proved that $(m-k)$-{\sc Hitting Set} is fixed-parameter tractable by obtaining an exponential kernel for the problem. We obtain two algorithms for $(m-k)$-{\sc Hitting Set}: a deterministic algorithm of runtime $O((2e)^{2k+O(\log^2 k)} (m+n)^{O(1)})$ and a randomized algorithm of expected runtime $O(8^{k+O(\sqrt{k})} (m+n)^{O(1)})$. Our deterministic algorithm improves an algorithm that follows from the kernelization result of Gutin, Jones and Yeo (2011).
cs.DS
cs
Fixed-parameter tractability of satisfying beyond the number of variables∗ Robert Crowston† Gregory Gutin† Saket Saurabh‡ Mark Jones† Venkatesh Raman‡ Anders Yeo§ Abstract We consider a CNF formula F as a multiset of clauses: F = {c1, . . . , cm}. The set of variables of F will be denoted by V (F ). Let BF denote the bipartite graph with partite sets V (F ) and F and with an edge between v ∈ V (F ) and c ∈ F if v ∈ c or ¯v ∈ c. The matching number ν(F ) of F is the size of a maximum matching in BF . In our main result, we prove that the following parameterization of MaxSat (denoted by (ν(F ) + k)-SAT) is fixed-parameter tractable: Given a formula F , decide whether we can satisfy at least ν(F ) + k clauses in F , where k is the parameter. A formula F is called variable-matched if ν(F ) = V (F ). Let δ(F ) = F − V (F ) and δ∗(F ) = maxF ′⊆F δ(F ′). Our main result implies fixed-parameter tractability of MaxSat parameterized by δ(F ) for variable-matched formulas F ; this complements related results of Kullmann (2000) and Szeider (2004) for MaxSat parameterized by δ∗(F ). To obtain our main result, we reduce (ν(F ) + k)-SAT into the following parameterization of the Hitting Set problem (denoted by (m − k)-Hitting Set): given a collection C of m subsets of a ground set U of n elements, decide whether there is X ⊆ U such that C ∩ X 6= ∅ for each C ∈ C and X ≤ m − k, where k is the parameter. Gutin, Jones and Yeo (2011) proved that (m − k)-Hitting Set is fixed-parameter tractable by obtaining an exponential kernel for the problem. We obtain two algorithms for (m − k)-Hitting Set: a deterministic algorithm of runtime O((2e)2k+O(log2 k)(m + n)O(1)) and a randomized algorithm of expected runtime O(8k+O(√k)(m + n)O(1)). Our deterministic algorithm improves an algorithm that follows from the kernelization result of Gutin, Jones and Yeo (2011). 1 Introduction In this paper we study a parameterization of MaxSat. We consider a CNF formula F as a multiset of clauses: F = {c1, . . . , cm}. (We allow repetition of clauses.) We assume that no clause contains both a variable and its negation, and no clause is empty. The set of variables of F will be denoted by V (F ), and for a clause c, V (c) = V ({c}). A truth assignment is a function τ : V (F ) → {true, false}. A truth assignment τ satisfies a clause C if there exists x ∈ V (F ) such that x ∈ C and τ (x) = true, or ¯x ∈ C and τ (x) = false. We will denote the number of clauses in F satisfied by τ as satτ (F ) and the maximum value of satτ (F ), over all τ , as sat(F ). Let BF denote the bipartite graph with partite sets V (F ) and F with an edge between v ∈ V (F ) and c ∈ F if v ∈ V (c). The matching number ν(F ) of F is the size of a maximum matching in BF . Clearly, sat(F ) ≥ ν(F ) and this lower bound for sat(F ) is tight as there are formulas F for which sat(F ) = ν(F ). ∗A preliminary version of this paper appeared in SAT 2012, Lect. Notes Comput. Sci. 7317 (2012), 341 -- 354. †Royal Holloway, University of London, Egham, Surrey, UK ‡The Institute of Mathematical Sciences, Chennai 600 113, India §University of Johannesburg, Auckland Park, 2006 South Africa 1 In this paper we study the following parameterized problem, where the parameterization is above a tight lower bound. (ν(F ) + k)-SAT Instance: A CNF formula F and a positive integer α. Parameter : k = α − ν(F ). Question: Is sat(F ) ≥ α? A natural and well-studied parameter in most optimization problems is the size of the solution. In particular, for MaxSat, the standard parameterized problem is whether sat(F ) ≥ k for a CNF formula F . Using a simple observation that sat(F ) ≥ m/2 for every CNF formula F on m clauses, Mahajan and Raman [21] showed that this problem is fixed-parameter tractable. The tight bound sat(F ) ≥ m/2 on sat(F ) means that the problem is interesting only when k > m/2, i.e., when the values of k are relatively large. To remedy this situation, Mahajan and Raman introduced, and showed fixed-parameter tractable, a more natural parameterized problem: whether the given CNF formula has an assignment satisfying at least m/2 + k clauses. Since this pioneering paper [21], researchers have studied numerous problems parameterized above tight bounds including a few such parameterizations of MaxSat [2, 6, 14], all stated in or inspired by Mahajan et al. [22]. Like the parameterizations in [2, 6, 14], (ν(F ) + k)-SAT will be proved fixed-parameter tractable, but unlike them, (ν(F ) + k)-SAT will be shown to have no polynomial-size kernel unless coNP⊆NP/poly, which is highly unlikely [4]. In our main result, we show that (ν(F ) + k)-SAT is fixed-parameter tractable by obtaining an algorithm with running time O((2e)2k+O(log2 k)(n + m)O(1)), where e is the base of the natural logarithm. (We provide basic definitions on parameterized algorithms and complexity, including kernelization, in the next section.) We also develop a randomized algorithm for (ν(F ) + k)-SAT of expected runtime O(8k+O(√k)(m + n)O(1)). The deficiency δ(F ) of a formula F is F−V (F ); the maximum deficiency δ∗(F ) = maxF ′⊆F δ(F ′). A formula F is called variable-matched if ν(F ) = V (F ). Our main result implies fixed-parameter tractability of MaxSat parameterized by δ(F ) for variable-matched formulas F . There are two related results: Kullmann [18] obtained an O(nO(δ∗(F )))-time algorithm for solving MaxSat for formulas F with n variables and Szeider [28] gave an O(f (δ∗(F ))n4)-time algorithm for the problem, where f is a function depending on δ∗(F ) only. Note that we cannot just drop the condition of being variable-matched from our result and expect a similar algorithm: it is not hard to see that the satisfiability problem remains NP-complete for formulas F with δ(F ) = 0. A formula F is minimal unsatisfiable if it is unsatisfiable but F \ c is satisfiable for every clause c ∈ F . Papadimitriou and Wolfe [26] showed that recognition of minimal unsatisfiable CNF formulas is complete for the complexity class1 DP . Kleine Buning [16] conjectured that for a fixed integer k, it can be decided in polynomial time whether a formula F with δ(F ) ≤ k is minimal unsatisfiable. Independently, Kullmann [18] and Fleischner and Szeider [11] (see also [10]) resolved this conjecture by showing that minimal unsatisfiable formulas with n variables and n + k clauses can be recognized in nO(k) time. Later, Szeider [28] showed that the problem is fixed-parameter tractable by obtaining an algorithm of running time O(2kn4). Note that Szeider's results follow from his results mentioned in the previous paragraph and the well-known fact that δ∗(F ) = δ(F ) holds for every minimal unsatisfiable formula F . Since every minimal unsatisfiable formula is variable-matched [1], our main result also implies fixed-parameter tractability of recognizing minimal unsatisfiable formula with n variables and n + k clauses, parameterized by k. 1DP is the class of problems that can be considered as the difference of two NP-problems; clearly DP contains all NP and all co-NP problems 2 To obtain our main result, we introduce some reduction rules and branching steps and reduce the problem to a parameterized version of Hitting Set, namely, (m − k)-Hitting Set defined below. Let H be a hypergraph. A set S ⊆ V (H) is called a hitting set if e∩S 6= ∅ for all e ∈ E(H). (m − k)-Hitting Set Instance: A hypergraph H (n = V (H), m = E(H)) and a positive integer k. Parameter : k. Question: Does there exist a hitting set S ⊆ V (H) of size m − k? Gutin et al. [13] showed that (m − k)-Hitting Set is fixed-parameter tractable by obtain- ing a kernel for the problem. The kernel result immediately implies a 2O(k2)(m + n)O(1)-time algorithm for the problem. Here we obtain a faster algorithm for this problem that runs in O((2e)2k+O(log2 k)(m + n)O(1)) time using the color-coding technique. This happens to be the dominating step for solving the (ν(F ) + k)-SAT problem. We also obtain a randomized algorithm for (m− k)-Hitting Set of expected runtime O(8k+O(√k)(m + n)O(1)). To obtain the randomized algorithm, we reduce (m − k)-Hitting Set into a special case of the Subgraph Isomorphism problem and use a recent randomized algorithm of Fomin et al. [9] for Subgraph Isomorphism. It was shown in [13] that the (m− k)-Hitting Set problem cannot have a kernel whose size is polynomial in k unless NP ⊆ coNP/poly. In this paper, we give a parameter preserving reduction from this problem to the (ν(F ) + k)-SAT problem, thereby showing that (ν(F ) + k)-SAT problem has no polynomial-size kernel unless NP ⊆ coNP/poly. In Section 2, we provide additional terminology Organization of the rest of the paper. and notation and some preliminary results. In Section 3, we give a sequence of polynomial time preprocessing rules on the given input of (ν(F ) + k)-SAT and justify their correctness. In Section 4, we give two simple branching rules and reduce the resulting input to a (m − k)-Hitting Set problem instance. Section 5 gives an improved fixed-parameter algorithm for (m−k)-Hitting Set using color coding. There we also obtain a faster randomized algorithm for (m− k)-Hitting Set. Section 6 summarizes the entire algorithm for the (ν(F ) + k)-SAT problem, shows its correctness and analyzes its running time. Section 7 proves the hardness of kernelization result. Section 8 concludes with some remarks. 2 Additional Terminology, Notation and Preliminaries Graphs and Hypergraphs. For a subset X of vertices of a graph G, NG(X) denotes the set of all neighbors of vertices in X. When G is clear from the context, we write N (X) instead of NG(X). A matching saturates all end-vertices of its edges. For a bipartite graph G = (V1, V2; E), the classical Hall's matching theorem states that G has a matching that saturates every vertex of V1 if and only if N (X) ≥ X for every subset X of V1. The next lemma follows from Hall's matching theorem: add d vertices to V2, each adjacent to every vertex in V1. Lemma 1. Let G = (V1, V2; E) be a bipartite graph, and suppose that for all subsets X ⊆ V1, N (X) ≥ X − d for some d ≥ 0. Then ν(G) ≥ V1 − d. We say that a bipartite graph G = (A, B; E) is q-expanding if for all A′ ⊆ A, NG(A′) ≥ A′+q. Given a matching M , an alternating path is a path in which the edges belong alternatively to M and not to M . A hypergraph H = (V (H),F ) consists of a nonempty set V (H) of vertices and a family F of nonempty subsets of V called edges of H (F is often denoted E(H)). Note that F may have parallel edges, i.e., copies of the same subset of V (H). For any vertex v ∈ V (H), and any E ⊆ F , 3 E[v] is the set of edges in E containing v, N [v] is the set of all vertices contained in edges of F [v], and the degree of v is d(v) = F [v]. For a subset T of vertices, F [T ] = Sv∈T F [v]. CNF formulas. For a subset X of the variables of CNF formula F , FX denotes the subset of F consisting of all clauses c such that V (c)∩X 6= ∅. A formula F is called q-expanding if X+q ≤ FX for each X ⊆ V (F ). Note that, by Hall's matching theorem, a formula is variable-matched if and only if it is 0-expanding. Clearly, a formula F is q-expanding if and only if BF is q-expanding. For x ∈ V (F ), n(x) and n(¯x) denote the number of clauses containing x and the number of clauses containing ¯x, respectively. A function π : U → {true, false}, where U is a subset of V (F ), is called a partial truth assignment. A partial truth assignment π : U → {true, false} is an autarky if π satisfies all clauses of FU . We have the following: Lemma 2 ([6]). Let π : U → {true, false} be an autarky for a CNF formula F and let γ be any truth assignment on V (F ) \ U . Then for the combined assignment τ := π ∪ γ, it holds that satτ (F ) = FU + satγ(F \ FU ). Clearly, τ can be constructed in polynomial time given π and γ. Autarkies were first introduced in [23]; they are the subject of much study, see, e.g., [10, 19, 28], and see [17] for an overview. Treewidth. A tree decomposition of an (undirected) graph G is a pair (U, T ) where T is a tree whose vertices we will call nodes and U = ({Ui i ∈ V (T )}) is a collection of subsets of V (G) such that 1. Si∈V (T ) Ui = V (G), 2. for each edge vw ∈ E(G), there is an i ∈ V (T ) such that v, w ∈ Ui, and 3. for each v ∈ V (G) the set {i : v ∈ Ui} of nodes forms a subtree of T . The Ui's are called bags. The width of a tree decomposition ({Ui i ∈ V (T )}, T ) equals maxi∈V (T ){Ui − 1}. The treewidth of a graph G is the minimum width over all tree decom- positions of G. We use notation tw(G) to denote the treewidth of a graph G. : Parameterized Complexity. A parameterized problem is a subset L ⊆ Σ∗ × N over a finite alphabet Σ. The unparameterized version of a parameterized problem L is the language Lc = {x#1k(x, k) ∈ L}. The problem L is fixed-parameter tractable if the membership of an instance (x, k) in Σ∗ × N can be decided in time f (k)xO(1), where f is a function of the parameter k only [8, 12, 24]. Given a parameterized problem L, a kernelization of L is a polynomial-time algorithm that maps an instance (x, k) to an instance (x′, k′) (the kernel ) such that (i) (x, k) ∈ L if and only if (x′, k′) ∈ L, (ii) k′ ≤ g(k), and (iii) x′ ≤ g(k) for some function g. We call g(k) the size of the kernel. It is well-known [8, 12] that a decidable parameterized problem L is fixed- parameter tractable if and only if it has a kernel. Polynomial-size kernels are of main interest, due to applications [8, 12, 24], but unfortunately not all fixed-parameter problems have such kernels unless coNP⊆NP/poly, see, e.g., [4, 5, 7]. For a positive integer q, let [q] = {1, . . . , q}. 3 Preprocessing Rules In this section we give preprocessing rules and their correctness. Let F be the given CNF formula on n variables and m clauses with a maximum matching M on BF , the variable-clause bipartite graph corresponding to F . Let α be a given integer and recall 4 that our goal is to check whether sat(F ) ≥ α. For each preprocessing rule below, we let (F ′, α′) be the instance resulting by the application of the rule on (F, α). We say that a rule is valid if (F, α) is a Yes instance if and only if (F ′, α′) a Yes instance. Reduction Rule 1. Let x be a variable such that n(x) = 0 (respectively n(¯x) = 0). Set x = false (x = true) and remove all the clauses that contain ¯x (x). Reduce α by n(¯x) (respectively n(x)). The proof of the following lemma is immediate. Lemma 3. If n(x) = 0 (respectively n(¯x) = 0) then sat(F ) = sat(F ′)+n(¯x) (respectively sat(F ) = sat(F ′) + n(x)), and so Rule 1 is valid. Reduction Rule 2. Let n(x) = n(¯x) = 1 and let c′ and c′′ be the two clauses containing x and ¯x, respectively. Let c∗ = (c′ − x) ∪ (c′′ − ¯x) and let F ′ be obtained from F be deleting c′ and c′′ and adding the clause c∗. Reduce α by 1. Lemma 4. For F and F ′ in Reduction Rule 2, sat(F ) = sat(F ′) + 1, and so Rule 2 is valid. Proof. Consider any assignment for F . If it satisfies both c′ and c′′, then the same assignment will satisfy c∗. So when restricted to variables of F ′, it will satisfy at least sat(F ) − 1 clauses of F ′. Thus sat(F ′) ≥ sat(F ) − 1 which is equivalent to sat(F ) ≤ sat(F ′) + 1. Similarly if an assignment γ to F ′ satisfies c∗ then at least one of c′, c′′ is satisfied by γ. Therefore by setting x true if γ satisfies c′′ and false otherwise, we can extend γ to an assignment on F that satisfies both of c′, c′′. On the other hand, if c∗ is not satisfied by γ then neither c′ nor c′′ is satisfied by γ, and any extension of γ will satisfy exactly one of c′, c′′. Therefore in either case sat(F ) ≥ sat(F ′) + 1. We conclude that sat(F ) = sat(F ′) + 1, as required. Our next reduction rule is based on the following lemma proved in Fleischner et al. [10, Lemma 10], Kullmann [19, Lemma 7.7] and Szeider [28, Lemma 9]. Lemma 5. Let F be a CNF formula. Given a maximum matching in BF , in time O(F) we can find an autarky π : U → {true, false} such that F \ FU is 1-expanding. Reduction Rule 3. Find an autarky π : U → {true, false} such that F \ FU is 1-expanding. Set F ′ = F \ FU and reduce α by FU. The next lemma follows from Lemma 2. Lemma 6. For F and F ′ in Reduction Rule 3, sat(F ) = sat(F ′) + FU and so Rule 3 is valid. After exhaustive application of Rule 3, we may assume that the resulting formula is 1-expanding. For the next reduction rule, we need the following results. Theorem 1 (Szeider [28]). Given a variable-matched formula F , with F = V (F ) + 1, we can decide whether F is satisfiable in time O(V (F )3). Consider a bipartite graph G = (A, B; E). Recall that a formula F is q-expanding if and only if BF is q-expanding. From a bipartite graph G = (A, B; E), x ∈ A and q ≥ 1, we obtain a bipartite graph Gqx, by adding new vertices x1, . . . , xq to A and adding edges such that new vertices have exactly the same neighborhood as x, that is, Gqx = (A∪{x1, . . . , xq}, B; E∪{(xi, y) : (x, y) ∈ E}). The following result is well known. Lemma 7. [20, Theorem 1.3.6] Let G = (A, B; E) be a 0-expanding bipartite graph. Then G is q-expanding if and only if Gqx is 0-expanding for all x ∈ A. Lemma 8. Let G = (A, B; E) be a 1-expanding bipartite graph. In polynomial time, we can check whether G is 2-expanding, and if it is not, find a set S ⊆ A such that NG(S) = S + 1. 5 Proof. Let x ∈ A. By Hall's Matching Theorem, G2x is 0-expanding if and only if ν(G2x) = A+2. Since we can check the last condition in polynomial time, by Lemma 7 we can decide whether G is 2-expanding in polynomial time. So, assume that G is not 2-expanding and we know this because G2y is not 0-expanding for some y ∈ A. By Lemma 3(4) in [28], in polynomial time, we can find a set T ⊆ A ∪ {y1, y2} such that NG2y (T ) < T. Since G is 1-expanding, y1, y2 ∈ T and NG2y (T ) = T − 1. Hence, S + 1 = NG(S), where S = T \ {y1, y2}. For a formula F and a set S ⊆ V (F ), F [S] denotes the formula obtained from FS by deleting all variables not in S. Reduction Rule 4. Let F be a 1-expanding formula and let B = BF . Using Lemma 8, check whether F is 2-expanding. If it is then do not change F , otherwise find a set S ⊆ V (F ) with NB(S) = S + 1. Let M be a matching that saturates S in B[S ∪ NB(S)] (that exists as B[S ∪ NB(S)] is 1-expanding). Use Theorem 1 to decide whether F [S] is satisfiable, and proceed as follows. F [S] is satisfiable: Obtain a new formula F ′ by removing all clauses in NB(S) from F . Reduce α by NB(S). F [S] is not satisfiable: Let c′ be the clause obtained by deleting all variables in S from ∪c′′∈NB(S)c′′. That is, a literal l belongs to c′ if and only if it belongs to some clause in NB(S) and the variable corresponding to l is not in S. Obtain a new formula F ′ by removing all clauses in NB(S) from F and adding c′. Reduce α by S. Lemma 9. For F , F ′ and S introduced in Rule 4, if F [S] is satisfiable sat(F ) = sat(F ′)+NB(S), otherwise sat(F ) = sat(F ′) + S and thus Rule 4 is valid. Proof. We consider two cases. Case 1: F [S] is satisfiable. Observe that there is an autarky on S and thus by Lemma 2, sat(F ) = sat(F ′) + NB(S). Case 2: F [S] is not satisfiable. Let F ′′ = F ′ \ c′. As any optimal truth assignment to F will satisfy at least sat(F ) − NB(S) clauses of F ′′, it follows that sat(F ) ≤ sat(F ′′) + NB(S) ≤ sat(F ′) + NB(S). Let y denote the clause in NB(S) that is not matched to a variable in S by M . Let S′ be the set of variables, and Z the set of clauses, that can be reached from y with an M -alternating path in B[S ∪ NB(S)]. We argue now that Z = NB(S). Since Z is made up of clauses that are reachable in B[S ∪ NB(S)] by an M -alternating path from the single unmatched clause y, Z = S′ + 1. It follows that NB(S)\Z = S\S′, and M matches every clause in NB(S)\Z with a variable in S\S′. Furthermore, NB(S\S′) ∩ Z = ∅ as otherwise the matching partners of some elements of S\S′ would have been reachable by an M -alternating path from y, contradicting the definition of NB(S) and S′. Thus S \ S′ has an autarky such that F \ FS\S ′ is 1-expanding which would have been detected by Rule 3, hence S \ S′ = ∅ and so S = S′. That is, all clauses in NB(S) are reachable from the unmatched clause y by an M -alternating path. We have now shown that Z = NB(S), as desired. Suppose that there exists an assignment γ to F ′, that satisfies sat(F ′) clauses of F ′ that also satisfies c′. Then there exists a clause c′′ ∈ NB(S) that is satisfied by γ. As c′′ is reachable from y by an M -alternating path, we can modify M to include y and exclude c′′, by taking the symmetric difference of the matching and the M -alternating path from y to c′′. This will give a matching saturating S and NB(S) \ c′′, and we use this matching to extend the assignment γ to one which satisfies all of NB(S)\c′′. We therefore have satisfied all the clauses of NB(S). Therefore since c′ is satisfied in F ′ but does not appear in F, we have satisfied extra NB(S) − 1 = S clauses. Suppose on the other hand that every assignment γ for F ′ that satisfies sat(F ′) clauses does not 6 satisfy c′. We can use the matching on B[S ∪ NB(S)] to satisfy NB(S) − 1 clauses in NB(S), which would give us an additional S clauses in NB(S). Thus sat(F ) ≥ sat(F ′) + S. As NB(S) = S + 1, it suffices to show that sat(F ) < sat(F ′) + NB(S). Suppose that there exists an assignment γ to F that satisfies sat(F ′) + NB(S) clauses, then it must satisfy all the clauses of NB(S) and sat(F ′) clauses of F ′′. As F [S] is not satisfiable, variables in S alone can not satisfy all of NB(S). Hence there exists a clause c′′ ∈ NB(S) such that there is a variable v ∈ V (c′′) \ S that satisfies c′′. But then v ∈ V (c′) and hence c′ would be satisfiable by γ, a contradiction as γ satisfies sat(F ′) clauses of F ′′. 4 Branching Rules and Reduction to (m − k)-Hitting Set Our algorithm first applies Reduction Rules 1, 2, 3 and 4 exhaustively on (F, α). Then it applies two branching rules we describe below, in the following order. Branching on a variable x means that the algorithm constructs two instances of the problem, one by substituting x = true and simplifying the instance and the other by substituting x = false and simplifying the instance. Branching on x or y being false means that the algorithm constructs two instances of the problem, one by substituting x = false and simplifying the instance and the other by substituting y = false and simplifying the instance. Simplifying an instance is done as follows. For any clause c, if c contains a literal z with z = true, remove c and reduce α by 1. If c contains a literal z with z = false and c contains other literals, remove z from c. If c consists of the single literal z = false, remove c. A branching rule is correct if the instance on which it is applied is a Yes-instance if and only if the simplified instance of (at least) one of the branches is a Yes-instance. Branching Rule 1. If n(x) ≥ 2 and n(¯x) ≥ 2 then we branch on x. Before attempting to apply Branching Rule 2, we apply the following rearranging step: For all variables x such that n(¯x) = 1, swap literals x and ¯x in all clauses. Clearly, this will not change sat(F ). Observe that now for every variable n(x) = 1 and n(¯x) ≥ 2. Branching Rule 2. If there is a clause c such that positive literals x, y ∈ c then we branch on x being false or y being false. Branching Rule 1 is exhaustive and thus its correctness also follows. When we reach Branching Rule 2 for every variable n(x) = 1 and n(¯x) ≥ 2. As n(x) = 1 and n(y) = 1 we note that c is the only clause containing these literals. Therefore there exists an optimal solution with x or y being false (if they are both true just change one of them to false). Thus, we have the following: Lemma 10. Branching Rules 1 and 2 are correct. Let (F, α) be the given instance on which Reduction Rules 1, 2, 3 and 4, and Branching Rules 1 and 2 do not apply. Observe that for such an instance F the following holds: 1. For every variable x, n(x) = 1 and n(¯x) ≥ 2. 2. Every clause contains at most one positive literal. We call a formula F satisfying the above properties special. In what follows we describe an algorithm for our problem on special instances. Let c(x) denote the unique clause containing positive literal x. We can obtain a matching saturating V (F ) in BF by taking the edge connecting the variable x and the clause c(x). We denote the resulting matching by Mu. We first describe a transformation that will be helpful in reducing our problem to (m − k)- Hitting Set. Given a formula F we obtain a new formula F ′ by changing the clauses of F as follows. If there exists some c(x) such that c(x) ≥ 2, do the following. Let c′ = c(x) − x (that is, 7 c′ contain the same literals as c(x) except for x) and add c′ to all clauses containing the literal ¯x. Furthermore remove c′ from c(x) (which results in c(x) = (x) and therefore c(x) = 1). Next we prove the validity of the above transformation. Lemma 11. Let F ′ be the formula obtained by applying the transformation described above on F . Then sat(F ′) = sat(F ) and ν(BF ) = ν(BF ′ ). Proof. We note that the matching Mu remains a matching in BF ′ and thus ν(BF ) = ν(BF ′ ). Let γ be any truth assignment to the variables in F (and F ′) and note that if c′ is false under γ then F and F ′ satisfy exactly the same clauses under γ (as we add and subtract something false to the clauses). So assume that c′ is true under γ. If γ maximizes the number of satisfied clauses in F then clearly we may assume that x is false (as c(x) is true due to c′). Now let γ′ be equal to γ except the value of x has been flipped to true. Note that exactly the same clauses are satisfied in F and F ′ by γ and γ′, respectively. Analogously, if an assignment maximizes the number of satisfied clauses in F ′ we may assume that x is true and by changing it to false we satisfy equally many clauses in F . Hence, sat(F ′) = sat(F ). We now show the following equivalence between (ν(F ) + k)-SAT on transformed special in- Given a special instance (F, α) we apply the above transformation repeatedly until no longer possible and obtain an instance (F ′, α) such that sat(F ′) = sat(F ), ν(BF ) = ν(BF ′ ) and c(x) = 1 for all x ∈ V (F ′). We call such an instance (F ′, α) transformed special. Observe that, it takes polynomial time, to obtain the transformed special instance from a given special instance. For simplicity of presentation we denote the transformed special instance by (F, α). Let C∗ denote all clauses that are not matched by Mu (and therefore only contain negated literals). We associate a hypergraph H∗ with the transformed special instance. Let H∗ be the hypergraph with vertex set V (F ) and edge set E∗ = {V (c) c ∈ C∗}. stances and (m − k)-Hitting Set. Lemma 12. Let (F, α) be the transformed special instance and H∗ be the hypergraph associated with it. Then sat(F ) ≥ α if and only if there is a hitting set in H∗ of size at most E(H∗) − k, where k = α − ν(F ). Proof. We start with a simple observation about an assignment satisfying the maximum number of clauses of F . There exists an optimal truth assignment to F , such that all clauses in C∗ are true. Assume that this is not the case and let γ be an optimal truth assignment satisfying as many clauses from C∗ as possible and assume that c ∈ C∗ is not satisfied. Let ¯x ∈ c be an arbitrary literal and note that γ(x) = true. However, changing x to false does not decrease the number of satisfied clauses in F and increases the number of satisfied clauses in C∗. Now we show that sat(F ) ≥ α if and only if there is a hitting set in H∗ of size at most E(H∗) − k. Assume that γ is an optimal truth assignment to F , such that all clauses in C∗ are true. Let U ⊆ V (F ) be all variables that are false in γ and note that U is a hitting set in H∗. Analogously if U′ is a hitting set in H∗ then by letting all variables in U′ be false and all other variables in V (F ) be true we get a truth assignment that satisfies F − U′ clauses in F . Therefore if τ (H∗) is the size of a minimum hitting set in H∗ we have sat(F ) = F−τ (H∗). Hence, sat(F ) = F−τ (H∗) = V (F )+C∗−τ (H∗) and thus sat(F ) ≥ α if and only if C∗−τ (H∗) ≥ k, which is equivalent to τ (H∗) ≤ E(H∗) − k. Therefore our problem is fixed-parameter tractable on transformed special instances, by the next theorem that follows from the kernelization result in [13]. Theorem 2. There exists an algorithm for (m− k)-Hitting Set running in time 2O(k2) + O((n+ m)O(1)). In the next section we give faster algorithms for (ν(F ) + k)-SAT on transformed special in- stances by giving faster algorithms for (m − k)-Hitting Set. 8 5 Algorithms for (m − k)-Hitting Set To obtain faster algorithms for (m − k)-Hitting Set, we utilize the following concept of k-mini- hitting set introduced in [13]. Definition 1. Let H = (V,F ) be a hypergraph and k be a nonnegative integer. A k-mini-hitting set is a set Smini ⊆ V such that Smini ≤ k and F [Smini] ≥ Smini + k. Lemma 13 ([13]). A hypergraph H has a hitting set of size at most m − k if and only if it has a k-mini-hitting set. Moreover, given a k-mini-hitting set Smini, we can construct a hitting set S with S ≤ m − k such that Smini ⊆ S in polynomial time. 5.1 Deterministic Algorithm Next we give an algorithm that finds a k-mini-hitting set Smini if it exists, in time ck(m + n)O(1), where c is a constant. We first describe a randomized algorithm based on color-coding [3] and then derandomize it using hash functions. Let χ : E(H) → [q] be a function. For a subset S ⊆ V (H), χ(S) denotes the maximum subset X ⊆ [q] such that for all i ∈ X there exists an edge e ∈ E(H) with χ(e) = i and e ∩ S 6= ∅. A subset S ⊆ V (H) is called a colorful hitting set if χ(S) = [q]. We now give a procedure that given a coloring function χ finds a minimum colorful hitting set, if it exists. This algorithm will be useful in obtaining a k-mini-hitting set Smini. Lemma 14. Given a hypergraph H and a coloring function χ : E(H) → [q], we can find a minimum colorful hitting set if there exists one in time O(2qq(m + n)). Proof. We first check whether for every i ∈ [q], χ−1(i) 6= ∅. If for any i we have that χ−1(i) = ∅, then we return that there is no colorful hitting set. So we may assume that for all i ∈ [q], χ−1(i) 6= ∅. We will give an algorithm using dynamic programming over subsets of [q]. Let γ be an array of size 2q indexed by the subsets of [q]. For a subset X ⊆ [q], let γ[X] denote the size of a smallest set W ⊆ V (H) such that X ⊆ χ(W ). We obtain a recurrence for γ[X] as follows: γ[X] = (cid:26) min(v∈V (H),χ({v})∩X6=∅){1 + γ[X \ χ({v})]} if X ≥ 1, 0 if X = ∅. The correctness of the above recurrence is clear. The algorithm computes γ[[q]] by filling the γ in the order of increasing set sizes. Clearly, each cell can be filled in time O(q(n + m)) and thus the whole array can be filled in time O(2qq(n + m)). The size of a minimum colorful hitting set is given by γ[[q]]. We can obtain a minimum colorful hitting set by the routine back-tracking. (p+k)! Now we describe a randomized procedure to obtain a k-mini-hitting set Smini in a hypergraph H, if there exists one. We do the following for each possible value p of Smini (that is, for 1 ≤ p ≤ k). Color E(H) uniformly at random with colors from [p + k]; we denote this random coloring by χ. Assume that there is a k-mini-hitting set Smini of size p and some p + k edges e1, . . . , ep+k such that for all i ∈ [p + k], ei ∩ Smini 6= ∅. The probability that for all 1 ≤ i < j ≤ p + k we (p+k)p+k ≥ e−(p+k) ≥ e−2k. Now, using Lemma 14 we can test in have that χ(ei) 6= χ(ej) is time O(2p+k(p + k)(m + n)) whether there is a colorful hitting set of size at most p. Thus with probability at least e−2k we can find a Smini, if there exits one. To boost the probability we repeat the procedure e2k times and thus in time O((2e)2k2k(m + n)O(1)) we find a Smini, if there exists one, with probability at least 1 − (1 − 1 2 . If we obtained Smini then using Lemma 13 we can construct a hitting set of H of size at most m − k. To derandomize the procedure, we need to replace the first step of the procedure where we color the edges of E(H) uniformly at random from the set [p + k] to a deterministic one. This is done by making use of an (m, p + k, p + k)-perfect hash family. An (m, p + k, p + k)-perfect hash family, e2k )e2k ≥ 1 9 H, is a set of functions from [m] to [p + k] such that for every subset S ⊆ [m] of size p + k there exists a function f ∈ H such that f is injective on S. That is, for all i, j ∈ S, f (i) 6= f (j). There exists a construction of an (m, p + k, p + k)-perfect hash family of size O(ep+k · kO(log k) · log m) and one can produce this family in time linear in the output size [27]. Using an (m, p + k, p + k)- perfect hash family H of size at most O(e2k · kO(log k) · log m) rather than a random coloring we get the desired deterministic algorithm. To see this, it is enough to observe that if there is a subset Smini ⊆ V (H) such that F [Smini] ≥ Smini + k then there exists a coloring f ∈ H such that the p + k edges e1, . . . , ep+k that intersect Smini are distinctly colored. So if we generate all colorings from H we will encounter the desired f . Hence for the given f , when we apply Lemma 14 we get the desired result. This concludes the description. The total time of the derandomized algorithm is O(k22k(m + n)e2k · kO(log k) · log m) = O((2e)2k+O(log2 k)(m + n)O(1)). Theorem 3. There exists an algorithm solving (m − k)-Hitting Set in time O((2e)2k+O(log2 k)(m + n)O(1)). By Theorem 3 and the transformation discussed in Section 4 we have the following theorem. Theorem 4. There exists an algorithm solving a transformed special instance of (ν(F ) + k)-SAT in time O((2e)2k+O(log2 k)(m + n)O(1)). 5.2 Randomized Algorithm In this subsection we give a randomized algorithm for (m − k)-Hitting Set running in time O(8k+O(√k)(m + n)O(1)). However, unlike the algorithm presented in the previous subsection we do not know how to derandomize this algorithm. Essentially, we give a randomized algorithm to find a k-mini-hitting set Smini in the hypergraph H, if it exists. Towards this we introduce notions of a star-forest and a bush. We call K1,ℓ a star of size ℓ; a vertex of degree ℓ in K1,ℓ is a central vertex (thus, both vertices in K1,1 are central). A star-forest is a forest consisting of stars. A star-forest F is said to have dimension (a1, a2, . . . , ap) if F has p stars with sizes a1, a2, . . ., ap respectively. Given a star-forest F of dimension (a1, a2, . . . , ap), we construct a graph, which we call a bush of dimension (a1, a2, . . . , ap), by adding a triangle (x, y, z) and making y adjacent to a central vertex of in every star of F . For a hypergraph H = (V,F ), the incidence bipartite graph BH of H has partite sets V and F , and there is an edge between v ∈ V and e ∈ F in H if v ∈ e. Given BH , we construct B∗H by adding a triangle (x, y, z) and making y adjacent to every vertex in the V . The following lemma relates k-mini-hitting sets to bushes. Lemma 15. A hypergraph H = (V,F ) has a k-mini-hitting set Smini if and only if there exists a tuple (a1, . . . , ap) such that (a) p ≤ k, ai ≥ 1 for all i ∈ [p], and Pp (b) there exists a subgraph of B∗H isomorphic to a bush of dimension (a1, . . . , ap). i=1 ai = p + k; and Proof. We first prove that the existence of a k-mini-hitting set in H implies the existence of a bush in B∗H of dimension satisfying (a) and (b). Let Smini = {w1, . . . , wq} be a k-mini-hitting set and let Si = {w1, . . . , wi}. We know that q ≤ k and F [Smini] ≥ Smini+k. We define Ei := F [Si]\F [Si−1] for every i ≥ 2, and E1 := F [S1]. Let Es1 , . . . ,Esr be the subsequence of the sequence E1, . . . ,Eq consisting only of non-empty sets Ei, and let bj = Esj for each j ∈ [r]. Let p be the least integer from [r] such that Pp Observe that for every j ∈ [p], the vertex wsj belongs to each hyperedge of Esj . Thus, the bipartite graph BH contains a star-forest F of dimension (b1, . . . , bp), such that p ≤ k, bj ≥ 1 for all j ∈ [p], and c := Pp j=1 bj ≥ p + k. Moreover, each star in F has a central vertex in V. By the i=1 bi ≥ k + p. 10 minimality of p, we have Pp−1 j=1 bj < p − 1 + k and so bp ≥ c + 1 − (p + k). Thus, the integers aj defined as follows are positive: aj := bj for every j ∈ [p− 1] and ap := bp − c + (p + k). Hence, BH contains a star-forest F ′ of dimension (a1, . . . , ap), such that each star in F ′ has a central vertex in V. Thus, all central vertices are in V , p ≤ k, ai ≥ 1 for all i ∈ [p], and Pp i=1 ai = p + k, which implies that B∗H contains, as a subgraph, a bush with dimension (a1, . . . , ap) satisfying the conditions above. The construction above relating a k-mini-hitting set of H with the required bush of B∗H can be easily reversed in the following sense: the existence of a bush of dimension satisfying (a) and (b) in B∗H implies the existence of a k-mini-hitting set in H. Here the triangle ensures that the central vertices are in V. This completes the proof. Next we describe a fast randomized algorithm for deciding the existence of a k-mini-hitting set using the characterization obtained in Lemma 15. Towards this we will use a fast randomized algorithm for the Subgraph Isomorphism problem. In the Subgraph Isomorphism problem we are given two graphs F and G on k and n vertices, respectively, as an input, and the question is whether there exists a subgraph of G isomorphic to F . Recall that tw(G) denotes the treewidth of a graph G. We will use the following result. Theorem 5 (Fomin et al.[9]). Let F and G be two graphs on q and n vertices respectively and tw(F ) ≤ t. Then, there is a randomized algorithm for the Subgraph Isomorphism problem that runs in expected time O(2q(nt)t+O(1)). Let Pℓ(s) be the set of all unordered partitions of an integer s into ℓ parts. Nijenhuis and Wilf [25] designed a polynomial delay generation algorithm for partitions of Pℓ(s). Let p(s) be the partition function, i.e., the overall number of partitions of s. The asymptotic behavior of p(s) was first evaluated by Hardy and Ramanujan in the paper in which they develop the famous "circle method." Theorem 6 (Hardy and Ramanujan [15]). We have p(s) ∼ eπ√ 2s 3 /(4s√3), as s → ∞. This theorem and the algorithm of Nijenhuis and Wilf [25] imply the following: Proposition 1. There is an algorithm of runtime 2O(√s) for generating all partitions in Pℓ(s). Now we are ready to describe and analyze a fast randomized algorithm for deciding the existence of a k-mini-hitting set in a hypergraph H. By Lemma 15, it suffices to design and analyze a fast randomized algorithm for deciding the existence of a bush in B∗H of dimension (a1, . . . , ap) satisfying conditions (a) and (b) of Lemma 15. Our algorithm starts by building B∗H . Then it considers all possible values of p one by one (p ∈ [k]) and generates all partitions in Pp(p+ k) using the algorithm of Proposition 1. For each such partition (a1, . . . , ap) that satisfies conditions (a) and (b) of Lemma 15, the algorithm of Fomin et al.[9] mentioned in Theorem 5 decides whether B∗H contains a bush of dimension (a1, . . . , ap). If such a bush exists, we output Yes and we output No, otherwise. To evaluate the runtime of our algorithm, observe that the treewidth of any bush is 2 and any bush in Lemma 15 has at most 3k + 3 vertices. This observation, the algorithm above, Theorem 5 and Proposition 1 imply the following: Theorem 7. There exists a randomized algorithm solving (m− k)-Hitting Set in expected time O(8k+O(√k)(m + n)O(1)). This theorem, in turn, implies the following: Theorem 8. There exists a randomized algorithm solving a transformed special instance of (ν(F )+ k)-SAT in expected time O(8k+O(√k)(m + n)O(1)). 11 6 Complete Algorithm, Correctness and Analysis The complete algorithm for an instance (F, α) of (ν(F ) + k)-SAT is as follows. Find a maximum matching M on BF and let k = α − M. If k ≤ 0, return Yes. Otherwise, apply Reduction Rules 1 to 4, whichever is applicable, in that order and then run the algorithm on the reduced instance and return the answer. If none of the Reduction Rules apply, then apply Branching Rule 1 if possible, to get two instances (F ′, α′) and (F ′′, α′′). Run the algorithm on both instances; if one of them returns Yes, return Yes, otherwise return No. If Branching Rule 1 does not apply then we rearrange the formula and attempt to apply Branching Rule 2 in the same way. Finally if k > 0 and none of the reduction or branching rules apply, then we have for all variables x, n(x) = 1 and every clause contains at most one positive literal, i.e. (F, α) is a special instance. Then solve the problem by first obtaining the transformed special instance, then the corresponding instance H∗ of (m − k)-Hitting Set and solving H∗ in time O((2e)2k+O(log2 k)(m + n)O(1)) as described in Sections 4 and 5. Correctness of all the preprocessing rules and the branching rules follows from Lemmata 3, 4, 6, 9 and 10. Analysis of the algorithm. Let (F, α) be the input instance. Let µ(F ) = µ = α− ν(F ) be the measure. We will first show that our preprocessing rules do not increase this measure. Following this, we will prove a lower bound on the decrease in the measure occurring as a result of the branching, thus allowing us to bound the running time of the algorithm in terms of the measure µ. For each case, we let (F ′, α′) be the instance resulting by the application of the rule or branch. Also let M′ be a maximum matching of BF ′ . Reduction Rule 1: We consider the case when n(x) = 0; the other case when n(¯x) = 0 is analogous. We know that α′ = α − n(¯x) and ν(F ′) ≥ ν(F ) − n(¯x) as removing n(¯x) clauses can only decrease the matching size by n(¯x). This implies that µ(F )− µ(F ′) = α− ν(F )− α′ + ν(F ′) = (α − α′) + (ν(F ′) − ν(F )) ≥ n(¯x) − n(¯x). Thus, µ(F ′) ≤ µ(F ). Reduction Rule 2: We know that α′ = α − 1. We show that ν(F ′) ≥ ν(F ) − 1. In this case we remove the clauses c′ and c′′ and add c∗ = (c′ − x) ∪ (c′′ − ¯x). We can obtain a matching of size ν(F ) − 1 in BF ′ as follows. If at most one of the c′ and c′′ is the end-point of some matching edge in M then removing that edge gives a matching of size ν(F ) − 1 for BF ′ . So let us assume that some edges (a, c′) and (b, c′′) are in M . Clearly, either a 6= x or b 6= x. Assume a 6= x. Then M \ {(a, c′), (b, c′′)} ∪ {(a, c∗)} is a matching of size ν(F ) − 1 in BF ′. Thus, we conclude that µ(F ′) ≤ µ(F ). Reduction Rule 3: The proof is the same as in the case of Reduction Rule 1. Reduction Rule 4: The proof that µ(F ′) ≤ µ(F ) in the case when F [S] is satisfiable is the same as in the case of Reduction Rule 1 and in the case when F [S] is not satisfiable is the same as in the case of Reduction Rule 2. Branching Rule 1: Consider the case when we set x = true. In this case, α′ = α − n(x). Also, since no reduction rules are applicable we have that F is 2-expanding. Hence, ν(F ) = V (F ). We will show that in (F ′, α′) the matching size will remain at least ν(F ) − n(x) + 1 (= V (F ) − n(x) + 1 = V (F ′) − n(x) + 2.) This will imply that µ(F ′) ≤ µ(F ) − 1. By Lemma 1 and the fact that n(x) − 2 ≥ 0, it suffices to show that in B′ = BF ′, every subset S ⊆ V (F ′), NB ′(S) ≥ S − (n(x) − 2). The only clauses that have been removed by the simplification process after setting x = true are those where x appears positively and the singleton clauses (¯x). Hence, the only edges of G[S ∪ NB[S]] that are missing in NB ′(S) from NB(S) are 12 those corresponding to clauses that contain x as a pure literal and some variable in S. Thus, NB ′(S) ≥ S + 2 − n(x) = S − (n(x) − 2) (as F is 2-expanding). The case when we set x = false is similar to the case when we set x = true. Here, also we can show that µ(F ′) ≤ µ(F ) − 1. Thus, we get two instances, with each instance (F ′, α′) having µ(F ′) ≤ µ(F ) − 1. Branching Rule 2: The analysis here is the same as for Branching Rule 1 and again we get two instances with µ(F ′) ≤ µ(F ) − 1. We therefore have a depth-bounded search tree of size of depth at most µ = α − ν(F ) = k, in which any branching splits an instance into two instances. Thus, the search tree has at most 2k instances. As each reduction and branching rule takes polynomial time, every rule decreases the number of variables, the number of clauses, or the value of µ, and an instance to which none of the rules apply can be solved in time O((2e)2µµO(log µ)(m + n)O(1)) (by Theorem 4), we have by induction that any instance can be solved in time O(2 · (2e)2(µ−1)(µ − 1)O(log(µ−1))(m + n)O(1)) = O((2e)2µµO(log µ)(m + n)O(1)). Thus the total running time of the algorithm is at most O((2e)2k+O(log2 k)(n + m)O(1)). Applying Theorem 8 instead of Theorem 4, we conclude that (ν(F ) + k)-SAT can be solved in expected time O(8k+O(√k)(n + m)O(1)). Summarizing, we have the following: Theorem 9. There are algorithms solving (ν(F ) + k)-SAT in time O((2e)2k+O(log2 k)(n + m)O(1)) or expected time O(8k+O(√k)(n + m)O(1)). 7 Hardness of Kernelization In this section, we show that (ν(F )+k)-SAT does not have a polynomial-size kernel, unless coNP ⊆ NP/poly. To do this, we use the concept of a polynomial parameter transformation [5, 7]: Let L and Q be parameterized problems. We say a polynomial time computable function f : Σ∗×N → Σ∗×N is a polynomial parameter transformation from L to Q if there exists a polynomial p : N → N such that for any (x, k) ∈ Σ∗ × N, (x, k) ∈ L if and only if f (x, k) = (x′, k′) ∈ Q, and k′ ≤ p(k). Lemma 16. [5, Theorem 3] Let L and Q be parameterized problems, and suppose that Lc and Qc are the derived classical problems2. Suppose that Lc is NP-complete, and Qc ∈ NP. Suppose that f is a polynomial parameter transformation from L to Q. Then, if Q has a polynomial-size kernel, then L has a polynomial-size kernel. The proof of the next theorem is similar to the proof of Lemma 12. Theorem 10. (ν(F ) + k)-SAT has no polynomial-size kernel, unless coNP ⊆ NP/poly. Proof. By [13, Theorem 3], there is no polynomial-size kernel for the problem of deciding whether a hypergraph H has a hitting set of size E(H) − k, where k is the parameter unless coNP ⊆ NP/poly. We prove the theorem by a polynomial parameter reduction from this problem. Then the theorem follows from Lemma 16, as (ν(F ) + k)-SAT is NP-complete. Given a hypergraph H on n vertices, construct a CNF formula F as follows. Let the variables of F be the vertices of H. For each variable x, let the unit clause (x) be a clause in F . For every edge e in H, let ce be the clause containing the literal ¯x for every x ∈ E. Observe that F is matched, and that H has a hitting set of size E(H) − k if and only if sat(F ) ≥ n + k. 2The parameters of L and Q are no longer parameters in Lc and Qc; they are part of input. 13 8 Conclusion We have shown that for any CNF formula F , it is fixed-parameter tractable to decide if F has a satisfiable subformula containing α clauses, where α − ν(F ) is the parameter. Our result implies fixed-parameter tractability for the problem of deciding satisfiability of F when F is variable- matched and δ(F ) ≤ k, where k is the parameter. In addition, we show that the problem does not have a polynomial-size kernel unless coNP ⊆ NP/poly. Clearly, parameterizations of MaxSat above m/2 and ν(F ) are "stronger" than the standard parameterization (i.e., when the parameter is the size of the solution). Whilst the two non-standard parameterizations have smaller parameter than the standard one, they are incomparable to each other as for some formulas F , m/2 < ν(F ) (e.g., for variable-matched formulas with m < 2n) and for some formulas F , m/2 > ν(F ) (e.g., when m > 2n). Recall that Mahajan and Raman [21] proved that MaxSat parameterized above m/2 is fixed-parameter tractable. This result and our main result imply that MaxSat parameterized above max{m/2, ν(F )} is fixed-parameter tractable: if m/2 > ν(F ) then apply the algorithm of [21], otherwise apply our algorithm. If every clause of a formula with m clauses contains exactly two literals then it is well known that we can satisfy at least 3m/4 clauses. From this, and by applying Reduction Rules 1 and 2, we can get a linear kernel for this version of the (ν(F ) + k)-SAT problem. It would be nice to see whether a linear or a polynomial-size kernel exists for the (ν(F ) + k)-SAT problem if every clause has exactly r literals. Acknowledgment This research was partially supported by an International Joint grant of the Royal Society. References [1] R. Aharoni and N. Linial, Minimal non-two-colorable hypergraphs and minimal unsatisfiable formulas. J. Combin. Th. Ser. A, 43: 196 -- 204, 1986. [2] N. Alon, G. Gutin, E. J. Kim, S. Szeider, and A. Yeo, Solving MAX-r-SAT above a tight lower bound. Algorithmica 61 (2011), 638 -- 655. [3] N. Alon, R. Yuster, and U. Zwick. Color-coding. J. ACM, 42(4):844 -- 856, 1995. [4] H.L. Bodlaender, R.G. Downey, M.R Fellows, and D. Hermelin, On problems without poly- nomial kernels, J. Comput. System Sci., 75(8): 423 -- 434, 2009. [5] H.L. Bodlaender, S. Thomasse, and A. Yeo, Kernel bounds for disjoint cycles and disjoint paths, Theor. Comput. Sci. 412(35): 4570 -- 4578, 2011. [6] R. Crowston, G. Gutin, M. Jones, and A. Yeo, A new lower bound on the maximum number of satisfied clauses in Max-SAT and its algorithmic applications. Algorithmica 64 (2012), 56 -- 68. [7] M. Dom, D. Lokshtanov and S. Saurabh, Incompressibility though Colors and IDs, Proc. 36th ICALP, Part I, Lect. Notes Comput. Sci. 5555: 378 -- 389, 2009. [8] R. G. Downey and M. R. Fellows. Parameterized Complexity, Springer, 1999. [9] F. V. Fomin, D. Lokshtanov, V. Raman, S. Saurabh and B. V. R. Rao. Faster algorithms for finding and counting subgraphs. J. Comput. Syst. Sci., 78(3):698 -- 706, 2012. 14 [10] H. Fleischner, O. Kullmann, and S. Szeider. Polynomial-time recognition of minimal unsat- isfiable formulas with fixed clause-variable difference. Theor. Comput. Sci., 289(1):503 -- 516, 2002. [11] H. Fleischner and S. Szeider. Polynomial-time recognition of minimal unsatisfiable formulas with fixed clause-variable difference. Electronic Colloquium on Computational Complexity (ECCC), 7(49), 2000. [12] J. Flum and M. Grohe, Parameterized Complexity Theory, Springer Verlag, 2006. [13] G. Gutin, M. Jones, and A. Yeo. Kernels for below-upper-bound parameterizations of the hitting set and directed dominating set problems. Theor. Comput. Sci., 412(41):5744 -- 5751, 2011. [14] G. Gutin, M. Jones and A. Yeo, A New Bound for 3-Satisfiable MaxSat and its Algorithmic Application. Proc. FCT 2011, Lect. Notes Comput. Sci. 6914 (2011), 138 -- 147. [15] G. H. Hardy and S. Ramanujan. Asymptotic formulae in combinatory analysis. Proc. London Math. Soc., 17:75 -- 115, 1918. [16] H. Kleine Buning. On subclasses of minimal unsatisfiable formulas. Discr. Appl. Math., 107(1-3):83 -- 98, 2000. [17] H. Kleine Buning and O. Kullmann, Minimal Unsatisfiability and Autarkies, Handbook of Satisfiability, chapter 11, 339 -- 401. [18] O. Kullmann. An application of matroid theory to the sat problem. In IEEE Conference on Computational Complexity, pages 116 -- 124, 2000. [19] O. Kullmann, Lean clause-sets: Generalizations of minimally unsatisfiable clause-sets, Discr. Appl. Math.,130:209-249, 2003. [20] L. Lov´asz and M. D. Plummer. Matching theory. AMS Chelsea Publ., 2009. [21] M. Mahajan and V. Raman. Parameterizing above guaranteed values: MaxSat and MaxCut. J. Algorithms 31(2) (1999), 335 -- 354. [22] M. Mahajan, V. Raman, and S. Sikdar. Parameterizing above or below guaranteed values. J. Comput. Sys. Sci. 75(2):137 -- 153, 2009. Preliminary version in the 2nd IWPEC, Lect. Notes Comput. Sci. 4169 (2006), 38 -- 49. [23] B. Monien and E. Speckenmeyer. Solving satisfiability in less than 2n steps. Discr. Appl. Math. 10:287 -- 295, 1985. [24] R. Niedermeier. Invitation to Fixed-Parameter Algorithms, Oxford University Press, 2006. [25] A. Nijenhuis and H. S. Wilf. Combinatorial Algorithms. Academic Press, Inc. 1978. [26] C. H. Papadimitriou and D. Wolfe. The complexity of facets resolved. J. Comput. Syst. Sci., 37(1):2 -- 13, 1988. [27] A. Srinivasan. Improved approximations of packing and covering problems. In STOC'95, pages 268 -- 276, 1995. [28] S. Szeider. Minimal unsatisfiable formulas with bounded clause-variable difference are fixed- parameter tractable. J. Comput. Syst. Sci., 69(4):656 -- 674, 2004. 15
1805.07742
1
1805
2018-05-20T09:18:59
A PTAS for a Class of Stochastic Dynamic Programs
[ "cs.DS" ]
We develop a framework for obtaining polynomial time approximation schemes (PTAS) for a class of stochastic dynamic programs. Using our framework, we obtain the first PTAS for the following stochastic combinatorial optimization problems: \probemax: We are given a set of $n$ items, each item $i\in [n]$ has a value $X_i$ which is an independent random variable with a known (discrete) distribution $\pi_i$. We can {\em probe} a subset $P\subseteq [n]$ of items sequentially. Each time after {probing} an item $i$, we observe its value realization, which follows the distribution $\pi_i$. We can {\em adaptively} probe at most $m$ items and each item can be probed at most once. The reward is the maximum among the $m$ realized values. Our goal is to design an adaptive probing policy such that the expected value of the reward is maximized. To the best of our knowledge, the best known approximation ratio is $1-1/e$, due to Asadpour \etal~\cite{asadpour2015maximizing}. We also obtain PTAS for some generalizations and variants of the problem and some other problems.
cs.DS
cs
A PTAS for a Class of Stochastic Dynamic Programs ∗ Hao Fu †1, Jian Li ‡1, and Pan Xu §2 1 Institute for Interdisciplinary Information Sciences, Tsinghua University, Beijng, China. 2 Department of Computer Science, University of Maryland, College Park, USA. May 22, 2018 Abstract We develop a framework for obtaining polynomial time approximation schemes (PTAS) for a class of stochastic dynamic programs. Using our framework, we obtain the first PTAS for the following stochastic combinatorial optimization problems: 1. Probemax [20]: We are given a set of n items, each item i ∈ [n] has a value Xi which is an independent random variable with a known (discrete) distribution πi. We can probe a subset P ⊆ [n] of items sequentially. Each time after probing an item i, we observe its value realization, which follows the distribution πi. We can adaptively probe at most m items and each item can be probed at most once. The reward is the maximum among the m realized values. Our goal is to design an adaptive probing policy such that the expected value of the reward is maximized. To the best of our knowledge, the best known approximation ratio is 1−1/e, due to Asadpour et al. [2]. We also obtain PTAS for some generalizations and variants of the problem. 2. Committed Pandora's Box [25, 23]: We are given a set of n boxes. For each box i ∈ [n], the cost ci is deterministic and the value Xi is an independent random variable with a known (discrete) distribution πi. Opening a box i incurs a cost of ci. We can adaptively choose to open the boxes (and observe their values) or stop. We want to maximize the expectation of the realized value of the last opened box minus the total opening cost. 3. Stochastic Target [16]: Given a predetermined target T and n items, we can adaptively insert the items into a knapsack and insert at most m items. Each item i has a value Xi which is an independent random variable with a known (discrete) distribution. Our goal is to design an adaptive policy such that the probability of the total values of all items inserted being larger than or equal to T is maximized. We provide the first bi-criteria PTAS for the problem. 4. Stochastic Blackjack Knapsack [17]: We are given a knapsack of capacity C and probability distributions of n independent random variables Xi. Each item i ∈ [n] has a size Xi and a profit pi. We can adaptively insert the items into a knapsack, as long as the capacity constraint is not violated. We want to maximize the expected total profit of all inserted items. If the capacity constraint is violated, we lose all the profit. We provide the first bi-criteria PTAS for the problem. ∗This work is published in the 45th International Colloquium on Automata, Languages, and Programming (ICALP2018) [10]. This research is supported in part by the National Basic Research Program of China Grant 2015CB358700, the National Natural Science Foundation of China Grant 61772297, 61632016, 61761146003, and a grant from Microsoft Research Asia. †Email: [email protected] ‡Email: [email protected] §Email: [email protected] 1 1 Introduction Consider an online stochastic optimization problem with a finite number of rounds. There are a set of tasks (or items, boxes, jobs or actions). In each round, we can choose a task and each task can be chosen at most once. We have an initial "state" of the system (called the value of the system). At each time period, we can select a task. Finishing the task generates some (possibly stochastic) feedback, including changing the value of the system and providing some profit for the round. Our goal is to design a strategy to maximize our total (expected) profit. The above problem can be modeled as a class of stochastic dynamic programs which was introduced by Bellman [3]. There are many problems in stochastic combinatorial optimization which fit in this model, e.g., the stochastic knapsack problem [9], the Probemax problem [20]. Formally, the problem is specified by a 5-tuple (V,A, f, g, h, T ). Here, V is the set of all possible values of the system. A is a finite set of items or tasks which can be selected and each item can be chosen at most once. This model proceeds for at most T rounds. At each round t ∈ [T ], we use It ∈ V to denote the current value of the system and At ⊆ A the set of remaining available items. If we select an item at ∈ At, the value of the system changes to f (It, at). Here f may be stochastic and is assumed to be independent for each item at ∈ A. Using the terminology from Markov decision processes, the state at time t is st = (It,At) ∈ V × 2A. 1 Hence, if we select an item at ∈ At, the evolution of the state is determined by the state transition function f: st+1 = (It+1,At+1) = (f (It, at),At \ at) t = 1, . . . , T. (1.1) Meanwhile the system yields a random profit g(It, at). The function h(IT +1) is the terminal profit function at the end of the process. We begin with the initial state s1 = (I1,A). We choose an item a1 ∈ A. Then the system yields a profit g(I1, a1), and moves to the next state s2 = (I2,A2) where I2 follows the distribution f (I1, a1) and A2 = A \ a1. This process is iterated yielding a random sequence of the total profits E(cid:104)(cid:80)T The profits are accumulated over T steps. 2 The goal is to find a policy that maximizes the expectation t=1 g(It, at) + h(IT +1) . Formally, we want to determine: E(cid:104) By Bellman's equation [3], for every initial state s1 = (I1,A), the optimal value DP∗(s1) is given by DP1(I1,A). Here DP1 is the function defined by DPT +1(IT +1) = h(IT +1) together with the recursion: DPt(It,At) = max at∈At DPt+1(f (It, at),At \ at) + g(It, at) , t = 1, . . . , T. (1.2) When the value and the item spaces are finite, and the expectations can be computed, this recursion yields an algorithm to compute the optimal value. However, since the state space S = V × 2A is exponentially large, this exact algorithm requires exponential time. Since this model can capture several stochastic optimization problems which are known (or believed) be #P-hard or even PSPACE-hard, we are interested in obtaining polynomial-time approximation algorithms with provable performance guarantees. 1This is why we do not call It the state of the system. 2If less than T steps, we can use some special items to fill which satisfy that f (I, a) = I and g(I, a) = 0 for any value I ∈ V. 2 s1, a1, s2, a2, s3, . . . , aT , sT +1. (cid:105) E(cid:104) T(cid:88) t=1 DP∗(s1) = max {a1,...,aT }⊆A g(It, at) + h(IT +1) (DP) subject to: It+1 = f (It, at), t = 1, . . . , T. (cid:105) (cid:105) 1.1 Our Results In order to obtain a polynomial time approximation scheme (PTAS) for the stochastic dynamic pro- gram, we need the following assumptions. Assumption 1. In this paper, we make the following assumptions. 1. The value space V is discrete and ordered, and its size V is a constant. W.l.o.g., we assume V = (0, 1, . . . ,V − 1). 2. The function f satisfies that f (It, at) ≥ It, which means the value is nondecreasing. 3. The function h : V → R≥0 is a nonnegative function. The expected profit E[g(It, at)] is nonnega- tive (although the function g(It, at) may be negative with nonzero probability). Assumption (1) seems to be quite restrictive. However, for several concrete problems where the value space is not of constant size (e.g., Probemax in Section 1.2), we can discretize the value space and reduce its size to a constant, without losing much profit. Assumption (2) and (3) are quite natural for many problems. Now, we state our main result. Theorem 1.1. For any fixed ε > 0, if Assumption 1 holds, we can find an adaptive policy in polynomial time n2O(ε−3) with expected profit at least OPT− O(ε)· MAX where MAX = maxI∈V DP1(I,A) and OPT denotes the expected profit of the optimal adaptive policy. Our Approach: For the stochastic dynamic program, an optimal adaptive policy σ can be represented as a decision tree T (see Section 2 for more details). The decision tree corresponding to the optimal policy may be exponentially large and arbitrarily complicated. Hence, it is unlikely that one can even represent an optimal decision for the stochastic dynamic program in polynomial space. In order to reduce the space, we focus a special class of policies, called block adaptive policy. The idea of block adaptive policy was first introduced by Bhalgatet al. [6] and further generalized in [18] to the context of the stochastic knapsack. To the best of our knowledge, the idea has not been extended to other applications. In this paper, we make use of the notion of block adaptive policy as well, but we target at the development of a general framework. For this sake we provide a general model of block policy (see Section 3). Since we need to work with the more abstract dynamic program, our construction of block adaptive policy is somewhat different from that in [6, 18]. Roughly speaking, in a block adaptive policy, we take a batch of items simultaneously instead of a single one each time. This can significantly reduce the size of the decision tree. Moreover, we show that there exists a block-adaptive policy that approximates the optimal adaptive policy and has only a constant number of blocks on the decision tree (the constant depends on ε). Since the decision tree corresponding to a block adaptive policy has a constant number of nodes, the number of all topologies of the block decision tree is a constant. Fixing the topology of the decision tree corresponding to the block adaptive policy, we still need to decide the subset of items to place in each block. Again, there is exponential number of possible choices. For each block, we can define a signature for it, which allows us to represent a block using polynomially many possible signatures. The signatures are so defined such that two subsets with the same signature have approximately the same reward distribution. Finally, we show that we can enumerate the signatures of all blocks in polynomial time using dynamic programming and find a nearly optimal block-adaptive policy. The high level idea is somewhat similar to that in [18], but the details are again quite different. 1.2 Applications Our framework can be used to obtain the first PTAS for the following problems. 3 1.2.1 The Probemax Problem In the Probemax problem, we are given a set of n items. Each item i ∈ [n] has a value Xi which is an independent random variable following a known (discrete) distribution πi. We can probe a subset P ⊆ [n] of items sequentially. Each time after probing an item i, we observe its value realization, which is an independent sample from the distribution πi. We can adaptively probe at most m items and each item can be probed at most once. The reward is the maximum among the m realized values. Our goal is to design an adaptive probing policy such that the expected value of the reward is maximized. Despite being a very basic stochastic optimization problem, we still do not have a complete under- standing of the approximability of the Probemax problem. It is not even known whether it is intractable to obtain the optimal policy. For the non-adaptive Probemax problem (i.e., the probed set P is just a priori fixed set), it is easy to obtain a 1 − 1/e approximation by noticing that f (P ) = E[maxi∈P Xi] is a submodular function (see e.g., Chen et al. [8]). Chen et al. [8] obtained the first PTAS. When considering the adaptive policies, Munagala [20] provided a 1 8-approximation ratio algorithm by LP relaxation. His policy is essentially a non-adaptive policy (it is related to the contention resolution schemes [24, 11]). They also showed that the adaptivity gap (the gap between the optimal adaptive policy and optimal non-adaptive policy) is at most 3. For the Probemax problem, the best-known approximation ratio is 1− 1 e. Indeed, this can be obtained using the algorithm for stochastic monotone submodular maximization in Asadpour et al. [2]. This is also a non-adaptive policy, which implies the e−1. In this paper, we provide the first PTAS, among all adaptive policies. adaptivity gap is at most Note that our policy is indeed adaptive. e Theorem 1.2. There exists a PTAS for the Probemax problem. In other words, for any fixed constant ε > 0, there is a polynomial-time approximation algorithm for the Probemax problem that finds a policy with the expected profit at least (1 − ε)OPT, where OPT denotes the expected profit of the optimal adaptive policy. Let the value It be the maximum among the realized values of the probed items at the time period t. Using our framework, we have the following system dynamics for Probemax: It+1 = f (It, i) = max{It, Xi}, g(It, i) = 0, and h(IT +1) = IT +1 (1.3) t = 1, 2, . . . , T . Clearly, Assumption 1 (2) and (3) are satisfied. But Assumption 1 (1) is not satisfied because the value space V is not of constant size. Hence, we need to discretize the value space and reduce its size to a constant. See Section 4 for more details. If the reward is the summation of top-k values (k = O(1)) among the m realized values, we obtain the ProbeTop-k problem. Our techniques also allow us to derive the following result. Theorem 1.3. For the ProbeTop-k problem where k is a constant, there is a polynomial time algorithm that finds an adaptive policy with the expected profit at least (1−ε)OPT, where OPT denotes the expected profit of the optimal adaptive policy. 1.2.2 Committed ProbeTop-k Problem We are given a set of n items. Each item i ∈ [n] has a value Xi which is an independent random variable with a known (discrete) distribution πi. We can adaptively probe at most m items and choose k values in the committed model, where k is a constant. In the committed model, once we probe an item and observe its value realization, we must make an irrevocable decision whether to choose it or not, i.e., we must either add it to the final chosen set C immediately or discard it forever. 3 If we add the item to the final chosen set C, the realized profit is collected. Otherwise, no profit is collected and we are going the probe the next item. Our goal is to design an adaptive probing policy such that the expected value E[(cid:80) i∈C Xi] is maximized, where C is the final chosen set. 3In [11, 12], it is called the online decision model. 4 Theorem 1.4. There is a polynomial time algorithm that finds a committed policy with the expected profit at least (1− ε)OPT for the committed ProbeTop-k problem, where OPT is the expected total profit obtained by the optimal policy. Let bθ i represent the action that we probe item i with the threshold θ (i.e., we choose item i if Xi realizes to a value s such that s ≥ θ). Let It be the the number of items that have been chosen at the period time t. Using our framework, we have following transition dynamics for the ProbeTop- k problem. (cid:26) It + 1 if Xi ≥ θ, It < k, It otherwise; (cid:26) Xi 0 g(It, bθ i ) = if Xi ≥ θ, It < k, otherwise; (1.4) It+1 = f (It, bθ i ) = for t = 1, 2, . . . , T , and h(IT +1) = 0. Since k is a constant, Assumption 1 is immediately satisfied. There is one extra requirement for the problem: in any realization path, we can choose at most one action bθ i}θ. See Section 5 for more details. i from the set Bi = {bθ adaptive strategy, which can be computed in polynomial time. Recently, Singla [23] generalized this model to other combinatorial optimization problems such as matching, set cover and so on. 1.2.3 Committed Pandora's Box Problem For Weitzman's "Pandora's box" problem [25], we are given n boxes. For each box i ∈ [n], the probing cost ci is deterministic and the value Xi is an independent random variable with a known (discrete) distribution πi. Opening a box i incurs a cost of ci. When we open the box i, its value is realized, which is a sample from the distribution πi. The goal is to adaptively open a subset P ⊆ [n] to maximize the expected profit: E(cid:2)maxi∈P{Xi} −(cid:80) constant. Our goal is to design an adaptive policy such that the expected value E(cid:2)(cid:80) In this paper, we focus on the committed model, which is mentioned in Section 1.2.2. Again, we can adaptively open the boxes and choose at most k values in the committed way, where k is a i∈P ci is maximized, where C ⊆ P is the final chosen set and P is the set of opened boxes. Although the problem looks like a slight variant of Weitzman's original problem, it is quite unlikely that we can adapt Weitzman's argument (or any argument at all) to obtain an optimal policy in polynomial time. When k = O(1), we provide the first PTAS for this problem. Note that a PTAS is not known previously even for k = 1. (cid:3) . Weitzman provided an elegant optimal i∈C Xi −(cid:80) i∈P ci (cid:3) Theorem 1.5. When k = O(1), there is a polynomial time algorithm that finds a committed policy with the expected value at least (1 − ε)OPT for the committed Pandora's Box problem. Similar to the committed ProbeTop-k problem, let bθ i represent the action that we open the box i with threshold θ. Let It be the number of boxes that have been chosen at the time period t. Using our framework, we have following system dynamics for the committed Pandora's Box problem: (cid:26) It + 1 if Xi ≥ θ, It < k, It otherwise; (cid:26) Xi − ci −ci It+1 = f (It, bθ i ) = g(It, bθ i ) = if Xi ≥ θ, It < k, otherwise; (1.5) for t = 1, 2,··· , T , and h(IT +1) = 0. Notice that we never take an action bθ E[g(It, bθ Section 6 for more details. i for a value It < k if i )] = Pr[Xt ≥ θ] · E[Xi Xi ≥ θ] − ci < 0. Then Assumption 1 is immediately satisfied. See 1.2.4 Stochastic Target Problem İlhan et al. [16] introduced the following stochastic target problem. 4 In this problem, we are given a predetermined target T and a set of n items. Each item i ∈ [n] has a value Xi which is an independent 4[16] called the problem the adaptive stochastic knapsack instead. However, their problem is quite different from the stochastic knapsack problem studied in the theoretical computer science literature. So we use a different name. 5 m items into the knapsack and our goal is to design an adaptive policy such that Pr[(cid:80) random variable with a known (discrete) distribution πi. Once we decide to insert an item i into a knapsack, we observe a reward realization Xi which follows the distribution πi. We can insert at most i∈P Xi ≥ T] is maximized, where P ⊆ [n] is the set of inserted items. For the stochastic target problem, İlhan et al. [16] provided some heuristic based on dynamic programming for the special case where the random profit of each item follows a known normal distribution. In this paper, we provide an additive PTAS for the stochastic target problem when the target is relaxed to (1 − ε)T. Theorem 1.6. There exists an additive PTAS for stochastic target problem if we relax the target to (1 − ε)T. In other words, for any given constant ε > 0, there is a polynomial-time approximation algorithm that finds a policy such that the probability of the total rewards exceeding (1 − ε)T is at least OPT − ε, where OPT is the resulting probability of an optimal adaptive policy. Let the value It be the total profits of the items in the knapsack at time period t. Using our framework, we have following system dynamics for the stochastic target problem: It+1 = f (It, i) = It + Xi, g(It, i) = 0, and h(IT +1) = (1.6) for t = 1, 2,··· , T . Then Assumption 1 (2,3) is immediately satisfied. But Assumption 1 (1) is not satisfied for that the value space V is not of constant size. Hence, we need to discretize the value space and reduce its size to a constant. See Section 7 for more details. 1.2.5 Stochastic Blackjack Knapsack Levin et al. [17] introduced the stochastic blackjack knapsack. In this problem, we are given a capacity C and a set of n items, each item i ∈ [n] has a size Xi which is an independent random variable with a known distribution πi and a profit pi. We can adaptively insert the items into a knapsack, as long as the capacity constraint is not violated. Our goal is to design an adaptive policy such that the expected total profits of all items inserted is maximized. The key feature here different from classic stochastic knapsack is that we gain zero if overflow, i.e., we will lose the profits of all items inserted already if the total size is larger than the capacity. This extra restriction might induce us to take more √ conservative policies. Levin et al. [17] presented a non-adaptive policy with expected value that is at 2 − 1)2/2 ≈ 1/11.66 times the expected value of the optimal adaptive policy. Chen et al. [7] least ( assumed each size Xi follows a known exponential distribution and gave an optimal policy for n = 2 based on dynamic programming. In this paper, we provide the first bi-criteria PTAS for the problem. Theorem 1.7. For any fixed constant ε > 0, there is a polynomial-time approximation algorithm for stochastic blackjack knapsack that finds a policy with the expected profit at least (1 − ε)OPT, when the capacity is relaxed to (1 + ε)C, where OPT is the expected profit of the optimal adaptive policy. Denote It = (It,1, It,2) and let It,1, It,2 be the total sizes and total profits of the items in the knapsack at the time period t respectively. When we insert an item i into the knapsack and observe its size realization, say si, we define the system dynamics function to be (cid:26) 1 if IT +1 ≥ T, 0 otherwise; (cid:26) IT +1,2 0 if IT +1,1 ≤ C, otherwise; (1.7) It+1 = f (It, i) = (It,1 + si, It,2 + pi), h(IT +1) = and g(It, i) = 0 for t = 1, 2,··· , T . Then Assumption 1 (2,3) is immediately satisfied. But Assumption 1 (1) is not satisfied for that the value space V is not of constant size. Hence, we need to discretize the value space and reduce its size to a constant. See Section 8 for more details. For the case without relaxing the capacity, we can improve the result of 11.66 in [17]. Theorem 1.8. For any ε ≥ 0, there is a polynomial time algorithm that finds a ( 1 adaptive policy for SBK. 8 − ε)-approximate 6 1.3 Related Work Stochastic dynamic program has been widely studied in computer science and operation research (see, for example, [4, 21]) and has many applications in different fields. It is a natural model for decision making under uncertainty. In 1950s, Richard Bellman [3] introduced the "principle of optimality" which leads to dynamic programming algorithms for solving sequential stochastic optimization problems. However, Bellman's principle does not immediate lead to efficient algorithms for many problems due to "curse of dimensionality" and the large state space. There are some constructive frameworks that provide approximation schemes for certain classes of stochastic dynamic programs. Shmoys et al. [22] dealt with stochastic linear programs. Halman et al. [13, 14, 15] studies stochastic discrete DPs with scalar state and action spaces and designed an FPTAS for their framework. As one of the applications, they used it to solve the stochastic ordered adaptive knapsack problem. As a comparison, in our model, the state space S = V × 2A is exponentially large and hence cannot be solved by previous framework. Stochastic knapsack problem SKP is one of the most well-studied stochastic combinatorial opti- mization problem. We are given a knapsack of capacity C. Each item i ∈ [n] has a random value Xi with a known distribution πi and a profit pi. We can adaptively insert the items to the knapsack, as long as the capacity constraint is not violated. The goal is to maximize the expected total profit of all items inserted. For SKP, Dean et al. [9] first provide a constant factor approximation algorithm. Later, 8 − ε and gave an algorithm with ratio of (1 − ε) by using ε Bhalgat et al. [6] improved that ratio to 3 extra budget for any given constant ε ≥ 0. In that paper, the authors first introduced the notion of block adaptive policies, which is crucial for this paper. The best known single-criterion approximation factor is 2 [5, 18, 19]. The Probemax problem and ProbeTop-k problem are special cases of the general stochastic probing framework formulated by Gupta et al. [12]. They showed that the adaptivity gap of any stochastic probing problem where the outer constraint is prefix-closed and the inner constraint is an intersection of p matroids is at most O(p3 log(np)), where n is the number of items. The Bernoulli version of stochastic probing was introduced in [11], where each item i ∈ U has a fixed value wi and is "active" with an independent probability pi. Gupta et al. [11] presented a framework which yields a 4(kin+kout)- approximation algorithm for the case when Iin and Iout are respectively an intersection of kin and kout matroids. This ratio was improved to (kin+kout) by Adamczyk et al. [1] using the iterative randomized rounding approach. Weitzman's Pandora's Box is a classical example in which the goal is to find out a single random variable to maximize the utility minus the probing cost. Singla [23] generalized this model to other combinatorial optimization problems such as matching, set cover, facility location, and obtained approximation algorithms. 1 1 2 Policies and Decision Trees An instance of stochastic dynamic program is given by J = (V,A, f, g, h, T ). For each item a ∈ A and values I, J ∈ V, we denote Φa(I, J) := Pr[f (I, a) = J] and Ga(I) := E[g(I, a)]. The process of applying a feasible adaptive policy σ can be represented as a decision tree Tσ. Each node v on Tσ is labeled by a unique item av ∈ A. Before selecting the item av, we denote the corresponding time index, the current value and the set of the remaining available items by tv, Iv and A(v) respectively. Each node has several children, each corresponding to a different value realization (one possible f (Iv, av)). Let e = (v, u) be the s-th edge emanating from s ∈ V where s is the realized value. We call u the s-child of v. Thus e has probability πe := πv,s = Φav (Iv, s) and weight we := s. We use P(σ) to denote the expected profit that the policy σ can obtain. For each node v on Tσ, we define Gv := Gav (Iv). In order to clearly illustrate the tree structure, we add a dummy node at the end of each root-to-leaf path and set Gv = h(Iv) if v is a dummy node. Then, we recursively define the 7 expected profit of the subtree Tv rooted at v to be P(v) = Gv + (cid:88) πe · P(u), e=(v,u) (2.1) if v is an internal node and P(v) = Gv = h(Iv) if v is a leaf (i.e., the dummy node). The expected profit P(σ) of the policy σ is simply P(the root of Tσ). Then, according to Equation (1.2), we have P(v) ≤ DPtv (Iv,A(v)) ≤ DP1(Iv,A) ≤ max I∈V DP1(I,A) = MAX v, and denote it by R(v). We denote the probability of reaching v as Φ(v) = Φ(R(v)) =(cid:81) for each node v. For a node v, we say the path from the root to it on Tσ as the realization path of e∈R(v) πe. Then, we have P(σ) = Φ(v) · Gv. (2.2) (cid:88) v∈Tσ We use OPT to denote the expected profit of the optimal adaptive policy. For each node v on the tree Tσ, by Assumption 1 (2) that f (Iv, av) ≥ Iv, we define µv := Pr[f (Iv, av) > Iv] = 1 − Φav (Iv, Iv). For a set of nodes P , we define µ(P ) :=(cid:80) v∈P µv. Lemma 2.1. Given an policy σ, there is a policy σ(cid:48) with profit at least OPT − O(ε) · MAX which satisfies that for any realization path R, µ(R) ≤ O(1/ε), where MAX = maxI∈V DP1(I,A). Proof. Consider a random realization path R = (v1, v2, . . . , vT +1) generated by σ. Recall in As- sumption 1 (1), the value space is V = {0, 1,··· ,V − 1}. For each node v on the tree, we define yv := E[f (Iv, av)] − Iv, which is larger than Iv · Pr[f (Ia, av) = Iv] + (Iv + 1) · Pr[f (Iv, av) > Iv] − Iv = Pr[f (Iv, av) > Iv] = µv. We now define a sequence of random variables {Yt}t∈[T +1]: yvi. i=1 Yt = It − t−1(cid:88) (cid:34) (cid:12)(cid:12)(cid:12) Yt It+1 − t(cid:88) (cid:34)(cid:32) (cid:33) It − t−1(cid:88) yvi i=1 (cid:35) E[Yt+1 Yt] = E This sequence {Yi} is a martinale: conditioning on current value Yt, we have = E = Yt + E[It+1 Yt] − It − yvt = Yt. + It+1 − It − yvt yvi v=1 (cid:35) (cid:12)(cid:12)(cid:12) Yt The last equation is due to the definition of yvt. By the martingale property, we have E[YT +1] = E[Yt] = Y1 = 0 for any t ∈ [T ]. Thus, we have V ≥ E[IT +1] = E = E yvi ≥ E [µ(R)] . yv (cid:34) T(cid:88) (cid:35) (cid:34)(cid:88) v∈R (cid:80) (cid:2)Φ(r) · 1 (cid:3) which implies that(cid:80) r∈E Let E be the set of realization paths r on the tree for which µ(r) ≥ 1/ε. Then, we have E[µ(R)] ≥ r∈E Φ(r) ≤ ε · E[µ(R)] ≤ O(ε), where Φ(r) is the probability of passing the path r. For each path r ∈ E, let vr be the first node on the path such that µ(R(vr)) ≥ 1/ε, where R(vr) is the path from the root to the node vr. Let F be the set of such nodes. For the policy ε i=1 (cid:35) 8 σ, we have a truncation on the node vr when we reach the node vr, i.e., we do not select items (include vr) any more in the new policy σ(cid:48). The total profit loss is at most (cid:88) v∈F [Φ(v) · P(v)] ≤ MAX ·(cid:88) r∈E Φ(r) ≤ O(ε) · MAX, where MAX = maxI∈V DP1(I,A). W.l.o.g, we assume that all (optimal or near optimal) policies σ considered in this paper satisfy that for any realization R, µ(R) ≤ O(1/ε). 3 Block Adaptive Policies The decision tree corresponding to the optimal policy may be exponentially large and arbitrarily complicated. Now we consider a restrict class of policies, called block-adaptive policy. The concept was first introduced by Bhalgat et al. [6] in the context of stochastic knapsack. Our construction is somewhat different from that in [6, 18]. Here, we need to define an order for each block and introduce the notion of approximate block policy. Formally, a block-adaptive policy σ can be thought as a decision tree Tσ. Each node on the tree is labeled by a block which is a set of items. For a block M, we choose an arbitrary order ϕ for the items in the block. According to the order ϕ, we take the items one by one, until we get a bigger value or all items in the block are taken but the value does not change (recall from Assumption 1 that the value is nondecreasing). Then we visit the child block which corresponds to the realized value. We use IM to denote the current value right before taking the items in the block M. Then for each edge e = (M, N ), it has probability (cid:34)(cid:32) (cid:89) (cid:88) a∈M ϕb<ϕa πϕ e = (cid:33) (cid:35) Φb(IM , IM ) · Φa(IM , IN ) e =(cid:81) if IN > IM and πϕ the expected profit of the subtree TM rooted at M to be a∈M Φa(IM , IM ) if IN = IM. Similar to Equation (2.1), for each block M and an arbitrary order ϕ for M, we recursively define P(M ) = Gϕ M + e · P(N ) πϕ (3.1) (cid:88) e=(M,N ) if M is an internal block and P(M ) = h(IM ) if M is a leaf (i.e., the dummy node). Here Gϕ expected profit we can get from the block which is equal to M is the (cid:34)(cid:32) (cid:89) (cid:88) a∈M ϕb<ϕa Gϕ M = (cid:33) (cid:35) Φb(IM , IM ) · Ga(IM ) . Since the profit Gϕ e are dependent on the order ϕ and thus difficult to deal with, we define the approximate block profit and the approximate probability which do not depend on the choice of the specific order ϕ: M and the probability πϕ (cid:88) (cid:101)GM = if IN > IM and(cid:101)πe =(cid:81) a∈M Ga(IM )  · Φa(IM , IN )  (cid:88) a∈M and (cid:101)πe = (cid:101)P(M ) = (cid:101)GM +  (cid:89) (cid:88) b∈M\a (cid:101)πe ·(cid:101)P(N ), Φb(IM , IM ) (3.2) (3.3) a∈M Φa(IM , IM ) if IN = IM. Then we recursicely define the approximate profit e=(M,N ) 9 if M is an internal block and (cid:101)P(M ) = P(M ) = h(IM ) if M is a leaf. For each block M, we define µ(M ) := (cid:80) a∈M [1 − Φa(IM , IM )]. Lemma 3.1 below can be used to bound the gap between the approximate profit and the original profit if the policy satisfies the following property. Then it suffices to consider the approximate profit for a block adaptive policy σ in this paper. (P1) Each block M with more than one item satisfies that µ(M ) ≤ ε2. Lemma 3.1. For any block-adaptive policy σ satisfying Property (P1), we have (cid:0)1 + O(ε2)(cid:1) ·(cid:101)P(σ) ≥ P(σ) ≥(cid:0)1 − ε2(cid:1) ·(cid:101)P(σ). Proof. The right hand of this lemma can be proved by induction: for each block M on the decision tree, we have If M is a leaf, we have P(M ) =(cid:101)P(M ) which implies that Equation (3.4) holds. For an internal block P(M ) ≥ (1 − ε2) ·(cid:101)P(M ). (3.4) M, by Property (P1), we have (cid:35) · (cid:88) (cid:34) 1 −(cid:88) (cid:16) (cid:17)(cid:35) · (cid:101)GM ≥ (1 − ε2) · (cid:101)GM 1 − Φb(IM , IM ) b∈M M = (cid:101)GM if M has only one item. For each edge e = (M, N ), we b∈M a∈M if M has more than one item and Gϕ have πϕ Φb(IM , IM ) Ga(IM ) ≥ P(M ) = Gϕ M ≥ Gϕ e ≥(cid:101)πe. Then, by induction, we have (cid:88) ≥ (1 − ε2) · (cid:101)GM + = (1 − ε2) ·(cid:101)P(M ). (cid:88) e=(M,N ) M + To prove the left hand of the lemma, we use Equation (2.2): Φ(M ) · Gϕ P(σ) = M M∈Tσ e · P(N ) (cid:88) πϕ e=(M,N ) (cid:101)πe ·(cid:104) (cid:105) (1 − ε2) ·(cid:101)P(N ) (cid:34)(cid:89) where Φ(M ) is the probability of reaching the block M. For each edge e = (M, N ), if IM = IN or M has only one item, we have(cid:101)πe = πϕ (cid:35) · (cid:88) (cid:34)(cid:89) Φb(IM , IM ) (cid:101)πe ≥ b∈M (cid:101)Φ(M ) Φ(M ) (cid:101)P(σ) = = i=0 πϕ (Mi,Mi+1) m−1(cid:89) (cid:101)π(Mi,Mi+1) (cid:101)ΦM · (cid:101)GM ≥ (cid:88) = (cid:88) M∈Tσ M∈Tσ 10 Then, for each block M and its realization path R(M ) = (M0, M1, . . . , Mm = M ), we have a∈M e . Otherwise, we have Φa(IM , IN ) ≥ (1 − ε2) · (cid:88) (cid:101)π(Mi,Mi+1) (cid:89) a∈M i : IMi <IMi+1 πϕ (Mi,Mi+1) Φa(IM , IN ) ≥ (1 − ε2) · πϕ e . ≥ (1 − ε2)V = 1 − O(ε2), where the last inequality holds because the value is nondecreasing and V = O(1). Thus we have (cid:2)(cid:0)1 − O(ε2)(cid:1) · Φ(M )(cid:3) · GM ≥(cid:0)1 − O(ε2)(cid:1) · P(σ). Figure 1: Decision tree and block policy 3.1 Constructing a Block Adaptive Policy In this section, we show that there exists a block-adaptive policy that approximates the optimal adaptive policy. In order to prove this, from an optimal (or nearly optimal) adaptive policy σ, we construct a block adaptive policy σ which satisfies certain nice properties and can obtain almost as much profit as σ does. Thus it is sufficient to restrict our search to the block-adaptive policies. The construction is similar to that in [18]. Lemma 3.2. An optimal policy σ can be transformed into a block adaptive policy σ with approximate expected profit(cid:101)P(σ) at least OPT− O(ε)· MAX. Moreover, the block-adaptive policy σ satisfies Property (P1) and (P2): (P1) Each block M with more than one item satisfies that µ(M ) ≤ ε2. (P2) There are at most O(ε−3) blocks on any root-to-leaf path on the decision tree. Proof. For a node v on the decision tree Tσ and a value s ∈ V, we use vs to denote the s-child of v, which is the child of v corresponding to the realized value s. We say an edge ev,u is non-increasing if Iv = Iu and define the leftmost path of v to be the realization path which starts at v, ends at a leaf, and consists of only the non-increasing edges. We say a node v is a starting node if v is the root or v corresponds to an increasing value of its parent v(cid:48) (i.e., Iv > Iv(cid:48)). For each staring node v, we greedily partition the leftmost path of v into several segments such that for any two nodes u, w in the same segment M and for any value s ∈ V, we have P(us) − P(ws) ≤ ε2 · MAX and µ(M ) ≤ ε2. (3.5) Since µ(R) is at most O(1/ε) for each root-to-leaf path R by Lemma 2.1, the second inequality in (3.5) can yield at most O(ε−3) blocks. Now focus on the first inequality in (3.5). Fix a particular leftmost path Rv = (v0, v1, . . . , vm) from a starting node v(v = v0) on Tσ. For each value s ∈ V, we have with Tvj s s s) < P(vj s ) ≥ ··· ≥ P(vm MAX ≥ DP1(s,A) ≥ P(v0 s ) ≥ P(v1 increases the profit of the policy σ for some i < j ≤ m Otherwise, replacing the subtree Tvi s). Thus, for each particular size s ∈ V, we could cut the path Rv at most ε−2 times. if P(vi Since V = O(1), we have at most O(ε−2) segments on the leftmost path Rv. Now, fix a particular root-to-leaf path. Since the value is nondecreasing by Assumption 1 (2), there are at most V = O(1) starting nodes on the path. Thus the first inequality in (3.5) can yield at most O(ε−2) segments on the root-to-leaf path. In total, there are at most O(ε−3) segments on any root-to-leaf path on the decision tree. s ) ≥ 0. Now, we are ready to describe the algorithm, which takes a policy σ as input and outputs a block adaptive policy σ. For each node v, we denote its segment seg(v) and use l(v) to denote the last node in seg(v). In Algorithm 1, we can see that the set of items which the policy σ attempts to take 11 Algorithm 1 A policy σ Input: A policy σ. 1: We start at the root of Tσ. 2: repeat 3: Suppose we are at node v on Tσ. Take the items in seg(v) one by one in the original order (the order of items in policy σ) until some node u makes a transition to an increasing value, say s. Visit the node l(v)s, the s-child of l(v) (i.e., the last node of seg(v)). If all items in seg(v) have be taken and the value does not change, visit l(v)Iv. 4: 5: 6: until A leaf on Tσ is reached. always corresponds to some realization path in the original policy σ. Property (P1) and (P2) hold immediately following from the partition argument. Now we show that the expected profit P(σ) that the new policy σ can obtain is at least OPT − O(ε2) · MAX. Our algorithm deviates the policy σ when the first time a node u in the segment seg(v) which makes a transition to an increasing value, say s. In this case, σ would visit us, the s-child of u and follows Tus from then on. But our algorithm visits l(v)s, the s-child of l(v) (i.e., the last node of seg(v)), and follows Tl(v)s. The expected profit gap in each such event can be bounded by P(us) − P(l(v)s) ≤ ε2 · MAX, due to the first inequality in Equation (3.5). Suppose σ pays such a profit loss, and switches to visit l(v)s. Then, σ and our algorithm always stay at the same node. Note that there are at most V = O(1) starting nodes on any root-to-leaf path. Thus σ pays at most O(1) times in any realization. Therefore, the total profit loss is at most O(ε2) · MAX. By Lemma 3.1, we have (cid:101)P(σ) ≥(cid:0)1 − O(ε2)(cid:1) · P(σ) ≥(cid:0)1 − O(ε2)(cid:1) ·(cid:0)OPT − O(ε2) · MAX(cid:1) ≥ OPT − O(ε) · MAX. 3.2 Enumerating Signatures To search for the (nearly) optimal block-adaptive policy, we want to enumerate all possible structures of the block decision tree. Fixing the topology of the decision tree, we need to decide the subset of items to place in each block. To do this, we define the signature such that two subsets with the same signature have approximately the same profit distribution. Then, we can enumerate the signatures of all blocks in polynomial time and find a nearly optimal block-adaptive policy. Formally, for an item a ∈ A and a value I ∈ V = (0, 1, . . . ,V − 1), we define the signature of a on I to be the following vector SgI (a) =(cid:0) ¯Φa(I, 0), ¯Φa(I, 1), . . . , ¯Φa(I,V − 1), ¯Ga(I)(cid:1) , (cid:106) n (cid:106)Ga(I) · and ¯Ga(I) = (cid:107) · ε4 n ¯Φa(I, J) = Φa(I, J) · n ε4 (cid:107) · ε4MAX n ε4MAX where for any J ∈ V. 5 For a block M of items, we define the signature of M on I to be SgI (M ) = SgI (a). Lemma 3.3. Consider two decision trees T1,T2 corresponding to block-adaptive policies with the same topology (i.e., T1 and T2 are isomorphic) and the two block adaptive policies satisfiy Property (P1) and (P2). If for each block M1 on T1, the block M2 at the corresponding position on T2 satisfies that SgI (M1) = SgI (M2) where I = IM1 = IM2, then (cid:101)P(T1) −(cid:101)P(T2) ≤ O(ε) · MAX. 5If MAX = maxI∈V DP1(I,A) is unknown, for some several concrete problems (e.g., Probemax), we can get a constant approximation result for MAX, which is sufficient for our purpose. In general, we can guess a constant approximation result for MAX using binary search. (cid:88) a∈M 12 b∈M\a Φb(IM , IM ) (cid:88) a∈M (cid:101)πe = M if J = I and πJ M if J > I.  · Φa(IM , IN )  Proof. We focus on the case when M has more than one item. Recall that for each e = (M, N ), we have a∈M Φa(IM , IM ) if IN = IM. For simplicity, we use (I, J) to replace (IM , IN ) Fixing a block M, for each item a ∈ M, we define µa := Pr [f (I, a) > I]. By Property (P1) that  (cid:89) if IN > IM and (cid:101)πe =(cid:81) if the context is clear, and write(cid:101)πe as πI µ(M ) =(cid:80) a∈M [1 − Φa(I, I)] =(cid:80) (cid:80) (cid:19)M (cid:89) ≤ exp(cid:0) − µ(M )(cid:1)≤ 1 − µ(M ) + µ(M )2 ≤ 1 − µ(M ) + ε4 a∈M µa = 1 − µ(M ). Since (cid:80) a∈M (1 − µa) ≥ 1 −(cid:80) M = (cid:81) (cid:34)(cid:89) (cid:34)(cid:88) ≥ (1 − ε2) · (cid:88) (cid:88) a∈M Φa(I, J) ≤ (cid:80) Φa(I, J) ≥ (cid:88) It is straightforward to verify the following property when M has only one item: a∈M µa ≤ ε2, we have and πI J > I, we have Φa(I, J) − ε4. a∈M µa for any Φa(I, J) Φa(I, I) (1 − µa) ≤ a∈M µa M (cid:35) · πJ M = Φb(I, I) πI M = a∈M (cid:18) 1 − a∈M a∈M (cid:35) b∈M a∈M M = 1 − µ(M ) and πJ πI M = Φa(I, J) for any J > I. Let M1, M2 be the root blocks of T1,T2 respectively. Since SgI (M1) = SgI (M2), we have that a∈M (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:88) Φa(I, J) − (cid:88) a∈M1 Φa(I, J) a∈M2 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ ε4, for any J ∈ V. Then, we have M1 − πI πI M2 ≤ 1 − µ(M1) + ε4 − (1 − µ(M2)) = (µ(M2) − µ(M1)) + ε4 = O(ε4). We replace all the blocks on T1 by the corresponding blocks on T2 one by one from the root to leaf. The of reaching M. The inequality holds because the depth of T2 is at most O(ε−3) by Property (P2), (cid:2)Φ(M ) · O(ε4) · MAX(cid:3) ≤ O(ε)MAX, where Φ(M ) is the probability total profit loss is at most(cid:80) which implies that(cid:80) Since V = O(1), the number of possible signatures for a block is O(cid:0)(n/ε4)V(cid:1) = nO(1), which is a polynomial of n. By Lemma 3.2, for any block decision tree T , there are at most (V)O(ε−3) = 2O(ε−3) blocks on the tree which is a constant. Φ(M ) ≤ O(ε−3). M∈T2 M∈T2 13 On the tree T1, we replace M1 with M2. For each s ∈ V, we use Ms to denote the s-child of block M1 and for any J > I M2 ≤ (cid:88) a∈M1 M1 − πJ πJ on T1. Then we have(cid:101)P(M1) −(cid:101)P(M2) = Φa(I, J) − (cid:88) (cid:17) (cid:16)(cid:101)GM1 − (cid:101)GM2 + a∈M2 Φa(I, J) + ε4 = O(ε4). (cid:101)P(Ms) ·(cid:0)πs (cid:88) s∈V (cid:1) M1 − πs M2 ≤ ε4 · MAX + O(ε4) · MAX = O(ε4) · MAX. 3.3 Finding a Nearly Optimal Block-adaptive Policy In this section, we find a nearly optimal block-adaptive policy and prove Theorem 1.1. To do this, we enumerate over all topologies of the decision trees along with all possible signatures for each block. This can be done by a standard dynamic programming. Consider a given tree topology T . A configuration C is a set of signatures each corresponding to a block. Let t1 and t2 be the number of paths and blocks on T respectively. We define a vector CA = (u1, u2, . . . , ut1) where uj is the upper bound of the number of items on the jth path. For each given i ∈ [n], C and CA, let M(i, C, CA) = 1 indicate that we can reach the configuration C using a subset of items {a1, . . . , ai} such that the total number of items on each path j is no more than uj and 0 otherwise. Set M(0, 0, 0) = 1 and we compute M(i, C, CA) in an lexicographically increasing order of (i, C, CA) as follows: M(i, C, CA) = max (cid:110)M(i − 1, C, CA),M(i − 1, C(cid:48), CA(cid:48)) (cid:111) (3.6) Now, we explain the above recursion as follows. In each step, we should decide how to place the item ai on the tree T . Notice that there are at most t2 = (V)O(ε−3) = 2O(ε−3) blocks and therefore at most 2t2 possible placements of item ai and each placement is called feasible if there are no two blocks on which we place the item ai have an ancestor-descendant relation. For a feasible placement of ai, we subtract Sg(ai) from each entry in C corresponding to the block we place ai and subtract 1 from CA on each entry corresponding to a path including ai, and in this way we get the resultant configuration C(cid:48) and CA(cid:48) respectively. Hence, the max is over all possible such C(cid:48), CA(cid:48). We have shown that the total number of all possible configurations on T is nt2. The total number of vectors CA is T t1 ≤ nt1 ≤ nt2 = nt2 where T is the number of rounds. For each given (i, C, CA), the computation takes a constant time O(2t2). Thus we claim for a given tree topology, finding the optimal configuration can be done within O(n2O(ε−3)) time . The proof of Theorem 1.1. Suppose σ∗ is the optimal policy with expected profit P(σ∗) = OPT. We use the above dynamic programming to find a nearly optimal block adaptive policy σ. By Lemma 3.2, there exists a block adaptive policy σ such that (cid:101)P(σ) ≥ OPT − O(ε)MAX. Since the configuration of σ is enumerated at some step of the algorithm, our dynamic programming is able to find a block adaptive policy σ with the same configuration (the same tree topology and the same signatures for corresponding blocks). By Lemma 3.3, we have By Lemma 3.1, we have P(σ) ≥(cid:0)1 − ε2(cid:1) ·(cid:101)P(σ) ≥ OPT − O(ε)MAX. Hence, the proof of Theorem 1.1 (cid:101)P(σ) ≥(cid:101)P(σ) − O(ε)MAX ≥ OPT − O(ε)MAX. is completed. 4 Probemax Problem the value set S = (cid:83) In this section, we demonstrate the application of our framework to the Probemax problem. Define i∈[n] Si where Si is the support of the random variable Xi and the item set A = {1, 2, . . . , n}. Let the value It be the maximum among the realized values of the probed items at the time period t. Thus, we begin with the initial value I1 = 0. Since we can probe at most m items, we set the number of rounds to be T = m. When we probe an item i and observe its value realization, say Xi, we have the system dynamic functions It+1 = f (It, i) = max{It, Xi}, (4.1) for It ∈ S and t = 1, 2, . . . , T . Assumption 1 (2,3) is immediately satisfied. But Assumption 1 (1) is not satisfied because the value space S is not of constant size. Hence, we need discretization. g(It, i) = 0, and h(IT +1) = IT +1 14 4.1 Discretization Now, we need to discretize the value space, using parameter ε. We start with a constant factor approximate solution (cid:93)OPT for the Probemax problem with OPT ≥ (cid:93)OPT ≥ (1 − 1/e)2OPT (this can be obtained by a simple greedy algorithm See e.g., Appendix C of [8]). Let X be a discrete random be a threshold. For variable with a support S = (s1, s2, . . . , sl) and psi = Pr[X = si]. Let θ = ε(cid:93)OPT. "large" size si, i.e., si ≥ θ, set DX (si) = θ. For "small" size si, i.e., si < θ, set DX (si) = We use V = {0, ε(cid:93)OPT, . . . , (cid:93)OPT/ε} to denote the discretized support. Now, we describe the discretized random variable (cid:101)X with the support V. For "large" size, we set (cid:106) si (cid:93)OPT ε ε(cid:93)OPT (cid:107) (4.2) Under the constraint that the sum of probabilities remains 1, for "small" size d ∈ V \ {θ}, we scale down the probability by setting θ (cid:101)pθ = Pr[(cid:101)X = θ] = Pr[X ≥ θ] · E[X X ≥ θ]  ≤ (cid:88)  (cid:88) Pr[X = s] 1 − Pr[(cid:101)X = θ] · . (cid:101)pd = Pr[(cid:101)X = d] = Pr[X < θ] s∈S,DX (s)=d s∈S,DX (s)=d Pr[X = s]. (4.3) not their true size. More precisely, when the canonical policy (cid:101)σ probes an item X which realizes to Although the above discretization is quite natural, there are some technical details. We know how to solve the problem for the discretized random variables supported on V but the realized values are in S. Hence, we need to introduce the notion of canonical policys (the notion was introduced in Bhalgat et al. [6] for stochastic knapsack). The policy makes decisions based on the discretized sizes of variables, s ∈ S, the policy makes decisions based on discretized size DX (s). In this following lemma, we show it suffices to only consider canonical policies. We use P(σ, π) to denote the expected profit that the policy σ can obtain with the given distribution π. Lemma 4.1. Let π = {πi} be the set of distributions of random variables and (cid:101)π be the discretized 1. For any policy σ, there exists a (canonical) policy (cid:101)σ such that 2. For any canonical policy (cid:101)σ, P((cid:101)σ,(cid:101)π) ≥ (1 − O(ε))P(σ, π) − O(ε)OPT; version of π. Then, we have: P((cid:101)σ, π) ≥ P((cid:101)σ,(cid:101)π). The proof of the lemma can be found in Appendix A. The proof of Theorem 1.2. Suppose σ∗ is the optimal policy with expected profit P(σ∗, π) = OPT. Given an instance π, we compute the discretized distribution (cid:101)π. By Lemma 4.1 (1), there exists a canonical policy(cid:101)σ∗ such that P((cid:101)σ∗,(cid:101)π) ≥ (1 − O(ε)) · P(σ∗, π) − O(ε)OPT = (1 − O(ε))OPT. Now, we present a stochastic dynamic program for the Probemax problem with the discretized distri- bution(cid:101)π. Define the value set V = {0, ε(cid:93)OPT, . . . , (cid:93)OPT/ε} and the item set A = {1, 2, . . . , n}, and set T = m and I1 = 0. When we probe an item i to observe its value realization, say Xi, we define the system dynamic functions to be It+1 = f (It, i) = max{It, Xi}, g(It, i) = 0, and h(IT +1) = IT +1 (4.4) 15 for It ∈ V and t = 1, 2, . . . , T . Then Assumption 1 is immediately satisfied. By Theorem 1.1, we can find a policy σ with profit at least where OPTd denotes the expected profit of the optimal policy for the discretized version(cid:101)π and MAX = maxI∈V DP1(I,A) = DP1((cid:93)OPT/ε,A) = (cid:93)OPT/ε. We can see that OPTd ≥ P((cid:101)σ∗,(cid:101)π) ≥ (1 − O(ε))OPT. OPTd − O(ε2) · MAX, Thus, by Lemma 4.1 (2), we have P(σ, π) ≥ P(σ,(cid:101)π) ≥ OPTd − O(ε2)MAX ≥ (1 − O(ε))OPT − O(ε)OPT = (1 − O(ε))OPT, which completes the proof. 4.2 ProbeTop-k Problem In this section, we consider the ProbeTop-k problem where the reward is the summation of top-k values and k is a constant. Theorem 4.2. There exists a PTAS for the ProbeTop-k problem. In other words, for any fixed constant ε > 0, there is a polynomial-time approximation algorithm for the ProbeTop-k problem that finds a policy with the expected value at least (1 − ε)OPT. In this case, It is a vector of the top-k values among the realizes value of the probed items at the time period t. Thus, we begin with the initial vector I1 = {0}k. When we probe an item i and observe its value realization Xi, we update the vector by It+1 = {It + Xi} \ min{It, Xi}. version of π. Then, we have: We set g(It, i) = 0 and h(IT +1) = sum(IT +1). Assumption 1 (2,3) is immediately satisfied. Then We also need the discretization to satisfy the Assumption 1 (1). For Lemma 4.1, we make a small change as shown in Lemma 4.3. The proof of the lemma can be found in Appendix B. Thus, we can prove Theorem 4.2 which is essentially the same as the proof of Theorem 1.2 and we omit it here. Lemma 4.3. Let π = {πi} be the set of distributions of random variables and (cid:101)π be the discretized 1. For any policy σ, there exists a canonical policy (cid:101)σ such that 2. For any canonical policy (cid:101)σ, P((cid:101)σ,(cid:101)π) ≥ (1 − O(ε))P(σ, π) − O(ε)OPT; P((cid:101)σ, π) ≥ P((cid:101)σ,(cid:101)π) − O(ε)OPT. 5 Committed ProbeTop-k Problem In this section, we prove Theorem 1.4, i.e., obtaining a PTAS for the committed ProbeTop-k. In the committed model, once we probe an item and observe its value realization, we are committed to making an irrevocable decision immediately whether to choose it or not. If we add the item to the final chosen set C, the realized profit is collected. Otherwise, no profit is collected and we are going to probe the next item. Let σ∗ be the optimal committed policy. Suppose σ∗ is going to probe the item i and choose the item i if Xi realizes to a value θ ∈ Si, where Si is the support of the random variable Xi. Then σ∗ would choose the item i if Xi realizes to a larger value s ≥ θ. We call θ threshold for the item i. Thus the committed policy σ∗ for the committed ProbeTop-k problem can be represented as a decision tree Tσ∗. Every node v is labeled by an unique item av and a threshold θ(v), which means the policy chooses the item av if Xv realizes to a size s ≥ θ(v), and otherwise rejects it. 16 i}θ, where bθ Now, we present a stochastic dynamic program for this problem. For each item i, we create a set of actions Bi = {bθ i represents the action that we probe item i with the threshold θ. Since we assume discrete distribution (given explicitly as the input), there are at most a polynomial number of thresholds. Hence the set of action A = ∪i∈[n]Bi is bounded by a polynomial. The only requirement is that at most one action from Bi can be selected. Let It be the the number of items that have been chosen at the period time t. Then we set V = {0, 1, . . . , k}, I1 = 0. Since we can probe at most m items, we set T = m. When we select an action bθ i to probe the item i and observe its value realization, say Xi, we define the system dynamic functions to be (cid:26) It + 1 if Xi ≥ θ, It < k, It i ) = g(It, bθ i ) = otherwise; It+1 = f (It, bθ (5.1) for It ∈ V and t = 1, 2, . . . , T , and h(IT +1) = 0. Since k is a constant, Assumption 1 is immediately satisfied. However, in this case, we cannot directly use Theorem 1.1, due to the extra requirement that at most one action from each Bi can be selected. In this case, we need to slightly modify the dynamic program in Section 3.3 to satisfy the requirement. To compute M(i, C, CA), once we decide the position of the item i, we need to choose a threshold for the item. Since there are at most a polynomial number of thresholds, it can be computed at polynomial time. Hence, again, we can find a policy σ with profit at least OPT − O(ε) · MAX = (1 − O(ε)) OPT, where OPT denotes the expected profit of the optimal policy and MAX = maxI∈V DP1(I,A) = DP1(0,V) = OPT. 6 Committed Pandora's Box Problem (cid:26) Xi 0 if Xi ≥ θ, It < k, otherwise; In this section, we obtain a PTAS for the committed Pandora's Box problem. This can be proved by an analogous argument to Theorem 1.4 in Section 5. Similarly, for each box i, we create a set of actions Bi = {bθ i represents the action that we open the box i with threshold θ. Let It be the number of boxes that have been chosen at the time period t. Then we set A = ∪i∈[n]Bi, V = {0, 1, . . . , k}, T = n and I1 = 0. When we select an action bθ i to open the box i and observe its value realization, say Xi, we define the system dynamic functions to be i}, where bθ (cid:26) It + 1 if Xi ≥ θ, It < k, It otherwise; (cid:26) Xi − ci −ci It+1 = f (It, bθ i ) = g(It, bθ i ) = if Xi ≥ θ, It < k, otherwise; (6.1) for It ∈ V and t = 1, 2,··· , T , and h(IT +1) = 0. Notice that we never take an action bθ i for a value i )] = Pr[Xt ≥ θ] · E[Xi Xi ≥ θ] − ci < 0. Then Assumption 1 is immediately It < k if E[g(It, bθ satisfied. Similar to the Committed ProbeTop-k Problem, we can choose at most one action from each Bi. This can be handled in the same way. So again we can find a policy σ with profit at least OPT − O(ε) · MAX = (1 − O(ε)) OPT, where OPT denotes the expected profit of the optimal policy and MAX = maxI∈V DP1(I,A) = DP1(0,A) = OPT. 7 Stochastic Target In this section, we consider the stochastic target problem and prove Theorem 1.6. Define the item set A = {1, 2, . . . , n}. Let the value It be the total profits of the items in the knapsack at time period t. Then we set T = m and I1 = 0. When we insert an item i into the knapsack and observe its profit realization, say Xi, we define the system dynamic functions to be (cid:26) 1 if IT +1 ≥ T, 0 otherwise; (7.1) It+1 = f (It, i) = It + Xi, g(It, i) = 0, and h(IT +1) = 17 for t = 1, 2,··· , T . Then Assumption 1 (2,3) is immediately satisfied. But Assumption 1 (1) is not satisfied for that the value space V is not of constant size. Hence, we need discretization. We use the same discretization technique as in [18] for the Expected Utility Maximization. The main idea is as follows. Without loss of generality, we set T = 1. For an item b, we say Xb is a big realization if Xb > ε4 and small otherwise. For a big realization of Xb, we simple define the discretized d ≤ Xb ≤ ε4, where d is a threshold such that Pr[Xb ≥ d Xb ≤ ε4]ε4 = E[Xb Xb ≤ ε4]. For more details, please refer to [18]. Let P(σ, π, 1) be the expected objective value of the policy σ for the instance (π, 1), where π = {πi} ε5 (cid:99)ε5. For a small realization of Xb, we define (cid:101)Xb = 0 if Xb < d and (cid:101)Xb = ε4 if version of (cid:101)Xb as (cid:98) Xb denotes the set of reward distributions and 1 denotes the target. Let(cid:101)π be the discretized version of π. Lemma 7.1. For any policy σ, there exists a canonical policy (cid:101)σ such that Lemma 7.2. For any canonical policy (cid:101)σ, P((cid:101)σ,(cid:101)π, (1 − 2ε)) ≥ P(σ, π, 1) − O(ε). P((cid:101)σ, π, (1 − 2ε)) ≥ P((cid:101)σ,(cid:101)π, 1) − O(ε). Then, we have following lemmas. The proof of the lemma can be found in Appendix C. The Proof of Theorem 1.6. Suppose σ∗ is the optimal policy with expected value OPT = P(σ∗, π, 1). Given an instance π, we compute the discretized distribution(cid:101)π. By Lemma 7.1, there exists a policy (cid:101)σ∗ such that Now, we present a stochastic dynamic program for the instance ((cid:101)π, 1 − 2ε). Define the value set P((cid:101)σ∗,(cid:101)π, (1 − 2ε)) ≥ P(σ∗, π, 1) − O(ε) = OPT − O(ε). V = {0, ε5, 2ε5, . . . , 1}, the item set A = {1, 2, . . . , n}, T = m and I1 = 0. When we insert an item i into the knapsack and observe its profit realization, say Xi, we define the system dynamic functions to be It+1 = f (It, i) = min{1, It + Xi}, g(It, i) = 0, and h(IT +1) = (7.2) for It ∈ V and t = 1, 2, . . . , T . Then Assumption 1 is immediately satisfied. By Theorem 1.1, we can find a policy σ with value P(σ,(cid:101)π, 1 − 2ε) at least where OPTd denotes the expected value of the optimal policy for instance ((cid:101)π, 1 − 2ε) and MAX = OPTd − O(ε) · MAX ≥ P((cid:101)σ∗,(cid:101)π, (1 − 2ε)) − O(ε) = OPT − O(ε), P(σ, π, (1 − 4ε)) ≥ P(σ,(cid:101)π, (1 − 2ε)) − O(ε) ≥ OPT − O(ε), maxI∈V DP1(I,A) = DP1(1,A) = 1. By Lemma 7.2, we have otherwise; (cid:26) 1 if IT +1 ≥ 1 − 2ε, 0 which completes the proof. 8 Stochastic Blackjack Knapsack In this section, we consider the stochastic blackjack knapsack and prove Theorem 1.7. Define the item set A = {1, 2, . . . , n}. Denote It = (It,1, It,2) and let It,1, It,2 be the total sizes and total profits of the items in the knapsack at the time period t respectively. We set T = n and I1 = (0, 0). When we insert an item i into the knapsack and observe its size realization, say si, we define the system dynamics function to be (cid:26) IT +1,2 0 if IT +1,1 ≤ C, otherwise; (8.1) It+1 = f (It, i) = (It,1 + si, It,2 + pi), g(It, i) = 0, and h(IT +1) = 18 Consider a given adaptive policy σ. For each node v ∈ Tσ, we have P (v) =(cid:80) for t = 1, 2,··· , T . Then Assumption 1 (2,3) is immediately satisfied. But Assumption 1 (1) is not satisfied for that the value space V is not of constant size. Hence, we need discretization. Unlike the stochastic traget problem, we need to discretize the sizes and profits simultaneously. i∈R(v) pi where R(v) is the realization path from root to v. Define D = {v ∈ LF : W (v) ≤ C} where LF is the set of leaves on Tσ. Then we have P(σ) = Φ(v) · P (v). (8.2) (cid:88) v∈D Without loss of generality, we assume C = 1 and Xi ∈ [0, 1] for any i ∈ [n]. Let P(σ, π, 1) be the expected profit of the policy σ for the instance (π, 1), where π = {πi} denotes the set of size distributions and 1 denotes the capacity. 8.1 Discretization Next, we show that item profits can be assumed to be bounded θ2 = OPT/ε2. We set θ1 = OPT/ε and θ3 = OPT/ε3. Now, we define an item to be a huge profit item if it has profit greater that or equal to θ2. We use the same discretization technique as in [6] for the stochastic knapsack. For a huge item bi with size Xi and profit pi, we define a new size Xi and profit pi as follows: for ∀s ≤ 1 Pr[ Xi = s] = Pr[ Xi = s] · pi θ2 , Pr[ Xi = 1 + 4ε] = 1 −(cid:88) s≤1 Pr[ Xi = s] (8.3) and pi = θ2. In Lemma 8.2, we show that this transformation can be performed with only an O(ε) loss in the optimal profit. Before to prove the lemma, we need following useful lemma. Lemma 8.1. For any policy σ on instance (π, C), there exists a policy σ(cid:48) such that P(σ(cid:48), π, C) = (1 − O(ε))P(σ, π, C) and in any realization path, the sum of profit of items except the last item that σ(cid:48) inserts is less than θ1. Proof. We interrupt the process of the policy σ on a node v when the first time that P (v) ≥ θ1 to get a new policy σ(cid:48), i.e., , we have a truncation on the node v and do not add items (include v) any more in the new policy σ(cid:48). Let F be the set of the nodes on which we have truncation. Then we have v∈F Φ(v) ≤ ε. Thus, the total profit loss is equal to(cid:80) (cid:80) v∈F Φ(v)OPT ≤ εOPT. W.l.o.g, we assume that all (optimal or near optimal) policies σ considered in this section satisfy the following property. (P3) In any realization path, the sum of profit of items except the last item that σ inserts is less than θ1. Lemma 8.2. Let π be the distribution of size and profit for items and π be the scaled version of π by Equation (8.3). Then, the following statement holds: 1. For any policy σ, there exists a policy σ such that 2. For any policy σ, P(σ, π, C) = (1 − O(ε))P(σ, π, C). P(σ, π, C) = (1 − O(ε))P(σ, π, C). Proof of Lemma 8.2. For the first result, by Lemma 8.1, there exists a policy σ such that P(σ, π, C) = (1 − O(ε))P(σ, π, C) and in any realization path, there are at most one huge profit item and always at the end of the policy. For huge profit item v, the expected profit contributed by the realization path from root to v to P(σ, π, C) is Φ(v) · Pr[Xv ≤ C − W (v)] · (P (v) + pv). 19 In P(σ, π, C) with scaled distributions on huge profit items, the expected profit contributed by the realization path from the root to v is (cid:18) Φ(v) · Pr[ Xv ≤ C − W (v)] · (P (v) + θ2) = Φ(v) · Pr[Xv ≤ C − W (v)] · pv θ2 · (P (v) + θ2). (cid:19) Since v is a huge profit item, we have pv ≥ θ2, which implies pv completes the proof of the first part. · (P (v) + θ2) ≥ P (v) + pv. This Now, we prove the second part. By Property (P3), for a huge item v, we have P (v) ≤ OPT/ε. θ2 Then we have · (P (v) + θ2) = pv · 1 + ≤ pv · (1 + ε) ≤ (1 + ε)(pv + P (v)). pv θ2 This completes the proof of the second part. In order to discretize the profit, we define the approximate profit(cid:101)P(σ, π) =(cid:80) v∈D Φ(v)·(cid:101)P (v) where (cid:18) (cid:19) P (v) θ2 (cid:101)P (v) = θ3 · 1 − (cid:89) i∈R(v) (cid:18) 1 − pi θ3 (cid:19) (8.4) Lemma 8.3 below can be used to bound the gap between the approximate profit and the original profit. Lemma 8.3. For any adaptive policy σ for the scaled distribution π, we have Proof. Fix a node v on the tree Tσ. For the left side, we have P(σ, π, C) ≥(cid:101)P(σ, π, C) ≥ (1 − O(ε))P(σ, π, C).  = (cid:18) 1 − pi θ3 pi θ3 1 − (cid:89) i∈R(v) (cid:101)P (v) = θ3 · (cid:88) i∈R(v) pi = P (v). For the right size, we have 1 − (cid:19) ≤ θ3 ·  (cid:89) (cid:18) 1 − (cid:88)  · (cid:34) i∈R(v) i∈R(v) 1 − pi i∈R(v) 1 − (cid:88) (cid:19)  (cid:88) (cid:35) i∈R(v) pi + i∈R(v) θ3 1 − pi θ3 pi θ3 (cid:80) (cid:101)P (v) = θ3 − θ3 ·  (cid:88) ≥ θ3 − θ3 · = i∈R(v) ≥ (1 − O(ε))P (v), 2 pi θ3 where the last inequality holds by Property (P3) that P (v) ≤ θ1 + θ2. Now, we choose the same discretization technique to discretize the sizes with parameter ε3 which For a big realization of Xb, we simple define the discretized version of (cid:101)Xb as (cid:98) Xb is used in Section 7. For an item b, we say Xb is a big realization if Xb > ε4×3 and small otherwise. realization of Xb, we define (cid:101)Xb = 0 if Xb < d and (cid:101)Xb = ε4×3 if d ≤ Xb ≤ ε4×3, where d is a threshold ε5×3(cid:99)ε5×3. For a small such that Pr[Xb ≥ d Xb ≤ ε4×3]ε4×3 = E[Xb Xb ≤ ε4×3]. For more details, please refer to [18]. 20 (cid:101)P((cid:101)σ∗,(cid:101)π, (1 + 2ε)) ≥ (1 − O(ε))P((cid:101)σ∗,(cid:101)π, (1 + 2ε)) ≥ (1 − O(ε))P(σ∗, π, 1) ≥ (1 − O(ε))P(σ∗, π, 1) = (1 − O(ε))OPT. [Lemma 8.3] [Lemma 8.4 (1)] [Lemma 8.2 (1)] θ3 and Pr[(cid:101)pi = 0] = 1 − pi (cid:26) θ3 · IT +1,2 h(IT +1) = 0 Now, we present a stochastic dynamic program for the instance ((cid:101)π, 1 + 2ε). Define the value set value (cid:101)pi with Pr[(cid:101)pi = 1] = pi V = {0, ε5×3, 2ε5×3, . . . , 1 + 3ε} × {0, 1} and the item set A = {1, 2, . . . , n}. We set T = n and I1 = 0. When we insert an item i into the knapsack, we observe its size realization si and toss a coin to get a . Then we define the system dynamics function It+1 = f (It, i) = (It+1,1, It+1,2) = (min{1 + 3ε, It,1 + si}, max{It,2,(cid:101)pi}) to be θ3 and g(It, i) = 0 for It ∈ V and t = 1, 2,··· , T . The terminal function is if IT +1 ≤ 1 + 2ε, otherwise; (8.5) (8.6) of π. Then, the following statements holds: Lemma 8.4. Let π be the distribution of size and profit for items and be (cid:101)π be the discretized version 1. For any policy σ, there exists a canonical policy (cid:101)σ such that 2. For any canonical policy (cid:101)σ, P((cid:101)σ,(cid:101)π, (1 + 2ε)) ≥ (1 − O(ε))P(σ, π, 1). P((cid:101)σ, π, (1 + 2ε)) ≥ (1 − O(ε))P((cid:101)σ,(cid:101)π, 1). 8.2 Proof of Theorem 1.7 Now, we ready to prove Theorem 1.7. The proof of Theorem 1.7. Suppose σ∗ is the optimal policy with expected profit OPT = P(σ∗, π, 1). Given an instance π, we compute the scaled distribution π and discretized distribution(cid:101)π. By Lemma 8.3, Lemma 8.4 (1) and Lemma 8.2 (1), there exist a policy(cid:101)σ∗ such that Then Assumption 1 is immediately satisfied. By Theorem 1.1, we can find a policy σ with profit (cid:101)P(σ,(cid:101)π, 1 + 2ε) at least where OPTd denotes the expected approximate profit of the optimal policy for instance ((cid:101)π, 1 + 2ε) and OPTd − O(ε4) · MAX ≥(cid:101)P((cid:101)σ∗,(cid:101)π, (1 + 2ε)) − O(ε)OPT = (1 − O(ε))OPT, ε3 . By Lemma 8.3, Lemma 8.4 (2) and Lemma MAX = maxI∈V DP1(I,A) = DP1((0, 1),A) = θ3 = OPT 8.2 (2), we have P(σ, π, (1 + 4ε)) ≥ (1 − O(ε))P(σ, π, (1 + 4ε)) ≥ (1 − O(ε))P(σ,(cid:101)π, (1 + 2ε)) ≥ (1 − O(ε))(cid:101)P(σ,(cid:101)π, (1 + 2ε)) ≥ (1 − O(ε))OPT, [Lemma 8.2 (2)] [Lemma 8.4 (2)] [Lemma 8.3] which completes the proof. 21 8.3 Without Relaxing the Capacity Before design a policy for SBK without relaxing the capacity C, we establish a connection between adaptive policies for SKP and SBK. For a particular stochastic knapsack instance J , we use OPTSKP(J ) to denote the expected profit of an optimal policy for stochastic knapsack. Similarly, we denote OPTSBK(J ) for stochastic blackjack knapsack. Note that a policy for SBK is also a policy for SKP. Lemma 8.5. For any policy σ for SKP on instance J = (π, C), there exists a policy σ(cid:48) for SBK such that PSBK(σ(cid:48), π, C) ≥ 1 4 (8.7) Proof. W.l.o.g, we assume that for any node v ∈ Tσ, we have P(v) ≤ PSKP(σ, π, C). Otherwise, we use the subtree Tv to instead Tσ for SKP. Set θ = PSKP(σ, π, C)/2. We interrupt the process of the policy σ on a node v when the first time that the summation of is larger than or equal to θ to get a new policy σ(cid:48), i.e., we have a truncation on the node v and do not insert the item (include v) any more in the new policy σ(cid:48). Let F be the set of the nodes on which we have a truncation. Let ¯F = LF\F be the set of rest leaves, where LF is the set of leaves of the tree Tσ(cid:48). Then we have · PSKP(σ, π, C). 2θ = Φ(v) · P (v) + Φ(v) · [P (v) + P(v)] Φ(v) + Φ(v)[P (v) + 2θ] (cid:88) v∈F (cid:88) v∈F Φ(v)[P (v) + θ] Φ(v)P (v). v∈ ¯F (cid:88) ≤ θ ·(cid:88) (cid:88) (cid:88) ≤ θ + 2 = θ + v∈ ¯F v∈F v∈F (cid:88) v∈F Thus the expect profit of the policy σ(cid:48) for SBK is equal to Φ(v)P (v) ≥ 1 2 · θ = 1 4 · PSKP(σ, π, C). Lemma 8.6. For any stochastic knapsack instance J , we have OPTSKP(J ) ≥ OPTSBK(J ) ≥ 1 4 (8.8) For any fixed ε ≥ 0 and instance J , by the result of [5], there is a polynomial time algorithm to 2 − ε)OPTSKP(J ). By Lemma 8.5, we can find a OPTSKP(J ). compute a policy σ for SKP with expected profit ( 1 policy σ(cid:48) for SBK expected profit at least 1 4 × ( 1 2 − ε)OPTSKP(J ) ≥ ( − ε)OPTSBK(J ). 1 8 This completes the proof of Theorem 1.8. 9 Concluding Remarks In the paper, we formally define a model based on stochastic dynamic programs. This is a generic model. There are a number of stochastic optimization problems which fit in this model. We design a polynomial time approximation schemes for this model. We also study two important stochastic optimization problems, Probemax problem and stochastic knapsack problem. Using the stochastic dynamic programs, we design a PTAS for Probemax problem, 22 which improves the best known approximation ratio 1 − 1/e. To improve the approximation ratio for Probemax with a matroid constraint is still a open problem. Next, we focus the variants of stochastic knapsack problem: stochastic blackjack knapsack and stochastic target problem. Using the stochastic dynamic programs and discretization technique, we design a PTAS for them if allowed to relax the capacity or target. To improve the ratio for stochastic knapsack problem and variants without relaxing the capacity is still a open problem. Acknowledgements We would like to thank Anupam Gupta for several helpful discussions during the various stages of the paper. Jian Li would like to thank the Simons Institute for the Theory of Computing, where part of this research was carried out. Hao Fu would like to thank Sahil Singla for useful discussions about Pandora's Box problem. Pan Xu would like to thank Aravind Srinivasan for his many useful comments. References [1] Marek Adamczyk, Maxim Sviridenko, and Justin Ward. Submodular stochastic probing on ma- troids. Mathematics of Operations Research, 41(3):1022–1038, 2016. [2] Arash Asadpour and Hamid Nazerzadeh. Maximizing stochastic monotone submodular functions. Management Science, 62(8):2374–2391, 2015. [3] Richard Bellman. Dynamic programming. In Princeton University Press, 1957. [4] Dimitri P. Bertsekas. Dynamic programming and optimal control, volume 1. Athena scientific Belmont, MA, 1995. [5] Anand Bhalgat. A (2 + ε)-approximation algorithm for the stochastic knapsack problem. Unpub- lished Manuscript, 2011. [6] Anand Bhalgat, Ashish Goel, and Sanjeev Khanna. Improved approximation results for stochastic knapsack problems. Proceedings of the twenty-second annual ACM-SIAM symposium on Discrete Algorithms, pages 1647–1665, 2011. [7] Kai Chen and Sheldon M. Ross. An adaptive stochastic knapsack problem. European Journal of Operational Research, 239(3):625 – 635, 2014. [8] Wei Chen, Wei Hu, Fu Li, Jian Li, Yu Liu, and Pinyan Lu. Combinatorial multi-armed bandit with general reward functions. Advances in Neural Information Processing Systems, 2016. [9] Brian C Dean, Michel X Goemans, and Jan Vondrák. Adaptivity and approximation for stochastic In Proceedings of the sixteenth annual ACM-SIAM symposium on Discrete packing problems. algorithms, pages 395–404. Society for Industrial and Applied Mathematics, 2005. [10] Hao Fu, Jian Li, and Pan Xu. A ptas for a class of stochastic dynamic programs. International Colloquium on Automata, Languages, and Programming, 2018. In 45th [11] Anupam Gupta and Viswanath Nagarajan. A stochastic probing problem with applications. In International Conference on Integer Programming and Combinatorial Optimization, pages 205– 216. Springer, 2013. [12] Anupam Gupta, Viswanath Nagarajan, and Sahil Singla. Algorithms and adaptivity gaps for stochastic probing. pages 1731–1747, 2016. 23 [13] Nir Halman, Diego Klabjan, Chung Lun Li, James Orlin, and David Simchi-Levi. Fully poly- nomial time approximation schemes for stochastic dynamic programs. In Nineteenth Acm-Siam Symposium on Discrete Algorithms, pages 700–709, 2008. [14] Nir Halman, Diego Klabjan, Chung-Lun Li, James Orlin, and David Simchi-Levi. Fully polyno- mial time approximation schemes for stochastic dynamic programs. SIAM Journal on Discrete Mathematics, 28(4):1725–1796, 2014. [15] Nir Halman, Giacomo Nannicini, and James Orlin. A computationally efficient fptas for convex stochastic dynamic programs. SIAM Journal on Optimization, 25(1):317–350, 2015. [16] Taylan İlhan, Seyed MR Iravani, and Mark S Daskin. The adaptive knapsack problem with stochastic rewards. Operations Research, 59(1):242–248, 2011. [17] Asaf Levin and Aleksander Vainer. Adaptivity in the stochastic blackjack knapsack problem. Theoretical Computer Science, 516:121–126, 2014. [18] Jian Li and Wen Yuan. Stochastic combinatorial optimization via poisson approximation. Pro- ceedings of the forty-fifth annual ACM symposium on Theory of computing, pages 971–980, 2013. [19] Will Ma. Improvements and generalizations of stochastic knapsack and markovian bandits ap- proximation algorithms. Mathematics of Operations Research, 2017. [20] Kamesh Munagala. Approximation algorithms for stochastic optimization. https://simons. berkeley.edu/talks/kamesh-munagala-08-22-2016-1, Simons Institue for the Theory of Com- puting, 2016. [21] Warren B Powell. Approximate Dynamic Programming: Solving the Curses of Dimensionality, volume 842. John Wiley & Sons, 2011. [22] David B Shmoys and Chaitanya Swamy. An approximation scheme for stochastic linear pro- gramming and its application to stochastic integer programs. Journal of the ACM (JACM), 53(6):978–1012, 2006. [23] Sahil Singla. The price of information in combinatorial optimization. In Proceedings of the Twenty- Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2523–2532. SIAM, 2018. [24] Jan Vondrák, Chandra Chekuri, and Rico 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, pages 783–792. ACM, 2011. [25] Martin L. Weitzman. Optimal search for the best alternative. Econometrica, 47(3):641–654, 1979. A Proof of Lemma 4.1 version of π. Then, we have: Lemma 4.1. Let π = {πi} be the set of distributions of random variables and (cid:101)π be the discretized 1. For any policy σ, there exists a (canonical) policy (cid:101)σ such that 2. For any canonical policy (cid:101)σ, P((cid:101)σ,(cid:101)π) ≥ (1 − O(ε))P(σ, π) − O(ε)OPT; P((cid:101)σ, π) ≥ P((cid:101)σ,(cid:101)π). 24 Proof of Lemma 4.1. Recall that for each node v on the decision tree Tσ, the value Iv is the maximum among the realized value of the probed items right before probing the item av. For a path R, we use W (R) to the denote the value of the last node on the path. Let E be the set of all root-to-leaf paths in Tσ. Then we have P(σ, π) = Φ(r) · W (r). (A.1) (cid:88) r∈E that P(σr,(cid:101)π) ≥ (1 − O(ε))P(σ, π) − O(ε)OPT. Thus such a deterministic policy(cid:101)σ exists. Let θ = For the first result of Lemma 4.1, we prove that there is a randomized canonical policy σr such (cid:93)OPT ε be a threshold. We interrupt the process of the policy σ on a node v when the first time we probe an item whose weight exceeds this threshold to get a new policy σ(cid:48) i.e., we have a truncation on the node v and do not probe items (include v) any more in the new policy σ(cid:48). The total profit loss is equal to Φ(v) · OPT = OPT × (cid:88) Φ(v) ≤ O(ε) · OPT, v∈LF where LF is the set of the nodes on which we have a truncation. The last inequality holds because OPT ≥(cid:80) The randomized policy σr is derived from σ(cid:48) as follows. T (σr,(cid:101)π) has the same tree structure as T (σ(cid:48), π). If σr probes an item (cid:101)X and observes a discretized size d ∈ V, it chooses a random branch in T (σr,(cid:101)π) among those sizes that are mapped to d, i.e., {we DX (we) = d} according to the probability v∈LF Φ(v). v∈LF Φ(v) · [P(v) − Iv] ≤ (cid:88) (cid:88) v∈LF Φ(v) · P(v) ≥ θ ·(cid:80) v∈LF distribution Pr[branch e is chosen] = (cid:80) Pr[X = we] s DX (s)=d Pr[X = s] . Then by Equation (4.3), if we < θ we have (cid:101)pe = Pr[(cid:101)X = d] · Pr[branch e is chosen] = pe · 1 − Pr[(cid:101)X = θ] Pr[X < θ] which is less than OPT, where R(v) is the path from the root to the node v. Then we have (cid:81) i∈R(v) (cid:16) 1 − Pr[(cid:101)Xi = θ] i∈R(v) (cid:17) ≥ 1 − O(ε), which implies that (cid:101)Φ(v) = Φ(v) · (cid:89) 1 − Pr[(cid:101)Xi = θ] Pr[Xi ≤ θ] ≥ (1 − O(ε))Φ(v). i∈R(v) in T (σ(cid:48), π). We split it into two parts E1 = {r ∈ E : W (r) < θ} and E2 = {r ∈ E : W (r) ≥ θ}. For Now we bound the profit that we can obtain from T (σr,(cid:101)π). Let E be the set of all root-to-leaf paths the first part, we have(cid:88) (cid:101)Φ(r) ·(cid:102)W (r) ≥ (cid:88) (cid:101)Φ(r) ·(cid:104) W (r) − O(ε(cid:93)OPT) (cid:105) r∈E1 r∈E1 25 and least · ε(cid:93)OPT ≥ we − ε(cid:93)OPT. Fact. For any node v in the tree T (σ(cid:48), π) such that Iv < θ, we have (cid:101)we = (cid:23) ε(cid:93)OPT (cid:22) we (cid:101)Φ(v) ≥ (1 − O(ε))Φ(v). 1 − (cid:89) (cid:17) , 1 − Pr[(cid:101)Xi = θ] (cid:16) θ · (A.2) When we regard the path R(v) as a policy, the expected profit of the path R(v) can obtain is at  − O(ε(cid:93)OPT). Equation (4.2), we have Pr[(cid:101)X = θ] · θ = Pr[X ≥ θ] · E[X X ≥ θ]. Then, we have As mentioned before, for any path r ∈ E2, we interrupt the process of the policy σ when the first time we probe an item whose weight exceeds this threshold θ. We use (cid:96)r to denote the item for path r. By (cid:88) ≥ (1 − O(ε)) Φ(r) · W (r) r∈E1 (cid:88) r∈E2 (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) = (cid:88) ≥ (cid:88) r∈E2 r∈E2 = r∈E2 (cid:101)Φ((cid:96)r) · Pr[(cid:101)X(cid:96)r = θ] · θ (cid:101)Φ((cid:96)r) · Pr[X(cid:96)r ≥ θ] · E[X(cid:96)r X(cid:96)r ≥ θ] (1 − O(ε))Φ((cid:96)r) · Pr[X(cid:96)r ≥ θ] · E[X(cid:96)r X(cid:96)r ≥ θ] (cid:88) = (1 − O(ε)) Φ(r) · W (r). In summation, the expected profit P(σr,(cid:101)π) is equal to (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) ≥ (1 − O(ε)) (cid:88) r∈E2 r∈E Φ(r) · W (r) − O(ε(cid:93)OPT) r∈E = (1 − O(ε))P(σ(cid:48), π) − O(ε)OPT = (1 − O(ε))P(σ, π) − O(ε)OPT. πe = (cid:88) s∈S:DX (s)=(cid:101)we Pr[X = s] ≥(cid:101)πe. Next, we prove the second result of Lemma 4.1. Recall that a canonical policy makes decisions obtain the true profit rather than the discretized profit. By Equation (4.3), for an edge e with a weight based on the discretized sizes. Then T ((cid:101)σ, π) has the same tree structure as T ((cid:101)σ,(cid:101)π), except that it (cid:101)we < θ on T ((cid:101)σ,(cid:101)π), we have Fact. For any node v in the tree T ((cid:101)σ,(cid:101)π) with Iv < θ, we have (cid:101)Φ(v) ≤ Φ(v). Similarly, we split the root-to-leaf paths set E into two parts E1 = {r ∈ E : maxe∈r (cid:101)we < θ} and E2 = {r ∈ E : maxe∈r (cid:101)we = θ}. Then, we have (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) + (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) + (cid:88) (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) (cid:101)Φ((cid:96)r) · Pr[(cid:101)X(cid:96)r = θ] · θ Φ((cid:96)r) · Pr[X(cid:96)r ≥ θ] · E[X(cid:96)r X(cid:96)r ≥ θ] Φ(r) · W (r) Φ(r) · W (r) + Φ(r) · W (r) + (A.3) r∈E2 r∈E2 r∈E2 = = r∈E1 (cid:88) P((cid:101)σ,(cid:101)π) = (cid:88) ≤ (cid:88) (cid:88) = P((cid:101)σ, π) r∈E1 r∈E1 r∈E1 r∈E2 26 B Proof of Lemma 4.3 version of π. Then, we have: Lemma 4.3. Let π = {πi} be the set of distributions of random variables and (cid:101)π be the discretized 1. For any policy σ, there exists a canonical policy (cid:101)σ such that 2. For any canonical policy (cid:101)σ, P((cid:101)σ,(cid:101)π) ≥ (1 − O(ε))P(σ, π) − O(ε)OPT; P((cid:101)σ, π) ≥ P((cid:101)σ,(cid:101)π) − O(ε)OPT. (cid:35) (cid:34)(cid:88) W (r) = max Xi . Proof. This can be proved by an analogous argument as Lemma 4.1. For the first result, we design a randomized canonical policy σr as before. Here, W (r) is the summation of the top-k weights on the path r. For a root-to-leaf path r, the profit we get is equal to (B.1) i∈C C⊆r,C≤k Now we bound the profit we can obtain from T (σr,(cid:101)π). recall that E1 = {r ∈ E : maxe∈r we < θ} and E2 = {r ∈ E : maxe∈r we ≥ θ} where E is the set of all root-to-leaf paths. Then for any r ∈ E1, we have (cid:102)W (r) ≤ W (r) − k · ε(cid:93)OPT = W (r) − O(ε(cid:93)OPT). For the first part, we have(cid:88) (cid:101)Φ(r) ·(cid:102)W (r) ≥ (1 − O(ε)) (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) = ≥ (cid:88) ≥ (cid:88) (cid:101)Φ((cid:96)r) · Pr[(cid:101)X(cid:96)r = θ] · (θ +(cid:102)W (cid:48)((cid:96)r)) (cid:101)Φ((cid:96)r) · Pr[X(cid:96)r ≥ θ] ·(cid:16)E[X(cid:96)rX(cid:96)r ≥ θ] +(cid:102)W (cid:48)((cid:96)r) (cid:17) (cid:17) (cid:101)Φ((cid:96)r) · Pr[X(cid:96)r ≥ θ] ·(cid:16)E[X(cid:96)rX(cid:96)r ≥ θ] + W (cid:48)((cid:96)r) − O(ε(cid:93)OPT) [Φ(r) · W (r)] − O(ε(cid:93)OPT). For the second part, we have (cid:88) (cid:88) r∈E2 r∈E2 r∈E1 r∈E2 r∈E1 where W (cid:48)(r) is the summation of top k − 1 weights on the path r. In summation, the expected profit Now, we prove the second result. Similarly, we have P(σr,(cid:101)π) is equal to and (cid:88) r∈E2 ≥ (1 − O(ε)) Φ(r) · W (r) − O(ε(cid:93)OPT) (cid:88) r∈E2 r∈E2 (cid:88) r∈E (cid:101)Φ(r) ·(cid:102)W (r) ≥ (1 − O(ε))P(σ, π) − O(ε)OPT. (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) ≤ (cid:88) (cid:88) (cid:101)Φ(r) ·(cid:102)W (r) = (cid:101)Φ((cid:96)r) · Pr[(cid:101)X(cid:96)r = θ] · (θ +(cid:102)W (cid:48)((cid:96)r)) ≤ (cid:88) Φ((cid:96)r) · Pr[X(cid:96)r ≥ θ] · E[X(cid:96)r X(cid:96)r ≥ θ] + O()OPT ≤ (cid:88) Φ(r) · W (r) + O()OPT Φ(r) · W (r) r∈E1 r∈E1 r∈E2 r∈E2 where the first inequality holds since Pr[(cid:101)X = θ] ≤ ε. Hence, the proof of the lemma is completed. r∈E2 27 C Proof of Lemma 7.1 and Lemma 7.2 Lemma 7.1. For any policy σ, there exists a canonical policy (cid:101)σ such that Lemma 7.2. For any canonical policy (cid:101)σ, Consider a given adaptive policy σ and for each v ∈ Tσ, let W (v) and(cid:102)W (v) be the sum of rewards P((cid:101)σ,(cid:101)π, (1 − 2ε)) ≥ P(σ, π, 1) − O(ε). P((cid:101)σ, π, (1 − 2ε)) ≥ P((cid:101)σ,(cid:101)π, 1) − O(ε). on the path R(v) before and after discretization respectively. Recall that Φ(v) is the probability associated with the path R(v). In the proof of Lemma 4.2 of [18], it shows that for any given set F of nodes in Tσ which contains at most one node from each root-leaf path, our discretization has the below property: (cid:88) v∈∆2 28 v∈F :W (v)−(cid:102)W (v)≥2 Φ(v) = O(ε). The Proof of Lemma 7.1. Consider a randomized canonical policy(cid:101)σ which has the same structure as If σr inserts an item (cid:101)X and observes a discretized size d ∈ V, it chooses a random branch in T (σr,(cid:101)π) among those sizes that are mapped to d, i.e., {we DX (we) = d} according to the probability σ. (C.1) distribution Pr[branch e is chosen] = (cid:80) Pr[X = we] s DX (s)=d Pr[X = s] . we have different is two edges are labels with different weight we on Tσ and (cid:101)we on Tσr. Then, the probability of an edge on Tσr is the same as that of the corresponding edge on Tσ. The only Notice that P((cid:101)σ,(cid:101)π, (1− 2ε)) is the sum of all paths R(v) with(cid:102)W (v) ≥ 1− 2. Define D = {v ∈ LF : W (v) ≥ 1} and (cid:101)D = {v ∈ LF :(cid:102)W (v) ≥ 1 − 2ε}, where LF is the set of leaves on T (σ, π). Therefore Consider the set ∆1 = D \ (cid:101)D. For each v ∈ ∆1, we have W (v) ≥ 1 and (cid:102)W (v) < 1 − 2ε. Thus we = {v ∈ LF : W (v) −(cid:102)W (v) ≥ 2}. Thus we claim that W (v) −(cid:102)W (v) > 2ε, implying that ∆1 ⊆ ∆ P((cid:101)σ,(cid:101)π, (1 − 2ε)) ≥ P(σ, π, 1) − (cid:88) (cid:88) v∈(cid:101)D Φ(v) ≥ P(σ, π, 1) −(cid:88) Φ(v), P((cid:101)σ,(cid:101)π, (1 − 2ε)) = Φ(v) ≥ P(σ, π, 1) − O(ε). P(σ, π, 1) = (cid:88) have Φ(v). v∈D . v∈∆1 v∈∆ The Proof of Lemma 7.2. In our case, we focus on the decision tree T ((cid:101)σ,(cid:101)π, 1) and assume all (cid:101)we take discretized value. T ((cid:101)σ,(cid:101)π, 1) has the same tree structure as T ((cid:101)σ, π, 1 − 2ε). Define ∆2 = {v ∈ LF, W (v) < 1 − 2ε,(cid:102)W (v) ≥ 1}, where LF is the set of leaves in Tσ. Then we see (cid:102)W (v) − W (v) > 2ε, implying ∆2 ⊆ ∆ = {v ∈ LF : W (v) −(cid:102)W (v) ≥ 2ε}. By the result of Equation (C.1), we see Therefore we claim that (cid:88) Φ(v) ≤(cid:88) P((cid:101)σ, π, (1 − 2ε)) ≥ P((cid:101)σ,(cid:101)π, 1) − (cid:88) v∈∆2 v∈∆ Φ(v) = O(ε). Φ(v) ≥ P((cid:101)σ,(cid:101)π, 1) − O(ε). D Proof of Lemma 8.4 of π. Then, the following statements hold: Lemma 8.4. Let π be the distribution of size and profit for items and be(cid:101)π be the discretized version 1. For any policy σ, there exists a canonical policy (cid:101)σ such that 2. For any canonical policy (cid:101)σ, The proof of Lemma 8.4. For the first result, consider a randomized canonical policy(cid:101)σ which has the same structure as σ. If σr inserts an item (cid:101)X and observes a discretized size d ∈ V, it chooses a random branch in T (σr,(cid:101)π) among those sizes that are mapped to d, i.e., {we DX (we) = d} according to the P((cid:101)σ,(cid:101)π, (1 + 2ε)) ≥ (1 − O(ε))P(σ, π, 1). P((cid:101)σ, π, (1 + 2ε)) ≥ (1 − O(ε))P((cid:101)σ,(cid:101)π, 1). probability distribution Pr[branch e is chosen] = (cid:80) Pr[X = we] s DX (s)=d Pr[X = s] . different is two edges are labels with different weight we on Tσ and (cid:101)we on Tσr. Then, the probability of an edge on Tσr is the same as that of the corresponding edge on Tσ. The only We have P (v) =(cid:80) W (v) ≤ 1} and (cid:101)D = {v ∈ LF : (cid:102)W (v) ≤ 1 + 2ε}, where LF is the set of leaves on T (σ, π). Then we i∈R(v) pi which is less than O(OPT/ε) by Lemma 8.2. Define D = {v ∈ LF : have P(σ, π, 1) = Φ(v) · P (v). Define ∆ = {v ∈ LF : W (v) −(cid:102)W (v) ≥ 2ε}. Then we have D \ (cid:101)D ⊆ ∆. By the result of Equation (cid:88) v∈(cid:101)D (cid:88) v∈D Φ(v) · P (v), P((cid:101)σ,(cid:101)π, 1 + 2ε) = Φ(v) ≤(cid:88) (cid:88) v∈D\(cid:101)D Φ(v) · P (v) ≤ (cid:88) v∈D\(cid:101)D Φ(v) · 2OPT Φ(v) = O(ε3). (cid:88) v∈D\(cid:101)D ε2 = O(ε)OPT. (C.1), we have less than By Property (P1), for any node v, we have P (v) ≤ θ1 + θ2.Then the gap P(σ, π, 1) − P((cid:101)σ,(cid:101)π, (1 + 2ε) is v∈∆ This completes the proof of the first part. Now, we prove the second part. Since a canonical policy makes decisions based on the discretized, T ((cid:101)σ,(cid:101)π, 1) has the same tree structure as T ((cid:101)σ, π, 1 + 2ε). Define D = {v ∈ LF : W (v) ≤ 1 + 2ε} and (cid:101)D = {v ∈ LF :(cid:102)W (v) ≤ 1}, where LF is the set of leaves on T ((cid:101)σ,(cid:101)π, 1). Then we have P((cid:101)σ, π, 1 + 2ε) = Φ(v) · P (v), P((cid:101)σ,(cid:101)π, 1) = Φ(v) · P (v). (cid:88) v∈D (cid:88) v∈(cid:101)D Then the gap P((cid:101)σ,(cid:101)π, 1) − P((cid:101)σ, π, (1 + 2ε) is equal to Φ(v) · P (v) ≤ (cid:88) v∈(cid:101)D\D (cid:88) v∈(cid:101)D\D Φ(v) · 2OPT ε2 = O(ε)OPT. 29
1502.05545
3
1502
2015-11-29T18:49:39
Time and space optimality of rotor-router graph exploration
[ "cs.DS" ]
We consider the problem of exploration of an anonymous, port-labeled, undirected graph with $n$ nodes and $m$ edges and diameter $D$, by a single mobile agent. Initially the agent does not know the graph topology nor any of the global parameters. Moreover, the agent does not know the incoming port when entering to a vertex. Each vertex is endowed with memory that can be read and modified by the agent upon its visit to that node. However the agent has no operational memory i.e., it cannot carry any state while traversing an edge. In such a model at least $\log_2 d$ bits are needed at each vertex of degree $d$ for the agent to be able to traverse each graph edge. This number of bits is always sufficient to explore any graph in time $O(mD)$ using algorithm Rotor-Router. We show that even if the available node memory is unlimited then time $\Omega(n^3)$ is sometimes required for any algorithm. This shows that Rotor-Router is asymptotically optimal in the worst-case graphs. Secondly we show that for the case of the path the Rotor-Router attains exactly optimal time.
cs.DS
cs
Time and space optimality of rotor-router graph exploration Artur Menc1, Dominik Pająk∗2, and Przemysław Uznański†3 1Faculty of Fundamental Problems of Technology, Wroclaw University of Technology, Poland 3Helsinki Institute for Information Technology HIIT, Department of Computer Science, 2Computer Laboratory, University of Cambridge, UK Aalto University, Finland June 28, 2021 Abstract We consider the problem of exploration of an anonymous, port-labeled, undirected graph with n nodes and m edges and diameter D, by a single mobile agent. Initially the agent does not know the graph topology nor any of the global parameters. Moreover, the agent does not know the incoming port when entering to a vertex. Each vertex is endowed with memory that can be read and modified by the agent upon its visit to that node. However the agent has no operational memory i.e., it cannot carry any state while traversing an edge. In such a model at least log2 d bits are needed at each vertex of degree d for the agent to be able to traverse each graph edge. This number of bits is always sufficient to explore any graph in time O(mD) using algorithm Rotor-Router [20]. We show that even if the available node memory is unlimited then time Ω(n3) is sometimes required for any algorithm. This shows that Rotor-Router is asymptotically optimal in the worst-case graphs. Secondly we show that for the case of the path the Rotor-Router attains exactly optimal time. Introduction 1 In this paper we consider the exploration problem of a port-labeled graph in the following setting. The exploration is performed by a single agent that has no memory (oblivious agent) and when it enters to a node it has no information about the port number through which it entered (no inport). Each node contains some number of bits of memory that can be read and modified by the agent upon its visit. Hence the whole navigation mechanism needs to be defined using only local information. Rotor-Router is an algorithm in which each node maintains a pointer to one of its neighbors and a cyclic sequence of its neighbors. Upon each visit of the token to a node, the token is propagated along the pointer of its current node and the pointer of the node is advanced to the next position in the cyclic sequence. Studies of Rotor-Router show that it can be used as a graph-exploration algorithm and there are guarantees on exploration time even is the initial state of the pointers and the sequence at each node can be set by an adversary. In such a case, Rotor-Router can be also seen as a space-efficient algorithm since the only information that needs to be stored at a node is the current position of the pointer. Hence (cid:100)log2 d(cid:101) bits of memory needs to be stored at each node with degree d to implement Rotor-Router. It is worth observing that with less memory the task becomes impossible as at each node with degree d, the algorithm needs at least d different inputs to traverse every outgoing edge. This paper considers the following question: ∗Corresponding author. E-mail [email protected] †Part of this work was done while D. Pająk was visiting P. Uznański at Aix-Marseille Université. Partially supported by the Labex Archimède and by the ANR project MACARON (ANR-13-JS02-0002) 1 does there exist an algorithm for exploration for oblivious agent with no inport that is always faster than Rotor-Router if we allow more bits of memory at each node? We give a negative answer to this question by showing a graph for which any such algorithm cannot be asymptotically faster than Rotor-Router even if we allow unbounded memory at each node. 1.1 Preliminaries We assume anonymous graph G = (V, E) with n nodes, m edges, diameter D and with no global labeling of the nodes nor the edges. In order to navigate in the graph, the agent needs to locally distinguish between the edges outgoing from its position, so we assume that all edges outgoing from a fixed vertex with degree d are distinctly labeled using numbers {1, 2, . . . , d}. The agent is modeled as a memoryless token. Each node contains a label of Mw bits which can be read and modified by the agent upon its visit to that node. Such a model will be referred to as an oblivious agent. Memory size on each node can depend on the node degree. Let us denote by Sw = {0, 1, . . . , 2Mw − 1} the set node states. An oblivious agent is then defined as a function f : Sw × N → Sw × N whose input is a tuple (sw, d) ∈ Sw × N, where sw is the state of the node currently occupied by the agent and d is the node degree. The output of function f is a tuple (s(cid:48)w, p) ∈ Sw × {1, 2, . . . , d}, where s(cid:48)w is the new state of the currently occupied node and p is the port number through which the agent exits the current node in the current step. We say that the agent is located at a node v at the beginning of some step t, then traverses the chosen arc during step t and appears at the w. other end of the arc at the beginning of step t + 1. Initially, each node is in a starting state s0 Observe that the port label through which the agent entered to the current node is not part of the input. Thus the agent cannot easily backtrack its moves. We call this model feature an unknown inport. At any step, the configuration of Rotor-Router is a triple ((πv)v∈V , (ρv)v∈V , r), where r is the current position of the agent. In the current step, the agent traverses the edge indicated by pointer πr which is then advanced to the next edge in the port ordering ρr. Graph exploration problem. The goal of the agent is to visit all vertices of graph G. We assume that the initial agent position in the graph as well as the port-labeling of the edges can be chosen by an adversary. Initially the agent has no knowledge about the topology of G or even its size. An oblivious agent that explores all unknown graphs, needs to traverse all edges and thus needs at least d different inputs at any vertex with degree d in order to traverse all of its outgoing edges. This leads to the following lower bound on the total memory at a vertex and on the agent. Observation 1.1. If an oblivious agent explores all graphs in the model with unknown inport, then Mw ≥ log2 d holds for any node with degree d. 1.2 Our results In this paper we show two lower bounds. In the first we show that for any oblivious algorithm with no inport there exists a labeling of a path for which this algorithm needs at least (n − 1)2 steps. This shows that unbounded memory at a node cannot decrease the exploration time of the path even by one step. On the other hand Rotor-Router needs only 1 bit and always explores a path in time at most (n − 1)2. For general graphs we show that any oblivious agent in the model with no inport requires time Ω(n3) for some graphs regardless of the sizes of node memory. This shows that it is impossible to construct an algorithm for oblivious agent that would be asymptotically faster than the Rotor-Router in the worst-case even if unbounded memory at each node is available. 1.3 Related work When exploring a graph using a Rotor-Router mechanism with arbitrary initialization, time Θ(mD) is always sufficient and sometimes required for any graph [20] [3]. Since the Rotor-Router requires no special 2 initialization, it can be implemented in a graph with (cid:100)log2 d(cid:101)-bits of memory at each node with degree d. An oblivious agent can simply exit the node v via port w(v) + 1, where w(v) is the value on the whiteboard, and increment the value w(v) modulo deg(v). Thus exploration in time O(mD) is possible by oblivious agents with (cid:100)log2 d(cid:101)-bit node memory, which is the smallest possible by Observation 1.1. 2 Lower bounds In this section we prove a lower bound on the number of steps of graph exploration for oblivious agent. First we need the following observation, which helps to reason about behavior of oblivious agents in port-labeled graphs. Lemma 2.1. Behavior of any oblivious agent A in graph G with arbitrary size of node memory is fully characterized by the collection of functions portd(i) for d = 1, 2, . . . . For a fixed d, the function denotes the outport chosen by the agent upon its i-th visit to any node with degree d. Proof. Since the agent has no internal memory and does not know the label of the port through which it enters to a node, the only information the agent has is the degree of the current node and the state of the node memory. Thus the label of the next outport taken from a node v can only depend on the degree of v and on the labels of previously chosen outports from node v. The following lemma characterizes the worst-case exploration time for any oblivious agent on a path. Theorem 2.2. Let P be a path on n vertices v1, v2, . . . , vn. For any oblivious agent A, starting on vertex vn, there exists port labeling of P such that if A visits v1, then: 1. A makes at least (n − 1)2 edge traversals before its first visit to v1, 2. A traverses arc vn → vn−1 at least n − 1 times before its first visit to v1. Proof. Let us fix any oblivious agent A. By Lemma 2.1 we can also fix its sequence {ai}∞i=1 of exits from each node of degree 2 (that is ai = port2(i) ∈ {1, 2}). The proof will proceed by induction on the number of nodes of the path. For i = 2, the agent makes one traversal of v2 → v1 before its first visit to v1. Let us assume, that the claim is true for some i ≥ 2 and we will show it for i + 1. The agent starts at node vi+1. We will use the inductive assumption for subpath of nodes vi, . . . , v2, v1. The agent needs to traverse arc vi → vi−1 at least i− 1 times before its first visit in v1. We want to choose port labeling of node vi. Take first 2(i − 1) − 1 elements of sequence {ai} and take the element α that appears in it at least (i − 1) times. Set α to be the label of the arc vi → vi+1. The other element, {1, 2} \ {α} is the label of the arc vi → vi−1. Observe that under such port labeling, before i − 1 traversals of vi → vi−1, arc vi → vi+1 will be traversed at least i − 1 times. This means that before the first visit to v1, the agent will enter node vi+1 at least i − 1 times. Since the agent started at vi+1 then before the first visit to v1 it will traverse edge vi+1 → vi at least i times. The total number of steps within subpath vi, . . . v1 is at least (i − 1)2 by the inductive assumption. Additionally the agent traverses vi+1 → vi at least i and vi → vi+1 at least i− 1 times thus the total number of traversals is at least (i − 1)2 + (i − 1) + i = i2. The previous theorem showed that any strategy for oblivious agents requires at least (n − 1)2 steps to Interestingly, (n − 1)2 is also the worst-case number of steps to explore a path for the explore a path. Rotor-Router. It shows that the Rotor-Router is optimal on a path. It means that even adding arbitrarily large node memory cannot provide any speedup (not only asymptotic one) for path exploration, when compared to just one bit node memory sufficient to implement Rotor-Router on the path. The next theorem shows a lower bound on exploration time for oblivious agents on arbitrary graphs. Theorem 2.3. For any value of n and any any oblivious agent A there exists graph G with n vertices, such that A needs at least Ω(n3) time steps to visit all vertices of G. 3 Proof. Fix agent A and size of the graph n. Assume that n divisible by 3. Let d = n/3. Consider the sequence ai = portd(i) ∈ {1, 2, . . . d} for i = 1, 2, . . . , where portd(i) is defined in Lemma 2.1. In the prefix of length d · (d − 1) of sequence {ai} there exists a value p that appears at most d − 1 times. Consider a graph G1 constructed from the clique Kd by attaching one node v(cid:48) to each node v of the clique (see Figure 1 for an example). Observe that each node coming from clique Kd has an additional neighbor thus its degree in G1 is d. For each v from the clique, the port leading to v(cid:48) is p. All other ports are set arbitrarily. Figure 1: Example of graph G1 for n = 18. Consider a walk of agent A on graph G1 starting from an arbitrary vertex vs for d2 · (d− 1) steps. There Figure 2: Example of graph G for n = 18. exists a vertex v∗ from the original clique Kd that was visited at most d · (d − 1) times. Construct a graph G by modifying G1. Replace the one additional node attached to v∗ with a path P of d + 1 nodes. Set the worst-case port-labeling of path P , as in the Theorem 2.2, depending on function port2(i) of A. Denote by vf , the first node of P that is connected to v∗ (see Figure 2 for an example). Consider agent A exploring the graph G starting from vertex vs. Since the agent is oblivious, its moves between vertices in G that come from original graph G1 are the same as in the graph G1. Thus within d2 · (d − 1) steps in G, node v∗ is visited at most d · (d − 1) times. Since p is the port leading from v∗ to vf then after d · (d − 1) visits to v∗, agent visited vf at most d − 1. But by Theorem 2.2, the agent needs to visit vf at least d times to explore path P . Thus the agent needs time at least d2 · (d − 1) = Ω(n3) to explore graph G. If n is not divisible by 3 we can add the remaining vertices to the path and the exploration time will be at least(cid:4) n (cid:5)2 ·(cid:0)(cid:4) n (cid:5) − 1(cid:1) = Ω(n3) 3 3 The theorem shows that, even with unbounded node memory, the oblivious agents need Ω(n3) steps to explore some graphs. Since the Rotor-Router explores any graph in time O(mD) = O(n3) [20] there is no strategy for oblivious agents that would be faster in the worst-case. Observe also that the Rotor- Router can be implemented using node memory of minimum possible size (cid:100)log2 d(cid:101) at nodes of degree d. By Observation 1.1, agent with less memory cannot traverse all outgoing edges. Thus the Rotor-Router is both time and space optimal strategy for oblivious agents. References [1] R. Aleliunas, R. M. Karp, R. J. Lipton, L. Lovász, and C. Rackoff. Random walks, universal traversal sequences, and the complexity of maze problems. In FOCS, pages 218 -- 223, 1979. [2] C. Ambühl, L. Gasieniec, A. Pelc, T. Radzik, and X. Zhang. Tree exploration with logarithmic memory. ACM Trans. on Alg., 7(2):17, 2011. [3] E. Bampas, L. Gąsieniec, N. Hanusse, D. Ilcinkas, R. Klasing, and A. Kosowski. Euler tour lock-in problem in the rotor-router model. In DISC, pages 423 -- 435, 2009. [4] P. Berenbrink, C. Cooper, and T. Friedetzky. Random walks which prefer unvisited edges: Exploring high girth even degree expanders in linear time. Random Struct. Algorithms, 46(1):36 -- 54, 2015. 4 ppppppppppppv∗vf [5] A. Borodin, W. L. Ruzzo, and M. Tompat. Lower bounds on the length of universal traversal sequences. JCSS, 45(2):180 -- 203, 1992. [6] R. Cohen, P. Fraigniaud, D. Ilcinkas, A. Korman, and D. Peleg. Label-guided graph exploration by a finite automaton. ACM Trans. on Alg., 4(4), 2008. [7] H. Dai and K. Flannery. Improved length lower bounds for reflecting sequences. In Computing and Combinatorics, volume 1090 of LNCS, pages 56 -- 67. Springer Berlin Heidelberg, 1996. [8] K. Diks, P. Fraigniaud, E. Kranakis, and A. Pelc. Tree exploration with little memory. J. Algorithms, 51(1):38 -- 63, 2004. [9] G. Dudek, M. Jenkin, E. E. Milios, and D. Wilkes. Robotic exploration as graph construction. IEEE T. Robotics and Automation, 7(6):859 -- 865, 1991. [10] U. Feige. A tight upper bound on the cover time for random walks on graphs. Random Struct. Algo- rithms, 6(1):51 -- 54, 1995. [11] P. Fraigniaud and D. Ilcinkas. Digraphs exploration with little memory. In STACS, pages 246 -- 257, 2004. [12] P. Fraigniaud, D. Ilcinkas, G. Peer, A. Pelc, and D. Peleg. Graph exploration by a finite automaton. Theor. Comput. Sci., 345(2-3):331 -- 344, 2005. [13] P. Fraigniaud, D. Ilcinkas, S. Rajsbaum, and S. Tixeuil. The reduced automata technique for graph exploration space lower bounds. In Theor. Comput. Sci., Essays in Memory of Shimon Even, pages 1 -- 26, 2006. [14] M. Koucký. Log-space constructible universal traversal sequences for cycles of length o(n4.03). Theor. Comput. Sci., 296(1):117 -- 144, 2003. [15] M. Koucký. Universal traversal sequences with backtracking. JCSS, 65(4):717 -- 726, 2002. Special Issue on Complexity 2001. [16] N. Nisan. RL ⊆ SC. Computational Complexity, 4:1 -- 11, 1994. [17] V. Priezzhev, D. Dhar, A. Dhar, and S. Krishnamurthy. Eulerian walkers as a model of self-organized criticality. Phys. Rev. Lett., 77(25):5079 -- 5082, Dec 1996. [18] O. Reingold. Undirected connectivity in log-space. J. ACM, 55(4), 2008. [19] H. A. Rollik. Automaten in planaren graphen. Acta Informatica, 13(3):287 -- 298, 1980. [20] V. Yanovski, I. A. Wagner, and A. M. Bruckstein. A distributed ant algorithm for efficiently patrolling a network. Algorithmica, 37(3):165 -- 186, 2003. 5
1708.05223
2
1708
2018-04-09T12:18:28
The streaming $k$-mismatch problem
[ "cs.DS" ]
We consider the streaming complexity of a fundamental task in approximate pattern matching: the $k$-mismatch problem. It asks to compute Hamming distances between a pattern of length $n$ and all length-$n$ substrings of a text for which the Hamming distance does not exceed a given threshold $k$. In our problem formulation, we report not only the Hamming distance but also, on demand, the full \emph{mismatch information}, that is the list of mismatched pairs of symbols and their indices. The twin challenges of streaming pattern matching derive from the need both to achieve small working space and also to guarantee that every arriving input symbol is processed quickly. We present a streaming algorithm for the $k$-mismatch problem which uses $O(k\log{n}\log\frac{n}{k})$ bits of space and spends \ourcomplexity time on each symbol of the input stream, which consists of the pattern followed by the text. The running time almost matches the classic offline solution and the space usage is within a logarithmic factor of optimal. Our new algorithm therefore effectively resolves and also extends an open problem first posed in FOCS'09. En route to this solution, we also give a deterministic $O( k (\log \frac{n}{k} + \log |\Sigma|) )$-bit encoding of all the alignments with Hamming distance at most $k$ of a length-$n$ pattern within a text of length $O(n)$. This secondary result provides an optimal solution to a natural communication complexity problem which may be of independent interest.
cs.DS
cs
The streaming k-mismatch problem Raphael Clifford1, Tomasz Kociumaka2, and Ely Porat3 1Department of Computer Science, University of Bristol, United Kingdom [email protected] 2Institute of Informatics, University of Warsaw, Poland 3Department of Computer Science, Bar-Ilan University, Israel [email protected] [email protected] Abstract We consider the streaming complexity of a fundamental task in approximate pattern It asks to compute Hamming distances between a matching: the k-mismatch problem. pattern of length n and all length-n substrings of a text for which the Hamming distance does not exceed a given threshold k. In our problem formulation, we report not only the Hamming distance but also, on demand, the full mismatch information, that is the list of mismatched pairs of symbols and their indices. The twin challenges of streaming pattern matching derive from the need both to achieve small working space and also to guarantee that every arriving input symbol is processed quickly. We present a streaming algorithm for the k-mismatch problem which uses O(k log n log n k ) k (√k log k+log3 n)) time on each symbol of the input stream, bits of space and spends O(log n which consists of the pattern followed by the text. The running time almost matches the classic offline solution [5] and the space usage is within a logarithmic factor of optimal. Our new algorithm therefore effectively resolves and also extends an open problem first posed in FOCS'09 [37]. En route to this solution, we also give a deterministic O(k(log n k + log Σ))- bit encoding of all the alignments with Hamming distance at most k of a length-n pattern within a text of length O(n). This secondary result provides an optimal solution to a natural communication complexity problem which may be of independent interest. 8 1 0 2 r p A 9 ] S D . s c [ 2 v 3 2 2 5 0 . 8 0 7 1 : v i X r a 1 Introduction Combinatorial pattern matching has formed a cornerstone of both the theory and practice of algorithm design over a number of decades. Despite this long history, there has been a recent resurgence of interest in the complexity of the most basic problems in the field. This has been partly been fuelled by the discovery of multiple lower bounds conditioned on the hardness of a small set of well-known problems with naive solutions notoriously resistant to any significant improvement [2, 3, 8, 6, 1, 9, 18]. Pattern matching has also proved to be a rich ground for exploring the time and space complexity of streaming algorithms [37, 19, 23, 28, 7, 16, 20, 17, 22] and it is this line of research that we follow. We consider the most basic similarity measure between strings of different lengths: that of computing all Hamming distances between a pattern and equal-length substrings of a longer text. In the streaming k-mismatch problem, the input strings arrive one symbol at a time and the task is to output the Hamming distance between the pattern and the latest length-n suffix of the text provided that it does not exceed a threshold k specified in advance. Considered as an online or streaming problem with one text symbol arriving at a time, The problem of computing the exact Hamming distances between a pattern and every length- n substring of a text of length O(n) has been studied in the standard offline model for over 30 years. In 1987, O(n√n log n)-time solutions were first developed [4, 32]. Motivated by the need to find close matches quickly, from there the focus moved to the bounded k-mismatch version of the problem. For many years, the fastest solution ran in O(nk) time [34]. It was not until 2000, when a breakthrough result gave O(n√k log k) time [5]. Much later, an O(k2 log k + n polylog n)-time solution was developed [17], and a recent manuscript [25] improves this further to O((n + k√n) polylog n) time. k-mismatch admits a linear-space solution running in O(√k log k + log n) worst-case time per arriving symbol, as shown in 2010 [19]. The paper of Porat and Porat in FOCS'09 gave an O(k3 polylog n)-space and O(k2 polylog n)-time streaming solution, showing for the first time that the k-mismatch problem could be solved in sublinear space for particular ranges of k [37]. In SODA'16, this was subsequently improved to O(k2 polylog n) space and O(√k log k + polylog n) time per arriving symbol [17]. As we will describe below, our solution tackles a harder version of the k-mismatch problem while having nearly optimal space complexity O(k polylog n). The twin challenges of streaming pattern matching stem from the need to optimise both working space and a guarantee on the running time for every arriving symbol of the text. An important feature of the streaming model is that we must account for all the space used and cannot, for example, store a copy of the pattern. One can derive a space lower bound for any streaming problem by looking at a related one- way communication complexity problem. The randomised one-way communication complexity of determining if the Hamming distance between two strings is greater than k is known to be Ω(k) bits with an upper bound of O(k log k) bits [27]. In our problem formulation, however, we report not only the Hamming distance but also the full mismatch information-the list of mismatched pairs of symbols and their indices. In this situation, one can derive a slightly higher space lower bound of Ω(k(log n k + log Σ)) bits1. This formulation has been tackled before as a streaming pattern matching problem: an O(k2 log10 n/ log log n) space and O(k log8 n/ log log n) time solution was given [38]. Prior to the work we present here, the simple lower bound for a single output combined with the upper bounds presented above used to represent the limits of our understanding of the complexity of this basic problem. In this paper, we almost completely resolve both the time and space complexity of the streaming k-mismatch pattern matching problem. Our solution is also the first small-space 1This follows directly from the observation that for a single alignment with Hamming distance k, there are (cid:0)n k(cid:1) possible sets of mismatch indices and each of the k mismatched symbols requires Ω(log Σ) bits to be represented, where Σ denotes the input alphabet. From this, we derive the same lower bound for the space required by any streaming k-mismatch algorithm. We assume throughout that Σ is bounded by a polynomial in n. 1 streaming pattern matching algorithm for anything other than exact matching which requires no offline and potentially expensive preprocessing of the pattern. That is, it assumes that the pattern precedes the text in the input stream and processes it in a truly streaming fashion. Problem 1.1. Consider a pattern of length n and a longer text which arrive in a stream one symbol at a time. The streaming k-mismatch problem asks after each arriving symbol of the text whether the current suffix of the text has Hamming distance at most k with the pattern and if so, it also asks to return the corresponding mismatch information. Our main result is an algorithm for the streaming k-mismatch problem which almost matches the running time of the classic offline algorithm while using nearly optimal working space. Unlike the fastest previous solutions for streaming k-mismatch (see e.g. [37, 17]), the algorithm we describe also allows us to report the full set of mismatched symbols (and their indices) at each k-mismatch alignment. This gives a remarkable resolution to the complexity of the streaming k-mismatch problem first posed by Porat and Porat in FOCS'09 [37]. Theorem 1.2. There exists a streaming k-mismatch algorithm which uses O(k log n log n of space and takes O(log n domised and its answers are correct with high probability, that is it errs with probability inverse polynomial in n. For each reported occurrence, the mismatch information can be reported on demand in O(k) time. k ) bits k (√k log k + log3 n)) time per arriving symbol. The algorithm is ran- While processing the pattern, our streaming algorithm works under the same restrictions on space consumption and per-symbol running time as when processing the text. This is in contrast to previous work on streaming approximate pattern matching which has typically included a potentially time- and space-inefficient offline preprocessing stage. In order to achieve our time and space improvements, we develop a number of new ideas and techniques which we believe may have applications more broadly. The first is a randomised O(k log n)-bit sketch which allows us not only to detect if two strings of the same length have Hamming distance at most k but if they do, also to report the related mismatch information. The sketch we give has a number of desirable algorithmic properties, including the ability to be efficiently maintained subject to concatenation and prefix removal. Armed with such a rolling sketch, one approach to the k-mismatch streaming problem could simply be to maintain the sketch of the length-n suffix of the text and to compare it to the sketch of the whole pattern. Although this takes O(k polylog n) time per arriving symbol, it would also require O(n log Σ) bits of space to retrieve the leftmost symbol that has to be removed from the sliding window at each new alignment. This is the central obstacle in streaming pattern matching which has to be overcome. Following the model of previous work on streaming exact pattern matching (see [37, 7]), we introduce a family of O(log n) prefixes Pℓ of the pattern with exponentially increasing lengths. We organise the algorithm into several levels, with the ℓth level responsible for finding the k- mismatch occurrences of Pℓ. The task of the next level is therefore to check, after Pℓ+1 − Pℓ subsequent symbols are read, which of these occurrences can be extended to k-mismatch occurrences of Pℓ+1. The key challenge is that in the meantime the k-mismatch occurrences of Pℓ have to be stored in a space-efficient way. In the exact setting, their starting positions form an arithmetic progression, but the presence of mismatches leads to a highly irregular structure. The task of storing k-mismatch occurrences of a pattern in a space-efficient representation can be expressed in terms of a natural communication problem which is of independent interest. Problem 1.3. Alice has a pattern P of length n and a text T of length O(n). She sends one message to Bob, who holds neither the pattern nor text. Bob must output all the alignments of the pattern and the text with at most k mismatches, as well as the applicable mismatch information. 2 The solution we give for this problem is both deterministic and asymptotically optimal. Theorem 1.4. There exists a deterministic one-way communication complexity protocol for Problem 1.3 that sends O(k(log n k + log Σ)) bits, where Σ denotes the input alphabet. One striking property of this result is that the communication complexity upper bound matches the lower bound we gave earlier for two strings of exactly the same length. In other words, we require no more space to report the mismatch information at all k-mismatch align- ments than we do to report it at only one such alignment. As the main conceptual step in our solution to Problem 1.3, we introduce modified versions of the pattern and text which are highly compressible but still contain sufficient information to solve the k-mismatch problem. More specifically, we place sentinel symbols at some positions of the text and the pattern, making sure that no new k-mismatch occurrences are introduced and that the mismatch information for the existing occurrences does not change. We then develop a key data structure (specified in Lemma 4.3) which lets us store the proxy pattern in a space- efficient way with O(log n)-time random access to any symbol. On the other hand, the relevant part of the text is covered by a constant number of k-mismatch occurrences of the pattern, so the modified text can be retrieved based on the proxy pattern and the mismatch information for these O(1) occurrences. Bob may use this data to find all the k-mismatch occurrences of the pattern in the text along with their mismatch information. We go on to show that both the encoding and decoding steps can be implemented quickly and in small space. The key tool behind the efficient decoding is a new fast and space-efficient algorithm for the k-mismatch problem in a setting with read-only random access to the input strings. This is much easier compared to the streaming model as the aforementioned idea of maintaining the sketch of a sliding window now requires just O(k log n) bits. This simple method would, however, be too slow for our purposes, and so in Theorem 4.7 we give a more efficient solution to the k-mismatch problem in the read-only model. Then in Theorem 4.8 we use this to give a solution for Problem 1.3 which is not only time- and space-efficient but which also lets us store the k-mismatch occurrences of prefixes of the pattern and retrieve them later on when they are going to be necessary. In our main algorithm, we apply it to store the k-mismatch occurrences of Pℓ until we can try extending them to k-mismatch occurrences of Pℓ+1. In order to guarantee that we can always process every symbol of the text in O(√k polylog n) time rather than in O(k polylog n) time, we develop a different procedure for matching strings with small approximate periods. The difficulty with such strings is that their k-mismatch occurrences may occur very frequently. Given in Theorem 3.8, our solution is based on a novel adaptation of Abrahamson's algorithm [4] designed for space-efficient convolution of sparse vectors. We apply it at the lowest level of our streaming algorithm so that at the higher levels we can guarantee that the k-mismatch occurrences of Pℓ start at least k positions apart. Finally, the use of sketches incurs a delay of O(k polylog n) time when a k-mismatch occur- rence is verified. To achieve better worst-case time per symbol, we set the penultimate prefix PL−1 to be of length n − 2k and we make the last level naively check which k-mismatch occur- rences of PL−1 extend to k-mismatch occurrences of P = PL. This trick lets us start verification already while reading the trailing 2k symbols of the candidate length-n substring of the text. In summary, our main contribution is given by Theorem 1.2, but in order to achieve this, we have developed a number of new tools and techniques. These include a new sliding win- dow sketch, a new small approximate period algorithm in Theorem 3.8, the communication protocol of Theorem 1.4, a new read-only pattern matching algorithm in Theorem 4.7 and, most importantly, our key technical innovation given by Theorem 4.8. This last result demon- strates that despite few structural properties, overlapping k-mismatch occurrences admit a very space-efficient representation with a convenient algorithmic interface. 3 2 A Rolling k-mismatch Sketch In this section, we give an overview of our new rolling sketch which will not only allow us to determine if two strings have Hamming distance at most k but if they do, it will also give us all the mismatch information. Our approach extends the deterministic sketch developed in [15] for the offline k-mismatch with wildcards problem and combines it with the classic Karp–Rabin fingerprints for exact matching [30]. We fix an upper bound n on the length of the compared strings and a prime number p > nc for sufficiently large exponent c (the parameter c can be used to control error probability). We will assume throughout that all the input symbols can be treated as elements of Fp by simply reading the bit representation of the symbols. If the symbols come from a larger alphabet, then we would need to hash them into Fp, which will introduce a small extra probability of error. Note that the earlier sketch of [15] is based on fields with characteristic two. However, in order to make our sketch able to roll forwards, we need to perform computations in a field with large characteristic (larger than n). The downside of this change is that we have to use a randomised polynomial factorisation algorithm to find the indices of the mismatches. Let us start by recalling the Karp–Rabin fingerprints [30] and defining our new sketch. Fact 2.1 (Karp–Rabin fingerprints). For r ∈ Fp chosen uniformly at random, the Karp–Rabin fingerprints ψr, defined as ψr(S) = Pℓ−1 if U, V ∈ Fℓ Definition 2.2 (k-mismatch sketch). For a fixed prime number p and for r ∈ Fp chosen uniformly at random, the sketch skk(S) of a string S ∈ F∗ p are not equal, then ψr(U ) = ψr(V ) holds with probability at most ℓ p . i=0 S[i]ri for S ∈ Fℓ p, satisfy the following property: p is defined as: skk(S) = (φ0(S), . . . , φ2k(S), φ′ k(S), ψr(S)), 0(S), . . . , φ′ i=0 S[i]2ij for j ≥ 0. i=0 S[i]ij and φ′ j(S) = Pℓ−1 where φj(S) = Pℓ−1 Observe that the sketch is a sequence of 3k + 3 elements of Fp, so it takes O(k log p) = O(k log n) bits. The main goal of the sketches is to check whether two given strings are at Hamming distance k or less, and, if so, to retrieve the mismatches. We define the mismatch information between two strings X and Y as MI(X, Y ) = {(i, X[i], Y [i]) : X[i] 6= Y [i]}. Lemma 2.3. Given the sketches skk(S) and skk(T ) of two strings of the same length ℓ ≤ n, in O(k log3 n) time we can decide (with high probability) whether HD(S, T ) ≤ k. If so, the mismatch information MI(S, T ) is reported. The algorithm uses O(k log n) bits of space. Next, we consider the efficiency of updating a sketch given the mismatch information. Lemma 2.4. Let S, T ∈ F∗ be constructed in O(k log2 n) time and O(k log n) bits of space given MI(S, T ) and skk(S). As a result, the sketch can be efficiently maintained subject to elementary operations. p be of the same length ℓ < n. If HD(S, T ) = O(k), then skk(T ) can Corollary 2.5. A string X ∈ F∗ p with X ≤ n can be stored in O(k log n) bits so that skk(X) can be retrieved in O(k log2 n) time and the following updates are handled in O(log2 n) time: 1. append a given symbol a ∈ Fp to X, 2. substitute X[i] = a for X[i] = b given the index i and the symbols a, b ∈ Fp. Unlike in [15], we also need to efficiently maintain sketches subject to concatenation etc. Lemma 2.6. The following operations can be implemented in O(k log n) time using O(k log n) bits of space, provided that all the processed strings belong to F∗ p and are of length at most n. 1. Construct one of the sketches skk(U ), skk(V ), or skk(U V ) given the other two. 2. Construct skk(U ) or skk(U m) given the other sketch and the integer m. 4 3 Patterns with a Small Approximate Period As our first space- and time-efficient algorithm, we show how the streaming k-mismatch problem can be solved deterministically when the pattern P has a small approximate period and therefore can be stored in O(k) words of space. Recall that a string X of length n is defined to have a period p > 0 if X[0, . . . , n − p − 1] = X[p, . . . , n − 1]. The d-periods describe analogous structure for the setting with mismatches: We say that an integer p is a d-period of a string X of length n if HD(X[0, . . . , n − p − 1], X[p, . . . , n − 1]) ≤ d. The set of d-periods of X is denoted by Per(X, d). d + (d + p) log Σ)-bit pe- riodic representation with respect to p, which by definition consists of X[0, . . . , p − 1] and MI(X[0, . . . , n − p − 1], X[p, . . . , n − 1]); see [17]. The following lemma lets us detect a small d-period of a given string X and construct the underlying periodic representation. If X does not have any such d-period, we can still retrieve the longest prefix of X which has one. This feature is going to be useful in Section 5, where we solve the general k-mismatch problem. A string X with a d-period p can be stored using an O(d log n Lemma 3.1. There exists a deterministic streaming algorithm that, given positive integers p and d = O(p), finds the longest prefix Y of the input string X which has a d-period p′ ≤ p. It reports the periodic representation of Y with respect to p′, uses O(p) words of space, and takes O(√p log p) per-symbol processing time plus O(p√p log p) post-processing time. In [17], it was proved that any k2 consecutive values HamP,T [i] := HD(P, T [i−P+1, . . . , i]) can be generated in O(k2 log k) time using O(k2) words of space if the pattern P and the text T share a d-period p satisfying d = O(k) and p = O(k). Below, we show how to compute k subsequent Hamming distances in O(k√k log k) time using O(k) words of space, under an additional assumption that the preceding 2p Hamming distances are already available. Our approach resembles Abrahamson's algorithm [4], so let us first recall how the values HamP,T [i] can be expressed in terms of convolutions. The convolution of two functions f, g : Z → Z is a function f ∗ g : Z → Z such that (f ∗ g)(i) = Xj∈Z f (j) · g(i − j). For a string X and a symbol a ∈ Σ, we define a characteristic function Xa : Z → {0, 1} of positions where a occurs in X. In other words, Xa[i] = 1 if and only if 0 ≤ i < X and X[i] = a. The cross-correlation of strings T and P is a function T ⊗ P : Z → Z defined as T ⊗ P = Pa∈Σ Ta ∗ P R Fact 3.2. We have (T ⊗ P )(i) = P − HamP,T [i] for P − 1 ≤ i < T and (T ⊗ P )(i) = 0 for i < 0 and i ≥ P + T. a , where P R denotes the reverse of P . If a string X has a d-period p, then Xa[i] is typically equal to Xa[i + p]. This property can be conveniently formalised using a notion of finite differences. For a function f : Z → Z and a positive integer p ∈ Z+, we define the forward difference ∆p[f ] : Z → Z as ∆p[f ](i) = f (i + p) − f (i). Observation 3.3. If a string X has a d-period p, then the functions ∆p[Xa] have at most 2(d + p) non-zero entries in total across all a ∈ Σ. The following lemma reuses the idea behind Abrahamson's algorithm to compute the con- volution of functions with a sparse support, i.e., with few non-zero entries. Lemma 3.4. Consider functions f, g : Z → Z with at most n non-zero entries in total. The non-zero entries among any δ consecutive values (f ∗ g)(i), . . . , (f ∗ g)(i + δ− 1) can be computed in O(n√δ log δ) time using O(n + δ) words of working space. 5 This is very useful because the forward difference operator commutes with the convolution: Fact 3.5. Consider functions f, g : Z → Z with finite support and a positive integer p. We have ∆p[f ∗ g] = f ∗ ∆p[g] = ∆p[g] ∗ f . Consequently, ∆p[f ] ∗ ∆p[g] = ∆p[∆p[f ∗ g]]. observe that ∆2 The function ∆p[∆p[h]], called the second forward difference of h : Z → Z, is denoted ∆2 Combining Lemma 3.4, Fact 3.5, and the notions introduced above, we can compute the second forward differences of the cross-correlation between P and T efficiently and in small space: p[h](i) = h(i + 2p) − 2h(i + p) + h(i). p[h]; Corollary 3.6. Suppose that p is a d-period of strings P and T . Given the periodic representa- tions of P and T with respect to p, any δ consecutive values ∆2 p[T ⊗P ](i+δ−1) can be computed in O(δ + (d + p)√δ log δ) time using O(d + p + δ) words of space. Proof. The functions ∆p[P R a ] have 2(d + p) non-zero entries in total, and the functions ∆p[Ta] enjoy the same property. Hence, using Lemma 3.4 to compute all the non-zero entries among (∆p[Ta]∗ ∆p[P R we observe that ∆2 a ])(j) for a ∈ Σ and i ≤ j < i + δ takes O((d + p)√δ log δ) time in total. Finally, p[T ⊗P ](i), . . . , ∆2 a ]) by Fact 3.5. p[T ⊗ P ] = Pa∈Σ(∆p[Ta] ∗ ∆p[P R Fact 3.2 and Corollary 3.6 can be applied to compute the subsequent Hamming distances HamP,T [i] provided that P and T share a common d-period p. These values can be generated in O(p(d + p) log(d + p)) amortised time using O(d+ p) words of space, with Θ(d+ p) consecutive Hamming distances actually computed in every iteration. In Lemma 3.7, we adapt this approach to the streaming setting, where HamP,T [i] needs to be known before T [i + 1] is revealed. To deal with this, we use a two-part partitioning known as the tail trick. Similar ideas were already used to deamortise streaming pattern matching algorithms; see [17, 16, 19]. Lemma 3.7. Let P be a pattern with a d-period p. Suppose that p is also an O(d + p)-period of the text T . There exists a deterministic streaming algorithm which processes T using O(d + p) words of space and O(p(d + p) log(d + p)) time per symbol, and reports HamT,P [i] for each position i ≥ P − 1. Our final goal in this section is to waive the assumption that p is an approximate period of the text. Nevertheless, we observe that p must still be a (d+k)-period of any fragment matching P with k mismatches. Thus, our strategy is to identify approximately periodic fragments of T which are guaranteed to contain all k-mismatch occurrences of P ; Lemma 3.7 is then called for each such fragment. To make the result applicable in Section 5, we augment it with two extra features: First, we allow for delaying the output by O(P) positions, which is possible because the approximately periodic fragments of T can be stored in small space. Secondly, we support reporting skk(T [0, . . . , i − 1]) for any k-mismatch occurrence T [i, . . . , i + P − 1]. This comes at the cost of O(log2 n) extra time per symbol due to the use of Corollary 2.5. Theorem 3.8. Suppose that we are given an integer k and the periodic representation of a pattern P with respect to a d-period p such that d = O(k) and p = O(k). There exists a deterministic streaming algorithm, which uses O(k) words of space and O(√k log k + log2 n) time per symbol to report the k-mismatch occurrences of P in the streamed text T . For each reported occurrence, the mismatch information and sketch of the prefix of T up to the reported occurrence can be computed on demand in O(k) and O(k log2 n) time, respectively. The algorithm may also be configured to report the output with any prescribed delay ∆ = O(P). A combination of Lemma 3.1 and Theorem 3.8 now enables us to give a deterministic streaming k-mismatch algorithm when the pattern is guaranteed to have a d-period p with d = O(k) and p = O(k). The procedure of Lemma 3.1 can be called to find an O(k)-period p′ = O(k) of P (along with the periodic representation of P ), and then T can be processed using Theorem 3.8. This concludes the description of our streaming k-mismatch algorithm in the case where the pattern has at least one small approximate period. 6 4 Efficiently Encoding Nearby k-Mismatch Occurrences k + log Σ)) bits along with the underlying mismatch information. In this section, we present the main technical contribution of our work: we show how all k- mismatch occurrences of a pattern P in a text T of length T = O(P) can be stored in O(k(log n First, we apply this tool to develop an optimal deterministic one-way communication proto- col for Problem 1.3, where Bob must output all the alignments of the pattern and the text with at most k mismatches, as well as the applicable mismatch information, with no access to the text T or the pattern P . Next, we increase the space complexity to O(k log n) bits, which lets us encode and retrieve the k-mismatch occurrences using time- and space-efficient procedures. The latter is a key building block of our k-mismatch streaming algorithm. Our approach relies on the crucial observation that overlapping k-mismatch occurrences of a pattern P induce a 2k-period of P . Fact 4.1. If P has k-mismatch occurrences at positions ℓ, ℓ of T satisfying ℓ < ℓ′ < ℓ + P, then ℓ′ − ℓ ∈ Per(P, 2k). Consequently, we shall build a data structure that for a given string X of length n and a collection P ⊆ Per(X, k) of its k-periods lets us efficiently encode all the underlying mismatch information MI(X[0, . . . , n − p − 1], X[p, . . . , n − 1]) for p ∈ P. It turns out that O(k(log n k + log Σ)) bits are sufficient provided that P ⊆ Per≤n/4(X, k), i.e., if each k-period p ∈ P satisfies p ≤ 1 4 n. Remarkably, the asymptotic size of the data structure matches the size of mismatch information of a single k-period despite encoding considerably more information. Our data structure must in particular be able to retrieve X[i] unless X[i] = X[i + p] and X[i] = X[i − p] hold for each p ∈ P (such that i + p < n and i − p ≥ 0, respectively). This idea can be conveniently formalised using the following concept of classes modulo d in a string X. Definition 4.2. Let X be a fixed string. For integers i and d with d ≥ 0, the i-th class modulo p (in X) is defined as a multiset: Cd(X, i) = {X[i′] : 1 ≤ i ≤ X and i′ ≡ i (mod p)}. For d = 0 we assume that i′ ≡ i (mod 0) if and only if i = i′. Now, it is easy to see that we do not need to store X[i] if the class Cd(X, i) modulo d = gcd(P) is uniform, i.e., if it contains just one element (with positive multiplicity). Indeed, a mismatch X[i] 6= X[i + p] or X[i] 6= X[i− p] may only occur in a non-uniform class. This is the motivation behind the following component developed in Section 10. Lemma 4.3. For a string X and an integer k, let P ⊆ Per≤n/4(X, k) and d = gcd(P). There is a data structure of size O(k(log n k +log Σ)) bits which given an index i retrieves X[i] in O(log n) time if Cd(X, i) is non-uniform, and returns a sentinel symbol # if the class is uniform. The data structure can be initialised in O(1) time with P = ∅, and updated in O(k log n) time subject to adding a k-period p ∈ Per≤n/4(X, k) to P given MI(X[0, . . . , n − p − 1], X[p, . . . , n − 1]). To prove Lemma 4.3, we build a sequence 0 = d0, . . . , ds = d of integers such that dℓ = gcd(dℓ−1, pℓ), pℓ ∈ P for 1 ≤ ℓ ≤ s, and s = O(log n). Next, we observe that classes modulo dℓ for ℓ = 0, . . . , s form a sequence of partitions of {X[i] : 0 ≤ i < n}, with each partition coarser than the previous one. We keep the majority of a class modulo dℓ whenever it differs form the majority of the enclosing class modulo dℓ+1. The majority of Cdℓ (i) is likely to match the majority of Cdℓ(i + pℓ), which lets us store these characters using run-length encoding. On the top level, we keep the majority of every non-uniform class modulo ds; the number of such classes turns out to be O(k). 7 4.1 An Optimal Deterministic Protocol for Problem 1.3 Using Lemma 4.3, we can now develop an efficient protocol for Problem 1.3 and thus prove Theorem 1.4. We shall assume that the text T is of length at most 5 4 n. If the actual text is longer, the full protocol splits it into substrings of length 5 4 n with overlaps of length n, thus enabling us to find all k-mismatch occurrences by repeating the protocol a constant number of times. If P does not occur in T , Alice may send an empty message to Bob. Otherwise, her message consists of the following data: along with the underlying mismatch information; • the locations ℓ and ℓ′ of the leftmost and the rightmost k-mismatch occurrence of P in T , • the value d = gcd(P) and the data structure of Lemma 4.3 for P consisting of distances between locations of k-mismatch occurrence of P in T ; P ⊆ Per≤n/4(P, 2k) due to Fact 4.1. By Lemma 4.3 and the tight bound on the size of the mismatch information, the message takes O(k(log n k + log Σ)) bits. Now, it suffices to describe how Bob can retrieve all the k-mismatch occurrences of P in T , as well as the corresponding mismatch information. For this, we show that Bob can construct a proxy pattern P# as well as a proxy text T ′ # and look for k-mismatch occurrences of P# in T ′ # instead of the k-mismatch occurrences of P in T . More precisely, we first obtain T ′ = T [ℓ, . . . , ℓ′ + P − 1] from T by trimming the prefix and the suffix of T disjoint with the k-mismatch occurrences of P . Next, we construct P# from P by replacing P [i] with a sentinel #i mod d (distinct between classes modulo d) whenever Cd(P, i) ∪ Cd(T ′, i) is uniform. Similarly, we transform T ′ to obtain T ′ #. The main property of these strings is that in any occurrence of P in T ′, we have not altered the symbols involved in a mismatch, while matching symbols could only be replaced by sentinels in a consistent way. Fact 4.4. The pattern P has a k-mismatch occurrence at position j of T if and only if P# has a k-mismatch occurrence at position j − ℓ of T ′ #. Moreover, in that case we have MI(P, T [j, . . . , j + n − 1]) = MI(P#, T ′ #[j − ℓ, . . . , j − ℓ + n − 1]). Furthermore, we deduce that Bob can retrieve any symbol of P# based on Lemma 4.3 (if Cd(P, i) is non-uniform) or the mismatch information for the k-mismatch occurrences of P as a prefix and a suffix of T (otherwise). Similarly, Bob can retrieve T ′ # because T ′ is covered by the two k-mismatch occurrences of P . Fact 4.5. Bob can retrieve P# and T ′ # from Alice's message. Consequently, Bob's strategy is to compute the mismatch information for all the alignments of P# in T ′ # and output it (with the starting position shifted by ℓ) whenever there are at most k mismatches. By Fact 4.4, this coincides with the desired output of k-mismatch occurrences of P in T . This concludes the proof of Theorem 1.4, whose statement is repeated below. Theorem 1.4. There exists a deterministic one-way communication complexity protocol for Problem 1.3 that sends O(k(log n 4.2 Algorithmic Consequences k + log Σ)) bits, where Σ denotes the input alphabet. In this section, we apply the ideas behind Theorem 1.4 to develop time- and space-efficient compression scheme for the following representation of the k-mismatch occurrences of P in T . Definition 4.6. Consider a pattern P and a text T . We define the stream of k-mismatch information of P in T as a sorted sequence of starting positions i of k-mismatch occurrences of P in T , each associated with the mismatch information and the sketch skk(T [0, . . . , i − 1]). 8 Θ(k log n) bits compared to Θ(k(log n Note that the inclusion of sketches increases the space consumption of a single entry to k + log Σ)) bits required for the mismatch information. Let us see how to implement fast procedures for both parties of Problem 1.3. As far as Alice is concerned, we observe that Fact 4.1 can be trivially made constructive. In other words, it is easy to transform the mismatch information of two overlapping k-mismatch occurrences of P to the mismatch information of the induced 2k-period of P . As stated in Lemma 4.3, the underlying component can be efficiently constructed based on this data. To implement Bob's procedure, we observe that the proof of Fact 4.4 actually allows for read-only random access to P# and T ′ #, with O(log n) time required to retrieve any symbol. Thus, we develop an efficient k-mismatch algorithm for that model, and we use it to locate k- mismatch occurrences of P# in T ′ #. This procedure is based on the results of Section 3 applied for the longest prefix Q of P with a (2k + 1)-period p ≤ k, with the sketches of Section 2 employed to check which k-mismatch occurrences of Q extend to k-mismatch occurrences of P . Theorem 4.7. In the read-only random-access model, the streaming k-mismatch problem can be solved on-line with a Monte-Carlo algorithm using O(k log n) bits of working space and O(√k log k+log3 n) time per symbol, including O(1) symbol reads. For any reported k-mismatch occurrence, the mismatch information can be retrieved on demand in O(k) time. Compared to the output of Problem 1.3, the stream of k-mismatch information also includes the sketches skk(T [0, . . . , i − 1]) for each k-mismatch occurrences T [i, . . . , i + P − 1]. We use Corollary 2.5 and Lemma 2.6 to retrieve them efficiently after some non-trivial preprocessing. Our final observation is that several instances of the resulting data structure can be combined to form a buffer allowing us to delay the stream of k-mismatch information by a prescribed value ∆. This component is defined in a synchronous setting, based on an external clock which measures the progress of processing the text T , with discrete ticks corresponding to scanning subsequent symbols of T . If P has a k-mismatch occurrence at position i, then the buffer is fed with the entry of the k-mismatch stream at tick i, and it should report it back at tick i + ∆. Theorem 4.8. The stream of k-mismatch information of P in T can delayed by any ∆ = Θ(P) using a buffer of O(k log n) bits, which takes O(√k log k + log3 n) time per tick, with O(k log2 n) extra time for ticks when it is fed with a k-mismatch occurrence of P or it reports one. The initialisation, given skk(P ) and ∆, takes O(k) time. 5 The Streaming k-mismatch Algorithm We can now present our main result, an O(log n k )-bit streaming algorithm for the k-mismatch problem. Without loss of generality, we assume that P ≥ k so that no output is required while we read the first k symbols of the text. As a result, we can start processing the text with a delay of k/2 symbols and catch up while processing the subsequent k/2 symbols of the text. This allows for a small amount of post-processing time once we finish reading the pattern. k (√k log k+log3 n))-time and O(k log n log n 5.1 Processing the Pattern Let us first describe the information about the pattern that we gather. We distinguish between two cases. If we discover that the pattern P has an O(k)-period p ≤ k, then we can store P using the periodic representation with respect to p. Otherwise, we proceed in a similar fashion to the work on streaming exact matching [37, 7], and we introduce a family of O(log n) prefixes P0, . . . , PL of P . We choose it so that: • P0 is the longest prefix of P with a (2k + 1)-period p ≤ k, • PL = n = PL−1 + 2k, and 9 • P1, . . . ,PL−2 are the subsequent powers of two between P0 and 1 2PL−1 (exclusive). We store the periodic representation of P0, the sketches skk(Pℓ) for 1 ≤ ℓ < L, and the trailing 2k symbols of P . Lemma 5.1. The pattern P can be processed by a deterministic streaming algorithm which uses O(k log n log n k log2 n) post-processing time. k ) bits of space, takes O(√k log k + log2 n) time per symbol, and O(k√k log k + Proof. While scanning the pattern, we store a buffer of 2k trailing symbols and we run the algorithm of Lemma 3.1 to compute the longest prefix P0 of P with a (2k + 1)-period p ≤ k. If P0 > n − 2k, we extend the periodic representation of P0 to the periodic representation of P , for which p must be a 4k-period. Otherwise, we set P1, . . . , PL as specified above. To have skk(Pℓ) available, we use Corol- lary 2.5 while scanning P and extract the sketches of every prefix of P whose length is a power of 2 larger than 3k (note that P0 ≥ 3k). We run this subroutine with a delay of 2k symbols so that skk(PL−1) can be retrieved as soon as the whole pattern P is read. 5.2 Processing the Text In the small approximate period case, we simply use Theorem 3.8 (with no delay). Otherwise, our algorithm is organised into several levels ℓ = 0, . . . , L. The task of level ℓ is to output the stream of k-mismatch information of Pℓ in T . This stream is forwarded to the next level ℓ + 1 or to the output (for ℓ = L). For ℓ < L − 1, the stream shall be generated with a delay of Pℓ+1 − Pℓ, i.e., the occurrence at position i shall be reported just before the algorithm reads T [i + Pℓ+1]. For ℓ = L − 1, the delay is specified as k, while the topmost level ℓ = L must report the k-mismatch occurrences of P with no delay. Level 0 is implemented using Theorem 3.8 with a delay of P1 − P0 = O(P0) symbols. The running time is O(√k log k + log2 n) per symbol. The implementation of level ℓ, 0 < ℓ < L is based on Corollary 2.5 and Theorem 4.8. When a k-mismatch occurrence of Pℓ−1 is reported at position j, we use Corollary 2.5 to obtain skk(T [0, . . . , j + Pℓ − 1]). We also retrieve skk(T [0, . . . , j − 1]) from the stream of k-mismatch information of Pℓ−1, which lets us derive skk(T [j, . . . , j + Pℓ − 1]) using Lemma 2.6. Then, we use Lemma 2.3 to test if T [j, . . . , j + Pℓ − 1] is a k-mismatch occurrence of Pℓ and to retrieve the mismatch information if the answer is positive. These computations take O(k log3 n) and we perform them while processing the subsequent k symbols of T . By Fact 4.1, we are guaranteed that just one k-mismatch occurrence of Pℓ−1 is processed at any given time. Thus, the stream of k-mismatch occurrences for the pattern Pℓ in the text T can be generated with delay k. For ℓ < L − 1, we apply a buffer of Theorem 4.8 to delay it further by Pℓ+1 − Pℓ − k. This comes at the extra cost of O(√k log k + log3 n) time per symbol due to Pℓ+1 − Pℓ − k = Θ(Pℓ): 4Pℓ ≥ Pℓ+1 ≥ Pℓ+1 − Pℓ − k ≥ Pℓ − k ≥ Pℓ − 1 3P0 ≥ 2 3Pℓ. Finally, the topmost level L simply maintains the trailing 2k symbols of the text. Whenever a k-mismatch occurrence of PL−1 at position i is reported (along with the mismatch information), we must check if it extends to a k-mismatch occurrence of P = PL. It arrives with delay k, so we can naively compare P [n − 2k, . . . , n − 1] with T [i + n − 2k, . . . , i + n − 1] while the algorithm processes T [i − n − k, . . . , i − 1], extending the mismatch information accordingly. Space complexity of level L is O(k log n) and the per-symbol running time is constant. k ) levels, we obtain our main result. k ) bits k (√k log k + log3 n)) time per arriving symbol. The algorithm is ran- Theorem 1.2. There exists a streaming k-mismatch algorithm which uses O(k log n log n of space and takes O(log n domised and its answers are correct with high probability, that is it errs with probability inverse polynomial in n. For each reported occurrence, the mismatch information can be reported on demand in O(k) time. Aggregating the resources required for each of the O(log n 10 6 A Conjectured Space Lower Bound We conclude this first part of the paper with a discussion of space lower bounds for the streaming k-mismatch problem. The space upper bound we give for our streaming algorithm, although close to being optimal, is still an O(log n)-factor away from the known lower bound. As a final contribution, we give a higher conjectured space lower bound for Problem 1.1, which partially closes this gap. We do this by observing that a particularly natural way to tackle the streaming problem is first to encode the k-mismatch alignments and mismatch information for all prefixes of the pattern against all suffixes of a substring of the text of the same length and then use this information to start processing new symbols as they arrive. Our streaming algorithm, for example, effectively does exactly this, as do the earlier streaming k-mismatch algorithms of [37, 17] and the exact matching streaming algorithms of [37, 7]. We show a space lower bound for Problem 1.1 for any streaming algorithm that takes this approach. We further conjecture that this lower bound is, in fact, tight in general. Conjecture 6.1. Any solution for Problem 1.1 must use at least Ω(k log n of space. k (log n k + log Σ)) bits We argue in favour of this conjecture by giving an explicit set of patterns for which encoding the mismatch information for all alignments of the pattern against itself will require the stated number of bits. If the text includes a copy of the pattern as a substring, then the result follows. It is interesting to note that a similar conjecture can be made for the space complexity of exact pattern matching in a stream. In this case, encoding the alignments of all exact matches between the prefixes and suffixes of a pattern is known to require Ω(log2 n) bits, matching the best known space upper bounds of [37, 7]. Lemma 6.2. Any solution for Problem 1.1 that computes all alignments with Hamming distance at most k between prefixes of the pattern and equal-length suffixes of the text, along with the associated mismatch information, must use at least Ω(k log n k (log n k + log Σ)) bits of space. Proof. We prove the space lower bound by showing an explicit set of patterns for which any encoding of all the k-mismatch alignments between prefixes of the pattern P and suffixes of the text T = P , along with the mismatch information, must use Ω(k log n k + log Σ)) bits. We define our string recursively. Consider a base string S0 = 0k. To create Si+1, we make three copies of Si and concatenate them to each other to make SiSiSi. We then choose ⌊ 1 2 k⌋ indices at random from the middle copy of Si and randomly change the symbols at those indices. Let S′ i be this modified middle third so that Si+1 = SiS′ k ) levels to the recursion, so in the final string we can identify Ω(log n k ) alignments at which the Hamming distance is at most k: the prefix SiS′ 2 k⌋. Mismatch information for each of these alignments contains ⌊ 1 2 k⌋ random symbols which need to be reported. This gives a lower bound of Ω(k log n k + log Σ)) bits in total needed for any encoding. 2 k⌋ randomly chosen indices and ⌊ 1 iSi are at Hamming distance 2⌊ 1 iSi. There are Θ(log n i and the suffix S′ k (log n k (log n 7 Algebraic Algorithms on Fp In this section, we recall several classic problems in computer algebra involving a prime field Fp, which arise in Section 2. The time and space complexities of their solutions depend on the relation between the field size p and the input size, as well as on the model of computation. Below, we state these complexities for the setting used throughout the paper, which is as follows: We assume the word RAM model with word size w, which supports constant-time arithmetic and bitwise operations on w-bit integers. Lemma 7.1 (Integer multiplication; Schonhage and Strassen [39, 31]). The product of two n-bit integers can be computed in O(n) time using O(n) bits of space provided that w = Ω(log n). 11 Next, we consider operations in the field Fp where p is a prime number with log p = Θ(w), and the corresponding ring of polynomials Fp[X]. We always assume that the degrees of input polynomials are bounded by n = 2O(w). Polynomial multiplication is a basic building block of almost all efficient algebraic algorithms on Fp. Our model of computation allows for the following efficient solution: Corollary 7.2 (Polynomial multiplication). Given two polynomials A, B ∈ Fp[X] of degree at most n, the product A · B can be computed in O(n log p) time using O(n log p) bits of space. Proof. Polynomial multiplication in Z[X] can be reduced to integer multiplication via the Kro- necker substitution [33]. More precisely, a polynomial P (X) = Pn i=0 piX i of degree n with 0 ≤ pi < N is represented as an integer with n + 1 blocks of 1 + 2 log N + log n bits each so the binary encoding of pi is stored in the i-th least significant block. To multiply polynomials in Fp[X], we can compute the product in Z[X] and then replace each coefficient by its remainder modulo p. In Section 2, we use efficient solutions to three classic problems listed below. The original papers refer provide the space complexity in terms of the time M (n) of polynomial multiplica- tion in Fp. The space complexity is not specified explicitly; one can retrieve it by analysing the structure of the original algorithms and their subroutines, such as multi-point evaluation, poly- nomial division, and gcd computation of polynomials. We refer to a textbook [40] for detailed descriptions of these auxiliary procedures as well as of the Cantor–Zassenhaus algorithm. Lemma 7.3 (Polynomial factorization; Cantor–Zassenhaus [12]). Given a polynomial A ∈ Fp[X] of degree n with n distinct roots, all the roots of A can be identified in O(n log3 p) time using O(n log p) bits of space. The algorithm may fail (report an error) with probability inverse polynomial in p. Proof. The Cantor–Zassenhaus algorithm proceeds in several iterations; see [40]. Each iteration involves log p multiplications and divisions of degree-O(n) polynomials, as well as several gcd computations involving polynomials of total degree O(n). The overall time of these operations is O(n log2 p + n log n log p) = O(n log2 p). Each step can be interpreted as a random partition of the set of roots of A into two subsets. The computation terminates when every two roots are separated by at least one partition. After Ω(log p) phases this condition is not satisfied with probability inverse polynomial in p. distinct values βi and coefficients αi i=1(1 − Xβi) can be computed in O(n log p) time using O(n log p) bits of space. i=0 αi · βj i ∈ Fp with 6= 0 for n < p. Given the values s0, s1, . . . , s2n, the Lemma 7.4 (BCH Decoding; Pan [35]). Consider a sequence sj = Pn−1 polynomial Qn Lemma 7.5 (Transposed Vandermonde matrix-vector multiplication; Canny–Kaltofen–Lak- shman [11]). Consider a sequence sj = Pn−1 i ∈ Fp with distinct values βi ∈ Fp and arbitrary coefficients αi ∈ Fp. Given the values α0, . . . , αn−1 and β0, . . . , βn−1, the coefficients s0, . . . , sn−1 can be computed in O(n log n log p) time using O(n log p) bits of space. Lemma 7.6 (Solving transposed Vandermonde systems; Kaltofen–Lakshman [29]). Consider a sequence sj = Pn−1 i ∈ Fp with distinct values βi ∈ Fp and arbitrary coefficients αi ∈ Fp. Given the values s0, . . . , sn−1 and β0, . . . , βn−1, the coefficients α0, . . . , αn−1 can be retrieved in O(n log n log p) time using O(n log p) bits of space. i=0 αi · βj i=0 αi · βj 8 Omitted Proofs from Section 2 Lemma 2.3. Given the sketches skk(S) and skk(T ) of two strings of the same length ℓ ≤ n, in O(k log3 n) time we can decide (with high probability) whether HD(S, T ) ≤ k. If so, the mismatch information MI(S, T ) is reported. The algorithm uses O(k log n) bits of space. 12 Proof. First, suppose that HD(S, T ) = k′ < k. Let x1, . . . , xk′ be the mismatch positions of S and T , and let ri = S[xi] − T [xi] be the corresponding numerical differences. We have: + r2 + . . . + = φ0(S) − φ0(T ) r1 r1x1 + r2x2 + . . . + rk′xk′ = φ1(S) − φ1(T ) r1x2 k′ = φ2(S) − φ2(T ) 2 + . . . + rk′x2 1 + r2x2 rk′ ... r1x2k 1 + r2x2k 2 + . . . + rk′x2k k′ = φ2k(S) − φ2k(T ) This set of equations is similar to those appearing in [15] and in the decoding procedures for Reed–Solomon codes. We use the standard Peterson–Gorenstein–Zierler procedure [36, 26], with subsequent efficiency improvements. This method consists of the following main steps: 1. Compute the error locator polynomial P (z) = Qk′ φj(S) − φj(T ) with 0 ≤ j ≤ 2k. i=1(1 − xiz) from the 2k + 1 syndromes 2. Find the error locations xi by factoring the polynomial P . 3. Retrieve the error values ri. We implement the first step in O(k log n) time using the efficient key equation solver by Pan [35]; see Lemma 7.4. The next challenge is to factorise P , taking advantage of the fact that it is a product of linear factors. As we are working over a field with large characteristic, there is no sufficiently fast deterministic algorithm for this task. Instead we use the randomised Cantor–Zassenhaus algorithm [12] (see Lemma 7.3), which takes O(k log3 n) time with high probability. If the algorithm takes longer than this time, then we stop the procedure and report a failure. Finally, we observe that the error values ri can be retrieved by solving a transposed Vandermonde linear system of k′ equations using Kaltofen–Lakshman algorithm [29] (see Lemma 7.6) in O(k log k log n) time. Each of these subroutines uses O(k log n) bits of working space. Using the fact that we now have full knowledge of the mismatch indices xi, a similar linear ... ... system lets us retrieve the values r′ i = S2[xi] − T 2[xi]: = φ′ r′ r′ r′ + . . . + k′ 2 1 k′xk′ = φ′ 2x2 + . . . + r′ 1x1 + r′ r′ k′ = φ′ k′x2 2 + . . . + r′ 2x2 1 + r′ 1x2 r′ + 1xk′ r′ 1 + r′ 2xk′ 2 + . . . + r′ k′xk′ 0(S) − φ′ 1(S) − φ′ 2(S) − φ′ 0(T ) 1(T ) 2(T ) ... k′(S) − φ′ k′(T ) k′ = φ′ i−r2 i 2ri . Now, we are able to compute S[xi] = r′ i+r2 i 2ri and T [xi] = r′ If HD(S, T ) > k, then we may still run the procedure above, but its behaviour is undefined. This issue is resolved by using the Karp–Rabin fingerprints to help us check if we have found all the mismatches or not. If the algorithm fails, we may assume that HD(S, T ) > k; otherwise, the failure probability is inverse polynomial in n. A successful execution results in the mismatch information {(xi, si, ti) : 1 ≤ i ≤ k′}. Observe that HD(S, T ) ≤ k if and only if S[xi] − T [xi] = si − ti and S[j] − T [j] = 0 at the remaining positions. In order to verify this condition, we compare the Karp–Rabin fingerprints, i.e., test whether k′ ψr(S) − ψr(T ) = Xi=1 (si − ti)rxi. This verification takes O(k′ log n) time and its error probability is at most ℓ p . Lemma 2.4. Let S, T ∈ F∗ be constructed in O(k log2 n) time and O(k log n) bits of space given MI(S, T ) and skk(S). p be of the same length ℓ < n. If HD(S, T ) = O(k), then skk(T ) can 13 Proof. Let MI(S, T ) = {(xi, si, ti) : 0 ≤ i < d}. First, observe that the Karp–Rabin fingerprint can be updated in O(d log n) time. Indeed, we have ψr(T )− ψr(S) = Pd−1 i=0 (ti − si)rxi, and each power rxi can be computed in O(log n) time. Next, we shall compute φj(T )−φj(S) = Pd−1 i=0 (ti− si)xj i for j ≤ 2k. This problem is an instance of transposed Vandermonde evaluation; see Lemma 7.5. Hence, this task can be accomplished in O((d+k) log2 n) time using O((d+k) log n) bits of space using the Canny–Kaltofen–Lakshman algorithm. The values φ′ j(S) are computed analogously. Corollary 2.5. A string X ∈ F∗ p with X ≤ n can be stored in O(k log n) bits so that skk(X) can be retrieved in O(k log2 n) time and the following updates are handled in O(log2 n) time: j(T ) − φ′ 1. append a given symbol a ∈ Fp to X, 2. substitute X[i] = a for X[i] = b given the index i and the symbols a, b ∈ Fp. Proof. First, observe that appending 0 to X does not change the sketch, so appending a symbol a is equivalent to substituting 0 at position X by a. Thus, below we focus on substitutions. We maintain the sketch skk(Y ) of a previous version Y of X and a buffer of up to k substitutions required to transform Y into X, i.e., the mismatch list MI(X, Y ). If there is room in the buffer, we simply append a new entry to MI(X, Y ) to handle a substitution. Whenever the buffer becomes full, we apply Lemma 2.4 to compute skk(X) based on skk(Y ) and MI(X, Y ). This computation takes O(k log2 n) time, so we run in it parallel to the subsequent k updates (so that the results are ready before the buffer is full again). To implement a query, we complete the ongoing computation of skk(Y ) and use Lemma 2.4 again to determine skk(X) (and clear the buffer as a side effect). This takes O(k log2 n) time. Lemma 2.6. The following operations can be implemented in O(k log n) time using O(k log n) bits of space, provided that all the processed strings belong to F∗ p and are of length at most n. 1. Construct one of the sketches skk(U ), skk(V ), or skk(U V ) given the other two. 2. Construct skk(U ) or skk(U m) given the other sketch and the integer m. Proof. 1. First, observe that ψr(U V ) = ψr(U )+rU ψr(V ). This formula can be used to retrieve one of the Karp–Rabin fingerprints given the remaining two ones. The running time O(log n) is dominated by computing rU (or r−U ). Next, we express φj(U V ) − φj(U ) in terms of φj′(V ) for j′ ≤ j: V [i](cid:18) j j′(cid:19)ij′ Uj−j′ = (cid:18) j j′(cid:19)φj′(V )Uj−j′ . j V −1 V −1 j Xi=0 Xi=0 Xj′=0 V [i](U + i)j = φj(U V ) − φj(U ) = Xj′=0 j=0 φj(S) X j Let us introduce an exponential generating function Φ(S) = P∞ j! , and recall that the j=0 rj X j exponential generating function of the geometric progression with ratio r is erX = P∞ j! . Now, the equality above can be succinctly written as Φ(U V ) − Φ(U ) = Φ(V ) · eU X. Conse- quently, given first 2k + 1 coefficients of Φ(U ), Φ(V ), or Φ(U V ), can be computed from the first 2k + 1 terms of the other two generating functions in O(k log n) time using efficient polynomial multiplication over Fp [39]; see Corollary 7.2. The coefficients φ′ j(U V ), can be computed in the same way. j(V ), and φ′ j(U ), φ′ i=0 riU ψr(U ) = rmU −1 rU −1 2. Observe that ψr(U m) = Pm−1 ψr(U ). Thus, ψr(U ) and ψr(U m) are easy to compute from each other in O(log n) time. Next, recall that the exponential generating function Φ(S) = P∞ j! satisfies Φ(U W ) = Φ(U )+eU XΦ(W ). Consequently, Φ(U m) = Φ(U ) · Pm−1 . Thus, Φ(U ) and Φ(U m) can be computed from each other in O(k log n) time using efficient polynomial multiplication over Fp; see Corollary 7.2. The first O(k) terms of the inverse of the power series (eℓX−1)/X can also be computed in O(k log n) time using polynomial multiplication and Newton's method for polynomial division. i=0 eiU X = Φ(U m) emU X −1 eU X −1 j=0 φj(S) X j 14 9 Omitted Proofs from Section 3 Lemma 3.1. There exists a deterministic streaming algorithm that, given positive integers p and d = O(p), finds the longest prefix Y of the input string X which has a d-period p′ ≤ p. It reports the periodic representation of Y with respect to p′, uses O(p) words of space, and takes O(√p log p) per-symbol processing time plus O(p√p log p) post-processing time. (the final block might be shorter), spending O(p√p log p) time on each block. p′ ≤ p, the periodic representation of Y with respect to p′, and the values Proof. The constraints on the time and space complexity let us process X in blocks of p symbols After reading each block, we compute the sought longest prefix Y of X with a d-period HD(Y [0, . . . ,Y − p′′ − 1], Y [p′′, . . . ,Y − 1]) for 0 < p′′ ≤ p. When at some iteration we discover that Y is a proper prefix of X, then Y cannot change anymore, so we can ignore any forthcoming block. Thus, below we assume that X = Y before a block B is appended to X. In this case, we need to check if B can be appended to Y as well, i.e., if Y B has any d-period p′′ ≤ p. We rely on the formula HD((Y B)[0, . . . ,Y B − p′′ − 1], (Y B)[p′′, . . . ,Y B − 1]) = = HD(Y [0, . . . ,Y B− p′′ − 1], Y [p′′, . . . ,Y − 1]) + HD((Y B)[Y − p′′, . . . ,Y B− p′′ − 1], B). The left summand is already available, while to determine the right summand for each p′′, we use Abrahamson's algorithm [4] to compute the Hamming distance of every alignment of B within the the suffix of Y B of length p + B. This procedure takes O(ppB log B) time. If we find out that Y B has a d-period p′′ ≤ p, we compute the periodic representation of Y with respect to p′′. For this, we observe that Y [i] 6= Y [i − p′′] may only hold if i < p′ + p′′, Y [i] 6= Y [i − p′], Y [i − p′] 6= Y [i − p′ − p′′], or Y [i − p′ − p′′] 6= Y [i − p′′]. Thus, it takes O(d + p) = O(p) time to transform the periodic representation of Y with respect to p′ to the one with respect to p′′. Finally, we append B to Y and update its periodic representation. Otherwise, we partition B into two halves B = BLBR and try appending the left half BL to Y using the procedure above. We recurse on BR or BL depending on whether it succeeds. The running time of the ith iteration is O(cid:0)p + pq p 2i⌉. Consequently, the overall processing time is O(p√p log p). a block of length at most ⌈ p Fact 3.2. We have (T ⊗ P )(i) = P − HamP,T [i] for P − 1 ≤ i < T and (T ⊗ P )(i) = 0 for i < 0 and i ≥ P + T. Proof. If P − 1 ≤ i < T, then: 2i(cid:1), because we attempt appending 2i log p P − HamP,T [i] = P − Xj=0 [T [i − j] 6= P [P − 1 − j]] = Xj=0 [T [i − j] = P [P − 1 − j]] = P −1 P −1 P −1 P −1 Xj=0 (Ta∗ P R Xj=0 Ta(i− j)P R Ta(i− j)Pa(P− 1− j) = Xa∈Σ = Xa∈Σ The second claim follows from the fact that Xa(i) = 0 if i < 0 or i ≥ X. Lemma 3.4. Consider functions f, g : Z → Z with at most n non-zero entries in total. The non-zero entries among any δ consecutive values (f ∗ g)(i), . . . , (f ∗ g)(i + δ− 1) can be computed in O(n√δ log δ) time using O(n + δ) words of working space. a )(i) = (T ⊗ P )(i). a (j) = Xa∈Σ 15 k in total. Proof. Let us partition Z into blocks Bk = [δk, δk + δ) for k ∈ Z. Moreover, we define B′ k = (i − (k + 1)δ, i − (k − 1)δ] and observe that (f ∗ g)(j) = Pk(fBk ∗ gB′ )(j) for i ≤ j < i + δ. We say that a block is heavy if Bk ∩ supp(f ) ≥ √δ log δ, i.e., if at most √δ log δ non-zero entries of f belong to Bk. For each heavy block Bk, we compute the convolution of fBk ∗ gB′ using the Fast Fourier Transform. This takes O(δ log δ) time per heavy block and O(n√δ log δ) The light blocks Bk are processed naively: we iterate over non-zero entries of fBk and of . Observe that each integer belongs to at most two blocks B′ gB′ k, so each non-zero entry of g is considered for at most 2√δ log δ non-zero entries of f . Hence, the running time of this phase is also O(n√δ log δ). Fact 3.5. Consider functions f, g : Z → Z with finite support and a positive integer p. We have ∆p[f ∗ g] = f ∗ ∆p[g] = ∆p[g] ∗ f . Consequently, ∆p[f ] ∗ ∆p[g] = ∆p[∆p[f ∗ g]]. Proof. Note that k k f (j) · g(i − j) = Xj∈Z f (j)g(i + p − j) −Xj∈Z f (j) · ∆p[g](i − j) = (f ∗ ∆p[g])(i). ∆p[f ∗ g](i) = Xj∈Z By symmetry, we also have ∆p[f ∗ g] = ∆p[f ]∗ g. Consequently, ∆p[f ]∗ ∆p[g] = ∆p[∆p[f ]∗ g] = ∆p[∆p[f ∗ g]]. Lemma 3.7. Let P be a pattern with a d-period p. Suppose that p is also an O(d + p)-period of the text T . There exists a deterministic streaming algorithm which processes T using O(d + p) words of space and O(p(d + p) log(d + p)) time per symbol, and reports HamT,P [i] for each position i ≥ P − 1. Proof. First, we assume that blocks of d + p symbols T [i, . . . , i + d + p − 1] can be processed simultaneously. We maintain the periodic representation of both P and T with respect to p. Moreover, we store the values (T ⊗ P )(j) for i − 2p ≤ j < i (initialised as zeroes for i = 0; this is valid due to Fact 3.2). The space consumption is O(d + p). When the block arrives, we update the periodic representation of T and apply Corollary 3.6 to compute ∆2 p[T ⊗ P ](j) for i ≤ j < i + d + p. Based on the stored values of T ⊗ P , this lets us retrieve (T ⊗ P )(j) for i ≤ j < i + d + p. Next, for each position j > P − 1, we report HamT,P [j] = P − (T ⊗ P )(j). Finally, we discard the values (T ⊗ P )(j) for j < i + d− p. Such an iteration takes O((d + p)p(d + p) log(d + p)) time and O(d + p) working space. Below, we apply this procedure in a streaming algorithm which processes T symbol by symbol. The first step is to observe that if the pattern length is O(d + p), we can compute the Hamming distance online using O(d + p) words of space and O(p(d + p) log(d + p)) worst-case time per arriving symbol [14]. We now proceed under the assumption that P > 2(d + p). We partition the pattern into two parts: the tail, PT - the suffix of P of length 2(d + p), and the head, PH - the prefix of P length P − 2(d + p). One can observe that HamP,T [j] = HamPT ,T [j]+HamPH ,T [j−2(d+p)]. Moreover, we can compute HamPT ,T [j] using the aforemen- tioned online algorithm of [14]; this takes O(p(d + p) log(d + p)) time per symbol and O(d + p) words of space. For the second summand, we need to ensure that we will have computed HamPH ,T [j−2(d+p)] before T [j] arrives. Hence, we partition the text into blocks of length d + p and use our algorithm to process a block T [i, . . . , i + d + p − 1] as soon as it is ready. This procedure takes O((d + p)p(d + p) log(d + p)) time, so it is can be performed in the background while we read the next block T [i + d + p, . . . , i + 2(d + p) − 1]. Thus, HamPH ,T [j] is indeed ready on time for j ∈ {i, . . . , i + d + p − 1}. The overall space usage is O(d + p) words and the worst-case time per arriving symbol is O(p(d + p) log(d + p)), dominated by the online procedure of [14] and by processing blocks in the background. 16 Theorem 3.8. Suppose that we are given an integer k and the periodic representation of a pattern P with respect to a d-period p such that d = O(k) and p = O(k). There exists a deterministic streaming algorithm, which uses O(k) words of space and O(√k log k + log2 n) time per symbol to report the k-mismatch occurrences of P in the streamed text T . For each reported occurrence, the mismatch information and sketch of the prefix of T up to the reported occurrence can be computed on demand in O(k) and O(k log2 n) time, respectively. The algorithm may also be configured to report the output with any prescribed delay ∆ = O(P). Proof. Our strategy is to partition T into overlapping blocks for which p is an O(k)-period, making sure that any k-mismatch occurrence of P is fully contained within a block. Then, we shall run Lemma 3.7 for each block to find these occurrences. Let us first build the partition into blocks. We shall make sure that every position of T belongs to exactly two blocks and that p is an (4k + 2d + p)-period of each block. While processing T , we maintain two current blocks B, B′ (assume B ≥ B′) along with their periodic representations. Let us denote the number of mismatches (with respect to the approximate period p) in B and B′ by m and m′, respectively. These values shall always satisfy m′ ≤ d + 2k and m ≤ m′ +min(B′, p)+d+2k, which clearly guarantees the claimed bound m ≤ 4k +2d+p. Moreover, we shall make sure that d+2k < m unless B is a prefix of T . This way, if a k-mismatch occurrence of P ends at the currently processed position, then it must be fully contained in B, because HD(P, Q) ≤ k implies that p is a (d + 2k)-period of Q. We start with B = B′ = ε before reading T [0]. Next, suppose that we read a symbol T [i]. If m′ < d + 2k or T [i] = T [i − p], we simply extend B and B′ with T [i]. In this case, m′ might increase but it will not exceed d + 2k, whereas m increases only if m′ + min(B′, p) increases, so the inequality m ≤ m′ +min(B′, p)+d+2k remains satisfied. On the other hand, if m′ = d+2k and T [i] 6= T [i − p], then we set B := B′T [i] and B′ := T [i]. In this case, m = d + 2k + 1 and m′ = 0, which satisfies the invariants as one can easily verify. The procedure described above outputs the blocks as streams, which we pass to Lemma 3.7 with a delay ∆. In order to save some space, when the construction of a block terminates and the block turns out to be shorter than P, we immediately launch a garbage collector to get rid of this block. The number of remaining blocks contained in T [i− ∆ + 1, . . . , i] is therefore bounded by 2⌊ ∆ P ⌋, because each such block is of length at least P and each position is located within at most two such blocks. Accounting for the two blocks currently in construction and the two blocks currently processed by Lemma 3.7, this implies that at any time we store O(1 + ∆ P ) = O(1) blocks in total, which means that the overall space consumption is bounded by O(k) words. The instances of Lemma 3.7 report k-mismatch occurrences of P with no delay, so the overall delay of the algorithm is precisely ∆. Requests for mismatch information are handled in O(k) time using the periodic representations of the pattern P and the currently processed block. To allow for computing sketches, we also maintain an instance of Corollary 2.5 and for every block we T [b, . . . , e], we store the sketch skk(T [0, . . . , b − 1]). As we stream the block to Lemma 3.7, we process it using another instance of Corollary 2.5, with an extra delay P (compared to Lemma 3.7). This way, whenever Lemma 3.7 reports a k-mismatch occurrence T [j, . . . , j + P − 1], the sketch T [0, . . . , j − 1] can be retrieved (on demand) in O(k log2 n) time (by combining skk(T [0, . . . , b − 1]) and skk(T [b, . . . , j − 1]) with Lemma 2.6). The use of Corollary 2.5 increases the processing time of each position by an additive O(log2 n) term. 10 Proof of Lemma 4.3 In this section, we prove Lemma 4.3; its statement is repeated below for completeness. Lemma 4.3. For a string X and an integer k, let P ⊆ Per≤n/4(X, k) and d = gcd(P). There is a data structure of size O(k(log n k +log Σ)) bits which given an index i retrieves X[i] in O(log n) time if Cd(X, i) is non-uniform, and returns a sentinel symbol # if the class is uniform. The 17 data structure can be initialised in O(1) time with P = ∅, and updated in O(k log n) time subject to adding a k-period p ∈ Per≤n/4(X, k) to P given MI(X[0, . . . , n − p − 1], X[p, . . . , n − 1]). We define kCp(i)k as the number of distinct elements in Cp(i); note that a class is uniform if kCp(i)k = 1. The majority element of a multiset S is an element with multiplicity strictly greater than 1 2S. We define uniform strings and majority symbols of a string in an analogous way. The remaining part of this section constitutes a proof of Lemma 4.3. We start with Sec- tion 10.1, where we introduce the main ideas, which rely on the structure of classes and their majorities. The subsequent Section 10.2 provides further combinatorial insight necessary to bound the size of our encoding. Section 10.3 presents two abstract building blocks based on well-known compact data structures. Next, in Section 10.4 we give a complete description of our encoding, in Section 10.5 we address answering queries, and in Section 10.6 we discuss updates. 10.1 Overview Observe that if d = gcd(P) does not change as we insert an approximate period p to P, then we do not need to update the data structure. Hence, let us introduce a sequence d0, . . . , ds of distinct values gcd(P) arising as we inserted subsequent approximate periods to P. Moreover, for 1 ≤ i ≤ s, let pi ∈ P be the period which caused the transition from di−1 to di. Fact 10.1. The sequences d0, . . . , ds and p1, . . . , ps satisfy d0 = 0, dℓ = gcd(dℓ−1, pℓ) for 1 ≤ ℓ ≤ s, and ds = gcd(P). Moreover, dℓ dℓ−1 and dℓ ≤ n 2ℓ+1 for 1 ≤ ℓ ≤ s, and therefore s = O(log n). Proof. We start with P = ∅, so d0 = gcd∅ = 0. If gcd(P) p for a newly inserted element p, we do not update the sequence. Otherwise, we append pℓ := p and dℓ := gcd(dℓ−1, pℓ). Note that dℓ is a proper divisor of dℓ−1, so dℓ ≤ 1 2 dℓ−1 which yields dℓ ≤ d1 2ℓ−1 ≤ n 2ℓ+1 by induction. Let Cℓ be the partition of the symbols of X into classes Cdℓ(i) modulo dℓ. Fact 10.1 lets us characterise the sequence C0, . . . , Cs: the first partition, C0, consists of singletons, i.e., it is the finest possible partition. Then, each partition is coarser than the previous one, and finally Cs is the partition into classes modulo ds. Consequently, the classes modulo Cdℓ(i) for 0 ≤ ℓ ≤ s form a laminar family, which can be represented as a forest of depth s + 1 = O(log n); its leaves are single symbols (classes modulo d0 = 0), while the roots are classes modulo ds. Let us imagine that each class stores its majority element (or a sentinel # if there is no majority). Observe that if all the classes Cdℓ−1(i′) contained in a given class Cdℓ (i) share a common majority element, then this value is also the majority of Cdℓ (i). Consequently, storing the majority elements of all the contained classes Cdℓ−1(i′) is redundant. Now, in order to retrieve X[i], it suffices to start at the leaf Cd0(i), walk up the tree until we reach a class storing its majority, and return the majority, which is guaranteed to be equal to X[i]. This is basically the strategy of our query algorithm. A minor difference is that we do not store the majority element of uniform classes Cds(i), because our procedure shall return a sentinel # when Cds(i) is uniform. On the other hand, we explicitly store the non-uniform classes Cds(i) so that updates can be implemented efficiently. In order to encode the majority symbols of classes Cdℓ−1(i′) contained in a given class Cdℓ(i), let us study the structure of these classes in more detail. Observation 10.2. Each class modulo dℓ can be decomposed as follows into non-empty classes 18 modulo dℓ−1; dℓ−1 dℓ [j=0 Cdℓ (i) = Cdℓ−1(i + jpℓ) Cdℓ (i) = ⌈ n−i dℓ ⌉ [j=0 Cdℓ−1(i + jpℓ) if ℓ > 1 if ℓ = 1 Motivated by this decomposition, for each class Cdℓ(i) with ℓ ≥ 1 and 0 ≤ i < dℓ, we define the majority string Mℓ,i of length Mℓ,i = dℓ−1 dℓ ⌉ for ℓ = 1. Its j-th symbol Mℓ,i[j] is defined as the majority of Cdℓ−1(i + jpℓ), or # if the class has no majority. We think of Mℓ,i as a cyclic string for ℓ > 1 and a linear string for ℓ = 1. Since pℓ ∈ Per(X, k), we expect that the adjacent symbols of the majority strings Mℓ,i are almost always equal. In the next section, we shall prove that the total number of mismatches between adjacent symbols is O(k) across all the majority strings. for ℓ > 1 and Mℓ,i = ⌈ n−i dℓ 10.2 Combinatorial Bounds For 1 ≤ ℓ ≤ s, let Nℓ ⊆ Cℓ consist of non-uniform classes. Moreover, for 0 ≤ ℓ < s, let Kℓ ⊆ Cℓ consist of classes Cdℓ(i) such that the majority elements of Cdℓ(i) and Cdℓ (i + pℓ+1) differ. Fact 10.3. Consider the decomposition of a class Cdℓ(i) ∈ Nℓ into classes C ∈ Cℓ−1. At least one of these classes satisfies C ∈ Nℓ−1 ∪ Kℓ−1. Moreover, if there is just one such class, then ℓ = 1 or this class C satisfies C ∈ Nℓ−1 \ Kℓ−1. Proof. If the majority string Mℓ,i is uniform, then one of the classes C must contain a symbol other than its majority; otherwise, Cdℓ(i) would be uniform. Such a class C clearly belongs to Nℓ−1 \ Kℓ−1. Next, suppose that the majority string Mℓ,i is non-uniform. Each mismatch between con- secutive symbols of Mℓ,i corresponds to a class C ∈ Kℓ−1. If ℓ = 1, then M1,i is a linear string and it may have one mismatch. Otherwise, Mℓ,i is circular, so there are at least two mismatches between consecutive symbols. Fact 10.4. If Cdℓ (i) ∈ Kℓ \ Nℓ for some 0 ≤ ℓ < s, then there are at least 2ℓ−1 positions i′ ≡ i (mod dℓ) such that 0 ≤ i′ < n − pℓ+1 and X[i′] 6= X[i′ + pℓ+1]. Proof. If ℓ = 0, then we just have C0(i) ∈ K0 if and only if 0 ≤ i < n− p1 and X[i] 6= X[i + p1]. Consider an alignment between X[0, . . . , n−pℓ+1−1] and X[pℓ+1, . . . , n−1] and let kℓ,i be the number of positions i′ specified above. Observe that exactly ⌊ i+pℓ+1 ⌋ symbols in Cdℓ(i+pℓ+1) are at indices smaller than pℓ+1 (and they are not aligned with any symbol of Cdℓ(i)), while exactly kℓ,i symbols are aligned with mismatching symbols. The remaining symbols of Cdℓ (i + pℓ+1) are aligned with matching symbols of Cdℓ(i). The class Cdℓ(i) is uniform, so at most kℓ,i + ⌊ i+pℓ+1 ⌋ symbols of Cdℓ (i + pℓ+1) are not equal to the majority of Cdℓ(i). Since Cdℓ(i + pℓ+1) does not share the majority with Cdℓ (i), we must have kℓ,i + ⌊ i+pℓ+1 ⌋ + 2⌈ n−i−pℓ+1 4 and dℓ ≤ n dℓ k ≥ n−2(i+pℓ+1) kℓ,i ≥ 1 In short, kℓ,i > 2ℓ−1 − 1, and thus kℓ,i ≥ 2ℓ−1. Lemma 10.5. We have 2Ns + Ps−1 contain in total at most 8k mismatches between adjacent symbols and PC∈Nds kCk ≤ 16k. ℓ=0 Kℓ ≤ 8k. Consequently, the majority strings Mℓ,i ⌉. Due to pℓ+1 ≤ n 2 j i+pℓ+1 2ℓ+1 (by Fact 10.1), this yields ⌋ ≥ 1 2Cdℓ (i + pℓ+1) = 1 4dℓ − 1 ≥ 2ℓ−1 − 1. = 2n−4i−4pℓ+1 2 l n−i−pℓ+1 dℓ m − 1 2⌊ i+pℓ+1 dℓ > 2n−4dℓ−n = n 4dℓ 1 dℓ 2dℓ 4dℓ dℓ dℓ dℓ 19 ℓ=1 k · 23−ℓ < 8k. Proof. We apply a discharging argument. In the charging phase, each mismatch X[i] 6= X[i+pℓ] (for 1 ≤ ℓ ≤ s and 0 ≤ i < n − pℓ) receives a charge of 23−ℓ units. The total charge is therefore at most Ps Next, each such mismatch passes its charge to the class Cdℓ (i). By Fact 10.4, each class Cdℓ(i) ∈ Kℓ \ Nℓ receives at least 2 units of charge. Moreover, each class Cd0(i) ∈ K0 \ N0 receives exactly 4 units. Finally, in subsequent iterations for ℓ = 0 to s − 1, the classes modulo dℓ pass some charge to the enclosing classes modulo dℓ+1: each Cdℓ (i) /∈ Kℓ passes all its charge to Cdℓ+1(i), whereas each Cdℓ(i) ∈ Kℓ leaves one unit for itself and passes the remaining charge. We shall inductively prove that prior to the iteration ℓ, each class Cdℓ(i) ∈ Nℓ had at least two units of charge. Let us fix such a class. If ℓ = 1, then Fact 10.3 implies that it contains a class C ∈ K0 (as N0 = ∅). As we have observed, it obtained 4 units of charge and passed 3 of them to Cdℓ(i). Similarly, if Cdℓ(i) contains a class C ∈ Nℓ−1 \ Kℓ−1, then this class obtained at least 2 units of charge (by the inductive assumption), and passed them all to Cdℓ(i). Otherwise, Fact 10.3 tells us that Cdℓ(i) contains at least two classes C ∈ Nℓ−1 ∪ Kℓ−1. Each of them received at least 2 units of charge (directly from the mismatches or due to the inductive assumption) and passed at least 1 unit to Cdℓ (i). has at least 2 units. This completes the proof of the inequality. In the end, each class C ∈ Kℓ has therefore at least one unit of charge and each class C ∈ Ns For the remaining two claims, observe that mismatches in the majority strings correspond to classes C ∈ Kℓ, and that if a ∈ C for C ∈ Ns, then there exists Cdℓ(i) ⊆ C such that the majority string Mℓ,i is non-uniform and contains a. Consequently, kCk is bounded by twice the number of mismatches in the corresponding majority strings. The classes modulo ds are disjoint, so no mismatch is counted twice. 10.3 Algorithmic Tools A maximal uniform fragment of a string S is called a run; we denote the number of runs by rle(S). Fact 10.6 (Run-length encoding). A string S of length n with r = rle(S) can be encoded using O(r(log n+r r + log Σ)) bits so that any given symbol S[i] can be retrieved in O(log r) time. This representation can be constructed in O(r log n) time from the run-length encoding of S. Proof. Let 0 = x1 < . . . < xr < n be starting position of each run. We store the sequence x1, . . . , xr using the Elias–Fano representation [21, 24] (with O(1)-time data structure for selec- tion queries in a bitmask; see e.g. [13]). It takes O(r log n+r r +r) bits and allows O(1)-time access. In particular, in O(log r) time we can binary search for the run containing a given position i. The values X[x1], . . . , X[xr] are stored using O(r log Σ) bits with O(1)-time access. Fact 10.7 (Membership queries, [10]). A set A ⊆ {0, . . . , n − 1} of size at most m can be encoded in O(m log n+m m ) bits so that one can check in O(1) time whether i ∈ A for a given i ∈ {0, . . . , n − 1}. The construction time is O(m log n). 10.4 Data Structure Following the intuitive description in Section 10.1, we shall store all the non-uniform majority strings Mℓ,i (for 1 ≤ ℓ ≤ s and 0 ≤ i < dℓ) and all non-uniform classes Cds(i). We represent them as non-overlapping factors of a single string M of length 2n, constructed as follows: Initially, M consists of blank symbols ⋄. Each non-uniform majority string Mℓ,i is placed in M at position 2dℓ + i dℓ−1 dℓ⌉ for ℓ = 1. Note that the positions occupied by strings dℓ Mℓ,i for a fixed level ℓ belong to the range [2dℓ, 2dℓ + dℓ−1 − 1] ⊆ [2dℓ, 2dℓ−1 − 1] for ℓ > 1 and [2d1, . . . , 2d1 + d1⌈ n dℓ⌉− 1] ⊆ [2d1, 3d1 + n− 1] ⊆ [2d1, 2n− 1] for ℓ = 1. These ranges are clearly for ℓ > 1 and 2dℓ + i⌈ n 20 disjoint for distinct values ℓ, so the majority strings Mℓ,i indeed do not overlap. Additionally, we exploit the fact that positions within [0, . . . , ds − 1] are free, and if Cds(i) ∈ Ns, we store its majority symbol at M[i]. Lemma 10.5 yields that the total number of mismatches between subsequent symbols and the number of non-uniform classes modulo ds are both O(k). Hence, rle(M) = O(k) and the space required to store M using Fact 10.6 is O(k(log n+k k + log Σ)) bits. On top of that, we also store a data structure of Fact 10.7 marking the positions in M where non-uniform majority strings start; this component takes O(k log n+k k ) bits. Additionally, we keep the contents of each non-uniform class modulo ds. We do not need to access this data efficiently, so for each such class, we simply store the symbols and their multi- )) bits for each plicities using variable-length encoding. This takes O(kCk(log Σ + log C+kCk C ∈ Ns, which is O(k(log n k + log Σ)) in total because PC∈Ns kCk = O(k) (by Lemma 10.5) and PC∈Ns C ≤ n. for 1 ≤ ℓ < s. A naive estimation of the required space is O(s log n) = O(log2 n) bits, but variable-length ) = O(log n) = O(k log n+k encoding lets us store the values k ) bits in total. Similarly, the integers rℓ can be stored in O(log n) bits because 1 ≤ rℓ < dℓ . Finally, we store integers n, d1, ds, as well as dℓ dℓ+1 using O(Ps and rℓ := ( pℓ+1 dℓ+1 )−1 mod dℓ dℓ+1 This completes the description of our data structure; its takes O(k(log n+k k + log Σ)) bits. dℓ+1 kCk dℓ dℓ+1 ℓ=1 log dℓ dℓ+1 10.5 Queries In this section, we describe the query algorithm for a given index i. We are going to iterate for ℓ = 0 to s, and for each ℓ we will either learn X[i] or find out that X[i] is the majority symbol of Cdℓ (i). Consequently, entering iteration ℓ, we already know that X[i] is the majority of Cdℓ−1(i). We also assume that dℓ is available at that time. We compute the starting position of Mℓ,i mod dℓ in M according to the formulae given in Section 10.4. Next, we query the data structure of Fact 10.7 to find out if the majority string is uniform. If so, we conclude that X[i] is the majority of Cdℓ(i) and we may proceed to the next level. Before this, we need to compute dℓ+1 = dℓ · ( dℓ )−1. An iteration takes O(1) time in this case. Otherwise, we need to learn the majority of Cdℓ−1(i), which is guaranteed to be equal to X[i]. This value is Mℓ,i mod dℓ[j] where j = ⌊ i for ℓ > 1. We know the starting position of Mℓ,i mod dℓ in M, so we just use Fact 10.6 to retrieve X[i] in O(log k) time. If the query algorithm completes all the s iterations without exiting, then X[i] is guaranteed to be the majority symbol of Cds(i). Thus, we retrieve M[i mod ds], which takes O(log k) time due to Fact 10.6. This symbol is either the majority of Cds(i) (guaranteed to be equal to X[i]) or a blank symbol. In the latter case, we know that the class Cds(i) is uniform, so we return a sentinel #. The overall running time is O(s + log k) = O(log n). d1⌋ for ℓ = 1, and j = rℓ⌊ i dℓ⌋ mod dℓ−1 dℓ+1 dℓ 10.6 Updates If ds p, then the we do not need to update. Otherwise, we extend our data structure with ps+1 := p and ds+1 := gcd(ps+1, ds). First, we shall detect non-uniform classes modulo ds+1. Facts 10.3 and 10.4 imply that a class Cds+1(i) is non-uniform if and only if for some i′ ≡ i (mod ds+1) there is a class Cds(i′) ∈ Ns or a position 0 ≤ i′ < n − ps+1 with X[i′] 6= X[i′ + ps+1]. Hence, we scan the non-uniform classes modulo ds and the mismatch information for ps+1 grouping the entries by i′ mod ds+1. For each Cds+1(i) ∈ Ns+1 our goal is to construct the underlying multiset and the corre- sponding majority string Ms+1,i. For every enclosed C ∈ Ns, we use the underlying multiset to deduce the majority symbol and store it at an appropriate position of Ms+1,i. Next, for every mismatch X[i′] 6= X[i′ + ps+1] we store X[i′] in Ms+1,i as the majority symbol of Cds(i′) if the 21 class is uniform. Symmetrically, if Cds(i′ + ps+1) is uniform, its majority symbol X[i′ + ps+1] is placed in Ms+1,i. Now, the remaining symbols of Ms+1,i are guaranteed to be equal to their both neighbours. This lets us retrieve the run-length encoding of Ms+1,i. To compute the multiset of Cds+1(i), we aggregate the data from the enclosed non-uniform classes, and use the majority string to retrieve for each symbol a the total size of enclosed classes uniform in a. Finally, we note that the data structures of Facts 10.6 and 10.7 can be reconstructed in O(k log n) time (which is sufficient to build them from scratch). 11 Omitted Proofs from Section 4.1 Fact 4.5. Bob can retrieve P# and T ′ Proof. First, note that Cd(P, i) ∪ Cd(T ′, i) is uniform if and only if Cd(P, i) is uniform and the mismatch information for neither stored k-mismatch occurrence contains (i′, P [i′], T [i′′]) with i′ ≡ i (mod d). Hence, Bob can easily decide which positions of P# and T ′ # contains sentinel symbols. # from Alice's message. Next, we shall prove that Bob can retrieve P#[i] = P [i] if Cd(P, i)∪Cd(T ′, i) is non-uniform. If Cd(P, i) is non-uniform, we can simply use the data structure of Lemma 4.3. Otherwise, mismatch information for the k-mismatch occurrence of P as a prefix or as a suffix of T ′ contains (i′, P [i′], T [i′′]) for some i′ ≡ i (mod d). The class Cd(P, i) is uniform, so Bob learns P [i] = P [i′]. If i < n, then Bob can use P [i] and the mis- match information of the k-mismatch occurrence of P as a prefix of T ′, which might contain (i, P [i], T ′[i]). On the other hand, for i′ ≥ n he can use P [i−ℓ′ +ℓ] and the mismatch information of the k-mismatch occurrence of P as a suffix of T ′. Finally, consider retrieving T ′ #[i] = T ′[i]. Fact 4.4. The pattern P has a k-mismatch occurrence at position j of T if and only if P# has a k-mismatch occurrence at position j − ℓ of T ′ #. Moreover, in that case we have MI(P, T [j, . . . , j + n − 1]) = MI(P#, T ′ #[j − ℓ, . . . , j − ℓ + n − 1]). Proof. Suppose that P has a k-mismatch occurrence at position j of T . By definition of P, we conclude that ℓ ≤ j ≤ ℓ′ and j ≡ ℓ (mod d). Consequently, P has a k-mismatch occurrence at position j′ := j − ℓ of T ′ satisfying d j′. If P [i] 6= T ′[j′ + i], then the class Cd(P, i) ∪ #[j′ + i]. Cd(T ′, i) contains at least two distinct elements, so P#[i] = P [i] 6= T ′[j′ + i] = T ′ #[j + i], with both symbols equal to #i mod d or P [i] = T ′[i + j]. Thus, Otherwise, P#[i] = T ′ MI(P, T [j, . . . , j + n − 1]) = MI(P#, T ′ #[j − ℓ, . . . , j − ℓ + n − 1]) and, in particular, P# has a k-mismatch occurrence at position j′ of T ′ #, with #[j′ + i] = T ′[j′ + i], or j′ = j − ℓ. #[j′ + i] = #i mod p. In the latter case, we conclude that d j′ and Cd(P, i) ∪ Cd(T ′, i) P#[i] = T ′ is uniform, so P [i] = T ′[j′ + i]. Hence, P indeed has a k-mismatch occurrence at position j′ of T ′, i.e., at position j of T . For the converse proof, suppose P# has a k-mismatch occurrence at position j′ of T ′ #[j′ + i], then either P [i] = P#[i] = T ′ #. If P#[i] = T ′ 12 Omitted Proofs from Section 4.2 In order to prove Theorem 4.8, we first give a new efficient algorithm for the streaming k- mismatch problem, assuming we can maintain a read-only copy of the latest n symbols in the text. The algorithm we give matches the running time of the classic offline algorithm of [5] despite having guaranteed worst-case performance per arriving symbol and using small additional space on top of that, needed to store the last n symbols of the text. 22 Theorem 4.7. In the read-only random-access model, the streaming k-mismatch problem can be solved on-line with a Monte-Carlo algorithm using O(k log n) bits of working space and O(√k log k+log3 n) time per symbol, including O(1) symbol reads. For any reported k-mismatch occurrence, the mismatch information can be retrieved on demand in O(k) time. Proof. First, we briefly sketch our strategy. If the pattern has an O(k)-period O(k), then it suffices to apply Lemma 3.1 and Theorem 3.8. Otherwise, we can still use these results to filter the set of positions where a P has k-mismatch occurrence in T , leaving at most one candidate for each k subsequent positions. We use sketches to verify candidates, with the tail trick (see Lemma 3.7) employed to avoid reporting occurrences with a delay. working space. More formally, while processing the pattern, we also construct a decomposition P = PHPT into the head PH and the tail PT with PT = 2k, and we compute the sketch skk(PH ) (using Corollary 2.5). We also use Lemma 3.1 with p = k and d = 2k + 1, which results in a prefix Q of P . This way, P is processed in O(√k log k + log2 n) time per symbol using O(k log n) bits of If Q > PH, then P has a 4k-period p′ ≤ k, and we may just use Theorem 3.8 to report the k-mismatch occurrences of P in T . Otherwise, Q has a (2k + 1)-period p′ ≤ k, but no 2k-period p′′ ≤ k. In particular, due to Fact 4.1, the k-mismatch occurrences of Q are located more than k positions apart. Processing the text T , we apply Corollary 2.5 so that skk(T [0, . . . , i]) and skk(T [0, . . . , i − PH]) can be efficiently retrieved while T [i] is revealed. Additionally, we run the streaming algorithm of Theorem 3.8, delayed so that a k-mismatch occurrence of Q starting at position i − PH + 1 is reported while T [i] is revealed. These components take O(k log n) bits of space and use O(√k log k + log n) time per symbol of T . If Theorem 3.8 reports a k-mismatch occurrence of Q at positions i − PH + 1, we shall check if PH also has a k-mismatch occurrence there. For this, we retrieve skk(T [0, . . . , i]) and skk(T [0, . . . , i − PH]) (using Corollary 2.5), compute skk(T [i − PH + 1, . . . , i]) (using Lemma 2.6), and compare it to skk(PH ) (using Lemma 2.3). This process O(k log3 n) time in If PH has a k- total, and it can be run while the subsequent k symbols of T are revealed. mismatch occurrence at position i− PH + 1, it results in MI(PH , T [i− PH + 1, . . . , i]). Then, we naively compute MI(PT , T [i + 1, . . . , i + 2k]). Thus, as soon as T [i + 2k] is revealed, we know if HD(P, T [i−PH + 1, . . . , i + 2k]) ≤ k, and we can retrieve the mismatch information in O(k) time upon request. Since Q does not have any 2k-period p′′ ≤ k, we are guaranteed that at most two k-mismatch occurrences of Q are processed in parallel. We are now able to prove Theorem 4.8. Theorem 4.8. The stream of k-mismatch information of P in T can delayed by any ∆ = Θ(P) using a buffer of O(k log n) bits, which takes O(√k log k + log3 n) time per tick, with O(k log2 n) extra time for ticks when it is fed with a k-mismatch occurrence of P or it reports one. The initialisation, given skk(P ) and ∆, takes O(k) time. Proof. We partition T into consecutive blocks of length b = 1 4 min(∆,P). The buffer shall be implemented as an assembly line of components, each responsible for k-mismatch occurrences of P starting within a single block, called the relevant occurrences in what follows. The choice of b guarantees that storing O(1) components suffices at any time. Moreover, the component needs to output the k-mismatch occurrences Θ(P) ticks after it is fed with the last relevant k-mismatch occurrence, which leaves plenty of time for reorganisation. Consequently, its lifetime shall consist of three phases: • compression, when it is fed with relevant k-mismatch occurrences of P in T , • reorganisation, when it performs some computations to change its structure, 23 • decompression, when it retrieves the stream of k-mismatch information of P in T . In the compression phase, we essentially construct the message as described in the proof of Theorem 1.4, encoding the relevant occurrences of P , i.e., the k-mismatch occurrences of P in the appropriate fragment of T . The only difference is that we also store the sketches skk(T [0, . . . , ℓ − 1]) and skk(T [0, . . . , ℓ′ − 1]) corresponding to the leftmost and the rightmost relevant occurrence. Processing a single relevant occurrence is easily implementable in O(k log n) time, dominated by updating the data structure of Lemma 4.3, which may need to account for a new element of P. Apart from that, we only need to replace the rightmost relevant occurrence and the associated information. In the decompression scheme, we apply Theorem 4.7 to find k-mismatch occurrences of P# in T ′ #, as defined in the proof of Theorem 1.4. To provide random access to these strings, we just need the data structure of Lemma 4.3 and the mismatch information for the two extremal relevant occurrences of P . To allow for O(log n)-time access, we organise the mismatch informa- tion in two dictionaries: for each mismatch (i, P [i], T [i′]), we store T [i′] in a dictionary indexed by i′, and P [i] in a dictionary indexed by i mod d. These dictionaries can be constructed in O(k) time (during the reorganisation phase). As a result, we can use Theorem 4.7 to report the occurrences of P in T in the claimed running time, along with the mismatch information. The reorganisation phase is also used to process the first n symbols of T ′ #. Retrieving the corresponding sketches T [0, . . . , i − 1] is more involved, and here is where the reorganisation phase becomes useful again. Based on the sketches skk(T [0, . . . , ℓ − 1]) and skk(T [0, . . . , ℓ′ − 1]), we can compute skk(T [ℓ, . . . , ℓ′ − 1]) = skk(T ′[0, . . . , ℓ′ − ℓ − 1]) applying Lemma 2.6. Consider the point-wise difference D of strings T ′ and T ′ #. Observe that Corol- lary 2.5 lets us transform skk(T ′[0, . . . , ℓ′ − ℓ − 1]) into skk(D[0, . . . , ℓ′ − ℓ − 1]) using random access to T ′ # for listing mismatches. Next, we observe that D is an integer power of a string of length d, so Lemma 2.6 can be used to retrieve the sketch skk(D[0, . . . , d − 1]) of its root. During the decompression phase, we maintain the data structure of Corollary 2.5 transform- ing skk(D[0, . . . , ℓ′ − ℓ− 1]) back to skk(T ′[0, . . . , ℓ′ − ℓ− 1]). When a k-mismatch occurrence of P# is reported at position i of T ′ #, we report a k-mismatch occurrence of P at position ℓ + i. At the same time, we compute skk(D[i, . . . , ℓ′ − ℓ − 1]) (using Lemma 2.6; we are guaranteed that d i) and retrieve skk(T ′[0, . . . , i − 1]D[i, . . . , ℓ′ − ℓ − 1]) (from Corollary 2.5). Finally, we construct skk(T [ℓ, . . . , ℓ + i − 1]) and skk(T [0, . . . , ℓ + i − 1]) using Lemma 2.6. In the compression phase, we need to update anything only when the component is fed with a relevant k-mismatch occurrence, and processing such an occurrence takes O(k log n) time. The reorganisation time is O(n(√k log k + log3 n)), which is O(√k log k + log3 n) time per tick. In the decompression phase, the running time is O(√k log k + log3 n) per tick (due to Theorem 4.7 and Corollary 2.5) plus O(k log2 n) time whenever a k-mismatch occurrence of P is reported. References [1] Amir Abboud, Arturs Backurs, and Virginia Vassilevska Williams. Tight hardness results for LCS and other sequence similarity measures. In Venkatesan Guruswami, editor, 56th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2015, pages 59–78. IEEE Computer Society, 2015. doi:10.1109/FOCS.2015.14. [2] Amir Abboud and Virginia Vassilevska Williams. Popular conjectures imply strong lower bounds for dynamic problems. In 55th IEEE Annual Symposium on Founda- tions of Computer Science, FOCS 2014, pages 434–443. IEEE Computer Society, 2014. doi:10.1109/FOCS.2014.53. 24 [3] Amir Abboud, Virginia Vassilevska Williams, and Oren Weimann. Consequences of faster alignment of sequences. In Javier Esparza, Pierre Fraigniaud, Thore Husfeldt, and Elias Koutsoupias, editors, Automata, Languages, and Programming, ICALP 2014, volume 8572 of LNCS, pages 39–51. Springer, 2014. doi:10.1007/978-3-662-43948-7_4. [4] Karl R. Abrahamson. Generalized string matching. SIAM Journal on Computing, 16(6):1039–1051, 1987. doi:10.1137/0216067. [5] Amihood Amir, Moshe Lewenstein, string matching with k mismatches. doi:10.1016/S0196-6774(03)00097-X. for and Ely Porat. Journal of Algorithms, 50(2):257–275, 2004. algorithms Faster [6] Arturs Backurs and Piotr Indyk. Edit distance cannot be computed in strongly sub- quadratic time (unless SETH is false). In Rocco A. Servedio and Ronitt Rubinfeld, editors, 47th Annual ACM on Symposium on Theory of Computing, STOC 2015, pages 51–58. ACM, 2015. doi:10.1145/2746539.2746612. [7] Dany Breslauer and Zvi Galil. Real-time streaming string-matching. ACM Transactions on Algorithms, 10(4):22:1–22:12, 2014. doi:10.1145/2635814. [8] Karl Bringmann. Why walking the dog takes time: Frechet distance has no strongly subquadratic algorithms unless SETH fails. In 55th IEEE Annual Symposium on Foun- dations of Computer Science, FOCS 2014, pages 661–670. IEEE Computer Society, 2014. doi:10.1109/FOCS.2014.76. [9] Karl Bringmann and Marvin Kunnemann. Quadratic conditional lower bounds for string problems and dynamic time warping. In Venkatesan Guruswami, editor, 56th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2015, pages 79–97. IEEE Computer Society, 2015. doi:10.1109/FOCS.2015.15. [10] Andrej Brodnik and J. almost-minimum space. doi:10.1137/S0097539795294165. Ian Munro. SIAM Journal on Computing, Membership in constant time 28(5):1627–1640, and 1999. [11] John F. Canny, Erich Kaltofen, and Yagati N. Lakshman. Solving systems of nonlinear polynomial equations faster. In Gaston H. Gonnet, editor, Symbolic and Algebraic Com- putation, ISSAC 1989, pages 121–128. ACM, 1989. doi:10.1145/74540.74556. [12] David G. Cantor and Hans Zassenhaus. nomials over finite fields. doi:10.1090/s0025-5718-1981-0606517-5. factoring poly- Mathematics of Computation, 36(154):587–587, 1981. A new algorithm for [13] David R. Clark and J. (extended abstract). on Discrete Algorithms, SODA 1996, pages 383–391. ACM/SIAM, 1996. http://dl.acm.org/citation.cfm?id=313852.314087. Efficient suffix trees on secondary storage In ´Eva Tardos, editor, 7th Annual ACM-SIAM Symposium URL: Ian Munro. [14] Raphael Clifford, Klim Efremenko, Benny Porat, and Ely Porat. A black box for on- line approximate pattern matching. Information and Computation, 209(4):731–736, 2011. doi:10.1016/j.ic.2010.12.007. [15] Raphael Clifford, Klim Efremenko, Ely Porat, and Amir Rothschild. From coding In Claire Mathieu, editor, 20th Annual ACM- theory to efficient pattern matching. SIAM Symposium on Discrete Algorithms, SODA 2009, pages 778–784. SIAM, 2009. doi:10.1137/1.9781611973068.85. 25 [16] Raphael Clifford, Allyx Fontaine, Ely Porat, Benjamin Sach, and Tatiana Starikovskaya. Dictionary matching in a stream. edi- tors, Algorithms, ESA 2015, volume 9294 of LNCS, pages 361–372. Springer, 2015. doi:10.1007/978-3-662-48350-3_31. In Nikhil Bansal and Irene Finocchi, [17] Raphael Clifford, Allyx Fontaine, Ely Porat, Benjamin Sach, and Tatiana Starikovskaya. The k-mismatch problem revisited. In Robert Krauthgamer, editor, 27th Annual ACM- SIAM Symposium on Discrete Algorithms, SODA 2016, pages 2039–2052. SIAM, 2016. doi:10.1137/1.9781611974331.ch142. [18] Raphael Clifford, Allan Grønlund, Kasper Green Larsen, and Tatiana A. Starikovskaya. Upper and lower bounds for dynamic data structures on strings. In Rolf Niedermeier and Brigitte Vall´ee, editors, Symposium on Theoretical Aspects of Computer Science, STACS 2018, volume 96 of LIPIcs, pages 22:1–22:14. Schloss Dagstuhl-Leibniz-Zentrum fur In- formatik, 2018. doi:10.4230/LIPIcs.STACS.2018.22. [19] Raphael Clifford and Benjamin Sach. Pseudo-realtime pattern matching: Clos- ing the gap. In Amihood Amir and Laxmi Parida, editors, Combinatorial Pat- tern Matching, CPM 2010, volume 6129 of LNCS, pages 101–111. Springer, 2010. doi:10.1007/978-3-642-13509-5_10. [20] Raphael Clifford and Tatiana A. Starikovskaya. Approximate Hamming distance in a stream. In Ioannis Chatzigiannakis, Michael Mitzenmacher, Yuval Rabani, and Davide Sangiorgi, editors, Automata, Languages and Programming, ICALP 2016, volume 55 of LIPIcs, pages 20:1–20:14. Schloss Dagstuhl–Leibniz-Zentrum fur Informatik, 2016. doi:10.4230/LIPIcs.ICALP.2016.20. [21] Peter Elias. Efficient storage and retrieval by content and address of static files. Journal of the ACM, 21(2):246–260, 1974. doi:10.1145/321812.321820. [22] Funda Ergun, Elena Grigorescu, Erfan Sadeqi Azer, and Samson Zhou. Streaming Periodic- ity with Mismatches. In Klaus Jansen, Jos´e D. P. Rolim, David Williamson, and Santosh S. Vempala, editors, Approximation, Randomization, and Combinatorial Optimization, AP- PROX/RANDOM 2017, volume 81 of LIPIcs, pages 42:1–42:21. Schloss Dagstuhl–Leibniz- Zentrum fur Informatik, 2017. doi:10.4230/LIPIcs.APPROX-RANDOM.2017.42. [23] Funda Ergun, Hossein Jowhari, and Mert Saglam. Periodicity in streams. In Maria J. Serna, Ronen Shaltiel, Klaus Jansen, and Jos´e D. P. Rolim, editors, Approximation, Ran- domization, and Combinatorial Optimization, APPROX/RANDOM 2010, volume 6302 of LNCS, pages 545–559. Springer, 2010. doi:10.1007/978-3-642-15369-3_41. [24] Robert M. Fano. On the number of bits required to implement an associative memory. Computation Structures Group Memo 61, Massachusetts Institute of Technology, August 1971. URL: http://csg.csail.mit.edu/pubs/memos/Memo-61/Memo-61.pdf. [25] Pawe l Gawrychowski and Przemys law Uzna´nski. Optimal trade-offs for pattern matching with k mismatches, 2017. arXiv:1704.01311. [26] Daniel Gorenstein and Neal Zierler. A class of error-correcting codes in pm sym- bols. Journal of the Society for Industrial and Applied Mathematics, 9(2):207–214, 1961. doi:10.1137/0109020. [27] Wei Huang, Yaoyun Shi, Shengyu Zhang, and Yufan Zhu. The communication complexity of the Hamming distance problem. Information Processing Letters, 99(4):149–153, 2006. doi:10.1016/j.ipl.2006.01.014. 26 [28] Markus Jalsenius, Benny Porat, and Benjamin Sach. Parameterized matching in the streaming model. In Natacha Portier and Thomas Wilke, editors, Symposium on Theoreti- cal Aspects of Computer Science, STACS 2013, volume 20 of LIPIcs, pages 400–411. Schloss Dagstuhl–Leibniz-Zentrum fur Informatik, 2013. doi:10.4230/LIPIcs.STACS.2013.400. [29] Erich Kaltofen and Yagati N. Lakshman. Improved sparse multivariate polyno- mial In Patrizia M. Gianni, editor, Symbolic and Alge- braic Computation, ISSAC 1988, volume 358 of LNCS, pages 467–474. Springer, 1988. doi:10.1007/3-540-51084-2_44. interpolation algorithms. [30] Richard M. Karp and Michael O. Rabin. IBM Journal of Research and Development, Efficient randomized pattern-matching 1987. 31(2):249–260, algorithms. doi:10.1147/rd.312.0249. [31] Donald Ervin Knuth. The art of computer programming, Volume II: Seminumerical Algo- rithms, 3rd Edition. Addison-Wesley, 1998. [32] S. Rao Kosaraju. Efficient string matching. Manuscript, 1987. [33] L. Kronecker. Grundzuge einer arithmetischen Theorie der algebraischen Grossen. URL: reine und angewandte Mathematik, 92:1–122, 1882. Journal http://eudml.org/doc/148487. fur die [34] Gad M. Landau and Uzi Vishkin. Efficient string matching with k mismatches. Theoretical Computer Science, 43:239–249, 1986. doi:10.1016/0304-3975(86)90178-7. [35] Victor Y. Pan. Faster solution of the key equation for decoding BCH error-correcting codes. In Frank Thomson Leighton and Peter W. Shor, editors, 29th Annual ACM Symposium on Theory of Computing, STOC 1997, pages 168–175. ACM, 1997. doi:10.1145/258533.258577. [36] W. Wesley Peterson. chaudhuri codes. doi:10.1109/TIT.1960.1057586. Encoding and error-correction procedures the bose– IRE Transactions on Information Theory, 6(4):459–470, 1960. for [37] Benny Porat and Ely Porat. Exact and approximate pattern matching in the streaming In 50th Annual IEEE Symposium on Foundations of Computer Science, FOCS model. 2009, pages 315–323. IEEE Computer Society, 2009. doi:10.1109/FOCS.2009.11. [38] Jakub Radoszewski and Tatiana A. Starikovskaya. Streaming k-mismatch with error cor- In Ali Bilgin, Michael W. Marcellin, Joan Serra-Sagrist`a, and recting and applications. James A. Storer, editors, Data Compression Conference, DCC 2017, pages 290–299. IEEE, 2017. doi:10.1109/DCC.2017.14. [39] Arnold Schonhage and Volker Strassen. Schnelle multiplikation grosser Zahlen. Computing, 7(3-4):281–292, 1971. doi:10.1007/BF02242355. [40] Joachim von zur Gathen and Jurgen Gerhard. Modern Computer Algebra (3rd ed.). Cam- bridge University Press, 2013. doi:10.1017/CBO9781139856065. 27
1105.2704
2
1105
2013-12-13T06:48:36
Hitting and Harvesting Pumpkins
[ "cs.DS" ]
The "c-pumpkin" is the graph with two vertices linked by c>0 parallel edges. A c-pumpkin-model in a graph G is a pair A,B of disjoint subsets of vertices of G, each inducing a connected subgraph of G, such that there are at least c edges in G between A and B. We focus on covering and packing c-pumpkin-models in a given graph: On the one hand, we provide an FPT algorithm running in time 2^O(k) n^O(1) deciding, for any fixed c>0, whether all c-pumpkin-models can be covered by at most k vertices. This generalizes known single-exponential FPT algorithms for Vertex Cover and Feedback Vertex Set, which correspond to the cases c=1,2 respectively. On the other hand, we present a O(log n)-approximation algorithm for both the problems of covering all c-pumpkin-models with a smallest number of vertices, and packing a maximum number of vertex-disjoint c-pumpkin-models.
cs.DS
cs
HITTING AND HARVESTING PUMPKINS GWENAEL JORET, CHRISTOPHE PAUL, IGNASI SAU, SAKET SAURABH, AND ST´EPHAN THOMASS´E Abstract. The c-pumpkin is the graph with two vertices linked by c ≥ 1 parallel edges. A c-pumpkin-model in a graph G is a pair {A, B} of disjoint subsets of vertices of G, each inducing a connected subgraph of G, such that there are at least c edges in G between A and B. We focus on hitting and packing c-pumpkin-models in a given graph in the realm of approximation algorithms and parameterized algorithms. We give an FPT algorithm running in time 2O(k)nO(1) deciding, for any fixed c ≥ 1, whether all c-pumpkin-models can be hit by at most k vertices. This generalizes known single-exponential FPT algorithms for Vertex Cover and Feedback Vertex Set, which correspond to the cases c = 1, 2 respectively. Finally, we present an O(log n)- approximation algorithm for both the problems of hitting all c-pumpkin-models with a smallest number of vertices, and packing a maximum number of vertex-disjoint c- pumpkin-models. Keywords: Hitting and packing; parameterized complexity; approximation algo- rithm; single-exponential algorithm; iterative compression; graph minors. 1. Introduction The c-pumpkin is the graph with two vertices linked by c ≥ 1 parallel edges. A in a graph G is a pair {A, B} of disjoint subsets of vertices of G, c-pumpkin-model each inducing a connected subgraph of G, such that there are at least c edges in G In this article we study the problems of hitting all c-pumpkin- between A and B. models of a given graph G with as few vertices as possible, and packing as many disjoint c-pumpkin-models in G as possible. As discussed below, these problems generalize several well-studied problems in algorithmic graph theory. We focus on FPT algorithms for the parameterized version of the hitting problem, as well as on polynomial-time approximation algorithms for the optimization version of both the packing and hitting problems. FPT algorithms. From the parameterized complexity perspective, we study the fol- lowing problem for every fixed integer c ≥ 1. p-c-Pumpkin-Hitting (p-c-Hit) Instance: A graph G and a non-negative integer k. Parameter: k. Question: Does there exist S ⊆ V (G), S ≤ k, such that G \ S does not contain the c-pumpkin as a minor? A preliminary conference version of this work appeared in the Proceedings of the 19th Annual Euro- pean Symposium on Algorithms (ESA), volume 6942 of LNCS, pages 394-407, Saarbrucken, Germany, September 2011. This work was supported in part by AGAPE (ANR-09-BLAN-0159) and GRATOS (ANR-09-JCJC-0041-01) French projects, by a project funded by DAE (India), and by the Actions de Recherche Concert´ees (ARC) fund of the Communaut´e fran¸caise de Belgique (Belgium). Gwenael Joret is a Postdoctoral Researcher of the Fonds National de la Recherche Scientifique (F.R.S. -- FNRS). 1 2 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E Several special cases of this problem are well studied in the parameterized complexity. When c = 1, the p-c-Hit problem is the p-Vertex Cover problem [2, 10]. For c = 2, it is the p-Feedback Vertex Set problem [8, 14, 23]. When c = 3, this corresponds to the recently introduced p-Diamond Hitting Set problem [18]. The p-c-Hit problem can also be seen as a particular case of the following problem, recently introduced by Fomin et al. [21] and studied from the kernelization perspective: Let F be a finite set of graphs. In the p-F-Hit problem, we are given an n-vertex graph G and an integer k as input, and asked whether at most k vertices can be deleted from G such that the resulting graph does not contain any graph from F as a minor. Among other results, it is proved in [21] that if F contains a c-pumpkin for some c ≥ 1, then p-F-Hit admits a kernel of size O(k2 log3/2 k). As discussed in Section 3, this kernel leads to a simple FPT algorithm for p-F-Hit in this case, and in particular for p-c-Hit, with running time 2O(k log k) · nO(1). A natural question is whether there exists an algorithm for p-c-Hit with running time 2O(k) · nO(1) for every fixed c ≥ 1. Such algorithms are called single-exponential. For the p-Vertex Cover problem the existence of single-exponential algorithms is well-known since almost the beginnings of the field of Parameterized Complexity [2], the best current algorithm being by Chen et al. [10]. On the other hand, the question about the existence of single-exponential algorithms for p-Feedback Vertex Set was open for a long time and was finally settled independently by Guo et al. [23] (using iterative compression) and by Dehne et al. [14]. The current champion deterministic algorithm for p-Feedback Vertex Set runs in time O(3.83kk · n2) [8], whereas the fastest randomized one runs in time O(3k) · poly(n) [13]. We present in Section 3 a single-exponential algorithm for p-c-Hit for every fixed c ≥ 1, using a combination of a kernelization-like technique and iterative compression. (In fact, we will solve the constructive version of the problem.) Notice that this general- izes the above results for p-Vertex Cover and p-Feedback Vertex Set. We remark that asymptotically these algorithms are optimal, that is, it is known that unless ETH fails neither p-Vertex Cover nor p-Feedback Vertex Set admit an algorithm with running time 2o(k) · nO(1) [9, 24]. It is worth mentioning here that a similar quantitative approach was taken by Lampis [27] for graph problems expressible in MSOL parameter- ized by the sum of the formula size and the size of a minimum vertex cover of the input graph. Approximation algorithms. For a fixed integer c ≥ 1, we define the following two optimization problems. Minimum c-Pumpkin-Hitting (Min c-Hit) Input: A graph G. Output: A subset S ⊆ V (G) such that G \ S does not contain the c-pumpkin as a minor. Objective: Minimize S. Maximum c-Pumpkin-Packing (Max c-Pack) Input: A graph G. Output: A collection M of vertex-disjoint subgraphs of G, each containing the c-pumpkin as a minor. Objective: Maximize M. Let us now discuss how the above problems encompass several well-known problems. For c = 1, Min 1-Hit is the Minimum Vertex Cover problem, which can be easily HITTING AND HARVESTING PUMPKINS 3 2-approximated by finding any maximal matching, whereas Max 1-Pack corresponds to finding a Maximum Matching, which can be done in polynomial time. For c = 2, Min 2-Hit is the Minimum Feedback Vertex Set problem, which can be also 2- approximated [1,3], whereas Max 2-Pack corresponds to Maximum Vertex-Disjoint Cycle Packing, which can be approximated to within a O(log n) factor [26]. For c = 3, Min 3-Hit is the Diamond Hitting Set problem studied by Fiorini et al. in [18], where a 9-approximation algorithm is given. We provide in Section 4 an algorithm that approximates both the Min c-Hit and the Max c-Pack problems to within a O(log n) factor for every fixed c ≥ 1. Note that this algorithm matches the best existing algorithms for Max c-Pack for c = 2 [26]. For the Min c-Hit problem, our result is only a slight improvement on the O(log3/2 n)- approximation algorithm given in [21]. However, for the Max c-Pack problem, there was no approximation algorithm known before except for the c ≤ 2 case. Also, let us remark that, for c ≥ 2 and every fixed ε > 0, Max c-Pack is quasi-NP-hard to approximate to within a O(log1/2−ε n) factor. For c = 2 this was shown by Friggstad and Salavatipour [22], and their result can be extended to the case c > 2 in the following straightforward way. Given an instance G of Max 2-Pack, we build an instance of Max c-Pack by replacing each edge of G with c− 1 parallel edges. This approximation preserving transformation shows that Max c-Pack is quasi-NP-hard to approximate to within a O(log1/2−ε n) factor for any c ≥ 2. The main ingredient of our approximation algorithm is the following combinatorial result: We show that every n-vertex graph G either contains a small c-pumpkin-model or has a structure that can be reduced in polynomial time, giving a smaller equivalent instance for both the Min c-Hit and the Max c-Pack problems. Here by a "small" c-pumpkin-model, we mean a model of size at most f (c) · log n for some function f independent of n. This result extends one of Fiorini et al. [18], who dealt with the case c = 3. 2. Preliminaries Graphs. We use standard graph terminology, see for instance [15]. All graphs in this article are finite and undirected, and may have parallel edges but no loops. We will sometimes restrict our attention to simple graphs, that is, graphs without parallel edges. Given a graph G, we denote the vertex set of G by V (G) and the edge set of G by E(G). We use the shorthand G for the number of vertices in G. For a subset X ⊆ V (G), we use G[X] to denote the subgraph of G induced by X. For a subset Y ⊆ E(G) we let G[Y ] be the graph with E(G[Y ]) := Y and with V (G[Y ]) being the set of vertices of G incident with some edge in Y . For a subset X ⊆ V (G), we may use the notation G \ X to denote the graph G[V (G) \ X]. The set of neighbors of a vertex v of a graph G is denoted by NG(v). The degree degG(v) of a vertex v ∈ V (G) is defined as the number of edges incident with v (thus parallel edges are counted). We write deg∗G(v) for the number of neighbors of v, that is, deg∗G(v) := NG(v). Similarly, given a subgraph H ⊆ G with v ∈ V (H), we can define in the natural way NH(v), degH (v), and deg∗H(v), that is, NH(v) = NG(v)∩V (H), degH(v) is the number of edges incident with v with both endpoints in H, and deg∗H (v) = NH(v). In these notations, we may drop the subscript if the graph is clear from the context. By the neighbors of a subgraph H ⊆ G we mean the set of vertices in V (G) \ V (H) that have at least one neighbor in H. The minimum degree of a vertex in a graph G is denoted δ(G), and the maximum degree of a vertex in G is denoted ∆(G). We use the notation cc(G) to denote the number of connected components of G. Also, we let µ(G) 4 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E denote the maximum multiplicity of an edge in G. A graph is said to be a multipath if its underlying simple graph (without parallel edges) is isomorphic to a path. Minors and models. Given a graph G and an edge e ∈ E(G), let G\e be the graph obtained from G by removing the edge e, and let G/e be the graph obtained from G by contracting e (we note that parallel edges resulting from the contraction are kept but self loops are deleted). If H can be obtained from a subgraph of G by a (possibly empty) sequence of edge contractions, we say that H is a minor of G, and we denote it by H (cid:22)m G. A graph G is H-minor-free, or simply H-free, if G does not contain H as a minor. A model of a graph H, or simply H-model, in a graph G is a collection {Sv ⊆ V (G) v ∈ V (H)} such that (i) G[Sv] is connected for every v ∈ V (H); (ii) Sv and Sw are disjoint for every two distinct vertices v, w of H; and (iii) there are at least as many edges between Sv and Sw in G as between v and w in H, for every vw ∈ E(H). The size of the model is defined as Pv∈V (H) Sv. Clearly, H is a minor of G if and only if there exists a model of H in G. In this paper, we will almost exclusively consider H-models with H being isomorphic to a c-pumpkin for some c ≥ 1. Thus a c-pumpkin- model in a graph G is specified by an unordered pair {A, B} of disjoint subsets of vertices of G, each inducing a connected subgraph of G, such that there are at least c edges in G between A and B. A c-pumpkin-model {A, B} of G is said to be minimal if there is no c-pumpkin-model {A′, B′} of G with A′ ⊆ A, B′ ⊆ B, and A′ + B′ < A + B. A subset X of vertices of a graph G such that G\ X has no c-pumpkin-minor is called a c-pumpkin-hitting set, or simply c-hitting set. We denote by τc(G) the minimum size of a c-pumpkin-hitting set in G. A collection M of vertex-disjoint subgraphs of a graph G, each containing a c-pumpkin-model, is called a c-pumpkin-packing, or simply c-packing. We denote by νc(G) the maximum size of a c-pumpkin-packing in G. Obviously, for any graph G it holds that νc(G) ≤ τc(G), but the converse is not necessarily true. forward and hence is omitted. The following lemma on models will be useful in our algorithms. The proof is straight- Lemma 2.1. Suppose G′ is obtained from a graph G by contracting some vertex-disjoint subgraphs of G, each of diameter at most k. Then, given an H-model in G′ of size s, one can compute in polynomial time an H-model in G of size at most k · ∆(H) · s. Parameterized algorithms. A parameterized problem Π is a subset of Γ∗ × N for some finite alphabet Γ. An instance of a parameterized problem consists of a pair (x, k), where k is called the parameter. A central notion in parameterized complexity is fixed parameter tractability (FPT), which means, for a given instance (x, k), solvability in time f (k) · p(x), where f is some computable function of k and p is a polynomial in the input size. A kernelization algorithm or, in short, a kernel for a parameterized problem Π ⊆ Γ∗ × N is an algorithm that given (x, k) ∈ Γ∗ × N outputs in time polynomial in x + k a pair (x′, k′) ∈ Γ∗ × N such that (i) (x, k) ∈ Π if and only if (x′, k′) ∈ Π; and (ii) max{x′, k′} ≤ g(k), where g is some computable function. The function g is referred to as the size of the kernel. If g(k) = kO(1) or g(k) = O(k), then we say that Π admits a polynomial kernel and a linear kernel, respectively. Iterative compression is a tool that has been used successfully in finding fast FPT algorithms for a number of parameterized problems. The main idea behind iterative HITTING AND HARVESTING PUMPKINS 5 compression is an algorithm which, given a solution of size k + 1 for a problem, either compresses it to a solution of size k or proves that there is no solution of size k. This technique was first introduced by Reed et al. to solve the Odd Cycle Transversal problem [29], where one is interested in finding a set of at most k vertices whose deletion makes the graph bipartite [29]. Since then, it has been extensively used in the literature, see for instance [11, 20, 23]. See [16] for detailed introduction to Parameterized Complexity. Tree-width. We briefly recall the definition of the tree-width of a graph. A tree de- composition of a graph G is an ordered pair (T,{Wx x ∈ V (T )}) where T is a tree and {Wx x ∈ V (T )} a family of subsets of V (G) (called bags) such that (i) Sx∈V (T ) Wx = V (G); (ii) for every edge uv ∈ E(G), there exists x ∈ V (T ) with u, v ∈ Wx; and (iii) for every vertex u ∈ V (G), the set {x ∈ V (T ) u ∈ Wx} induces a subtree of T . The width of tree decomposition (T,{Wx x ∈ V (T )}) is max{Wx − 1 x ∈ V (T )}. The tree-width tw(G) of G is the minimum width among all tree decompositions of G. We refer the reader to Diestel's book [15] for an introduction to the theory of tree-width. It is an easy exercise to check that the tree-width of a simple graph is an upper bound on its minimum degree. This implies the following lemma. Lemma 2.2. Every n-vertex simple graph with tree-width k has at most k · n edges. We will need the following result of Bodlaender et al. [7]. Theorem 2.3 (Bodlaender et al. [7]). Every graph not containing a c-pumpkin as a minor has tree-width at most 2c − 1. The following corollary is an immediate consequences of the above theorem. Corollary 2.4. Every n-vertex graph (may contain parallel edges) with no minor iso- morphic to a c-pumpkin has at most (c − 1) · (2c − 1) · n edges. Note that the existence of a c-pumpkin-minor in a graph can be tested in polynomial time by using the polynomial-time algorithm of Robertson and Seymour [30]. The following proposition states that c-pumpkin-minors can be found in linear time. Proposition 2.5. For each fixed integer positive integer c, the existence of a c-pumpkin- minor in an n-vertex graph G can be done in time O(n). Proof. We first check whether the treewidth of G is at most 2c − 1, by using the linear- time algorithm of Bodlaender [4]. If the treewidth of G is strictly larger than 2c − 1, then by Theorem 2.3 we can conclude that G contains a c-pumpkin-minor. Otherwise, the treewidth of G is bounded, and we can test for the existence of a c-pumpkin-minor by using the linear-time algorithm of Courcelle [12]. (cid:3) 3. A single-exponential FPT algorithm As mentioned in the introduction, it is proved in [21] that given an instance (G, k) of p-F-Hit such that F consists of only a c-pumpkin for some c ≥ 1, one can obtain in polynomial time an equivalent instance with O(k2 log3/2 k) vertices. This kernel leads to the following simple FPT algorithm for p-c-Hit: First compute the kernel K in polynomial time, and then for every subset S ⊆ V (K) of size k, test whether K[V (K)\S] contains a c-pumpkin as a minor, using for instance the linear-time algorithm given by Proposition 2.5. If for some S we have that K[V (K) \ S] does not contain c-pumpkin as a minor, we answer Yes; otherwise the answer is No. The running time of this algorithm is clearly bounded by (cid:0)k2 log3/2 k (cid:1) · nO(1) = 2O(k log k) · nO(1). k 6 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E In this section we give an algorithm for p-c-Pumpkin-Hitting that runs in time dk·nO(1) for any fixed c ≥ 1, where d only depends on the fixed constant c. Towards this, we first introduce a variant of p-c-Pumpkin-Hitting, namely p-c-Pumpkin-Disjoint Hitting, formally defined as follows. p-c-Pumpkin-Disjoint Hitting (p-c-Disjoint Hit for short) Instance: A graph G , a non-negative integer k, and a set S ⊆ V (G) with S ≤ k + 1, such that G \ S does not contain the c-pumpkin as a minor. Parameter: k. Question: Does there exist S′ ⊆ V (G) \ S, with S′ ≤ k, such that G \ S does not contain the c-pumpkin as a minor? We would like to note that we will focus on solving the constructive version of the p-c- Disjoint Hit problem. That is, we will be interested in finding such a set S′ ⊆ V (G)\S, as we will need it in our algorithm. Next we show a lemma that allows us to relate the two problems mentioned above. Lemma 3.1. If p-c-Disjoint Hit can be solved in time η(c)k · nO(1), then p-c-Hit can be solved in time (η(c) + 1)k · nO(1). Proof. Let A be an FPT algorithm which solves the p-c-Disjoint Hit problem in time η(c)k · nO(1). Let (G, k) be an input graph for the p-c-Hit problem, and let v1, . . . , vn be an arbitrary ordering of V (G). Let Vi and Gi, respectively, denote the subset {v1, . . . , vi} of vertices and the induced subgraph G[Vi]. We iterate over i = 1, . . . , n in the following way. At the i-th iteration, suppose we have a c-hitting set Si ⊆ Vi of Gi of size at most k. At the next iteration, we set Si+1 := Si ∪ {vi+1} (note that Si+1 is a c-hitting set for Gi+1 of size at most k+1). If Si+1 ≤ k, we can safely move on to the (i+2)-th iteration. If Si+1 = k + 1, we look at every subset S ⊆ Si+1 and check whether there is a c-hitting set W of size at most k such that W ∩ Si+1 = Si+1 \ S. To do this, we use the FPT algorithm A for p-c-Disjoint Hit on the instance (H, S), with H = Gi+1 \ (Si+1 \ S). If A returns a c-hitting set W of H with W < S, then observe that the vertex set (Si+1 \ S) ∪ W is a c-hitting set of G of size strictly smaller than Si+1. If there is a c-hitting set of Gi+1 of size strictly smaller than Si+1, then for some S ⊆ Si+1, there is a small c-hitting set in Gi+1\(Si+1\S) disjoint from S, and A correctly returns a solution. If no such small c-hitting set exists, the algorithm returns No. Let us now argue about the running time of this algorithm. The time required to execute A for every subset S at the i-th iteration is Pk+1 i (cid:1)· η(c)i · nO(1) = (η(c) + 1)k+1 · nO(1). That is, we have an algorithm for p-c-Hit running in time (η(c) + 1)k · nO(1), as we wanted to prove. (cid:3) In what follows we give an algorithm for p-c-Disjoint Hit that runs in single-exponential time. In fact, we obtain a linear kernel for p-c-Disjoint Hit, which clearly yields a single-exponential algorithm. Lemma 3.1 allows us to focus on p-c-Disjoint Hit. i=0 (cid:0)k+1 Overview of the algorithm. The algorithm for p-c-Disjoint Hit is based on a com- bination of polynomial-time preprocessing and a protrusion-based reduction rule. Let (G, S, k) be the given instance of p-c-Disjoint Hit and let V := V (G). Our main objective is to show that, after applying some simple polynomial-time reduction rules, {v ∈ V \ S : NG(v) ∩ S 6= ∅} has cardinality O(k); the proof of this fact, specially Lemma 3.5, is the most technical part of this section. Once we have the desired upper bound, we use a protrusion-based reduction rule adapted from [21] to give a polynomial- time procedure that, given an instance (G, S, k) of p-c-Disjoint Hit, returns an equiv- alent instance (G′, S, k′) such that G′ has O(k) vertices. That is, we obtain a linear HITTING AND HARVESTING PUMPKINS 7 p =c 2 P u v u v P p =c 2 u v u v p =c 1 P u v u v p =c 1 P u v u v Figure 1. Four examples of reduction rule R3 for c = 4. vertex kernel for p-c-Disjoint Hit1. Notice that once we have a linear vertex kernel of size αk for p-c-Disjoint Hit, we can solve the problem in (cid:0)αk k (cid:1) · kO(1). We can now proceed to the detailed description of the algorithm. Pre-processing step. We start by defining two sets. Our first objective is to upper bound the cardinality of these two sets by O(k). V1 V≥2 := {v ∈ V \ S : NG(v) ∩ S = 1} := {v ∈ V \ S : NG(v) ∩ S ≥ 2}. We start with some simple polynomial-time reduction rules (depending on c) that will be applied in the compression routine. We also prove, together with the description of each rule, that they are valid for our problem. R1 Suppose that C is a connected component of G\ S with no neighbor in S. Then delete C. Proof of correctness. The deletion of C can be safely done, as its vertices will never participate in a c-pumpkin-model. (cid:3) R2 Suppose that C is a connected component of G \ S with exactly one neighbor v in S, and such that G[V (C) ∪ {v}] is c-pumpkin-free. Then delete C. Proof of correctness. In this case C can be also safely deleted, as its vertices will never participate in a minimal c-pumpkin-model. (cid:3) R3 Let u ∈ S, let v ∈ V (G) \ S, let P be a (non-empty) connected component of G\{u, v} entirely contained in G\S, and suppose that is c-pumpkin-free. Let Hp be the graph obtained from G[V (P )∪{u, v}] by adding p parallel edges between u and v, and let pc be the smallest positive integer p such that Hp contains a c-pumpkin-minor (note that it is possible that pc = 0). Then replace P with c − pc parallel edges between u and v. See Figure 1 for some small examples for c = 4. Proof of correctness. Note that in order to hit all c-pumpkins-models intersecting P , there is no need to include any vertex of P in the solution, as any such vertex could be replaced with v, obtaining another solution with equal or smaller size. We say that two c-pumpkins-models in G are P -equivalent if they coincide except, possibly, for vertices in P . Let G′ be the graph obtained from G by replacing P with c − pc parallel edges between u and v. By construction, G and G′ contain exactly the same c-pumpkins-models modulo the P -equivalence relation. As we can assume that no vertex of P is included in the solution, we conclude that the reduction rule yields an equivalent instance. (cid:3) 1This was not the case in the conference version of this article, in which the algorithm for p-c- Disjoint Hit was considerably more complicated, involving in particular a branching procedure and a more extensive usage of the protrusion-based reduction rule. 8 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E We would like to note that under the hypothesis of Rule R3, if in addition it holds that G[V (P ) ∪ {u, v}] contains a c-pumpkin-minor, then we could safely delete vertex v from G and decrease the parameter k by one. Nevertheless, it turns out that keeping c parallel edges between u and v yields the analysis of the algorithm simpler. We say that the instance (G, S, k) is (S, c)-reduced if rules R1, R2, or R3 cannot be applied anymore. Note that reduction rule R1 can easily be applied in polynomial time. For reduction rules R2 and R3, we have to test whether the considered graph contains a c-pumpkin-minor, which can be done in linear time by Proposition 2.5. The following Lemmas 3.2 and 3.5 are key to the analysis of our algorithm. We also need two intermediate technical results stated in Lemmas 3.3 and 3.4, which will be used in the proof of Lemma 3.5. Lemma 3.2. There is a function f : N → N such that if (G, S, k) is a Yes-instance to the p-c-Disjoint Hit problem, then V≥2 ≤ f (c) · k. Proof. In order to upper-bound V≥2, we build from G[S] the following auxiliary graph H: we start with H = (S, E(G[S])), and for each vertex v ∈ V≥2 with neighbors u1, . . . , uℓ, ℓ ≥ 2, we add to H an edge ev between two arbitrary neighbors u1, u2 of v. Note that H (cid:22)m G, and that for each vertex v ∈ V≥2, H \ ev (cid:22)m G \ v. We now argue that E(H) is linearly bounded by k, which implies the desired result as by construction V≥2 ≤ E(H). If G is a Yes-instance, there must be a set S′ ⊆ V \S, S′ ≤ k, such that G\ S′ is c-pumpkin-free. By construction of H, the removal of each vertex v ∈ S′ ∩ V≥2 corresponds to the removal of the edge ev ∈ E(H). Let H′ = H \ {ev : v ∈ S′ ∩ V≥2}, and note that H′ (cid:22)m G \ S′, so H′ is c-pumpkin-free. Therefore, by Corollary 2.4 it follows that E(H′) ≤ (c − 1) · (2c − 1) · V (H′) ≤ (c − 1) · (2c − 1) · (k + 1). As E(H) ≤ E(H′)+k, we conclude that V≥2 ≤ E(H) ≤ (c−1)·(2c−1)·(k +1)+k. (cid:3) Lemma 3.3. There is a function g : N → N such that if (G, S, k) is a Yes-instance to the p-c-Disjoint Hit problem and C is a collection of disjoint connected subgraphs of G\ S such that each subgraph has at least two distinct neighbors in S, then C ≤ g(c)· k. Proof. The proof is very similar to the proof of Lemma 3.2. In order to upper-bound C, we build from G[S] the following auxiliary graph H: we start with H = (S, E(G[S])), and for each subgraph C ∈ C with neighbors u1, . . . , uℓ, ℓ ≥ 2, we add to H an edge eC between two arbitrary neighbors u1, u2 of C. Note that H (cid:22)m G, and that for each subgraph C ∈ C, H \ eC (cid:22)m G \ C. We now argue that E(H) is linearly bounded by k, which implies the desired result as by construction C ≤ E(H). If G is a Yes- instance, there must be a set S′ ⊆ V \ S, S′ ≤ k, such that G \ S′ is c-pumpkin-free. By construction of H, the removal of a vertex v in a subgraph C ∈ C corresponds to the removal of at most one edge eC ∈ E(H) (as maybe the edge eC can still be simulated after the removal of v). Let H′ be the subgraph obtained from H after the removal of those edges, and note that H′ (cid:22)m G\ S′, so H′ is c-pumpkin-free. Therefore, by Corollary 2.4 it follows that E(H′) ≤ (c − 1) · (2c − 1) · V (H′) ≤ (c − 1) · (2c − 1) · (k + 1). As E(H) ≤ E(H′) + k, we conclude that C ≤ E(H) ≤ (c− 1)· (2c− 1)· (k + 1) + k. (cid:3) Lemma 3.4. In an (S, c)-reduced Yes-instance (G, S, k) to the p-c-Disjoint Hit prob- lem, the number of connected components of G \ S is O(k). Proof. Note that by reduction rules R1 and R2, we can assume that each connected component C of G\ S has some neighbor in S, and that if C has exactly one neighbor v in S, then G[V (C)∪{v}] has a c-pumpkin. On the one hand, the number of components C that have exactly one neighbor v in S and such that G[V (C) ∪ {v}] contains the c- pumpkin as a minor is at most k, as any solution needs to contain at least one vertex from each such connected component. On the other hand, the number of components that have at least two neighbors in S is O(k) by Lemma 3.3. (cid:3) HITTING AND HARVESTING PUMPKINS 9 Now we prove our key structural lemma. Lemma 3.5. There is a function h : N → N such that if (G, S, k) is an (S, c)-reduced Yes-instance to the p-c-Disjoint Hit problem, then V1 ≤ h(c) · k. Proof. For simplicity we call the vertices in V1 white. We proceed to find a packing of disjoint connected subgraphs P = {B1, . . . , Bℓ} of G \ S containing all white vertices except for O(k) of them. This will help us in bounding V1. We call the subgraphs in P blocks. For a graph H ⊆ G \ S, let w(H) be the number of white vertices in H. The idea is to obtain, as far as possible, blocks B with c ≤ w(B) ≤ c3; we call these blocks suitable, and the other blocks are called unsuitable. If at some point we cannot refine the packing anymore in order to obtain suitable blocks, we will argue about its structural properties, which will allow us to bound the number of white vertices. We start with P containing all the connected components C of G \ S such that w(C) > c3, and we recursively try to refine the current packing. By Lemma 3.4, we know that the number of connected components is O(k), and hence the number of white vertices that are not included in P is O(c3k) = O(k). More precisely, for each block B with w(B) > c3, we build a spanning tree T of B, and we orient each edge e ∈ E(T ) towards the components of T \{e} containing at least c white vertices. Note that, as w(B) > c3, each edge gets at least one orientation, and that edges may be oriented in both directions. If some edge e ∈ E(T ) is oriented in both directions, we replace in P block B with the subgraphs induced by the vertices in each of the two subtrees. We stop this recursive procedure whenever we cannot find more suitable blocks using this orientation trick. Let P be the current packing. Now let B be an unsuitable block in P, that is, w(B) > c3 and no edge of its spanning tree T is oriented in both directions. This implies that there exists a vertex v ∈ V (T ) with all its incident edges pointing towards it. We call such a vertex v a sink. Let T1, . . . , Tp be the connected components of T \ {v}. Note that as v is a sink, w(Ti) < c for 1 ≤ i ≤ p, using the fact that w(B) > c3 we conclude that p ≥ c2. Now let P1, . . . , Pℓ be the connected components of G[V (T1)∪···∪ V (Tp)] = G[V (B)\{v}], and note that ℓ ≤ p. We call these subgraphs Pi the pieces of the unsuitable block B. For each unsuitable block, we delete the pieces with no white vertex. This completes the construction of P. The next claim bounds the number of white vertices in each piece of an unsuitable block in P. Claim 1. Each of the pieces of an unsuitable block contains less than c2 white vertices. Proof. Assume for contradiction that there exists a piece P of an unsuitable block with w(P ) ≥ c2, and let v be the sink of the unsuitable block obtained from tree T . By construction, V (P ) is the union of the vertices in some of the trees in T \ {v}; let without loss of generality these trees be T1, . . . , Tq. As w(P ) ≥ c2 and w(Ti) < c for 1 ≤ i ≤ q, it follows that q ≥ c. As v has at least one neighbor in each of the trees Ti, 1 ≤ i ≤ q, and P is a connected subgraph of G, we can obtain a c-pumpkin-model {A, B} in G \ S by setting A := {v} and B := V (P ), contradicting the fact that G \ S is c-pumpkin-free. See Figure 2(a) for an example for c = 3. (cid:3) Hence in the packing P we are left with a set of suitable blocks with at most c3 white vertices each, and a set of unsuitable blocks, each one broken up into pieces linked by a sink in a star-like structure. By Claim 1, each piece of the remaining unsuitable blocks contains at most c2 white vertices. See Figure 2(b) for an example of an unsuitable block B for c = 3. Now we need two claims about the properties of the constructed packing. 10 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E P 1T 2T 3T v (a) S 1P B 2P v (b) 3P 4P V S Figure 2. (a) Example for c = 3 of the contradiction in the proof of Claim 1. The trees T1, T2, and T3 are defined by the dashed edges. (b) Example for c = 3 of an unsuitable block B in the packing P built in the proof of Lemma 3.5. Claim 2. In the packing P constructed above, the number of suitable or unsuitable blocks is O(k). Proof. We first bound the number of suitable blocks, and for this we distinguish between two types of suitable blocks. • Type 1: blocks that have exactly one neighbor in S. For each such block we need to include a vertex of it in the c-hitting set (as each suitable block contains at least c white vertices), so their number is at most k. • Type 2: blocks that have at least two distinct neighbors in S. The number of such blocks is O(k) by Lemma 3.3. The proof for unsuitable blocks is similar. Namely, we distinguishing between the same two types of blocks, and use the fact that each unsuitable block contains at least c3 ≥ c white vertices. This concludes the proof. (cid:3) Claim 3. In an (S, c)-reduced Yes-instance, the total number of pieces in the packing P constructed above is O(k). Proof. We distinguish between three types of pieces. • Type 1: pieces that have at least two distinct neighbors in S (see piece P3 in Figure 2(b) for c = 3). The number of pieces of this type is O(k) by Lemma 3.3. • Type 2: pieces that are not of Type 1 and that have at least one neighbor in some suitable block or in another unsuitable block (note that by construction a piece cannot have any neighbor in other pieces of the same unsuitable block). We construct an auxiliary graph H as follows: we start with the packing P, and we add all the edges in G \ S between vertices in different blocks of P (suitable or unsuitable). Then we contract each block to a single vertex, and let H be the resulting graph. By Claim 2, V (H) = O(k). As H (cid:22)m G \ S and G \ S is c-pumpkin-free, by Corollary 2.4 we have that E(H) = O(k). Since each piece of Type 2 is incident with at least one edge of H after uncontracting the blocks, it follows that the number of pieces of Type 2 is at most 2E(H) = O(k). • Type 3: the remaining pieces. That is, these are pieces P that see exactly one vertex u in S, and that are connected to the rest of G \ S only through the HITTING AND HARVESTING PUMPKINS 11 corresponding sink v. In other words, such a piece P is a connected component of G \ {u, v}. We distinguish two subcases. ◦ If G[V (P ) ∪ {u}] contains a c-pumpkin-minor, then any c-hitting set needs to contain at least one vertex in P (see piece P1 in Figure 2(b) for c = 3). We conclude that the number of pieces of this subtype is at most k. ◦ Otherwise, all the conditions of reduction rule R3 are fulfilled, and we conclude that such a piece cannot exist in an (S, c)-reduced instance. (cid:3) (cid:3) To conclude, recall that the constructed packing P contains all but O(k) white ver- tices, either in suitable blocks or in pieces of unsuitable blocks. As by construction each suitable block has at most c3 white vertices and by Claim 2 the number of such blocks is O(k), it follows that the number of white vertices contained in suitable blocks is O(k). Similarly, by Claim 1 each piece contains at most c2 white vertices, and the total number of pieces is O(k) by Claim 3, so the number of white vertices contained in pieces of unsuitable blocks is also O(k). Linear kernel. We now proceed to describe a procedure, called protrusion rule, that bounds the size of our graph when V1 ∪ V≥2 = O(k). We first need some definitions. Many graph optimization problems can be expressed as finding an optimal number of vertices or edges satisfying a property expressible in Monadic Second Order (MSO) logic. A parameterized graph problem Π ⊆ Σ∗ × N is given with a graph G and an integer k as an input. When the goal is to decide whether there exists a subset W of at most k vertices for which an MSO-expressible property PΠ(G, W ) holds, we say that Π is a p-min-MSO graph problem. One can easily check that the p-c-Hit problem is p-min-MSO. In the (parameterized) disjoint version Πd of a p-min-MSO problem Π, we are given a triple (G, S, k), where G is a graph, S a subset of V (G) and k the parameter, and we seek for a solution set W which is disjoint from S, and whose size is at most k. Given R ⊆ V (G), we define ∂G(R) as the set of vertices in R that have a neighbor in V (G) \ R. Thus the neighborhood of R is NG(R) = ∂G(V (G) \ R). We say that a set X ⊆ V (G) is an r-protrusion of G if tw(G[X]) ≤ r and ∂G(X) ≤ r. An important concept when applying protrusion-based reduction rules is strong mono- tonicity of a problem, which we do not define here (see for instance [5]). What we will need is the following fact, which can be found in [5, proof of Lemma 13]: if F is a finite set of connected planar graphs, then the p-F-Hit problem is strongly monotone. As the c-pumpkin is a connected planar graph for any c ≥ 1, we immediately have the following lemma. Lemma 3.6. The p-c-Hit problem is strongly monotone. The following lemma is key to our protrusion-based reduction rule. Its proof follows basically from the framework introduced in [5], although some details need to be modified when dealing with the disjoint version of a problem, as it is our case. A self-contained proof for the specific case of disjoint problems can be found in [25, Lemma 12]. The general statement deals with the disjoint version of a general (parameterized) strongly monotone p-min-MSO problem. As the p-c-Hit problem is p-min-MSO, and it is strongly monotone by Lemma 3.6, we only state the lemma for the specific case of our problem. Lemma 3.7 (Kim et al. [25]). Let Πd be the disjoint version of p-c-Hit. There exists a computable function γ : N → N and an algorithm that given: • an instance (G, S, k) of Πd such that G \ S is c-pumpkin-minor-free, and • a t-protrusion X of G such that X > γ(2t + 1) and X ∩ S = ∅, in time O(X) outputs an instance (G′, S, k′) such that V (G′) < V (G), k′ ≤ k, (G′, S, k′) ∈ Πd if and only if (G, S, k) ∈ Πd, and G′ \ S is c-pumpkin-minor-free. 12 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E We are now ready the state the protrusion rule. It follows as a corollary of Lemma 3.7 that the following reduction rule for p-c-Disjoint Hit is safe. P Let (G, S, k) be an instance of p-c-Disjoint Hit and let γ : N → N be the computable function given by Lemma 3.7. Let X be a 4c-protrusion of G with X > γ(8c + 1) and such that X ∩ S = ∅. Then use the algorithm given by Lemma 3.7 to compute in time O(X) an equivalent instance (G′, S, k′) such that G[S] and G′[S] are isomorphic, G′\S is c-pumpkin-minor-free, V (G′) < V (G), and k′ ≤ k. Before describing how to obtain the linear kernel for p-c-Disjoint Hit, we need the following lemma, corresponding to [21, Lemma 6]. Lemma 3.8 (Fomin et al. [21]). There is a linear-time algorithm that given an n-vertex graph G and a set S ⊆ V (G) such that tw(G \ S) ≤ d, outputs a 2(d + 1)-protrusion n−S 4N (S)+1 , where N (S) is the set of vertices in V (G) \ S with at in G \ S of size at least least one neighbor in S. Here d is some constant. The proof of the next lemma is similar to the proof of [21, Theorem 1]. Lemma 3.9. If V1 ∪ V≥2 = O(k), then p-c-Disjoint Hit has a kernel with O(k) vertices. Proof. Let for this proof V⋆ = V1 ∪ V≥2, and let (G, S, k) be an instance of p-c-Disjoint Hit such that V⋆ = O(k). As by Theorem 2.3 we have that tw(G \ S) ≤ 2c − 1, we can apply Lemma 3.8 and obtain in linear time a 2((2c − 1) + 1) = 4c-protrusion Y of size at least V (G)−S in G \ S. Let γ : N → N be the function defined in Lemma 3.7. 4V⋆+1 If V (G)−S 4V⋆+1 > γ(8c + 1), then using protrusion rule P we obtain in time O(Y ) an instance (G′, S, k′) such that G[S] and G′[S] are isomorphic, G′ \ S is c-pumpkin-minor- free, V (G′) < V (G), k′ ≤ k, and such that (G′, S, k′) is a Yes-instance of p-c-Disjoint Hit if and only if (G, S, k) is a Yes-instance of p-c-Disjoint Hit. We continue applying Lemma 3.8 and protrusion rule P to the newly obtained instance as far as there is a 4c-protrusion of size strictly greater than γ(8c + 1). We would like to note that in the whole process we never delete either the vertices of S or V⋆. Let (G∗, S, k∗) be the reduced instance obtained after this procedure. It follows that there is no 4c-protrusion of size greater than γ(8c + 1) in G∗ \ S, so protrusion rule P no longer applies. Note that k∗ ≤ k. We claim that the number of vertices in this graph G∗ is bounded by O(k). Indeed, since we cannot apply protrusion rule P, we have that V (G∗)−S 4V⋆+1 ≤ γ(8c + 1). Therefore, we have that V (G∗) ≤ γ(8c + 1) · (4V⋆ + 1) + S. Since S = O(k) and by hypothesis V⋆ = O(k), we have that V (G∗) = O(k). This completes the proof. (cid:3) Lemma 3.9 clearly implies that, if V1 ∪ V≥2 = O(k), then p-c-Disjoint Hit can be solved in time 2O(k) · nO(1). Nevertheless, the above proof only shows that the decision version of p-c-Disjoint Hit can be solved in single-exponential time, as we have applied reduction rules that may modify the instance. But in the iterative compression routine (see proof of Lemma 3.1), we need to be able to obtain an explicit solution S′ ⊆ V (G)\S of p-c-Disjoint Hit in the original instance, with S′ = k, if it exists. We can get this explicit solution (if it exists) by repeatedly applying the single- exponential algorithm for the decision version as follows. Suppose that G is a Yes- instance of p-c-Disjoint Hit, and let an ordering of the vertices of V (G) \ S be u1, u2, . . . , uq. Set i := 1 and U := ∅. Repeat the following two steps for i = 1, . . . , q. HITTING AND HARVESTING PUMPKINS 13 (1) Check whether G \ U is c-pumpkin-free in linear time, using Proposition 2.5. If it is the case, then return U as the desired solution. Otherwise, go to the next step. (2) Using the single-exponential algorithm for the decision version of p-c-Disjoint Hit, check whether G\ ({ui}∪ U ) contains a solution S∗ ⊆ V (G)\ (S ∪ U ∪{ui}) of size k − (U + 1). If it is the case, then set U := U ∪ {ui}. Set i := i + 1. This concludes the description of the algorithm to obtain the desired explicit solution U in the compression step. Final algorithm. Finally we combine everything to obtain the following result. Theorem 3.10. For any fixed c ≥ 1, the p-c-Pumpkin-Hitting problem can be solved in time 2O(k) · nO(1). Proof. To obtain the desired result, by Lemma 3.1 and the procedure described after the proof of Lemma 3.9, it is sufficient to obtain a single-exponential algorithm for p-c-Disjoint Hit. To this end, after applying reduction rules R1, R2, and R3 in polynomial time, by Lemmas 3.2 and 3.5 we have that V1 ∪ V≥2 = O(k). Thus, using Lemma 3.9 we get, also in polynomial time, an equivalent instance (G∗, S, k∗) with O(k) vertices, and hence the problem can be solved by enumerating all subsets of size at most k∗ of G∗ \ S. This completes the proof. (cid:3) Running time analysis. To conclude this section, we provide a running time analysis of the algorithm given by Theorem 3.10 above. We would like to note that we did not focus at all on optimizing the hidden constant in the term 2O(k), so we will just concentrate on the term nO(1). From the proof of Lemma 3.1 it follows that if p-c- Disjoint Hit can be solved in time ak · nb for two constants a, b, then p-c-Pumpkin- Hitting can be solved in time (a + 1)k · nb+1. Let us now focus on p-c-Disjoint Hit. First note that reduction rules R1, R2 and R3 can be applied in linear time. Indeed, the connected components of G \ S can be listed by successively performing BFS in time O(V (G \ S) + E(G \ S)), which equals O(V (G \ S)) as the graph G \ S has bounded treewidth by Theorem 2.3. By Proposition 2.5, testing for the existence of a c-pumpkin-minor can also be performed in linear time. As for protrusion rule P, it can also be performed in linear time by Lemmas 3.7 and 3.8. As each of these reduction rules is applied at most O(k · n) times, and as once we have a linear kernel the problem can be solved exhaustively in time 2O(k), we conclude that p-c-Disjoint Hit can be solved in time 2O(k) · n2, and therefore the algorithm given by Theorem 3.10 solves the p-c-Pumpkin-Hitting problem in time 2O(k) · n3. We feel that there is room for improvement in this running time, as it was not our main objective to optimize it. 4. An approximation algorithm for hitting and packing pumpkins In this section we show that every n-vertex graph G either contains a small c-pumpkin- model or has a structure that can be reduced, giving a smaller equivalent instance for both the Minimum c-Pumpkin-Hitting and the Maximum c-Pumpkin-Packing problems. Here by a "small" c-pumpkin-model, we mean a model of size at most f (c) · log n for some function f independent of n. We finally use this result to derive a O(log n)-approximation algorithm for both problems. This section is organized as follows. We first describe in Section 4.1 our reduction rules and prove their validity for both hitting and packing problems (see Lemma 4.1). The existence of small c-pumpkin-models in c-reduced graphs is provided in Section 4.3 (see Lemma 4.10); its proof strongly relies on a graph structure that we call hedgehog, which 14 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E u v u v Figure 3. The graph Γ(K, u, v) of two c-outgrowths (K, u, v) for c = 11 (left) and c = 7 (right), respectively. We have γ(K, u, v) = 9 for the left one, and γ(K, u, v) = 6 for the right one. we study in Section 4.2. We finally focus in Section 4.4 on the algorithmic consequences of our results (see Theorem 4.11). 4.1. Reduction rules. We describe two reduction rules for hitting/packing c-pumpkin- models, which given an input graph G satisfying some specific conditions, produce a graph H with less vertices than G and satisfying τc(G) = τc(H) and νc(G) = νc(H). Moreover, these operations are defined in such a way that, for both problems, an optimal (resp. approximate) solution for G can be retrieved in polynomial time from an optimal (resp. approximate) solution for H. Given a graph G and two distinct vertices u, v of G, we write G +k uv for the graph obtained from G by adding k parallel edges linking u to v. A c-outgrowth of a graph G is a triple (K, u, v) such that (i) u, v are two distinct vertices of G; (ii) K is a connected component of G \ {u, v} with K ≥ 1; (iii) u and v both have at least one neighbor in K in the graph G; and (iv) the graph Γ(K, u, v) obtained from G[V (K) ∪ {u, v}] by removing all the edges between u and v has no c-pumpkin-minor. Given a c-outgrowth (K, u, v) we let γ(K, u, v) := c − k, where k is the smallest integer such that Γ(K, u, v) +k uv has a c-pumpkin minor. Observe that, when adding k parallel edges between u and v to Γ(K, u, v), there are two distinct "types" of c- pumpkin-models {A, B} that could appear: Exchanging A and B if necessary, we either have u ∈ A and v ∈ B (first type), or u, v ∈ A (second type). (Possibly both types of models coexist.) Note that we always have γ(K, u, v) = c − 1 when Γ(K, u, v) +k uv contains a c-pumpkin-model of the second type. See Figure 3 for an illustration. Now that we are equipped with these definitions and notations, we may describe the two reduction rules, which depend on the value of the positive integer c. Z1 Suppose v is a vertex of G such that no block of G containing v has a c-pumpkin- minor. Then define H as the graph obtained from G by removing v. Z2 Suppose that (K, u, v) is a c-outgrowth of G. Then define H as the graph obtained from G \ V (K) by adding γ(K, u, v) parallel edges between u and v. See Figure 4 for an illustration of Z2. We note that testing for the existence of a c-pumpkin-minor in a graph G can be done in polynomial time when c is fixed by Proposition 2.5. Moreover, if there is one, an explicit c-pumpkin-model can be computed. This follows from classical results of Robertson and Seymour [30], and will be used implicitly in the subsequent proofs. Note that, in particular, testing whether a vertex v is in a block containing a c-pumpkin-minor can be done in polynomial time. Similarly, testing whether a triple (K, u, v) with K a component of G − {u, v} is a c-outgrowth can be done in polynomial time, and the parameter γ(K, u, v) can be computed in polynomial time as well. Therefore, we can HITTING AND HARVESTING PUMPKINS 15 Figure 4. Illustration of reduction rule Z2 on the two outgrowths from Figure 3. check in polynomial time if Z1 or Z2 can be applied to a given graph, and each of these two reduction rules can be realized in polynomial time. A graph G is said to be c-reduced if neither Z1 nor Z2 can be applied to G. The next lemma shows the validity of these reduction rules. Lemma 4.1. Let c be a fixed positive integer. Suppose that H results from the applica- tion of Z1 or Z2 on a graph G. Then (a) τc(G) = τc(H) and moreover, given a c-hitting set X′ of H, one can compute in (b) νc(G) = νc(H) and moreover, given a c-packing M′ of H, one can compute in polynomial time a c-hitting set X of G with X ≤ X′. polynomial time a c-packing M of G with M = M′. In order to prove Lemma 4.1, we first need to introduce a few technical lemmas; the validity of the reduction rules is shown in Lemmas 4.4 and 4.5 at the end of this section, which correspond to Lemma 4.1(a) and Lemma 4.1(b), respectively. Lemma 4.2. Let c be a fixed positive integer. Suppose H is obtained by applying rule Z2 on a c-outgrowth (K, u, v) of a graph G. Let X be an arbitrary subset of vertices of V (G) \ (V (K) ∪ {u, v}). Then, given a c-pumpkin-model of H \ X, one can find in polynomial time a c-pumpkin-model of G \ X. Proof. Let Γ := Γ(K, u, v), γ := γ(K, u, v), and k := c− γ. Let {A, B} denote the given c-pumpkin-model of H \ X. If u /∈ A ∪ B or v /∈ A ∪ B, then {A, B} is a c-pumpkin-model in G \ X and we are done. Thus, exchanging A and B if necessary, we may assume that either u, v ∈ A, or u ∈ A and v ∈ B. In the first case, since G[A ∪ V (K)] is connected, {A ∪ V (K), B} is a c-pumpkin-model in G \ X. Now suppose that u ∈ A and v ∈ B. We need to consider which types of c-pumpkin-models appear in Γ +k uv. If Γ +k uv contains a c-pumpkin-model {A′, B′} with u ∈ A′ and v ∈ B′ then there are exactly γ edges linking A′ to B′ in the graph Γ, and hence {A ∪ A′, B ∪ B′} is a c-pumpkin-model in G \ X, as desired. If Γ +k uv has a c-pumpkin-model {A′, B′} with u, v ∈ A′, then k = 1 and γ = c − 1. In H[A ∪ B] there is a path P linking u to v that avoids the c − 1 edges that resulted from the application of Z2 on the c-outgrowth (K, u, v). (Note that P could possibly consists of a single edge linking u to v.) Then {A′ ∪ V (P ), B′} is a c-pumpkin-model in G \ X. (cid:3) Next we show that the converse of the above lemma also holds. Lemma 4.3. Let c be a fixed positive integer. Suppose H is obtained by applying rule Z2 on a c-outgrowth (K, u, v) of a graph G. Let X be an arbitrary subset of vertices 16 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E of V (G) \ (V (K) ∪ {u, v}). Then, given a c-pumpkin-model of G \ X, one can find in polynomial time a c-pumpkin-model of H \ X. Proof. Let Γ := Γ(K, u, v), γ := γ(K, u, v), and k := c− γ. Let {A, B} denote the given c-pumpkin-model of G \ X. We may assume that this model is minimal (if not, one can obviously make it minimal in polynomial time). If u /∈ A ∪ B or v /∈ A ∪ B, then by minimality of {A, B} both A and B avoid V (K). Thus {A, B} is a c-pumpkin-model in H\X, and we are done. Hence, exchanging A and B if necessary, we may assume that either u, v ∈ A, or u ∈ A and v ∈ B. In the second case, at most γ edges between A and B in G \ X are included in Γ. Since there are γ extra edges between u and v in H compared to G, it follows that {A\ V (K), B \ V (K)} is a c-pumpkin-model in H \ X. Now suppose that u, v ∈ A. If B ⊆ V (K) then all edges between A and B in G \ X are in Γ. Let P be a path in G[A] linking u to v. (Note that the path P possibly consists of a single edge.) Then P is disjoint from V (K), as otherwise P ⊆ Γ and {A∩ V (Γ), B} would be a c-pumpkin-model in Γ. Thus in particular k = 1 and γ = c − 1. Since there are c− 1 extra edges between u and v in H compared to G, and P avoids all these edges, {{u},{v} ∪ (V (P ) \ {u})} is a c-pumpkin-model in H \ X. If B 6⊆ V (K) then B is disjoint from V (K). Since u and v are linked by at least γ ≥ 1 edges in H, the graph H[A \ V (K)] is connected, and it follows that {A \ V (K), B} is a c-pumpkin-model in H \ X. Lemma 4.4. Let c be a fixed positive integer. Suppose H results from the application of Z1 or Z2 on a graph G. Then τc(G) = τc(H). Moreover, every c-hitting set X′ of H is also a c-hitting set of G. (cid:3) This lemma implies that an optimal solution to the Minimum c-Pumpkin-Hitting problem on G can be computed given one for H, and similarly that an approximate solution for G can be obtained from an approximate solution for H. This will be used in our approximation algorithms in Section 4.4. Proof of Lemma 4.4. First suppose H results from the application of Z1 on G with vertex v. We trivially have τc(G) ≥ τc(H). Let X′ be a given c-hitting set of H. If X′ is not a c-hitting set of G, then G\ X′ has a c-pumpkin-model; let {A, B} be a minimal one. We have v ∈ A∪ B since otherwise {A, B} would be a c-pumpkin-model in H \ X′. By the minimality of {A, B}, we must have A ∪ B ⊆ V (K) for some block K of G. But then K is a block of G including v and containing a c-pumpkin-minor, contradicting the assumptions of Z1. Therefore X′ is a c-hitting set of G, and τc(G) ≤ τc(H) also holds, implying τc(G) = τc(H). Now assume H has been obtained by applying Z2 on G with c-outgrowth (K, u, v), and let Γ := Γ(K, u, v). First we show τc(G) ≥ τc(H). Let X be a minimum c-hitting set of G. If u ∈ X or v ∈ X, then X is trivially a c-hitting set of H, so let us assume u, v /∈ X. Moreover, we may suppose that X has no vertex in K, since otherwise we could replace all such vertices with the vertex u (or equivalently v). Since X ⊆ V (G) \ V (Γ) and G \ X has no c-pumpkin-minor, it follows from Lemma 4.2 that H \ X has no c-pumpkin-minor either, that is, X is a c-hitting set of H. This shows τc(G) ≥ τc(H). Now we prove that τc(G) ≤ τc(H) also holds. Here we show that, given a c-hitting set X′ of H, the set X′ is also a c-hitting set of G. Hence, this will also prove the second part of the lemma. If u ∈ X′ or v ∈ X′, then X′ is trivially a c-hitting set of G. If u, v /∈ X′, then Lemma 4.3 implies that G \ X′ has no c-pumpkin-minor, that is, that X′ is a c-hitting set of G. This shows τc(G) ≤ τc(H), and therefore τc(G) = τc(H). (cid:3) HITTING AND HARVESTING PUMPKINS 17 We conclude this section with a lemma similar to Lemma 4.4 for c-packings. Lemma 4.5. Let c be a fixed positive integer. Suppose H results from the application of Z1 or Z2 on a graph G. Then νc(G) = νc(H). Moreover, given a c-packing M′ of H one can compute in polynomial time a c-packing M of G with M = M′. Proof. First suppose H results from the application of Z1 on G with vertex v. Clearly, every c-packing of H is a c-packing for G. Thus νc(G) ≥ νc(H), and it is enough to show the reverse inequality. Consider a c-packing of G. We may assume that every c-pumpkin-model in that packing is minimal. Thus each such model is contained in some block of G, and hence avoids the vertex v. Therefore the packing also exists in H, implying νc(G) ≤ νc(H) and νc(G) = νc(H), as desired. Now assume H has been obtained by applying Z2 on G with outgrowth (K, u, v). First we show νc(G) ≥ νc(H). Let M′ = {M′1, . . . , M′k} be a given c-packing of H. We show that a packing of the same size in G can be computed in polynomial time, which will prove the second part of the lemma. If every M′i avoids at least one of u, v then the packing M := M′ is a c-packing in G and we are done. So assume one model in the collection, say without loss of generality M′1, includes both u and v. Let X be the union of the vertices in M′2, . . . , M′k. Since M′1 is a c-pumpkin-model in H \ X, using Lemma 4.2 we can compute in polynomial time a c-pumpkin-model M1 in G\ X. Hence M := {M1, M′2, . . . , M′k} is a c-packing of the desired size in G. In order to prove νc(G) = νc(H) it remains to show νc(G) ≤ νc(H). Let {M1, . . . , Mk} be a c-packing of G. We may assume that each Mi is minimal. Thus if some Mi contains some vertex of K then Mi contains both u and v. If there is no such model in the packing then {M1, . . . , Mk} is also of c-packing of H and we are done. We may thus assume that some model in the packing, say without loss of generality M1, contains both u and v. As before, let X be the union of the vertices in M2, . . . , Mk. Using Lemma 4.3 with M1 and X we find a c-pumpkin-model M′1 in H \ X. Thus {M′1, M2, . . . , Mk} is a c-packing of size k in H, as desired. (cid:3) 4.2. Hedgehogs. Recall that a graph is said to be a multipath if its underlying simple graph is isomorphic to a path. If P is a multipath and u, v ∈ V (P ), we write uP v for the subgraph of P induced by the vertices on a u -- v path in P (thus edges in uP v have the same multiplicities as in P ). A hedgehog is a pair (H, P ), where H is a graph and P is an induced multipath of H with P ≥ 2 and such that (i) the (possibly empty) set S := V (H) \ V (P ) is a stable set of H; and (ii) every vertex in S has at least two neighbors in P . (Let us recall that a stable set is a set of vertices such that no two of them are adjacent.) Consider a hedgehog (H, P ). Its size is defined as P, the number of vertices in P . A bad cutset of (H, P ) is a set X = {u, v} of two internal vertices of P such that H \ X has a connected component K avoiding both endpoints of P . This definition is motivated by reduction rule Z2: First, if K is such a component, then u and v each have at least one neighbor in K. This is because either K contains the subpath of P strictly between u and v, or K consists of a unique vertex of V (H) \ V (P ) which is then adjacent to u and v (by condition (ii) in the definition of hedgehogs). Hence either (K, u, v) is a c-outgrowth of H, or one can find a c-pumpkin-minor in H[V (K) ∪ {u, v}]. property that A and B both contain an endpoint of P . A rooted c-pumpkin-model of (H, P ) is a c-pumpkin-model {A, B} of H with the extra Given a hedgehog (H, P ) and a connected induced subgraph Q of P with Q ≥ 2, one can define a hedgehog (H′, Q) as follows: First, remove from H every vertex not in P that has no neighbor in Q. Then contract every edge of P not included in Q. 18 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E Figure 5. A hedgehog (H, P ) (left) and a contraction (H′, Q) of (H, P ) (right). The multipaths P and Q are drawn in bold. Finally, remove from the graph every vertex not in Q that has only one neighbor in Q. This defines the graph H′. We leave it to the reader to check that (H′, Q) is indeed a hedgehog; we say that (H′, Q) is the contraction of (H, P ) on the multipath Q. See Figure 5 for an illustration of this operation. The following lemma is a direct consequence of the definition. Lemma 4.6. If (H′, Q) is a contraction of a hedgehog (H, P ) and X is a bad cutset of (H′, Q), then X is also a bad cutset of (H, P ). We show that every big enough hedgehog has a rooted c-pumpkin-model or a bad cutset. This fact will be useful in the subsequent proofs. Lemma 4.7. Let c be a fixed positive integer. Then every hedgehog (H, P ) of size at least (2c)2c contains a rooted c-pumpkin-model or a bad cutset, either of which can be found in polynomial time. Proof. The proof is by induction on c. The base case c = 1 is trivial since P directly gives a rooted 1-pumpkin-model. For the inductive step, assume c > 1. Define f (k), for a positive integer k, as f (k) := (2k)2k. Let S := V (H)\ V (P ). Let a, b be the endpoints of P . If a vertex v ∈ S has at least c neighbors in P , then let w be the neighbor of v that is closest to a on P . Then A := V (aP w)∪{v} and B := V (P )\ A both induce a connected subgraph of H. Moreover, there are at least c − 1 edges from v to B, and at least one from A \ {v} to B (because of P ). Since a ∈ A and b ∈ B, we deduce that {A, B} is a rooted c-pumpkin-model of (H, P ). Thus we may assume that every vertex in S has at most c − 1 neighbors in P . In particular we have c ≥ 3, since every vertex in S has at least two neighbors in P . The multipath P , seen from its endpoint a, induces a natural linear ordering of the neighbors of a given vertex in S; we say that two such neighbors are consecutive if they are consecutive in that ordering. Suppose that there exists a vertex v ∈ S with two consecutive neighbors x, y such that xP y ≥ f (c − 1) + 2. Consider the contraction (H′, Q) of (H, P ) on the multipath Q := xP y \ {x, y}. Since Q ≥ f (c − 1), by induction (H′, Q) has a rooted (c − 1)- pumpkin-model {A′, B′} or a bad cutset X. If the latter holds, then by Lemma 4.6 the set X is also a bad cutset of (H, P ) and we are done. Thus we may assume the former holds. In the graph H, the vertex v has no neighbor in Q, thus v is not included in H′. Hence, we can obtain a rooted c-pumpkin-model {A, B} in (H, P ) by setting A := A′ ∪ V (aP x)∪{v} and B := B′∪ V (yP b). Therefore we can assume that, for every vertex v ∈ S, every two consecutive neighbors of v are at distance at most f (c − 1) on P . Let us enumerate the vertices of P in order as p1, p2, . . . , pk, with p1 = a and pk = b. We may assume that, for every i ∈ {3, . . . , k − 2}, (1) pi is adjacent to some vertex in S. HITTING AND HARVESTING PUMPKINS 19 Indeed, if not then {pi−1, pi+1} would be a bad cutset of (H, P ). Since k = P ≥ f (c) ≥ f (3) ≥ 5, this implies in particular that S is not empty. Define an open interval Iv = (i, j) for every vertex v ∈ S, where i (j) is the smallest (largest, respectively) index t such that pt is a neighbor of v in H. (Observe that i < j since v has at least two neighbors.) Now, let G be the interval graph defined by these open intervals, that is, let V (G) := S, and for every two distinct vertices v, w ∈ S, make v adjacent to w in G if and only if Iv ∩ Iw 6= ∅. For a connected subgraph G′ of G, we define I(G′) as the union of the intervals of vertices in G′, that is, I(G′) := S{Iv : v ∈ V (G′)}. Observe that, since G′ is connected, we have I(G′) = (i, j) for some integers i, j with 1 ≤ i < j ≤ k. First suppose that G has at least three connected components. The ordering p1, . . . , pk of the vertices of P induces an ordering of these components; let C, C′, C′′ be three consecutive connected components in that ordering. Let (i, j) := I(C), (i′, j′) := I(C′), and (i′′, j′′) := I(C′′). Then we have 1 ≤ i < j ≤ i′ < j′ ≤ i′′ < j′′ ≤ k, and every vertex of S that is adjacent to some vertex strictly between pi′ and pj ′ on P has all its neighbors in the set {pi′, pi′+1, . . . , pj ′}. Thus, for each w ∈ V (C′), the component K of H − {pi′, pj ′} that contains w avoids both endpoints of P . It follows that {pi′, pj ′} is a bad cutset of (H, P ). Hence, we may assume that G has at most two connected components. Since G has at most two connected components, using (1) we deduce that G has a connected component C with I(C) = (x, y) such that (2) y − x + 1 ≥ P − 4 2 ≥ f (c) − 4 2 . Let Q := pxP py and let (H′, Q) be the contraction of (H, P ) on Q. (Note that possibly Q = P , in which case (H′, Q) = (H, P ).) We will show that (H′, Q) contains a rooted c-pumpkin-model. The lemma will then follow, since such a model can be extended straightforwardly to one of (H, P ). First let us observe that H′ is an induced subgraph of H. This is because, by our choice of Q, every vertex of S that is adjacent to at least two vertices of Q, or to at least one internal vertex of Q, has all its neighbors in Q. Let S′ := V (H′) \ V (Q) = V (C). For a vertex u ∈ S′, let us denote by ℓ(u) and r(u) the two integers such that Iu = (ℓ(u), r(u)). It follows from our assumptions on (H, P ) that, for each u ∈ S′, the vertex u has at most c − 1 neighbors in Q and every two consecutive neighbors of u are at distance at most f (c − 1) on Q. This implies (3) for each u ∈ S′. In H′, the vertices px and py each have at least one neighbor in S′. Let v ∈ S′ be a neighbor of px maximizing r(v), and let w ∈ S′ be a neighbor of py minimizing ℓ(w). Let Z be a shortest v -- w path in the interval graph G; enumerate the vertices of Z as z1, z2, . . . , zm with z1 = v and zm = w. r(u) − ℓ(u) ≤ (c − 2)f (c − 1) By our choice of v, w and the fact that Z is a shortest v -- w path, we have (4) (5) for each j ∈ {1, . . . , m − 1}, and (6) for each j ∈ {1, . . . , m − 2}. ℓ(zj) < ℓ(zj+1) r(zj) < r(zj+1) r(zj) ≤ ℓ(zj+2) 20 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E Figure 6. Illustration of the coloring for d = 2. The vertices in {z1, . . . , z2d} are on top, the path Q at the bottom, and each breakpoint pi of Q is linked to the vertices zj such that j ∈ J(pi). j=1(r(zj) − ℓ(zj)). Hence y − x ≤ 2(c − 2)f (c − 1) (2c)2c − 6 2(c − 2)(2c − 2)2c−2 ≥ c. Since I(Z) = I(C) = (x, y) we have y ≤ x + Pm m(c − 2)f (c − 1) by (3). Using (2) we then obtain = (7) f (c) − 6 m ≥ y − x (c − 2)f (c − 1) ≥ Let d := ⌊m/2⌋. Define, for i ∈ {x, . . . , y}, the set J(pi) as the set of indices j ∈ {1, . . . , 2d} such that i ∈ {ℓ(zj), r(zj)} (let us emphasize that the latter set is not an interval but just a 2-element set). We say that pi is a breakpoint of Q if J(pi) is not empty. (Thus px is a breakpoint in particular.) It is a consequence of (4), (5), and (6) that, if J(pi) > 1, then J(pi) = {j, j + 2} for some j ∈ {1, . . . , 2d − 2}. In particular, the numbers in J(pi) always have the same parity. We color the vertices in V (Q) ∪ {z1, . . . , z2d} in black or white as follows. First, for every j ∈ {1, . . . , 2d}, color zj black if j is odd, white if j is even. Next color every breakpoint pi of Q with the color corresponding to the parity of the numbers in J(pi) (namely, black for odd and white for even). Finally, color every uncolored vertex of Q with the color of the closest breakpoint of Q in the direction of px. See Figure 6 for an illustration of the coloring. Let A and B be the set of black and white vertices, respectively. By construction, px ∈ A and py ∈ B, and each of A, B induces a connected subgraph of H′. Moreover, there are 2d + 1 ≥ m ≥ c edges of Q whose endpoints received distinct colors. It follows that {A, B} is a rooted c-pumpkin-model of (H′, Q), as desired. We have shown that (H, P ) always has a rooted c-pumpkin-model or a bad cutset. Moreover, it is easily seen from the proof given above that each of these can be found in polynomial time. This concludes the proof of the lemma. (cid:3) We note that no effort has been made in order to optimize the constants in Lemma 4.7. 4.3. Small pumpkins in reduced graphs. Our goal is to prove that every n-vertex c-reduced graph G has a c-pumpkin-model of size O(log n), where c is a fixed constant. We will use the following recent result by Fiorini et al. [19] about the existence of small minors in simple graphs with large average degree. Theorem 4.8 (Fiorini et al. [19]). There is a function h such that every n-vertex simple graph G with average degree at least 2t contains a Kt-model with at most h(t) · log n vertices. Moreover, such a model can be computed in polynomial time. Since a Kt-model in a graph directly gives a c-pumpkin-model of the same size for c = (⌊t/2⌋)2, we have the following corollary from Theorem 4.8, which is central in the proof of Lemma 4.10. Corollary 4.9. There is a function h such that every n-vertex simple graph G with average degree at least 22√c+1 contains a c-pumpkin-model with at most h(c) · log n vertices. Moreover, such a model can be computed in polynomial time. HITTING AND HARVESTING PUMPKINS 21 The next lemma states the existence of small c-pumpkin-models in a c-reduced graph G. Its proof relies on Lemma 4.7 on hedgehogs and Corollary 4.9. The proof can be briefly summarized as follows. An hedgehog in G which is large enough so that Lemma 4.7 can be applied to it, but at the same time not too big, witnesses the existence of either a small c-pumpkin-model or a c-outgrowth. Hence we may assume that no such hedgehog exists in G. The latter fact is then used to either find directly a small c- pumpkin-model, or a dense-enough minor that is not "too far" from G in the sense that it is obtained by contracting disjoint connected subgraphs of G of bounded radius. In the latter case, we apply Corollary 4.9 on the minor, yielding a small c-pumpkin-model which we then lift back to G, incurring only a constant-factor increase in its size. Lemma 4.10. There is a function f such that every n-vertex c-reduced graph G contains a c-pumpkin-model of size at most f (c)· log n. Moreover, such a model can be computed in polynomial time. Proof. Let k := c2 l22√c+1m r := (2c)2ck b := kr. We will prove the lemma with f defined as f (c) := max{krb, 3rc · h(c)}, where h is the function in Corollary 4.9. Throughout the proof, a c-pumpkin-model of G is said to be small if it has the required size, that is, if it has at most f (c) log n vertices. Recall that µ(G) denotes the maximum multiplicity of any edge in G. The lemma trivially holds if µ(G) ≥ c, so we may assume µ(G) < c. Let W be the (possibly empty) subset of vertices of G having degree at least k. We build a collection P of vertex-disjoint induced subgraphs of G\W , each isomorphic to a multipath on r vertices. Initially, we let P := ∅ and G′ := G \ W . Then, as long as G′ has a connected component C with diameter at least r−1, we do the following: First, we consider two vertices at distance r − 1 in C and compute a shortest path Q between these two vertices. Note that the subgraph P of G induced by V (Q) is a multipath on r vertices. Next, we add P to P. Finally, we remove from G′ the r vertices in P . When the above procedure is finished, every connected component of G′ has diam- eter less than r − 1 and maximum degree less than k. Hence each such component has bounded size: at most kr = b vertices. Let C denote the collection of connected components of G′. An illustration of the sets W , P, and C in the graph G is given in Figure 7. If some subgraph C ∈ C contains a c-pumpkin-model, then the size of the model is at most C ≤ b ≤ f (c) ≤ f (c) log n, and we are done. (Note that n ≥ 2 since the model has at least two vertices.) Thus we may assume that no subgraph C ∈ C contains a c-pumpkin-minor. Let J be the graph obtained from G by contracting each subgraph C ∈ C into a single vertex vC. Consider a subgraph C ∈ C. We cannot have deg∗J (vC ) = 0, because otherwise we could have applied Z1 on any vertex of C in G (since C has no c-pumpkin- If deg∗J (vC ) = 1, then let v be an arbitrary vertex of C, and let w be the minor). unique vertex in V (G) \ V (C) having a neighbor in V (C) in the graph G. Since Z1 cannot be applied on G with vertex v, there is a block B of G that includes v and containing a c-pumpkin-model. Since V (B) ⊆ V (C) ∪ {w}, this model has size at most B ≤ b + 1 ≤ f (c), that is, we have found a small c-pumpkin-model of G. Therefore, 22 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E ≥ k W C { r P Figure 7. The sets W , P, and C in the graph G. we may assume deg∗J (vC) ≥ 2 (8) for every C ∈ C. Let K be the graph obtained from J by contracting each subgraph P ∈ P into a If two vertices of K are linked by at least c parallel edges (note single vertex vP . that these two vertices cannot correspond to two components of C, as no such two components are adjacent), then we directly find a c-pumpkin-model in G of size at most max{b + 1, r + 1, 2r, b + r} ≤ f (c). Thus we may assume (9) µ(K) < c. deg∗K(vC ) = 1, and good otherwise. We have deg∗K(vC ) ≥ 1 for every C ∈ C. Let us say that a subgraph C ∈ C is bad if We color the vertices of each multipath P ∈ P as follows: a vertex v ∈ V (P ) is colored black if, in the graph G, all its neighbors outside P belong to bad subgraphs of C; the vertex v is colored white otherwise. (We remark that v could possibly have no neighbor outside P , in which case v is colored black by our definition.) Claim 4. If some multipath P ∈ P contains (2c)2c consecutive black vertices, then one can find a small c-pumpkin-model in G. Proof. Let Q be the subgraph of P induced by these (2c)2c black vertices. Let C′ be the subset of subgraphs C ∈ C such that vC is adjacent to an internal vertex of Q in the graph J. Let S := {vC : C ∈ C′}. Since all vertices of Q are colored black, it follows that internal vertices of Q are only adjacent in J to vertices in V (P )∪ S, and that every subgraph C ∈ C′ is bad. Let H be the graph obtained from J[V (P ) ∪ S] by contracting every edge of P not included in Q. Since every subgraph C ∈ C′ is bad, it follows from (8) that, in H, every vertex in S has at least two neighbors in Q. Hence (H, Q) is a hedgehog of size Q = (2c)2c. The graph H is a minor of the subgraph G∗ of G induced by V (P ) ∪ [{V (C) : C ∈ C′}. HITTING AND HARVESTING PUMPKINS 23 Since vertices of P have degree at most k in G and C ≤ b for every C ∈ C′, we have (10) We claim that G∗ contains a c-pumpkin-minor. By (10), such a minor directly yields a small c-pumpkin-model of G. Arguing by contradiction, assume G∗ has no c-pumpkin- minor. Thus H has no c-pumpkin-minor either. G∗ ≤ r + r(k − 1)b ≤ f (c). Applying Lemma 4.7 on (H, Q), we obtain either a bad cutset X of (H, Q) or a c- pumpkin-model of H. The latter case cannot happen since H has no c-pumpkin-minor, so assume the former holds and let {u, v} := X. Consider a connected component T of H \ X that avoids both endpoints of Q. Let Z be the subgraph of G induced by (V (T ) ∩ V (Q)) ∪ S{V (C) : vC ∈ V (T )}. It follows from the definition of H and our choice of T that Z is a connected component of G \ X such that u and v are both adjacent to some vertex in Z. Since G∗ has no c-pumpkin-minor, it follows that (Z, u, v) is a c-outgrowth of G. But this implies that we could have applied Z2 on G with the c-outgrowth (Z, u, v), a contradiction. (cid:3) By Claim 4, we may assume that, for every P ∈ P, the number w(P ) of white vertices in P satisfies (11) w(P ) ≥ r (2c)2c = k. Our aim now is to use (11) to define a minor of K with large minimum degree. First, for every good subgraph C ∈ C, "assign" vC to an arbitrary neighbor of vC in K. Next, for every w ∈ W , contract all edges vCw of K into the vertex w for all vertices vC assigned to w. Similarly, for every P ∈ P, contract all edges vC vP into the vertex vP for all vertices vC assigned to vP . Finally, remove the vertex vC for every bad subgraph C ∈ C. The resulting graph is denoted L. For every vertex of L there is a natural induced subgraph of G that corresponds to it, namely the subgraph defined by all the edges that were contracted into w. Let Sw and SP be the (induced) subgraph of G that corresponds to the vertex w ∈ W and vP (P ∈ P) of L, respectively. The subgraphs Sw (w ∈ W ) and SP (P ∈ P) of G have diameter at most 2r and 3r, respectively. Thus, by Lemma 2.1, a c-pumpkin-model of L of size q can be turned into one of G of size at most 3rc · q. Hence, in order to conclude the proof, it is enough to find a c-pumpkin-model in L of size at most h(c) log L, since h(c) log L ≤ f (c) 3rc log L ≤ f (c) 3rc log n. To do so, we will show that L has large minimum degree. First consider a vertex w ∈ W , and note that degK (w) = degG(w) ≥ k. Let a be the number of edges incident with w in K such that the other endpoint is a vertex of the form vC (C ∈ C) that was assigned to w. By (8), w cannot be adjacent in K to a vertex vC corresponding to a bad subgraph C ∈ C. Thus, it follows from the definitions of good subgraphs and L that degL(w) ≥ a µ(K) + (degK(w) − a). a (The µ(K) term above comes from the fact that each vertex vC that was assigned to w contributes at least one to the degree of w in L, while in K there were at most µ(K) edges between vC and w.) Using (9) we obtain (12) degL(w) > a c + (degK(w) − a) ≥ degK (w) c k c . ≥ Now consider a multipath P ∈ P. Let a′ be the number of edges incident with vP in K such that the other endpoint is a vertex of the form vC (C ∈ C) that was assigned to 24 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E vP . Let b′ be the number of edges incident with vP in K that are not of the previous form and also not incident with a vertex vC such that C is bad. By the definition of white vertices, we have a′ + b′ ≥ w(P ) (recall that w(P ) is the number of white vertices in P ). Using (11), it follows (13) degL(vP ) ≥ a′ µ(K) + b′ > a′ c + b′ ≥ w(P ) c ≥ k c . It follows from (12) and (13) that L has minimum degree at least k/c. If µ(L) ≥ c, then L has a c-pumpkin-model of size two and we are trivially done, so let us assume µ(L) < c. Then the underlying simple graph L′ of L has minimum degree at least k/c2 ≥ 22√c+1. Using Corollary 4.9 on L′, we find a c-pumpkin-model in L of the desired size, that is, of size at most h(c) log L. Therefore, a small c-pumpkin-model of G can be found in polynomial time. Finally, we note that each step of the proof can easily be realized in polynomial time. (cid:3) 4.4. Algorithmic consequences. Lemma 4.10 can be used to obtain O(log n)- approximation algorithms for both the Minimum c-Pumpkin-Hitting and the Maxi- mum c-Pumpkin-Packing problems for every fixed c ≥ 1, as we now show. Algorithm 1 A O(log n)-approximation algorithm. INPUT: An arbitrary graph G OUTPUT: A c-packing M of G and a c-hitting set X of G s.t. X ≤ (f (c) log G)·M M ← ∅; X ← ∅ If G ≤ 1: Return M, X /* G cannot have a c-pumpkin-minor */ Else: If G is not c-reduced: Else: Apply a reduction rule on G, giving a graph H Call the algorithm on H, giving a packing M′ and a c-hitting set X′ of H Compute using Lemma 4.1(b) a c-packing M of G with M = M′ Compute using Lemma 4.1(a) a c-hitting set X of G with X ≤ X′ Return M, X Compute using Lemma 4.10 a c-pumpkin-model M = {A, B} of G with H ← G \ (A ∪ B) Call the algorithm on H, giving a packing M′ and a c-hitting set X′ of H M ← M′ ∪ {M} X ← X′ ∪ A ∪ B Return M, X A ∪ B ≤ f (c) log G Theorem 4.11. Given an n-vertex graph G, a O(log n)-approximation for both the Minimum c-Pumpkin-Hitting and the Maximum c-Pumpkin-Packing problems on G can be computed in polynomial time using Algorithm 1, for any fixed integer c ≥ 1. Proof. Consider Algorithm 1, where f is the function in Lemma 4.10. We will show that this algorithm provides a O(log n)-approximation for the two problems under consider- ation. It should be clear that the collection M returned by Algorithm 1 is a c-packing of G, and similarly that the set X is a c-hitting set of G. Thus it is enough to show that they satisfy X ≤ (f (c) log G) · M as claimed in the description of the algorithm. Indeed, since M ≤ νc(G) ≤ τc(G) ≤ X and f (c) is a constant depending only on c, this HITTING AND HARVESTING PUMPKINS 25 implies that the approximation factor of Algorithm 1 is O(log n) for both the Minimum c-Pumpkin-Hitting and the Maximum c-Pumpkin-Packing problems. We prove the inequality X ≤ (f (c) log G)·M by induction on G. The inequality If G is not c-reduced, then by induction the packing M′ and the c-hitting set X′ of is obviously true in the base case, namely when G ≤ 1, so let us assume G > 1. H considered by the algorithm satisfy X′ ≤ (f (c) log H) · M′, and we obtain X ≤ X′ ≤ (f (c) log H) · M′ = (f (c) log H) · M ≤ (f (c) log G) · M as desired. If G is c-reduced, then by induction the packing M′ and the c-hitting set X′ of H satisfy X′ ≤ (f (c) log H) · M′, and we have X = X′ + A ∪ B ≤ (f (c) log H) · M′ + f (c) log G ≤ (f (c) log G) · (M′ + 1) = (f (c) log G) · M. Thus X ≤ (f (c) log G) · M holds in all cases. of the algorithm, which implies that its running time is polynomial in n. Finally, we observe that there are at most n recursive calls during the whole execution (cid:3) 5. Concluding remarks On the one hand, we provided an FPT algorithm running in time 2O(k)·nO(1) deciding, for any fixed c ≥ 1, whether all c-pumpkin-models of a given graph can be hit by at most k vertices. In our algorithms we used protrusions but it may be possible to avoid it by further exploiting the structure of the graphs during the iterative compression routine (for example, a graph excluding the 3-pumpkin is a forest of cacti). We did not focus on optimizing the constants involved in our algorithms; it may be worth doing it, as well as enumerating all solutions, in the same spirit of [23] for Feedback Vertex Set. It is natural to ask whether there exist faster algorithms for sparse graphs. Also, it would be interesting to have lower bounds for the running time of parameterized algorithms for this problem, in the spirit of those recently provided in [28]. One could as well consider other containment relations, like topological minor, induced minor, or contraction minor. A more difficult problem seems to find single-exponential algorithms for the problem of deleting at most k vertices from a given graph so that the resulting graph has tree- width bounded by some constant c. Note that the case c = 0 (resp. c = 1) corresponds to p-Vertex Cover (resp. p-Feedback Vertex Set). Very recently, this problem has been solved for c = 2 [25], the cases c ≥ 3 being still open. One could also consider the parameterized version of packing disjoint c-pumpkin-models, as it has been done for c = 2 in [6]. On the other hand, we provided a O(log n)-approximation for the problems of packing the maximum number of vertex-disjoint c-pumpkin-models, and hitting all c-pumpkin- models with the smallest number of vertices. It may be possible that the hitting version admits a constant-factor approximation; so far, such an algorithm is only known for c ≤ 3. As mentioned in the introduction, for the packing version there is a lower bound of Ω(log1/2−ε n) on the approximation ratio (under reasonable complexity-theoretic as- sumptions). In fact, this lower bound applies to both the vertex-disjoint packing and the edge-disjoint packing [22]. For c = 2, the problem of packing a maximum number of edge-disjoint cycles admits a O(√log n)-approximation, whereas up to date O(log n) is 26 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E the best approximation ratio known for vertex-disjoint cycles [26]. Therefore, one might expect to get better approximation algorithms for packing edge-disjoint c-pumpkin- models. Our algorithms use as subroutines some steps that are only of theoretical interest. For instance, the FPT algorithm of Section 3 uses a protrusion replacement rule that involves huge constants, and in the whole paper we repeatedly use Courcelle's theorem [12] to test for the existence of a c-pumpkin-model in graphs of bounded treewidth. Turning these steps into routines involving reasonable constants is worth investigating. Finally, a class of graphs H has the Erdos-P´osa property if there exists a function f such that, for every integer k and every graph G, either G contains k vertex-disjoint subgraphs each isomorphic to a graph in H, or there is a set S ⊆ V (G) of at most f (k) vertices such that G \ S has no subgraph in H. Given a connected graph H, let M(H) be the class of graphs that can be contracted to H. Robertson and Seymour [31] proved that M(H) satisfies the Erdos-P´osa property if and only if H is planar. Therefore, for every c ≥ 1, the class of graphs that can be contracted to the c-pumpkin satisfies the Erdos-P´osa property. But the best known function f is super-exponential (see [15]), so it would be interesting to find a better function for this case. The only known lower bound on f is Ω(k log k) when c ≥ 2, which follows from the Ω(k log k) lower bound given by Erdos and P´osa in their seminal paper [17] for c = 2. Acknowledgement. We would like to thank the anonymous referees for helpful re- marks that improved the presentation of the article. References [1] V. Bafna, P. Berman, and T. Fujito. A 2-approximation algorithm for the undirected feedback vertex set problem. SIAM Journal on Discrete Mathematics, 12(3):289 -- 297, 1999. [2] R. Balasubramanian, M. Fellows, and V. Raman. An improved fixed parameter algorithm for Vertex Cover. Information Processing Letters, 65:163 -- 168, 1998. [3] A. Becker and D. Geiger. Optimization of pearl's method of conditioning and greedy-like approxi- mation algorithms for the vertex feedback set problem. Artificial Intelligence, 83:167 -- 188, 1996. [4] H. L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM Journal on Computing, 25(6):1305 -- 1317, 1996. [5] H. L. Bodlaender, F. V. Fomin, D. Lokshtanov, E. Penninkx, S. Saurabh, and D. M. Thilikos. (Meta) Kernelization. In Proc. of the 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 629 -- 638, 2009. [6] H. L. Bodlaender, S. Thomass´e, and A. Yeo. Kernel bounds for disjoint cycles and disjoint paths. Theoretical Computer Science, 412(35):4570 -- 4578, 2011. [7] H. L. Bodlaender, J. van Leeuwen, R. B. Tan, and D. M. Thilikos. On interval routing schemes and treewidth. Information and Computation, 139(1):92 -- 109, 1997. [8] Y. Cao, J. Chen, and Y. Liu. On feedback vertex set new measure and new structures. In Proc. of the 12th Scandinavian Symposium and Workshops on Algorithm Theory (SWAT), volume 6139 of LNCS, pages 93 -- 104, 2010. [9] J. Chen, B. Chor, M. Fellows, X. Huang, D. W. Juedes, I. A. Kanj, and G. Xia. Tight lower bounds for certain parameterized NP-hard problems. Information and Computation, 201(2):216 -- 231, 2005. [10] J. Chen, I. A. Kanj, and G. Xia. Improved upper bounds for vertex cover. Theoretical Computer Science, 411(40-42):3736 -- 3756, 2010. [11] J. Chen, Y. Liu, S. Lu, B. O'Sullivan, and I. Razgon. A fixed-parameter algorithm for the directed feedback vertex set problem. In Proc. of the 40th Annual ACM Symposium on Theory of Computing (STOC), pages 177 -- 186, 2008. [12] B. Courcelle. The monadic second-order logic of graphs III: tree-decompositions, minor and com- plexity issues. ITA, 26:257 -- 286, 1992. [13] M. Cygan, J. Nederlof, M. Pilipczuk, M. Pilipczuk, J. M. M. van Rooij, and J. O. Wojtaszczyk. Solving Connectivity Problems Parameterized by Treewidth in Single Exponential Time. In Proc. of the 52nd Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 150 -- 159, 2011. HITTING AND HARVESTING PUMPKINS 27 [14] F. K. H. A. Dehne, M. R. Fellows, M. A. Langston, F. A. Rosamond, and K. Stevens. An O(2O(k)n3) FPT Algorithm for the Undirected Feedback Vertex Set Problem. Theory of Computing Systems, 41(3):479 -- 492, 2007. [15] R. Diestel. Graph Theory, volume 173. Springer-Verlag, 2005. [16] R. G. Downey and M. R. Fellows. Parameterized complexity. Springer-Verlag, 1999. [17] P. Erdos and L. P´osa. On independent circuits contained in a graph. Canadian Journal of Mathe- matics, 17:347 -- 352, 1965. [18] S. Fiorini, G. Joret, and U. Pietropaoli. Hitting Diamonds and Growing Cacti. In Proc. of the 14th International Conference on Integer Programming and Combinatorial Optimization (IPCO), volume 6080 of LNCS, pages 191 -- 204, 2010. [19] S. Fiorini, G. Joret, D. O. Theis, and D. R. Wood. Small minors in dense graphs. European Journal of Combinatorics, 33(6):1226 -- 1245, 2012. [20] F. V. Fomin, S. Gaspers, D. Kratsch, M. Liedloff, and S. Saurabh. Iterative compression and exact algorithms. Theoretical Computer Science, 411(7-9):1045 -- 1053, 2010. [21] F. V. Fomin, D. Lokshtanov, N. Misra, G. Philip, and S. Saurabh. Hitting forbidden minors: Ap- proximation and Kernelization. In Proc. of the 28th Symposium on Theoretical Aspects of Computer Science (STACS), volume 9 of LIPIcs, pages 189 -- 200, 2011. [22] Z. Friggstad and M. Salavatipour. Approximability of packing disjoint cycles. Algorithmica, 60:395 -- 400, 2011. [23] J. Guo, J. Gramm, F. Huffner, R. Niedermeier, and S. Wernicke. Compression-based fixed- parameter algorithms for feedback vertex set and edge bipartization. Journal of Computer and System Sciences, 72(8):1386 -- 1396, 2006. [24] R. Impagliazzo, R. Paturi, and F. Zane. Which problems have strongly exponential complexity? Journal of Computer and System Sciences, 63(4):512 -- 530, 2001. [25] E. J. Kim, C. Paul, and G. Philip. A Single-Exponential FPT Algorithm for the K4-Minor Cover Problem. In Proc. of the 13th Scandinavian Symposium and Workshops on Algorithm Theory (SWAT), volume 7357 of LNCS, pages 119 -- 130, 2012. [26] M. Krivelevich, Z. Nutov, M. R. Salavatipour, J. Yuster, and R. Yuster. Approximation algorithms and hardness results for cycle packing problems. ACM Transactions on Algorithms, 3(4), 2007. [27] M. Lampis. Algorithmic meta-theorems for restrictions of treewidth. Algorithmica, 64(1):19 -- 37, 2012. [28] D. Lokshtanov, D. Marx, and S. Saurabh. Known Algorithms on Graphs of Bounded Treewidth are Probably Optimal. In Proc. of the 22nd annual ACM-SIAM Symposium on Discrete algorithms (SODA), pages 777 -- 789, 2011. [29] B. A. Reed, K. Smith, and A. Vetta. Finding odd cycle transversals. Operations Research Letters, 32(4):299 -- 301, 2004. [30] N. Robertson and P. Seymour. Graph Minors. XIII. The Disjoint Paths Problem. Journal of Com- binatorial Theory, Series B, 63(1):65 -- 110, 1995. [31] N. Robertson and P. D. Seymour. Graph Minors. V. Excluding a Planar Graph. Journal of Com- binatorial Theory, Series B, 41(1):92 -- 114, 1986. D´epartement d'Informatique Universit´e Libre de Bruxelles Brussels, Belgium E-mail address: [email protected] AlGCo project-team CNRS, LIRMM Montpellier, France E-mail address: {paul,sau}@lirmm.fr Laboratoire LIP Universit´e de Lyon, CNRS, ENS Lyon, INRIA, UCBL Lyon, France E-mail address: [email protected] 28 G. JORET, C. PAUL, I. SAU, S. SAURABH, AND S. THOMASS´E The Institute of Mathematical Sciences Chennai, India E-mail address: [email protected]
1804.06515
1
1804
2018-04-18T00:39:09
Faster Evaluation of Subtraction Games
[ "cs.DS", "math.NT" ]
Subtraction games are played with one or more heaps of tokens, with players taking turns removing from a single heap a number of tokens belonging to a specified subtraction set; the last player to move wins. We describe how to compute the set of winning heap sizes in single-heap subtraction games (for an input consisting of the subtraction set and maximum heap size $n$), in time $\tilde O(n)$, where the $\tilde O$ elides logarithmic factors. For multi-heap games, the optimal game play is determined by the nim-value of each heap; we describe how to compute the nim-values of all heaps of size up to~$n$ in time $\tilde O(mn)$, where $m$ is the maximum nim-value occurring among these heap sizes. These time bounds improve naive dynamic programming algorithms with time $O(n|S|)$, because $m\le|S|$ for all such games. We apply these results to the game of subtract-a-square, whose set of winning positions is a maximal square-difference-free set of a type studied in number theory in connection with the Furstenberg-S\'ark\"ozy theorem. We provide experimental evidence that, for this game, the set of winning positions has a density comparable to that of the densest known square-difference-free sets, and has a modular structure related to the known constructions for these dense sets. Additionally, this game's nim-values are (experimentally) significantly smaller than the size of its subtraction set, implying that our algorithm achieves a polynomial speedup over dynamic programming.
cs.DS
cs
Faster Evaluation of Subtraction Games David Eppstein1 Computer Science Department, University of California, Irvine [email protected] Abstract Subtraction games are played with one or more heaps of tokens, with players taking turns re- moving from a single heap a number of tokens belonging to a specified subtraction set; the last player to move wins. We describe how to compute the set of winning heap sizes in single-heap subtraction games (for an input consisting of the subtraction set and maximum heap size n), in time O(n), where the O elides logarithmic factors. For multi-heap games, the optimal game play is determined by the nim-value of each heap; we describe how to compute the nim-values of all heaps of size up to n in time O(mn), where m is the maximum nim-value occurring among these heap sizes. These time bounds improve naive dynamic programming algorithms with time O(nS), because m ≤ S for all such games. We apply these results to the game of subtract-a- square, whose set of winning positions is a maximal square-difference-free set of a type studied in number theory in connection with the Furstenberg–Sárközy theorem. We provide experimental evidence that, for this game, the set of winning positions has a density comparable to that of the densest known square-difference-free sets, and has a modular structure related to the known constructions for these dense sets. Additionally, this game's nim-values are (experimentally) sig- nificantly smaller than the size of its subtraction set, implying that our algorithm achieves a polynomial speedup over dynamic programming. 2012 ACM Subject Classification Theory of computation → Design and analysis of algorithms Keywords and phrases subtraction games, Sprague–Grundy theory, nim-values Digital Object Identifier 10.4230/LIPIcs.FUN.2018.20 1 Introduction Subtraction games were made famous by the French film L'Année dernière à Marienbad (1961), which showed repeated scenes of two men playing Nim. A subtraction game is played by two players, with some heaps of game tokens (such as coins, stones, or, in the film, matchsticks) between them. On each turn, a player may take away a number of tokens from a single heap. The tokens removed in each turn are discarded, and play continues until all the tokens are gone. Under the normal winning convention, the last player to move is the winner [2]. In Nim, any number of tokens may be removed in a turn. This game has a simple analysis according to which it is a winning move to make the bitwise exclusive-or of the binary representations of the heap sizes become zero. If this bitwise exclusive-or is already zero, the player who just moved already has a winning position [4]. However, other subtraction games require the number of removed tokens to belong to a predetermined set of numbers, the subtraction set of the game. Different subtraction sets lead to different games with different strategies.2 1 Supported in part by NSF grants CCF-1618301 and CCF-1616248. 2 Golomb [7] has considered an even more general class of games, in which the subtraction set specifies combinations of numbers of tokens that may be simultaneously removed from each pile. 8 1 0 2 r p A 8 1 ] S D . s c [ 1 v 5 1 5 6 0 . 4 0 8 1 : v i X r a © David Eppstein; licensed under Creative Commons License CC-BY 9th International Conference on Fun with Algorithms (FUN 2018). Editors: Hiro Ito, Stefano Leonardi, Linda Pagli, and Giuseppe Prencipe; Article No. 20; pp. 20:1–20:12 Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 20:2 Faster Evaluation of Subtraction Games All subtraction games are impartial, meaning that the choice of moves on each turn does not depend on who is making the move. As such, with the normal winning convention, these games can be analyzed by the Sprague–Grundy theory, according to which each heap of tokens in a subtraction game has a nim-value, the size of an equivalent heap in the game of Nim [4,8,17]. The optimal play in any such game is to move to make the bitwise exclusive-or of the nim-values zero. The winning positions are the ones in which this bitwise exclusive-or is already zero. Unlike Nim itself, positions with a single nonempty heap of tokens may be winning for the player who just moved; this is true when the nim-value of the heap is zero. The heap sizes whose nim-values are zero are called "cold", while the remaining heap sizes are called "hot". In a game with a single heap of tokens, it is a winning move to take a number of tokens such that the remaining tokens form a cold position. If the position is already cold, the player who just moved already has a winning position, because the player to move must move to a hot position. Every finite subtraction set leads to a game with periodic nim-values (depending only on the sizes of the heaps modulo a fixed number). Some natural choices of infinite subtraction set, such as the prime numbers, also do not lead to interesting subtraction games [7]. However, a more complicated subtraction game, "subtract-a-square", has the square numbers as its subtraction set. That is, on each move, each player may remove any square number of tokens from any single heap of tokens. The game of subtract-a-square was studied in 1966 by Golomb [7], who calls it "remarkably complex"; Golomb credits its invention to Richard A. Epstein.3 Its sequence of nim-values, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 3, 2, 3, 4, 0, . . . (sequence A014586 in the Online Encyclopedia of Integer Sequences, OEIS) displays no obvious patterns. Subtract-a-square has another reason for interest, beyond investigations related to combi- natorial game theory. The set C of cold positions in this game, 0, 2, 5, 7, 10, 12, 15, 17, 20, 22, 34, 39, 44, 52, 57, 62, 65, 67, 72, 85, 95, . . . (sequence A030193 in the OEIS) has the property that no two elements of C differ by a square number. A sequence with this property is called a square-difference-free set. The cold positions of subtract-a-square are square-difference-free because, whenever c is a cold position, and i is a positive integer, c + i2 must be hot, as one could win by moving from c + i2 to c. The square-difference-free sets have been extensively investigated in number theory, following the work of Furstenberg [6] and Sárközy [14], who showed that they have natural density zero. This means that, for all , there exists an N such that, for all n > N, the fraction of positive integers up to n that belong to the set is at most . More strongly, the set C of cold positions in subtract-a-square is a maximal square- difference-free set. Every positive integer that is not in C (a hot position) has a move to a cold position, so it could not be added to C without destroying the square-difference-free property. Every maximal square-difference-free subset of the range [0, n] must have size at √ least Ω( n) (otherwise there would not be enough sums or differences of set elements and squares to prevent the addition of another number in this range)4 and size at most (cid:18) (cid:19) O n (log n) 1 4 log log log log n 3 No relation. 4 See Golomb [7], Theorem 4.1. David Eppstein 20:3 by quantitative forms of the Furstenberg–Sárközy theorem [12]. In particular, these bounds apply to C ∩ [0, n], the number of cold positions of subtract-a-square up to n. However, it is not known whether these upper and lower bounds are tight or where the number of cold positions lies with respect to them. In the densest known maximal square-difference-free sets, the number of elements up to n is Ω(cid:16) n(1+log205 12)/2(cid:17) ≈ n0.733412. The construction for these dense sets involves finding a square-difference-free set modulo some base b, and selecting the numbers whose base-b representation has these values in its even digit positions and arbitrary values in its odd digit positions [13]. The bound given in the formula above comes from applying this method to a square-difference-free set of 12 values modulo 205 [1,10]. Plausibly, a greater understanding of the nim-values of subtract-a-square could lead to progress in this area of number theory. Algorithmically, for a subtraction game in which the allowed moves are to take a number of tokens in a given set S, the nim-values can be computed by dynamic programming, using the recurrence nimvalue(n) = mex i∈S,i≤n nimvalue(n − i). Here, the "mex" operator (short for "minimum excludent" [4]) returns the smallest non- negative integer that cannot be represented by an expression of the given form. No separate base case is needed, because in the base case (when n = 0), the set of available moves (numbers in S that are at most n) is empty and the mex of an empty set of choices is zero. Evaluating this recurrence, for all heap sizes up to a given threshold n, takes time O(nS). The set C of cold positions can be determined within the same time bound, by applying this recurrence and then returning the set of positions whose nim-value is zero. However, in the study of algorithms, many naive dynamic programming algorithms turn out to be suboptimal: they can be improved by more sophisticated algorithms for the same problem. Is that the case for this one? We will see that it is. We provide the following two results: We show how to compute the set of cold positions in a given subtraction game, for heaps of size up to a given threshold n, in time O(n). We show how to compute the nim-values of a given subtraction game, for heaps of size up to a given threshold n, in time O(mn). In these time bounds, the O notation elides logarithmic factors in the time bound, and the parameter m refers to the maximum nim-value of any position within the given range. Ignoring the logarithmic factors hidden in the O notation, our time bounds are always at least as good as the O(nS) time for naive dynamic programming, because for any subtraction game m ≤ S (if there are only S possible moves, the mex of their values can be at most m). But are they actually a significant improvement? To answer this, we need to know how quickly m grows compared to the known growth rate of S. To determine whether our algorithms provide a speedup for the game of subtract-a-square, we performed a sequence of computational experiments to determine the density of this game's cold positions and the growth rate of its largest nim-values. We find experimentally that, up to a given n, the largest nim-value appears to grow as O(n0.35), significantly more slowly than the O(n1/2) growth rate of the subtraction set. The difference in the growth rates for these quantities shows that our algorithms are indeed an asymptotic improvement by a polynomial factor. Additionally, the number of cold positions appears to grow at least FUN 2018 20:4 Faster Evaluation of Subtraction Games as quickly as n0.69. That is, the cold positions of this game provide an unexpectedly large square-difference-free set, competitive with the best theoretical constructions for these sets. Examining the modular structure of the set of cold positions, we find that it appears to be similar to the structure of these theoretical constructions, with a square-difference-free set of digit values in even positions and arbitrary values in odd positions. Algorithms 2 2.1 Subtraction with hotspots In order to evaluate subtraction games efficiently, it will be convenient to generalize them somewhat, to a class of subtraction games with hotspots. Given two sets S and H (of positive and non-negative integers respectively), we define a subtraction game with subtraction set S and hotspot set H as follows. The game starts with a single pile of some number of tokens, and the players alternate in choosing a number from S and removing that number of tokens from the pile, as before. However, if any move leaves a pile whose remaining number of tokens belongs to H, then the player who made that move immediately loses. (This is not quite the same as allowing the other player to remove all the tokens from piles whose size belongs to H, because H might contain the number zero, in which case removing all the tokens could be a losing move instead of a winning move.) The presence of these hotspots makes defining a nim-value for these games problematic: they are not played by the normal winning convention, so what would happen if we played a game with multiple piles and one player moved to a hotspot? Nevertheless, a recurrence of the usual form suffices to determine the set of hot and cold positions of such a game: hot(n) = n ∈ H ∨ _ ¬ hot(n − i). i∈S,i≤n 2.2 Finding the hotspots In a subtraction game (with subtraction set S, with or without hotspots), suppose that some set C of positions has already been determined to be cold. Then all positions H that can reach C in a single move are automatically hot. We can formulate membership in this set of hot positions as a Boolean formula in conjunctive normal form (2-CNF): (i ∈ H) ⇐⇒ _ (j ∈ C) ∧ (k ∈ S). j+k=i Now suppose that C and S are both represented as bitvectors: arrays of binary values that are 0 for non-members and 1 for members of each set. Then the problem of computing the bitvector representation of H from the above formula is a standard problem known as Boolean convolution, studied for its applications in string matching [5,9,11]. It is an instance of a more general class of convolution problems in which we compute C[i] = ⊕ j+k=i A[j] ⊗ B[j] for an "addition" operation ⊕ and "multiplication" operation ⊗. In Boolean convolution, ⊗ is conjunction (∧), and ⊕ is disjunction (∨). If the input bitvectors have total length n, their Boolean convolution can be computed in O(n log n) time by replacing their Boolean values with the numbers 0 and 1 and computing a numerical convolution (with addition as ⊕ and multiplication as ⊗) using the fast Fourier transform algorithm. David Eppstein 20:5 2.3 Divide and conquer We are now ready to describe our algorithm for finding the hot and cold positions of a subtraction game with hotspots. We assume that we are given as input a range [x, y) of integer values to evaluate (following the Python convention for half-open integer ranges where the bottom delimiter is inside the range and the top delimiter is outside it), together with two sets: the subtraction set S and a set H of predetermined hotspots. As a base case, if the range has zero or one values in it, we can solve the problem directly: each value in the range is hot or cold accordingly as it belongs or does not belong to H, respectively. Otherwise, we perform the following steps: 1. Find the midpoint m = (x + y)/2 of the range, and partition the range into the two subranges [x, m) and [m, y). (Hx and Cx respectively). 2. Recursively evaluate the lower subrange [x, m), determining its hot and cold positions 3. Use Boolean convolution to find the positions Hm in the upper subrange [m, y) that are hot because they can be reached in a single step from a cold position Cx in the lower subrange. 4. Recursively evaluate the upper subrange [m, y), with hotspot set H ∪ Hm, determining its hot and cold positions (Hy and Cy respectively). 5. Return the hot set Hx ∪ Hy and cold set Cx ∪ Cy. The time for this algorithm can be analyzed using the master method, as is standard for such divide-and-conquer algorithms, giving the following result: (cid:73) Theorem 1. We can determine which positions are hot and which are cold, in a range of n positions of a subtraction game with hotspots, in time O(n log2 n). 2.4 Nim-values We can reduce the computation of nim-values in a subtraction game to the computation of hot and cold positions in a subtraction game with hotspots, via the following lemma. (cid:73) Lemma 2. Let S be a subtraction set, and let H be the set of positions in the subtraction game for S that have nim-value at most t. Then the positions that have nim-value t + 1 are exactly the cold positions of the subtraction game with hotspots with subtraction set S and hotspot set H. Proof. A position has nim-value t + 1 if it does not belong to H (else it would have a smaller nim-value) and does not have a move to a smaller position with nim-value t + 1 (else t + 1 would not be one of its excluded values). But this is exactly the defining condition for the (cid:74) cold positions of the subtraction game with hotspots. (cid:73) Theorem 3. In any subtraction game with subtraction set S, we can determine the nim- values of the first n positions in time O(mn log2 n), where m is the maximum nim-value of any of these positions. Proof. We loop over the range of nim-values from 0 to s, using Theorem 2 to compute the set of positions having each successive nim-value in time O(n log2 n) per nim-value. The (cid:74) loop terminates when all of the first n positions have been assigned a nim-value. The maximum nim-value of a subtraction game is S, so (except for the logarithmic factors) this time bound compares favorably with a naive O(nS) dynamic programming algorithm for computing the nim-values of each position by finding the minimum excluded value among the other positions reachable from it. FUN 2018 20:6 Faster Evaluation of Subtraction Games Figure 1 The maximum nim-values m seen among the first n positions in subtract-a-square. Experiments 3 To compare the performance of our Boolean convolution based evaluation algorithms to naive algorithms for subtract-a-square, we performed some computational experiments, which we describe here. 3.1 Maximum nim-value Figure 1 plots (on a doubly logarithmic scale) the maximum nim-values m seen among the first n positions in subtract-a-square. Only the positions where a new maximum is attained are included in the plot. We fitted a function of the form cne (a monomial with constant coefficient c and exponent e) to these points, by using Siegel's repeated median estimator [16], a form of robust statistical regression that is insensitive to outliers (as would be expected to occur in the lower left parts of the plot). This estimator fits a line through a sample of points by, for each point, computing the median of the slopes formed by it and the other points, and then choosing the slope of the fit line to be the median of these medians. It similarly chooses the height of the fit line so that it passes above and below an equal number of points. We applied this to the points on our log-log plot, using the mblm library of the R statistical package, which implements this estimator, and then transformed the fit line back to a monomial over the llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll0510152002468log2 nlog2 max nim−valuem = 1.3251885340723 * n**0.350735691549274 David Eppstein 20:7 Figure 2 The number of cold positions among the first n positions in subtract-a-square. original coordinates of the data points. The result is shown in red in the figure. As the figure shows, the maximum nim-value m among the first n positions of subtract-a- square is accurately estimated by a function of the form O(n0.351), well below the O(n0.5) size of the subtraction set for this game. Therefore, we would expect our O(mn log2 n)-time convolution-based algorithm for computing the nim-values of this game to be asymptotically faster than the O(n3/2) time for dynamic programming. However, even if we ignore the different constant factors in the running times of these two algorithms, n needs to be approximately 1026 in order for n1.35 log2 2 n to be smaller than n1.5, so we would not expect this speedup to be applicable to practically relevant ranges of n. Because of the simplicity and relative efficiency of the dynamic programming algorithm for small n, the values in Figure 1 (for n up to 224) were computed by dynamic programming rather than convolution. 3.2 Number of cold positions Our next experiment measures the number of cold positions among the first n positions in subtract-a-square (Figure 2). In order to provide more data points in the lower left part of the log-log plot than would be visible if we used uniform sampling of the range of values of n, the plot of Figure 2 shows the number of cold positions for each value of n that is a perfect cube (that is, for the values 1, 8, 27, 64, . . . ) up to 230. As in the previous experiment, FUN 2018 lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll05101520253005101520log2 nlog2 # coldc = 0.897244337916743 * n**0.698354314248528 20:8 Faster Evaluation of Subtraction Games we fitted a monomial function to these points using Siegel's repeated median estimator. The number of cold positions does not directly affect the time bound for our convolution- based algorithm. However, it does affect the time for a different algorithm, for computing the set of cold positions (but not their nim-values) directly, in any subtraction game. This algorithm is analogous to the sieve of Eratosthenes, which finds prime numbers iteratively, for each one marking off the numbers that are not prime. To compute the cold positions among the first n positions, it performs the following steps: 1. Initialize a Boolean array H of length n (indicating whether each position is hot) to be false in each cell. 2. For each position i from 0 to n, test whether H[i] is still false. If it is, perform the following steps: a. Output i as one of the cold positions. b. For each value s in the subtraction set S, mark i + s as hot by setting H[i + s] to be true. If the set of cold positions up to n is C, and the subtraction set is S, then this sieving algorithm takes time O(C · S). In some subtraction games, C could be as small as n/S, in which case the sieving algorithm would take linear time. However, our experiments show that, for subtract-a-square, C appears to grow more like n0.7, giving the sieving algorithm a running time of approximately n1.2, compared to the O(n log2 n) time bound of the convolution based algorithm. Again ignoring the constant factors in the time bounds, n would need to be approximately 1018 for the convolution-based algorithm to be faster than the sieving algorithm. Because it is simple to code and fast for smaller values of n, the results in Figure 2 were calculated using the sieving algorithm. 3.3 Modularity The high density of cold positions in subtract-a-square is surprising, especially in view of earlier conjectures in the theory of square-difference-free sets that the number of values up to n in such a set could be at most n1/2+o(1) [15]. These conjectures were disproven by finding sets of numbers of a special form: numbers whose radix-b representation, for a carefully chosen base b, use only base-b digits from a square-difference-free set (modulo b) in their even digit positions [1,10,13]. Although the cold positions of subtract-a-square have somewhat lower density than these constructions, they arise more naturally, and it is of interest to investigate their modular structure and compare it to the structure of these other known dense square-difference-free sets. The idea of considering the base-b structure of these positions, for different choices of the base b, also arises from the consideration of a different subtraction game, described by Golomb [7]. This game has as its subtraction set the Moser–de Bruijn sequence 0, 1, 4, 5, 16, 17, 20, 21, 64, 65, 68, 69, . . . of numbers that are sums of distinct powers of four. That is, when written in base 4, the numbers of the subtraction set have only 0 and 1 as their base-4 digits. The nim-value of any position n may be obtained by writing n in base 4, taking each digit modulo 2 (reducing it to 0 or 1), and then reinterpreting the resulting string of 0's and 1's as a binary number. Because of this simple formula for its nim-values, the Moser–de Bruijn subtraction game has both a maximum nim-value and a number of cold positions (among the first n positions) proportional to Θ( n), is comparable to that n). It subtraction set size, also Θ( √ √ David Eppstein 20:9 Figure 3 The distribution of digit values among the three low-order base-5 digits of cold positions (for n < 230) in subtract-a-square. for subtract-a-square. In particular, for this game, convolution is neither asymptotically faster than dynamic programming nor than sieving, although all of these algorithms can be improved by using the formula instead. What makes subtract-a-square so different from the Moser–de Bruijn subtraction game? To approach these questions, we performed more computational experiments studying the distribution of digit values for the cold positions in subtract-a-square, for various bases. This study follows the earlier work of Golomb [7], who observed that the low-order base-5 digits of the cold positions among the first first 20,000 game positions were highly non-uniformly distributed, and of Bush [3], who extended this study to the first 40,000,000 game positions. Figure 3 shows an extension of this study to the first 230 game positions, and to the three low-order base-5 digits of each cold position. As the figure shows, with a few exceptions, the ones digit of the cold positions lies within the square-difference-free set {0, 2} (mod 5). The fives digit shows no significant non-uniformities, but the twentyfives digit is quite non- uniformly distributed, and is possibly heading towards the same square-difference-free set {0, 2} (mod 5). In this way, the cold positions of subtract-a-square appear to be emulating the strategy of the known dense square-difference-free sets [1, 10, 13] of having a square- difference-free set of digits in even digit positions and all possible digits in odd positions modulo a base b. In this case b = 5, and following this strategy perfectly for b = 5 would lead FUN 2018 onesfivestwentyfives0e+002e+054e+056e+058e+05 20:10 Faster Evaluation of Subtraction Games Figure 4 The distribution of digit values among the low-order base-7 and base-13 digits of cold positions (for n < 230) in subtract-a-square. to a set of size nlog10 25 ≈ n0.71534. The slightly slower growth rate of the cold positions in subtract-a-square can be explained by the slow convergence of its higher-order base-5 digits to square-difference-free sets of digits. What about other bases? Figure 4 shows the results of the same experiment (for the low-order digits only) for base 7 and base 13. Because 7 is 3 modulo 4, there are no nontrivial square-difference-free sets modulo 7: every two numbers modulo 7 differ by a square (mod 7). Perhaps because of this, the digit values in base 7 show no significant nonuniformities. However, modulo 13, the squares are 0, ±1, ±3, and ±4. Because 13 is 1 modulo 4, each of the nonzero squares occurs four times among the squares of values mod 13; for instance, ±3 is the square of 4, 6, 7, and 9 (mod 13). As the figure shows, the low-order digits of the base-13 representations of the cold positions in subtract-a-square appear to be converging towards the square-difference-free set {0, 2, 7} (mod 13). Perhaps subtract-a-square implements the modular strategy for finding dense square-difference-free sets in all prime bases (congruent to 1 mod 4) simultaneously? sevens050000100000150000200000250000thirteens0e+001e+052e+053e+054e+05 David Eppstein 4 Conclusions 20:11 We have developed new convolution-based methods for evaluating arbitrary subtraction games (either to determine the set of cold positions or to evaluate the nim-value of each position). Our experiments on the subtract-a-square game show that its maximum nim-value is lower than the theoretical value for games with subtraction sets of the same size, and its number of cold positions is higher than the theoretical value. These results show that, asymptotically, our new algorithms are faster than alternative dynamic programming or sieving approaches for the same problems on this game. However, the breakeven point for the new algorithms is high enough that our convolution-based approach is not yet practical. It would be of interest to develop improved algorithms that are both asymptotically faster and more practical than existing approaches. In an attempt to investigate why the cold positions of subtract-a-square produce a dense square-difference-free set, we investigated the base-b representations of the cold positions for several small prime choices of b. Our tests found significant irregularities in the even positions of these base-b representations, when b is congruent to 1 mod 4. We leave the problem of finding a theoretical explanation for these patterns, and for the density of the cold positions in subtract-a-square, as open for future research. References 1 R. Beigel and W. Gasarch. Square-difference-free sets of size Ω(n0.7334...). Electronic preprint arxiv:0804.4892, 2008. E. R. Berlekamp, J. H. Conway, and R. K. Guy. Subtraction games. Winning Ways for your Mathematical Plays, Vol. I: Games in General, pp. 83–86. Addison-Wesley, 1982. 3 D. Bush. The uniqueness of 11,356. sci.math usenet newsgroup, October 12 1992, https: //www.ics.uci.edu/~eppstein/cgt/subsquare.html. J. H. Conway. Chapter 11: Impartial Games and the Game of Nim. On Numbers and Games, pp. 122–135. Academic Press, 1976. 2 4 5 M. J. Fischer and M. S. Paterson. String-matching and other products. Complexity of com- putation (Proc. SIAM-AMS Appl. Math. Sympos., New York, 1973), pp. 113–125. American Mathematical Society, SIAM-AMS Proceedings 7, 1974, MR0400782. 6 H. Furstenberg. Ergodic behavior of diagonal measures and a theorem of Szemerédi on arithmetic progressions. Journal d'Analyse Mathématique 31:204–256, 1977, doi:10.1007/ BF02813304, MR0498471. S. W. Golomb. A mathematical investigation of games of "take-away". Journal of Combi- natorial Theory 1:443–458, 1966, doi:10.1016/S0021-9800(66)80016-9, MR0209015. P. M. Grundy. Mathematics and games. Eureka 2:6–8, 1939. 8 9 A. Kalai. Efficient pattern-matching with don't cares. Proceedings of the 13th Annual ACM- SIAM Symposium on Discrete Algorithms (SODA '02), pp. 655–656. Society for Industrial and Applied Mathematics, 2002, https://dl.acm.org/citation.cfm?id=545381.545468. 7 11 10 M. Lewko. An improved lower bound related to the Furstenberg-Sárközy theorem. Elec- tronic Journal of Combinatorics 22(1):P1.32, 2015, https://www.combinatorics.org/ojs/ index.php/eljc/article/view/v22i1p32, MR3315474. S. Muthukrishnan and K. Palem. Non-standard stringology: Algorithms and complexity. Proceedings of the 26th Annual ACM Symposium on Theory of Computing (STOC '94), pp. 770–779. ACM, 1994, doi:10.1145/195058.195457. J. Pintz, W. L. Steiger, and E. Szemerédi. On sets of natural numbers whose difference set contains no squares. Journal of the London Mathematical Society (2nd Series) 37(2):219– 231, 1988, doi:10.1112/jlms/s2-37.2.219, MR928519. 12 FUN 2018 20:12 Faster Evaluation of Subtraction Games 13 I. Z. Ruzsa. Difference sets without squares. Periodica Mathematica Hungarica 15(3):205– 209, 1984, doi:10.1007/BF02454169, MR756185. 14 A. Sárkőzy. On difference sets of sequences of integers. I. Acta Mathematica Academiae Sci- entiarum Hungaricae 31(1–2):125–149, 1978, doi:10.1007/BF01896079, https://www.renyi. hu/~p_erdos/1978-19a.pdf, MR0466059. 15 A. Sárközy. On difference sets of sequences of integers. II. Annales Universitatis Scientiarum Budapestinensis de Rolando Eötvös Nominatae 21:45–53, 1978, MR536201. 16 A. F. Siegel. Robust regression using repeated medians. Biometrika 69(1):242–244, 1982, doi:10.1093/biomet/69.1.242. 17 R. P. Sprague. Über mathematische Kampfspiele. Tohoku Math. J 41:438–444, 1935, https://www.jstage.jst.go.jp/article/tmj1911/41/0/41_0_438/_article.
1805.05208
4
1805
2019-08-21T03:40:34
Theoretically Efficient Parallel Graph Algorithms Can Be Fast and Scalable
[ "cs.DS", "cs.DC" ]
There has been significant recent interest in parallel graph processing due to the need to quickly analyze the large graphs available today. Many graph codes have been designed for distributed memory or external memory. However, today even the largest publicly-available real-world graph (the Hyperlink Web graph with over 3.5 billion vertices and 128 billion edges) can fit in the memory of a single commodity multicore server. Nevertheless, most experimental work in the literature report results on much smaller graphs, and the ones for the Hyperlink graph use distributed or external memory. Therefore, it is natural to ask whether we can efficiently solve a broad class of graph problems on this graph in memory. This paper shows that theoretically-efficient parallel graph algorithms can scale to the largest publicly-available graphs using a single machine with a terabyte of RAM, processing them in minutes. We give implementations of theoretically-efficient parallel algorithms for 20 important graph problems. We also present the optimizations and techniques that we used in our implementations, which were crucial in enabling us to process these large graphs quickly. We show that the running times of our implementations outperform existing state-of-the-art implementations on the largest real-world graphs. For many of the problems that we consider, this is the first time they have been solved on graphs at this scale. We have made the implementations developed in this work publicly-available as the Graph-Based Benchmark Suite (GBBS).
cs.DS
cs
Theoretically Efficient Parallel Graph Algorithms Can Be Fast and Scalable LAXMAN DHULIPALA, Carnegie Mellon University GUY E. BLELLOCH, Carnegie Mellon University JULIAN SHUN, MIT CSAIL There has been significant recent interest in parallel graph processing due to the need to quickly analyze the large graphs available today. Many graph codes have been designed for distributed memory or external memory. However, today even the largest publicly-available real-world graph (the Hyperlink Web graph with over 3.5 billion vertices and 128 billion edges) can fit in the memory of a single commodity multicore server. Nevertheless, most experimental work in the literature report results on much smaller graphs, and the ones for the Hyperlink graph use distributed or external memory. Therefore, it is natural to ask whether we can efficiently solve a broad class of graph problems on this graph in memory. This paper shows that theoretically-efficient parallel graph algorithms can scale to the largest publicly- available graphs using a single machine with a terabyte of RAM, processing them in minutes. We give implementations of theoretically-efficient parallel algorithms for 20 important graph problems. We also present the optimizations and techniques that we used in our implementations, which were crucial in enabling us to process these large graphs quickly. We show that the running times of our implementations outperform existing state-of-the-art implementations on the largest real-world graphs. For many of the problems that we consider, this is the first time they have been solved on graphs at this scale. We have made the implementations developed in this work publicly-available as the Graph-Based Benchmark Suite (GBBS). ACM Reference Format: Laxman Dhulipala, Guy E. Blelloch, and Julian Shun. 2019. Theoretically Efficient Parallel Graph Algorithms Can Be Fast and Scalable. 1, 1 (August 2019), 44 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn 1 INTRODUCTION Today, the largest publicly-available graph, the Hyperlink Web graph, consists of over 3.5 billion vertices and 128 billion edges [86]. This graph presents a significant computational challenge for both distributed and shared memory systems. Indeed, very few algorithms have been applied to this graph, and those that have often take hours to run [39, 67, 79], with the fastest times requiring between 1 -- 6 minutes using a supercomputer [122, 123]. In this paper, we show that a wide range of fundamental graph problems can be solved quickly on this graph, often in minutes, on a single commodity shared-memory machine with a terabyte of RAM.1 For example, our k-core implementation takes under 3.5 minutes on 72 cores, whereas Slota et al. [123] report a running time of about 6 minutes for approximate k-core on a supercomputer with over 8000 cores. They also report that they can identify the largest connected component on this graph in 63 seconds, whereas 1These machines are roughly the size of a workstation and can be easily rented in the cloud (e.g., on Amazon EC2). Authors' addresses: Laxman Dhulipala, Carnegie Mellon University, [email protected]; Guy E. Blelloch, Carnegie Mellon University, [email protected]; Julian Shun, MIT CSAIL, [email protected]. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. © 2019 Association for Computing Machinery. XXXX-XXXX/2019/8-ART $15.00 https://doi.org/10.1145/nnnnnnn.nnnnnnn , Vol. 1, No. 1, Article . Publication date: August 2019. Problem Breadth-First Search (BFS) Integral-Weight SSSP (weighted BFS) General-Weight SSSP (Bellman-Ford) Single-Source Widest Path (Bellman-Ford) Single-Source Betweenness Centrality (BC) O(k)-Spanner Low-Diameter Decomposition (LDD) Connectivity Spanning Forest Biconnectivity Strongly Connected Components (SCC)* Minimum Spanning Forest (MSF) Maximal Independent Set (MIS) Maximal Matching (MM) Graph Coloring Approximate Set Cover k-core Approximate Densest Subgraph Triangle Counting (TC) PageRank Iteration (1) 576 3770 4010 3210 2260 2390 980 1640 2420 9860 8130 9520 2190 7150 8920 5320 8515 3780 -- 973 (72h) 8.44 58.1 59.4 48.4 37.1 36.5 16.6 25.0 35.8 165 185 187 32.2 108 158 90.4 184 51.4 1168 13.1 (SU) Alg. Model Work O(m) 68 64 67 66 60 65 59 65 67 59 43 50 68 66 56 58 46 73 -- 74 -- [42] [38] [38] [30] [89] [90] [117] [117] [125] [23] [130] [22] [22] [59] [25] [42] [13] [119] [31] O(m) O(m) O(m) O(m) expected O(m) expected O(m) expected TS PW O(m) expected PW O(diam(G)m) PW O(diam(G)m) FA TS TS TS TS FA PW O(m log n) expected O(diam(G) log n) w.h.p. PW O(m log n) O(m) expected FA PW O(m) expected O(m) FA PW O(m) expected O(m) expected FA O(m) FA O(m3/2) -- O(n + m) FA Depth O(diam(G) log n) O(diam(G) log n) w.h.p.† O(diam(G) log n) O(diam(G) log n) O(diam(G) log n) O(k log n) w.h.p. O(log2 n) w.h.p. O(log3 n) w.h.p. O(log3 n) w.h.p. O(max(diam(G) log n, log3 n)) w.h.p. O(log2 n) O(log2 n) w.h.p. O(log3 m/log log m) w.h.p. O(log n + L log ∆) O(log3 n) w.h.p. O(ρ log n) w.h.p. O(log2 n) O(log n) O(log n) Table 1. Running times (in seconds) of our algorithms on the symmetrized Hyperlink2012 graph where (1) is the single- thread time, (72h) is the 72-core time using hyper-threading, and (SU) is the parallel speedup. Theoretical bounds for the algorithms and the variant of the TRAM used (MM) are shown in the last three columns. We mark times that did not finish in 5 hours with -- . *SCC was run on the directed version of the graph. †We say that an algorithm has O(f (n)) cost with high probability (w.h.p.) if it has O(k · f (n)) cost with probability at least 1 − 1/nk . we can identify all connected components in 25 seconds. Another recent result by Stergiou et al. [124] solves connectivity on the Hyperlink 2012 graph in 341 seconds on a 1000 node cluster with 12000 cores and 128TB of RAM. Compared to this result, our implementation is 13.6x faster on a system with 128x less memory and 166x fewer cores. However, we note that they are able to process a significantly larger private graph that we would not be able to fit into our memory footprint. A more complete comparison between our work and existing work, including both distributed and disk-based systems [39, 41, 60, 67, 79], is given in Section 7. Importantly, all of our implementations have strong theoretical bounds on their work and depth. There are several reasons that algorithms with good theoretical guarantees are desirable. For one, they are robust as even adversarially-chosen inputs will not cause them to perform extremely poorly. Furthermore, they can be designed on pen-and-paper by exploiting properties of the problem instead of tailoring solutions to the particular dataset at hand. Theoretical guarantees also make it likely that the algorithm will continue to perform well even if the underlying data changes. Finally, careful implementations of algorithms that are nearly work-efficient can perform much less work in practice than work-inefficient algorithms. This reduction in work often translates to faster running times on the same number of cores [42]. We note that most running times that have been reported in the literature on the Hyperlink Web graph use parallel algorithms that are not theoretically-efficient. In this paper, we present implementations of parallel algorithms with strong theoretical bounds on their work and depth for connectivity, biconnectivity, strongly connected components, low-diameter decomposition, graph spanners, maximal independent set, maximal matching, graph coloring, breadth-first search, single-source shortest paths, widest (bottleneck) path, betweenness centrality, PageRank, spanning forest, minimum spanning forest, k-core decomposition, approximate set cover, approximate densest subgraph, and triangle counting. We describe the techniques used to achieve good performance on graphs with billions of vertices and hundreds of billions of edges and share experimental results for the Hyperlink 2012 and Hyperlink 2014 Web crawls, the largest and , Vol. 1, No. 1, Article . Publication date: August 2019. second largest publicly-available graphs, as well as several smaller real-world graphs at various scales. Some of the algorithms we describe are based on previous results from Ligra, Ligra+, and Julienne [42, 114, 118], and other papers on efficient parallel graph algorithms [22, 59, 119]. However, most existing implementations were changed significantly in order to be more memory efficient. Several algorithm implementations for problems like strongly connected components, minimum spanning forest, and biconnectivity are new, and required implementation techniques to scale that we believe are of independent interest. We also had to extend the compressed representation from Ligra+ [118] to ensure that our graph primitives for mapping, filtering, reducing and packing the neighbors of a vertex were theoretically-efficient. We note that using compression techniques is crucial for representing the symmetrized Hyperlink 2012 graph in 1TB of RAM, as storing this graph in an uncompressed format would require over 900GB to store the edges alone, whereas the graph requires 330GB in our compressed format (less than 1.5 bytes per edge). We show the running times of our algorithms on the Hyperlink 2012 graph as well as their work and depth bounds in Table 1. To make it easy to build upon or compare to our work in the future, we describe a benchmark suite containing our problems with clear I/O specifications, which we have made publicly-available.2 We present an experimental evaluation of all of our implementations, and in almost all cases, the numbers we report are faster than any previous performance numbers for any machines, even much larger supercomputers. We are also able to apply our algorithms to the largest publicly-available graph, in many cases for the first time in the literature, using a reasonably modest machine. Most importantly, our implementations are based on reasonably simple algorithms with strong bounds on their work and depth. We believe that our implementations are likely to scale to larger graphs and lead to efficient algorithms for related problems. 2 RELATED WORK Parallel Graph Algorithms. Parallel graph algorithms have received significant attention since the start of parallel computing, and many elegant algorithms with good theoretical bounds have been developed over the decades (e.g., [4, 18, 34, 46, 66, 71, 78, 88, 90, 91, 100, 104, 113, 125]). A major goal in parallel graph algorithm design is to find work-efficient algorithms with polylogarithmic depth. While many suspect that work-efficient algorithms may not exist for all parallelizable graph problems, as inefficiency may be inevitable for problems that depend on transitive closure, many problems that are of practical importance do admit work-efficient algorithms [70]. For these prob- lems, which include connectivity, biconnectivity, minimum spanning forest, maximal independent set, maximal matching, and triangle counting, giving theoretically-efficient implementations that are simple and practical is important, as the amount of parallelism available on modern systems is still modest enough that reducing the amount of work done is critical for achieving good per- formance. Aside from intellectual curiosity, investigating whether theoretically-efficient graph algorithms also perform well in practice is important, as theoretically-efficient algorithms are less vulnerable to adversarial inputs than ad-hoc algorithms that happen to work well in practice. Unfortunately, some problems that are not known to admit work-efficient parallel algorithms due to the transitive-closure bottleneck [70], such as strongly connected components (SCC) and single-source shortest paths (SSSP) are still important in practice. One method for circumventing the bottleneck is to give work-efficient algorithms for these problems that run in depth proportional to the diameter of the graph -- as real-world graphs have low diameter, and theoretical models of real-world graphs predict a logarithmic diameter, these algorithms offer theoretical guarantees in 2https://github.com/ldhulipala/gbbs , Vol. 1, No. 1, Article . Publication date: August 2019. practice [23, 110]. Other problems, like k-core are P-complete [6], which rules out polylogarithmic- depth algorithms for them unless P = NC [55]. However, even k-core admits an algorithm with strong theoretical guarantees that is efficient in practice [42]. Parallel Graph Processing Frameworks. Motivated by the need to process very large graphs, there have been many graph processing frameworks developed in the literature (e.g., [53, 77, 81, 93, 114] among many others). We refer the reader to [84, 128] for surveys of existing frameworks. Several recent graph processing systems evaluate the scalability of their implementations by solving problems on massive graphs [39, 42, 67, 79, 122, 124]. All of these systems report running times either on the Hyperlink 2012 graph or Hyperlink 2014 graphs, two web crawls released by the WebDataCommons that are the largest and second largest publicly-available graphs respectively. We describe these recent systems and give a detailed comparison of how our implementations perform compare to their codes in Section 7. Benchmarking Parallel Graph Algorithms. There are a surprising number of existing bench- marks of parallel graph algorithms. SSCA [10], an early graph processing benchmark, specifies four graph kernels, which include generating graphs in adjacency list format, subgraph extraction, and graph clustering. The Problem Based Benchmark Suite (PBBS) [116] is a general benchmark of parallel algorithms that includes 6 problems on graphs (BFS, spanning forest, minimum spanning forest, maximal independent set, maximal matching, and graph separators). The PBBS benchmarks are problem-based in that they are defined only in terms of the input and output without any specification of the algorithm used to solve the problem. We follow the style of PBBS in this paper of defining the input and output requirements for each problem. The Graph Algorithm Platform (GAP) Benchmark Suite [15] specifies 6 kernels for BFS, SSSP, PageRank, connectivity, betweenness centrality, and triangle counting. Several recent benchmarks characterize the architectural properties of parallel graph algorithms. GraphBIG [92] describes 12 applications, including several problems that we consider, like k- core and graph coloring (using the Jones-Plassmann algorithm), but also problems like depth- first search, which are difficult to parallelize, as well as dynamic graph operations. CRONO [3] implements 10 graph algorithms, including all-pairs shortest paths, exact betweenness centrality, traveling salesman, and depth-first search. LDBC [63] is an industry-driven benchmark that selects 6 algorithms that are considered representative of graph processing including BFS, and several algorithms based on label propagation. Unfortunately, all of the existing graph algorithm benchmarks we are aware of restrict their evaluation to small graphs, often on the order of tens or hundreds of millions of edges, with the largest graphs in the benchmarks having about two billion edges. As real-world graphs are frequently several orders of magnitude larger than this, evaluation on such small graphs makes it hard to judge whether the algorithms or results from a benchmark scale to terabyte-scale graphs. 3 PRELIMINARIES Graph Notation. We denote an unweighted graph by G(V , E), where V is the set of vertices and E is the set of edges in the graph. A weighted graph is denoted by G = (V , E, w), where w is a function which maps an edge to a real value (its weight). The number of vertices in a graph is n = V , and the number of edges is m = E. Vertices are assumed to be indexed from 0 to n − 1. For undirected graphs we use N(v) to denote the neighbors of vertex v and deg(v) to denote its degree. For directed graphs, we use in-deg(v) and out-deg(v) to denote the in and out-neighbors of a vertex v. We use diam(G) to refer to the diameter of the graph, or the longest shortest path distance between any vertex s and any vertex v reachable from s. Given an undirected graph G = (V , E) the density of a set S ⊆ V , or ρ(S), is equal to E(S) S where E(S) are the edges in the induced subgraph , Vol. 1, No. 1, Article . Publication date: August 2019. on S. ∆ is used to denote the maximum degree of the graph. We assume that there are no self-edges or duplicate edges in the graph. We refer to graphs stored as a list of edges as being stored in the edgelist format and the compressed-sparse column and compressed-sparse row formats as CSC and CSR respectively. Atomic Primitives. We use three common atomic primitives in our algorithms: test-and-set (TS), fetch-and-add (FA), and priority-write (PW). A test-and-set(&x) checks if x is 0, and if so atomically sets it to 1 and returns true; otherwise it returns false. A fetch-and-add(&x) atomically returns the current value of x and then increments x. A priority-write(&x, v, p) atomically compares v with the current value of x using the priority function p, and if v has higher priority than the value of x according to p it sets x to v and returns true; otherwise it returns false. Model. In the analysis of algorithms we use the following work-depth model, which is closely related to the PRAM but better models current machines and programming paradigms that are asynchronous and allow dynamic forking. We can simulate the model on the CRCW PRAM equipped with the same operations with an additional O(log∗ n) factor in the depth due to load- balancing. Furthermore, a PRAM algorithm using P processors and T time can be simulated in our model with PT work and T depth. The Threaded Random-Access Machine (TRAM) [20] consists of a set of threads that share an unbounded memory. Each thread is basically equivalent to a Random Access Machine -- it works on a program stored in memory, has a constant number of registers, and has standard RAM instructions (including an end to finish the computation). The TRAM extends the RAM with a fork instruction that takes a positive integer k and forks k new child threads. Each child thread receives a unique integer in the range [1, . . . , k] in its first register and otherwise has the identical state as the parent, which has a 0 in that register. They all start by running the next instruction. When a thread performs a fork, it is suspended until all the children terminate (execute an end instruction). A computation starts with a single root thread and finishes when that root thread ends. This model supports what is often referred to as nested parallelism. If the root thread never does a fork, it is a standard sequential program. A computation can be viewed as a series-parallel DAG in which each instruction is a vertex, sequential instructions are composed in series, and the forked subthreads are composed in parallel. The work of a computation is the number of vertices and the depth is the length of the longest path in the DAG. We augment the model with three atomic instructions that are used by our algorithms: test-and-set (TS), fetch-and-add (FA), and priority-write (PW) and discuss our model with these operations as the TS, FA, and PW variants of the TRAM. As is standard with the RAM model, we assume that the memory locations and registers have at most O(log M) bits, where M is the total size of the memory used. More details about the model can be found in [20]. Parallel Primitives. The following parallel procedures are used throughout the paper. Scan takes as input an array A of length n, an associative binary operator ⊕, and an identity element ⊥ such that ⊥ ⊕ x = x for any x, and returns the array (⊥,⊥ ⊕ A[0],⊥ ⊕ A[0] ⊕ A[1], . . . ,⊥ ⊕n−2 i =0 A[i]) as i =0 A[i]. Scan can be done in O(n) work and O(log n) depth (assuming ⊕ well as the overall sum, ⊥⊕n−1 takes O(1) work) [66]. Reduce takes an array A and a binary associative function f and returns the sum of the elements in A with respect to f . Filter takes an array A and a predicate f and returns a new array containing a ∈ A for which f (a) is true, in the same order as in A. Reduce and filter can both be done in O(n) work and O(log n) depth (assuming f takes O(1) work). Ligra, Ligra+, and Julienne. We make use of the Ligra, Ligra+, and Julienne frameworks for shared-memory graph processing in this paper and review components from these frameworks here [42, 114, 118]. Ligra provides data structures for representing a graph G = (V , E), vertexSubsets , Vol. 1, No. 1, Article . Publication date: August 2019. F can side-effect data structures associated with the vertices. edgeMap runs in O( O( (subsets of the vertices). We make use of the edgeMap function provided by Ligra, which we use for mapping over edges. edgeMap takes as input a graph G(V , E), a vertexSubset U , and two boolean functions F and C. edgeMap applies F to (u, v) ∈ E such that u ∈ U and C(v) = true (call this subset of edges Ea), and returns a vertexSubset U ′ where u ∈ U ′ if and only if (u, v) ∈ Ea and F(u, v) = true. u∈U deg(u)) work and O(log n) depth assuming F and C take O(1) work. edgeMap either applies a sparse or dense method based on the number of edges incident to the current frontier. Both methods run in u∈U deg(u)) work and O(log n) depth. We note that in our experiments we use an optimized version of the dense method which examines in-edges sequentially and stops once C returns false. This optimization lets us potentially examine significantly fewer edges than the O(log n) depth version, but at the cost of O(in-deg(v)) depth. 4 BENCHMARK In this section we describe I/O specifications of our benchmark. We discuss related work and present the theoretically-efficient algorithm implemented for each problem in Section 5. We mark implementations based on prior work with a †. 4.1 Shortest Path Problems Breadth-First Search (BFS)† Input: G = (V , E), an unweighted graph, src ∈ V . Output: D, a mapping where D[v] is the shortest path distance from src to v in G and ∞ if v is unreachable. Integral-Weight SSSP (weighted BFS)† Input: G = (V , E, w), a weighted graph with integral edge weights, src ∈ V . Output: D, a mapping where D[v] is the shortest path distance from src to v in G and ∞ if v is unreachable. General-Weight SSSP (Bellman-Ford)† Input: G = (V , E, w), a weighted graph, src ∈ V . Output: D, a mapping where D[v] is the shortest path distance from src to v in G and ∞ if v is unreachable. All distances must be −∞ if G contains a negative-weight cycle reachable from src. Single-Source Betweenness Centrality (BC)† Input: G = (V , E), an undirected graph, src ∈ V . Output: S, a mapping from each vertex v to the centrality contribution from all (src, t) shortest paths that pass through v. Widest Path Input: G = (V , E, w), a weighted graph with integral edge weights, src ∈ V . Output: D, a mapping where D[v] is the maximum over all paths between src and v in G of the minimum weight on the path and ∞ if v is unreachable. , Vol. 1, No. 1, Article . Publication date: August 2019. O(k)-Spanner Input: G = (V , E), an undirected, unweighted graph, and an integer stretch factor, k. Output: H ⊆ E, a set of edges such that for every u, v ∈ V connected in G, distH(u, v) ≤ O(k). 4.2 Connectivity Problems Low-Diameter Decomposition† Input: G = (V , E), a directed graph, 0 < β < 1. Output: L, a mapping from each vertex to a cluster ID representing a (O(β), O((log n)/β)) decom- position. A (β, d)-decomposition partitions V into V1, . . . , Vk such that the shortest path between two vertices in Vi using only vertices in Vi is at most d, and the number of edges (u, v) where u ∈ Vi , v ∈ Vj , j (cid:44) i is at most βm. Connectivity† Input: G = (V , E), an undirected graph. Output: L, a mapping from each vertex to a unique label for its connected component. Spanning Forest† Input: G = (V , E), an undirected graph. Output: T , a set of edges representing a spanning forest of G. Biconnectivity Input: G = (V , E), an undirected graph. Output: L, a mapping from each edge to the label of its biconnected component. Minimum Spanning Forest Input: G = (V , E, w), a weighted graph. Output: T , a set of edges representing a minimum spanning forest of G. Strongly Connected Components Input: G(V , E), a directed graph. Output: L, a mapping from each vertex to the label of its strongly connected component. 4.3 Covering Problems Maximal Independent Set† Input: G = (V , E), an undirected graph. Output: U ⊆ V , a set of vertices such that no two vertices in U are neighbors and all vertices in V \ U have a neighbor in U . , Vol. 1, No. 1, Article . Publication date: August 2019. Maximal Matching† Input: G = (V , E), an undirected graph. Output: E′ ⊆ E, a set of edges such that no two edges in E′ share an endpoint and all edges in E \ E′ share an endpoint with some edge in E′. Graph Coloring† Input: G = (V , E), an undirected graph. Output: C, a mapping from each vertex to a color such that for each edge (u, v) ∈ E, C(u) (cid:44) C(v), using at most ∆ + 1 colors. Approximate Set Cover† Input: G = (V , E), an undirected graph representing a set cover instance. Output: S ⊆ V , a set of sets such that ∪s∈s N(s) = V with S being an O(log n)-approximation to the optimal cover. 4.4 Substructure Problems k-core† Input: G = (V , E), an undirected graph. Output: D, a mapping from each vertex to its coreness value. Approximate Densest Subgraph Input: G = (V , E), an undirected graph, and a parameter ϵ. Output: U ⊆ V , a set of vertices such that the density of GU is a 2(1 + ϵ) approximation of density of the densest subgraph of G. Triangle Counting† Input: G = (V , E), an undirected graph. Output: TG, the total number of triangles in G. 4.5 Eigenvector Problems PageRank† Input: G = (V , E), an undirected graph. Output: P, a mapping from each vertex to its PageRank value after a single iteration of PageRank. 5 ALGORITHMS In this section we discuss related work and give self-contained descriptions of all of the theoretically efficient algorithms implemented in our benchmark. We also include implementation details for algorithms implemented in prior papers that we did not significantly change. The pseudocode , Vol. 1, No. 1, Article . Publication date: August 2019. if (!Fl[d] && (test_and_set(&Fl[d]) == 0)) then F = edgeMap(G, F , Update, Cond) round = round + 1 return D D[d] = round return 1 return 0 F = {r}, D[r] = 0 while F > 0 do for many of the algorithms make use of the edgeMap and vertexMap primitives, as well as test-and-set, fetch-and-add and priority-write. All of these primitives are defined in Section 3. We cite the original papers that our algorithms are based on in Table 1. Algorithm 1 Breadth-First Search 1: Fl = {0, . . . , 0}, D = {∞, . . . ,∞}, round = 0 2: procedure Cond(v) return Fl[v] == 0 3: procedure Update(s, d) 4: 5: 6: 7: 8: procedure BFS(G(V , E), r) 9: 10: 11: 12: 13: Algorithm 2 Betweenness Centrality 1: Visited = {0, . . . , 0}, NumPaths = {0, . . . , 0}, D = {0, . . . , 0} 2: round = 0, Levels = array(n, null) 3: procedure Cond(v) return Visited[v] == 0 4: procedure SetVisited(v) return Visited[v] = 1 5: procedure PathUpdate(s, d) prev = fetch_and_add(&NumPaths[d], NumPaths[s]) 6: return prev == 0 7: 8: procedure DependencyUpdate(s, d) add_val = (NumPaths[d]/NumPaths[s]) · (1 + D[s]) 9: fetch_and_add(&D[d], add_val) 10: 11: procedure BC(G(V , E), r) F = {r} 12: while F > 0 do 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: F = Levels[round − 1] vertexMap(F , SetVisited) edgeMap(G, F , DependencyUpdate, Cond) round = round − 1 F = edgeMap(G, F , PathUpdate, Cond) Levels[round] = F vertexMap(F , SetVisited) round = round + 1 Visited = {0, . . . , 0} while round > 0 do return D 5.1 Shortest Path Problems Although work-efficient polylogarithmic-depth algorithms for single-source shortest paths (SSSP) type problems are not known due to the transitive-closure bottleneck [70], work-efficient algorithms that run in depth proportional to the diameter of the graph are known for the special cases considered in our benchmark. Several work-efficient parallel breadth-first search algorithms are known [11, , Vol. 1, No. 1, Article . Publication date: August 2019. return D nDist = D[s] + w, oDist = D[d], res = None if (nDist < oDist) then if (test_and_set(&Fl[d]) == 0) then res = Some(oDist) writeMin(&D[d], nDist) Moved = edgeMapData(G, ids, Update, Cond) NewBuckets = vertexMap(Moved, Reset) B.updateBuckets(NewBuckets, NewBuckets) Algorithm 3 wBFS 1: D = {∞, . . . ,∞}, Fl = {0, . . . , 0} 2: procedure GetBucketNum(i) return D[i] 3: procedure Cond(v) return 1 4: procedure Update(s, d, w) 5: 6: 7: 8: 9: return res 10: procedure Reset(v, oldDist) Fl[v] = 0, newDist = D[d] 11: return B.get_bucket(oldDist, newDist) 12: 13: procedure wBFS(G(V , E,W ), r) D[r] = 0 14: B = makeBuckets(V , GetBucketNum, increasing) 15: while ((id, ids) = B.nextBucket() and id (cid:44) nullbkt) do 16: 17: 18: 19: 20: Algorithm 4 Bellman-Ford 1: Fl = {0, . . . , 0}, D = {∞, . . . ,∞} 2: procedure Cond(v) return 1 3: procedure ResetFlags(v) Fl[v] = 0 4: procedure Update(s, d, w) if D[s] + w < D[d] then 5: 6: 7: 8: 9: procedure BellmanFord(G(V , E,W ), r) 10: 11: 12: 13: 14: 21, 76]. On weighted graphs with integral edge weights, SSSP can be solved in O(m) work and O(diam(G) log n) depth [42]. Parallel algorithms also exist for weighted graphs with positive edge weights [87, 88]. SSSP on graphs with negative integer edge weights can be solved using Bellman- Ford [38], where the number of iterations depends on the diameter of the graph. Betweenness centrality from a single source can be computed using two breadth-first searches [30, 114]. In this paper, we present implementations of five SSSP problems that are based on graph search. We also include an algorithm to construct an O(k)-spanner which is based on computing low- diameter decompositions. BFS, wBFS, Bellman-Ford, and Betweenness Centrality. Our implementations of BFS, Bellman- Ford, and betweenness centrality are based on the implementations in Ligra [114]. Our wBFS implementation is based on our earlier work on Julienne [42]. Algorithm 1 shows pseudocode for a writeMin(&D[d], D[s] + w) if !Fl[d] then return test_and_set(&Fl[d]) == 0 return 0 F = {r}, D[r] = 0 while F > 0 do F = edgeMap(G, F , Update, Cond) vertexMap(F , ResetFlags) return D , Vol. 1, No. 1, Article . Publication date: August 2019. frontier-based BFS implementation which synchronizes after each round of the BFS. The algorithm runs in O(m) and O(diam(G) log n) depth on the TS-TRAM, as vertices use test-and-set to non- deterministically acquire unvisited neighbors on the next frontier. Algorithm 4 shows pseudocode for a frontier-based version of Bellman-Ford which uses a priority-write to write the minimum distance to a vertex on each round and runs in O(diam(G)m) work and O(diam(G) log n) depth on the PW-TRAM. Pseudocode for our betweenness centrality implementation is shown in Algorithm 2. It uses fetch-and-add to compute the total number of shortest-paths through vertices, and runs in O(m) work and O(diam(G) log n) depth on the FA-TRAM. Algorithm 3 shows pseudocode for our weighted BFS implementation from Julienne [42]. The algorithm runs in O(m) work in expectation and O(diam(G) log n) depth w.h.p on the PW-TRAM, as vertices use priority-write to write the minimum distance to a neighboring vertex on each round. The algorithm uses a bucketing structure and generalized version of edgeMap called edgeMapData, which are discussed in the Julienne paper. The main change we made to these algorithms was to improve the cache-efficiency of the edgeMap implementation using the block-based version of edgeMap, described in Section 6. Widest Path (Bottleneck Path). The Widest Path, or Bottleneck Path problem is to compute ∀v ∈ V the maximum over all paths of the minimum weight edge on the path between a source vertex, u, and v. The algorithm is an important primitive, used for example in the Ford-Fulkerson flow algorithm [38, 49], as well as other flow algorithms [14]. Sequentially, the algorithm can be solved as quickly as SSSP using a modified version of Dijkstra's algorithm. We note that faster algorithms are known sequentially for sparse graphs [44]. For positive integer-weighted graphs, the problem can also be solved using the the work-efficient bucketing data structure from Julienne [42]. The buckets represent the width classes. The buckets are initialized with the out-neighbors of the source, u, and the buckets are traversed using the decreasing order. This order specifies that the buckets are traversed from the largest bucket to the smallest bucket. Unlike the other applications in Julienne, using widest path is interesting since the bucket containing a vertex can only increase. The problem can also be solved using the Bellman-Ford approach, by performing computations over the (max, min) semi-ring instead of the (min, +) semi-ring. Other than these changes, the pseudocode for the problem is identical to that of Algorithms 3 and 4. Algorithm 5 O(k)-Spanner 1: procedure Spanner(G(V , E), k) 2: 3: 4: 5: 6: O(k)-Spanner. Computing graph spanners is a fundamental problem in combintaorial graph algorithms and graph theory [99]. A graph H is a k-spanner of a graph G if ∀u, v ∈ V connected by a path, distG(u, v) ≤ distH(u, v) ≤ k · distG(u, v). Sequentially, classic results give elegant constructions of (2k − 1)-spanners using O(n 1+1/k) edges, which are essentially the best possible assuming the girth conjecture [126]. In this paper, we implement the recent spanner algorithm proposed by Miller, Peng, Xu, and Vladu (MPXV) [89]. The construction results in an O(k)-spanner with expected size O(n The MPXV spanner algorithm (Algorithm 5) uses the low-diameter decomposition (LDD) algo- rithm, which will be described in Section 5.2. It takes as input a parameter k which controls the multiplicative stretch of the spanner. The idea is to first compute a LDD with β = log n/(2k) (Line 3). The stretch of each ball is O(k) w.h.p., and so the algorithm includes all spanning tree edges generated by the LDD in the spanner (Line 4). Next, the algorithm handles inter-cluster edges β = L = LDD(G(V , E), β) S = EL = tree edges used in the LDD, L For each pair of adjacent clusters in L, add one inter-cluster edge to S. return S log n 2k 1+1/k), and runs in O(m) work and O(k log n) depth on the TS-TRAM. , Vol. 1, No. 1, Article . Publication date: August 2019. by taking a single inter-cluster edge between a boundary vertex and its neighbors (Line 5). We note that this procedure is slightly different than the procedure in the MPXV paper, which adds a single edge between every boundary vertex of a cluster and each adjacent cluster. Our algorithm only adds a single edge between two clusters, while the MPXV algorithm may add multiple parallel edges between two clusters. Their argument bounding the stretch to O(k) for an edge spanning two clusters is still valid, since the endpoints can be first routed to the cluster centers, and then to the single edge that was selected between the two clusters. if (C[d] == ∞) then return CAS(&C[d],∞, s) return 0 numVisited = 0, round = 0 F = {} while numVisited < V do return C F = F ∪ {v ∈ V Start[v] < round + 1 and C[v] == ∞} numVisited = numVisited + F F ′ = edgeMap(G, F , Update) round = round + 1 5.2 Connectivity Problems Algorithm 6 Low Diameter Decomposition 1: δ = {∼ Exp(β), . . . ,∼ Exp(β)} 2: Start = {δmax − δv v ∈ V } 3: C = {∞, . . . ,∞} 4: procedure Update(s, d) 5: 6: 7: procedure LDD(G(V , E)) 8: 9: 10: 11: 12: 13: 14: 15: Low-Diameter Decomposition. Low-diameter decompositions (LDD) were first introduced in the context of distributed computing [7], and were later used in metric embedding, linear-system solvers, and parallel algorithms. Awerbuch presents a simple sequential algorithm based on ball growing that computes an (β, O((log n)/β) decomposition [7]. Miller, Peng, and Xu (MPX) present a work-efficient parallel algorithm that computes a (β, O((log n)/β) decomposition. For each v ∈ V , the algorithm draws a start time, δv, from an exponential distribution with parameter β. The clustering is done by assigning each vertex u to the center v which minimizes d(u, v) − δv. This algorithm can be implemented by running a set of parallel breadth-first searches where the initial breadth-first search starts at the vertex with the largest start time, δmax, and starting breadth- first searches from other v ∈ V once δmax − δv steps have elapsed. In this paper, we present an implementation of the MPX algorithm which computes an (2β, O(log n/β)) decomposition in O(m) expected work and O(log2 n) depth w.h.p. on the TS-TRAM. Our implementation is based on the non-deterministic LDD implementation from Shun et al. [117]. The main changes in our implementation are separating the LDD code from the connectivity implementation. Algorithm 6 shows pseudocode for the modified version of the Miller-Peng-Xu algorithm from [117], which computes a (2β, O(log n/β)) decomposition in O(m) expected work and O(log2 n) depth w.h.p. on the TS-TRAM. The algorithm allows ties to be broken arbitrarily when two searches visit a vertex in the time-step, and one can show that this only affects the number of cut edges by a constant factor [117]. The algorithm first draws independent samples from Exp(β) (Line 1). Next, it computes the start times which is the difference between the maximum shifted value δmax and δv (Line 2). Initially, all vertices are unvisited (Line 3). The algorithm performs ball-growing while all of the vertices are not yet visited (Line 10). On Line 11, it updates the current frontier with any vertices that are ready to start and have not yet been visited, and update the number of visited vertices with , Vol. 1, No. 1, Article . Publication date: August 2019. the size of the current frontier (Line 12). Finally, on Line 13, it uses edgeMap to traverse the out edges of the current frontier and non-deterministically acquire unvisited neighboring vertices. Algorithm 7 Connectivity 1: procedure Connectivity(G(V , E), β) L = LDD(G(V , E), β) 2: G′(V ′, E′) = Contract(G(V , E), L) 3: if E′ = 0 then 4: 5: L′ = Connectivity(G′(V ′, E′), β) 6: L′′ = {v → L′[L[v]] v ∈ V } 7: return L′′ 8: return L Connectivity. Connectivity can be solved sequentially in linear work using breadth-first or depth- first search. Parallel algorithms for connectivity have a long history; we refer readers to [117] for a review of the literature. Early work on parallel connectivity discovered many natural algorithms which perform O(m log n) work [8, 101, 106, 113]. A number of optimal parallel connectivity algorithms were discovered in subsequent years [34, 50, 57, 58, 100, 102, 117], but to the best of our knowledge the recent algorithm by Shun et al. is the only linear-work polylogarithmic-depth parallel algorithm that has been studied experimentally [117]. In this paper we implement the connectivity algorithm from Shun et al. [117], which runs in O(m) expected work and O(log3 n) depth w.h.p. on the TS-TRAM. The implementation uses the work-efficient algorithm for low-diameter decomposition (LDD) [90] described above. One change we made to the implementation from [117] was to separate the LDD and contraction steps from the connectivity algorithm. Refactoring these sub-routines allowed us to express the main connectivity algorithm in Ligra in about 50 lines of code. The connectivity algorithm from Shun et al. [117] (Algorithm 7) takes as input an undirected graph G and a parameter 0 < β < 1. It first runs the LDD algorithm (Line 2) which decomposes the graph into clusters each with diameter (log n)/β, and βm inter-cluster edges in expectation. Next, it builds G′ by contracting each cluster to a single vertex and adding inter-cluster edges while removing duplicate edges and isolated vertices (Line 3). It then checks if the contracted graph consists of isolated vertices (Line 4); if so, the clusters are the components, and it returns the mapping from vertices to clusters (Line 5). Otherwise, it recurses on the contracted graph (Line 7) and returns the connectivity labeling produced by assigning each vertex to the label assigned to its cluster in the recursive call (Line 9). Algorithm 8 Spanning Forest 1: procedure SpanningForestImpl(G(V , E), M, β) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: procedure SpanningForest(G(V , E), β) 12: L = LDD(G(V , E), β) EL = edges used in the LDD EM = {M(e) e ∈ EL} G′(V ′, E′) = Contract(G(V , E), L) if E′ = 0 then M′ = mapping from e′ ∈ E′ to M(e) where e ∈ E is some edge representing e′ E′′ = SpanningForest(G′(V ′, E′), M′, β) return EM ∪ E′′ return SpanningForestImpl(G, {e → e e ∈ E}, β)) ▷ Original edges corresponding to EL return L , Vol. 1, No. 1, Article . Publication date: August 2019. Spanning Forest. Finding spanning forests in parallel has been studied largely in conjunction with connectivity algorithms, since most parallel connectivity algorithms can naturally be modified to output a spanning forest (see [117] for a review of the literature). Our spanning forest algorithm (Algorithm 8) is based on the connectivity algorithm from Shun et al. [117] which we described earlier. The main difference in the spanning forest algorithm is to include all LDD edges at each level of the recuursion (Line 4). However, observe that the LDD edges after the topmost level of recursion are taken from a contracted graph, and need to be mapped back to some edge in the original graph realizing the contracted edge. We decide which edges in G to add by maintaining a mapping from the edges in the current graph at some level of recursion to the original edge set. Initially this mapping, M, is an identity map (Line 12). To compute the mapping to pass to the recursive call, we select any edge e in the input graph G that resulted in e′ ∈ E′ and map e′ to M(e) (Line 8). In our implementation, we use a parallel hash table to select a single original edge per contracted edge. Algorithm 9 Biconnectivity 1: procedure Biconnectivity(G(V , E)) 2: 3: 4: 5: 6: 7: F = SpanningForest(G) PN = PreorderNumber(F) For each v ∈ V , compute Low(v) and High(v) and Size(v) critical = e = (u, p(u)) ∈ F s.t. p(u) is an articulation point Labels = CC(G(V , E \ critical)) return (Labels, F) ▷ trees in F are rooted arbitrarily ▷ sufficient to answer biconnectivity queries Biconnectivity. Sequentially, biconnectivity can be solved using the Hopcroft-Tarjan algorithm [62]. The algorithm uses depth-first search (DFS) to identify articulation points and requires O(m + n) work to label all edges with their biconnectivity label. It is possible to parallelize the sequential algorithm using a parallel DFS, however, the fastest parallel DFS algorithm is not work-efficient [2]. Tarjan and Vishkin present the first work-efficient algorithm for biconnectivity [125] (as stated in the paper the algorithm is not work-efficient, but it can be made so by using a work-efficient connectivity algorithm). Another approach relies on the fact that biconnected graphs admit open ear decompositions to solve biconnectivity efficiently [82, 105]. In this paper, we implement the Tarjan-Vishkin algorithm for biconnectivity in O(m) expected n)) depth on the FA-TRAM. Our implementation first computes work and O(max(diam(G) log n, log3 connectivity labels using our connectivity algorithm, which runs in O(m) expected work and O(log3 n) depth w.h.p. and picks an arbitrary source vertex from each component. Next, we compute a spanning forest rooted at these sources using breadth-first search, which runs in O(m) work and O(diam(G) log n) depth. We note that the connectivity algorithm can be modified to compute a spanning forest in the same work and depth as connectivity, which would avoid the breadth-first- search. We compute Low, High, and Size for each vertex by running leaffix and rootfix sums on the spanning forests produced by BFS with fetch-and-add, which requires O(n) work and O(diam(G)) depth. Finally, we compute an implicit representation of the biconnectivity labels for each edge, using an idea from [16]. This step computes per-vertex labels by removing all critical edges and computing connectivity on the remaining graph. The resulting vertex labels can be used to assign biconnectivity labels to edges by giving tree edges the connectivity label of the vertex further from the root in the tree, and assigning non-tree edges the label of either endpoint. Summing the cost of each step, the total work of this algorithm is O(m) in expectation and the total depth is O(max(diam(G) log n, log3 Algorithm 9 shows the Tarjan-Vishkin biconnectivity algorithm. We first compute a spanning forest of G using the work-efficient connectivity algorithm, where the trees in the forest can be n)) w.h.p. , Vol. 1, No. 1, Article . Publication date: August 2019. rooted arbitrarily (Line 2). Next, we compute a preorder numbering, PN, with respect to the roots (Line 3). We then compute for each v ∈ V Low(v) and High(v), which are the minimum and maximum preorder numbers respectively of all non-tree (u, w) edges where u is a vertex in v's subtree. We also compute Size(v), the size of each vertex's subtree. Note that we can determine whether the parent of a vertex u is an articulation point by checking PN(p(u)) ≤ Low(u) and High(u) < PN(p(u)) + size(p(u)). As in [16], we refer to this set of tree edges (u, p(u)), where p(u) is an articulation point, as critical edges. The last step of the algorithm is to solve connectivity on the graph with all critical edges removed. Now, the biconnectivity label of an edge (u, v) is the connectivity label of the vertex that is further from the root of the tree. The query data structure can thus report biconnectivity labels of edges in O(1) time using 2n space, which is important for our implementations as storing a biconnectivity label per-edge explicitly would require a prohibitive amount of memory for large graphs. As the most costly step in this algorithm is to run connectivity, the algorithm runs in O(m) work in expectation and O(log3 n) depth w.h.p. Our implementation described of the Tarjan-Vishkin algorithm runs in the same work but O(max(diam(G) log n, log3 n)) depth w.h.p. as it computes a spanning tree using BFS and performs leaffix and rootfix computations on this tree. Algorithm 10 Minimum Spanning Forest 1: procedure Borůvka(n, E = {(vi , vj , wvivj), . . . , }) Parents = {0, . . . , n − 1}, active = n, forest = {} 2: while active > 1 and E > 0 do 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: MarkRoots(P, Parents) FilterInactiveVertices(active, P) forest = forest ∪ {edges that won on either endpoint in P} PointerJump(Parents) RelabelEdges(E, Parents) FilterSelfEdges(E) return forest P = {(∞,∞), . . . ,(∞,∞)} for ((i, e = (u, v, w)) ∈ E do in parallel writeMin(&P[u],(w, i)) writeMin(&P[v],(w, i)) Minimum Spanning Forest. Borůvka gave the first known sequential and parallel algorithm for computing a minimum spanning forest (MSF) [29]. Significant effort has gone into finding linear-work MSF algorithms both in the sequential and parallel settings [34, 69, 100]. Unfortunately, the linear-work parallel algorithms are highly involved and do not seem to be practical. Significant effort has also gone into designing practical parallel algorithms for MSF; we discuss relevant experimental work in Section 7. Due to the simplicity of Borůvka, many parallel implementations of MSF use variants of it. In this paper, we present an implementation of Borůvka's algorithm that runs in O(m log n) work and O(log2 n) depth on the PW-TRAM. Our implementation is based on a recent implementation of Borůvka by Zhou [130] that runs on the edgelist format. We made several changes to the algorithm which improve performance and allow us to solve MSF on graphs stored in the CSR/CSC format, as storing an integer-weighted graph in edgelist format would require well over 1TB of memory to represent the edges in the Hyperlink2012 graph alone. Our code uses an implementation of Borůvka that works over an edgelist; to make it efficient we ensure that the size of the lists passed to it are much smaller than m. Our approach is to perform a constant number of filtering steps. Each filtering step solves an approximate k'th smallest problem in order to extract the lightest 3n/2 , Vol. 1, No. 1, Article . Publication date: August 2019. edges in the graph (or all remaining edges) and runs Borůvka on this subset of edges. We then filter the remaining graph, packing out any edges that are now in the same component. This idea is similar to the theoretically-efficient algorithm of Cole et al. [34], except that instead of randomly sampling edges, we select a linear number of the lowest weight edges. Each filtering step costs O(m) work and O(log m) depth, but as we only perform a constant number of steps, they do not affect the work and depth asymptotically. In practice, most of the edges are removed after 3 -- 4 filtering steps, and so the remaining edges can be copied into an edgelist and solved in a single Borůvka step. We also note that as the edges are initially represented in both directions, we can pack out the edges so that each undirected edge is only inspected once (we noticed that earlier edgelist-based implementations stored undirected edges in both directions). Algorithm 10 shows an efficient implementation of Borůvka's algorithm based on shortcutting using pointer-jumping instead of contraction [130]. The Borůvka step is described in terms of the edgelist representation of a graph. We note that in practice, it is often the case that the MSF is contained in the first 2n or so lowest weight edges. This motivates running several Borůvka steps on prefixes of the edges sorted by weight, an optimization which is also implemented by other experimental MSF algorithms [96, 116, 130]. Each run computes a new set of edges that are now in the MSF which can be used to filter the remaining edges that are now shortcut by the newly added edges. After running a constant number of filter steps, we can run Borůvka on the remaining edges in the graph. We now give a high-level description of the edgelist based Borůvka implementation and refer to [130] for a detailed explanation of the code. Each vertex is initially its own parent, all vertices are active and the initial forest is empty (Line 2). The algorithm runs over a series of rounds. In each round, we initialize cells for currently active vertices (Line 4). Next, we loop in parallel over all edges and perform a priority-write with min based on the weight on both endpoints of the edge (Lines 6 and 7). This writes the weight and index-id of a minimum-weight edge incident to a vertex v into P[v]. On Line 8, we mark the roots of the forest (we break symmetry by marking the higher endpoint of an edge as the root of that edge). On Line 9 we filter vertices that did not have any vertices join their component and update the number of vertices that are still active. Next, we update the forest, adding all edges which won on either of their endpoints in P (Line 10). We then use pointer-jumping to map every vertex to the id of its new component root (Line 11) and relabel all edges based on the new ids of each endpoint (Line 12). Finally, we filter any self-edges from the graph. We note that our implementation uses indirection over both the vertices and edges by maintaining a set of active vertices, of size active and a set of active edge-ids. This helps improve performance in practice as we can allocate P to have size proportional to the number of active vertices in each round, and as we can filter just the ids of the edges, instead of triples containing the two endpoints and the weight of each edge. Algorithm 11 Strongly Connected Components 1: procedure SCC(G(V , E)) 2: 3: 4: 5: 6: 7: 8: 9: 10: Centers = {v ∈ Vi Done[i] == 0} InL = MarkReachable(GT, L, Centers) OutL = MarkReachable(G, L, Centers) Set Done[i] = true,(i, _ ) ∈ InL ∩ OutL Set L[i] = min{label (i, label) ∈ InL ∩ OutL} Set L[i] = min{label (i, label) ∈ InL ⊕ OutL and !Done[i]} P = {V1, . . . , Vlog n} = Partition(V ) L = {∞, . . . ,∞}, Done = {0, . . . , 0} for i ← 1, . . . , log n do , Vol. 1, No. 1, Article . Publication date: August 2019. Strongly Connected Components. Tarjan's algorithm is the textbook sequential algorithm for computing the strongly connected components (SCCs) of a directed graph [38]. As it uses depth-first search, we currently do not know how to efficiently parallelize it [2]. The current theoretical state-of- the-art for parallel SCC algorithms with polylogarithmic depth reduces the problem to computing the transitive closure of the graph. This requires O(n 3) work using combinatorial algorithms [51], which is significantly higher than the O(m + n) work done by sequential algorithms. As the transitive-closure based approach performs a significant amount of work even for moderately sized graphs, subsequent research on parallel SCC algorithms has focused on improving the work while potentially sacrificing depth [23, 37, 48, 110]. Conceptually, these algorithms first pick a random pivot and use a reachability-oracle to identify the SCC containing the pivot. They then remove this SCC, which partitions the remaining graph into several disjoint pieces, and recurse on the pieces. In this paper, we present the first implementation of the SCC algorithm from Blelloch et al. [23], shown in Algorithm 11. We refer the reader to Section 6.2 of [23] for proofs of correctness and its work and depth bounds. The algorithm is similar in spirit to randomized quicksort. On Line 2 we randomly permute the vertices and assign them to log n batches. On Line 3 we set the initial label for all vertices as ∞ and mark all vertices as not done. Now, we process the batches one at a time. For each batch, we compute Centers, which are the vertices in the batch that are not yet done (Line 5). The next step calls MarkReachable from the centers on both G and the transposed graph, GT (Lines 6 -- 7). MarkReachable takes the set of centers and uses a breadth-first search to compute the sets InL (OutL), which for a center c ∈ Centers includes all (v, c) pairs for vertices v that c can reach through its in-edges (out-edges) that share the same label as c. On Line 8, we mark all vertices that had a center visit them through both the in-search and out-search as done -- these vertices are captured by some SCC. On Line 9, we deterministically set the label for vertices that were finished in this round. Finally, on Line 10, we set the labels for vertices that were not finished in this round but were visited by either the in or out-search. Our implementation runs in in O(m log n) expected work and O(diam(G) log n) depth w.h.p. on the PW-TRAM. One of the challenges in implementing this SCC algorithm is how to compute reachability information from multiple vertices simultaneously and how to combine the information to (1) identify SCCs and (2) refine the subproblems of visited vertices. In our implementation, we explicitly store RF and RB, the forward and backward reachability sets for the set of centers that are active in the current phase, CA. The sets are represented as hash tables that store tuples of vertices and center IDs, (u, ci), representing a vertex u in the same subproblem as ci that is visited by a directed path from ci. We explain how to make the hash table technique practical in Section 6. The reachability sets are computed by running simultaneous breadth-first searches from all active centers. In each round of the BFS, we apply edgeMap to traverse all out-edges (or in-edges) of the current frontier. When we visit an edge (u, v) we try to add u's center IDs to v. If u succeeds in adding any IDs, it test-and-set's a visited flag for v, and returns it in the next frontier if the test-and-set succeeded. Each BFS requires at most O(diam(G)) rounds as each search adds the same labels on each round as it would have had it run in isolation. After computing RF and RB, we deterministically assign (with respect to the random permutation of vertices generated at the start of the algorithm) vertices that we visited in this phase a new label, which is either the label of a refined subproblem or a unique label for the SCC they are contained in. We first intersect the two tables and perform, for any tuple (v, ci) contained in the intersection, a priority-write with min on the memory location corresponding to v's SCC label with ci as the label. Next, for all pairs (v, ci) in RF ⊕ RB we do a priority-write with min on v's subproblem label, which ensures that the highest priority search that visited v sets its new subproblem. , Vol. 1, No. 1, Article . Publication date: August 2019. We implemented an optimized search for the first phase, which just runs two regular BFSs over the in-edges and out-edges from a single pivot and stores the reachability information in bit- vectors instead of hash-tables. It is well known that many directed real-world graphs have a single massive strongly connected component, and so with reasonable probability the first vertex in the permutation will find this giant component [32]. We also implemented a 'trimming' optimization that is reported in the literature [85, 121], which eliminates trivial SCCs by removing any vertices that have zero in- or out-degree. We implement a procedure that recursively trims until no zero in- or out-degree vertices remain, or until a maximum number of rounds are reached. 5.3 Covering Problems Algorithm 12 Maximal Independent Set 1: P = RandomPermutation({0, . . . , n − 1}) 2: Priority = {NghsBefore(v0), . . . , NghsBefore(vn−1)} 3: procedure NghsBefore(v) return {u ∈ N(v) P[u] < P[v]} 4: procedure MIS(G(V , E)) roots = {v ∈ V Priority[v] = 0} 5: finished = 0, I = {} 6: while finished < V do 7: 8: 9: 10: 11: 12: 13: I = I ∪ roots removed = {v ∈ V v ∈ N(roots and Priority[v] > 0} Set Priority[v] = 0 for all v ∈ removed finished = finished + roots + removed roots = edgeMap(G, removed, DecrementPriority) return I Maximal Independent Set. Maximal independent set (MIS) and maximal matching (MM) are easily solved in linear work sequentially using greedy algorithms. Many efficient parallel maximal independent set and matching algorithms have been developed over the years [4, 18, 22, 64, 71, 78]. Blelloch et al. show that when the vertices (or edges) are processed in a random order, the sequential greedy algorithms for MIS and MM can be parallelized efficiently and give practical algorithms [22]. Recently, Fischer and Noever showed an improved depth bound for this algorithm [47]. In this paper, we implement the rootset-based algorithm for MIS from Blelloch et al. [22] which runs in O(m) expected work and O(log2 n) depth w.h.p. on the FA-TRAM. To the best of our knowledge this is the first implementation of the rootset-based algorithm; the implementations from [22] are based on processing appropriately-sized prefixes of an order generated by a random permutation P. Our implementation of the rootset-based algorithm works on a priority-DAG defined by directing edges in the graph from the higher-priority endpoint to the lower-priority endpoint. On each round, we add all roots of the DAG into the MIS, compute N(roots), the neighbors of the rootset that are still active, and finally decrement the priorities of N(N(roots)). As the vertices in N(roots) are at arbitrary depths in the priority-DAG, we only decrement the priority along an edge (u, v), u ∈ N(roots) if P[u] < P[v]. The algorithm runs in O(m) work as we process each edge once; the depth bound is O(log2 n) as the priority-DAG has O(log n) depth w.h.p. [47], and each round takes O(log n) depth. We were surprised that this implementation usually outperforms the prefix-based implementation from [22], while also being simple to implement. The rootset-based MIS algorithm from Blelloch et al. [22] is shown in Algorithm 12. In MIS, we first randomly order the vertices with a random permutation P and compute the array Priority, an array which for each vertex v contains the number of neighbors that have higher priority than v by calling NghsBefore(v) according to P (Lines 1 -- 2). On Line 5 we compute the initial rootset, roots, , Vol. 1, No. 1, Article . Publication date: August 2019. which is the set of all vertices that have priority 0. In each round, the algorithm adds the roots to the independent set (Line 8), computes the set of removed vertices, which are neighbors of the rootset that are still active (Priority[v] > 0). On Lines 10-11 we set the priority of the removed vertices to 0 and update the number of finished vertices. Finally, we compute the new rootset by decrementing the priority of all edges (u, v) where u ∈ removed and P[u] < P[v] using a fetch-and-add, and returning true for a neighbor v if we decrement its priority to 0. Algorithm 13 Maximal Matching 1: procedure ParallelGreedyMM(P, matched) 2: 3: 4: 5: 6: 7: 8: procedure MaximalMatching(G(V , E)) 9: 10: 11: 12: 13: 14: 15: matched = {0, . . . , 0}, M = {} while E > 0 do P = Select a 1/de-prefix of E W = ParallelGreedyMM(P, matched) E = E \ (W ∪ N(W )) M = M ∪ W W = edges in P with no adjacent edges with higher priority Update matched[u], matched[v] for all (u, v) ∈ W Filter edges incident to newly matched vertices from P M = {} while P > 0 do return M return M Maximal Matching. Our maximal matching implementation is based on the prefix-based algo- rithm from [22] that takes O(m) expected work and O(log3 m/log log m) depth w.h.p. on the PW- TRAM (using the improved depth shown in [47]). We had to make several modifications to run the algorithm on the large graphs in our experiments. The original code from [22] uses an edgelist representation, but we cannot directly use this implementation as uncompressing all edges would require a prohibitive amount of memory for large graphs. Instead, as in our MSF implementation, we simulate the prefix-based approach by performing a constant number of filtering steps. Each filter step packs out 3n/2 of the highest priority edges, randomly permutes them, and then runs the edgelist based algorithm on the prefix. After computing the new set of edges that are added to the matching, we filter the remaining graph and remove all edges that are incident to matched vertices. In practice, just 3 -- 4 filtering steps are sufficient to remove essentially all edges in the graph. The last step uncompresses any remaining edges into an edgelist and runs the prefix-based algorithm. The filtering steps can be done within the work and depth bounds of the original algorithm. The prefix-based maximal matching algorithm from Blelloch et al. [22] is shown in Algorithm 13. The algorithm first sets all vertices as unmatched, and initializes the matching to empty (Line 9). The algorithm runs over a set of rounds; each round selects a 1/de-prefix of the edges (de is the maximum number of neighboring edges an edge has), and runs the parallel greedy maximal matching algorithm (Line 1) on it. The parallel greedy algorithm repeatedly finds the set of edges that have the highest priority amongst all other edges incident to either endpoint (Line 4), adds them to the matching (Line 5), and filters the prefix based on the newly matched edges (Line 6). The edges matched by the greedy algorithm are returned to the MaximalMatching procedure (Line 12). We then recompute E by removing the matched edges, and the one-hop neighborhood of the matched edges. Implementing this in practice can be done by lazily deleting edges, and using doubling to select the next prefix. We refer to [22] for the proof of the work and depth of this , Vol. 1, No. 1, Article . Publication date: August 2019. roots = {v ∈ V Priority[v] == 0}, finished = 0 while finished < n do AssignColors(roots) finished = finished + roots roots = edgeMap(G, roots, DecrementPriority) algorithm. Our actual implementation does several filtering steps before executing Algorithm 13 as described in Section 5. This does not affect the work and depth bounds. Algorithm 14 LLF Graph Coloring 1: P = RandomPermutation({1, . . . , n − 1}), C = {∞, . . . ,∞} 2: Priority = priority based on log-degree, breaking ties using P 3: procedure LLF(G(V , E)) 4: 5: 6: 7: 8: 9: Graph Coloring. As graph coloring is NP-hard to solve optimally, algorithms like greedy coloring, which guarantees a (∆ + 1)-coloring, are used instead in practice, and often use much fewer than (∆ + 1) colors on real-world graphs [59, 127]. Jones and Plassmann (JP) parallelize the greedy algorithm using linear work, but unfortunately adversarial inputs exist for the heuristics they consider that may force the algorithm to run in O(n) depth. Hasenplaugh et al. introduce several heuristics that produce high-quality colorings in practice and also achieve provably low-depth regardless of the input graph. These include LLF (largest-log-degree-first), which processes vertices ordered by the log of their degree and SLL (smallest-log-degree-last), which processes vertices by removing all lowest log-degree vertices from the graph, coloring the remaining graph, and finally coloring the removed vertices. For LLF, they show that it runs in O(m+n) work and O(L log ∆+log n) depth, where L = min{√ In this paper, we implement a synchronous version of Jones-Plassmann using the LLF heuristic in Ligra, which runs in O(m +n) work and O(L log ∆ +log n) depth on the FA-TRAM. The algorithm is implemented similarly to our rootset-based algorithm for MIS. In each round, after coloring the roots we use a fetch-and-add to decrement a count on our neighbors, and add the neighbor as a root on the next round if the count is decremented to 0. m, ∆} + log2 ∆ log n/log log n in expectation. return C Algorithm 14 shows a synchronous implementation of the parallel LLF-Coloring algorithm from [59]. On Lines 1 and 2 we compute a random permutation P, and compute Priority which for each vertex v contains the number of neighbors that have higher priority than v based on comparing ⌈log d(v)⌉ and breaking ties using P. Initially, roots is the set of all vertices that have priority 0 (Line 4). In each round, we assign the lowest available color the roots and update finished (Line 6). We compute the next rootset by decrementing the priority of all edges (u, v) where u ∈ roots using a fetch-and-add, and returning any neighbor whose priority is decremented to 0 (Line 8). Approximate Set Cover. The set cover problem can be modeled by a bipartite graph where sets and elements are vertices, with an edge between a set an element if and only if the set covers that element. Like graph coloring, the set cover problem is NP-hard to solve optimally, and a sequential greedy algorithm computes an Hn-approximation in O(m) time for unweighted sets, and O(m log m) k =1 1/k and m is the sum of the sizes of the sets (or the number of edges in the graph). There has been significant work on finding work-efficient parallel algorithms that achieves an Hn-approximation [17, 25, 26, 73, 103]. Algorithm 15 shows pseudocode for the Blelloch et al. algorithm [25] which runs in O(m) work and O(log3 n) depth on the PW-TRAM. We refer to [42] for a detailed explanation of the code, and give a high-level description of the algorithm here. The algorithm first buckets the sets based on their degree, placing a set covering D elements into ⌊log1+ϵ D⌋'th bucket (Line 2). We process the buckets in decreasing order. In each round, we extract the highest bucket (Line 5) and pack out time for weighted sets, where Hn =n , Vol. 1, No. 1, Article . Publication date: August 2019. B = bucket sets based on degree and ϵ, finished = 0 C = {} while finished < n do Algorithm 15 Approximate Set Cover 1: procedure AboveThreshold(s, d) return d >= ⌈(1 + ϵ)max(b,0)⌉ 2: procedure SC(G = (S ∪ E, A), ϵ) 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: (b, sets) = B.NextBucket() Pack out neighbors of sets that are covered (SC , SR) = split sets based on new degrees Sets in SC try acquiring elements with a randomly chosen priority AS = {s ∈ SC s acquired enough neighbors} C = C ∪ AS Reset neighbors of SC that are not covered B.UpdateBuckets((SC \ AS) ∪ SR) return C ▷ Extract the highest bucket their adjacency lists to remove neighbors that may have been covered by prior rounds (Line 6). We then split the sets into SC, sets that continue in the round, and SR, sets that should be rebucketed based on whether the set still contains enough uncovered neighbors (Line 8). Next, we implement one step of MaNIS [25], which subselects a set of sets from SC that have little overlap. We select a random priority for each set in SC and try to acquire all neighbors of the set (Line 9) by doing a priority-write with min using the randomly chosen priority. On Line 10, we compute AS, the sets that won on more than ⌈(1 + ϵ)max(b−1,0)⌉ of their neighbors, and add them to the cover (Line 11). Next, we reset memory locations for elements that were written-to by a set, but not acquired (Line 12). Finally we reinsert sets that did not win on enough neighbors (SC \ AS), or lost enough of their size (SR) back into the bucket structure. Our implementation of approximate set cover in this paper is based on the implementation from Julienne [42]. The main change we made in this paper is to ensure that we correctly set random priorities on each round of the algorithm. Both the implementation in Julienne as well as an earlier implementation of the algorithm [26] use vertex IDs instead of picking random priorities for all sets that are active on a given round. This can cause very few vertices to be added on each round on meshes and other graphs with a large amount of symmetry. Instead, in our implementation, for AS, the active sets on a round, we generate a random permutation of [0, . . . , AS − 1] and write these values into a pre-allocated dense array with size proportional to the number of sets. We give experimental details regarding this change in Section 7. 5.4 Substructure Problems Algorithm 16 k-core 1: procedure Coreness(G(V , E)) D = {deg(v0), . . . , deg(vn−1)} 2: B = bucket vertices based on D, finished = 0 3: 4: while finished < n do 5: 6: 7: 8: 9: (k, ids) = B.NextBucket() finished = finished + ids moved = Histogram(G, ids, DecrementCoreness) B.UpdateBuckets(moved) return D , Vol. 1, No. 1, Article . Publication date: August 2019. k-core. k-cores were defined independently by Seidman [111], and by Matula and Beck [83] who also gave a linear-time algorithm for computing the coreness value of all vertices, i.e. the maximum k-core a vertex participates in. Anderson and Mayr showed that k-core (and therefore coreness) is in NC for k ≤ 2, but is P-complete for k ≥ 3 [6]. The Matula and Beck algorithm is simple and practical -- it first bucket-sorts vertices by their degree, and then repeatedly deletes the minimum- degree vertex. The affected neighbors are moved to a new bucket corresponding to their induced degree. As each edge in each direction and vertex is processed exactly once, the algorithm runs in O(m + n) work. In [42], the authors give a parallel algorithm based on bucketing that runs in O(m + n) expected work, and ρ log n depth w.h.p. ρ is the peeling-complexity of the graph, defined as the number of rounds to peel the graph to an empty graph where each peeling step removes all minimum degree vertices. Our implementation of k-core in this paper is based on the implementation from Julienne [42]. One of the challenges to implementing the peeling algorithm for k-core is efficiently computing the number of edges removed from each vertex that remains in the graph. A simple approach is to just fetch-and-add a counter per vertex, and update the bucket of the vertex based on this counter, however this incurs significant contention on real-world graphs with vertices with large degree. In order to make this step faster in practice, we implemented a work-efficient histogram which computes the number of edges removed from remaining vertices while incurring very little contention. We describe our histogram implementation in Section 6. Algorithm 16 shows pseudocode for the work-efficient k-core algorithm from Julienne [42] which computes the coreness values of all vertices. The algorithm initializes the initial coreness values to the degree of each vertex (Line 2), and inserts the vertices into a bucketing data-structure based on their degree (Line 3). In each round, while all of the vertices have not yet been processed the algorithm removes the vertices in the minimum bucket (Line 5), computes the number of edges removed from each neighbor using a histogram (Line 7) and finally updates the buckets of affected neighbors (Line 8). We return the array D, which contains the coreness values of each vertex at the end of the algorithm. Algorithm 17 Approximate Densest Subgraph 1: D = {deg(v) v ∈ V } 2: procedure Cond(v) return 1 3: procedure UpdateDecrement(s, d) 4: 5: 6: procedure ApproximateDensestSubgraph(G(V , E)) 7: 8: 9: 10: 11: 12: 13: 14: R = {v ∈ S D[v] < 2(1 + ϵ)ρ(S)} edgeMap(G, R, UpdateDecrement, Cond) D = D \ R if ρ(D) > ρ(Dmax) then fetch_and_add(&D[d],−1) return 0 S = V , Smax = ∅ while S (cid:44) ∅ do , G[S] is the induced subgraph on S ▷ ρ(S) = E(G[S]) S Dmax = D return Dmax Approximate Densest Subgraph. The densest subgraph problem is to find a subgraph of an undirected graph with the highest density (the density of a subgraph is the number of edges in the subgraph divided by the number of vertices). The problem is a classic graph optimization problem that admits exact polynomial-time solutions using either a reduction to flow [52] or LP- rounding [33]. In his paper, Charikar also gives a simple O(m + n) work 2-approximation algorithm , Vol. 1, No. 1, Article . Publication date: August 2019. based on computing a degeneracy ordering of the graph, and taking the maximum density subgraph over all suffixes of the degeneracy order3. The problem has also received attention in parallel models of computation [12, 13]. Bahmani et al. give a (2 + ϵ)-approximation running in O(log1+ϵ n) rounds of MapReduce [13]. Subsequently, Bahmani et al. [12] showed that a (1 + ϵ) can be found in O(log n/ϵ 2) rounds of MapReduce by using the multiplicative-weights approach on the dual of the natural LP for densest subgraph. To the best our knowledge, it is currently open whether the densest subgraph problem can be exactly solved in NC. In this paper, we implement the elegant (2 + ϵ)-approximation algorithm of Bahmani et al. (Algorithm 17). Our implementation of the algorithm runs in O(m + n) work and O(log1+ϵ n log n) depth. The algorithm starts with a candidate densest subgraph, S, consisting of all vertices, and an empty densest subgraph Smax (Line 7). It also maintains an array with the induced degree of each vertex in S, which is initially just its degree in G (Line 1). The main loop iteratively peels vertices with degree below the density threshold in the current candidate subgraph (Lines 8 -- 13). Specifically, it finds all vertices with induced degree less than 2(1 + ϵ)ρ(S) (Line 9), calls edgeMap, which updates the induced degrees array (Line 10) and finally removes them from S (Line 11). If the density of the updated subgraph S is greater than the density of Smax, the algorithm updates Smax to be S. Bahmani et al. show that this algorithm removes a constant factor of the vertices in each round. However, they do not consider the work of the algorithm in the MapReduce model. We briefly sketch how the algorithm can be implemented in O(m +n) work and O(log1+ϵ n log n) depth. Instead of computing the density of the current subgraph by scanning all edges, we maintain it explicitly in an array, D (Line 1), and update it as vertices are removed from S. Each round of the algorithm does work proportional to vertices in S to compute R (Line 9) but since S decreases by a constant factor in each round the work of these steps is O(n) over all rounds. Computing the new density can be done by computing the number of edges between R and S, which only requires scanning edges incident to vertices in R using edgeMap (Line 10). Therefore, the edges incident to a vertex are scanned exactly once, in the round when it is included in R, and so the algorithm performs O(m + n) work. The depth is O(log1+ϵ n log n) since there are O(log1+ϵ n) rounds each of which perform a filter and edgeMap which both run in O(log n) depth. In practice, we found that since a large number of vertices are removed in each round, using fetch-and-add can cause contention, especially on graphs containing vertices with high degrees. Instead, our implementation uses a work-efficient histogram procedure (see Section 6) which updates the degrees while incurring very little contention. Triangle Counting. Triangle counting has received significant recent attention due to its numerous applications in Web and social network analysis. There have been dozens of papers on sequential triangle counting [5, 65, 75, 95, 97, 108, 109]. The fastest algorithms rely on matrix multiplication and 2ω/(1+ω)) work, where ω is the best matrix multiplication exponent [5, 65]. run in either O(nω) or O(m The fastest algorithm that does not rely matrix multiplication requires O(m 3/2) work [75, 108, 109], which also turns out to be much more practical. Parallel algorithms with O(m 3/2) work have been designed [1, 77, 119], with Shun and Tangwongsan [119] showing an algorithm that requires O(log n) depth on the TRAM.4 The implementation from [119] parallelizes Latapy's compact-forward algorithm, which creates a directed graph DG where an edge (u, v) ∈ E is kept in DG iff deg(u) < deg(v). Although triangle 3We note that the 2-approximation be work-efficiently solved in the same depth as our k-core algorithm by augmenting the k-core algorithm to return the order in which vertices are peeled. Computing the maximum density subgraph over suffixes of the degeneracy order can be done using scan. 4The algorithm in [119] was described in the Parallel Cache Oblivious model, with a depth of O(log3/2 n). , Vol. 1, No. 1, Article . Publication date: August 2019. counting can be done directly on the undirected graph in the same work and depth asymptotically, directing the edges helps reduce work, and ensures that every triangle is counted exactly once. In this paper we implement the triangle counting algorithm described in [119]. We had to make several significant changes to the implementation in order to run efficiently on large compressed graphs. First, we parallelized the creation of the directed graph; this step creates a directed graph encoded in the parallel-byte format in O(m) work and O(log n) depth. We also parallelized the merge-based intersection algorithm to make it work in the parallel-byte format. We give more details on these techniques in Section 6. 5.5 Eigenvector Problems PageRank. PageRank is a centrality algorithm first used at Google to rank webpages [31]. The algorithm takes a graph G = (V , E), a damping factor 0 ≤ γ ≤ 1 and a constant ϵ which controls convergence. Initially, the PageRank of each vertex is 1/n. On each iteration, the algorithm updates the PageRanks of the vertices using the following equation:  1 − γ n + γ Pv = Pu deg+(u) u∈N −(v) This update step can be implemented using a single sparse-matrix vector multiplication call (im- plementable using, for example, edgeMap). The algorithm implemented in this paper follows the implementation of PageRank described in Ligra [114]. We note that many PageRank implementa- tions in the wild actually implement an algorithm called PageRank-Delta, which modified PageRank by only activating a vertex if its PageRank value has changed sufficiently. However, we are not aware of any bounds on the work and depth of this algorithm, and therefore chose to implement the classic PageRank. The main modification we made to the implementation from Ligra was to implement the dense iterations of the algorithm using a reduction primitive, which can be carried out over the incoming neighbors of a vertex in parallel, without needing a fetch-and-add instruction. Each iteration of our implementation requires O(m + n) work and O(log n) depth. 6 IMPLEMENTATIONS AND TECHNIQUES In this section, we introduce several general implementation techniques and optimizations that we use in our algorithms. The techniques include a fast histogram implementation useful for reducing contention in the k-core algorithm, a cache-friendly sparse edgeMap implementation that we call edgeMapBlocked, and compression techniques used to efficiently parallelize algorithms on massive graphs. 6.1 A Work-efficient Histogram Implementation Our initial implementation of the peeling-based algorithm for k-core algorithm suffered from poor performance due to a large amount of contention incurred by fetch-and-adds on high-degree vertices. This occurs as many social-networks and web-graphs have large maximum degree, but relatively small degeneracy, or largest non-empty core (labeled kmax in Table 2). For these graphs, we observed that many early rounds, which process vertices with low coreness perform a large number of fetch-and-adds on memory locations corresponding to high-degree vertices, resulting in high contention [115]. To reduce contention, we designed a work-efficient histogram implementation that can perform this step while only incurring O(log n) contention w.h.p. The Histogram primitive takes a sequence of (K, T) pairs, and an associative and commutative operator R : T × T → T and , Vol. 1, No. 1, Article . Publication date: August 2019. dU = I = Intermediate array of size Algorithm 18 edgeMapBlocked 1: procedure edgeMapBlocked(G, U , F) O = Prefix sums of degrees of u ∈ U 2: u∈U deg(u) 3: nblocks = ⌈dU /bsize⌉ 4: B = Result of binary search for nblocks indices into O 5: 6: 7: 8: 9: 10: 11: 12: R = Prefix sum A and compact I return R u∈U deg(u) A = Intermediate array of size nblocks parfor i ∈ B do Process work in B[i] and pack live neighbors into I[ibsize] A[i] = Number of live neighbors computes a sequence of (K, T) pairs, where each key k only appears once, and its associated value t is the sum of all values associated with keys k in the input, combined with respect to R. A useful example of histogram to consider is summing for each v ∈ N(F) for a vertexSubset F, the number of edges (u, v) where u ∈ F (i.e., the number of incoming neighbors from the frontier). This operation can be implemented by running histogram on a sequence where each v ∈ N(F) appears once per (u, v) edge as a tuple (v, 1) using the operator +. One theoretically efficient implementation of histogram is to simply semisort the pairs using the work-efficient semisort algorithm from [56]. The semisort places pairs from the sequence into a set of heavy and light buckets, where heavy buckets contain a single key that appears many times in the input sequence, and light buckets contain at most O(log2 n) distinct keys (k, v) keys, each of which appear at most O(log n) times w.h.p. (heavy and light keys are determined by sampling). We compute the reduced value for heavy buckets using a standard parallel reduction. For each light bucket, we allocate a hash table, and hash the keys in the bucket in parallel to the table, combining multiple values for the same key using R. As each key appears at most O(log n) times w.h.p, we incur at most O(log n) contention w.h.p. The output sequence can be computed by compacting the light tables and heavy arrays. While the semisort implementation is theoretically efficient, it requires a likely cache miss for each key when inserting into the appropriate hash table. To improve cache performance in this step, we implemented a work-efficient algorithm with O(nϵ) depth based on radix sort. Our implementation is based on the parallel radix sort from PBBS [116]. As in the semisort, we first sample keys from the sequence and determine the set of heavy-keys. Instead of directly moving the elements into light and heavy buckets, we break up the input sequence into O(n 1−ϵ) blocks, each of size O(nϵ), and sequentially sort the keys within a block into light and heavy buckets. Within the blocks, we reduce all heavy keys into a single value and compute an array of size O(nϵ) which holds the starting offset of each bucket within the block. Next, we perform a segmented-scan [19] over the arrays of the O(n 1−ϵ) blocks to compute the sizes of the light buckets, and the reduced values for the heavy-buckets, which only contain a single key. Finally, we allocate tables for the light buckets, hash the light keys in parallel over the blocks and compact the light tables and heavy keys into the output array. Each step runs in O(n) work and O(nϵ) depth. Compared to the original semisort implementation, this version incurs fewer cache misses because the light keys per block are already sorted and consecutive keys likely go to the same hash table, which fits in cache. We compared our times in the histogram-based version of k-core and the fetch-and-add-based version of k-core and saw between a 1.1 -- 3.1x improvement from using the histogram. , Vol. 1, No. 1, Article . Publication date: August 2019. of size often much smaller than 6.2 edgeMapBlocked One of the core primitives used by our algorithms is edgeMap (described in Section 3). The push- based version of edgeMap, edgeMapSparse, takes a frontier U and iterates over all (u, v) edges incident to it. It applies an update function on each edge that returns a boolean indicating whether or not the neighbor should be included in the next frontier. The standard implementation of edgeMapSparse first computes prefix-sums of deg(u), u ∈ U to compute offsets, allocates an array u∈U deg(u), and iterates over all u ∈ U in parallel, writing the ID of the neighbor to the array if the update function F returns true, and ⊥ otherwise. It then filters out the ⊥ values in the array to produce the output vertexSubset. In real-world graphs, N(U), the number of unique neighbors incident to the current frontier is u∈U deg(u) writes and incur a proportional number of cache misses, despite the size of the output being at most N(U). More precisely, the size of the output is at most LN(U) ≤ N(U), where LN(U) is the number of live neighbors of U , where a live neighbor is a neighbor of the current frontier for which F returns true. To reduce the number of cache misses we incur in the push-based traversal, we implemented a new version of edgeMapSparse that performs at most LN(U) writes that we call edgeMapBlocked. The idea behind edgeMapBlocked is to logically break the edges incident to the current frontier up into a set of blocks, and iterate over the blocks sequentially, packing live neighbors, compactly for each block. We then simply prefix-sum the number of live neighbors per-block, and compact the block outputs into the output array. u∈U deg(u). However, edgeMapSparse will always perform We now describe a theoretically efficient implementation of edgeMapBlocked (Algorithm 18). As in edgeMapSparse, we first compute an array of offsets O (Line 1) by prefix summing the degrees of u ∈ U . We process the edges incident to this frontier in blocks of size bsize. As we cannot afford to explicitly write out the edges incident to the current frontier to block them, we instead logically assign the edges to blocks. Each block searches for a range of vertices to process with bsize edges; the i'th block binary searches the offsets array to find the vertex incident to the start of the (i · bsize)'th edge, storing the result into B[i] (Lines 4 -- 5). The vertices that block i must process are therefore between B[i] and B[i + 1]. We note that multiple blocks can be assigned to process the edges incident to a high-degree vertex. Next, we allocate an intermediate array I of size dU (Line 6), but do not initialize the memory, and an array A that stores the number of live neighbors found by each block (Line 7). Next, we process the blocks in parallel by sequentially applying F to each edge in the block and compactly writing any live neighbors to I[i · bsize] (Line 9), and write the number of live neighbors to A[i] (Line 10). Finally, we do a prefix sum on A, which gives offsets into an array of size proportional to the number of live neighbors, and copy the live neighbors in parallel to R, the output array (Line 11). imbalance between the size of the output of each edgeMap, and We found that this optimization helps the most in algorithms where there is a significant u∈U deg(u). For example, in weighted BFS, relatively few of the edges actually relax a neighboring vertex, and so the size of the output, which contains vertices that should be moved to a new bucket, is usually much smaller than the total number of edges incident to the frontier. In this case, we observed as much as a 1.8x improvement in running time by switching from edgeMapSparse to edgeMapBlocked. 6.3 Techniques for overlapping searches In this section, we describe how we compute and update the reachability labels for vertices that are visited in a phase of our SCC algorithm. Recall that each phase performs a graph traversal from the set of active centers on this round, CA, and computes for each center c, all vertices in the weakly-connected component for the subproblem of c that can be reached by a directed path from , Vol. 1, No. 1, Article . Publication date: August 2019. it. We store this reachability information as a set of (u, ci) pairs in a hash-table, which represent the fact that u can be reached by a directed path from ci. A phase performs two graph traversals from the centers to compute RF and RB, the out-reachability set and in-reachability sets respectively. Each traversal allocates an initial hash table and runs rounds of edgeMap until no new label information is added to the table. The main challenge in implementing one round in the traversal is (1) ensuring that the table has sufficient space to store all pairs that will be added this round, and (2) efficiently iterating over all of the pairs associated with a vertex. We implement (1) by performing a parallel reduce to sum over vertices u ∈ F, the current frontier, the number of neighbors v in the same subproblem, multiplied by the number of distinct labels currently assigned to u. This upper-bounds the number of distinct labels that could be added this round, and although we may overestimate the number of actual additions, we will never run out of space in the table. We update the number of elements currently in the table during concurrent insertions by storing a per-processor count which gets incremented whenever the processor performs a successful insertion. The counts are then summed together at the end of a round and used to update the count of the number of elements in the table. One simple implementation of (2) is to simply allocate O(log n) space for every vertex, as the maximum number of centers that visit any vertex during a phase is at most O(log n) w.h.p. However, this will waste a significant amount of space, as most vertices are visited just a few times. Instead, our implementation stores (u, c) pairs in the table for visited vertices u, and computes hashes based only on the ID of u. As each vertex is only expected to be visited a constant number of times during a phase, the expected probe length is still a constant. Storing the pairs for a vertex in the same probe-sequence is helpful for two reasons. First, we may incur fewer cache misses than if we had hashed the pairs based on both entries, as multiple pairs for a vertex can fit in the same cache line. Second, storing the pairs for a vertex along the same probe sequence makes it extremely easy to find all pairs associated with a vertex u, as we simply perform linear-probing, reporting all pairs that have u as their key until we hit an empty cell. Our experiments show that this technique is practical, and we believe that it may have applications in similar algorithms, such as computing least-element lists or FRT trees in parallel [23, 24]. 6.4 Primitives on Compressed Graphs Many of our algorithms are concisely expressed using fundamental primitives such as map, map- reduce, filter, pack, and intersection. To run our algorithms without any modifications on com- pressed graphs, we wrote new implementations of these primitives using using the parallel-byte format from Ligra+, some of which required some new techniques in order to be theoretically efficient. We first review the byte and parallel-byte formats from [118]. In byte coding, we store a vertex's neighbor list by difference encoding consecutive vertices, with the first vertex difference encoded with respect to the source. Decoding is done by sequentially uncompressing each differ- ence, and summing the differences into a running sum which gives the ID of the next neighbor. As this process is sequential, graph algorithms using the byte format that map over the neighbors of a vertex will require O(∆) depth. The parallel-byte format from Ligra+ breaks the neighbors of a high-degree vertex into blocks, where each block contains a constant number of neighbors. Each block is difference encoded with respect to the source. As each block can have a different size, it also stores offsets that point to the start of each block. The format stores the blocks in a neighbor list L in sorted order. We now describe efficient implementations of primitives used by our algorithms. All descriptions are given for neighbor lists coded in the parallel-byte format. The Map primitive takes as input neighbor list L, and a map function F, and applies F to each ID in L. This can be implemented with a parallel-for loop across the blocks, where each iteration decodes its block sequentially. Our , Vol. 1, No. 1, Article . Publication date: August 2019. implementation of map runs in O(L) work and O(log n) depth. Map-Reduce takes as input a neighbor list L, a map function F : vtx → T and a binary associative function R and returns the sum of the mapped elements with respect to R. We perform map-reduce similarly by first mapping over the blocks, then sequentially reducing over the mapped values in each block. We store the accumulated value on the stack or in an allocated array if the number of blocks is large enough. Finally, we reduce the accumulated values using R to compute the output. Our implementation of map-reduce runs in O(L) work and O(log n) depth. Filter takes as input a neighbor list L, a predicate P, and an array T into which the vertices satisfying P are written, in the same order as in L. Our implementation of filter also takes as input an array S, which is an array of size deg(v) space for lists L larger than a constant threshold, and null otherwise. In the case where L is large, we implement the filter by first decoding L into S in parallel; each block in L has an offset into S as every block except possibly the last block contains the same number of vertex IDs. We then filter S into the output array T . In the case where L is small we just run the filter sequentially. Our implementation of filter runs in O(L) work and O(log n) depth. Pack takes as input a neighbor list L and a predicate P function, and packs L, keeping only vertex IDs that satisfied P. Our implementation of pack takes as input an array S, which an array of size 2 ∗ deg(v) for lists larger than a constant threshold, and null otherwise. In the case where L is large, we first decode L in parallel into the first deg(v) cells of S. Next, we filter these vertices into the second deg(v) cells of S, and compute the new length of L. Finally, we recompress the blocks in parallel by first computing the compressed size of each new block. We prefix-sum the sizes to calculate offsets into the array and finally compress the new blocks by writing each block starting at its offset. When L is small we just pack L sequentially. We make use of the pack and filter primitives in our implementations of maximal matching, minimum spanning forest, and triangle counting. Our implementation of pack runs in O(L) work and O(log n) depth. The Intersection primitive takes as input two neighbor lists La and Lb and computes the size of the intersection of La and Lb (La ≤ Lb). We implement an algorithm similar to the optimal parallel intersection algorithm for sorted lists. As the blocks are compressed, our implementation works on the first element of each block, which can be quickly decoded. We refer to these elements as block starts. If the number of blocks in both lists sum to less than a constant, we intersect them sequentially. Otherwise, we take the start vs of the middle block in La, and binary search over the starts of Lb to find the first block whose start is less than or equal to vs. Note that as the closest value less than or equal to vs could be in the middle of the block, the subproblems we generate must to consider elements in the two adjoining blocks of each list, which adds an extra constant factor of work in the base case. Our implementation of intersection runs in O(La log(1 + Lb/La)) work and O(log n) depth. 7 EXPERIMENTS In this section, we describe our experimental results on a set of real-world graphs and also discuss related experimental work. Tables 3 and 4 show the running times for our implementations on our graph inputs. For compressed graphs, we use the compression schemes from Ligra+ [118], which we extended to ensure theoretical efficiency. We describe these modifications and also other statistics about our algorithms (e.g., number of colors used, number of SCCs, etc.) in section A. 7.1 Experimental Setup and Graph Inputs Experimental Setup. We run all of our experiments on a 72-core Dell PowerEdge R930 (with two-way hyper-threading) with 4 × 2.4GHz Intel 18-core E7-8867 v4 Xeon processors (with a 4800MHz bus and 45MB L3 cache) and 1TB of main memory. Our programs use Cilk Plus to express , Vol. 1, No. 1, Article . Publication date: August 2019. Graph Dataset LiveJournal LiveJournal-Sym com-Orkut Twitter Twitter-Sym 3D-Torus ClueWeb ClueWeb-Sym Hyperlink2014 Hyperlink2014-Sym Hyperlink2012 Hyperlink2012-Sym Num. Vertices 4,847,571 4,847,571 3,072,627 41,652,231 41,652,231 1,000,000,000 978,408,098 978,408,098 1,724,573,718 1,724,573,718 3,563,602,789 3,563,602,789 Num. Edges 68,993,773 85,702,474 234,370,166 1,468,365,182 2,405,026,092 6,000,000,000 42,574,107,469 74,744,358,622 64,422,807,961 124,141,874,032 128,736,914,167 225,840,663,232 diam 16 20 9 65* 23* 1500* 821* 132* 793* 207* 5275* 331* ρ ∼ 3480 5,667 ∼ 14,963 1 ∼ 106,819 ∼ 58,711 ∼ 130,728 kmax ∼ 372 253 ∼ 2488 6 ∼ 4244 ∼ 4160 ∼ 10565 Table 2. Graph inputs, including vertices and edges. diam is the diameter of the graph. For undirected graphs, ρ and kmax are the number of peeling rounds, and the largest non-empty core (degeneracy). We mark diam values where we are unable to calculate the exact diameter with * and report the effective diameter observed during our experiments, which is a lower bound on the actual diameter. parallelism and are compiled with the g++ compiler (version 5.4.1) with the -O3 flag. By using Cilk's work-stealing scheduler we are able obtain an expected running time of W /P + O(D) for an algorithm with W work and D depth on P processors [27]. For the parallel experiments, we use the command numactl -i all to balance the memory allocations across the sockets. All of the speedup numbers we report are the running times of our parallel implementation on 72-cores with hyper-threading over the running time of the implementation on a single thread. Graph Data. To show how our algorithms perform on graphs at different scales, we selected a representative set of real-world graphs of varying sizes. Most of the graphs are Web graphs and social networks -- low diameter graphs that are frequently used in practice. To test our algorithms on large diameter graphs, we also ran our implementations 3-dimensional tori where each vertex is connected to its 2 neighbors in each dimension. We list the graphs used in our experiments, along with their size, approximate diameter, peeling complexity [42], and degeneracy (for undirected graphs) in Table 2. LiveJournal is a directed graph of the social network obtained from a snapshot in 2008 [28]. com-Orkut is an undirected graph of the Orkut social network. Twitter is a directed graph of the Twitter network, where edges represent the follower relationship [74]. ClueWeb is a Web graph from the Lemur project at CMU [28]. Hyperlink2012 and Hyperlink2014 are directed hyperlink graphs obtained from the WebDataCommons dataset where nodes represent web pages [86]. 3D-Torus is a 3-dimensional torus with 1B vertices and 6B edges. We mark symmetric (undirected) versions of the directed graphs with the suffix -Sym. We create weighted graphs for evaluating weighted BFS, Borůvka, widest path, and Bellman-Ford by selecting edge weights between [1, log n) uniformly at random. We process LiveJournal, com-Orkut, Twitter, and 3D-Torus in the uncompressed format, and ClueWeb, Hyperlink2014, and Hyperlink2012 in the compressed format. 7.2 SSSP Problems Our BFS, weighted BFS, Bellman-Ford, and betweenness centrality implementations achieve be- tween a 13 -- 67x speedup across all inputs. We ran all of our shortest path experiments on the symmetrized versions of the graph. Our widest path implementation achieves between 38 -- 72x speedup across all inputs, and our spanner implementation achieves between 31 -- 65x speedup across all inputs. We ran our spanner code with k = 4. Our experiments show that our weighted BFS and Bellman-Ford implementations perform as well as or better than our prior implementations from Julienne [42]. Our running times for BFS and betweenness centrality are the same as the times , Vol. 1, No. 1, Article . Publication date: August 2019. Application Breadth-First Search (BFS) Integral-Weight SSSP (weighted BFS) General-Weight SSSP (Bellman-Ford) Single-Source Widest Path (Bellman-Ford) Single-Source Betweenness Centrality (BC) O(k)-Spanner Low-Diameter Decomposition (LDD) Connectivity Spanning Forest Biconnectivity Strongly Connected Components (SCC)* Minimum Spanning Forest (MSF) Maximal Independent Set (MIS) Maximal Matching (MM) Graph Coloring Approximate Set Cover k-core Approximate Densest Subgraph Triangle Counting (TC) PageRank Iteration (1) (72h) com-Orkut Twitter-Sym LiveJournal-Sym (1) (SU) (72h) (1) (SU) 301 0.137 39.7 0.59 437 0.995 33.5 1.45 31.2 6280 1.56 3.39 580 0.749 56.6 3.48 496 0.937 28.0 1.66 380 0.768 54.0 1.31 275 0.186 45.5 0.54 300 0.585 59.1 1.01 334 0.818 52.8 1.11 30.0 1610 4.86 5.36 ∼ 0.495 26.8 1.61 617 3.02 20.4 3.64 236 0.759 45.3 1.18 403 32.8 1.42 2.42 21.4 6.91 350 4.69 20.0 1429 3.31 4.65 753 16.3 6.72 3.75 95.4 66.6 1.14 2.89 168 13.5 23.5 81.7 0.861 0.012 71.7 1.28 0.018 71.1 24.16 0.453 53.3 107 (SU) (72h) 0.018 32.7 0.41 0.012 34.1 0.107 13.5 2.03 0.095 21.3 0.086 39.4 3.98 0.168 23.6 0.090 38.6 4.39 0.098 44.7 0.049 33.8 2.52 0.057 44.2 0.041 31.9 2.34 0.046 50.8 0.027 20.0 0.33 0.019 17.3 0.029 34.8 1.36 0.031 43.8 0.035 31.7 1.84 0.047 39.1 0.261 20.5 7.31 0.292 25.0 ∼ 0.116 13.8 0.204 17.8 4.58 0.227 20.1 0.034 34.7 2.23 0.052 42.8 0.095 25.4 4.65 0.183 25.4 0.392 11.9 9.05 0.789 11.4 0.613 7.58 4.51 0.786 5.73 0.641 5.85 8.32 6.25 0.052 55.5 4.71 0.081 58.1 0.342 39.4 78.1 65.6 (1) 5.45 33.4 48.7 42.4 26.3 41.5 8.48 34.6 43.2 146 13.3 61.8 34.4 46.7 148 66.4 110 76.0 1920 1.33 1.19 ∼ ∼ 3D-Torus (72h) 5.53 18.1 133 9.7 12.5 11.7 7.55 8.71 10.1 59.6 ∼ 23.6 4.44 11.4 11.3 40.2 6.58 1.59 6.63 2.25 (SU) 54.4 24.1 47.2 59.7 39.6 32.4 36.4 34.4 33.0 27.0 ∼ 26.1 53.1 35.3 30.9 35.5 114.4 60.0 25.3 47.5 Table 3. Running times (in seconds) of our algorithms over symmetric graph inputs on a 72-core machine (with hyper-threading) where (1) is the single-thread time, (72h) is the 72 core time using hyper-threading, and (SU) is the parallel speedup (single-thread time divided by 72-core time). We mark experiments that are not applicable for a graph with ∼, and experiments that did not finish within 5 hours with -- . *SCC was run on the directed versions of the input graphs. of the implementations in Ligra [114]. We note that our running times for weighted BFS on the Hyperlink graphs are larger than the times reported in Julienne. This is because the shortest-path experiments in Julienne were run on directed version of the graph, where the average vertex can reach many fewer vertices than on the symmetrized version. We set a flag for our weighted BFS experiments on the ClueWeb and Hyperlink graphs that lets the algorithm switch to a dense edgeMap once the frontiers are sufficiently dense, which lets the algorithm run within half of the RAM on our machine. Before this change, our weighted BFS implementation would request a large amount of amount of memory when processing the largest frontiers which then caused the graph to become partly evicted from the page cache. For widest path, the times we report are for the Bellman-Ford version of the algorithm, which we were surprised to find is consistently 1.1 -- 1.3x faster than our algorithm based on bucketing. We observe that our spanner algorithm is only slightly more costly than computing connectivity on the same input. In an earlier paper [42], we compared the running time of our weighted BFS implementation to two existing parallel shortest path implementations from the GAP benchmark suite [15] and Galois [80], as well as a fast sequential shortest path algorithm from the DIMACS shortest path challenge, showing that our implementation is between 1.07 -- 1.1x slower than the ∆-stepping implementation from GAP, and 1.6 -- 3.4x faster than the Galois implementation. Our old version of Bellman-Ford was between 1.2 -- 3.9x slower than weighted BFS; we note that after changing it to use the edgeMapBlocked optimization, it is now competitive with weighted BFS and is between 1.2x faster and 1.7x slower on our graphs with the exception of 3D-Torus, where it performs 7.3x slower than weighted BFS, as it performs O(n 4/3) work on this graph. , Vol. 1, No. 1, Article . Publication date: August 2019. Application Breadth-First Search (BFS) Integral-Weight SSSP (weighted BFS) General-Weight SSSP (Bellman-Ford) Single-Source Widest Path (Bellman-Ford) Single-Source Betweenness Centrality (BC) O(k)-Spanner Low-Diameter Decomposition (LDD) Connectivity Spanning Forest Biconnectivity Strongly Connected Components (SCC)* Minimum Spanning Forest (MSF) Maximal Independent Set (MIS) Maximal Matching (MM) Graph Coloring Approximate Set Cover k-core Approximate Densest Subgraph Triangle Counting (TC) PageRank Iteration ClueWeb-Sym (1) 106 736 1050 849 569 613 176 381 936 2250 1240 2490 551 1760 2050 1490 2370 1380 13997 256.1 (72h) 2.29 14.4 16.2 11.8 27.7 9.79 3.62 6.01 18.2 48.7 38.1 45.6 8.44 31.8 49.8 28.1 62.9 19.6 204 3.49 (SU) 55.5 62.3 63.7 72.0 53.1 63.3 47.0 63.3 58.8 49.2 41.5 49.7 70.3 61.9 52.4 54.2 41.8 70.8 -- 74.4 Hyperlink2014-Sym Hyperlink2012-Sym (1) (SU) (SU) 68.2 46.2 250 64.8 51.1 1390 67.5 64.8 1460 66.3 71.9 1211 60.9 866 20.5 62.6 906 65.8 59.0 322 48.6 65.6 63.3 710 67.5 51.4 1319 59.7 46.2 3520 32.5 2140 43.9 50.9 54.6 3580 68.0 65.2 1020 66.2 55.3 2980 56.4 41.1 3310 53.0 2040 58.8 46.0 37.6 3480 71.9 70.4 1721 -- 68.6 -- 73.3 385 74.2 (72h) 4.50 22.3 22.9 16.8 16.3 14.3 6.84 11.2 22.4 71.5 51.5 71.9 14.5 48.1 63.1 37.6 83.2 24.3 480 5.17 (72h) 8.44 58.1 59.4 48.4 37.1 36.3 16.6 25.0 35.8 165 185 187 32.2 108 158 90.4 184 61.4 1168 13.1 (1) 576 3770 4010 3210 2260 2390 980 1640 2420 9860 8130 9520 2190 7150 8920 5320 8515 4420 -- 973 Table 4. Running times (in seconds) of our algorithms over symmetric graph inputs on a 72-core machine (with hyper-threading) where (1) is the single-thread time, (72h) is the 72 core time using hyper-threading, and (SU) is the parallel speedup (single-thread time divided by 72-core time). We mark experiments that are not applicable for a graph with ∼, and experiments that did not finish within 5 hours with -- . *SCC was run on the directed versions of the input graphs. 7.3 Connectivity Problems Our low-diameter decomposition (LDD) implementation achieves between 17 -- 59x speedup across all inputs. We fixed β to 0.2 in all of the codes that use LDD. The running time of LDD is comparable to the cost of a BFS that visits most of the vertices. We are not aware of any prior experimental work that reports the running times for an LDD implementation. Our work-efficient implementation of connectivity and spanning forest achieve 25 -- 57x speedup and 31 -- 67x speedup across all inputs, respectively. We note that our implementation does not assume that vertex IDs in the graph are randomly permuted and always generates a random permutation, even on the first round, as adding vertices based on their original IDs can result in poor performance (for example on 3D-Torus). There are several existing implementations of fast parallel connectivity algorithms [98, 116, 117, 121], however, only the implementation from [117], which presents the connectivity algorithm that we implement in this paper, is theoretically-efficient. The implementation from Shun et al. was compared to both the Multistep [121] and Patwary et al. [98] implementations, and shown to be competitive on a broad set of graphs. We compared our connectivity implementation to the work-efficient connectivity implementation from Shun et al. on our uncompressed graphs and observed that our code is between 1.2 -- 2.1x faster in parallel. Our spanning forest implementation is slightly slower than connectivity due to having to maintain a mapping between the current edge set and the original edge set. Despite our biconnectivity implementation having O(diam(G)) depth, our implementation achieves between a 20 -- 59x speedup across all inputs, as the diameter of most of our graphs is extremely low. Our biconnectivity implementation is about 3 -- 5 times slower than running connectivity on the graph, which seems reasonable as our current implementation performs two calls to connectivity, and one breadth-first search. There are a several existing implementations of , Vol. 1, No. 1, Article . Publication date: August 2019. biconnectivity. Cong and Bader [35] parallelize the Tarjan-Vishkin algorithm and demonstrated speedup over the Hopcroft-Tarjan (HT) algorithm. Edwards and Vishkin [45] also implement the Tarjan-Vishkin algorithm using the XMT platform, and show that their algorithm achieves good speedups. Slota and Madduri [120] present a BFS-based biconnectivity implementation which requires O(mn) work in the worst-case, but behaves like a linear-work algorithm in practice. We ran the Slota and Madduri implementation on 36 hyper-threads allocated from the same socket, the configuration on which we observed the best performance for their code, and found that our implementation is between 1.4 -- 2.1x faster than theirs. We used a DFS-ordered subgraph corre- sponding to the largest connected component to test their code, which produced the fastest times. Using the original order of the graph affects the running time of their implementation, causing it to run between 2 -- 3x slower as the amount of work performed by their algorithm depends on the order in which vertices are visited. Our strongly connected components implementation achieves between a 13 -- 43x speedup across all inputs. Our implementation takes a parameter β, which is the base of the exponential rate at which we grow the number of centers added. We set β between 1.1 -- 2.0 for our experiments and note that using a larger value of β can improve the running time on smaller graphs by up to a factor of 2x. Our SCC implementation is between 1.6x faster to 4.8x slower than running connectivity on the graph. There are several existing SCC implementations that have been evaluated on real-world directed graphs [61, 85, 121]. The Hong et al. algorithm [61] is a modified version of the FWBW- Trim algorithm from McLendon et al. [85], but neither algorithm has any theoretical bounds on work or depth. Unfortunately [61] do not report running times, so we are unable to compare our performance with them. The Multistep algorithm [121] has a worst-case running time of O(n 2), but the authors point-out that the algorithm behaves like a linear-time algorithm on real-world graphs. We ran our implementation on 16 cores configured similarly to their experiments and found that we are about 1.7x slower on LiveJournal, which easily fits in cache, and 1.2x faster on Twitter (scaled to account for a small difference in graph sizes). While the multistep algorithm is slightly faster on some graphs, our SCC implementation has the advantage of being theoretically-efficient and performs a predictable amount of work. Our minimum spanning forest implementation achieves between 17 -- 54x speedup over the implementation running on a single thread across all of our inputs. Obtaining practical parallel algorithms for MSF has been a longstanding goal in the field, and several existing implementations exist [9, 36, 94, 116, 130]. We compared our implementation with the union-find based MSF imple- mentation from PBBS [116] and the implementation of Borůvka from [130], which is one of the fastest implementations we are aware of. Our MSF implementation is between 2.6 -- 5.9x faster than the MSF implementation from PBBS. Compared to the edgelist based implementation of Borůvka from [130] our implementation is between 1.2 -- 2.9x faster. 7.4 Covering Problems Our MIS and maximal matching implementations achieve between 31 -- 70x and 25 -- 70x speedup across all inputs. The implementations by Blelloch et al. [22] are the fastest existing implementations of MIS and maximal matching that we are aware of, and are the basis for our maximal matching implementation. They report that their implementations are 3 -- 8x faster than Luby's algorithm on 32 threads, and outperform a sequential greedy MIS implementation on more than 2 processors. We compared our rootset-based MIS implementation to the prefix-based implementation, and found that the rootset-based approach is between 1.1 -- 3.5x faster. Our maximal matching implementation is between 3 -- 4.2x faster than the implementation from [22]. Our implementation of maximal matching can avoid a significant amount of work, as each of the filter steps can extract and permute just the 3n/2 highest priority edges, whereas the edgelist-based version in PBBS must permute , Vol. 1, No. 1, Article . Publication date: August 2019. all edges. Our coloring implementation achieves between 11 -- 56x speedup across all inputs. We note that our implementation appears to be between 1.2 -- 1.6x slower than the asynchronous implementation of JP in [59], due to synchronizing on many rounds which contain few vertices. Our approximate set cover implementation achieves between 5 -- 57x speedup across all inputs. Our implementation is based on the implementation presented in Julienne [42]; the one major modification was to regenerate random priorities for sets that are active on the current round. We compared the running time of our implementation with the parallel implementation from [26] which is available in the PBBS library. We ran both implementations with ϵ = 0.01. Our implementation is between 1.2x slower to 1.5x faster than the PBBS implementation on our graphs, with the exception of 3D-Torus. On 3D-Torus, the implementation from [26] runs 56x slower than our implementation as it does not regenerate priorities for active sets on each round causing worst-case behavior. Our performance is also slow on this graph, as nearly all of the vertices stay active (in the highest bucket) during each round, and using ϵ = 0.01 causes a large number of rounds to be performed. 7.5 Substructure Problems Our k-core implementation achieves between 5 -- 46x speedup across all inputs, and 114x speedup on the 3D-Torus graph as there is only one round of peeling in which all vertices are removed. There are several recent papers that implement parallel algorithms for k-core [40, 42, 68, 107]. Both the ParK algorithm [40] and Kabir and Madduri algorithm [68] implement the peeling algorithm in O(kmaxn + m) work, which is not work-efficient. Our implementation is between 3.8 -- 4.6x faster than ParK on a similar machine configuration. Kabir and Madduri show that their implementation achieves an average speedup of 2.8x over ParK. Our implementation is between 1.3 -- 1.6x faster than theirs on a similar machine configuration. Our approximate densest subgraph implementation achieves between 44 -- 77x speedup across all inputs. We ran our implementation with ϵ = 0.001, which in our experiments produced sub- graphs with density roughly equal to those produced by the 2-approximation algorithm based on degeneracy ordering, or setting ϵ to 0. To the best of our knowledge, there are no prior existing shared-memory parallel algorithms for this problem. Our triangle counting (TC) implementation achieves between 39 -- 81x speedup across all inputs. Unfortunately, we are unable to report speedup numbers for TC on our larger graphs as the single-threaded times took too long due to the algorithm performing O(m 3/2) work. There are a number of experimental papers that consider multicore triangle counting [1, 54, 72, 77, 112, 119]. We implement the algorithm from [119], and adapted it to work on compressed graphs. We note that in our experiments we intersect directed adjacency lists sequentially, as there was sufficient parallelism in the outer parallel-loop. There was no significant difference in running times between our implementation and the implementation from [119]. We ran our implementation on 48 threads on the Twitter graph to compare with the times reported by EmptyHeaded [1] and found that our times are about the same. 7.6 Eigenvector Problems Our PageRank (PR) implementation achieves between 39 -- 54x speedup across all inputs. Our implementation is based on the PageRank-Delta implementation from Ligra [114]. We ran the algorithm with ϵ = 1e − 6, and with ϵ′ = 0.01, where ϵ′ is the local (per-node) threshold for the amount of change in its PageRank value before it is activated. We note that the modification made to carry out dense iterations using a reduction over the in-neighbors of a vertex was important to decrease contention, and provided between 2 -- 3x speedup over the Ligra implementation in practice. Many graph processing systems implement PageRank. The optimizing compiler used by GraphIt generates a highly-optimized implementation that is currently the fastest shared-memory , Vol. 1, No. 1, Article . Publication date: August 2019. Fig. 1. Log-linear plot of normalized throughput vs. vertices for MIS, BFS, BC, and coloring on the 3D-Torus graph family. implementation known to us [129]. We note that our implementation is about 1.8x slower than the implementation in GraphIt for LiveJournal and Twitter when run on the same number of threads as in their experiments. 7.7 Performance on 3D-Torus We ran experiments on a family of 3D-Torus graphs with different sizes to study how our diameter- bounded algorithms scale relative to algorithms with polylogarithmic depth. We were surprised to see that the running time of some of our polylogarithmic depth algorithms on this graph, like LDD and connectivity, are 17 -- 40x more expensive than their running time on Twitter and Twitter-Sym, despite 3D-Torus only having 4x and 2.4x more edges than Twitter and Twitter-Sym. Our slightly worse scaling on this graph can be accounted for by the fact that we stored the graph ordered by dimension, instead of storing it using a local ordering. It would be interesting to see how much improvement we could gain by reordering the vertices. In Figure 1 we show the normalized throughput of MIS, BFS, BC, and graph coloring for 3- dimensional tori of different sizes, where throughput is measured as the number of edges processed per second. The throughput for each application becomes saturated before our largest-scale graph for all applications except for BFS, which is saturated on a graph with 2 billion vertices. The throughput curves show that the theoretical bounds are useful in predicting how the half-lengths5 are distributed. The half-lengths are ordered as follows: coloring, MIS, BFS, and BC. This is the same order as sorting these algorithms by their depth with respect to this graph. Locality. While our algorithms are efficient on the TRAM, we do not analyze their cache complexity, and in general they may not be efficient in a model that takes caches into account. Despite this, we observed that our algorithms have good cache performance on the graphs we tested on. In this section we give some explanation for this fact by showing that our primitives make good use of the caches. Our algorithms are also aided by the fact that these graph datasets often come in highly local orders (e.g., see the Natural order in [43]). Table 5 shows metrics for our experiments measured using Open Performance Counter Monitor (PCM). Due to space limitations, we only report numbers for the ClueWeb graph. We observed that using a work-efficient histogram is 3.5x faster than using fetch-and-add in our k-core implementation, 5The graph size when the system achieves half of its peak-performance. , Vol. 1, No. 1, Article . Publication date: August 2019. 100000 1x106 1x107 1x108 1x109normalized throughputnumber of vertices (logscale)MISBFSBCGraph Coloring Algorithm k-core (histogram) k-core (fetch-and-add) weighted BFS (blocked) weighted BFS (unblocked) 9 67 3.7 5.6 Cycles Stalled LLC Hit Rate LLC Misses BW Time 62.9 96 24 221 130 14.4 152 25.2 0.223 0.155 0.070 0.047 49 42 19 29 Table 5. Cycles stalled while the memory subsystem has an outstanding load (trillions), LLC hit rate and misses (billions), bandwidth in GB/s (bytes read and written from memory, divided by running time), and running time in seconds. All experiments are run on the ClueWeb graph using 72 cores with hyper-threading. which suffers from high contention on this graph. Using a histogram reduces the number of cycles stalled due to memory by more than 7x. We also ran our wBFS implementation with and without the edgeMapBlocked optimization, which reduces the number of cache-lines read from and written to when performing a sparse edgeMap. The blocked implementation reads and writes 2.1x fewer bytes than the unoptimized version, which translates to a 1.7x faster runtime. We disabled the dense optimization for this experiment to directly compare the two implementations of a sparse edgeMap. 7.8 Processing Massive Web Graphs In Tables 3 and 4, we show the running times of our implementations on the ClueWeb, Hyper- link2014, and Hyperlink2012 graphs. To put our performance in context, we compare our 72-core running times to running times reported by existing work. Table 6 summarizes state-of-the-art existing results in the literature. Most results process the directed versions of these graphs, which have about half as many edges as the symmetrized version. Unless otherwise mentioned, all results from the literature use the directed versions of these graphs. To make the comparison easier we show our running times for BFS, SSSP (weighted BFS), BC and SCC on the directed graphs, and running times for Connectivity, k-core and TC on the symmetrized graphs in Table 6. FlashGraph [39] reports disk-based running times for the Hyperlink2012 graph on a 4-socket, 32-core machine with 512GB of memory and 15 SSDs. On 64 hyper-threads, they solve BFS in 208s, BC in 595s, connected components in 461s, and triangle counting in 7818s. Our BFS and BC implementations are 12x faster and 16x faster, and our triangle counting and connectivity implementations are 5.3x faster and 18x faster than their implementations, respectively. Mosaic [79] report in-memory running times on the Hyperlink2014 graph; we note that the system is optimized for external memory execution. They solve BFS in 6.5s, connected components in 700s, and SSSP (Bellman-Ford) in 8.6s on a machine with 24 hyper-threads and 4 Xeon-Phis (244 cores with 4 threads each) for a total of 1000 hyper-threads, 768GB of RAM, and 6 NVMes. Our BFS and connectivity implementations are 1.1x and 62x faster respectively, and our SSSP implementation is 1.05x slower. Both FlashGraph and Mosaic compute weakly connected components, which is equivalent to connectivity. BigSparse [67] report disk-based running times for BFS and BC on the Hyperlink2012 graph on a 32-core machine. They solve BFS in 2500s and BC in 3100s. Our BFS and BC implementations are 149x and 88x faster than their implementations, respectively. Slota et al. [123] report running times for the Hyperlink2012 graph on 256 nodes on the Blue Waters supercomputer. Each node contains two 16-core processors with one thread each, for a total of 8192 hyper-threads. They report they can find the largest connected component and SCC from the graph in 63s and 108s respectively. Our implementations find all connected components 2.5x faster than their largest connected component implementation, and find all strongly connected components 1.6x slower than their largest-SCC implementation. Their largest-SCC implementation computes two BFSs from a randomly chosen vertex -- one on the in-edges and the other on the out-edges -- and intersects the reachable sets. We perform the same operation as one of the first , Vol. 1, No. 1, Article . Publication date: August 2019. Paper Mosaic [79] FlashGraph [39] BigSparse [67] Slota et al. [123] This paper Stergiou et al. [124] Connectivity Gluon [41] Graph Memory Hyper-threads Nodes Time Problem 1 2014 6.55 BFS* 1 708 2014 Connectivity* 1 8.6 2014 SSSP* 1 208 2012 BFS* 1 595 2012 BC* 1 2012 461 Connectivity* 1 7818 2012 TC* 1 2500 2012 BFS* 1 3100 2012 BC* 2012 63 Largest-CC* 256 108 Largest-SCC* 2012 256 363 Approx k-core* 2012 256 341 2012 1000 2012 380 256 256 2012 75.3 256 158.2 2012 256 574.9 2012 5.71 2014 1 2014 9.08 1 11.2 2014 1 16.7 2012 1 35.2 2012 1 25.0 2012 1 2012 185 1 58.1 2012 1 184 2012 1 1 2012 462 2012 1 1168 BFS Connectivity PageRank SSSP BFS* SSSP* Connectivity BFS* BC* Connectivity SCC* SSSP k-core PageRank TC 1000 1000 1000 64 64 64 64 32 32 8192 8192 8192 24000 69632 69632 69632 69632 144 144 144 144 144 144 144 144 144 144 144 0.768 0.768 0.768 .512 .512 .512 .512 0.064 0.064 16.3 16.3 16.3 128 24 24 24 24 1 1 1 1 1 1 1 1 1 1 1 Table 6. System configurations (memory in terabytes, hyper-threads, and nodes) and running times (seconds) of existing results on the Hyperlink graphs. The last section shows our running times. *These problems are run on directed versions of the graph. steps of our SCC algorithm and note that it requires about 30 seconds on our machine. They solve approximate k-cores in 363s, where the approximate k-core of a vertex is the coreness of the vertex rounded up to the nearest powers of 2. Our implementation computes the exact coreness of each vertex in 184s, which is 1.9x faster than the approximate implementation while using 113x fewer cores. Recently, Dathathri et al. [41] have reported running times for the Hyperlink2012 graph using Gluon, a distributed graph processing system based on Galois. They process this graph on a 256 node system, where each node is equipped with 68 4-way hyper-threaded cores, and the hosts are connected by an Intel Omni-Path network with 100Gbps peak bandwidth. They report times for BFS, connectivity, PageRank, and SSSP. Other than their connectivity implementation, which uses pointer-jumping, their implementations are based on data-driven asynchronous label-propagation. We are not aware of any theoretical bounds on the work and depth of these implementations. Compared to their reported times, our implementation of BFS is 22.7x faster, our implementation of connectivity is 3x faster, and our implementation of SSSP is 9.8x faster. Our PageRank imple- mentation is 2.9x slower. However, we note that the PageRank numbers they report are not for true PageRank, but PageRank-Delta, and are thus in some sense incomparable. , Vol. 1, No. 1, Article . Publication date: August 2019. Stergiou et al. [124] describe a connectivity algorithm that runs in O(log n) rounds in the BSP model and report running times for the symmetrized Hyperlink2012 graph. They implement their algorithm using a proprietary in-memory/secondary-storage graph processing system used at Yahoo!, and run experiments on a 1000 node cluster. Each node contains two 6-core processors that are 2-way hyper-threaded and 128GB of RAM, for a total of 24000 hyper-threads and 128TB of RAM. Their fastest running time on the Hyperlink2012 graph is 341s on their 1000 node system. Our implementation solves connectivity on this graph in 25s -- 13.6x faster on a system with 128x less memory and 166x fewer cores. They also report running times for solving connectivity on a private Yahoo! webgraph with 272 billion vertices and 5.9 trillion edges, over 26 times the size of our largest graph. While such a graph seems to currently be out of reach of our machine, we are hopeful that techniques from theoretically-efficient parallel algorithms can help solve problems on graphs at this scale and beyond. 8 CONCLUSION In this paper, we showed that we can process the largest publicly-available real-world graph on a single shared-memory server with 1TB of memory using theoretically-efficient parallel algorithms. We outperform existing implementations on the largest real-world graphs, and use much fewer resources than the distributed-memory solutions. On a per-core basis, our numbers are significantly better. Our results provide evidence that theoretically-efficient shared-memory graph algorithms can be efficient and scalable in practice. ACKNOWLEDGEMENTS Thanks to the reviewers and to Lin Ma for helpful comments. This research was supported in part by NSF grants #CCF-1408940, #CCF-1533858, #CCF-1629444, and #CCF-1845763, and DOE grant #DE-SC0018947. REFERENCES [1] C. R. Aberger, A. Lamb, S. Tu, A. Nötzli, K. Olukotun, and C. Ré. Emptyheaded: A relational engine for graph processing. ACM Trans. Database Syst., 2017. [2] A. Aggarwal, R. J. Anderson, and M.-Y. Kao. Parallel depth-first search in general directed graphs. In STOC, 1989. [3] M. Ahmad, F. Hijaz, Q. Shi, and O. Khan. Crono: A benchmark suite for multithreaded graph algorithms executing on futuristic multicores. In IISWC, 2015. problem. J. Algorithms, 1986. [4] N. Alon, L. Babai, and A. Itai. A fast and simple randomized parallel algorithm for the maximal independent set [5] N. Alon, R. Yuster, and U. Zwick. Finding and counting given length cycles. Algorithmica, 17(3), 1997. [6] R. Anderson and E. W. Mayr. A P-complete problem and approximations to it. Technical report, 1984. [7] B. Awerbuch. Complexity of network synchronization. J. ACM, 32(4), 1985. [8] B. Awerbuch and Y. Shiloach. New connectivity and MSF algorithms for Ultracomputer and PRAM. In ICPP, 1983. [9] D. A. Bader and G. Cong. Fast shared-memory algorithms for computing the minimum spanning forest of sparse graphs. JPDC, 2006. cray mta-2. In ICPP, 2006. [10] D. A. Bader and K. Madduri. Design and implementation of the hpcs graph analysis benchmark on symmetric multiprocessors. In International Conference on High-Performance Computing, 2005. [11] D. A. Bader and K. Madduri. Designing multithreaded algorithms for breadth-first search and st-connectivity on the [12] B. Bahmani, A. Goel, and K. Munagala. Efficient primal-dual graph algorithms for mapreduce. In International Workshop on Algorithms and Models for the Web-Graph, pages 59 -- 78, 2014. [13] B. Bahmani, R. Kumar, and S. Vassilvitskii. Densest subgraph in streaming and mapreduce. VLDB, 5(5):454 -- 465, 2012. [14] G. Baier, E. Köhler, and M. Skutella. The k-splittable flow problem. Algorithmica, 42(3-4):231 -- 248, 2005. [15] S. Beamer, K. Asanovic, and D. A. Patterson. The GAP benchmark suite. CoRR, abs/1508.03619, 2015. [16] N. Ben-David, G. E. Blelloch, J. T. Fineman, P. B. Gibbons, Y. Gu, C. McGuffey, and J. Shun. Implicit decomposition for write-efficient connectivity algorithms. In IPDPS, 2018. , Vol. 1, No. 1, Article . Publication date: August 2019. 2013. 2012. 2000. 2016. [17] B. Berger, J. Rompel, and P. W. Shor. Efficient NC algorithms for set cover with applications to learning and geometry. J. Comput. Syst. Sci., 49(3), Dec. 1994. [18] M. Birn, V. Osipov, P. Sanders, C. Schulz, and N. Sitchinava. Efficient parallel and external matching. In Euro-Par, [19] G. E. Blelloch. Prefix sums and their applications. Synthesis of Parallel Algorithms, 1993. [20] G. E. Blelloch and L. Dhulipala. Introduction to parallel algorithms 15-853: Algorithms in the real world. 2018. [21] G. E. Blelloch, J. T. Fineman, P. B. Gibbons, and J. Shun. Internally deterministic algorithms can be fast. In PPoPP, [22] G. E. Blelloch, J. T. Fineman, and J. Shun. Greedy sequential maximal independent set and matching are parallel on average. In SPAA, 2012. [23] G. E. Blelloch, Y. Gu, J. Shun, and Y. Sun. Parallelism in randomized incremental algorithms. In SPAA, 2016. [24] G. E. Blelloch, Y. Gu, and Y. Sun. A new efficient construction on probabilistic tree embeddings. In ICALP, 2017. [25] G. E. Blelloch, R. Peng, and K. Tangwongsan. Linear-work greedy parallel approximate set cover and variants. In SPAA, 2011. 1999. [26] G. E. Blelloch, H. V. Simhadri, and K. Tangwongsan. Parallel and I/O efficient set covering algorithms. In SPAA, 2012. [27] R. D. Blumofe and C. E. Leiserson. Scheduling multithreaded computations by work stealing. J. ACM, 46(5), Sept. [28] P. Boldi and S. Vigna. The WebGraph framework I: Compression techniques. In WWW, 2004. [29] O. Borůvka. O jistém problému minimálním. Práce Mor. Přírodověd. Spol. v Brně III, 3, 1926. [30] U. Brandes. A faster algorithm for betweenness centrality. Journal of mathematical sociology, 25(2), 2001. [31] S. Brin and L. Page. The anatomy of a large-scale hypertextual web search engine. In WWW, pages 107 -- 117, 1998. [32] A. Broder, R. Kumar, F. Maghoul, P. Raghavan, S. Rajagopalan, R. Stata, A. Tomkins, and J. Wiener. Graph structure in the web. Computer networks, 33(1-6), 2000. [33] M. Charikar. Greedy approximation algorithms for finding dense components in a graph. APPROX, pages 84 -- 95, [34] R. Cole, P. N. Klein, and R. E. Tarjan. Finding minimum spanning forests in logarithmic time and linear work using [35] G. Cong and D. A. Bader. An experimental study of parallel biconnected components algorithms on symmetric random sampling. In SPAA, 1996. multiprocessors (SMPs). In IPDPS, 2005. [36] G. Cong and I. G. Tanase. Composable locality optimizations for accelerating parallel forest computations. In HPCC, [37] D. Coppersmith, L. Fleischer, B. Hendrickson, and A. Pinar. A divide-and-conquer algorithm for identifying strongly connected components. 2003. [38] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms (3. ed.). MIT Press, 2009. [39] D. M. Da Zheng, R. Burns, J. Vogelstein, C. E. Priebe, and A. S. Szalay. Flashgraph: Processing billion-node graphs on an array of commodity SSDs. In FAST, 2015. [40] N. S. Dasari, R. Desh, and M. Zubair. ParK: An efficient algorithm for k-core decomposition on multicore processors. [41] R. Dathathri, G. Gill, L. Hoang, H.-V. Dang, A. Brooks, N. Dryden, M. Snir, and K. Pingali. Gluon: A communication- optimizing substrate for distributed heterogeneous graph analytics. In PLDI, pages 752 -- 768. ACM, 2018. [42] L. Dhulipala, G. E. Blelloch, and J. Shun. Julienne: A framework for parallel graph algorithms using work-efficient In Big Data, 2014. [43] L. Dhulipala, I. Kabiljo, B. Karrer, G. Ottaviano, S. Pupyrev, and A. Shalita. Compressing graphs and indexes with [44] R. Duan, K. Lyu, and Y. Xie. Single-source bottleneck path algorithm faster than sorting for sparse graphs. In ICALP, [45] J. A. Edwards and U. Vishkin. Better speedups using simpler parallel programming for graph connectivity and bucketing. In SPAA, 2017. recursive graph bisection. In KDD, 2016. pages 43:1 -- 43:14, 2018. biconnectivity. In PMAM, 2012. [46] J. T. Fineman. Nearly work-efficient parallel algorithm for digraph reachability. In STOC, 2018. [47] M. Fischer and A. Noever. Tight analysis of parallel randomized greedy MIS. In SODA, 2018. [48] L. K. Fleischer, B. Hendrickson, and A. Pinar. On identifying strongly connected components in parallel. In IPDPS, [49] L. R. Ford and D. R. Fulkerson. Maximal flow through a network. In Classic papers in combinatorics, pages 243 -- 248. [50] H. Gazit. An optimal randomized parallel algorithm for finding connected components in a graph. SIAM J. Comput., 2000. 1991. Springer, 2009. , Vol. 1, No. 1, Article . Publication date: August 2019. [51] H. Gazit and G. L. Miller. An improved parallel algorithm that computes the BFS numbering of a directed graph. Information Processing Letters, 28(2), 1988. [52] A. V. Goldberg. Finding a maximum density subgraph. Technical report, Berkeley, CA, USA, 1984. [53] J. E. Gonzalez, Y. Low, H. Gu, D. Bickson, and C. Guestrin. PowerGraph: Distributed graph-parallel computation on natural graphs. In OSDI, 2012. Press, Inc., 1995. [54] O. Green, L. M. Munguia, and D. A. Bader. Load balanced clustering coefficients. In PPAA, 2014. [55] R. Greenlaw, H. J. Hoover, and W. L. Ruzzo. Limits to Parallel Computation: P-completeness Theory. Oxford University [56] Y. Gu, J. Shun, Y. Sun, and G. E. Blelloch. A top-down parallel semisort. In SPAA, 2015. [57] S. Halperin and U. Zwick. An optimal randomized logarithmic time connectivity algorithm for the EREW PRAM (extended abstract). In SPAA, 1994. [58] S. Halperin and U. Zwick. Optimal randomized EREW PRAM algorithms for finding spanning forests. In J. Algorithms, [59] W. Hasenplaugh, T. Kaler, T. B. Schardl, and C. E. Leiserson. Ordering heuristics for parallel graph coloring. In SPAA, [60] L. Hoang, M. Pontecorvi, R. Dathathri, G. Gill, B. You, K. Pingali, and V. Ramachandran. A round-efficient distributed betweenness centrality algorithm. In PPoPP, pages 272 -- 286. ACM, 2019. [61] S. Hong, N. C. Rodia, and K. Olukotun. On fast parallel detection of strongly connected components (SCC) in small-world graphs. In SC, 2013. [62] J. Hopcroft and R. Tarjan. Algorithm 447: efficient algorithms for graph manipulation. Communications of the ACM, 2000. 2014. 1973. [63] A. Iosup, T. Hegeman, W. L. Ngai, S. Heldens, A. Prat-Pérez, T. Manhardto, H. Chafio, M. Capotă, N. Sundaram, M. Anderson, I. G. Tănase, Y. Xia, L. Nai, and P. Boncz. LDBC graphalytics: A benchmark for large-scale graph analysis on parallel and distributed platforms. Proc. VLDB Endow., 9(13), Sept. 2016. [64] A. Israeli and Y. Shiloach. An improved parallel algorithm for maximal matching. Inf. Process. Lett., 1986. [65] A. Itai and M. Rodeh. Finding a minimum circuit in a graph. In STOC, 1977. [66] J. Jaja. Introduction to Parallel Algorithms. Addison-Wesley Professional, 1992. [67] S. W. Jun, A. Wright, S. Zhang, S. Xu, and Arvind. BigSparse: High-performance external graph analytics. CoRR, [68] H. Kabir and K. Madduri. Parallel k-core decomposition on multicore platforms. In IPDPSW, 2017. [69] D. R. Karger, P. N. Klein, and R. E. Tarjan. A randomized linear-time algorithm to find minimum spanning trees. J. abs/1710.07736, 2017. ACM, 42(2), Mar. 1995. [70] R. M. Karp and V. Ramachandran. Handbook of theoretical computer science (vol. a). chapter Parallel Algorithms for Shared-memory Machines. MIT Press, Cambridge, MA, USA, 1990. [71] R. M. Karp and A. Wigderson. A fast parallel algorithm for the maximal independent set problem. In STOC, 1984. [72] J. Kim, W.-S. Han, S. Lee, K. Park, and H. Yu. OPT: A new framework for overlapped and parallel triangulation in large-scale graphs. In SIGMOD, 2014. Trans. Parallel Comput., 2(3), Sept. 2015. [73] R. Kumar, B. Moseley, S. Vassilvitskii, and A. Vattani. Fast greedy algorithms in mapreduce and streaming. ACM [74] H. Kwak, C. Lee, H. Park, and S. Moon. What is twitter, a social network or a news media? In WWW, 2010. [75] M. Latapy. Main-memory triangle computations for very large (sparse (power-law)) graphs. Theor. Comput. Sci., 2008. [76] C. E. Leiserson and T. B. Schardl. A work-efficient parallel breadth-first search algorithm (or how to cope with the [77] Y. Low, J. Gonzalez, A. Kyrola, D. Bickson, C. Guestrin, and J. M. Hellerstein. GraphLab: A new parallel framework nondeterminism of reducers). In SPAA, 2010. for machine learning. In UAI, 2010. machine. In EuroSys, 2017. shortest path problem. In ICS, 2016. [78] M. Luby. A simple parallel algorithm for the maximal independent set problem. SIAM J. Comput., 1986. [79] S. Maass, C. Min, S. Kashyap, W. Kang, M. Kumar, and T. Kim. Mosaic: Processing a trillion-edge graph on a single [80] S. Maleki, D. Nguyen, A. Lenharth, M. Garzarán, D. Padua, and K. Pingali. DSMR: A parallel algorithm for single-source [81] G. Malewicz, M. H. Austern, A. J. Bik, J. C. Dehnert, I. Horn, N. Leiser, and G. Czajkowski. Pregel: A system for large-scale graph processing. In SIGMOD, 2010. [82] Y. Maon, B. Schieber, and U. Vishkin. Parallel ear decomposition search (EDS) and st-numbering in graphs. Theoretical [83] D. W. Matula and L. L. Beck. Smallest-last ordering and clustering and graph coloring algorithms. J. ACM, 30(3), July Computer Science, 47, 1986. 1983. , Vol. 1, No. 1, Article . Publication date: August 2019. [84] R. R. McCune, T. Weninger, and G. Madey. Thinking like a vertex: A survey of vertex-centric frameworks for large-scale distributed graph processing. ACM Comput. Surv., 48(2), Oct. 2015. [85] W. Mclendon Iii, B. Hendrickson, S. J. Plimpton, and L. Rauchwerger. Finding strongly connected components in distributed graphs. Journal of Parallel and Distributed Computing, 65(8), 2005. [86] R. Meusel, S. Vigna, O. Lehmberg, and C. Bizer. The graph structure in the web -- analyzed on different aggregation levels. The Journal of Web Science, 1(1), 2015. [87] U. Meyer and P. Sanders. Parallel shortest path for arbitrary graphs. In Euro-Par, 2000. [88] U. Meyer and P. Sanders. ∆-stepping: a parallelizable shortest path algorithm. J. Algorithms, 49(1), 2003. [89] G. L. Miller, R. Peng, A. Vladu, and S. C. Xu. Improved parallel algorithms for spanners and hopsets. pages 192 -- 201, 2015. 2012. [90] G. L. Miller, R. Peng, and S. C. Xu. Parallel graph decompositions using random shifts. In SPAA, 2013. [91] G. L. Miller and V. Ramachandran. A new graph triconnectivity algorithm and its parallelization. Combinatorica, [92] L. Nai, Y. Xia, I. G. Tanase, H. Kim, and C.-Y. Lin. GraphBIG: Understanding graph computing in the context of 12(1), Mar 1992. industrial solutions. In SC, 2015. [93] D. Nguyen, A. Lenharth, and K. Pingali. A lightweight infrastructure for graph analytics. In SOSP, 2013. [94] S. Nobari, T.-T. Cao, P. Karras, and S. Bressan. Scalable parallel minimum spanning forest computation. In PPoPP, [95] M. Ortmann and U. Brandes. Triangle listing algorithms: Back from the diversion. In ALENEX, 2014. [96] V. Osipov, P. Sanders, and J. Singler. The filter-kruskal minimum spanning tree algorithm. In ALENEX, 2009. [97] R. Pagh and F. Silvestri. The input/output complexity of triangle enumeration. In PODS, 2014. [98] M. Patwary, P. Refsnes, and F. Manne. Multi-core spanning forest algorithms using the disjoint-set data structure. In IPDPS, 2012. [99] D. Peleg and A. A. Schäffer. Graph spanners. Journal of graph theory, 13(1):99 -- 116, 1989. [100] S. Pettie and V. Ramachandran. A randomized time-work optimal parallel algorithm for finding a minimum spanning forest. SIAM J. Comput., 31(6), 2002. [101] C. A. Phillips. Parallel graph contraction. In SPAA, 1989. [102] C. K. Poon and V. Ramachandran. A randomized linear work EREW PRAM algorithm to find a minimum spanning forest. In ISAAC, 1997. programs. SIAM J. Comput., 28(2), Feb. 1999. [103] S. Rajagopalan and V. V. Vazirani. Primal-dual RNC approximation algorithms for set cover and covering integer [104] V. Ramachandran. A framework for parallel graph algorithm design. In Optimal Algorithms, 1989. [105] V. Ramachandran. Parallel open ear decomposition with applications to graph biconnectivity and triconnectivity. In Synthesis of Parallel Algorithms, 1993. [106] J. Reif. Optimal parallel algorithms for integer sorting and graph connectivity. TR-08-85, Harvard University, 1985. [107] A. E. Sariyuce, C. Seshadhri, and A. Pinar. Parallel local algorithms for core, truss, and nucleus decompositions. CoRR, abs/1704.00386, 2017. 2005. [108] T. Schank. Algorithmic aspects of triangle-based network analysis. PhD Thesis, Universitat Karlsruhe, 2007. [109] T. Schank and D. Wagner. Finding, counting and listing all triangles in large graphs, an experimental study. In WEA, [110] W. Schudy. Finding strongly connected components in parallel using O(log2 N) reachability queries. In SPAA, 2008. [111] S. B. Seidman. Network structure and minimum degree. Soc. Networks, 5(3), 1983. [112] M. Sevenich, S. Hong, A. Welc, and H. Chafi. Fast in-memory triangle listing for large real-world graphs. In Workshop [113] Y. Shiloach and U. Vishkin. An O(log n) parallel connectivity algorithm. J. Algorithms, 1982. [114] J. Shun and G. E. Blelloch. Ligra: A lightweight graph processing framework for shared memory. In PPoPP, 2013. [115] J. Shun, G. E. Blelloch, J. T. Fineman, and P. B. Gibbons. Reducing contention through priority updates. In SPAA, 2013. [116] J. Shun, G. E. Blelloch, J. T. Fineman, P. B. Gibbons, A. Kyrola, H. V. Simhadri, and K. Tangwongsan. Brief announcement: on Social Network Mining and Analysis, 2014. the Problem Based Benchmark Suite. In SPAA, 2012. [117] J. Shun, L. Dhulipala, and G. E. Blelloch. A simple and practical linear-work parallel algorithm for connectivity. In SPAA, 2014. DCC, 2015. [118] J. Shun, L. Dhulipala, and G. E. Blelloch. Smaller and faster: Parallel processing of compressed graphs with Ligra+. In [119] J. Shun and K. Tangwongsan. Multicore triangle computations without tuning. In ICDE, 2015. [120] G. M. Slota and K. Madduri. Simple parallel biconnectivity algorithms for multicore platforms. In HiPC, 2014. [121] G. M. Slota, S. Rajamanickam, and K. Madduri. BFS and coloring-based parallel algorithms for strongly connected components and related problems. In IPDPS, 2014. , Vol. 1, No. 1, Article . Publication date: August 2019. [122] G. M. Slota, S. Rajamanickam, and K. Madduri. Supercomputing for Web Graph Analytics. Apr 2015. [123] G. M. Slota, S. Rajamanickam, and K. Madduri. A case study of complex graph analysis in distributed memory: Implementation and optimization. In IPDPS, 2016. [124] S. Stergiou, D. Rughwani, and K. Tsioutsiouliklis. Shortcutting label propagation for distributed connected components. In WSDM, 2018. [125] R. E. Tarjan and U. Vishkin. An efficient parallel biconnectivity algorithm. SIAM Journal on Computing, 1985. [126] M. Thorup and U. Zwick. Approximate distance oracles. Journal of the ACM (JACM), 52(1):1 -- 24, 2005. [127] D. J. Welsh and M. B. Powell. An upper bound for the chromatic number of a graph and its application to timetabling problems. The Computer Journal, 1967. [128] D. Yan, Y. Bu, Y. Tian, and A. Deshpande. Big graph analytics platforms. Foundations and Trends in Databases, 7, 2017. [129] Y. Zhang, M. Yang, R. Baghdadi, S. Kamil, J. Shun, and S. Amarasinghe. Graphit: A high-performance graph dsl. Proc. ACM Program. Lang., 2(OOPSLA):121:1 -- 121:30, Oct. 2018. [130] W. Zhou. A practical scalable shared-memory parallel algorithm for computing minimum spanning trees. Master's thesis, KIT, 2017. A GRAPH STATISTICS In this section, we list graph statistics computed for the graphs from Section 7.6 These statistics include the number of connected components, strongly connected components, colors used by the LLF and LF heuristics, number of triangles, and several others. These numbers will be useful for verifying the correctness or quality of our algorithms in relation to future algorithms that also run on these graphs. Although some of these numbers were present in Table 2, we include in the tables below for completeness. To ensure that the interested reader can reproduce these results we provide details about the statistics that are not self-explanatory. • Effective Directed Diameter: the maximum number of levels traversed during a graph traversal algorithm (BFS or SCC) on the unweighted directed graph. • Effective Undirected Diameter: the maximum number of levels traversed during a graph traversal algorithm (BFS) on the unweighted directed graph. • Size of Largest (Connected/Biconnected/Strongly-Connected) Component: The number of vertices in the largest (connected/biconnected/strongly-connected) component. Note that in the case of biconnectivity, we assign labels to edges, so a vertex participates in a component for each distinct edge label incident to it. • Num. Triangles: The number of closed triangles in G, where each triangle (u, v, w) is counted exactly once. • Num. Colors Used by (LF/LLF): The number of colors used is just the maximum color ID assigned to any vertex. • (Maximum Independent Set/Maximum Matching/Approximate Set Cover) Size: We report the sizes of these objects computed by our implementations. For MIS and maximum matching we report this metric to lower-bound on the size of the maximum independent set and maximum matching supported by the graph. For approximate set cover, we run our code on instances similar to those used in prior work (e.g., Blelloch et al. [26] and Dhulipala et al. [42]) where the elements are vertices and the sets are the neighbors of each vertex in the undirected graph. In the case of the social network and hyperlink graphs, this optimization problem naturally captures the minimum number of users or Web pages whose neighborhoods must be retrieved to cover the entire graph. • kmax (Degeneracy): The value of k of the largest non-empty k-core. 6Similar statistics can be found on the SNAP website (https://snap.stanford.edu/data/) and the Laboratory for Web Algorith- mics website (http://law.di.unimi.it/datasets.php). , Vol. 1, No. 1, Article . Publication date: August 2019. Statistic Num. Vertices Num. Directed Edges Num. Undirected Edges Effective Directed Diameter Effective Undirected Diameter Num. Connected Components Num. Biconnected Components Num. Strongly Connected Components Size of Largest Connected Component Size of Largest Biconnected Component Size of Largest Strongly Connected Component Num. Triangles Num. Colors Used by LF Num. Colors Used by LLF Maximal Independent Set Size Maximal Matching Size Set Cover Size kmax (Degeneracy) ρ (Num. Peeling Rounds in k-core) Value 4,847,571 68,993,773 85,702,474 16 20 1,876 1,133,883 971,232 4,843,953 3,665,291 3,828,682 285,730,264 323 327 2,316,617 1,546,833 964,492 372 3,480 Table 7. Graph statistics for the LiveJournal graph. Statistic Num. Vertices Num. Directed Edges Num. Undirected Edges Effective Directed Diameter Effective Undirected Diameter Num. Connected Components Num. Biconnected Components Num. Strongly Connected Components Size of Largest Connected Component Size of Largest Biconnected Component Size of Largest Strongly Connected Component Num. Triangles Num. Colors Used by LF Num. Colors Used by LLF Maximal Independent Set Size Maximal Matching Size Set Cover Size kmax (Degeneracy) ρ (Num. Peeling Rounds in k-core) Value 3,072,627 -- 234,370,166 -- 9 187 68,117 -- 3,072,441 3,003,914 -- 627,584,181 86 98 651,901 1,325,427 105,572 253 5,667 Table 8. Graph statistics for the com-Orkut graph. As com-Orkut is an undirected graph, some of the statistics are not applicable and we mark the corresponding values with -- . , Vol. 1, No. 1, Article . Publication date: August 2019. Statistic Num. Vertices Num. Directed Edges Num. Undirected Edges Effective Directed Diameter Effective Undirected Diameter Num. Connected Components Num. Biconnected Components Num. Strongly Connected Components Size of Largest Connected Component Size of Largest Biconnected Component Size of Largest Strongly Connected Component Num. Triangles Num. Colors Used by LF Num. Colors Used by LLF Maximal Independent Set Size Maximal Matching Size Set Cover Size kmax (Degeneracy) ρ (Num. Peeling Rounds in k-core) Value 41,652,231 1,468,365,182 2,405,026,092 65 23 2 1,936,001 8,044,729 41,652,230 39,708,003 33,479,734 34,824,916,864 1,081 1,074 26,564,540 9,612,260 1,736,761 2,488 14,963 Table 9. Graph statistics for the Twitter graph. Statistic Num. Vertices Num. Directed Edges Num. Undirected Edges Effective Directed Diameter Effective Undirected Diameter Num. Connected Components Num. Biconnected Components Num. Strongly Connected Components Size of Largest Connected Component Size of Largest Biconnected Component Size of Largest Strongly Connected Component Num. Triangles Num. Colors Used by LF Num. Colors Used by LLF Maximal Independent Set Size Maximal Matching Size Set Cover Size kmax (Degeneracy) ρ (Num. Peeling Rounds in k-core) Value 978,408,098 42,574,107,469 74,774,358,622 821 132 23,794,336 81,809,602 135,223,661 950,577,812 846,117,956 774,373,029 1,995,295,290,765 4,245 4,245 459,052,906 311,153,771 64,322,081 4,244 106,819 Table 10. Graph statistics for the ClueWeb graph. , Vol. 1, No. 1, Article . Publication date: August 2019. Statistic Num. Vertices Num. Directed Edges Num. Undirected Edges Effective Directed Diameter Effective Undirected Diameter Num. Connected Components Num. Biconnected Components Num. Strongly Connected Components Size of Largest Connected Component Size of Largest Biconnected Component Size of Largest Strongly Connected Component Num. Triangles Num. Colors Used by LF Num. Colors Used by LLF Maximal Independent Set Size Maximal Matching Size Set Cover Size kmax (Degeneracy) ρ (Num. Peeling Rounds in k-core) Value 1,724,573,718 64,422,807,961 124,141,874,032 793 207 129,441,050 132,198,693 1,290,550,195 1,574,786,584 1,435,626,698 320,754,363 4,587,563,913,535 4154 4158 1,333,026,057 242,469,131 23,869,788 4,160 58,711 Table 11. Graph statistics for the Hyperlink2014 graph. Statistic Num. Vertices Num. Directed Edges Num. Undirected Edges Effective Directed Diameter Effective Undirected Diameter Num. Connected Components Num. Biconnected Components Num. Strongly Connected Components Size of Largest Connected Component Size of Largest Biconnected Component Size of Largest Strongly Connected Component Num. Triangles Num. Colors Used by LF Num. Colors Used by LLF Maximal Independent Set Size Maximal Matching Size Set Cover Size kmax (Degeneracy) ρ (Num. Peeling Rounds in k-core) Value 3,563,602,789 128,736,914,167 225,840,663,232 5275 331 144,628,744 298,663,966 1,279,696,892 3,355,386,234 3,023,064,231 1,827,543,757 9,648,842,110,027 10,566 10,566 1,799,823,993 2,434,644,438 372,668,619 10,565 130,728 Table 12. Graph statistics for the Hyperlink2012 graph. , Vol. 1, No. 1, Article . Publication date: August 2019.
1804.10726
1
1804
2018-04-28T02:58:00
QDR-Tree: An Efcient Index Scheme for Complex Spatial Keyword Query
[ "cs.DS", "cs.DB" ]
With the popularity of mobile devices and the development of geo-positioning technology, location-based services (LBS) attract much attention and top-k spatial keyword queries become increasingly complex. It is common to see that clients issue a query to find a restaurant serving pizza and steak, low in price and noise level particularly. However, most of prior works focused only on the spatial keyword while ignoring these independent numerical attributes. In this paper we demonstrate, for the first time, the Attributes-Aware Spatial Keyword Query (ASKQ), and devise a two-layer hybrid index structure called Quad-cluster Dual-filtering R-Tree (QDR-Tree). In the keyword cluster layer, a Quad-Cluster Tree (QC-Tree) is built based on the hierarchical clustering algorithm using kernel k-means to classify keywords. In the spatial layer, for each leaf node of the QC-Tree, we attach a Dual-Filtering R-Tree (DR-Tree) with two filtering algorithms, namely, keyword bitmap-based and attributes skyline-based filtering. Accordingly, efficient query processing algorithms are proposed. Through theoretical analysis, we have verified the optimization both in processing time and space consumption. Finally, massive experiments with real-data demonstrate the efficiency and effectiveness of QDR-Tree.
cs.DS
cs
QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query Xinshi Zang, Peiwen Hao, Xiaofeng Gao( ), Bin Yao, and Guihai Chen Department of Computer Science and Engineering, Shanghai Jiao Tong University, China {fei125,williamhao}@sjtu.edu.cn,{gao-xf,yaobin,gchen}@cs.sjtu.edu.cn Abstract. With the popularity of mobile devices and the development of geo-positioning technology, location-based services (LBS) attract much attention and top-k spatial keyword queries become increasingly com- plex. It is common to see that clients issue a query to find a restaurant serving pizza and steak, low in price and noise level particularly. However, most of prior works focused only on the spatial keyword while ignoring these independent numerical attributes. In this paper we demonstrate, for the first time, the Attributes- Aware Spatial Keyword Query (ASKQ), and devise a two-layer hybrid index structure called Quad-cluster Dual-filtering R-Tree (QDR-Tree). In the keyword cluster layer, a Quad-Cluster Tree (QC-Tree) is built based on the hierarchical clustering algorithm using kernel k-means to classify keywords. In the spatial layer, for each leaf node of the QC- Tree, we attach a Dual-Filtering R-Tree (DR-Tree) with two filtering algorithms, namely, keyword bitmap-based and attributes skyline-based filtering. Accordingly, efficient query processing algorithms are proposed. Through theoretical analysis, we have verified the optimization both in processing time and space consumption. Finally, massive experiments with real-data demonstrate the efficiency and effectiveness of QDR-Tree. Keywords: Top-k Spatial Keyword Query, Skyline Algorithm, Keyword Cluster, Location-based Service 1 Introduction With the growing popularity of mobile devices and the advance in geo-positioning technology, location-based services (LBS) are widely used and spatial keyword query becomes increasingly complex. Clients may have special requests on nu- merical attributes, such as price, in addition to the location and keywords. Example 1. Consider some spatial objects in Fig. 1(a), where dots represent spa- tial objects such as restaurants, whose keywords and three numerical attributes are listed in Fig. 1(b). Dots with the same color own similar keywords, e.g., red dots share keywords about food. The triangle represents a user issuing a query to find a nearest restaurant serving pizza and steak with low level in price, noise, 8 1 0 2 r p A 8 2 ] S D . s c [ 1 v 6 2 7 0 1 . 4 0 8 1 : v i X r a 2 X. Zang et al. and congestion. At a first glance, o8 seems to be the best choice for the close range, while o1 surpasses o8 in the numerical attributes obviously. This common situation shows that such complex queries deserve careful treatment. (a) Geo-position of spatial objects (b) Keywords and attributes table Fig. 1. A set of spatial objects and a query Extensive efforts have been made to support spatial keyword query. How- ever, prior works [7, 9, 15] mainly focused on the keywords of spatial objects but neglected or failed to distinguish independent numerical attributes. Recently, Sasaki Y. [16] schemed out SKY R-Tree which incorporates R-tree with sky- line algorithm to deal with the numerical attributes. However, it does not work well for multi keywords, which reduces their usage for various applications. Liu X. [10] proposed a hybrid index structure called Inverted R-tree with Synopses tree (IRS), which can search many different types of numerical attributes si- multaneously. However, the IRS-based search algorithm requires providing ex- act ranges of attributes which is a heavy and unnecessary burden to the users. What's more, the exact match in in attributes can also lead to few or no query results to be returned. Correspondingly, in this paper, we named and studied, for the first time, the attributes-aware spatial keyword query (ASKQ). This complex query needs to take location proximity, keywords' similarity, and the value of numerical at- tributes into consideration, that is respectively, the Euclidean spatial distance, the relevance of different keywords, and the integrated attributes of users' pref- erence. Obviously the ASKQ has wide apps in the real world. Tackling with the ASKQ in Example 1, common search algorithms [7, 9, 15] ignoring numerical attributes may retrieve finally o1, o5, o8 indiscriminately, and SKY R-Tree-based algorithm may return o4 as one of results, and IRS-Tree-based algorithm may retrieve no objects when the query predicate is set as "price < 0.3 & noise < 0.3 & congestion < 0.4". Apparently, none of these algorithms can satisfy the users' need. These gaps motivate us to investigate new approaches that can deal with the ASKQ efficiently. In this paper, we propose a novel two-layer index structure called Quad- cluster Dual-filter R-Tree (QDR-Tree) with query processing algorithms. In the 1.00.50.51.00q:pizza,steak,lowinprice,noise,andconges-tionO7O9O2O3O1O8O6O5O4OXSpatialobjectsKeywordsNumericalattributespricenoisecongestionO2O3O7O9hospital,dentistcinema,theateryouth,hotelmarket,mallhamburger,pizzaO1O4O5O6O8pizza,steakpizza,steaksandwich,breadpizza,steak0.30.70.30.20.60.70.50.50.20.30.50.50.40.30.20.30.50.40.40.30.60.20.30.20.40.50.8xy1.00.50.51.00q:pizza,steak,lowinprice,noise,andconges-tionO7O9O2O3O1O8O6O5O4OXSpatialobjectsKeywordsNumericalattributespricenoisecongestionO2O3O7O9hospital,dentistcinema,theateryouth,hotelmarket,mallhamburger,pizzaO1O4O5O6O8pizza,steakpizza,steaksandwich,breadpizza,steak0.30.70.30.20.60.70.50.50.20.30.50.50.40.30.20.30.50.40.40.30.60.20.30.20.40.50.8 QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query 3 first layer we deal with keyword specifically. Considering numbers of keywords share the similar semanteme and clients tend to query objects of the same class, we cluster and store the keywords in a Quad-Cluster Tree (QC-Tree) by hier- archical clustering algorithm using kernel k-means clustering [6]. With keyword relaxation operation and Cut-line theorem to avoid redundance, QC-Tree can balance search time and space cost well. In the second layer we deal with spatial objects with numerical attributes. At each leaf node of the first layer, a Dual-filter R-Tree (DR-Tree) is attached according to two filtering algorithms, namely, keyword bitmap-based filtering and attributes skyline-based filtering, which effectively reduce the false positives. Moreover, we also propose a novel method to measure the relevance of one spatial object with the query keywords. We measure the similarity of different keywords from both textual and semantic aspects. For the latter one, the term vectors that are obtained by word2vec [12] are applied to represent every key- words, and therefore, the similarity can be quantified. Note that both queries and spatial objects usually own several keywords, a bitmap of keywords is used to measure the relevance between two lists of keywords lightly and efficiently. Table 1 compares the current index with QDR-Tree in three aspects. Appar- ently, QDR-Tree outperform existing methods in tackling with the ASKQ, and can achieve great improvements in query processing time and space consump- tion. This will be demonstrated in both theoretical and experimental analysis. Massive experiments with real-data also confirm the efficiency of QDR-Tree. Table 1. Comparisons among current indexes and QDR-Tree Index IR-Tree From location proximity muti-keywords fuzzy attributes TKDE(2011) [9] ICDE(2013) [18] IL-Quadtree SKY R-Tree DASFAA(2014) [16] IRS-Tree QDR-Tree TKDE(2015) [10] DEXA(2018) ! ! ! ! ! ! ! % ! ! % % ! % ! To sum up, the main contributions of this paper are summarized as follows: – We formulate the attributes-aware spatial keyword query, which takes spatial proximity, keywords' similarity and numerical attributes into consideration. – We design a novel hybrid index structure, i.e., QDR-Tree which incorporates Quad-Cluster Tree with Dual-filtering R-Trees and accordingly propose the query processing algorithm to tackle the ASKQ. – We propose a novel method to measure the relevance of one spatial objects with query keywords based on word2vec and bitmap of keyword. – We conduct an empirical study that demonstrates the efficiency of our algo- rithms and index structures for processing the ASKQ on real-world datasets. The rest of the paper is organized as follows. Section 2 reviews the related works. Section 3 formulates the problem of ASKQ. Section 4 presents the QDR- Tree. Section 5 introduces the query processing algorithm based on the QDR- 4 X. Zang et al. Tree. Three baseline algorithms are proposed in Section 6 and considerable ex- perimental results are reported. Finally, Section 7 concludes the paper. 2 Related Work Existing works concerning the ASKQ include spatial keyword search, keyword relevance measurement, and the skyline operator. Spatial keyword search. There are many studies on spatial keyword search recently [7,17,18]. Most of them focus on integrating inverted index and R-tree to support spatial keyword search. For example, IR2-tree [7] combines R-trees with signature files. It preserves objects spatial proximity, which is the key to solve spatial queries efficiently, and can filter a considerable portion of the objects that do not contain all the query keywords. Thus it significantly reduces the number of objects to be examinated. SI-index [18] overcomes IR2-trees' drawbacks and outperform IR2-tree in query response time significantly. [17] proposes inverted linear quadtree, which is carefully designed to exploit both spatial and keyword- based pruning techniques to effectively reduce the search space. Keyword relevance measurement. The traditional measurement on key- word relevance includes textual and semantic relevance. The textual relevance can be computed using an information retrieval model [2, 4, 5, 19]. They are all TF-IDF variants essentially sharing the same fundamental principles. The semantic relevance is measured by many methods. [13, 14] apply the Latent Dirichlet Allocation (LDA) model to calculate the topic distance of keywords. Gao Y. [3] proposed an efficient disk-based metric access method which achieves excellent performance in the measurement of keywords' similarity. The skyline operator. The skyline operator deals with the optimization problem of selecting multi-dimension points. A skyline query returns a set of points that are not dominated by any other points, called a skyline. It is said that a point oi dominates another point oj if oi is no worse than oj in all dimensions of attributes and is better than oj at least in one dimension. Borzsonyi et al. [1] first introduced the skyline operator into relational database systems and introduced three algorithms. Geng et al. [11] propose a method which combines the spatial information with non-spatial information to obtain skyline results. Lee [8] et al. focused on two methods about multi-dimensional subspace skyline computation and developed orthogonal optimization principles. 3 Problem Statement Given an geo-object dataset O in which each object o is denoted as a tuple (cid:104)λ, K, A(cid:105), where o.λ is a location descriptor which we assume is at a two dimen- sional geographical space and is composed of latitude and longitude, o.K is the set of keywords, and o.A represents the set of numerical attributes. Without loss of generality, we assume the attributes o.ai in o.A are numeric attributes and normalize each o.ai ∈ [0, 1]. We assume that smaller values of these nu- mercial attributes, e.g., price and noise, are preferable. As for other numerical QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query 5 ∀q.wi ∈ q.W, q.wi ≥ 0 (i = 1, . . . ,q.W) and (cid:80)q.W attributes' values which are better if higher, such as the rating and health score, we convert them decreasingly as o.ai = 1 − o.ai. The query q is represented as a tuple (cid:104)λ, K, W(cid:105), where q.λ and q.K represent the location of the user and the required keywords respectively, and q.W represents the set of weight for dif- ferent numerical attributes and user's different preference on these attributes. i=1 q.wi = 1. The reason for assigning weight to each attribute instead of qualifying exact range of attributes is to prepare for the fuzzy query on numerical attributes. In order to elaborate the QDR-Tree , we firstly define the keyword distance and the keyword cluster as follows. Definition 1 (Keyword Distance). Given two keywords k1, k2, their keyword distance, denoted as d(k1, k2), includes both textual distance and semantic dis- tance. The textual similarity between two keywords is denoted as dt(k1, k2) which is measured by the Edit Distance. The semantic distance between two keywords denoted as ds is measured by the Euclidean distance of the term vector gener- ated by word2vec. With a parameter δ(∈ [0, 1]) controlling their relative weights, Eqn. (1) describes the formulation of d(k1, k2). d(k1, k2) = δdt(k1, k2) + (1 − δ)ds(k1, k2) (1) Definition 2 (Keyword Cluster). A keyword cluster (Ci) is formed by simi- lar keywords. The cluster diameter is defined as the maximum keyword distance within the cluster. One keyword can be allocated into the cluster if the diameter after adding it does not exceed the threshold τ , i.e. ∀ki, kj ∈ Ci, d(ki, kj) < τ . Each cluster has a center object denoted as Ci.cen. All the keyword clusters (Ci) make up the set of keyword clusters (C). Definition 3 (Attributes-Aware Spatial Keyword Query). Given a geo- object set O and the attributes-aware spatial keyword query q, the result includes a set of T opκ(q),1 T opκ(q) ⊂ O, T opκ(q) = κ and ∀oi, oj : oi ∈ T opκ(q), oj ∈ O − T opκ(q), it holds that score(q, oi) ≤ score(q, oj). As for the evaluation function, score(q, o) in Def. 3, it is composed of three aspects, including the location proximity, the keywords similarity, and the value of numerical attributes, and will be discussed at large in the Sec. 5. 4 QDR-Tree In this section, we introduce a new hybrid index structure QDR-Tree, which is a new indexing framework for efficiently processing the ASKQ. The QDR-Tree can be divided into two layers, the keyword cluster layer and the spatial layer where the QDR-Tree can be split up into two sub-trees, named as Quad-Cluster Tree (QC-Tree) and Dual-filtering R-tree (DR-Tree) respectively. 1 Hereafter, Top-k is denoted as Top-κ to avoid confusion with the k-means algorithm. 6 X. Zang et al. 4.1 Keyword cluster layer The keyword cluster layer deals with keyword search with both textual and semantic similarities. Neither appending an R-Tree to each keyword with a huge space redundancy, nor just clustering all keywords into k groups with a high false positive ratio during query search, QC-Tree smartly splits keyword set into hierarchical levels and link them by a Quad-Tree. To improve the searching efficiency, we propose a new hierarchical quad clus- tering algorithm based on the kernel k-means [6]. Compared with the tradi- tional k-means clustering, kernel k-means will have better clustering effect even the samples do not obey the normal distribution and is more suitable to clus- ter the keywords. Moreover, different from the common clustering, hierarchical clustering can form a meaningful relationship between different clusters, which is helpful to allocate a new sample and decrease the cost of misallocation. After the clustering process finishs, a quad-cluster tree (QC-Tree) is used to arrange all of these clusters, which is the core composition of the keyword cluster layer. In Alg. 1, the critical part is applying the kernel k-means to each keyword clus- ter per level, with k fixed as 4. Furthermore, when the diameter of the keyword cluster is smaller than the τcluster, the duplication operation is executed, which is presented in Alg. 2 and will be discussed later. Algorithm 1: Hierarchical quad clustering algorithm Input: keyword set K, cluster number k Output: Quad-Cluster Tree: Tqc 4 1 Tqc.add(K) 2 Insert K into a priority queue U 3 while U (cid:54)= ∅ do S ← U .Pop() {S1,S2,S3,S4} ← KernelkMeans (k, S) foreach Si ∈ {S1, S2, S3, S4} do if Si.diameter < τcluster then Duplication (S1,S2,S3,S4) 7 8 6 5 /* instert as a set */ /* pop the whole set */ /* k=4 by default */ 9 10 11 else insert Si in to U Tqc.add(Si) /* Si are children of S */ Algorithm 2: Duplication 1 for ∀ki ∈ S1 Input: Four keyword sets: S1,S2,S3,S4 1,S(cid:48) Output: Duplicated keyword sets: S(cid:48) (cid:83) S4 do (cid:83) S3 (cid:83) S2 (cid:83) Sj, if ki (cid:54)∈ Sj with j ∈ {1, 2, 3, 4} if σ(d(ki, Sj.cen)) ¡ τdup then 2,S(cid:48) 3,S(cid:48) j ← ki S(cid:48) 2 3 4 /* Variance */ 4 {S1, S2, S3, S4} ← {S(cid:48) 1, S(cid:48) 2, S(cid:48) 3, S(cid:48) 4 } QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query 7 Fig. 2(a) illustrates the hierarchical clustering in Alg. 1, where each dot represents a keyword and different aggregation of these dots presents different keyword clusters. The dots marked in different color are the centroid of these clusters, and moreover, same color denotes their clusters stay in the same level. (a) Distribution (b) Quad-cluster Tree (c) Keyword relaxation Fig. 2. Overview of the keyword cluster layer Notice that, the main target of QC-Tree is to improve the pruning effect of keywords while making the future query keyword set located in only one keyword cluster. As is shown in both Alg. 1 and Fig. 2(a), with the cluster level growing, the cluster will be more centralized and compact. That means the possibility of one query being allocated to different clusters increases layer by layer. It is necessary to decide an optimal τcluster to terminate the hierarchical cluster proceeding, if not, there would only be a single keyword in each cluster finally. The basic structure of QC-Tree is displayed in Fig. 2(b), where each internal node keeps the centroid keyword (cen) and four pointers (4p) to its four descendants nodes, and each leaf node will keep the keyword set in this cluster and the pointer to a new DR-Tree. Additionally, a cut-line is drawn to emphasize the shift of index structure, which is mainly dependent on the value of τcluster. As is analyzed above, the leaf cluster is where a query would most likely be scattered into different clusters. We will take a keyword-relaxation operation by duplicating some keywords among the four clusters sharing the same parent node. In Fig. 2(c), for a keyword cluster, its keywords are grouped into four sub-clusters and the duplication operation need to be executed. The dots in the shadow represent the keywords that will be duplicated and allocated to all of these four sub-clusters because they are closed to all of the sub-clusters. Here, we introduce another threshold (τdup) to decide whether to execute the duplication operation. Although this keyword-relaxation operator will cause redundancy of keywords and extra space consumption, it will largely improve the time efficiency, which will also be demonstrated in the experimental verification. 4.2 Spatial layer Under each keyword cluster in the bottom of QC-Tree, we build a DR-Tree based on dual-filtering technique to organize the spatial objects in this cluster. ...NWNESWSEClusterClusterNWSWNESEClusterL0L1L1L2......ClusterClusterClusterLn−1LnLn+1NWSWNESE(cid:104)Cen,4p(cid:105)(cid:104)Cen,4p(cid:105)(cid:104)Cen,KS(cid:105)CuttinglineDR-TreeDR-TreeClusterLnnon-duplicationduplicationpartClusterLn−1ClusterLnpartDR-TreeDR-TreesCuttinglineClusterLmClusterClusterClusterL0L1L2NWSWNESE(cid:104)Cen,4p(cid:105)(cid:104)Cen,4p(cid:105)(cid:104)Cen,KS(cid:105)CuttinglineDR-TreeDR-TreeClusterLnnon-duplicationduplicationpartClusterLn−1ClusterLnpart 8 X. Zang et al. In Fig. 3, a basic structure of DR-Tree is shown in the spatial layer. Each internal node N records a two-element tuple: (cid:104)SP, KB(cid:105). The first element SP stands for the skyline points of the numerical attributes of all objects in the subtree rooted at the node. The second element is a bitmap of the keywords included in this cluster, which uses 1 and 0 to denote the existence of keywords. Keyword bitmap filter algorithm: In the DR-Tree, each node just records the keyword bitmap, and then the specific keywords list is kept only in the leaf keyword cluster. Then, the keyword relevance can be calculated just by Bitwise AND within the pair of bitmaps, which can decrease the storage consumption and increase the query efficiency. Because bitwise AND within bitmaps need an exact keywords matching, in order to support similar keyword matching, we also implement the relaxation in each query process. In Fig. 3, as is highlighted in blue, the bitmap of query keywords performs a search-relaxation by switching some 0-bits to 1-bits based on the keyword similarity The search-relaxation algorithm will be proposed in Alg. 4 in Section 4.2. Fig. 3. Structure of QDR-Tree Multidimensional subspace skyline filter algorithm: In order to satisfy the needs of user's intention on multiple attributes, a filter called Multidimen- sional Subspace Skyline Filter, which is inspired by [1,8], is employed to amortize .........KeywordClusterLayero2o8o1SpatialLayer.........Skylinepoints(cid:104)0100...10100(cid:105)Keywordbitmap(cid:104)p1,p2,...(cid:105)duplicationDR-Treeq.Kbitmap(cid:104)0010...00100(cid:105)Searchrelaxationbitmap(cid:104)0111...01110(cid:105)QC-TreeKeywordrelaxationCut-line QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query 9 the query false positive and the cost of computation. We use the Evaluate() al- gorithm proposed in [8] to gain the multidimensional skyline points efficiently, and then let every QC-Tree node record the skyline points of its descendants. Furthermore, in order to reduce the complexity of recording multidimensional skyline points, we will take the point-compression operation by merging the closed skyline points in the attributes space. We calculate the cosine distance between skyline points' attributes to measure the similarity, and then merge these closed points when cosine distance is larger than a threshold. 5 QDR-based Query Algorithm In this section, we will introduce the ASKQ processing algorithms based on QDR-Tree. The process includes finding the Leaf Cluster, making search-relaxation and searching in the DR-Tree. Find the leaf cluster The leaf keyword cluster that is best-matched with q can be obtained by iteratively comparing q with the four sub-clusters in each cluster level. If the combination of keywords in the query is typical and can be al- located into the same cluster, only one keyword cluster will be found. Otherwise, more than one keyword cluster may be returned. Search-relaxation As is stated in Section 4.2, by means of executing search- relaxation, bitmap-based filter can support similar keyword matching. In Alg. 4, a bitmap of relaxed query keyword is obtained by switching 0-bit to 1-bit if their keyword distance is under a threshold. By adopting a rational threshold, we can make a good trade-off between time cost and space occupation. Algorithm 3: FindLeafCluster Input: q, QC-Tree Tqc Output: the leaf cluster: LC 1 LC ← ∅ 2 foreach k ∈ q.K do lc ← Tqc.root while lc is not leaf cluster do LC ← LC ∪ lc 3 4 5 6 2 3 4 5 6 ls ← lc.subi, with d(k, lc.subi.cen) is minimum among 4 lc.subs Algorithm 4: Search relaxation Input: bitmap of query keyword: bmq, bitmap of keyword cluster: bmc Output: bitmap of relaxed query keyword: bmr 1 for i ← 1 to -bmq- do if bmq[i] = 1 then bmr[i] ← 1 for j ← 1 to -bmc- do if d(ki,kj) < τ then bmr[j] ← 1 10 X. Zang et al. Alg. 5 illustrates the query processing mechanism over QDR-Tree. Given a query q, the object retrieval is carried out firstly by traversing the QC-Tree to locate the best-matched keyword cluster. Secondly, after executing search- relaxation, it will traverse the DR-Tree in the ascending order of the scores and keep a minimum heap for the scores. Notice that, if more than one keyword cluster is located, it will traverse all of them. At last the Top-κ results can be returned. The ranking score of an object o for ASKQ is calculated by Eqn. (2). Here, α, β ∈ [0, 1] are parameters indicating the relative importance of these three factors. ψ(q, o) is the Euclidian distance between q and o. The Dmax is the maximal spatial distance that the client will accept. φ(q, o) which represents the keyword relevance between q and o is determined by the result of Bitwise AND between their keyword bitmaps. The smaller the score, the higher the relevance. s score(q, o) = αβ × ψ(q, o) Dmax s + (1 − β) × 1 φ(q, o) + (1 − α)β × q.W(cid:88) i=1 q.wi × o.ai (2) What is more, the score for non-leaf node N can also been measured to represent the optimal score of its descendant nodes, which is defined as Eqn. (3) score(q, N ) =αβ × min ψ(q, N.M BR) + (1 − β) × Dmax s + (1 − α)β × min ∀p∈N.sp q.wi × p.ai q.W(cid:88) i=1 1 φ(q, N ) (3) where the min ψ(q, N.M BR) represents the minimum Euclidian distance be- tween the N's MBR and the φ(q, N ) is can also be calculated by the bitmap of keywords kept in this node. We can prove that Topκ(q) is an exact result by the Theorem 1. If the score of the internal node dose not satisfy the ASKQ, there is no need to search its descendant nodes. Hence, the final Top-κ objects will have the least κ scores. Theorem 1. The score of an internal node N is the best score of its descendant object o to the query q. Proof. the score factors in location proximity, keyword relevance and non-spatial attributes' value. First, the MBR of the N encloses all of its descendant objects, then ∀oi ∈ descendant objects of N, min ψ(q, N.M BR) ≤ ψ(q, oi). Second, the keyword bitmap includes all of the keywords existing in the descendant ob- jects of N . Obviously, φ(q, N ) ≥ φ(q, o). Finally, the skyline points dominate or are equal to all of descendent objects concerning the value of attributes, i.e., i=1 q.wi × o.ai. All these inequalities con- min∀p∈N.SP tribute to that score(q, N ) ≤ score(q.o). (cid:3) i=1 q.wi × p.ai ≤(cid:80)q.W (cid:80)q.W QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query 11 Algorithm 5: QDR-Search algorithm Input: a query q, Topκ results κ, and a QDR-Tree Tqdr Output: Topκ(q) 1 LC = FindLeafCluster (q, Tqc); 2 for i ← 1 to LC do q.bitmap ← SearchRelaxation (q.bitmap, LC[i].bitmap) Minheap.insert(LC[i].root, 0) while Minheap.size() (cid:54)= 0 do 3 4 5 6 7 8 9 10 11 12 13 14 N ← Minheap.first() if N is an object then Topκ(q).insert(N ) if Topκ(q).size() ≥ k then break else for ni ∈ N .entry do if Number of objects with smaller score than score(q, ni) in Minheap < (κ − Topκ(q).size()) then Minheap.insert(ni, score(q, ni)) 6 Experiment Study 6.1 Baseline algorithm In this section, we propose three baseline algorithms which are based on the three existing indexes listed in Tab. 1, including IR-Tree [9], SKY R-Tree [16] and IRS-Tree [10]. As is discussed in Sec. 1, none of these existing indexes can be qualified for the ASKQ due to different drawbacks. The specific algorithm designs will be respectively explained in detail as follows. Because the IR-Tree pays no attention on the value of numerical attributes, all spatial objects containing the query keywords and numerical attributes will be extracted. After that they will be ranked by the comprehensive value of numercial attributes. Eventually, the top-κ spatial objects are just the result of the ASKQ. Different from the IR-Tree, the SKY R-Tree fails to support multi-keywords query because one SKY R-Tree can only arrange one keyword and its correspond- ing spatial objects, such as restaurant. In order to deal with the ASKQ, all of the SKY R-Trees containing the query keywords will be searched and merged to obtain the final top-κ results. The last baseline algorithm is proposed based on the IRS-Tree which is orig- inally intended to address the GLPQ. Unlike ASKQ, the GLPQ requires specific range of attributes to leverage the IRS-Tree. To copy with the ASKQ, we will firstly set some different suitable ranges of each attributes as the input, which insures that enough spatial objects can be returned. Afterwards, we will further 12 X. Zang et al. to select top-κ objects from the results in the first stage. Apparently, in our experiments, the IRS-Tree will not make much sense anymore. Notice that, all of these three baseline algorithms cannot solve the ASKQ directly at a time and need subsequent elimination of redundancy, which deter- mines their inefficiency in the ASKQ. In the experiment section, we conduct extensive experiments on both real and synthetic datasets to evaluate the performance of our proposed algorithms. 6.2 Experiment Setup The real dataset is crawled from the famous location-based service platform, Foursquare. After information cleaning, the dataset has about 1M objects con- sisting of geographical location, the keyword list written in English, and the normalized value of attributes. Each spatial object contains the keywords such as steak, pizza, coffee, etc. and four numerical attributes, including price, envi- ronment, service and rating. In the synthetic dataset, each object is composed of coordinates, various keyword, and multi-dimensional numerical attributes. The size of the synthetic dataset varies in the experiments. The coordinates are randomly generated in (0, 10000.0), and the average number of keywords per object is decided by a parameter r which denotes the ratio of the number of object's keywords to the cluster's. Without loss of generality, the values of each numercial attribute are randomly and independently generated, following a normal distribution. Table 2. Default value of parameters Parameter Default value κ o.A δ α β τcluster τdup O M 10 4 0.5 0.5 0.67 0.3 0.05 1M 25 Descriptions Top-κ query No. of attributes' dimension Weight factor of Eqn. (1) Weight factor of Eqn. (2) Weight factor of Eqn. (2) Threshold of quad clustering Threshold of duplication Number of objects Maximum number of DR-Tree entries We compare the query cost of proposed algorithms with different datasets respectively. The experimental settings are given in Table 2. The default values are used unless otherwise specified. All algorithms are implemented in Python and run with Intel core i7 6700HQ CPU at 2.60 GHz and 16 GB memory. 6.3 Performance Evaluation In this section, we campare different baseline algorithms proposed in Section 6.1 with our framework. We evaluate the processing time and disk I/O of all the QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query 13 proposed methods by varying the parameters in Table 2 and investigate their effects. In the first part we study the experimental results on the real dataset. Index construction cost: We first evaluate the construction costs of vari- ous methods. The cost of an index is measured by its construction time and space budget. The costs of various methods are shown in Fig. 4, where IRS refers to the baseline structure IRS-Tree, the SKY-R, IR refer to SKY R-Tree, IR-Tree respectively, and the QDR represents our design. We can see that, SKY R-Tree and IR-Tree exceed both in time consumption and space cost, because they are short of attention of either attributes or multi-keywords. Moreover, since we em- ploy bitmap and skyline points to measure numercial attributes, QDR is more lightweight than IRS. Effect of κ: We investigate the effect of κ on the processing time and disk I/O of the proposed algorithms by randomly generate 100 queries. Here, considering that the SKY R-Tree and IR-Tree do not take into account either attributes or keywords, we add a filter operation after their query process. For example, the SKY R-Tree returns Top-κ results of each keyword and merges them in the second stage. Obviously, this redundancy of result is the main reason of the high time cost. As shown in Fig. 5, with the increase of κ, IRS and QDR have the same smoothly increasing trend on query time and disk I/O. QDR exceeds in query time cost with different parameters. It indicates that we can effectively receive the Top-κ results from one branch to another. (a) Index time (b) Index size (a) Process time (b) Disk I/O Fig. 4. Construction cost Fig. 5. Effect of κ Effect of O: Parameter O denotes the number of objects in the QDR- Tree, We increase the number of objects in the synthetic dataset from 0.1 to 5 M. It can be seen from Fig. 7(a)(b), that, SKY-R and IR have more obvious increases in query time cost and disk I/O when the data size increases, which can be explained because of their larger redundancy along with the larger dataset. On the other hand, the QDR is more stable and surpasses another three indexes. Effect of o.A: Parameter o.A denotes the number of attributes the object o covers. As shown in Fig. 7(c)(d), the query time and Disk I/O of the IR-Tree based on synopses tree has distinct increase, because it fails to consider the attributes, while another three frameworks are more stable, which is mainly because of either the skyline filter algorithm or the synopses tree. Effect of τcluster & τdup: τcluster and τdup are the crucial parameters in our QDR-Tree, which are analyzed theoretically in Sec. 4. The experimental results also verify their effect on the Processing Time and Index Size. Fig. 6(a)(c) show 100101102103104105 Indexing Time(Sec) IRS SKY-R QDR IR100101102103104 Index Size(MB) IRS SKY-R QDR IR5102050100101102103Processing Time(Sec)k IRS SKY-R QDR IR5102050100101102103104105 kDisk I/O IRS SKY-R QDR IR 14 X. Zang et al. that both τcluster and τdup have an optimal value to minimize the processing time. Smaller or larger value will both increase the processing time because of keyword scattring or redundancy. In Fig. 6(b)(d), index size decreases as the τcluster becomes larger and reach saturation at some point, while it increases along with the τdup because of the increase of keyword redundancy. (a) Efficiency-O (b) Disk I/O-O (c) Efficiency-o.A (d) Disk I/O-o.A Fig. 6. Synthetic dataset (a) Efficiency-τcluster (b) Index Size-τcluster (c) Efficiency-τdup (d) Index Size-τdup Fig. 7. Effect of τcluster & τdup 7 Conclusion In this paper, we formulated the attributes-aware spatial keyword query (ASKQ) and proposed a novel index structure call Quad-cluster Dual-filtering R-Tree (QDR). QDR-Tree is a two-layer hybrid index based on two index structures and two searching algorithms. We also proposed a novel method to measure the relevance of spatial objects with query keywords, which applies keyword-bitmap and search-relaxation to achieve exact and similar keyword match. Moreover, by employing the keyword-relaxation, we greatly improve the time efficiency at the sacrifice of a little space consumption. Finally, massive experiments with real datasets demonstrate the efficiency and effectiveness of QDR-Tree. References 1. Borzsonyi, S., Stocker, K., Kossmann, D.: The skyline operator. IEEE International Conference on Data Engineering (ICDE) pp. 421–430 (2002) 151050100101102ProcessingTime(Sec)O(0.1M)IRSSKY-RQDRIR151050102103104DiskI/OO(0.1M)IRSSKY-RQDRIR2468080160240ProcessingTime(Sec)o.AIRSSKY-RQDRIR2468102103104105DiskI/Oo.AIRSSKY-RQDRIR0.10.20.30.40.55101520 Processing Time (Sec) QDRtcluster0.00.20.40.66008001000 Index Size (MB)tcluster QDR0.000.050.100.15810121416ProcessingTime(Sec)QDRtdup0.000.050.100.152004006008001000IndexSize(MB)tdupQDR QDR-Tree: An Efficient Index Scheme for Complex Spatial Keyword Query 15 2. Cao, X., Cong, G., Jensen, C.S.: Retrieving top-k prestige-based relevant spatial web objects. International Conference on Very Large Data Bases (VLDB) 3, 373– 384 (2010) 3. Chen, L., Gao, Y., Li, X., Jensen, C.S., Chen, G.: Efficient metric indexing for similarity search. IEEE Transactions on Knowledge and Data Engineering (TKDE) 29(3), 556–571 (2017) 4. Cong, G., Jensen, C., Wu, D.: Efficient retrieval of the top-k most relevant spatial web objects. International Conference on Very Large Data Bases (VLDB) 2(1), 337–348 (2009) 5. Cong, G., Jensen, C.S., Wu, D.: Efficient retrieval of the top-k most relevant spatial web objects. International Conference on Very Large Data Bases (VLDB) 2(1), 337–348 (2009) 6. Dhillon, I.S., Guan, Y., Kulis, B.: Kernel k-means: spectral clustering and normal- ized cuts. ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD) pp. 551–556 (2004) 7. Felipe, I.D., Hristidis, V., Rishe, N.: Keyword search on spatial databases. In: IEEE International Conference on Data Engineering (ICDE). pp. 656–665 (2008) 8. Lee, J., Hwang, S.: Toward efficient multidimensional subspace skyline computa- tion. International Conference on Very Large Data Bases (VLDB) 23(1), 129–145 (2014) 9. Li, Z., Lee, K.C., Zheng, B., Lee, W.C., Lee, D., Wang, X.: Ir-tree: An efficient index for geographic document search. IEEE Transactions on Knowledge and Data Engineering (TKDE) 23(4), 585–599 (2011) 10. Liu, X., Chen, L., Wan, C.: Linq: A framework for location-aware indexing and query processing. IEEE Transactions on Knowledge and Data Engineering (TKDE) 27(5), 1288–1300 (2015) 11. Ma, G., Arefin, M.S., Morimoto, Y.: A spatial skyline query for a group of users having different positions. In: Third International Conference on NETWORKING and Computing. pp. 137–142 (2012) 12. Mikolov, T., Chen, K., Corrado, G., Dean, J.: Efficient estimation of word repre- sentations in vector space. Computer Science (2013) 13. Qian, Z., Xu, J., Zheng, K., Sun, W., Li, Z., Guo, H.: On efficient spatial key- word querying with semantics. International Conference on Database Systems for Advanced Applications (DASFAA) pp. 149–164 (2016) 14. Qian, Z., Xu, J., Zheng, K., Zhao, P., Zhou, X.: Semantic-aware top-k spatial keyword queries. World Wide Web (WWW) pp. 1–22 (2017) 15. Ray, S., Nickerson, B.G.: Dynamically ranked top-k spatial keyword search. ACM International Conference on Management of Data (SIGMOD) pp. 6–18 (2016) 16. Sasaki, Y., Lee, W.C., Hara, T., Nishio, S.: Sky r-tree: an index structure for distance-based top-k query. International Conference on Database Systems for Ad- vanced Applications (DASFAA) pp. 220–235 (2014) 17. Tao, Y., Sheng, C.: Fast nearest neighbor search with keywords. IEEE Transactions on Knowledge and Data Engineering (TKDE) 26(4), 878–888 (2014) 18. Zhang, C., Zhang, Y., Zhang, W., Lin, X.: Inverted linear quadtree: Efficient top k spatial keyword search. IEEE International Conference on Data Engineering (ICDE) pp. 901–912 (2013) 19. Zobel, J., Moffat, A.: Inverted files for text search engines. ACM Computing Sur- veys (CSUR) 38(2), 6–21 (2006)
1101.3620
2
1101
2011-05-28T03:29:27
Clustering Protein Sequences Given the Approximation Stability of the Min-Sum Objective Function
[ "cs.DS", "cs.CE" ]
We study the problem of efficiently clustering protein sequences in a limited information setting. We assume that we do not know the distances between the sequences in advance, and must query them during the execution of the algorithm. Our goal is to find an accurate clustering using few queries. We model the problem as a point set $S$ with an unknown metric $d$ on $S$, and assume that we have access to \emph{one versus all} distance queries that given a point $s \in S$ return the distances between $s$ and all other points. Our one versus all query represents an efficient sequence database search program such as BLAST, which compares an input sequence to an entire data set. Given a natural assumption about the approximation stability of the \emph{min-sum} objective function for clustering, we design a provably accurate clustering algorithm that uses few one versus all queries. In our empirical study we show that our method compares favorably to well-established clustering algorithms when we compare computationally derived clusterings to gold-standard manual classifications.
cs.DS
cs
Clustering Protein Sequences Given the Approximation Stability of the Min-Sum Objective Function Konstantin Voevodski1, Maria-Florina Balcan2, Heiko Roglin3, Shang-Hua Teng4, and Yu Xia5 1 Department of Computer Science, Boston University, Boston, MA 02215, USA 2 College of Computing, Georgia Institute of Technology, Atlanta, GA 30332, USA 3 Department of Computer Science, University of Bonn, Bonn, Germany 4 Computer Science Department, University of Southern California, Los Angeles, CA 5 Bioinformatics Program and Department of Chemistry, Boston University, Boston, 90089, USA MA 02215, USA Abstract. We study the problem of efficiently clustering protein se- quences in a limited information setting. We assume that we do not know the distances between the sequences in advance, and must query them during the execution of the algorithm. Our goal is to find an ac- curate clustering using few queries. We model the problem as a point set S with an unknown metric d on S, and assume that we have access to one versus all distance queries that given a point s ∈ S return the distances between s and all other points. Our one versus all query rep- resents an efficient sequence database search program such as BLAST, which compares an input sequence to an entire data set. Given a natural assumption about the approximation stability of the min-sum objective function for clustering, we design a provably accurate clustering algo- rithm that uses few one versus all queries. In our empirical study we show that our method compares favorably to well-established cluster- ing algorithms when we compare computationally derived clusterings to gold-standard manual classifications. 1 Introduction Biology is an information-driven science, and the size of available data continues to expand at a remarkable rate. The growth of biological sequence databases has been particularly impressive. For example, the size of GenBank, a biologi- cal sequence repository, has doubled every 18 months from 1982 to 2007. It has become important to develop computational techniques that can handle such large amounts of data. Clustering is very useful for exploring relationships be- tween protein sequences. However, most clustering algorithms require distances between all pairs of points as input, which is infeasible to obtain for very large protein sequence data sets. Even with a one versus all distance query such as BLAST (Basic Local Alignment Search Tool) [AGM+90], which efficiently com- pares a sequence to an entire database of sequences, it may not be possible to use it n times to construct the entire pairwise distance matrix, where n is the size of the data set. In this work we present a clustering algorithm that gives an accurate clustering using only O(k log k) queries, where k is the number of clusters. We analyze the correctness of our algorithm under a natural assumption about the data, namely the (c, ) approximation stability property of [BBG09]. Balcan et al. assume that there is some relevant "target" clustering CT , and optimizing a particular objective function for clustering (such as min-sum) gives clusterings that are structurally close to CT . More precisely, they assume that any c-approximation of the objective is -close to CT , where the distance be- tween two clusterings is the fraction of misclassified points under the optimum matching between the two sets of clusters. Our contribution is designing an algorithm that given the (c, )-property for the min-sum objective produces an accurate clustering using only O(k log k) one versus all distance queries, and has a runtime of O(k log(k)n log(n)). We conduct an empirical study that compares computationally derived clusterings to those given by gold-standard classifica- tions of protein evolutionary relatedness. We show that our method compares favorably to well-established clustering algorithms in terms of accuracy. More- over, our algorithm easily scales to massive data sets that cannot be handled by traditional algorithms. The algorithm presented here is related to the one presented in [VBR+10]. The Landmark-Clustering algorithm presented there gives an accurate clustering if the instance satisfies the (c, )-property for the k-median objective. However, if the property is satisfied for the min-sum objective the structure of the clustering instance is quite different, and the algorithm given in [VBR+10] fails to find an accurate clustering in such cases. Indeed, the analysis presented here is also quite different. The min-sum objective is also considerably harder to approximate. For k-median the best approximation guarantee is (3 + ) given by [AGK+04]. For the min-sum objective when the number of clusters is arbitrary there is an O(δ−1 log1+δ n)-approximation algorithm with running time nO(1/δ) due to [BCR01]. There are also several other clustering algorithms that are applicable in our limited information setting [AV07,AJM09,MOP01,CS07]. However, because all of these methods seek to approximate an objective function they will not produce an accurate clustering in our model if the (c, )-property holds for values of c for which finding a c-approximation is difficult. Other than [VBR+10] we are not aware of any results providing both provably accurate algorithms and strong query complexity guarantees in such a model. 2 Preliminaries Given a metric space M = (X, d) with point set X, an unknown distance function d satisfying the triangle inequality, and a set of points S ⊆ X, we would like to i=1 function for clustering is x,y∈Ci (cid:80) The min-sum objective find a k-clustering C that partitions the points in S into k sets C1, . . . , Ck by using one versus all distance queries. Φ(C) = (cid:80)k tion seeks to minimize Ψ (C) = (cid:80)k dian of cluster Ci, which is the point y ∈ Ci that minimizes(cid:80) to minimize d(x, y). We reduce the min-sum clustering problem to the related balanced k-median problem. The balanced k-median objective func- d(x, ci), where ci is the me- d(x, y). As pointed out in [BCR01], in metric spaces the two objective functions are related to within a factor of 2: Ψ (C)/2 ≤ Φ(C) ≤ Ψ (C). For any objective function Ω we use OPTΩ to denote its optimum value. i=1 Ci(cid:80) x∈Ci x∈Ci In our analysis we assume that S satisfies the (c, )-property of [BBG09] for the min-sum and balanced k-median objective functions. To formalize the (c, )-property we need to define a notion of distance between two k-clusterings k}. As in [BBG09], we define the distance C = {C1, . . . , Ck} and C(cid:48) = {C(cid:48) between C and C(cid:48) as the fraction of points on which they disagree under the optimal matching of clusters in C to clusters in C(cid:48): k(cid:88) 1, . . . , C(cid:48) dist(C, C(cid:48)) = min σ∈Sk 1 n Ci − C(cid:48) σ(i), i=1 where Sk is the set of bijections σ:{1, . . . , k} → {1, . . . , k}. Two clusterings C and C(cid:48) are said to be -close if dist(C, C(cid:48)) < . We assume that there exists some unknown relevant "target" clustering CT and given a proposed clustering C we define the error of C with respect to CT as dist(C, CT ). Our goal is to find a clustering of low error. The (c, ) approximation stability property is defined as follows. Definition 1. We say that the instance (S, d) satisfies the (c, )-property for objective function Ω with respect to the target clustering CT if any clustering of S that approximates OPTΩ within a factor of c is -close to CT , that is, Ω(C) ≤ c · OPTΩ ⇒ dist(C, CT ) < . We note that because any (1 + α)-approximation of the balanced k-median objective is a 2(1 + α)-approximation of the min-sum objective, it follows that if the clustering instance satisfies the (2(1 + α), )-property for the min-sum objective, then it satisfies the (1 + α, )-property for balanced k-median. 3 Algorithm Overview In this section we present a clustering algorithm that given the (1+α, )-property for the balanced k-median objective finds an accurate clustering using few dis- tance queries. Our algorithm is outlined in Algorithm 1 (with some implementa- tion details omitted). We start by uniformly at random choosing n(cid:48) points that we call landmarks, where n(cid:48) is an appropriate number. For each landmark that we choose we use a one versus all query to get the distances between this landmark and all other points. These are the only distances used by our procedure. Our algorithm then expands a ball Bl around each landmark l one point at a time. In each iteration we check whether some ball Bl∗ passes the test in line 7. Our test considers the size of the ball and its radius, and checks whether their product is greater than the threshold T . If this is the case, we consider all balls that overlap Bl∗ on any points, and compute a cluster that contains all the points in these balls. Points and landmarks in the cluster are then removed from further consideration. Algorithm 1 Landmark-Clustering-Min-Sum(S, k, n(cid:48), T ) 1: choose a set of landmarks L of size n(cid:48) uniformly at random from S; 2: i = 1, r = 0; 3: while i ≤ k do 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: end while 15: return C = {C1, . . . Ck}; Bl = {s ∈ S d(s, l) ≤ r}; end for if ∃l∗ ∈ L :Bl∗ · r > T then L(cid:48) = {l ∈ L : Bl ∩ Bl∗ (cid:54)= ∅}; Ci = {s ∈ S : s ∈ Bl and l ∈ L(cid:48)}; i = i + 1; remove clustered points from consideration; for each l ∈ L do end if increment r to the next relevant distance; A complete description of this algorithm can be found in the next section. We now present our theoretical guarantee for Algorithm 1. Theorem 1. Given a metric space M = (X, d), where d is unknown, and a set of points S, if the instance (S, d) satisfies the (1 + α, )-property for the balanced-k-median objective function, we are given the optimum objective value OPT, and each cluster in the target clustering CT has size at least (6+240/α)n, then Landmark-Clustering-Min-Sum(S, k, n(cid:48), αOPT 40n ) outputs a clustering that is O(/α)-close to CT with probability at least 1 − δ. The algorithm uses n(cid:48) = δ one versus all distance queries, and has a runtime of O(n(cid:48)n log n). (3+120/α) ln k 1 We note that n(cid:48) = O(k ln k δ ) if the sizes of the target clusters are balanced. In addition, if we do not know the value of OPT, we can still find an accurate clustering by running Algorithm 1 from line 2 at most n(cid:48)n2 times with increasing estimates of T until enough points are clustered. It is not necessary to recompute the landmarks, so the number of distance queries that are required remains the same. We next give some high-level intuition for how our procedures work. Given our approximation stability assumption, the target clustering must have the structure shown in Figure 1. Each target cluster Ci has a "core" of well-separated points, where any two points in the cluster core are closer than a certain distance di to each other, and any point in a different core is farther than cdi, for some constant c. Moreover, the diameters of the cluster cores are Fig. 1. Cluster cores C1, C2 and C3 are shown with diameters d1, d2 and d3, respec- tively. The diameters of the cluster cores are inversely proportional to their sizes. inversely proportional to the cluster sizes: there is some constant θ such that Ci· di = θ for each cluster Ci. Given this structure, it is possible to classify the points in the cluster cores correctly if we extract the smaller diameter clusters first. In the example in Figure 1, we can extract C1, followed by C2 and C3 if we choose the threshold T correctly and we have selected a landmark from each cluster core. However, if we wait until some ball contains all of C3, C1 and C2 may be merged. 4 Algorithm Analysis In this section we present a formal analysis of our algorithm, and give the proof of Theorem 1. We first present a complete description of the algorithm. We then describe the structure of the clustering instance that is implied by our approximation stability assumption. We then give a general overview of our argument, which is followed by the complete proof. 4.1 Algorithm Description A full description of our algorithm is given in Algorithm 2. In order to efficiently expand a ball around each landmark, we first sort all landmark-point pairs (l, s) by d(l, s). We then consider these pairs in order of increasing distance (line 7), skipping pairs where l or s have already been clustered; the clustered points are maintained in the set ¯S. In each iteration we check whether some ball Bl∗ passes the test in line 19. Our actual test, which is slightly different than the one presented earlier, con- siders the size of the ball and the next largest landmark-point distance (denoted by r2), and checks whether their product is greater than the threshold T . If this is the case, we consider all balls that overlap Bl∗ on any points, and compute a cluster that contains all the points in these balls. Points and landmarks in the cluster are then removed from further consideration by adding the clustered points to ¯S, and removing the clustered points from any ball. Our procedure terminates once we find k clusters. If we reach the final landmark-point pair, we stop and report the remaining unclustered points as C1C2C3d1d2d3 part of the same cluster (line 12). If the algorithm terminates without partition- ing all the points, we assign each remaining point to the cluster containing the closest clustered landmark. In our analysis we show that if the clustering instance satisfies the (1+α, )-property for the balanced k-median objective function, our procedure will output exactly k clusters. The most time-consuming part of our algorithm is sorting all landmark- points pairs, which takes O(Ln log n), where n is the size of the data set and L is the set of landmarks. With a simple implementation that uses a hashed set to store the points in each ball, the total cost of computing the clusters and removing clustered points from active balls is at most O(Ln) each. All other operations take asymptotically less time, so the overall runtime of our procedure is O(Ln log n). end if Bl = Bl + {s}; if r1 == r2 then else r2 = d(l(cid:48), s(cid:48)); Ci = S − ¯S; break; (l, s) = GetNextActivePair(); r1 = d(l, s); if ((l(cid:48), s(cid:48)) = PeekNextActivePair()) ! = null then Algorithm 2 Landmark-Clustering-Min-Sum(S, k, n(cid:48), T ) 1: choose a set of landmarks L of size n(cid:48) uniformly at random from S; 2: for each l ∈ L do Bl = ∅; 3: 4: end for 5: i = 1, ¯S = ∅; 6: while i ≤ k do 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: while ∃l ∈ L − ¯S :Bl > T /r2 and i ≤ k do 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: end while 32: return C = {C1, . . . Ck}; l∗ = argmaxl∈L− ¯SBl; L(cid:48) = {l ∈ L − ¯S : Bl ∩ Bl∗ (cid:54)= ∅}; Ci = {s ∈ S : s ∈ Bl and l ∈ L(cid:48)}; for each s ∈ Ci do ¯S = ¯S + {s}; for each l ∈ L do Bl = Bl − {s}; continue; end if end for end for i = i + 1; end while 4.2 Structure of the Clustering Instance We next describe the structure of the clustering instance that is implied by our approximation stability assumption. We denote by C∗ = {C∗ k} 1 , . . . , C∗ the optimal balanced-k-median clustering with objective value OPT=Ψ (C∗). i be the median point in the cluster. For x ∈ C∗ i , let c∗ For each cluster C∗ i , define w(x) = C∗ i d(x, c∗ i ) and let w = avgxw(x) = OPT n . Define w2(x) = minj(cid:54)=iC∗ j d(x, c∗ j ). It is proved in [BBG09] that if the instance satisfies the (1+α, )-property for the balanced k-median objective function and each cluster in C∗ has size at least max(6, 6/α) · n, then at most 2-fraction of points x ∈ S have w2(x) < αw 4 . In addition, by definition of the average weight w at most 120/α-fraction of points x ∈ S have w(x) > αw 120 . bad. Let Xi be the good points in the optimal cluster C∗ be the bad points. We call point x good if both w(x) ≤ αw 120 and w2(x) ≥ αw 4 , else x is called i , and let B = S \ ∪Xi Lemma 1, which is similar to Lemma 14 of [BBG09], proves that the optimum balanced k-median clustering must have the following structure: 1. For all x, y in the same Xi, we have d(x, y) ≤ αw i . 60C∗ 2. For x ∈ Xi and y ∈ Xj(cid:54)=i, d(x, y) > αw 5 / min(C∗ i ,C∗ j ). 3. The number of bad points is at most b = (2 + 120/α)n. 4.3 Proof of Theorem 1 Our algorithm expands a ball around each landmark, one point at a time, until some ball is large enough. We use r1 to refer to the current radius of the balls, and r2 to refer to the next relevant radius (next largest landmark-point distance). To pass the test in line 19, a ball must satisfy Bl > T /r2. We choose T such that by the time a ball satisfies the conditional, it must overlap some good set Xi. Moreover, at this time the radius must be large enough for Xi to be entirely contained in some ball; Xi will therefore be part of the cluster computed in line 22. However, the radius is too small for a single ball to overlap different good sets and for two balls overlapping different good sets to share any points. Therefore the computed cluster cannot contain points from any other good set. Points and landmarks in the cluster are then removed from further consideration. The same argument can then be applied again to show that each cluster output by the algorithm entirely contains a single good set. Thus the clustering output by the algorithm agrees with C∗ on all the good points, so it must be closer than b +  = O(/α) to CT . A more detailed argument is given below. Proof. Since each cluster in the target clustering has more than (6 + 240/α)n points, and the optimal balanced-k-median clustering C∗ can differ from the target clustering by fewer than n points, each cluster in C∗ must have more than (5+240/α)n points. Moreover, by Lemma 1 we may have at most (2+120/α)n i \B > (3+120/α)n ≥ (2+120/α)n+2 = bad points, and hence each Xi = C∗ b + 2. We will use smin to refer to the (3 + 120/α)n quantity. ln k δ = smin 1 δ 1 ≥ C∗ i . Define di = αw 60C∗ Suppose that we order the clusters of C∗ such that C∗ Our argument assumes that we have chosen at least one landmark from each good set Xi. Lemma 2 argues that after selecting n(cid:48) = n (3+120/α) ln k landmarks the probability of this happening is at least 1 − δ. Moreover, if the target clusters are balanced in size: maxC∈CT C/ minC∈CT C < c for some constant c, because the size of each good set is at least half the size of the corresponding target cluster, it must be the case that 2sminc· k ≥ n, so n/smin = O(k). 2 ≥ . . .C∗ k, i and recall that maxx,y∈Xi d(x, y) ≤ di. and let ni = C∗ Note that because there is a landmark in each good set Xi, for radius r ≥ di there exists some ball containing all of Xi. We use Bl(r) to denote a ball of radius r around landmark l: Bl(r) : {s ∈ S d(s, l) ≤ r}. If we apply Lemma 3 with all the clusters in C∗, we can see that as long as r ≤ 3d1, a ball cannot contain points from more than one good set and balls overlapping different good sets cannot share any points. We also observe that when both r ≤ 3d1 and r < di are true, a ball Bl(r) containing points from Xi does not satisfy Bl(r) ≥ T /r. For r ≤ 3d1 a ball cannot contain points from different good sets; therefore any ball containing points from Xi has size at most C∗ 2 . In addition, for r < di the size bound T /r > T /di = 40 / αw 2 . Therefore for these values of r any ball containing points from 60C∗ Xi is too small to satisfy the conditional. Finally, we observe that for r = 3d1 some ball Bl(r) containing all of X1 does satisfy Bl(r) ≥ T /r. Clearly, for r = 3d1 there is some ball containing all of X1, which must have size at least C∗ 1 − b ≥ n1/2. For r = 3d1 the size bound T /r = n1/2, so this ball is large enough to satisfy this conditional. Moreover, for r ≤ 3d1 the size bound T /r ≥ n1/2. Therefore a ball containing only bad points cannot pass our test for r ≤ 3d1 because the number of bad points is at most b < n1/2. Consider the smallest radius r∗ for which some ball Bl∗ (r∗) satisfies Bl∗ (r∗) ≥ T /r∗. It must be the case that r∗ ≤ 3d1, and Bl∗ overlaps with some good set Xi because we cannot have a ball containing only bad points for r∗ ≤ 3d1. Moreover, by our previous argument because Bl∗ contains points from Xi, it must be the case that r∗ ≥ di, and therefore some ball contains all the points in Xi. Consider a cluster C of all the points in balls that overlap Bl∗ : C = {s ∈ S s ∈ Bl and Bl ∩ Bl∗ (cid:54)= ∅}, which must include all the points in Xi. In addition, Bl∗ cannot share any points with balls that overlap other good sets because r∗ ≤ 3d1, there- fore C does not contain points from any other good set. Therefore the cluster C entirely contains some good set and no points from any other good set. i + b < 3ni i = 3ni αw These facts suggest the following conceptual algorithm for finding a clustering that classifies all the good points correctly: increment r until some ball satisfies Bl(r) ≥ T /r, compute the cluster containing all points in balls that overlap Bl(r), remove these points, and repeat until we find k clusters. We can argue that each cluster output by the algorithm entirely contains some good set and no points from any other good set. Each time we can consider the clusters C ⊆ C∗ whose good sets have not yet been output, order them by size, and apply Lemma 3 with C to argue that while r ≤ 3d1 the radius is too small for the computed cluster to overlap any of the remaining good sets. As before, we can argue that by the time we reach 3d1 we must output some cluster. In addition, when r ≤ 3d1 we cannot output a cluster of only bad points and whenever we output a cluster overlapping some good set Xi, it must be the case that r ≥ di. Therefore each computed cluster must entirely contain some good set and no points from any other good set. If there are any unclustered points upon the completion of the algorithm, we can assign the remaining points to any cluster. Still, we are able to classify all the good points correctly, so the reported clustering must be closer than b + dist(C∗, CT ) < b +  = O(/α) to CT . It suffices to show that even though our algorithm only considers discrete values of r corresponding to landmark-point distances, the output of our proce- dure exactly matches the output of the conceptual algorithm described above. Consider the smallest (continuous) radius r∗ for which some ball Bl1(r∗) satisfies Bl1 (r∗) ≥ T /r∗. We use dreal to refer to the largest landmark-point distance such that dreal ≤ r∗. Clearly, by the time our algorithm reaches r1 = dreal it must be the case that Bl1 passes the test on line 19: Bl1 > T /r2, and this test is not passed by any ball at any prior time. Moreover, Bl1 must be the largest ball passing our test at this point because if there is another ball Bl2 that also satisfies our test when r1 = dreal it must be the case that Bl1 > Bl2 because Bl1 satisfies Bl1(r) ≥ T /r for a smaller r. Finally because there are no landmark-point pairs (l, s) with r1 < d(l, s) < r2, Bl(r1) = Bl(r∗) for each landmark l ∈ L. Therefore the cluster that we compute on line 22 for Bl1 (r1) is equivalent to the cluster the conceptual algorithm computes for Bl1 (r∗). We can repeat this argument for each cluster output by the conceptual algorithm, showing that Algorithm 2 finds exactly the same clustering. We note that when there is only one good set left the test in line 19 may not be satisfied anymore if 3d1 ≥ maxx,y∈S d(x, y), where d1 is the diameter of the remaining good set. However, in this case if we exhaust all landmark-points pairs we report the remaining points as part of a single cluster (line 12), which must contain the remaining good set, and possibly some additional bad points that we consider misclassified anyway. With a simple implementation that uses a hashed set to keep track of the points in each ball, the runtime of our procedure is O(Ln log n), which is given by the time necessary to sort all landmark-point pairs by distance. All other operations take asymptotically less time. In particular, over the entire run of the algorithm, the cost of computing the clusters in lines 21-22 is at most O(nL), and the cost of removing clustered points from active balls in lines 23-28 is also at most O(nL). (cid:117)(cid:116) Theorem 2. If we are not given the optimum objective value w, then we can still find a clustering that is O(/α)-close to CT with probability at least 1− δ by running Landmark-Clustering-Min-Sum at most n(cid:48)n2 times with the same set of landmarks, where the number of landmarks n(cid:48) = Proof. If we are not given the value of w then we have to estimate the threshold parameter T for deciding when a cluster develops. Let us use T ∗ to refer to its (3+120/α) ln k 1 δ as before. 40 ). We first note that there are at most n · nL relevant correct value (T ∗ = αw values of T to try, where L is the set of landmarks. Our test in line 19 checks whether the product of a ball size and a ball radius is larger than T , and there are only n possible ball sizes and Ln possible values of a ball radius. Suppose that we choose a set of landmarks L, L = n(cid:48), as before. We then compute all n(cid:48)n2 relevant values of T and order them in ascending order: Ti ≤ Ti+1 for 1 ≤ i < n(cid:48)n2. Then we repeatedly execute Algorithm 2 starting on line 2 with increasing estimates of T . Note that this is equivalent to trying all continuous values of T in ascending order because the execution of the algorithm does not change for any T (cid:48) such that Ti ≤ T (cid:48) < Ti+1. In other words, when Ti ≤ T (cid:48) < Ti+1, the algorithm will give the same exact answer for Ti as it would for T (cid:48). Our procedure stops the first time we cluster at least n − b points, where b is the maximum number of bad points. We give an argument that this gives an accurate clustering with an additional error of b. As before, we assume that we have selected at least one landmark from each good set, which happens with probability at least 1− δ. Clearly, if we choose the right threshold T ∗ the algorithm must cluster at least n − b points because the clustering will contain all the good points. Therefore the first time the algorithm clusters at least n− b points for some estimated threshold T , it must be the case that T ≤ T ∗. Lemma 4 argues that if T ≤ T ∗ and the number of clustered points is at least n− b, then the reported partition must be a k-clustering that contains a distinct good set in each cluster. This clustering may exclude up to b points, all of which may be good points. Still, if we arbitrarily assign the remaining points (cid:117)(cid:116) we will get a clustering that is closer than 2b +  = O(/α) to CT . Lemma 1. If the balanced k-median instance satisfies the (1 + α, )-property and each cluster in C∗ has size at least max(6, 6/α) · n we have: 1. For all x, y in the same Xi, we have d(x, y) ≤ αw i . 60C∗ 2. For x ∈ Xi and y ∈ Xj(cid:54)=i, d(x, y) > αw i ,C∗ j ). 5 / min(C∗ 3. The number of bad points is at most b = (2 + 120/α)n. Proof. For part 1, since x, y ∈ Xi ⊆ C∗ at most αw i to c∗ i , and hence at distance of at most For part 2 assume without loss of generality that C∗ j ) ≤ αw 120C∗ 120C∗ j are good; it follows that d(y, c∗ j d(x, c∗ j ) ≥ w2(x) > αw i are both good, they are at distance of i to each other. j . Both x ∈ C∗ i j ) > αw 4C∗ j 4 . By the triangle inequality it follows that αw 60C∗ i ≥ C∗ j , and d(x, c∗ and y ∈ C∗ because C∗ d(x, y) ≥ d(x, c∗ j ) − d(y, c∗ 1 4 − 1 120 ) > αw 5 / min(C∗ i ,C∗ j ), where we use that C∗ j = min(C∗ j ) ≥ αw C∗ j ( i ,C∗ j ). Part 3 follows from the maximum number of points that may not satisfy each (cid:117)(cid:116) of the properties of the good points and the union bound. Lemma 2. After selecting n δ points uniformly at random, where s is the size of the smallest good set, the probability that we did not choose a point from every good set is smaller than 1 − δ. s ln k nc nc n ) nc si ≤ (e− si n ) s samples is (1 − si Proof. We denote by si the cardinality of Xi. Observe that the probability of s ≤ not selecting a point from some good set Xi after nc (1− si si = e−c. By the union bound the probability of not selecting n ) s samples is at most ke−c, which is equal to a point from every good set after nc (cid:117)(cid:116) δ for c = ln k δ . Lemma 3. Given a subset of clusters C ⊆ C∗, and the set of the corresponding good sets X, let smax = maxCi∈C Ci be the size of the largest cluster in C, and . Then for r ≤ 3dmin, a ball cannot overlap a good set Xi ∈ X and dmin = αw any other good set, and a ball containing points from a good set Xi ∈ X cannot share any points with a ball containing points from any other good set. Proof. By part 2 of Lemma 1, for x ∈ Xi and y ∈ Xj(cid:54)=i we have 60smax d(x, y) > αw 5 / min(C∗ i ,C∗ j ). αw i ,C∗ 5 /C∗ i > αw j ) ≥ αw It follows that for x ∈ Xi ∈ X and y ∈ Xj(cid:54)=i we must have d(x, y) > 5 / min(C∗ 5 /smax = 12dmin, where we use the fact that Ci ≤ smax. So a point in a good set in X and a point in any other good set must be farther than 12dmin. To prove the first part, consider a ball Bl of radius r ≤ 3dmin around land- mark l. In other words, Bl = {s ∈ S d(s, l) ≤ r}. If Bl overlaps a good set in Xi ∈ X and any other good set, then it must contain a point x ∈ Xi and a point y ∈ Xj(cid:54)=i. It follows that d(x, y) ≤ d(x, l) + d(l, y) ≤ 2r ≤ 6dmin, giving a contradiction. To prove the second part, consider two balls Bl1 and Bl2 of radius r ≤ 3dmin around landmarks l1 and l2. Suppose Bl1 and Bl2 share at least one point: Bl1 ∩ Bl2 (cid:54)= ∅, and use s∗ to refer to this point. It follows that the distance between any point x ∈ Bl1 and y ∈ Bl2 satisfies d(x, y) ≤ d(x, s∗) + d(s∗, y) ≤ [d(x, l1) + d(l1, s∗)] + [d(s∗, l2) + d(l2, y)] ≤ 4r ≤ 12dmin. If Bl1 overlaps with Xi ∈ X and Bl2 overlaps with Xj(cid:54)=i, and the two balls share at least one point, there must be a pair of points x ∈ Xi and y ∈ Xj(cid:54)=i such that d(x, y) ≤ 12dmin, giving a contradiction. Therefore if Bl1 overlaps with some good set Xi ∈ X and Bl2 overlaps with any other good set, Bl1 ∩ Bl2 = ∅.(cid:117)(cid:116) Lemma 4. If T ≤ T ∗ = αw 40 and the number of clustered points is at least n− b, then the clustering output by Landmark-Clustering-Min-Sum using the threshold T must be a k-clustering that contains a distinct good set in each cluster. Proof. Our argument considers the points that are in each cluster that is output by the algorithm. Let us call a good set covered if any of the clusters C1, . . . , Ci−1 found so far contain points from it. We will use ¯C∗ to refer to the clusters in To see this, let us order the clusters in ¯C∗ by decreasing size: C∗ j , and let ni = C∗ C∗ whose good sets are not covered. It is critical to observe that if T ≤ T ∗ then if Ci contains points from an uncovered good set, Ci cannot overlap with any other good set. 2 ≥ . . .C∗ i . Applying Lemma 3 with ¯C∗ we can see that for r ≤ 3d1, a ball of radius r cannot overlap a good set in ¯C∗ and any other good set, and a ball containing points from a good set in ¯C∗ cannot share any points with a ball containing points from any other good set. Because T ≤ T ∗ we can also argue that by the time we reach r = 3d1 we must output some cluster. i . As before, define di = αw 60C∗ 1 ≥ C∗ Given this observation, it is clear that the algorithm can cover at most one new good set in each cluster that it outputs. In addition, if a new good set is covered this cluster may not contain points from any other good set. If the algorithm is able to cluster at least n − b points, it must cover every good set because the size of each good set is larger than b. So it must report k clusters (cid:117)(cid:116) where each cluster contains points from a distinct good set. 5 Experimental Results We present some preliminary results of testing our Landmark-Clustering-Min- Sum algorithm on protein sequence data. Instead of requiring all pairwise sim- ilarities between the sequences as input, our algorithm is able to find accurate clusterings by using only a few BLAST calls. For each data set we first build a BLAST database containing all the sequences, and then compare only some of the sequences to the entire database. To compute the distance between two sequences, we invert the bit score corresponding to their alignment, and set the distance to infinity if no significant alignment is found. In practice we find that this distance is almost always a metric, which is consistent with our theoretical assumptions. In our computational experiments we use data sets created from the Pfam [FMT+10] (version 24.0, October 2009) and SCOP [MBHC95] (version 1.75, June 2009) classification databases. Both of these sources classify proteins by their evolutionary relatedness, therefore we can use their classifications as a ground truth to evaluate the clusterings produced by our algorithm and other methods. These are the same data sets that were used in the [VBR+10] study, therefore we also show the results of the original Landmark-Clustering algo- rithm on these data, and use the same amount of distance information for both algorithms (30k landmarks/queries for each data set, where k is the number of clusters). In order to run Landmark-Clustering-Min-Sum we need to set the parameter T . Because in practice we do not know its correct value, we use in- creasing estimates of T until we cluster enough of the points in the data set; this procedure is similar to the algorithm for the case when we don't know the optimum objective value OPT and hence don't know T . In order to compare a computationally derived clustering to the one given by the gold-standard classi- fication, we use the distance measure from the theoretical part of our work. Because our Pfam data sets are so large, we cannot compute the full dis- tance matrix, so we can only compare with methods that use a limited amount of distance information. A natural choice is the following algorithm: uniformly at random choose a set of landmarks L, L = d; embed each point in a d- dimensional space using distances to L; use k-means clustering in this space (with distances given by the Euclidian norm). This procedure uses exactly d one versus all distance queries, so we can set d equal to the number of queries used by the other algorithms. For SCOP data sets we are able to compute the full distance matrix, so we can compare with a spectral clustering algorithm that has been shown to work very well on these data [PCS06]. From Figure 2 we can see that Landmark-Clustering-Min-Sum outperforms k-means in the embedded space on all the Pfam data sets. However, it does not perform better than the original Landmark-Clustering algorithm on most of these data sets. When we investigate the structure of the ground truth clusters in these data sets, we see that the diameters of the clusters are roughly the same. When this is the case the original algorithm will find accurate clusterings as well [VBR+10]. Still, Landmark-Clustering-Min-Sum tends to give better results when the original algorithm does not work well (data sets 7 and 9). Fig. 2. Comparing the performance of k-means in the embedded space (blue), Landmark-Clustering (red), and Landmark-Clustering-Min-Sum (green) on 10 data sets from Pfam. Datasets 1-10 are created by uniformly at random choosing 8 families from Pfam of size s, 1000 ≤ s ≤ 10000. Figure 3 shows the results of our computational experiments on the SCOP data sets. We can see that the three algorithms are comparable in performance here. These results are encouraging because the spectral clustering algorithm significantly outperforms other clustering algorithms on these data [PCS06]. Moreover, the spectral algorithm needs the full distance matrix as input and takes much longer to run. When we examine the structure of the SCOP data sets, we find that the diameters of the ground truth clusters vary considerably, which resembles the structure implied by our approximation stability assump- tion, assuming that the target clusters vary in size. Still, most of the time the product of the cluster sizes and their diameters varies, so it does not quite look like what we assume in the theoretical part of this work. Fig. 3. Comparing the performance of spectral clustering (blue), Landmark-Clustering (red), and Landmark-Clustering-Min-Sum (green) on 10 data sets from SCOP. Data sets A and B are the two main examples from [PCS06], the other data sets (1-8) are created by uniformly at random choosing 8 superfamilies from SCOP of size s, 20 ≤ s ≤ 200. We plan to conduct further studies to find data where clusters have different scale and there is an inverse relationship between cluster sizes and their diam- eters. This may be the case for data that have many outliers, and the correct clustering groups sets of outliers together rather than assigns them to arbitrary clusters. The algorithm presented here will consider these sets to be large diam- eter, small cardinality clusters. More generally, the algorithm presented here is more robust because it will give an answer no matter what the structure of the data is like, whereas the original Landmark-Clustering algorithm often fails to find a clustering if there are no well-defined clusters in the data. 6 Conclusion We present a new algorithm that clusters protein sequences in a limited informa- tion setting. Instead of requiring all pairwise distances between the sequences as input, we can find an accurate clustering using few BLAST calls. We show that our algorithm produces accurate clusterings when compared to gold-standard classifications, and we expect it to work even better on data who structure more closely resembles our theoretical assumptions. References AGK+04. V. Arya, N. Garg, R. Khandekar, A. Meyerson, K. Munagala, and V. Pandit. Local search heuristics for k-median and facility location problems. SIAM J. Comput., 33(3), 2004. AGM+90. S.F. Altschul, W. Gish, W. Miller, E.W. Myers, and D.J. Lipman. Basic local alignment search tool. J. Mol. Biol., 215(3):403 -- 410, 1990. AJM09. N. Ailon, R. Jaiswal, and C. Monteleoni. Streaming k-means approximation. AV07. In Advances in Neural Information Processing Systems (NIPS), 2009. D. Arthur and S. Vassilvitskii. k-means++: the advantages of careful seed- ing. In Proc. of 18th ACM-SIAM Symp. on Discrete Algorithms (SODA), 2007. BBG09. M. F. Balcan, A. Blum, and A. Gupta. Approximate clustering without the approximation. In Proc. of 20th ACM-SIAM Symp. on Discrete Algorithms (SODA), 2009. BCR01. Y. Bartal, M. Charikar, and D. Raz. Approximating min-sum k-clustering in metric spaces. In STOC '01: Proceedings of the thirty-third annual ACM symposium on Theory of computing, 2001. A. Czumaj and C. Sohler. Sublinear-time approximation algorithms for clustering via random sampling. Random Struct. Algorithms, 30(1-2):226 -- 256, 2007. CS07. FMT+10. R.D. Finn, J. Mistry, J. Tate, P. Coggill, A. Heger, J.E. Pollington, O.L. Gavin, P. Gunesekaran, G. Ceric, K. Forslund, L. Holm, E.L. Sonnhammer, S.R. Eddy, and A. Bateman. The pfam protein families database. Nucleic Acids Res., 38:D211 -- 222, 2010. MBHC95. A.G. Murzin, S. E. Brenner, T. Hubbard, and C. Chothia. Scop: a structural classification of proteins database for the investigation of sequences and structures. J. Mol. Biol., 247:536 -- 540, 1995. MOP01. N. Mishra, D. Oblinger, and L Pitt. Sublinear time approximate clustering. In Proc. of 12th ACM-SIAM Symp. on Discrete Algorithms (SODA), 2001. A. Paccanaro, J. A. Casbon, and M. A. S. Saqi. Spectral clustering of protein sequences. Nucleic Acids Res., 34(5):1571 -- 1580, 2006. PCS06. VBR+10. K. Voevodski, M. F. Balcan, H. Roglin, S. Teng, and Y. Xia. Efficient clustering with limited distance information. In Proc. of the 26th Conference on Uncertainty in Artifcial Intelligence, 2010.
1304.6707
2
1304
2013-10-11T13:41:42
Counting approximately-shortest paths in directed acyclic graphs
[ "cs.DS" ]
Given a directed acyclic graph with positive edge-weights, two vertices s and t, and a threshold-weight L, we present a fully-polynomial time approximation-scheme for the problem of counting the s-t paths of length at most L. We extend the algorithm for the case of two (or more) instances of the same problem. That is, given two graphs that have the same vertices and edges and differ only in edge-weights, and given two threshold-weights L_1 and L_2, we show how to approximately count the s-t paths that have length at most L_1 in the first graph and length at most L_2 in the second graph. We believe that our algorithms should find application in counting approximate solutions of related optimization problems, where finding an (optimum) solution can be reduced to the computation of a shortest path in a purpose-built auxiliary graph.
cs.DS
cs
Counting approximately-shortest paths in directed acyclic graphs Matúš Mihalák, Rastislav Šrámek, and Peter Widmayer Institute of Theoretical Computer Science, ETH Zurich, Zurich, Switzerland e-mail: {mmihalak,rsramek,widmayer}@inf.ethz.ch Abstract. Given a directed acyclic graph with positive edge-weights, two vertices s and t, and a threshold-weight L, we present a fully- polynomial time approximation-scheme for the problem of counting the s-t paths of length at most L. We extend the algorithm for the case of two (or more) instances of the same problem. That is, given two graphs that have the same vertices and edges and differ only in edge-weights, and given two threshold-weights L1 and L2, we show how to approxi- mately count the s-t paths that have length at most L1 in the first graph and length not much larger than L2 in the second graph. We believe that our algorithms should find application in counting approximate solutions of related optimization problems, where finding an (optimum) solution can be reduced to the computation of a shortest path in a purpose-built auxiliary graph. 1 Introduction Systematic generation and enumeration of combinatorial objects (such as graphs, set systems, and many more) has been a topic of extensive study in the field of combinatorial algorithms for decades [10]. Counting of combinatorial objects has been investigated at least as thoroughly, even leading to their own computational complexity class #P, defined in Valiant's seminal paper [14]. A counting problem usually asks for the number of solutions to a given combinatorial problem, such as the number of perfect matchings in a bipartite graph. In combinatorial op- timization, the number of optimum solutions can sometimes be computed by a modification of an algorithm for finding a single optimum solution. For instance, for shortest s-t paths in graphs with positive edge weights, Dijkstra's algorithm easily admits such a modification. The problem we discuss in this paper has a more general flavor: We aim at counting the number of approximate solutions, in the sense of solutions whose objective value is within a given threshold from optimum. For shortest s-t paths, it is not obvious how to count the number of paths within, say, 10% from optimum. A related problem of enumerating fea- sible solutions makes a step in this direction: If we can enumerate solutions in order of decreasing quality, starting from an optimum solution, we have a way to count approximate solutions. Even though for some problems there are known enumeration algorithms that return the next feasible solution in the sequence of solutions within only polynomial extra time (called "polynomial delay"), this approach will usually not be satisfactory in our setting. The reason is that the number of approximate solutions can be exponential, and counting by enumer- ating then takes exponential time, while our interest is only in the count itself. In this paper we propose a way to count approximate solutions for the short- est s-t path problem in directed acyclic graphs (DAGs) in polynomial time, but the count that we get is only approximate, even though we come as close to the exact count as we wish (technically, we propose an FPTAS). We also show that exact counting for our problem is #P-hard, thus (together with the FPTAS) fully settling its complexity. We achieve our result by a modification of a con- ceptually interesting dynamic program for all feasible solutions for the knapsack problem [13]. Our motivation for studying our counting problem comes from a new approach [2] to cope with uncertainty in optimization problems. There, we not only need to count the number of approximate solutions for a given problem instance, but we also need to count the number of solutions that are approximate (within a given approximation ratio) for two problem instances at the same time. For the case of shortest s-t paths, this means that we are given two input graphs that are structurally identical, but are allowed to differ in their edge weights. We now want to count the number of s-t paths that are within, say, 10% from optimum in both input graphs at the same time. For this problem we propose both a pseudo-polynomial algorithm and an algorithm that calculates an approx- imate solution for a potentially slightly different threshold in fully polynomial time. Our hope is that our study paves the way for approximately counting ap- proximate solutions for other optimization problems, such as minimum spanning trees. The rest of the paper is organized as follows. We outline possible implications of our result in Section 1.1. We show in Section 1.2 that our problem is #P- complete. We present the algorithms in Section 2, and conclude the paper in Section 3. 1.1 Dynamic Programming as Shortest-Path Computation in DAGs The concept of computing a shortest s-t path in a directed acyclic graph has a large number of applications in many areas of algorithmics. This is partly due to the fact that dynamic programming algorithms in which the inductive step consists of searching for a maximum or a minimum among some functions of previously-computed values can be viewed as the problem of looking for the shortest or longest path in a directed acyclic graph.1 In many problems that admit a dynamic programming solution we are inter- ested not only in the single optimum, but also in other approximately optimal solutions. For instance, if we single out the context of analysis of biological data, de novo peptide sequencing [4,11], sequence alignment [12], or Viterbi decoding of HMMs [3,5] all use dynamic programming to find a shortest path in some implicit graph. Due to the nature of the data in these applications, producing a 1 Note that due to the lack of cycles, the problems of looking for shortest and longest paths on DAGs are computationally identical. single solution is often insufficient and enumerating all solutions close to the op- timum is necessary. Our contribution, therefore, provides a faster solution than explicit enumeration for the problems where counting of approximate solutions is required [12]. Counting and sampling from close-to-optimum solutions is the key-element of the recent optimization method with uncertain input data of Buhmann et al. [2]. Our work thus makes a step towards practical algorithms in this context. 1.2 Counting Approximate Solutions is #P-Complete The problem of counting the number of all self-avoiding s-t walks in a directed (or undirected) graph is known to be #P-complete [15]. The proof makes use of graphs containing cycles, thus it cannot be used to show the hardness of the problem of counting approximate shortest paths on a directed acyclic graph. In fact, we can easily count all s-t paths in a directed acyclic graph in time proportional to the number of edges, if we traverse the graph vertices sorted in topological order and add up the number of paths arriving to each vertex from its predecessors. The difficulty thus lies in the addition of edge-weights and the requirement to count s-t paths of length at most L. In the following, we show that this problem is #P-complete, by a reduction from the N P -complete partition problem. Given a set of positive integers S = {s1, . . . , sn}, the partition problem asks for a partition of S into sets S1 and S2 such that the sums of numbers in both sets are equal. Given an instance S = {s1, . . . , sn} of the partition problem, we construct a graph with n + 1 vertices v1, . . . , vn+1 as follows. We consider the elements of S in an arbitrary order s1, . . . , sn. Then, for every i < n, the graph will contain two parallel edges between vertices vi and vi+1 with lengths si and −si, respectively. Then every path from v1 to vn+1 corresponds to one partition of S to subsets S1 and S2. If, between two consecutive vertices vi and vi+1, the edge with length si is chosen, si will belong to the set S1. If the chosen edge has length −si, the element si will belong to the set S2. The length of the v1-vn+1 path then corresponds to the difference between the sums of elements in S1 and in S2 and the number of paths of length 0 is then equal to the number of optimal solutions of the partition problem. If we had an algorithm that can count the number of v1-vn+1 paths of length at most −1 and the number of v1-vn+1 paths of length at most 0, the difference between these two numbers is the number of paths of length exactly 0 and thus the number of solutions to the partition problem. Since the partition problem is reducible from the #P-complete knapsack problem [6] and its own reduction as well as ours is parsimonious [9], the problem of counting all s-t paths of length at most L is #P-complete. Note that the existence of parallel edges is not necessary for the reduction; we could bisect each parallel edge creating an auxiliary vertex to form a graph of the same functionality but without parallel edges. Also, observe that the use of negative edge-weights is not necessary; we can add to every edge-weight a very large number M (say, the maximum number in S), and then ask whether there exists a path of length nM. Thus, we have shown the following. Theorem 1. Let G be a directed acyclic graph with integer edge-weights, and L be an integer. The problem of counting all s-t paths of length at most L is #P-complete, even if all edge-weights are non-negative. 2 Approximation Algorithms In this section we present an FPTAS for our counting problem. That is, we present an algorithm that when given a directed acyclic graph G on n vertices, two dedicated vertices s and t, a weight-threshold L, and a constant ε > 0, computes a (1 + ε)-approximation of the total number of s-t paths of length at ε . most L, and which runs in time polynomial in both n and 1 Let us note why the most immediate attempt to solve the problem directly does not work. We could try to calculate the number of paths from s to each vertex i that are shorter than all possible thresholds L. We can do this incremen- tally by calculating the paths for vertices sorted in topological order and for each new vertex combining the paths that arrived from previously computed vertices. We can then pick some polynomially large subset of the thresholds L and round all distances down to the nearest one in the subset. While we would end up with an algorithm of polynomial run-time, it would not constitute a FPTAS, since we would exactly count the number of paths that are no longer than some length L′ which does not differ much from our desired maximum length L, instead of approximately counting the number of solutions that are shorter than the exact length L. We first show a recurrence that can be used to exactly count the number of s-t paths of length at most L. Evaluating the recurrence takes exponential time, but we will later show how to group partial solutions together in such way that we trade accuracy for the number of recursive calls. We adapt the approach of Štefankovič et al. [13], which they used to approximate the number of all feasible solutions to the knapsack problem. Let G be a directed acyclic graph with n vertices. We will label the vertices v1, . . . , vn in such order that there is no path from vi to vj unless i < j, i.e., v1, . . . , vn defines a topological ordering. We suppose that v1 = s and vn = t, otherwise the graph can be pruned by discarding all vertices that appear before s and after t in the topological order, since no path from s to t ever visits these. Now, for a given L, instead of asking for the number of s-t paths that have length at most L, we indirectly ask: for a given value a, what is the smallest threshold L′ such that there are at least a paths from s to t of length at most L′? Let τ (vi, a) denote the minimum length L′ such that there are at least a paths from v1 to vi of length at most L′. To find the number of s-t paths of length at most L using this function τ, we simply search for the largest a such that τ (vn, a) ≤ L, and return it as the output. In particular, if the length of the shortest s-t path is OP T (which can be computed in polynomial time), we can find, for any ρ > 1, the number of ρ-approximate s-t paths by setting L := ρOP T . For a concrete vertex vi with in-degree di, let us denote its di neighbors that precede it in the topological order by p1, . . . , pdi and let us denote the corresponding incoming edge lengths by l1, . . . , ldi. For simplicity, we usually drop the index i when it is clear from the context and just write d, p1, . . . , pd and l1, . . . , ld. Now, τ (vi, a) can be expressed by the following recurrence τ (v1, 0) = −∞ τ (v1, a) = 0,∀a : 0 < a ≤ 1 τ (v1, a) = ∞,∀a : a > 1 τ (vi, a) = min max (τ (ps, αsa) + ls). α1,...,αd P αj =1 s Intuitively, the a paths starting at v1 and arriving at vi must split in some way among incoming edges. The values αj define such split. We look for a set of α1, . . . , αd that minimizes the maximum allowed path length needed such that the incoming paths can be distributed according to αj, j = 1, . . . , d. Note that while the values of αia do not have to be integer, τ (vi, αia) is equal to τ (vi,⌈αia⌉). Moreover, when evaluating the recursion, it is enough to search for values αi such that each of the values α1a, . . . , αda is an integer. Calculating τ using the given recurrence will not result in a polynomial time algorithm since we might need to consider an exponential number of values for a, namely 2n−2 on a DAG with a maximal number of edges.2 To overcome this, we will consider only a polynomial number of possible values for a, and always round down to the closest previously considered one in the recursive evaluation. If we are looking for an algorithm that counts with 1 + ε precision, the ratio between two successive considered values of a must be at most 1 + ε. For this purpose, we introduce a new function τ ′. In order to achieve precision of 1 + ε, we will only consider values of τ ′ for minimum path numbers in the form of qk for all positive integers k such that qk < 2n−2, where q = n+1√1 + ε. The values of τ ′ for other numbers of paths will be undefined. The function τ ′ is defined by the recurrence τ ′(v1, 0) = −∞ τ ′(v1, a) = 0,∀a : 0 < a ≤ 1 τ ′(v1, a) = ∞,∀a : a > 1 τ ′(vi, qj) = min max α1,...,αd P αj =1 s (τ ′(ps, q⌊j+logq αs⌋) + ls). (1) To give a meaning to the expression q⌊j+logq αi⌋ when αi = 0, we define it to be equal to 0, which is consistent with its limit when αi goes to 0. We now show 2 To see this, observe that in a topologically sorted graph G, any subset of V \ {s, t} gives a unique candidate for an s-t path. that the rounding does not make the values of τ ′ too different from the values of τ. Lemma 1. Let 1 ≤ i and i ≤ j. Then τ (vi, qj−i) ≤ τ ′(vi, qj) ≤ τ (vi, qj). (2) Proof. We first prove the first inequality, proceeding by induction on i. The base case holds since τ (v1, a) ≤ τ ′(v1, b) for any a ≤ b. Suppose now that the first inequality of (2) holds for every p, p < i. Then, for every 0 ≤ α < 1, τ ′(p, q⌊j+logq α⌋) ≥ τ (p, q⌊j+logq α⌋−p) ≥ τ (p, qj−p−1+logq α) ≥ τ (p, αqj−i). Thus, since every predecessor of vi is earlier in the vertex ordering, we can use the obtained inequality to get the claimed bound τ ′(vi, qj) = min α1,...,αd P αj =1 max s τ ′(ps, q⌊j+logq αs⌋) + ls ≥ min α1,...,αd P αj =1 max s τ (ps, αsqj−i) + ls = τ (vi, qj−i). The other inequality τ ′(vi, qj) ≤ τ (vi, qj) follows by a simpler induction on i. The base case holds since τ (v1, x) = τ ′(v1, x) for all x. Assume now that the second part of (2) holds for all p < i. Then τ ′(p, q⌊j+logq αi⌋) ≤ τ (p, q⌊j+logq αi⌋) ≤ τ (p, αiqj). We can now use the recursive definition to obtain the claimed inequality τ ′(vi, qj) ≤ τ (vi, qj): τ ′(vi, qj) = min α1,...,αd P αj =1 max s τ ′(ps, q⌊j+logq αs⌋) + ls ≤ min α1,...,αd P αj =1 max s τ (ps, αsqj) + ls = τ (vi, qj). ⊓⊔ We can now use τ ′(vn, qk) to obtain a (1 + ε)-approximation for the counting problem. Basically, for any L, we show that for the largest integer k such that τ ′(vn, qk) ≤ L < τ ′(vn, qk+1), the value qk will be no more than (1 + ε)±1 away from the optimum. Lemma 2. Given L, let k be such that τ ′(vn, qk) ≤ L < τ ′(vn, qk+1) and a be such that τ (vn, a) ≤ L < τ (vn, a + 1). Then (1 + ε)−1 ≤ a qk ≤ 1 + ε. Proof. Using Lemma 1 twice, we get τ (vn, qk−n) ≤ τ ′(vn, qk) ≤ L < τ ′(vn, qk+1) ≤ τ (vn, qk+1). As τ (vn, qk−n) is at most L, and a is largest such that τ (vn, a) ≤ L, and τ is monotonous in its second parameter, it must be that qk−n ≤ a. Sim- ilarly, τ (vn, qk+1) is larger than L, so by monotonicity a ≤ qk+1. Thus both a and qk must lie between qk−n and qk+1 and their ratio can be at most qk+1−(k−n) = qn+1 = 1 + ε and at least qk−(k+1) = (1 + ε)−1/(n+1) > (1 + ε)−1. ⊓⊔ We now show that computing the values of τ ′(vi, qk) can be done in time ε . This then, together with Lemma 2, gives an FPTAS for polynomial in n and 1 the counting problem. Theorem 2. For any L, any edge-weighted directed acyclic graph G, and any vertices s, t, there is an FPTAS that counts the number of all s-t paths in G of length at most L in time O(mn3ε−1 log n). Proof. Recall that a directed acyclic graph on n vertices has at most 2n−2 s- t paths. The values of a in τ therefore span at most {1, 2, . . . , 2n−2}, and the values of qk in τ ′ span at most {1, q, q2, . . . , qs}, where (n − 2)(n + 1) log2(1 + ε) s := logq(2n−2) = = O(n2ε−1). (n − 2) log2 q = Thus, we evaluate function τ ′ for at most ns = O(n3ε−1) different parameter pairs. To show that the evaluation of τ ′ can be done in polynomial time, we need to show that we can efficiently find α1, . . . , αd that minimize Expression (1). Fortunately, τ ′(vi, qk) is monotonous with increasing k, we can thus apply a greedy approach. Given vi, we will evaluate τ ′(vi, qk) for all possible values of qk in one run. Instead of looking for the tuple α1, . . . , αd such that P αi = 1 we will consider an integer tuple k1, . . . , kd that minimizes maxi τ ′(pi, qki) restricted by P qki > qk−1. We start with all ki equal to 0 and always increase by one the ki that minimizes τ ′(pi, qki+1) + li. Whenever the sum of all qki gets larger than some value qk−1, we store the current maximum of τ ′(pi, qki ) + li as the value τ ′(vi, qk). We terminate once Pi qki reaches 2n−2. It can be shown that such approach calculates the same values of τ ′ as searching through ratios αi. As we can increase each ki at most s times, we make at most ds steps, each of which involves choosing a minimum from d values and replacing it with a new value. The latter can be done in time O(log d) ⊆ O(log n), for instance by keeping the values τ ′(vi, qki+1) + li in a heap. The sum of the d's for all considered vertices is equal to the number of edges m. The update of Pi qki, calculation of qk+1 from qk, and comparison with the maximum number of paths can all be done in O(log(2n)) = O(n) time if we choose q in the form 1 + 2−t in order to be able to implement multiplication by q by a sequence of bit-shifts and a single addition. The resulting bit-time complexity is thus O(mn3ε−1 log n). ⊓⊔ We note that processing the dynamic programming table for all path numbers in one go would to improve the time complexity of the original Knapsack FPTAS [13] by a factor of O(log(n)). 2.1 Counting solutions of given lengths in multiple instances In this section we consider the problem of counting solutions that are approximately- optimum for two given instances at the same time. The two instances differ in edge lengths, but share the same topology, effectively forming a bi-criteria in- stance. Formally, given two directed acyclic graphs G1 and G2, differing only in edge-weights, given two vertices s and t, and given two threshold values L1 and L2, we are interested in the number of the s-t paths that have at the same time length at most L1 in G1 and length at most L2 in G2. To solve this algorithmic problem, we cannot directly apply the approach for the single-instance case (by defining τ to be a pair of path lengths, one for each of the two instances), as we now have two lengths per edge and it is unclear how to suitably define a maximum over pairs in Equation (1). In fact, we can show that we cannot construct a FPTAS for the two instance scenario, or indeed any approximation algorithm. Theorem 3. Let G1 and G2 be two directed acyclic graphs with the same sets of vertices and edges, but possibly different edge-weights, let s and t be two vertices in them, let L1 and L2 be two length thresholds. The existence of an algorithm that in time polynomial in number of vertices n computes any finite approxima- tion of the number of paths from s to t that are shorter than L1 if measured in the graph G1 and shorter than L2 if measured in the graph G2, implies that P = N P . Proof. We show this by reducing the decision version of the knapsack problem to the aforementioned problem. Let us have a knapsack instance with n items with weights w1, . . . , wn and prices p1, . . . , pn. Given a total weight limit W and a price limit P we want to know if we can select a set of items such that the total weight is at most W and the total price is at least P . The corresponding DAG will have n + 1 vertices v0, . . . , vn, with two edges between all successive vertices vk and vk+1 that will correspond to the action of taking or not taking the k + 1-st element into the knapsack. The first edge between vk and vk+1 will have length wk+1 in the graph G1 and length 2P n+1 − pk+1 in the graph G2, the second edge will have length 0 in the graph G1 and 2P n+1 in the graph G2. We can now ask for the number of paths from v0 to vn that are shorter than W in the graph G1 and shorter than P in the graph G2. If we had an algorithm that gives us a number that differs from this number by any real and finite multiplicative ratio c, we could determine whether the original knapsack problem had at least one solution since the ratio between 1 and 0 is not a real number. ⊓⊔ This proof is perhaps surprising due to the fact that Gopalan et al. [7] showed a FPTAS that counts the number of solutions of multi-criteria knapsack in- stances. This shows that while knapsack is a special version of our problem, it is in fact less complex due to the common assumption that the item values are non-negative. While we cannot obtain a (1 + ε)-approximation of the number of s-t paths that have length at most L1 in the first instance, and at the same time length at most L2 in the second instance, we will adopt the techniques for FPTAS in a single instance, and show a polynomial-time algorithm that provides heuristics for good estimates of s-t paths that have length at most (1 + δ)L1 in the first instance, and at the same time length at most L2 in the second instance. We will only consider the case where L1 is positive. To do so, we define a function τ2 similar in spirit to τ that uses a maxi- mum path-length L1 in the form of a "budget" as a parameter of τ2. Formally, τ2(vi, a, L1) is the smallest length L2 such that there are at least a v1-vi paths, each of length at most L1 with respect to the edge lengths in the first instance, and of length at most L2 with respect to the edge length in the second instance. Similarly to τ, we can express τ2 recursively using the following notation. Let vi be a vertex of in-degree d, and let p1, . . . , pd be the neighbors of vi preced- ing it in the topological order. The edge-length of the incoming edge (pj, vi), j = 1, . . . , di, is lj in the first instance, and l′ j in the second instance. Then, τ2 satisfies the following recursion: τ2(v1, 0, x) = −∞,∀x ∈ R+ τ2(v1, a, x) = 0,∀a : 0 < a ≤ 1,∀x ∈ R+ τ2(v1, a, x) = ∞,∀a : a > 1,∀x ∈ R+ τ2(vi, a, L1) = min max α1,...,αd P αj =1 s τ2(ps, αsa, L1 − ls) + l′ s If we wanted to use τ2 to directly use to solve our counting problem, the function τ2 would have to be evaluated not only for an exponential number of path counts a, but also for possibly exponential number of values of L1. To end up with polynomial runtime, we thus need to consider only a polynomial number of values for both parameters of τ2. For this purpose, we will introduce a function τ ′ 2 that does this by considering only path lengths in the form of rk, where r = n√1 + δ, and path numbers a in the form of qj, where q = n√1 + ε, for positive ε and δ. Function τ ′ 2 is defined by the following recurrence: τ ′ 2(v1, 0, x) = −∞,∀x ∈ R+ τ ′ 2(v1, a, x) = 0,∀a : 0 < a ≤ 1,∀x ∈ R+ τ ′ 2(v1, a, x) = ∞,∀a : a > 1,∀x ∈ R+ τ ′ 2(vi, qj, rk) = min α1,...,αd P αj =1 max s 2(ps, q⌊j+logq αs⌋, r⌊logr (rk−ls)⌋) + l′ τ ′ s Similarly to the case of one instance only, one can show that τ ′ 2 approximates τ2 well, this time in two variables. Lemma 3. Let 0 ≤ i, i ≤ j, and i ≤ k. Then τ2(vi, qj−i, rk) ≤ τ ′ 2(vi, qj, rk) ≤ τ2(vi, qj, rk−i). (3) Proof. We proceed as in the proof of Lemma 1. Note that the function τ2 is monotone non-decreasing in a, but monotone non-increasing in L1. Proceeding by induction on i, the base case holds since τ2(v1, a, y) ≤ τ ′ 2(v1, b, y) for any a ≤ b and y. We suppose that Equation (3) holds for all p < i. Then, for every 0 ≤ α < 1, 2(p, q⌊j+logq α⌋, r⌊logr(rk−l)⌋)a ≥ τ2(p, q⌊j+logq α⌋−p, r⌊logr (rk−l)⌋) τ ′ ≥ τ2(p, qj−p−1+logq α, rk − l) ≥ τ2(p, αqj−i, rk − l). Thus, since every predecessor of vi has index smaller than i, τ ′ 2(vi, qj, rk) = min α1,...,αd P αj =1 max s 2(ps, q⌊j+logq αs⌋, r⌊logr (rk−ls)⌋) + l′ τ ′ s ≥ min α1,...,αd P αj =1 max s τ2(ps, αsqj−i, rk − ls) + l′ s = τ2(vi, qj−i, rk). The proof of the inequality τ ′ that (3) holds for every p < i, we obtain 2(vi, qj, rk) ≤ τ2(vi, qj, rk−i) is similar. Assuming 2(p, q⌊j+logq α⌋, r⌊logr (rk−l)⌋) ≤ τ2(p, q⌊j+logq α⌋, r⌊logr (rk−l)⌋−p) τ ′ ≤ τ2(p, αqj, rlogr(rk−l)−p−1) ≤ τ2(p, αqj, rk−i − l). Plugging it into the definition of τ ′ 2, we obtain τ ′ 2(vi, qj, rk) = min α1,...,αd P αj =1 max s 2(ps, q⌊j+logq αs⌋, r⌊logr (rk−ls)⌋) + l′ τ ′ s ≤ min α1,...,αd P αj =1 max s τ2(ps, αsqj, rk−i − ls) + l′ s = τ2(vi, qj, rk−i). Using Lemma 3, we can show that τ ′ ⊓⊔ 2 provides enough information to compute an approximation of τ2. However, we cannot get a (1 + ε) approximation to the optimal value as in Lemma 2, because we need to round the value of L1 to a 2 and we further round it power of r in order for it to be legal parameter of τ ′ during the evaluation of τ ′ 2 to the results of τ2 we would have gotten if we considered the value of L1 when rounded up towards the nearest number that can be represented as rk for integer k and the value rk−n. Due to the choice of r, the ratio of these two values is 1 + δ. 2. We will therefore relate the result of τ ′ Lemma 4. Let k be such that τ ′ 2(vn, qk+1, r⌈logr L1⌉), a be such that τ2(vn, a, r⌈logr L1⌉−n) ≤ L2 < τ2(vn, a + 1, r⌈logr L1⌉−n), and b be largest such that τ2(vn, b, r⌈logr L1⌉) ≤ L2 < τ2(vn, b + 1, r⌈logr L1⌉). Then a ≤ b, qk ≤ 1 + ε, and qk 2(vn, qk, r⌈logr L1⌉) ≤ L2 < τ ′ b ≤ 1 + ε. a Proof. The statement that a ≤ b follows from the definition of a and b: decreasing the limit on the path length in the first instance from r⌈logr L1⌉ to r⌈logr L1⌉−n cannot increase the number of possible paths. By applying Lemma 3 twice, we get τ2(vn, qk−n, r⌈logr L1⌉) ≤ τ ′ 2(vn, qk, r⌈logr L1⌉) ≤ L2, (4) and L2 < τ ′ a b ≤ qn ≤ 1 + ε. 2(vn, qk+1, r⌈logr L1⌉) ≤ τ2(vn, qk+1, r⌈logr L1⌉−n). (5) From the definition of a and (5) we can conclude a ≤ qk+1. This implies that qk ≤ q ≤ 1 + ε, due to our choice of q. Similarly, from the definition of b and (4) we get b ≥ qk−n and thus qk ⊓⊔ Lemma 4 shows that the computed number of s-t paths qk cannot be larger than b by more than a factor of 1 + ε, nor can it be smaller than a by a factor larger than 1 + ε. Furthemore, with the aforementioned choice of r as n√1 + δ, the difference between the rounded up value of L1 which is r⌈logr L1⌉ and the rounded down value which is r⌈logr L1⌉−n is (1 + δ). We can now state the overall running time of the approach. Compared to the function τ ′ we need to evaluate 2 for ⌈logr L1⌉ = O(nδ−1 log L1) values of rl, in addition to the values of vi τ ′ and qk. Otherwise the arguments are identical to the proof of Theorem 2. Note that log L1 is by definition in O(n), but we list it explicitly since it can be much smaller in practice. Lemma 5. Given path-lengths L1 and L2 for two given instances G1 and G2 of a graph with n edges and m vertices, there is an algorithm that finds k satisfying 2(vn, qk, r⌈logr L1⌉) ≤ L < τ ′ τ ′ 2(vn, qk+1, r⌈logr L1⌉) in time O(mn3ε−1δ−1 log n log L1). Putting together Lemma 4 and Lemma 5 we can state the overall result: Theorem 4. For any L1, L2, any edge-weighted directed acyclic graphs on the same topology G1 and G2, and any two of their vertices s, t, there exists a length 2 satisfying (1 + δ)−1L2 ≤ L′ L′ 2 ≤ L2 and an FPTAS for counting the number of paths from s to t no longer than L1 when evaluated on the graph G1 and no longer than L′ 2 when evaluated on the graph G2 in the time O(mn4ε−1δ−1 log n log L1). It is easy to see that we can extend the approach to count paths that ap- proximate m instances at the same time by adding "budgets" L1, . . . , Lm−1 for the desired maximal lengths of paths in instances 1, 2, . . . , m− 1. The time com- plexity would again increase, for every additional instance with threshold Li by O(nδ−1 log Li). Pseudo-polynomial algorithm for two instances. If the discrepancy between a and b as defined in Lemma 4 is too large and all edges have integer lengths, we can consider all possible lengths in the first instance, instead of rounding to values in the form of rk. The function τ ′′ 2 will be τ ′ extended with the budget representing the exact maximum length of a path in the first instance. τ ′′ 2 (v1, 0, x) = −∞,∀x ∈ R+ 2 (v1, a, x) = 0,∀a : 0 < a ≤ 1,∀x ∈ R+ τ ′′ τ ′′ 2 (v1, a, x) = ∞,∀a : a > 1,∀x ∈ R+ τ ′′ 2 (vi, qj, rk) = min α1,...,αd P αj =1 max s τ ′′ 2 (ps, q⌊j+logq αs⌋, L − ls) + l′ s We will state the lemma and theorem about accuracy and runtime without proofs, since these are similar to the proofs of Lemma 2 and Theorem 2. Notice that the algorithm evaluating τ ′′ 2 is pseudo-polynomial. Lemma 6. Given L, let k be such that τ ′′ and a be such that τ2(vn, a, L1) ≤ L2 < τ2(vn, a + 1, L1). Then (1 + ε)−1 ≤ a 1 + ε. 2 (vn, qk, L1) ≤ L2 < τ ′′ 2 (vn, qk+1, L1) qk ≤ Theorem 5. Given two graphs with integer weights, and any ε > 0, there is an algorithm that computes a (1 + ε)-approximation for the number of s-t paths that have length at most L1 in the first instance, and length at most L2 in the second instance, and runs in time O(mn3ε−1L1 log n), where m denotes the number of edges in the graph. 3 Concluding Remarks We have shown that there is an efficient algorithm to approximate the number of approximately shortest paths in a directed acyclic graph. This problem is implicitly or explicitly present as an algorithmic tool in algorithmic solutions to a large number of different computational problems, not limited to the evaluation of solutions achieved by dynamic programming which we noted in Section 1.1. Our result allows us, for instance, to approximately count only the small (or large) terms of a polynomial p(x) = Pi aixi, ai ≥ 0, represented as a product Qj pj(x) of polynomially many polynomial factors pj(x), where each pj(x) = Pk bkxk has polynomially many terms, and where every bk ≥ 0. This is especially interesting if the full expansion of p(x) has exponentially many terms. This may be a powerful tool, if extended to the case of both negative and positive bk, enabling the counting of approximate solutions for problems with known generating polynomials of solutions by weight. For instance, counting of large graph matchings [8] or short spanning trees [1] can be done via generating polynomials (which, in general, have exponentially many terms). This direction is our primary future work. We have also showed that our algorithm can be extended, given threshold weights L1, . . . , Lm, and polynomially many graphs G1, . . . , Gm, to count s-t paths that have, at the same time, length at most L1 in G1 and at most (1 + δ)Li in Gi, i = 2, . . . , m. In the case when m = 2, this algorithm is necessary for application of the aforementioned robust optimization method [2] to the various mentioned optimization problems. Acknowledgements. We thank Octavian Ganea and anonymous reviewers for their suggestions and comments. The work has been partially supported by the Swiss National Science Foundation under grant no. 200021_138117/1, and by the EU FP7/2007-2013, under the grant agreement no. 288094 (project eCOM- PASS). References 1. Broder, A.Z., Mayr, E.W.: Counting minimum weight spanning trees. J. Algo- rithms 24, 171 -- 176 (July 1997) 2. Buhmann, J.M., Mihalák, M., Šrámek, R., Widmayer, P.: Robust optimization in the presence of uncertainty. In: Proc. 4th Conference on Innovations in Theoretical Computer Sciencei (ITCS). pp. 505 -- 514. ACM, New York, NY, USA (2013) 3. Burge, C., Karlin, S.: Prediction of complete gene structures in human genomic DNA. Journal of molecular biology 268(1), 78 -- 94 (1997) 4. Chen, T., Kao, M.Y., Tepel, M., Rush, J., Church, G.M.: A dynamic programming approach to de novo peptide sequencing via tandem mass spectrometry. Journal of Computational Biology 8(3), 325 -- 337 (2001) 5. Durbin, R., Eddy, S.R., Krogh, A., Mitchison, G.: Biological sequence analysis: probabilistic models of proteins and nucleic acids. Cambridge university press (1998) 6. Dyer, M., Frieze, A., Kannan, R., Kapoor, A., Perkovic, L., Vazirani, U.: A mildly exponential time algorithm for approximating the number of solutions to a multi- dimensional knapsack problem. Combinatorics, Probability and Computing 2(3), 271 -- 284 (1993) 7. Gopalan, P., Klivans, A., Meka, R., Štefankovič, D., Vempala, S., Vigoda, E.: An FPTAS for # knapsack and related counting problems. In: Proc. 52nd An- nual IEEE Symposium on Foundations of Computer Science (FOCS). pp. 817 -- 826 (2011) 8. Jerrum, M.: Two-dimensional monomer-dimer systems are computationally in- tractable. Journal of Statistical Physics 48(1-2), 121 -- 134 (1987) 9. Karp, R.M.: Reducibility among combinatorial problems. Springer (1972) 10. Kreher, D.L., Stinson, D.R.: Combinatorial Algorithms: Generation, Enumeration, and Search (1998) 11. Lu, B., Chen, T.: A suboptimal algorithm for de novo peptide sequencing via tandem mass spectrometry. Journal of Computational Biology 10(1), 1 -- 12 (2003) 12. Naor, D., Brutlag, D.: On suboptimal alignments of biological sequences. In: Proc. 4th Annual Symposium on Combinatorial Pattern Matching (CPM). pp. 179 -- 196. Springer (1993) 13. Štefankovič, D., Vempala, S., Vigoda, E.: A deterministic polynomial-time ap- proximation scheme for counting knapsack solutions. SIAM Journal on Computing 41(2), 356 -- 366 (2012) 14. Valiant, L.G.: The complexity of computing the permanent. Theoretical computer science 8(2), 189 -- 201 (1979) 15. Valiant, L.G.: The complexity of enumeration and reliability problems. SIAM J. Comput. 8(3), 410 -- 421 (1979)
1312.2381
1
1312
2013-12-09T11:10:11
A Note on the Longest Common Compatible Prefix Problem for Partial Words
[ "cs.DS", "cs.FL" ]
For a partial word $w$ the longest common compatible prefix of two positions $i,j$, denoted $lccp(i,j)$, is the largest $k$ such that $w[i,i+k-1]\uparrow w[j,j+k-1]$, where $\uparrow$ is the compatibility relation of partial words (it is not an equivalence relation). The LCCP problem is to preprocess a partial word in such a way that any query $lccp(i,j)$ about this word can be answered in $O(1)$ time. It is a natural generalization of the longest common prefix (LCP) problem for regular words, for which an $O(n)$ preprocessing time and $O(1)$ query time solution exists. Recently an efficient algorithm for this problem has been given by F. Blanchet-Sadri and J. Lazarow (LATA 2013). The preprocessing time was $O(nh+n)$, where $h$ is the number of "holes" in $w$. The algorithm was designed for partial words over a constant alphabet and was quite involved. We present a simple solution to this problem with slightly better runtime that works for any linearly-sortable alphabet. Our preprocessing is in time $O(n\mu+n)$, where $\mu$ is the number of blocks of holes in $w$. Our algorithm uses ideas from alignment algorithms and dynamic programming.
cs.DS
cs
A Note on the Longest Common Compatible Prefix Problem for Partial Words M. Crochemorea,b, C. S. Iliopoulosa,c, T. Kociumakad, M. Kubicad, A. Langiua, J. Radoszewskid,∗, W. Rytterd,e, B. Szrederd, T. Wale´nf,d aKing's College London, London WC2R 2LS, UK bUniversit´e Paris-Est, France cDigital Ecosystems & Business Intelligence Institute, Curtin University of Technology, Perth WA 6845, Australia dFaculty of Mathematics, Informatics and Mechanics, University of Warsaw, e Faculty of Mathematics and Computer Science, Copernicus University, ul. Banacha 2, 02-097 Warsaw, Poland ul. Chopina 12/18, 87-100 Toru´n, Poland fLaboratory of Bioinformatics and Protein Engineering, International Institute of Molecular and Cell Biology in Warsaw, Poland Abstract For a partial word w the longest common compatible prefix of two positions i, j, denoted lccp(i, j), is the largest k such that w[i, i+k−1] ↑ w[j, j +k−1], where ↑ is the compatibility relation of partial words (it is not an equivalence relation). The LCCP problem is to preprocess a partial word in such a way that any query lccp(i, j) about this word can be answered in O(1) time. It is a natural generalization of the longest common prefix (LCP) problem for regular words, for which an O(n) preprocessing time and O(1) query time solution exists. Recently an efficient algorithm for this problem has been given by F. Blanchet- Sadri and J. Lazarow (LATA 2013). The preprocessing time was O(nh + n), where h is the number of "holes" in w. The algorithm was designed for partial words over a constant alphabet and was quite involved. We present a simple solution to this problem with slightly better runtime that works for any linearly-sortable alphabet. Our preprocessing is in time O(nµ + n), where µ is the number of blocks of holes in w. Our algorithm uses ideas from alignment algorithms and dynamic programming. Keywords: partial word, longest common compatible prefix, longest common prefix, dynamic programming ∗Corresponding author. Tel.: +48-22-55-44-484, fax: +48-22-55-44-400. Email addresses: [email protected] (M. Crochemore), [email protected] (C. S. Iliopoulos), [email protected] (T. Kociumaka), [email protected] (M. Kubica), [email protected] (A. Langiu), [email protected] (J. Radoszewski), [email protected] (W. Rytter), [email protected] (B. Szreder), [email protected] (T. Wale´n) Preprint submitted to Elsevier April 20, 2018 Let w be a partial word of length n. That is, w = w1 . . . wn, with wi ∈ Σ ∪ {⋄}, where Σ is called the alphabet (the set of letters) and ⋄ /∈ Σ denotes a hole. A non-hole position in w is called solid. By h we denote the number of holes in w and by µ we denote the number of blocks of consecutive holes in w. By ↑ we denote the compatibility relation: a ↑ ⋄ for any a ∈ Σ and moreover ↑ is reflexive. The relation ↑ is extended in a natural letter-by-letter manner to partial words of the same length. Note that ↑ is not transitive: a ↑ ⋄ and ⋄ ↑ b whereas a 6↑ b for any letters a 6= b. Motivation on partial words and their applications can be found in the book [1]. Example 1. Let w = a b ⋄ ⋄ a ⋄ ⋄ ⋄ b c a b ⋄. There are 7 solid positions in w, h = 6 and µ = 3. By w[i, j] we denote the subword wi . . . wj . The longest common compatible prefix of two positions i, j, denoted lccp(i, j), is the largest k such that w[i, i + k − 1] ↑ w[j, j + k − 1]. Example 2. For the word w from Example 1, we have lccp(2, 9) = 3, lccp(1, 2) = 0, lccp(3, 6) = 8. In [2] F. Blanchet-Sadri and J. Lazarow provide a data structure that is constructed in O(nh + n) time and space and allows computing LCCP for any two positions in O(1) time. Their data structure is based on suffix dags which are a modification of suffix trees and requires Σ to be a fixed alphabet (i.e. Σ = O(1)). We show a much simpler data structure that requires only O(nµ + n) con- struction time and space and also allows constant-time LCCP-queries. Our algorithm is based on alignment techniques and suffix arrays for full (regular) words and works for any integer alphabet (that is, the letters can be treated as integers in a range of size nO(1)). By type(i) we mean hole or solid depending on the type of wi. We add a sentinel position: w0 = ⋄ if w1 is solid or w0 = a ∈ Σ if w1 is a hole. A position in w is called transit if it is a hole directly preceded by a solid position or a solid position directly preceded by a hole, see Fig. 1. Enumerate all transit positions T = {i1, i2, . . . , iκ}. Note that κ ≤ 2µ. Transit positions holes solid Figure 1: Illustration of transit positions, µ = 3, κ = 6. 2 Example 3. Let w = a b ⋄ ⋄ a ⋄ ⋄ ⋄ b c a b ⋄. Then T = {1, 3, 5, 6, 9, 13}, see also Fig. 1. Our data structure consists of two parts: 1. a data structure of size O(n) allowing to answer in O(1) time the longest common prefix, denoted lcp(i, j), between any two positions in the full word w, which results from w by treating holes as solid symbols 2. a n × µ table LCCP [i, j] = lccp(i, j) for i ∈ {1, . . . , n}, j ∈ T . For simplicity we assume LCCP [j, i] = LCCP [i, j] if i ∈ T , j ∈ {1, . . . , n}. The data structure (1) consists of the suffix array for w and Range Minimum Query data structure. A suffix array is composed of three tables: SUF , RANK and LCP . The SUF table stores the list of positions in w sorted according to the increasing lexicographic order of suffixes starting at these positions. The LCP array stores the lengths of the longest common prefixes of consecutive suffixes in SUF . We have LCP [1] = −1 and, for 1 < i ≤ n, we have: LCP [i] = lcp(SUF [i − 1], SUF [i]). Finally, the RANK table is an inverse of the SUF table: SUF [RANK [i]] = i for i = 1, 2, . . . , n. All tables comprising the suffix array for a word over a linearly-sortable alphabet can be constructed in O(n) time [3, 5, 6]. The Range Minimum Query data structure (RMQ, in short) is constructed for an array A[1 . . n] of integers. This array is preprocessed to answer the following form of queries: for an interval [i, j] (where 1 ≤ i ≤ j ≤ n), find the minimum value A[k] for i ≤ k ≤ j. The best known RMQ data structures have O(n) preprocessing time and O(1) query time [4]. To compute lcp(i, j) for i 6= j we use a classic combination of the two data structures, see also [3]. Let x be min(RANK [i], RANK [j]) and y be max(RANK [i], RANK [j]). Then: lcp(i, j) = min{LCP [x + 1], LCP[x + 2], . . . , LCP [y]}. This value can be computed in O(1) time provided that RMQ data structure for the table LCP is given. For i ∈ {1, . . . , n} define NextChange[i] = min{k > 0 : type(i + k) 6= type(i)}. If no such k exists then NextChange[i] = n + 1 − i. Clearly the NextChange table can be computed in O(n) time. We denote next(i, j) = min(NextChange[i], NextChange[j]). 3 Lemma 1. Assume we have the data structures from points (1)-(2) above. Then lccp(i, j) for any 1 ≤ i, j ≤ n can computed in O(1) time. Proof. If any of the positions i, j belongs to T then we simply use the LCCP table. Otherwise we have two cases. If any of the positions i, j is a hole then the result is d + LCCP [i + d, j + d], where d = next(i, j). Otherwise, both i, j are solid. Let k = lcp(i, j). The result is d + LCCP [i + (cid:3) d, j + d] if k ≥ d or k otherwise. Algorithm LCCP-Query(w, i, j) d := next (i, j); k := lcp(i, j); if type(wi) 6= solid or type(wj ) 6= solid or k ≥ d then return d + LCCP[i + d, j + d]; else return k Theorem 2. Let w be a partial word of length n over an integer alphabet. We can preprocess w in O(nµ + n) time to enable lccp-queries in constant time. Proof. The data structure (1) for lcp-queries is constructed in O(n) time from the suffix array for w and the RMQ data structure for the LCP table. The con- struction of the data structure (2) is shown in the following LCCP-Preprocess algorithm. This algorithm is based on the dynamic programming technique and works in O(nµ + n) time. Using the two data structures, by Lemma 1 we can answer lccp(i, j) queries in O(1) time. (cid:3) Algorithm LCCP-Preprocess(w) for i := 1 to n + 1 do LCCP [i, n + 1] := 0; foreach (i, j) : i ∈ {1, . . . , n}, j ∈ T in decreasing lex. order do LCCP [i, j] := LCCP-Query(w, i, j); Example 4. Let w = a b ⋄ ⋄ a ⋄ ⋄ ⋄ b c a b ⋄. The LCCP table computed by the algorithm LCCP-Preprocess(w) is as follows. wi j 1 3 5 6 9 13 a 13 8 4 4 0 1 b 0 7 0 3 3 1 ⋄ 8 11 6 8 5 1 ⋄ 1 6 5 5 1 1 a 4 6 9 4 0 1 ⋄ 4 2 6 3 1 1 b 0 5 0 5 5 1 c 0 2 0 4 0 1 a 3 3 3 3 0 1 b 0 2 0 2 2 1 ⋄ 1 1 1 1 1 1 ⋄ 7 2 4 3 2 1 ⋄ 4 8 4 8 5 1 4 References [1] F. Blanchet-Sadri. Algorithmic Combinatorics on Partial Words. Chapman & Hall/CRC Press, Boca Raton, FL, 2008. [2] F. Blanchet-Sadri and J. Lazarow. Suffix trees for partial words and the longest common compatible prefix problem. In A. H. Dediu, C. Mart´ın-Vide, and B. Truthe, editors, LATA, volume 7810 of Lecture Notes in Computer Science, pages 165 -- 176. Springer, 2013. [3] M. Crochemore, C. Hancart, and T. Lecroq. Algorithms on Strings. Cam- bridge University Press, 2007. [4] D. Harel and R. E. Tarjan. Fast algorithms for finding nearest common ancestors. SIAM J. Comput., 13(2):338 -- 355, 1984. [5] J. Karkkainen and P. Sanders. Simple linear work suffix array construction. In J. C. M. Baeten, J. K. Lenstra, J. Parrow, and G. J. Woeginger, editors, ICALP, volume 2719 of Lecture Notes in Computer Science, pages 943 -- 955. Springer, 2003. [6] T. Kasai, G. Lee, H. Arimura, S. Arikawa, and K. Park. Linear-time longest- common-prefix computation in suffix arrays and its applications. In A. Amir and G. M. Landau, editors, CPM, volume 2089 of Lecture Notes in Computer Science, pages 181 -- 192. Springer, 2001. 5
1910.00581
1
1910
2019-10-01T09:38:50
On the Parameterized Complexity of Reconfiguration of Connected Dominating Sets
[ "cs.DS", "cs.CC", "cs.DM", "math.CO" ]
In a reconfiguration version of an optimization problem $\mathcal{Q}$ the input is an instance of $\mathcal{Q}$ and two feasible solutions $S$ and $T$. The objective is to determine whether there exists a step-by-step transformation between $S$ and $T$ such that all intermediate steps also constitute feasible solutions. In this work, we study the parameterized complexity of the \textsc{Connected Dominating Set Reconfiguration} problem (\textsc{CDS-R)}. It was shown in previous work that the \textsc{Dominating Set Reconfiguration} problem (\textsc{DS-R}) parameterized by $k$, the maximum allowed size of a dominating set in a reconfiguration sequence, is fixed-parameter tractable on all graphs that exclude a biclique $K_{d,d}$ as a subgraph, for some constant $d \geq 1$. We show that the additional connectivity constraint makes the problem much harder, namely, that \textsc{CDS-R} is \textsf{W}$[1]$-hard parameterized by $k+\ell$, the maximum allowed size of a dominating set plus the length of the reconfiguration sequence, already on $5$-degenerate graphs. On the positive side, we show that \textsc{CDS-R} parameterized by $k$ is fixed-parameter tractable, and in fact admits a polynomial kernel on planar graphs.
cs.DS
cs
On the Parameterized Complexity of Reconfiguration of Connected Dominating Sets Daniel Lokshtanov University of California Santa Barbara, Santa Barbara, USA [email protected] Amer E. Mouawad Department of Computer Science, American University of Beirut, Lebanon [email protected] Fahad Panolan Department of Computer Science and Engineering, IIT Hyderabad, India [email protected] Sebastian Siebertz University of Bremen, Germany [email protected] Abstract In a reconfiguration version of an optimization problem Q the input is an instance of Q and two feasible solutions S and T. The objective is to determine whether there exists a step-by-step transformation between S and T such that all intermediate steps also constitute feasible solutions. In this work, we study the parameterized complexity of the Connected Dominating Set Reconfiguration problem (CDS-R). It was shown in previous work that the Dominating Set Reconfiguration problem (DS-R) parameterized by k, the maximum allowed size of a dominating set in a reconfiguration sequence, is fixed-parameter tractable on all graphs that exclude a biclique Kd,d as a subgraph, for some constant d ≥ 1. We show that the additional connectivity constraint makes the problem much harder, namely, that CDS-R is W[1]-hard parameterized by k + ', the maximum allowed size of a dominating set plus the length of the reconfiguration sequence, already on 5-degenerate graphs. On the positive side, we show that CDS-R parameterized by k is fixed-parameter tractable, and in fact admits a polynomial kernel on planar graphs. 2012 ACM Subject Classification CCS → Theory of computation → Design and analysis of algorithms → Parameterized complexity and exact algorithms Keywords and phrases reconfiguration, parameterized complexity, connected dominating set, graph structure theory Introduction 1 In an optimization problem Q, we are usually asked to determine the existence of a feasible solution for an instance I of Q. In a reconfiguration version of Q, we are instead given a source feasible solution S and a target feasible solution T and we are asked to determine whether it is possible to transform S into T by a sequence of step-by-step transformations such that after each intermediate step we also maintain feasible solutions. Formally, we consider a graph, called the reconfiguration graph, that has one vertex for each feasible solution and where two vertices are connected by an edge if we allow the transformation between the two corresponding solutions. We are then asked to determine whether S and T are connected in the reconfiguration graph, or even to compute a shortest path between them. 9 1 0 2 t c O 1 ] S D . s c [ 1 v 1 8 5 0 0 . 0 1 9 1 : v i X r a © Daniel Lokshtanov, Amer E. Mouawad, Fahad Panolan, Sebastian Siebertz; licensed under Creative Commons License CC-BY Editors: John Q. Open and Joan R. Access125 Leibniz International Proceedings in Informatics Schloss Dagstuhl -- Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 2 Reconfiguration of Connected Dominating Set Historically, the study of reconfiguration questions predates the field of computer science, as many classic one-player games can be formulated as such reachability questions [16,18], e.g., the 15-puzzle and Rubik's cube. More recently, reconfiguration problems have emerged from computational problems in different areas such as graph theory [1,14,15], constraint satisfaction [11,23] and computational geometry [4,17,21], and even quantum complexity theory [10]. Reconfiguration problems have been receiving considerable attention in recent literature, we refer the reader to [22,26,30] for an extensive overview. In this work, we consider the Connected Dominating Set Reconfiguration problem (CDS-R) in undirected graphs. A dominating set in a graph G is a set D ⊆ V (G) such that every vertex of G lies either in D or is adjacent to a vertex in D. A dominating set D is a connected dominating set if the graph induced by D is connected. The Dominating Set problem and its connected variant have many applications, including the modeling of facility location problems, routing problems, and many more. We study CDS-R under the Token Addition/Removal model (TAR model). Suppose we are given a connected dominating set D of a graph G, and imagine that a token/pebble is placed on each vertex in D. The TAR rule allows either the addition or removal of a single token/pebble at a time from D, if this results in a connected dominating set of size at most a given bound k ≥ 1. A sequence D1, . . . , D' of connected dominating sets of a graph G is called a reconfiguration sequence between D1 and D' under TAR if the change from Di to Di+1 respects the TAR rule, for 1 ≤ i < '. The length of the reconfiguration sequence is ' − 1. The (Connected) Dominating Set Reconfiguration problem for TAR gets as input a graph G, two (connected) dominating sets S and T and an integer k ≥ 1, and the task is to decide whether there exists a reconfiguration sequence between S and T under TAR using at most k tokens/pebbles. Structural properties of the reconfiguration graph for k-dominating sets were studied in [13,29]. The Dominating Set Reconfiguration problem was shown to be PSPACE- complete in [24], even on split graphs, bipartite graphs, planar graphs and graphs of bounded bandwidth. Both pathwidth and treewidth of a graph are bounded by its bandwidth, hence the Dominating Set Reconfiguration problem is PSPACE-complete on graphs of bounded pathwidth and treewidth. These hardness results motivated the study of the parameterized complexity of the problem. It was shown in [24] that the Dominating Set Reconfiguration problem is W[2]-hard when parameterized by k + ', where k is the bound on the number of tokens and ' is the length of the reconfiguration sequence. However, the problem becomes fixed-parameter tractable on graphs that exclude a fixed complete bipartite graph Kd,d as a subgraph, as shown in [20]. Such so-called biclique-free classes are very general sparse graph classes, including in particular the planar graphs, which are K3,3-free. In this work we study the complexity of CDS-R. The standard reduction from Dominat- ing Set to Connected Dominating Set shows that also CDS-R is PSPACE-complete, even on graphs of bounded pathwidth (Figure 1). We hence turn our attention to the parameterized complexity of the problem. We first show that the additional connectivity constraint makes the problem much harder, namely, that CDS-R parameterized by k + ' is W[1]-hard already on 5-degenerate graphs. As 5-degenerate graphs exclude the biclique K6,6 as a subgraph, Dominating Set Reconfiguration is fixed- parameter tractable on much more general graph classes than its connected variant. To prove hardness we first introduce an auxiliary problem that we believe is of independent interest. In the Colored Connected Subgraph problem we are given a graph G, an integer k, and a coloring c: V (G) → C, for some color set C with C ≤ k. The question is whether G contains a vertex subset H on at most k vertices such that G[H] is connected and H contains D. Lokshtanov et al. 3 G H G k + 1 V (G) V (G) Figure 1 A graph G with a minimum dominating set of size k = 2 marked in dark blue and the graph H obtained in the standard reduction from Dominating Set to Connected Dominating Set. G has a dominating set of size k if and only if H has a connected dominating set of size k + 1. If p is equal to the pathwidth of G then the pathwidth of H is bounded by 2p + 1. at least one vertex of every color in C (i.e., c(V (H)) = C). The reconfiguration variant Colored Connected Subgraph Reconfiguration (CCS-R) is defined as expected. We first prove that CCS-R reduces to CDS-R by a parameter preserving reduction (where k + ' is the parameter) and the degeneracy of the reduced graph is at most the degeneracy of the input graph plus one. We then prove that the known W[1]-hard problem Multicolored Clique reduces to CCS-R on 4-degenerate graphs. The last reduction has the additional property that for an input (G, c, k) of Multicolored Clique the resulting instance of CCS-R admits either a reconfiguration sequence of length O(k3), or no reconfiguration sequence at all. Hence, we derive that both CDS-R and CCS-R are W[1]-hard parameterized by k + ' on 5-degenerate and 4-degenerate graphs, respectively. bounded VC-dimension W[1]-hard with parameter k + ' fpt with parameter k + ' bounded cliquewidth bounded treewidth bounded pathwidth nowhere dense bounded expansion excluded minor planar fpt with parameter k biclique-free degenerate excluded topological minor bounded degree Figure 2 The map of tractability for Connected Dominating Set Reconfiguration. The classes colored in dark green admit an fpt algorithm with parameter k, the classes colored in light green admit an FPT algorithm with parameter k + '. On the classes colored in red the problem is W[1]-hard with respect to the parameter k + '. The existence of a reconfiguration sequence of length at most ' with connected dominating sets of size at most k can be expressed by a first-order formula of length depending only on k and '. It follows from [12] that the problem is fixed-parameter tractable parameterized by k + ' on every nowhere dense graph class and the same is implied by [2] for every class of bounded cliquewidth. Nowhere dense graph classes are very general classes of uniformly sparse graphs, in particular the class of planar graphs is nowhere dense. Nowhere dense classes are themselves biclique-free, but are not necessarily degenerate. Hence, our hardness 4 Reconfiguration of Connected Dominating Set result on degenerate graphs essentially settles the question of fixed-parameter tractability for the parameter k + ' on sparse graph classes. It remains an interesting open problem to find dense graph classes beyond classes of bounded cliquewidth on which the problem is fixed-parameter tractable. We then turn our attention to the smaller parameter k alone. We show that CDS-R parameterized by k is fixed-parameter tractable on the class of planar graphs. Our approach is as follows. We first compute a small domination core for G, a set of vertices that captures exactly the domination properties of G for dominating sets of sizes not larger than k. The notion of a domination core was introduced in the study of the Distance-r Dominating Set problem on nowhere dense graph classes [3]. While the classification of interactions with the domination core would suffice to solve Dominating Set Reconfiguration on nowhere dense classes, additional difficulties arise for the connected variant. In a second step we use planarity to identify large subgraphs that have very simple interactions with the domination core and prove that they can be replaced by constant size gadgets such that the reconfiguration properties of G are preserved. Observe that CDS-R parameterized by k is trivially fixed-parameter tractable on every class of bounded degree. The existence of a connected dominating set of size k implies that the diameter of G is bounded by k + 2, which in every bounded degree class implies a bound on the size of the graph depending only on the degree and k. We conjecture that CDS-R is fixed-parameter tractable parameterized by k on every nowhere dense graph class. However, resolving this conjecture remains open for future work (see Figure 1). The rest of the paper is organized as follows. We give background on graph theory and fix our notation in Section 2. We show hardness of CDS-R on degenerate graphs in Section 3 and finally show how to handle the planar case in Section 4. Due to space constraints proofs of results marked with a ? are deferred to the appendix. 2 Preliminaries We denote the set of natural numbers by N. For n ∈ N, we let [n] = {1, 2, . . . , n}. We assume that each graph G is finite, simple, and undirected. We let V (G) and E(G) denote the vertex set and edge set of G, respectively. An edge between two vertices u and v in a graph is denoted by {u, v} or uv. The open neighborhood of a vertex v is denoted by NG(v) = {u {u, v} ∈ E(G)} and the closed neighborhood by NG[v] = NG(v) ∪ {v}. The degree of a vertex v, denoted dG(v), is NG(v). For a set of vertices S ⊆ V (G), we define NG(S) = {v 6∈ S {u, v} ∈ E(G), u ∈ S} and NG[S] = NG(S) ∪ S. The subgraph of G induced by S is denoted by G[S], where G[S] has vertex set S and edge set {{u, v} ∈ E(G) u, v ∈ S}. We let G − S = G[V (G) \ S]. A graph G is d-degenerate if every subgraph H ⊆ G has a vertex of degree at most d. For a set C, we use K[C] to denote the complete graph on vertex set C. For an integer r ∈ N, an r-independent set in a graph G is a subset U ⊆ V (G) such that for any two distinct vertices u, v ∈ U, the distance between u and v in G is more than r. An independent set in a graph is a 1-independent set. A subset of vertices U in G is called a separator in G if G− U is has more than one connected component. For s, t ∈ V (G), we say that a subset of vertices U in G is an (s, t)-separator in G if there is no path from s to t in G − U. D. Lokshtanov et al. 5 3 Hardness on degenerate graphs In this section we prove that CDS-R and CCS-R are W[1]-hard when parameterized by k + ' even on 5-degenerate and 4-degenerate graphs, respectively. Towards that, we first give a polynomial-time reduction from the W[1]-hard Multicolored Clique prob- lem to CCS-R on 4-degenerate graphs with the property that for an input (G, c, k) of Multicolored Clique the resulting instance of CCS-R admits either a reconfiguration sequence of length O(k3) or no reconfiguration sequence at all. As a result, we conclude that CCS-R is W[1]-hard when parameterized by k + ' on 4-degenerate graphs. Then, we give a parameter-preserving polynomial-time reduction from CCS-R to CDS-R. Let us first formally define the CCS problem. Colored Connected Subgraph (CCS) Input: A graph G, k ∈ N, and a vertex-coloring c: V (G) → C, where C ≤ k Question: Is there a vertex subset S ⊆ V (G) of at most k vertices with at least one vertex from every color class such that G[S] is connected? Parameter: k Reduction from Multicolored Clique to CCS-R. We now present the reduction from Multicolored Clique to CCS-R, which we believe to be of independent interest. We can assume, without loss of generality, that for an input (G, c, k) of Multicolored Clique, G is connected and c is a proper vertex-coloring, i.e., for any two distinct vertices u, v ∈ V (G) with c(u) = c(v) we have {u, v} /∈ E(G). Before we proceed let us define a graph operation. (cid:73) Definition 3.1. Let G be a graph and let c: V (G) → {1, . . . , k} be a proper vertex coloring of V (G). Let H be a graph on the vertex set {1, . . . , k}. We define the graph G (cid:22)c H as follows. We remove all edges {u, v} ∈ E(G) such that c(u) = i and c(v) = j and {i, j} 6∈ E(H). We subdivide every remaining edge, i.e. for every remaining edge {u, v} we introduce a new vertex suv, remove the edge {u, v} and introduce instead the two edges {u, suv} and {v, suv}. We write W(G (cid:22)c H) for the set of all subdivision vertices suv (see Figure 3). 1 2 3 • •u • •v • • • • 4 (a) A graph G and a proper coloring c: V (G) → {1, . . . , 4} • 1 • 3 • 2 • 4 suv = w1 w2 w3 • •u • • • • • •v • w5 • w4 • • • (b) A graph H on the vertex set {1, . . . , 4} (c) The graph G (cid:22)c H. Here, W (G (cid:22)c H) = {w1, . . . , w5} Figure 3 Construction of G (cid:22)c H. Let (G, c, k) be the input instance of Multicolored Clique, where G is a connected graph and c is a proper k-vertex-coloring of G. We construct an instance (H,bc: V (H) 7→ [k + 1], Qs, Qt, 2k) of CCS-R. 6 Reconfiguration of Connected Dominating Set H(1,1) • • • • • • • • • • • • • H(1,2) • • • • • • • • • H(1,3) • • • • • • • • • • • • • • • • • • • • Figure 4 Construction of H1 from the instance (G, c) depicted in Figure 3a. The red edges are some of the "crossing" edges but not all of them. We first construct a routing gadget. For 1 ≤ i ≤ k, let T i be the star with vertex set {1, . . . , k} having vertex i as the center. For any 1 ≤ i ≤ k and 1 ≤ r ≤ 20k, we let H(i,r) be a copy of the graph G (cid:22)c T i. We let c(i,r) be the the partial vertex-coloring of H(i,r) that is naturally inherited from G. For an illustration, consider the input instance (G, c, k) of Multicolored Clique depicted in Figure 3a. Then, T 2 is identical to the graph H in Figure 3b and Figure 3c represents H(2,r) = G (cid:22)c T 2, for any 1 ≤ r ≤ 20k. Now, for 1 ≤ i ≤ k we define a graph H i as follows. We use W(H(i,r)) to denote the set of subdivision vertices in H(i,r). For 1 ≤ r < 20k and all vertices u, v in V (H(i,r)) \ W(H(i,r)), we connect the copy of the subdivision vertex suv in H(i,r) (if it exists) with the copies of the vertices u and v in H(i,r+1) (see Figure 4 for an illustration of a portion of H1). We use W(H i) to denote the set of subdivision verticesS r∈[20k] W(H(i,r)). For each 1 ≤ i ≤ k, we use ci to denote a coloring on V (H i) that is a union of c(i,1), c(i,2), . . . , c(i,20k) and we color all the copies of the subdivision vertices using a new color k + 1. In other words, we know that for each u ∈ V (H i) we have u ∈ V (H(i,r)), for some r ∈ {1, . . . , 20k}. Hence, if u ∈ V (H(i,r)) \ W(H(i,r)) then we set ci(u) = c(i,r)(u). For all suv ∈ W(H i), we set ci(suv) = k + 1. Now, define a graph R, which is super graph of H1 ∪ . . . ∪ H k, as follows. For 1 ≤ i < k and all vertices u and v, we connect the copy of the subdivision vertex suv in H(i,20k) (if it exists) with the copies of the vertices u and v in H(i+1,1) (see Figure 5 for an illustration). We additionally introduce two subgraphs H0 and H k+1. The graph H0 is obtained by sub- dividing each edge of a star on vertex set {v1, . . . , vk} centered at v1. Here we use w2, . . . , wk to denote the subdivision vertices. Similarly, the graph H k+1 is obtained by subdividing each edge of star on {x1, . . . , xk} centered at xk. Here y1, . . . , yk−1 denote the subdivision vertices. Let c0 and ck+1 be the colorings on {v1, . . . , vk, w2, . . . , wk} and {x1, . . . , xk, y1, . . . , yk−1}, respectively, defined as follows. For all 1 ≤ i ≤ k, c0(vi) = i and ck+1(xi) = i. For all 2 ≤ i ≤ k, c0(wi) = k + 1 and for all 1 ≤ i ≤ k − 1, ck+1(yi) = k + 1. Observe that we may interpret H0 as K[{v1, . . . , vk}] (cid:22)c0 T 0 and H k+1 as K[{x1, . . . , xk}] (cid:22)ck+1 T k+1, where T 0 and T k+1 are two trees on vertex set {1, . . . , k}, with E(T 0) = {{1, i}: 2 ≤ i ≤ k} and E(T k+1) = {{k, i}: 1 ≤ i ≤ k − 1}. Finally, for each 2 ≤ i ≤ k, we connect the "subdivision vertex" wi (adjacent to v1 and vi) to all vertices v ∈ V (H(1,1)) colored 1 or i, i.e., with c(1,1)(v) ∈ {1, i}. For each subdivision vertex sab ∈ W(H(k,20k)), we connect sab to xk and xi, where k = ck(a) = c(k,20k)(a) and D. Lokshtanov et al. 7 H(2,20k) • • • • • • • • • • • • • H(3,1) • • • • • • • • • • • Figure 5 Illustration of the subgraph of R induced on V (H(2,20k)) ∪ V (H3,1) constructed from the instance (G, c, k) depicted in Figure 3a. The red edge are some of the "crossing edges". i = ck(b) = c(k,20k)(b). Recall that sab is adjacent a vertex of color k and a vertex of color i, for some i < k. This completes the construction of H (see Figure 6). We define bc: V (H) 7→ [k + 1] to be the union of c0, . . . , ck+1. • v1 • w2 • v2 • w3 • v3 • w4 • v4 H(1,1) • • • • • • • • • • • • • • H(4,20k) • • • • x1 • y1 • • • • • • • • • x2 • y2 • • x3 • y3 • x4 Figure 6 Illustration of connection between H0 and R, and H k+1 and R from the instance (G, c, k) depicted in Figure 3a. The red edge are some of the "crossing edges" between H0 and H1, and H k and H k+1. (cid:73) Observation 3.2. The sets {v1, . . . , vk, w2, . . . , wk} and {x1, . . . , xk, y1, . . . , yk−1} are solu- tions of size 2k − 1 of the CCS instance (H,bc, 2k). (H,bc, Qs, Qt, 2k) of the CCS-R problem. That is, the bound on the sizes of the solutions in We define the starting configuration Qs as the set {v1, . . . , vk, w2, . . . , wk} and the tar- get configuration Qt as the set {x1, . . . , xk, y1, . . . , yk−1}. We now consider the instance the reconfiguration sequence is at most 2k. Before we analyze the reconfiguration properties of H, let us verify that H is 4-degenerate. (cid:73) Lemma 3.3 (?). The graph H is 4-degenerate. (cid:73) Lemma 3.4 (?). if there exists a k-colored clique in G then there is reconfiguration sequence of length O(k3) from Qs to Qt in (H,bc, 2k). 8 Reconfiguration of Connected Dominating Set (j,r) i Proof sketch. We aim to shift the connected vertices of Qs through the subgraphs H1, . . . , H k (in that order) to maintain connectivity and eventually shift all the tokens to Qt. For each ui ∈ V (G), 1 ≤ j ≤ k and 1 ≤ r ≤ 20k, we use u to denote the copy of ui in H(j,r). Let C = {u1, . . . , uk} be a k-colored clique in G such that c(ui) = i, for all 1 ≤ i ≤ k. To prove the lemma, we need to define a reconfiguration sequence starting from Qs and ending at Qt such that the cardinality of any solution in the sequence is at most 2k. First we define k "colored" trees bT1, . . . ,bTk each on 2k − 1 vertices, and then prove that there are reconfiguration sequences from Qs to V (bT1), V (bTi) to V (bTi+1) for all 1 ≤ i < k, and V (bTk) We start by defining bT1, . . . ,bTk. For each 1 ≤ i ≤ k, Ci = {u to Qt. } and Si = {z ∈ V (H(i,1)): NH(i,1)(z) ∩ Ci = 2}. That is, for each 1 ≤ j ≤ k and j 6= i, is in Si), and Si = k − 1. In su other words, Ci contains the copies of the vertices of the clique C in H(i,1) and Si contains subdivision vertices corresponding to k − 1 edges in the clique incident on the ith colored vertex of the clique, such that H[Ci ∪ Si] is a tree. Now, define bTi = H[Ci ∪ Si]. It is easy to verify thatbc(Ci ∪ Si) = {1, . . . , k + 1} and hence Ci ∪ Si = V (bTi) is a solution to the CCS instance (H,bc, 2k). Let Ts = H[Qs] and Tt = H[Qt]. Note that Ts and Tt are trees on 2k − 1 Case 1: Reconfiguration from Qs to V (bT1). Informally, we move to bT1 by adding a ∈ Si (the subdivision vertex on the edge u vertices. (i,1) u j (i,1) k , . . . , u (i,1) i (i,1) 1 (i,1) u j (i,1) i (1,1) i (i,r) 1 , . . . , u (i,r) u j i = {u (i,r) k (i,r) i token on u and then removing tokens from vi for i in the order 2, . . . , k, 1 (for a total of 2k token additions/removals). Finally, we move the tokens from {w2, . . . , wk−1} to S1 in 2(k − 1) steps. The length of the reconfiguration sequence is 2k + 2(k − 1) = 4k − 2. Case 2: Reconfiguration from V (bTi) to V (bTi+1). First we define 20k trees P1, . . . P20k, each on 2k − 1 vertices such that for all 1 ≤ r ≤ 20k, (i) V (Pr) ⊆ V (H(i,r)), and (ii) bTi = P1. reconfiguration sequence from V (P20k) to V (bTi+1). Then we give a reconfiguration sequence from V (Pr) to V (Pr+1) for all r ∈ [20k − 1] and a Recall that C = {u1, . . . , uk} is a k-colored clique in G such that c(ui) = i for all 1 ≤ i ≤ k. For 1 ≤ r ≤ 20k, let C r i = 2}. i = {z ∈ V (H(i,r)): NH(i,r)(z) ∩ C r That is, for each 1 ≤ j ≤ k and j 6= i, su i (i.e, the subdivision vertex on the edge i ]. Notice that for all r ∈ [20k], Pr i ∪ Sr (i,r) u instance (H,bc, 2k). By arguments similar to those given for Case 1, one can prove that there i is a tree on 2k − 1 vertices. Moreover, for each 1 ≤ r ≤ 20k, V (Pr) is a solution to the CCS For the reconfiguration sequence from V (P20k) to V (bTi+1) we refer the reader to the is a reconfiguration sequence of length 4k − 2 from V (Pr) to V (Pr+1), for all 1 ≤ r < 20k. Case 3: Reconfiguration from V (bTk) to V (Tt). The arguments for this case are similar } and Sr ∈ Sr i = k − 1. Let Pr = H[C r complete proof in the appendix. (cid:74) to those given in Case 1, we therefore omit the details. (cid:73) Lemma 3.5 (?). If there is a reconfiguration sequence from Qs to Qt then there is a k-colored clique in G. (cid:73) Theorem 3.6. CCS-R parameterized by k + ' is W[1]-hard on 4-degenerate graphs. i ) and Sr is in Sr (i,r) u j Reduction from CCS-R to CDS-R. We give a polynomial-time parameter-preserving reduction from CCS-R to CDS-R that is fairly straightforward. Let (G, c, S, T, k) be an instance of CCS-R. Let c: V (G) 7→ {1, . . . , k0}, where k0 ≤ k. We construct a graph H as follows. For each 1 ≤ i ≤ k0, we add a vertex di and connect di to all the vertices in c−1(i). D. Lokshtanov et al. 9 Next, for each 1 ≤ i ≤ k0, we add 2k + 1 pendent vertices to di. That is, we add vertices {xi,j : 1 ≤ i ≤ k0, 1 ≤ j ≤ 2k + 1} and edges {{xi,j, di}: 1 ≤ i ≤ k0, 1 ≤ j ≤ 2k + 1}. Let D = {d1, . . . , dk0}. We output (H, S ∪ D, T ∪ D, k + k0) as the new CDS-R instance. (cid:73) Lemma 3.7. If G is a d-degenerate graph then H is a (d + 1)-degenerate graph. Proof. For each vertex v ∈ V (G), dH(v) = dG(v) + 1. Thus, after removing V (G) and {xi,j : 1 ≤ i ≤ k0, 1 ≤ j ≤ 2k + 1}, the remaining graph is edgeless. (cid:74) It is easy to verify that for any reconfiguration sequence S = S1, . . . , S' = T of (G, c, S, T, k), S ∪ D = S1 ∪ D, . . . , S' ∪ D = T ∪ D is a reconfiguration sequence of (H, S ∪ D, T ∪ D, k + k0). Now we prove the reverse direction. (cid:73) Lemma 3.8. If (H, S∪D, T ∪D, k+k0) is a yes-instance then (G, c, S, T, k) is a yes-instance. Proof. Let Z be a dominating set in H of size at most k + k0. Then D ⊆ H. Moreover for any minimal connected dominating set Z in H, Z ∩ {xi,j : 1 ≤ i ≤ k0, 1 ≤ j ≤ 2k + 1} = ∅, H[Z \ D] is connected, and Z \ D contains a vertex from c−1(i) for all 1 ≤ i ≤ k0 (recall that G is a subgraph of H). Therefore, by deleting D from each set in a reconfiguration sequence of (H, S ∪ D, T ∪ D, k + k0), we get a valid reconfiguration sequence of (G, c, S, T, k). (cid:74) This completes the proof. Thus, by Theorem 3.6, we have the following theorem. (cid:73) Theorem 3.9. CDS-R parameterized by k + ' is W[1]-hard on 5-degenerate graphs. Fixed-parameter tractability on planar graphs 4 This section is devoted to proving that CDS-R under TAR parameterized by k is fixed- parameter tractable on planar graphs. In fact, we show that the problem admits a polynomial kernel. Recall that a kernel for a parameterized problem Q is a polynomial-time algorithm that computes for each instance (I, k) of Q an equivalent instance (I0, k0) with I0+ k0 ≤ f(k) for some computable function f. The kernel is polynomial if the function f is polynomial. We prove that for every instance (G, S, T, k) of CDS-R, with G planar, we can compute in polynomial time an instance (G0, S, T, k) where V (G0) ≤ p(k) for some polynomial p, G0 planar, and where there exists a reconfiguration sequence under TAR from S to T in G (using at most k tokens) if and only if such a sequence exists in G0. Our approach is as follows. We first compute a small domination core for G, that is, a set of vertices that captures exactly the domination properties of G for dominating sets of sizes not larger than k. While the classification of interactions with the domination core would suffice to solve Dominating Set Reconfiguration, additional difficulties arise for the connected variant. In a second step we use planarity to identify large subgraphs that have very simple interactions with the domination core and prove that they can be replaced by constant size gadgets such that the reconfiguration properties of G are preserved. 4.1 Domination cores (cid:73) Definition 4.1. Let G be a graph and let k ≥ 1 be an integer. A k-domination core is a subset C ⊆ V (G) of vertices such that every set X ⊆ V (G) of size at most k that dominates C also dominates G. 10 Reconfiguration of Connected Dominating Set It is not difficult to see that Dominating Set is fixed-parameter tractable on all graphs that admit a k-domination core of size at most f(k) that is computable in time g(k) · nc, for any computable functions f, g and constant c. This approach was first used (implicitly) in [3] to solve Distance-r Dominating Set on nowhere dense graph classes. In case k is the size of a minimum (distance-r) dominating set, one can establish the existence of a linear size k-domination core on classes of bounded expansion [5] (including the class of planar graphs) and a polynomial size (in fact an almost linear size) k-domination core on nowhere dense graph classes [7,19]. If k is not minimum, there exist classes of bounded expansion such that a k-domination core must have at least quadratic size [6]. The most general graph classes that admit k-domination cores are given in [8]. Moreover, Dominating Set Reconfiguration and Distance-r Dominating Set Reconfiguration are fixed-parameter tractable on all graphs that admit small (distance-r) k-domination cores [20,28]. (cid:73) Lemma 4.2. There exists a polynomial p such that for all k ≥ 1, every planar graph G admits a polynomial-time computable k-domination core of size at most p(k). The lemma is implied by Theorem 1.6 of [19] by the fact that planar graphs are nowhere dense. We want to stress again that the polynomial size of the k-domination core results from the fact that k may not be the size of a minimum dominating set, if k is minimum we can find a linear size core. Explicit bounds on the degree of the polynomial can be derived from [25,27], but we refrain from doing so to not disturb the flow of ideas. The following lemma is immediate from the definition of a k-domination core. (cid:73) Lemma 4.3. If D is a dominating set of size at most k that contains a vertex set W ⊂ D such that N[D] ∩ C = N[D \ W] ∩ C = C, then D \ W is also a dominating set. (cid:73) Definition 4.4. Let G be a graph and let A ⊆ V (G). The projection of a vertex v ∈ V (G)\A into A is the set N(v) ∩ A. If two vertices u, v have the same projection into A we write u ∼A v. Obviously, the relation ∼A is an equivalence relation. The following lemma is folklore, one possible reference is [9]. (cid:73) Lemma 4.5. Let G be a planar graph and let A ⊆ V (G). Then there exists a constant c such that there are at most c·A different projections to A, that is, the equivalence relation ∼A has at most c · A equivalence classes. 4.2 Reduction rules Let G be an embedded planar graph. We say that a vertex v touches a face f if v is drawn inside f or belongs to the boundary of f or is adjacent to a vertex on the boundary of f. We fix two connected dominating sets S and T of size at most k. We will present a sequence of lemmas, each of which implies a polynomial-time computable reduction rule that allows to transform G to a planar graph G0 that inherits its embedding from G, with S, T ⊆ V (G0) and that has the same reconfiguration properties with respect to S and T as G. To not overload notation, after stating a lemma with a reduction rule, we assume that the reduction rule is applied until this is no longer possible and call the resulting graph again G. We also assume that whenever one or more of our reduction rules are applicable, then they are applied in the order presented. We will guarantee that S and T will always be connected dominating sets of size at most k, hence, after each application of a reduction rule, we can recompute a k-domination core in polynomial time. This yields only polynomial overhead D. Lokshtanov et al. 11 and allows us to assume that we always have marked a k-domination core C of size at most p := p(k) as described in Lemma 4.2. This allows us to state the lemmas as if G and C were fixed. Without loss of generality we assume that C contains S and T. (cid:73) Definition 4.6. A set W ⊆ V (G) \ C of vertices is irrelevant if there is a reconfiguration sequence from S to T in G if and only if there is a reconfiguration sequence from S to T in G − W. (cid:73) Definition 4.7. Let u, v ∈ V (G) be non-equal vertices. We call the set D(u, v) := (N(u)∩ N(v))∪{u, v} the diamond induced by u and v. We call N(u)∩ N(v) the thickness of D(u, v). (cid:73) Lemma 4.8. If G contains a diamond D(u, v) of thickness greater than 3k, then at least one of u or v must be pebbled in every reconfiguration sequence from S to T. Proof. Assume S = S1, . . . , St = T is a reconfiguration sequence from S to T and u, v 6∈ Si for some 1 ≤ i ≤ t. Then every s ∈ Si can dominate at most 3 vertices of N(u) ∩ N(v): otherwise u, v, s together with 3 vertices of N(u)∩ N(v) different from u, v and s would form (cid:74) a complete bipartite graph K3,3. • • •v • s •u • • Figure 7 A vertex s ∈ Si can dominate at most 3 vertices of N(u) ∩ N(v). (cid:73) Lemma 4.9. If G contains a diamond D(u, v) of thickness greater than 3k, then we can remove all internal edges in D(u, v), i.e., edges with both endpoints in N(u) ∩ N(v). Proof. Assume S = S1, . . . , St = T is a reconfiguration sequence from S to T. According to Lemma 4.8, for each 1 ≤ i ≤ t, Si ∩ {u, v} 6= ∅. Hence all vertices of N(u) ∩ N(v) are always dominated by at least one of u or v, say by u. Moreover, pebbling more than one vertex of N(u) ∩ N(v) will never create connectivity via internal edges that is not already there via edges incident on u. In other words, for any connected dominating set S of G, if an edge yz is used for connectivity, where y, z ∈ N(u) ∩ N(v), then this edge can be replaced by either (cid:74) the path yuz or the path yvz (depending on which of u or v is in S). As described earlier, we now apply the reduction rule of Lemma 4.9 until this is no longer possible, and name the resulting graph again G. As we did not make use of the properties of a k-domination core in the lemma, it is sufficient to recompute a k-domination core C after applying the reduction rule exhaustively. In the following it may be necessary to recompute it after each application of a reduction rule. We will not mention these steps explicitly anymore in the following. (cid:73) Lemma 4.10 (?). If G contains a diamond D(u, v) of thickness greater than 4C + 3k + 1 then G contains an irrelevant vertex. We may in the following assume that G does not contain diamonds of thickness greater than 4C + 3k + 1. 12 Reconfiguration of Connected Dominating Set (cid:73) Corollary 4.11. If a vertex v ∈ V (G) has degree greater than (4C + 3k + 1) · k, then the token on v is never lifted throughout a reconfiguration sequence. Proof. Assume S = S1, . . . , St = T is a reconfiguration sequence from S to T in G and assume there is Si with v 6∈ Si. The dominating set Si has at most k vertices and must dominate N(v). Hence, there must be one vertex u ∈ Si that dominates at least a 1/k fraction of N(v), which is larger than 4C + 3k + 1. Then there is a diamond D(u, v) of thickness greater than 4C + 3k + 1, which does not exist after application of the reduction (cid:74) rule of Lemma 4.10. According to Corollary 4.11, the only vertices that can have high degree after applying the reduction rules are vertices that are never lifted throughout a reconfiguration sequence. This gives rise to another reduction rule that is similar to the rule of Lemma 4.9. (cid:73) Lemma 4.12. Assume v is a vertex of degree greater than (4C + 3k + 1) · k. Then we may remove all edges with both endpoints in N(v). Proof. Let G0 be the graph obtained from G by removing all edges with both endpoints in N(v). We claim that reconfiguration between S and T is possible in G if and only if it is possible in G0. The fact that S and T are in fact connected dominating sets in G0 is implied by the argument below. Assume S = S1, . . . , St = T is a reconfiguration sequence from S to T in G. We claim that the same sequence is a reconfiguration sequence in G0. According to Corollary 4.11, v ∈ Si for all 1 ≤ i ≤ t. This implies that Si is connected in G0 for all 1 ≤ i ≤ t, as all x, y ∈ Si that are no longer connected by an edge in G0 but were connected in G are connected via a path of length 2 using the vertex v. It is also easy to see that Si is a dominating set in G0, as all vertices that are no longer dominated by s ∈ Si in G are still dominated by v. Observe that this in particular implies that S and T are connected dominating sets in G0. Vice versa, if S = S1, . . . , St = T is a reconfiguration sequence from S to T in G0, this is trivially also a (cid:74) reconfiguration sequence in G. The following reduction rule is obvious. (cid:73) Lemma 4.13. If a vertex v has more than k + 1 pendant neighbours, i.e., neighbors of degree exactly one, then it suffices to retain exactly k + 1 of them in the graph. (cid:73) Lemma 4.14. There are at most cC · (4C + 3k + 1) vertices of V (G) \ C that have 2 neighbours in C, where c is the constant of Lemma 4.5. Proof. According to Lemma 4.5 there are at most cC different projections to C. Each projection class that has at least 3 representatives has size at most 2, as otherwise we would find a K3,3 as a subgraph, contradicting the planarity of G. Consider a class with a projection of size 2 into C. Denote these two vertices of C by u and v. If this class has more than 4C+3k+1 representatives, then D(u, v) is a diamond of thickness greater than 4C+3k+1, which cannot not exist after exhaustive application of the reduction rule of Lemma 4.10. (cid:74) We now come to the description of our final reduction rule. Let D denote the set of vertices containing both C and all vertices of V (G) \ C having at least two neighbors in C. In other words, D contains all those vertices in V (G) \ C that have exactly one neighbor in C. According to Lemma 4.14 at most cC · (4C + 3k + 1) vertices have two neighbors in C, hence D ≤ cC · (4C + 3k + 1) + C =: p. D. Lokshtanov et al. 13 (cid:73) Lemma 4.15 (?). Assume there are two vertices u and v with degree greater than 4p + (4C + 3k + 1) · k + 1. Let P be a maximum set of vertex-disjoint paths of length at least 2 that run between u and v using only vertices in V (G)\ D. If P > 4p + (4C + 3k + 1)· k + 1, then there is G0 such that the instances (G, S, T, k) and (G0, S, T, k) are equivalent, G0 is planar, and V (G0) < V (G). We are ready to state the final result. (cid:73) Theorem 4.16. CDS-R under TAR parameterized by k admits a polynomial kernel on planar graphs. Proof. Our kernelization algorithm starts by computing (in polynomial time) a k-domination core C of size at most p := p(k) as described in Lemma 4.2. Without loss of generality we assume that C contains S and T. After each application of a reduction rule, we recompute the core, giving a polynomial blow-up of the running time. We are left to prove that each reduction rule can be implemented in polynomial time and that we end up with a polynomial number of vertices. It is clear that the reduction rules of Lemma 4.10, Lemma 4.12 and Lemma 4.13 can easily be implemented in polynomial time. The reduction rule of Lemma 4.15 is slightly more involved, however, we can use a standard maximum-flow algorithm to compute in polynomial time a maximum set of vertex-disjoint paths in a subgraph of G. It remains to bound the size of G. Recall that we call D the set of all vertices C and of all vertices of V (G) \ C that have at least 2 neighbors in C. It follows from Lemma 4.14 that D has size at most cC· (4C + 3k + 1) +C =: p, where c is the constant of Lemma 4.5. We are left to bound the number of vertices in V (G) \ C having exactly one neighbour in C (recall that each vertex in V (G) \ C has at least one neighbour in S ∪ T ⊆ C). Let p0 = (4p + (4C + 3k + 1)· k + 1)· (4C + 3k + 1)· k + k + 1, which is still a polynomial in k. Towards a contradiction, assume that there exists an equivalence class Q in ∼C with a projection of size one containing more than p0 vertices. Let u ∈ C denote the projection of the aforementioned class. Due to Lemma 4.13, we know that at most k + 1 of the vertices in Q are pendant, i.e., adjacent to only u in G. Since we cannot apply the reduction rule of Lemma 4.12 any more, we know that there are no edges with both endpoints in Q. Hence, all but k + 1 vertices of Q must be adjacent to at least one other vertex in V (G) \ C. Let R = NG(Q) \ {u} denote this set of neighbours. No vertex in R can be adjacent to more than 4C + 3k + 1 vertices of Q, as we cannot apply the reduction rule of Lemma 4.10. The vertices of R must be dominated by S, and cannot be dominated by u, as otherwise two neighbours of u would be connected. Hence, there is v ∈ S different from u that dominates at least a 1/k fraction of R. This implies the existence of at least 4p + (4C + 3k + 1) · k + 1 vertex-disjoint paths of length at least 2 that run between u and v. But in this case, the reduction rule of Lemma 4.15 is applicable. Therefore, we conclude that Q cannot exist, obtaining a bound on the size of all equivalence classes of ∼C, as needed. (cid:74) References Luis Cereceda, Jan van den Heuvel, and Matthew Johnson. Connectedness of the graph of vertex-colourings. Discrete Mathematics, 308(56):913 -- 919, 2008. 1 2 Bruno Courcelle, Johann A Makowsky, and Udi Rotics. Linear time solvable optimization problems on graphs of bounded clique-width. Theory of Computing Systems, 33(2):125 -- 150, 2000. 14 Reconfiguration of Connected Dominating Set 6 4 5 3 Anuj Dawar and Stephan Kreutzer. Domination problems in nowhere-dense classes. In IARCS Annual Conference on Foundations of Software Technology and Theoretical Com- puter Science, FSTTCS 2009, pages 157 -- 168, 2009. Erik D. Demaine and Joseph O'Rourke. Geometric folding algorithms - linkages, origami, polyhedra. Cambridge University Press, 2007. Pål Grønås Drange, Markus Sortland Dregi, Fedor V. Fomin, Stephan Kreutzer, Daniel Lokshtanov, Marcin Pilipczuk, Michal Pilipczuk, Felix Reidl, Fernando Sánchez Villaamil, Saket Saurabh, Sebastian Siebertz, and Somnath Sikdar. Kernelization and sparseness: the case of dominating set. In 33rd Symposium on Theoretical Aspects of Computer Science, STACS 2016, pages 31:1 -- 31:14, 2016. Eduard Eiben, Mithilesh Kumar, Amer E. Mouawad, Fahad Panolan, and Sebastian Siebertz. Lossy kernels for connected dominating set on sparse graphs. In 35th Symposium on Theoretical Aspects of Computer Science, STACS 2018, pages 29:1 -- 29:15, 2018. 7 Kord Eickmeyer, Archontia C. Giannopoulou, Stephan Kreutzer, O-joung Kwon, Michal Pilipczuk, Roman Rabinovich, and Sebastian Siebertz. Neighborhood complexity and ker- nelization for nowhere dense classes of graphs. In 44th International Colloquium on Auto- mata, Languages, and Programming, ICALP 2017, pages 63:1 -- 63:14, 2017. 8 Grzegorz Fabianski, Michal Pilipczuk, Sebastian Siebertz, and Szymon Toruńczyk. Pro- gressive algorithms for domination and independence. In 36th International Symposium on Theoretical Aspects of Computer Science, STACS 2019, pages 27:1 -- 27:16, 2019. Jakub Gajarský, Petr Hlinený, Jan Obdrzálek, Sebastian Ordyniak, Felix Reidl, Peter Ross- manith, Fernando Sánchez Villaamil, and Somnath Sikdar. Kernelization using structural parameters on sparse graph classes. J. Comput. Syst. Sci., 84:219 -- 242, 2017. Sevag Gharibian and Jamie Sikora. Ground state connectivity of local hamiltonians. In Pro- ceedings of the 42nd International Colloquium on Automata, Languages, and Programming, ICALP 2015, pages 617 -- 628, 2015. Parikshit Gopalan, Phokion G. Kolaitis, Elitza N. Maneva, and Christos H. Papadimitriou. The connectivity of Boolean satisfiability: computational and structural dichotomies. SIAM Journal on Computing, 38(6):2330 -- 2355, 2009. 9 10 11 12 Martin Grohe, Stephan Kreutzer, and Sebastian Siebertz. Deciding first-order properties of nowhere dense graphs. Journal of the ACM (JACM), 64(3):17, 2017. 13 Ruth Haas and Karen Seyffarth. The k-dominating graph. Graphs and Combinatorics, 30(3):609 -- 617, 2014. 14 Takehiro Ito, Erik D. Demaine, Nicholas J. A. Harvey, Christos H. Papadimitriou, Martha Sideri, Ryuhei Uehara, and Yushi Uno. On the complexity of reconfiguration problems. Theoretical Computer Science, 412(12-14):1054 -- 1065, 2011. 15 Takehiro Ito, Marcin Kamiński, and Erik D. Demaine. Reconfiguration of list edge-colorings in a graph. Discrete Applied Mathematics, 160(15):2199 -- 2207, 2012. 17 16 Wm. Woolsey Johnson and William E. Story. Notes on the "15" puzzle. American Journal of Mathematics, 2(4):397 -- 404, 1879. Iyad A. Kanj and Ge Xia. Flip distance is in FPT time o(n+ k * ck). In 32nd International Symposium on Theoretical Aspects of Computer Science, STACS 2015, pages 500 -- 512, 2015. 18 Graham Kendall, Andrew J. Parkes, and Kristian Spoerer. A survey of NP-complete puzzles. ICGA Journal, pages 13 -- 34, 2008. Stephan Kreutzer, Roman Rabinovich, and Sebastian Siebertz. Polynomial kernels and wideness properties of nowhere dense graph classes. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, pages 1533 -- 1545, 2017. 20 Daniel Lokshtanov, Amer E. Mouawad, Fahad Panolan, M. S. Ramanujan, and Saket Saurabh. Reconfiguration on sparse graphs. J. Comput. Syst. Sci., 95:122 -- 131, 2018. 19 D. Lokshtanov et al. 15 21 Anna Lubiw and Vinayak Pathak. Flip distance between two triangulations of a point set is NP-complete. Comput. Geom., 49:17 -- 23, 2015. 22 Amer E. Mouawad. On reconfiguration problems: Structure and tractability. 2015. 23 Amer E. Mouawad, Naomi Nishimura, Vinayak Pathak, and Venkatesh Raman. Shortest reconfiguration paths in the solution space of boolean formulas. In Automata, Languages, and Programming - 42nd International Colloquium, ICALP 2015, Kyoto, Japan, July 6-10, 2015, Proceedings, Part I, pages 985 -- 996, 2015. 24 Amer E. Mouawad, Naomi Nishimura, Venkatesh Raman, Narges Simjour, and Akira Suzuki. On the parameterized complexity of reconfiguration problems. Algorithmica, 78(1):274 -- 297, 2017. 25 Wojciech Nadara, Marcin Pilipczuk, Roman Rabinovich, Felix Reidl, and Sebastian Siebertz. Empirical evaluation of approximation algorithms for generalized graph coloring and uniform quasi-wideness. In 17th International Symposium on Experimental Algorithms, SEA 2018, pages 14:1 -- 14:16, 2018. 26 Naomi Nishimura. Introduction to reconfiguration. Algorithms, 11(4):52, 2018. 27 Michał Pilipczuk, Sebastian Siebertz, and Szymon Toruńczyk. On the number of types in sparse graphs. In Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, pages 799 -- 808. ACM, 2018. Sebastian Siebertz. Reconfiguration on nowhere dense graph classes. Electr. J. Comb., 25(3):P3.24, 2018. 29 Akira Suzuki, Amer E. Mouawad, and Naomi Nishimura. Reconfiguration of dominating 28 30 sets. Journal of Combinatorial Optimization, 32(4):1182 -- 1195, 2016. Jan van den Heuvel. The complexity of change. Surveys in combinatorics, 409(2013):127 -- 160, 2013. 16 Reconfiguration of Connected Dominating Set i+1 = T 0 0, T 0 i + fi − ei and T 0 i is a tree, for all i ∈ [k − 1], and T 0 A Details omitted from Section 3 We need the following lemma to prove Lemma 3.4. (cid:73) Lemma A.1. Let T1, T2 be two trees on vertex set {1, . . . , k} and let f1, . . . fk−1 be an ordering of the edges in T2. Then, in polynomial time, we can find an ordering e1, . . . , ek−1 of the edges in T1 such that the following holds. In the sequence of graphs T 0 1, . . . , T 0 k−1 on vertex set {1, . . . , k}, where for each 0 ≤ i ≤ k − 2, T 0 0 = T1, we have that T 0 k−1 = T2. Proof. We proceed by induction on ' = E(T1) \ E(T2). In the base case, we have ' = 0 and E(T1) = E(T2). In this case f1, . . . fk−1 is also the required ordering of the edges in T1 (note that the sequence of graphs consists of only T1 = T2 in this case). Now consider the induction step, ' > 1. Let j be the first index in {1, . . . , k − 1} such that fj /∈ E(T1). We add fj to T1 and this creates a cycle in T1. Hence, there exists an 1 = T1 + fj − ej is a edge ej ∈ E(T1) \ E(T2) whose removal results in a tree. That is, T 0 tree. Notice that E(T 0 1) \ E(T2) = ' − 1. By the induction hypothesis, there is a sequence 1 , . . . , T 00 g1, . . . , gk−1 of edges in E(T 0 1) such that for the sequence of graphs T 0 1 = T 00 0 , T 00 k−1 on vertex set {1, . . . , k}, we have T 00 is a tree, and T2 = T 00 k−1, 1 = T1 + fj − ej, 0 ≤ i < k. Since j is the first index in {1, . . . , k − 1} such that fj /∈ E(T1), T 0 k−1 are trees, we have that gi = fi for all i < j. Notice that fj ∈ E(T 0 and T 00 1 , . . . , T 00 1) 1) \ {fj}) ∪ {ej}. and E(T1) = (E(T 0 We claim that e1, . . . , ej−1, ej, ej+1, . . . , ek−1, where ei = gi for all i < j, is the required k−1 be the sequence where, for each 0 ≤ i ≤ 0, T 0 sequence of edges in T1. Let T 0 1, . . . , T 0 i + fi − ei and T 0 k − 2, T 0 0 = T1. Since gi = fi = ei for all i < j, we have j = T1 + {f1, . . . , fj} − {e1, . . . , ej} = j−1. Moreover, T 0 that T1 = T 0 1 = . . . = T 0 T1 + {f1, . . . , fj} − {g1, . . . , gj} = T 00 1) \ {fj}) ∪ {ej} and ei = gi j because E(T1) = (E(T 0 for all i < j. Then, the sequence T 0 j , . . . , T 00 j, . . . , T 0 k−1. Therefore, the sequence e1, . . . , ej−1, ej, ej+1, . . . , ek−1 of edges in T1 satisfies the conditions (cid:74) of the lemma. k−1 is the same as the sequence T 00 i+1 = T 0 i+1 = T 00 i + fi − gi, each T 00 i 0 , T 00 0 = T 0 Proof of Lemma 3.3 Proof. We iteratively remove minimum degree vertices and show that we can always remove a vertex of degree at most 4 in each step. Every subdivision vertex w ∈ W(H i) for 1 ≤ i ≤ k has degree at most 4; it has 4 neighbors in V (H i) ∪ V (H i+1). After removal of all subdivision vertices the degree of the remaining vertices of each H i is at most one. That is, a vertex in H(1,1) may have a neighbor in {w2, . . . , wk}. After the removal of V (H1) ∪ . . . V (H k), the degree of all vertices except v1 and xk is at most 2. (cid:74) Finally we remove v1 and xk. Proof of Lemma 3.4 Proof. We aim to shift the connected vertices of Qs through the subgraphs H1, . . . , H k (in that order) to maintain connectivity and eventually shift to Qt. For each ui ∈ V (G), 1 ≤ j ≤ k and 1 ≤ r ≤ 20k, we use u Let C = {u1, . . . , uk} be a k-colored clique in G such that c(ui) = i, for all 1 ≤ i ≤ k. To prove the lemma, we need to define a reconfiguration sequence starting from Qs and to denote the copy of ui in H(j,r). (j,r) i D. Lokshtanov et al. 17 (i,1) i (i,1) u j (i,1) 1 (i,1) i , . . . , u (i,1) k ∈ Si (the subdivision vertex on the edge u ending at Qt such that the cardinality of any solution in the sequence is at most 2k. First we define k "colored" trees bT1, . . . ,bTk each on 2k − 1 vertices, and then prove that there are reconfiguration sequences from Qs to V (bT1), V (bTi) to V (bTi+1) for all 1 ≤ i < k, and V (bTk) We start by defining bT1, . . . ,bTk. For each 1 ≤ i ≤ k, Ci = {u to Qt. } and Si = {z ∈ V (H(i,1)): NH(i,1)(z) ∩ Ci = 2}. That is, for each 1 ≤ j ≤ k and j 6= i, is in Si), and Si = k − 1. In su other words, Ci contains the copies of the vertices of the clique C in H(i,1) and Si contains subdivision vertices corresponding to k − 1 edges in the clique incident on the ith colored vertex of the clique, such that H[Ci ∪ Si] is a tree. Now, define bTi = H[Ci ∪ Si]. It is easy to verify thatbc(Ci ∪ Si) = {1, . . . , k + 1} and hence Ci ∪ Si = V (bTi) is a solution to the CCS instance (H,bc, 2k). Let Ts = H[Qs] and Tt = H[Qt]. Note that Ts and Tt are trees on 2k − 1 Case 1: Reconfiguration from Qs to V (bT1). Informally, we move to bT1 by adding a token on u and then removing tokens from vi for i in the order 2, . . . , k, 1 (for a total of 2k token additions/removals). Finally, we move the tokens from {w2, . . . , wk−1} to S1 in 2(k − 1) steps. The length of the reconfiguration sequence is 2k + 2(k − 1) = 4k − 2. j+1 } and (1,1) Z2j = Z2j−1 \ {vj+1}. That is, for each 1 ≤ j ≤ k − 1, Formally, we define Z0 = Qs and for each 1 ≤ j ≤ k − 1, Z2j−1 = Z2j−2 ∪ {u vertices each. (i,1) u j (1,1) i Z2j−1 = {u (1,1) 2 Z2j = {u (1,1) 2 , . . . , u , . . . , u j+1 } ∪ {vj+1 . . . , vk, v1} ∪ {w1, . . . , wk−1}, and (1,1) j+1 } ∪ {vj+2 . . . , vk, v1} ∪ {w1, . . . , wk−1}. (1,1) Next, we define Z2k−1 and Z2k as (1,1) k (1,1) k Z2k−1 = {u (1,1) 2 Z2k = {u (1,1) 2 , . . . , u (1,1) , u 1 (1,1) , u 1 } ∪ {v1} ∪ {w1, . . . , wk−1}, and } ∪ {w1, . . . , wk−1}. (1,1) 1 (1,1) u j , . . . , u , for all 2 ≤ j ≤ k. we now have a reconfiguration sequence Z0, Z1, . . . , Z2k, where Z0 = Qs. It is easy to verify that Z1, . . . Z2k are solutions to the CCS instance (H,bc, 2k). Thus, Next, we explain how to get a reconfiguration sequence from Z2k to V (bT1). Recall that Z2k = C1 ∪ {w1, . . . , wk−1} and V (bT1) = C1 ∪ S1. Let sj = su Notice that S1 = {s2, . . . , sk}. To obtain a reconfiguration sequence from Z2k to V (bT1), we Therefore, there exists a reconfiguration sequence of length 4k − 2 from Qs to V (bT1). Case 2: Reconfiguration from V (bTi) to V (bTi+1). First we define 20k trees P1, . . . P20k, each on 2k − 1 vertices such that for all 1 ≤ r ≤ 20k, (i) V (Pr) ⊆ V (H(i,r)), and (ii) bTi = P1. reconfiguration sequence from V (P20k) to V (bTi+1). add sj and then remove wj for j in the order 2, . . . , k. Since wj and sj connect the same two vertices from C1, this reconfiguration sequence will maintain connectivity. Moreover, it is easy to verify that each set in the reconfiguration sequence uses all the colors {1, . . . , k}. Then we give a reconfiguration sequence from V (Pr) to V (Pr+1) for all r ∈ [20k − 1] and a Recall that C = {u1, . . . , uk} is a k-colored clique in G such that c(ui) = i for all 1 ≤ i ≤ k. } and Sr i = {z ∈ V (H(i,r)): NH(i,r)(z)∩C r For each 1 ≤ r ≤ 20k, let C r i = 2}. That is, for each 1 ≤ j ≤ k and j 6= i, su ∈ Sr i (i.e, the subdivision vertex on the i ]. Notice that for all r ∈ [20k], i ∪ Sr i = k − 1. Let Pr = H[C r edge u CCS instance (H,bc, 2k). Pr is a tree on 2k − 1 vertices. Moreover, for each 1 ≤ r ≤ 20k, V (Pr) is a solution to the i = {u (i,r) 1 i ) and Sr is in Sr (i,r) u j , . . . , u (i,r) k (i,r) i (i,r) i (i,r) u j 18 Reconfiguration of Connected Dominating Set (i,r) i u j and s0 j = su i = {sj : j ∈ {1, . . . , k} \ {i}} and Sr+1 Case 2(a): Reconfiguration from V (Pr) to V (Pr+1). By arguments similar to those given for Case 1, one can prove that there is a reconfiguration sequence of length 4k − 2 from V (Pr) to V (Pr+1), for all 1 ≤ r < 20k. For completeness we give the details here. Fix an for all j ∈ {1, . . . , k} \ {i}. integer 1 ≤ r < 20k. Let sj = sui,r j : j ∈ {1, . . . , k} \ {i}}. Now we Notice that Sr } and define Z0 = V (Pr) = C r Z2j = Z2j−1 \ {u Z2j−1 = {u (i,r+1) 1 Z2j = {u (1,1) 1 }. That is, for each 1 ≤ j ≤ i − 1, } ∪ {u } ∪ Sr (i,r) . . . , u k } ∪ Sr (i,r) (i,r) j+1 . . . , u i . k } and Z2j = Z2j−1 \ {u For each i ≤ j ≤ k − 1, Z2j−1 = Z2j−2 ∪ {u i and for each 1 ≤ j ≤ i − 1, Z2j−1 = Z2j−2 ∪ {u (i,r+1) j } ∪ {u (1,1) j i = {s0 j+1 }. That is, (1,r) i ∪ Sr i , and (i,r+1) j (i,r+1) j+1 (i,r+1) u j (i,r+1) i (1,r) j , . . . , u , . . . , u (i,r) j , . . . , u , u (i,r+1) i−1 (i,r+1) i−1 (i,r+1) i+1 (i,r+1) i+1 , . . . , u , . . . , u (i,r+1) j+1 (i,r+1) j+1 } ∪ {u } ∪ {u (i,r) (i,r) j+1 . . . , u k (i,r) (i,r) j+2 . . . , u k (i,r) , u i (i,r) , u i } ∪ Sr i , and } ∪ Sr i . for each i ≤ j ≤ k − 1, Z2j−1 = {u (i,r+1) 1 Z2j = {u (i,r+1) 1 , u Next, we define Z2k−1 and Z2k as , . . . , u Z2k−1 = {u (i,r+1) 1 Z2k = {u (i,r+1) 1 , . . . , u , . . . , u (i,r+1) k (i,r+1) k } ∪ {u (i,r) i } ∪ Sr i . } ∪ Sr i , and u (i,20k) j (i,20k) i (i+1,1) i j = su , . . . , u , . . . , u Next, for each 1 ≤ j ≤ k−1, let Z2k+2j−1 = Z2k+2j−2∪{s0 Z0, . . . , Z4k−2 is a reconfiguration sequence where Z0 = V (Pr) and Z4k−2 = V (Pr+1). It is easy to verify that Z1, . . . Z4k−2 are solutions to the CCS instance (H,bc, 2k) and j} and Z2k+2j = Z2k+2j−1\{sj}. Case 2(b): Reconfiguration from V (P20k) to V (bTi+1). Next, we explain how to get a reconfiguration sequence from V (P20k) to V (bTi+1) using Lemma A.1. Recall that C20k i = } and S20k i = 2}. Let Ci+1 = } and Si+1 = {z ∈ V (H(i+1,1)): NH(i+1,1)(z) ∩ Ci+1 = 2}. For ease of i = {z ∈ V (H(i,20k)): NH(i,20k)(z) ∩ C20k for all j ∈ {1, . . . , k} \ {i}. Also, let s0 {u (i,20k) 1 {u (i+1,1 1 presentation, let sj = su for all j ∈ {1, . . . , k}\{i + 1}. That is, S20k {1, . . . , k} \ {i + 1}}. Notice that V (P20k) = C20k and V (bTi+1) = Ci+1 ∪ Si+1. i = {sj : j ∈ {1, . . . , k}\{i}} and Si+1 = {s0 (i,20k) k (i+1,1) k to Ci+1∪S20k is similar to the one in Case 1. That is, we add u to Ci+1∪S20k i ∪S20k i ∪ S20k from C20k sequence from C20k (i,20k) and delete u j sequence from C20k Towards proving the required reconfiguration sequence, we give a reconfiguration sequence to Ci+1∪Si+1. The reconfiguration (i+1,1) j for j in the order 1, . . . , i − 1, i + 1, . . . , k, i. This gives a reconfiguration to Ci+1∪Si+1. {1, . . . , k} with vertex i being the center, and T i+1 is is the star on {1, . . . , k} with vertex i being the center. Also, cj is a coloring on H j which is inherited from the coloring c of ) = j for all 1 ≤ j ≤ k. Then, H[Z] = K[Ci+1] (cid:22)ci+1 T i and G. That is, ci+1(u Notice that H[Z] and bTi+1 = H[Ci+1 ∪ Si+1] are trees. Recall that T i is the star on bTi+1 = H[Ci+1 ∪ Si+1] = K[Ci+1] (cid:22)ci+1 T i+1. Next we explain how to get a reconfiguration sequence from Z = Ci+1∪S20k to Z = Ci+1 ∪ S20k i ∪ S20k and then from Ci+1∪S20k i ∪S20k of length 2k. have a sequence ei1, . . . , ei vertex set {1, . . . , k}, where for each 0 ≤ j ≤ k − 2, T i following holds. k−1 be an arbitrary ordering of the the edges in T i+1. By Lemma A.1, we k−1 on j and T i0 = T i, the k−1 of edges in T i such that for the sequence T i0, T i1, . . . , T i j − ei j+1 = T i j + ei+1 , . . . , ei+1 Let ei+1 j : j ∈ (i+1,1) j (i+1,1) j 1 u i i i i i i i i i D. Lokshtanov et al. 19 (i) T i (ii) T i j is a tree for all 0 ≤ j ≤ k − 1, and k−1 = T i+1. This implies that, from the sequences ei1, . . . , ei k−1 and ei+1 1 , . . . , ei+1 i k−1 on S20k and a sequence f0 k−1, we get a sequence f1, . . . , f0 k−1 on Si+1 such that the for the sequence L0, . . . , L2(k−1), where L0 = Ci+1 ∪ {f1, . . . , fk−1} and for all 1 ≤ j ≤ k − 1 L2j−1 = (L2j−2 ∪ {f0 (1) H[Li] is connected for all 0 ≤ i ≤ k − 1, and (2) Lk−1 = Si+1 ∪ Ci+1. i}), L2j = L2j−1 \ {fi} the following holds. 1, . . . , f0 Here, conditions (1) and (2) follow from conditions (i) and (ii), respectively. Moreover, ordering by which we can move the subdivision vertices from Si to Si+1 without violating bc(Li) = [k + 1] for all 0 ≤ i ≤ 2(k − 1) and L0 = Z. Thus, L0, . . . , L2(k−1) is a valid reconfiguration sequence from Z to V (bTi+1). Note that the ordering on the edges implies an connectivity. This implies that there is a reconfiguration sequence from V (P20k) to V (bTi+1), of length 4k − 2. Therefore, we have a reconfiguration sequence from V (bTi) to V (bTi+1) of Case 3: Reconfiguration from V (bTk) to V (Tt). The arguments for this case are similar length O(k2). to those given in Case 1, we therefore omit the details. By summing up the lengths of reconfiguration sequences, we get that if (G, c, k) is a yes-instance of Multicolored Clique then there is a reconfiguration sequence from Qs to Qt, of length O(k3). (cid:74) Proof of Lemma 3.5 Proof. For each 1 ≤ i ≤ k + 1, let Qi be the set of vertices colored by the color i. That is, (cid:73) Claim 1. (i) Q1 ∪ . . . ∪ Qk is an independent set in H, and (ii) every vertex in Qk+1 is connected to vertices of at most two distinct colors. Qi =bc−1(i). First, we prove some auxiliary claims. The proofs of the following two claims follow from the construction of H and the definition ofbc. (cid:73) Claim 2. Let v, w ∈ V (H)\(V (H0)∪V (H k+1)) be two distinct vertices such thatbc(v) =bc(w) andbc(v) ∈ {1, . . . , k}. If v and w have a common neighbor in V (H) \ V (H0), then v and w (cid:73) Claim 3. Let Y ⊆ V (H) be a vertex subset such thatbc(Y ) = {1, . . . , k + 1} and H[Y ] is Proof. Let B = Y \bc−1(k + 1) = Y ∩ (Q1 ∪ . . . ∪ Qk). Sincebc(Y ) = {1, . . . , k + 1}, B ≥ k are copies of same vertex z ∈ V (G). connected. Then, Y ≥ 2k − 1. and by Claim 1(i), B is an independent set in H. By Claim 1(ii), each vertex in Qi+1 is connected to vertices of at most two distinct colors. Thus, since H[Y ] is connected, the claim (cid:121) follows. Suppose (H,bc, Qs, Qt, 2k) is a yes-instance of CCS-R. Then, there is a reconfiguration sequence D1, . . . , D' for ' ∈ N, where D1 = Qs and D' = Qt. Without loss of generality, we assume that the sequence D1, . . . , D' is a minimal reconfiguration sequence. Then, by Claim 3, for each i ∈ ['], 2k − 1 ≤ Di ≤ 2k. Moreover, since D1 = D' = 2k − 1, we have that for each even i, Di is obtained from Di−1 by a token addition, and for each odd i, Di is obtained from Di−1 by a token removal. This also implies that for each even i, Di = 2k, for each odd i, Di = 2k − 1, and ' is odd. 20 Reconfiguration of Connected Dominating Set at most one vertex in {v, w} is in V (H(1,1)), andbc(v) =bc(w) ∈ {1, . . . , k}. Then, v and w (cid:73) Claim 4. Let i ∈ ['] and Di = 2k − 1. Then, for all 1 ≤ j ≤ k, Di ∩ Qj = 1, and Di ∩ Qk+1 = k − 1. Moreover, each vertex in Di ∩ Qk+1 will be adjacent to exactly two vertices in H[Di] and these vertices will be of different colors from {1, . . . , k}. Proof. By Claim 1, Q1 ∪ . . . ∪ Qk is independent and every vertex of Qk+1 is adjacent to vertices of at most two different color classes. Hence, we need at least k − 1 vertices from Qk+1 that make the connections between the vertices of Di colored with {1, . . . , k}. The above statement along with the assumption Di = 2k − 1 imply the claim. (cid:121) (cid:73) Claim 5. Let i ∈ {2, . . . '−1}. Let v ∈ Di and w ∈ Di+1 such that v, w /∈ V (H0)∪V (H k+1), are copies of the same vertex in G. Moreover, v, w ∈ V (H j) ∪ V (H j+1) for some j ∈ [k − 1]. Proof. Suppose v and w are not copies of the same vertex z ∈ V (G). We know that Di = 2k − 1 or Di = 2k. Case 1: Di = 2k − 1. Since Di is a solution, Di induces a connected subgraph in H. By Claim 4, Di ∩ Qj = 1 for all j ∈ {1, . . . , k} and Di ∩ Qk+1 = k − 1. Also, by Claim 1, (i) Q1∪. . .∪Qk is an independent set in H, and (ii) every vertex in Qk+1 is connected to vertices of at most two distinct colors. Statements (i) and (ii), and the fact that Di = 2k − 1 imply that (iii) H[Di] is a tree and each vertex in Di ∩ Qk+1 is incident to exactly two vertices in Di. Since Di+1 = Di + 1, in reconfiguration step i + 1, we add a vertex to obtain Di+1. We know that v ∈ Di. Since, for any color q ∈ [k], there is exactly one vertex in Di of color q (i.e., Di ∩ Qq = 1), we have that Di+1 = Di ∪ {w}. Moreover, in step i + 2, the vertex removed from Di+1 will be from {v, w} and that vertex will be v (because of the minimality assumption of the length of the reconfiguration sequence). That is, Di+2 = (Di ∪ {w}) \ {v}. Notice that Di = Di+2 = 2k−1. Let b a vertex in Di+2 which is adjacent to w in H[Di+2]. Since Qk+1 ∩ Di = Qk+1 ∩ Di+2 and Di = Di+2 = 2k − 1, by Claim 1, the neighbors of b in H[Di] and H[Di+2] are of the same color. This implies that b is adjacent to v in H[Di]. Thus, we proved that {b, w},{b, v} ∈ E(H). If b ∈ V (H0), then v, w ∈ V (H(1,1)) which is a contradiction to the assumption. Otherwise, by Claim 2, we conclude that v and w are copies of same vertex. Case 2: Di = 2k. In this case Di+1 is obtained by removing a vertex from Di. Moreover, i ≥ 3, because we have two vertices in Di from V (H) \ D1. Since Di+1 = 2k − 1, because of Claim 4, Di+1 is obtained by removing the vertex v from Di. That is, Di+1 = Di \ {v} and v, w ∈ Di. Then, again by Claim 4, there is v0 ∈ {v, w} such that Di−1 ] {v0} = Di. Let w0 = {v, w} \ {v0}. Since i ≥ 3, we now apply Case 1 with respect to w0 ∈ Di−1 and v0 ∈ Di (cid:121) to complete the proof. (cid:73) Claim 6. For any index j ∈ {1, . . . , k} and color q ∈ {1, . . . , k}, there exist an odd i ∈ {3, . . . , '} and r ∈ {5k, . . . , 15k} such that Di contains a vertex of color q from V (H j,r). Proof. Without loss of generality, assume that k ≥ 2. Moreover, for any odd i ∈ [' − 2], there is a vertex common in Di and Di+2 (since k ≥ 2). This implies that H[D1 ∪ D3 . . . D'] is a connected subgraph of H. Notice that for any j ∈ {1, . . . , k} and r ∈ [20k], V (H(j,r)) is a (v1, x1)-separator in H. Therefore, since H[D1 ∪ D3 . . . D'] is connected and v1, x1 ∈ D1 ∪ D', (i) for any j ∈ [k] and r ∈ [20k], there is an odd i ∈ ['] such that Di contains a vertex from V (H(j,r)). Now fix an index j ∈ {1, . . . , k} and a color q ∈ {1, . . . , k}. By statement (i), there is an odd i ∈ {1, . . . , '} such that Di contains a vertex from V (H(j,10k)). Since H[Di] r=5k V (H(j,r)) is connected, Di = 2k − 1, Di ∩ V (H(j,10k)) 6= ∅, and any vertex in V (H) \S15k D. Lokshtanov et al. 21 is at distance more that 5k (by the construction of H), we have that all the vertices in Di r=5k V (H(j,r)). Moreover, by Claim 4, Di contains a vertex colored q and that (cid:121) belong toS15k will also be present inS15k (cid:73) Claim 7. For any color q ∈ {1, . . . , k}, the vertices of color q from Sk r=5k V (H(j,r)). This completes the proof of the claim. i=2 V (H i) used in the reconfiguration sequence D1, . . . , D' are copies of the same vertex z ∈ V (G). Moreover, exactly one vertex from V (H j) of color q is used in the reconfiguration for all 2 ≤ j ≤ k. Proof. Fix a color q ∈ {1, . . . , k}. By Claim 6, there are vertices of color q from V (H j) for all j is used in the reconfiguration sequence. By Claim 5, all these vertices are copies of the same vertex z ∈ V (G). (cid:121) Now we define a k-size vertex subset C ⊆ V (G) and prove that C is a clique in G. We let C = {ai ∈ V (G): 1 ≤ i ≤ k, c(ai) = i, and the copy of ai in V (H2) is used in D1, . . . , D'}. Because of Claim 7, we have that C = k and C contains a vertex of each color in c. C = {a1, . . . , ak} ⊆ V (G) and for each q ∈ [k], c(aq) = q. We now prove that C is indeed a clique in G. Towards that, we need to prove that for each 1 ≤ q < j ≤ k, {aq, aj} ∈ E(G). (cid:73) Claim 8. Let 1 ≤ q < j ≤ k. Then, {aq, aj} ∈ E(G). Proof. By Claim 6, we know that there exist an odd i ∈ ['] and r ∈ {5k, . . . , 15k} such that Di contains a vertex of color q in V (H(j,r)). Thus, by Claim 7, a copy of aj and a copy of aq are present in Di. Let uj and uq be the vertices in Di colored with j and q, respectively. By Claim 7, uj is a copy of aj and uq is a copy of aq. Any vertex b in V (H j) colored k + 1 is adjacent to vertices of exactly two colors, out of which one color is j. Moreover, by the construction of H, (a) if b is adjacent to x and y in V (H j), and x and y are copies of x0 and y0 in G, respectively, then {x0, y0} ∈ E(G). We know that H[Di] is connected, Qs ∩ Di = 1 for all 1 ≤ s ≤ k, Di \ Qk+1 is an independent set in H, and each vertex in Di colored with k + 1 is adjacent to exactly two vertices in Di \ Qk+1 with one of them being uj (see Claims 1 and 4). This implies that there is common neighbor b for uq and uj and hence {aq, aj} ∈ E(G), by statement (a) above. This completes the proof of the claim. (cid:121) (cid:74) This completes the proof of the lemma. B Details omitted from Section 4 Proof of Lemma 4.10 Proof. Let H be the subgraph of G induced by D(u, v). We enumerate the vertices of N(u) ∩ N(v) consecutively as x1, . . . , xt for some t > 4C + 3k + 1. We let X = {x1, . . . , xt}. Note that since we have t vertex-disjoint paths between u and v in H, these paths define the boundaries of t faces in the plane embedding of H (after applying the reduction rule of Lemma 4.9, H has all the edges {u, x} and {v, x} for x ∈ N(u) ∩ N(v) and no other edges). Each vertex in C \ {u, v} can be adjacent in H to at most two vertices in X, say with y and z, and these two vertices y and z can touch at most 3 faces of H. This leaves C+3k +1 > C+1 faces of H that are not touched by a vertex of C \{u, v}. By the pidgeonhole principle we can find 2 adjacent faces f and g of H that are not touched by a vertex of C \ {u, v}. We let x1 and x2 denote the two vertices on the boundary of face f different from u and v and we let x2 and x3 denote the two vertices on the boundary of face g different from u and v. Recall that, due to Lemma 4.9, we know that there are no edges between those three vertices. Let W denote the set of all vertices contained in the face of the cycle u, x1, v, x3, u. 22 Reconfiguration of Connected Dominating Set • • • c1• • x1 •v f • g x2 • u • x3 • c2 • • • Figure 8 Every vertex of C \ {u, v} can touch at most 3 faces of H. In the figure we assume the vertices c1 and c2 are in C \ {u, v}. The faces that are touched by c1 or c2 are colored in blue. The uncolored faces f and g are not touched by vertices of C \ {u, v}. In particular, W contains x2. We claim that the vertices of W can be removed from G without changing the reconfiguration properties of G, i.e., W is a set of irrelevant vertices. Let G0 = G − W. First observe that W ∩ (S ∪ T) = ∅, hence S, T ⊆ V (G0). We show that reconfiguration from S to T is possible in G if and only if reconfiguration from S to T is possible in G0. Assume S = S1, . . . , St = T is a reconfiguration sequence from S to T in G. Let S0 i := Si if Si does not contain a vertex of W and S0 where for 1 ≤ i ≤ t, S0 otherwise. Note that this modification leaves S and T unchanged, hence, S0 t = St. We claim that S0 S0 (cid:73) Claim 1. For 1 ≤ i ≤ t, S0 1, . . . , S0 i is a dominating set of G, and hence also of G0. t is a reconfiguration sequence from S to T in G0. 1, . . . , S0 t, i := (Si \ W) ∪ {x1} 1 = S1 and Proof. No vertex of W is adjacent to a vertex of C \ {u, v} and W ∩ C = ∅ by construction. Hence, the only vertices of C that are possibly adjacent to a vertex of W are the vertices u and v. Whenever Si contains a vertex of W, we have x1 ∈ S0 i, which dominates both u and v. Hence, S0 i dominates at least the vertices of C that Si dominates. We use Lemma 4.3 to (cid:121) conclude that S0 (cid:73) Claim 2. For 1 ≤ i ≤ t, S0 i is a dominating set of G. i is connected. Proof. Let s1, s2 ∈ Si \ W and let P be a shortest path between s1 and s2 in G[Si]. We have to show that there exists a path between s1 and s2 in G[S0 i]. If P does not use a vertex of W, then there is nothing to show. Hence, assume P uses a vertex of W. By definition of W, both s1 and s2 lie outside the face h of the cycle u, x1, v, x3 that contains x2. Hence, P must enter and leave the face h, and as P is a shortest path, it must enter and leave via opposite vertices, i.e., via u and v, or via x1 and x3 (as all other pairs are linked by an edge and we could find a shorter path). If P contains u and v, then we can replace the vertices of W on P by x1 and we are done. Hence, assume P uses x1 and x3. As D(u, v) is a diamond of thickness greater than 4p + 3k + 1 > 3k, according to Lemma 4.8 at least one of the vertices u and v, say u, is contained in Si, and by definition also in S0 i. Then we can replace the vertices of W on P (cid:121) by u and we are again done. Finally, the following claim is immediate from the definition of each S0 i. Combining Claim 1, 2, and 3, we conclude that S0 (cid:73) Claim 3. S0 1 ≤ i < t. 1, . . . , S0 i+1 is obtained from S0 t is a reconfiguration sequence from S to T in G0. i by the addition or removal of a single token for all D. Lokshtanov et al. 23 1, . . . , S0 To prove the opposite direction, assume S = S0 t = T is a reconfiguration sequence from S to T in G0. We claim that this is also a reconfiguration sequence from S to T in i is a dominating set of G for all 1 ≤ i ≤ t. This follows G. All we have to show is that S0 immediately from the fact that S0 i is a dominating set of G0, and hence, as W is not adjacent to C \{u, v} and W ∩ C = ∅, also a dominating set of C in G. Then according to Lemma 4.3, S0 i also dominates G. We conclude that there is a reconfiguration sequence from S to T in G if and only if there is a reconfiguration sequence from S to T in G0 = G − W. (cid:74) Proof of Lemma 4.15 Proof. We first show that we can essentially establish the situation depicted in Figure 9. We may assume that the paths of P are induced paths, otherwise we may replace them by induced paths. Let H be the graph induced on u, v and the vertices of P that contains exactly the edges of the paths in P. In the figure, the paths of P are depicted by thick edges, while the diagonal edges do not belong to the paths. This situation is similar to the situation in the proof of Lemma 4.10. Just as in the proof of Lemma 4.10, we find two adjacent faces f, g of H that do not touch a vertex of D \ {u, v}. • • • yf • xf •v • zv • zu • u • • yg xg • • ⇒ • • • • •v • u • • • • Figure 9 An exemplary situation handled by Lemma 4.15. (cid:73) Claim 1. The paths bounding f and g have length 3, i.e., they have exactly two inner vertices. Proof. First observe that P ∈ P cannot have length exactly 2, as then P contains a vertex adjacent to both u and v. However, the vertices with this property lie in D, and hence by construction not on P. Assume there is P ∈ P of length greater than 3. Let M(u) denote the neighbors of u that are in V (G) \ D and are only adjacent to u and to no other vertex of C. Similarly, let M(v) denote the neighbors of v that are in V (G) \ D and are only adjacent to v and to no other vertex of C. By construction, the faces f and g do not contain vertices of D \ {u, v}. Furthermore, P contains exactly one vertex of M(u) and exactly one vertex of M(v). It cannot contain two vertices of one of these sets, as otherwise P is not an induced path. Hence, assume that P contains another vertex x that is not in M(u) ∪ M(v). Then x must be dominated by a vertex different from u and from v. However, by construction, the faces f and g do not touch a vertex of D \ {u, v} ⊇ (S ∪ T) \ {u, v}, a contradiction. (cid:121) Denote by xf , yf the two vertices that lie on the boundary of f and not on the boundary of g and by xg, yg the two vertices that lie on the boundary of g and not on the boundary of f. Assume that xf , xg ∈ M(u) and yf , yg ∈ M(v). Denote by zu, zv the vertices shared by f and g different from u and v that are adjacent to u and v, respectively. Denote by W 24 Reconfiguration of Connected Dominating Set the set of all vertices that lie inside the face h of the cycle u, xf , yf , v, yg, xg, u that contains the vertices zu and zv. Hence W contains at least the vertices zu and zv. By Corollary 4.11, we know that u, v ∈ Si, for all 1 ≤ i ≤ t (both u and v can never be lifted). Consequently, by Lemma 4.12, we know that there are no edges with both endpoints in N(v) nor edges with both endpoints in N(u). Combining the previous fact with the fact that all vertices of W are adjacent to either u or v (but not both) and to no other vertex of C ⊇ S ∪ T, we conclude that W consists of exactly the two vertices zu and zv and that there are no edges between zu and xg, xf and no edges between zv and yg, yf. Note that we can safely assume that none of the degree-one neighbors of u or v are inside W. We claim that the vertices zu and zv are irrelevant and can be removed after possibly introducing an additional edge to the graph. Recall that S and T do not contain the vertices zu and zv. We define G0 as follows. If {u, v} 6∈ E(G) and ({xf , zv} ∈ E(G) or {yf , zu} ∈ E(G)) and ({xg, zv} ∈ E(G) or {yg, zu} ∈ E(G)) then G0 is obtained from G by deleting zu and zv and introducing the edge {xf , yg}. Otherwise, G0 is obtained from G by simply deleting zu and zv. We claim that (G, S, T, k) and (G0, S, T, k) are equivalent instances of CDS-R. Assume first that there exists a reconfiguration sequence S = S1, . . . , St = T in G. We distinguish two cases. First assume that {u, v} ∈ E(G). Hence, G0 is obtained from G by simply deleting t, where for 1 ≤ i ≤ t, S0 zu and zv. Let S0 1, . . . , S0 is a reconfiguration sequence from S to T in G0. (cid:73) Claim 2. For 1 ≤ i ≤ t, S0 Proof. The vertices zu and zv are not adjacent to a vertex of C \{u, v} and {zu, zv}∩ C = ∅. Hence, the only vertices of C that are possibly adjacent to zu or zv are the vertices u and v. According to Lemma 4.11, u, v ∈ Si, and moreover u, v ∈ S0 i, for all 1 ≤ i ≤ t. Hence, S0 dominates at least the vertices of C that Si dominates. We use Lemma 4.3 to conclude that (cid:121) S0 i is a dominating set of G. (cid:73) Claim 3. For 1 ≤ i ≤ t, S0 Proof. Let s1, s2 ∈ Si \ {zu, zv} and let P be a shortest path between s1 and s2 in G[Si]. We have to show that there exists a path between s1 and s2 in G[S0 i]. If P does not use zu nor zv then there is nothing to prove. Hence, assume P uses zu or zv (or both). By definition of W, both s1 and s2 lie outside the face h of the cycle u, xf , yf , v, yg, xg, u that contains zu, zv. Hence, P must enter and leave the face h, say it enters at u and leaves at yf. All other possibilities are handled analogously. Then we can avoid the vertices zu and zv by (cid:121) walking to v first, then u (or xf), and then to yf. i is a dominating set of G, and hence also of G0. i = Si \ {zu, zv}. We claim that S0 i is connected. 1, . . . , S0 t i The next claim follows from the definition of S0 duplicate consecutive sets in a reconfiguration sequence. (cid:73) Claim 4. S0 1 ≤ i < t. i+1 is obtained from S0 i and the fact that we can remove any i by the addition or removal of a single token for all This finishes the proof in case {u, v} ∈ E(G). Hence, we assume now that {u, v} 6∈ E(G) and ({xf , zv} ∈ E(G) or {yf , zu} ∈ E(G)) and ({xg, zv} ∈ E(G) or {yg, zu} ∈ E(G)). That is, G0 is obtained from G by deleting zu and zv and introducing the edge {xf , yg}. We now obtain S0 i from Si, for 1 ≤ i ≤ t, by replacing zu by xf and zv by yg if Si ∩ {zu, zv} = {zu, zv}, D. Lokshtanov et al. 25 zu by xf if Si ∩ {zu, zv} = {zu}, and zv by yg if Si ∩ {zu, zv} = {zv}. We claim that S0 i is connected in G0. i, for all 1 ≤ i ≤ t. t is a reconfiguration sequence from S to T in G0. We need no i is a dominating set of G and hence of G0 and that i by adding or removing one token. It remains to show that 1, . . . , S0 new arguments to prove that each S0 each S0 i+1 is obtained from S0 each S0 i is connected in G0. (cid:73) Claim 5. For 1 ≤ i ≤ t, S0 Proof. According to Lemma 4.11, u, v ∈ Si, and also u, v ∈ S0 If Si \ {zu, zv} is connected, S0 i is also connected, hence assume Si \ {zu, zv} is not connected. As X = {u, xf , zu, xg} is connected via u and Y = {v, yf , zv, yg} is connected via v, it suffices to show that our vertex exchange creates a connection in G0 between any vertex of X and any vertex of Y . If Si ∩ {zu, zv} = {zu, zv} this is clear, as we shift the tokens to xf and yg and in G0 we have introduced the edge {xf , yg}. If Si ∩ {zu, zv} = {zu}, then {zu, yg} ∈ E(G) and yg ∈ Si, or {zu, yf} ∈ E(G) and yf ∈ Si. We move the token zu to xf. In the first case we have connectivity via the new edge {xf , yg} ∈ E(G0), and in the second case we have connectivity via the edge {xf , yf} ∈ E(G). The case Si ∩ {zu, zv} = {zv} is symmetric. (cid:121) This finishes the proof that if (G, S, T, k) is a positive instance then (G0, S, T, k) is a positive instance. Now assume that there exists a reconfiguration sequence S = S0 t = T in G0. In case we do not introduce the new edge to obtain G0 from G, we do not need new t is a reconfiguration sequence also in G. Moreover, if G00[S0 arguments to see that S0 i] is connected for all i, where G00 is obtained from G0 by removing the edge {xf , yg}, then again there is nothing to prove as G0 is a subgraph of G and therefore S = S0 t = T is a reconfiguration sequence in G. Hence, assume that there exists at least one contiguous subsequence σ starting at index s and ending at index f (with possibly s = f) such that G00[S0 f] are not connected. In other words, there exists a subsequence of length one or more that uses the edge {xf , yg} for connectivity. Moreover, we assume, without loss of generality (the other case is symmetric), that S0 s−1 s−1 ∪ {yg}, and S0 by adding a token on vertex yg, i.e., S0 f by f \{xf}. We also assume that E(G) contains removing the token on vertex xf, i.e., S0 the edges {xf , zv} and {zu, yg} (the remaining cases are handled identically). It remains to show how to modify σ so that it does not use the edge {xf , yg} for connectivity and remains a valid reconfiguration sequence in G. By applying the same arguments for any such subsequence we obtain the required reconfiguration sequence in G. We modify σ as follows. We let S00 f+1 by four new sets A1, A2, f \ {xf}, A2 = A1 ∪ {zu}, A3 = A2 \ {zv}, A3 = A3 ∪ {yg}, and A3, and A4, where A1 = S0 A4 = A3 \ {zu}. Using the fact that the vertices xf , yf , xg, yg are not adjacent to vertices of D \ {u, v}, it is easy to see that this yields a valid reconfiguration sequence, as both (cid:74) domination and connectivity are preserved. This completes the proof of the lemma. i \{yg})∪{zv}, for s ≤ i ≤ f. Then we replace S0 s is obtained from S0 f+1 is obtained from S0 1, . . . , S0 1, . . . , S0 s = S0 f+1 = S0 1, . . . , S0 s], G00[S0 s+1], . . . , G00[S0 i = (S0
1911.03449
2
1911
2019-12-10T13:39:32
Fully-dynamic Planarity Testing in Polylogarithmic Time
[ "cs.DS" ]
Given a dynamic graph subject to insertions and deletions of edges, a natural question is whether the graph presently admits a planar embedding. We give a deterministic fully-dynamic algorithm for general graphs, running in amortized $O(\log^3 n)$ time per edge insertion or deletion, that maintains a bit indicating whether or not the graph is presently planar. This is an exponential improvement over the previous best algorithm [Eppstein, Galil, Italiano, Spencer, 1996] which spends amortized $O(\sqrt{n})$ time per update.
cs.DS
cs
Fully-dynamic Planarity Testing in Polylogarithmic Time Jacob Holm∗1 and Eva Rotenberg†2 1University of Copenhagen 2Technical University of Denmark [email protected] [email protected] Abstract Given a dynamic graph subject to insertions and deletions of edges, a natural question is whether the graph presently admits a planar embedding. We give a deterministic fully-dynamic algorithm for general graphs, running in amortized O(log3 n) time per edge insertion or deletion, that maintains a bit indicating whether or not the graph is presently planar. This is an exponential improvement over the previous best algorithm [Eppstein, Galil, Italiano, Spencer, 1996] which √ spends amortized O( n) time per update. 9 1 0 2 c e D 0 1 ] S D . s c [ 2 v 9 4 4 3 0 . 1 1 9 1 : v i X r a ∗Partially supported by the VILLUM Foundation grant 16582, Basic Algorithms Research Copenhagen (BARC). †Partially supported by Independent Research Fund Denmark grant "AlgoGraph" 2018-2021 (8021-00249B). 1 Introduction A linear time algorithm for determining whether a graph is planar was found by Hopcroft and Tarjan [14]. For the partially dynamic case, where one only allows insertion of edges, the problem was solved by La Poutré [17], who improved on work by Di Battista, Tamassia, and Westbrook [5, 19, 20], to obtain a amortized running time of O(α(q, n)) where q is the number of operations, and where α is the inverse-Ackermann function. Galil, Italiano, and Sarnak [8] made a data structure for fully dynamic planarity testing with O(n n) by Eppstein et al. [7]. 3 ) amortized time per update, which was improved to O( √ 2 While there has for a long time been no improvements upon [7], there have been different approaches in works that address the task of maintaining an embedded graph. In [15], Italiano, La Poutré, and Rauch present a data structure for maintaining a planar embedded graph while allowing insertions that do not violate the embedding, but allowing arbitrary deletions; its update time is O(log2 n). Eppstein [6] presents a data structure for maintaining a dynamic embedded graph, which handles updates in O(log n) time if the embedding remains plane -- this data structure maintains the genus of the embedding, but does not answer whether another embedding of the same graph with a lower genus exists. Patraşcu and Demaine [16] give a lower bound of Ω(log n) for fully-dynamic planarity testing. For other natural questions about fully-dynamic graphs, such as fully dynamic shortest paths, even on planar graphs, there are conditional lower bounds based on popular conjectures that indicate that subpolynomial update bounds are unlikely [2, 1]. In this paper, we show that planarity testing does indeed admit a subpolynomial update time algorithm, thus exponentially improving the state of the art for fully-dynamic planarity testing. We give a deterministic fully-dynamic algorithm for general graphs, running in amortized O(log3 n) time per edge insertion or deletion, that explicitly maintains a single bit indicating whether the graph is presently planar, and that given any vertex can answer whether the connected component containing that vertex is planar in worst case O(log n/ log log n) time. In fact, our algorithm not only maintains whether the graph is presently planar, but also implicitly maintains how the graph may be embedded in the plane, in the affirmative case. Specifically, we give a deterministic algorithm that maintains a planar embedding of a fully dynamic planar graph in amortized O(log3 n) time per edge insertion, and worst case O(log2 n) time per edge deletion. In this algorithm, attempts to insert edges that would violate planarity are detected and rejected, but may still change the embedding. The algorithm for fully-dynamic general graphs then follows by a simple reduction. Our main result consists of two parts which may be of independent interest. Our analysis goes via a detailed understanding of flips, i.e. local changes to the embedding, to be defined in Section 1.1. Firstly, we consider any algorithm for maintaining an embedding that lazily makes no changes to the embedding upon edge deletion, and that for each (attempted) insertion greedily only does the minimal (or close to minimal) number of flips necessary to accommodate the edge. We prove that any such algorithm will do amortized O(log n) flips. Secondly, we show how to find such a sufficiently small set of flips in worst case O(log2 n) time per flip. The idea of focusing on flips is not new: In [11], we use insights from Eppstein [6] to improve upon the data structure by Italiano, La Poutré, and Rauch [15], so that it also facilitates flips, i.e. local changes to the embedding, and, so that it may handle edge-insertions that only require one such flip. In [12], we analyze these flips further and show that there exists a class of embeddings 1 where only Θ(log n) flips are needed to accommodate any one edge insertion that preserves planarity. The core idea of our analysis of the lazy greedy algorithm is to define a potential function based on how far the current embedding is from being in this class. This is heavily inspired by the analysis of Brodal and Fagerberg's algorithm for fully-dynamic bounded outdegree orientation [4]. 1.1 Maintaining an embedding if it exists Before stating our results in detail, we will define some crucial but natural terminology for describing changeable embeddings of dynamic graphs. are graphs that can be drawn in the plane without edge crossings. A planar graph Planar graphs may admit many planar embeddings, and we use the term plane graph to denote a planar graph equipped with a given planar embedding. Given a plane graph, its drawing in the plane defines faces, and the faces together with the edges form its dual graph. Related, one may consider the bipartite vertex-face (multi-)graph whose nodes are the vertices and faces, and which has an edge for each time a vertex is incident to a face. Through the paper, we will use the term corner to denote an edge in the vertex-face graph, reflecting that it corresponds to a corner of the face in the planar drawing of the graph. If a planar graph has no vertex cut-sets of size ≤ 2, its embedding is unique up to reflection. On the other hand, if a plane graph has an articulation point (cut vertex) or a separation pair (2-vertex cut), then it may be possible to alter the embedding by flipping [21, 11, 12] the embedding in that point or pair (see figure 1). Given two embeddings of the same graph, the flip-distance between them is the minimal number of flips necessary to get from one to the other. Intuitively, a flip can be thought of as cutting out a subgraph by cutting along a 2-cycle or 4-cycle in the vertex-face graph, possibly mirroring its planar embedding, and then doing the inverse operation of cutting along a 2- or 4-cycle in the vertex-face graph. The initial cutting and the final gluing involve the same vertices but not necessarily the same faces, thus, the graph but not the embedding is preserved. y y y z z z x x x (a) Separation flips: reflect and slide. (b) Articulation flips: reflect and slide. Figure 1: Local changes to the embedding of a graph [12]. We use the following terminology: To distinguish between whether the subgraph being flipped is connected to the rest of the graph by a separation pair or an articulation point, we use the terms separation flip and articulation flip, respectively. To indicate whether the subgraph was mirrored, moved to a different location, or both, we use the terms reflect, slide, and reflect-and-slide. Note that for articulation flips, only slide and reflect-and-slide change which edges are insertable across a face. For separation flips, note that any slide operation or reflect-and-slide operation may be obtained by doing 3 or 2 reflect operations, respectively. 2 Results. Let n denote the number of vertices of our fully-dynamic graph. Theorem 1. There is a data structure for fully-dynamic planarity testing that handles edge-insertions and edge-deletions in amortized O(log3 n) time, answers queries to planarity-compatibility of an edge in amortized O(log3 n) time, and answers queries to whether the graph is presently planar in worst case O(1) time, or to whether the component of a given vertex is presently planar in worst case O(log n/ log log n) time. It maintains an implicit representation of an embedding that is planar on each planar connected component, and may answer queries to the neighbors of a given existing edge in this current embedding, in O(log2 n) time. The result follows by applying a simple extension of the reduction by Eppstein et al. [7, Corollary 1] to the following theorem: Theorem 2. There is a data structure for maintaining a planar embedding of a fully-dynamic planar graph that handles edge-updates and planarity-compatibility queries in amortized O(log3 n) time, edge deletions in worst-case O(log2 n) time, and queries to the neighbors of a given existing edge in the current embedding in worst-case O(log2 n) time. The underlying properties in the data structure above include that the queries may change the embedding, but the deletions do not change anything aside from the mere deletion of the edge itself. To arrive at these theorems, we prove some technical lemmas which may be of independent interest. A weak form of these that is easy to state is the following: Lemma 3. Any algorithm for maintaining a fully dynamic planar embedding that for each attempted edge-insertion greedily does the minimal number of flips, and that for each edge deletion lazily does nothing, will do amortized O(log n) flips per insertion when starting with an empty graph (or amortized over Ω(n/ log n) operations). 1.2 Article outline In Section 2, we introduce some of the concepts and data structures that we use to prove our result. In Section 3 we give the proof of Lemma 3 conditioned on insights and details deferred to Section 6. In Section 4, we prove Theorem 2 by giving an algorithm (given an edge to insert and an embedded graph) for greedily finding flips that bring us closer to an embedding that is compatible with the edge we are trying to insert. In Section 5, we show how the reduction that extends this result to general graphs, proving Theorem 1. 2 Preliminaries Since each 3-connected component of a planar graph has a unique embedding up to reflection, the structure of 3-connected components play an important role in the analysis of embeddings. Namely, the two-vertex cuts (also known as separation pairs) point to places where there is a choice in how to embed the graph. Similarly, any cutvertex (also known as articulation point) points to a freedom in the choice of embedding. In the following, we will define the BC tree and the SPQR tree which are structures that reflect the 2-connected components of a connected graph and the 3-connected components of a 2-connected graph, respectively. Then, related to the understanding of a combinatorial embedding, we will define flips which are local changes to the embedding, and the notion of flip distance between embedded graphs. 3 BC trees, as described in [9, p. 36], reflect the 2-connected components and their relations. Definition 4. Let x be a vertex in a connected loopless multigraph G. Then x is an articulation point if G − {x} is not connected. Definition 5. A (strict) BC tree for a connected loopless multigraph G = (V, E) with at least 1 edge is a tree with nodes labelled B and C, where each node v has an associated skeleton graph Γ(v) with the following properties: • For every node v in the BC tree, V (Γ(v)) ⊆ V . • For every edge e ∈ E there is a unique node v = b(e) in the BC tree such that e ∈ E(Γ(v)). • For every edge (u, v) in the BC tree, V (Γ(u)) ∩ V (Γ(v)) (cid:54)= ∅ and either u or v is a C node. • If v is a B node, Γ(v) is either a single edge or a biconnected graph. • If v is a C node, Γ(v) consists of a single vertex, which is an articulation point in G. • No two B nodes are neighbors. • No two C nodes are neighbors. The BC tree for a connected graph is unique. The (skeleton graphs associated with) the B nodes are sometimes referred to as G's biconnected components. In this paper, we use the term relaxed BC tree as defined in [12] to denote a tree that satisfies all but the last condition. Unlike the strict BC tree, the relaxed BC tree is not unique. SPQR trees Reflecting the structure of the 3-connected components, we rely on the SPQR tree. Definition 6 (Hopcroft and Tarjan [13, p. 6]). Let {a, b} be a pair of vertices in a biconnected multigraph G. Suppose the edges of G are divided into equivalence classes E1, E2, . . . , Ek, such that two edges which lie on a common path not containing any vertex of {a, b} except as an end-point are in the same class. The classes Ei are called the separation classes of G with respect to {a, b}. If there are at least two separation classes, then {a, b} is a separation pair of G unless (i) there are exactly two separation classes, and one class consists of a single edge1, or (ii) there are exactly three classes, each consisting of a single edge2 Definition 7 ([10]). The (strict) SPQR tree for a biconnected multigraph G = (V, E) with at least 3 edges is a tree with nodes labeled S, P, or R, where each node x has an associated skeleton graph Γ(x) with the following properties: and there is a virtual edge ab in each of Γ(x) and Γ(y) that corresponds to (x, y). • For every node x in the SPQR tree, V (Γ(x)) ⊆ V . • For every edge e ∈ E there is a unique node x = b(e) in the SPQR tree such that e ∈ E(Γ(x)). • For every edge (x, y) in the SPQR tree, V (Γ(x)) ∩ V (Γ(y)) is a separation pair {a, b} in G, • For every node x in the SPQR tree, every edge in Γ(x) is either in E or a virtual edge. • If x is an S node, Γ(x) is a simple cycle with at least 3 edges. • If x is a P node, Γ(x) consists of a pair of vertices with at least 3 parallel edges. • If x is an R node, Γ(x) is a simple triconnected graph. • No two S nodes are neighbors, and no two P nodes are neighbors. The SPQR tree for a biconnected graph is unique (see e.g. [5]). In this paper, we use the term relaxed SPQR tree as defined in [12] to denote a tree that satisfies all but the last condition. Unlike the strict SPQR tree, the relaxed SPQR tree is not unique. 1So in a triconnected graph, the endpoints of an edge do not constitute a separation pair. 2So the graph consisting of two vertices connected by 3 parallel edges is triconnected. 4 Pre-split BC trees and SPQR trees. Once the BC tree or the SPQR is rooted, one may form a path decomposition [18] over them. Given a connected component, one may form its BC tree and an SPQR tree for each block. In [12], we show how to obtain a balanced combined tree for each component, inspired by [3], where the heavy paths reflect not only the local SPQR tree of a block, but also the weight of the many other blocks. Given a heavy path decomposition, [12] introduced presplit versions of BC trees and SPQR trees, in which cutvertices, P nodes and S nodes that lie internal on heavy paths have been split in two, thus transforming the strict BC tree or SPQR tree into a relaxed BC or SPQR tree. In [11] we give a structure for maintaining a planar embedded graph subject to Flip-finding. edge deletions, insertions across a face, and flips changing the embedding. It operates using the tree-cotree decomposition of a connected plane graph; for any spanning tree, the non-tree edges form a spanning tree of the dual graph where faces and vertices swap roles. The data structure allows the following interesting operation: Mark a constant number of faces, and search for vertices along a path in the spanning tree that are incident to all marked faces. Or, dually, mark a number of vertices and search for faces along a path in the cotree. This mark-and-search operation is supported in O(log2 n) time. Originally, in [11], we use the mark-and-search operation to detect single flips necessary to bring a pair of vertices to the same face. It turns out this operation is more powerful than previously assumed, and we will use it as part of the machinery that finds all the possibly many flips necessary to bring a pair of vertices to the same face. In [12], a class of good embeddings are provided that share the property that Good embeddings any edge that can be added without violating planarity only requires O(log n) flips to the current embedding. The good embeddings relate to the dynamic balanced heavy path decompositions of BC trees and SPQR trees in the following way: For all the articulation points and separation pairs that lie internal on a heavy path, the embedding of the graph should be favorable to the possibility of an incoming edge connecting the endpoints of the heavy path, if possible. No other choices to the embedding matter; the properties of the heavy path decomposition ensure that only O(log n) such choices may be unfavorable to accommodating any planarity-preserving edge insertion. Projections and meets For vertices x, y, and z on a tree, we use meet(x, y, z) to denote the unique common vertex on all 3 tree paths between x, y, and z. Alternatively meet(x, y, z) can be seen as the projection of x on the tree path from y to z. For a vertex x and a fundamental cycle C in a graph with some implied spannning tree, let πC(x) denote the projection of x on C. Note that if (y, z) is the non-tree edge closing the cycle C then πC(x) = meet(x, y, z). 3 Analyzing the number of flips in the lazy greedy algorithm This section is dedicated to the proof of Lemma 3. We define some distance measures and a concept of good embeddings, and single out exactly the properties of these that would be sufficient for the lazy analysis to go through. All proofs that these sufficient conditions indeed are met are deferred to Section 6, thus enabling us to give an overview within the first limited number of pages. Definition 8. We will consider only two kinds of flips: • An articulation flip at a takes a single contiguous subsequence of the edges incident to a out, • A separation flip at s, t reverses a contiguous subsequence of the edges incident to each of s, t. possibly reverses their order, and inserts them again, possibly in a different position. 5 Definition 9. We will distinguish between two types of separation flips at s, t: • In a P flip, each of the two subgraphs consist of at least 2 {s, t}-separation classes. • In an SR flip, at least one of the two subgraphs consist of a single {s, t}-separation class. Definition 10. A separation flip at s, t is clean if the first and last edges in each of the subsequences being reversed are biconnected, and dirty otherwise. A clean separation flip preserves the sets of edges that could participate in an articulation flip. All articulation flips are considered clean. Definition 11. Given vertices u, v, a flip is called critical (for u, v) if exactly one of u and v is in the subgraph being flipped. Definition 12. For a planar graph G, let Emb(G) denote the graph whose nodes are planar embeddings of G, and (H, H(cid:48)) is an edge if H(cid:48) is obtained from H by applying a single flip. As a slight abuse of notation we will also use Emb(G) to denote the set of all planar embeddings of G. Furthermore, for vertices u, v in G let Emb(G; u, v) denote the (possibly empty) set of embeddings of G that admit insertion of (u, v). We will often need to discuss distances in some (pseudo)metric between a particular embedding H ∈ Emb(G) and some particular subset of embeddings S ⊆ Emb(G). For this, we define (for any metric or pseudometric dist) dist(H, S) = dist(S, H) := min H(cid:48)∈S dist(H, H(cid:48)) Definition 13. For any two embeddings H, H(cid:48) of the planar graph G, that is, H, H(cid:48) ∈ Emb(G), we say that a path from H to H(cid:48) in Emb(G) is clean if every flip on the path is clean. • Let distclean(H, H(cid:48)) be the length of a shortest clean path from H to H(cid:48). • Let distsep(H, H(cid:48)) be the minimum number of separation flips on a clean path from H to H(cid:48). • Let distP (H, H(cid:48)) be the minimum number of P flips on a clean path from H to H(cid:48). Observation 14. distclean is a metric, and distsep and distP are pseudometrics, on Emb(G). In Section 6, we define two families of functions related to these particular (pseudo) metrics. Intuitively, for each τ ∈ {clean, sep, P}, any planar graph G containing vertices u, v, and any embedding H ∈ Emb(G): • critical-costτ (H; u, v) is the number of flips of type τ needed to accommodate (u, v) (if possible). • solid-costτ (H; u, v) is the number of flips of type τ needed to reach a "good" embedding that accommodates (u, v) (if possible). We will state the properties we need for these functions here, in the form of Lemmas (to be proven once the actual definition has been given). Lemma 15. For any planar graph G with vertices u, v, and any embedding H ∈ Emb(G), solid-costτ (H; u, v) ≥ critical-costτ (H; u, v) ≥ 0 solid-costclean(H; u, v) ≥ solid-costsep(H; u, v) ≥ solid-costP(H; u, v) critical-costclean(H; u, v) ≥ critical-costsep(H; u, v) ≥ critical-costP(H; u, v) And if G ∪ (u, v) is planar, critical-costclean(H; u, v) = 0 ⇐⇒ H ∈ Emb(G; x, y) 6 Lemma 16. Let u, v be vertices in a planar graph G, let H ∈ Emb(G) and let H(cid:48) ∈ Emb(G) be the result of a single flip σ in H. Define ∆ critical-costτ := critical-costτ (H(cid:48); u, v) − critical-costτ (H; u, v) ∆ solid-costτ := solid-costτ (H(cid:48); u, v) − solid-costτ (H; u, v) then ∆ critical-costτ ∈ {−1, 0, 1}, ∆ solid-costτ ∈ {−1, 0, 1}, and ∆ critical-costτ (cid:54)= 0 =⇒ σ is a critical flip ⇐⇒ ∆ solid-costτ = ∆ critical-costτ Lemma 17. Let u, v be vertices in a planar graph G, and let H ∈ Emb(G). • If critical-costτ (H; u, v) > 0 then there exists a clean flip in H such that the resulting H(cid:48) ∈ • If solid-costτ (H; u, v) > 0 then there exists a clean flip in H such that the resulting H(cid:48) ∈ Emb(G) has critical-costτ (H(cid:48); u, v) < critical-costτ (H; u, v). Emb(G) has solid-costτ (H(cid:48); u, v) < solid-costτ (H; u, v). The main motivation for defining critical-cost comes from the following Corollary 18. Let G be a planar graph, let u, v be vertices in G such that G ∪ (u, v) is planar, and let H ∈ Emb(G). Then Proof. "≥" follows from Lemmas 15 and 16, and "≤" follows from Lemma 17. distτ (H, Emb(G; u, v)) = critical-costτ (H; u, v). With these properties in hand, we can now redefine what we mean by a good embedding in a quantifiable way: Definition 19. Given a planar graph G with vertices u, v, the good embeddings of G with respect to u, v is the set Emb(cid:63)(G; u, v) := {H ∈ Emb(G) solid-costclean(H; u, v) = 0} And the set of all good embeddings of G is (cid:91) u,v Emb(cid:63)(G) := Emb(cid:63)(G; u, v) = {H ∈ Emb(G) min u,v solid-costclean(H; u, v) = 0} Note that this definition is not the same as in [12], although the underlying ideas are the same. With this definition, we get Corollary 20. Let G be a planar graph, let u, v be vertices in G, and let H ∈ Emb(G). Then distτ (H, Emb(cid:63)(G; u, v)) = solid-costτ (H; u, v) distτ (H, Emb(cid:63)(G)) = min u,v solid-costτ (H; u, v) Proof. "≥" follows from Lemmas 15 and 16, and "≤" follows from Lemma 17. The reason we call these embeddings good is the following property 7 Lemma 21. Given a planar graph G with vertices u, v and any H ∈ Emb(cid:63)(G), then distclean(H, Emb(cid:63)(G; u, v)) ∈ O(log n) Corollary 22. Given a planar graph G with vertices u, v and any H ∈ Emb(G), then distτ (H, Emb(cid:63)(G)) ≤ distτ (H, Emb(cid:63)(G; u, v)) ≤ distτ (H, Emb(cid:63)(G)) + O(log n) Proof. The first inequality follows from Emb(cid:63)(G) ⊇ Emb(cid:63)(G; u, v). For the second, let H(cid:48) ∈ Emb(cid:63)(G) minimize distτ (H, H(cid:48)). By Corollary 20 and Lemmas 15 and 21, distτ (H(cid:48), Emb(cid:63)(G; u, v)) ≤ distclean(H(cid:48), Emb(cid:63)(G; u, v)) ∈ O(log n) and the result follows by the triangle inequality. Lemma 23. Given a planar graph G with vertices u, v, such that G ∪ (u, v) is planar, and any H ∈ Emb(G; u, v). Then solid-costτ (H; u, v) = solid-costτ (H ∪ (u, v); u, v) Everything so far has been stated in terms of clean flips. Most of our results do not depend on this, due to the following lemma (Proved in Section 6.3). Lemma 24. A dirty separation flip corresponds to a clean separation flip and at most 4 articulation flips. At most one of these 5 flips change solid-costτ or critical-costτ . Theorem 25. Let p, q, r ∈ N0 be nonnegative integer constants. Let A be a lazy greedy algorithm for maintaining a planar embedding with the following behavior: • A does no flips during edge deletion; and • during the attempted insertion of the edge (u, v) into an embedded graph H, A only uses critical • this sequence of flips can be divided into steps of at most r flips, such that each step (except flips; and possibly the last) decreases the following potential by at least 1: critical-costclean(H; u, v) + p · critical-costsep(H; u, v) + q · critical-costP(H; u, v) Then, A uses amortized O(log n) steps per attempted edge insertion. Proof. Let G be a planar graph with vertices u, v, such that G ∪ (u, v) is planar, let H0 ∈ Emb(G) be the embedding before inserting (u, v) and let H1, . . . , Hk ∈ Emb(G) be the embedded graphs after each "step" until finally Hk ∈ Emb(G; u, v). Define distalg = distclean +p · distsep +q · distP. Then distalg is a metric on Emb(G), and for each H ∈ Emb(G) we can define Φ(H) = distalg(H, Emb(cid:63)(G)) Φ(H; u, v) = distalg(H, Emb(cid:63)(G; u, v)) By Corollary 22 Φ(H) ≤ Φ(H; u, v) ≤ Φ(H) + O(log n). By assumption, distalg(H, Emb(G; u, v)) is strictly decreasing in each step, and by Lemma 16, Φ(H; u, v) decreases by exactly the same amount. In particular, after k steps it has decreased by at 8 Emb(G) X0 k Emb(G; u, v) Xk 0 Xk ∪ (u, v) Emb(G ∪ (u, v)) Φ(X0) Φ(X0; u, v) ≤ Φ(X0) + O(log n) Φ(Xk; u, v) ≤ Φ(X0; u, v) − k Φ(Xk ∪ (u, v); u, v) = Φ(Xk; u, v) Φ(Xk ∪ (u, v)) ≤ Φ(Xk ∪ (u, v); u, v) H ∈ Emb(cid:63)(G) O(log n) Y ∈ Emb(cid:63)(G; u, v) 0 Y (cid:48) ∈ Emb(cid:63)(G ∪ (u, v); u, v) O(log n) H(cid:48) ∈ Emb(cid:63)(G ∪ (u, v)) Figure 2: Illustration of the proof of Theorem 25. least k, so Φ(Hk; u, v) ≤ Φ(H0; u, v)−k ≤ Φ(H0)+O(log n)−k. By Lemma 23, Φ(Hk∪(u, v); u, v) = Φ(Hk; u, v), so Φ(Hk ∪ (u, v)) ≤ Φ(Hk ∪ (u, v); u, v) = Φ(Hk; u, v) ≤ Φ(H0; u, v) − k ≤ Φ(H0) + O(log n) − k The same argument holds when an attempted insert stops after k steps because G ∪ (u, v) is not planar. Since the potential Φ(H) increases by at most O(log n) and drops by at least the number of steps used, the amortized number of steps for each attempted insert is O(log n). For deletion it is even simpler, as Φ(H − (u, v)) ≤ Φ(H − (u, v); u, v) = Φ(H; u, v) ≤ Φ(H) + O(log n) Thus, each deletion increases the potential by O(log n). However, as we start with an empty edge set, the number of deletions is upper bounded by the number of insertions, and so each edge can instead pay a cost of O(log n) steps when inserted to cover its own future deletion. In other words, deletions are essentially free. As a direct consequence, our main lemma holds. Lemma 3. Any algorithm for maintaining a fully dynamic planar embedding that for each attempted edge-insertion greedily does the minimal number of flips, and that for each edge deletion lazily does nothing, will do amortized O(log n) flips per insertion when starting with an empty graph (or amortized over Ω(n/ log n) operations). Proof. Set p = q = 0 and r = 1 in the lemma above, and the result follows. Our algorithm may not decrease critical-cost in every step. To simplify the description of how and when it changes, we associate each type of flip with one of the critical-costτ as in Corollary 27: • A P flip is associated with critical-costP • An SR flip is associated with critical-costsep • An articulation flip is associated with critical-costclean 9 A flip is potential-decreasing/potential-neutral/potential-increasing if it changes its associated cost by −1/0/1 respectively. Using the following lemma (proved in Section 6) Lemma 26. Any SR flip or articulation flip leaves critical-costP and solid-costP unchanged, and any articulation flip leaves critical-costsep and solid-costsep unchanged. we can simplify Theorem 25 to. Corollary 27. Let A be a lazy greedy algorithm for planar embeddings that does no flips during edge deletion, and that during attempted edge insertion only uses critical flips such that • Each flip (except possibly the last) is potential-decreasing or potential-neutral. • For some constant r, no sequence of r consecutive flips are potential-neutral. Then A uses amortized O(log n) steps per attempted edge insertion. Proof. Simply use p = r + 1, q = r2 + 2r + 1, r = r in Theorem 25, and note that Lemma 26 guarantees the resulting potential is strictly decreasing in each round of at most r flips. 4 A Greedy Flip-Finding Algorithm We use the data structure from [11] to represent the current embedding. This structure maintains interdigitating spanning trees (also known as the tree co-tree decomposition) for the primal and dual graphs under flips, admissible edge insertions, and edge deletions in worst case O(log2 n) time per operation. In particular it supports the linkable(u, v) operation, which in worst case O(log2 n) time either determines that u and v has no face in common and returns "no", or returns some pair of corners ((u, f ), (v, f )) where f is a common face. Furthermore, the structure allows for a mark-and-search operation, in which a constant number of faces may be "marked", and vertices along a path on the spanning tree that are incident to all marked faces may be sought after in O(log2 n) time. (Dually, one may mark vertices and search for faces in the same time, ie. O(log2 n).) 4.1 Algorithm overview We want to use this structure to search for the flips needed to insert a new edge (u, v) that is not admissible in the current embedding. For simplicity, we will present an algorithm that fits the framework in Corollary 27, rather than insisting on finding a shortest sequence of clean flips. This is sufficient to get amortized O(log n) flips, and with O(log2 n) overhead per flip, amortized O(log3 n) time for (attempted) edge insertion. If desired, the algorithm can be made to detect if it has made non-optimal flips and backtrack to use an optimal sequence of flips without affecting the asymptotic amortized running time. At the highest possible level of abstraction, our algorithm is just the multi-flip-linkable routine from Algorithm 1. In the following we will go into more detail and provide detailed proofs. We will assume full knowledge of how to use the mark-and-search features from [11] to e.g. search a path in the dual tree for the first face containing a given pair of vertices. Let a1, . . . , ak−1 be the articulation points on u··· v, and let a0 = u and ak = v. For 1 ≤ i ≤ k let Bi be the biconnected component (or bridge) containing ai−1 ··· ai. Our algorithm "cleans up" this path by sweeping from a0 = u to ak = v. At all times the algorithm keeps track of a latest 10 if u(cid:48), v biconnected then u(cid:48) ← u while u(cid:48) (cid:54)= v do Algorithm 1 1: function multi-flip-linkable(u, v) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: return "yes" else v(cid:48) ← v v(cid:48) ← first articulation point on u(cid:48) ··· v. if not do-separation-flips(u(cid:48), v(cid:48)) then do-articulation-flips(u, u(cid:48), v(cid:48), v) (cid:46) Now u shares a face with v(cid:48), and (if v(cid:48) (cid:54)= v) with at least one edge in Bi+2. u(cid:48) ← find-next-flip-block(u, u(cid:48), v(cid:48), v) return "no" (cid:46) Do all separation flips needed in Bi+1. (cid:46) Do articulation flips required by Bi+1. (cid:46) Skip to next relevant ai (cid:46) u, v are now in same face articulation point u(cid:48) = ai seen on u··· v (initially u(cid:48) = a0 = u) such that either u(cid:48) = u or (u, u(cid:48)) is admissible in the current embedding. We will further maintain the invariant that (unless i = k) there is a common face of u and ai that contains at least one edge from Bi+1. In the round where u(cid:48) = ai the algorithm sets v(cid:48) = ai+1 and does the following: 1. It finds and applies all separation flips in Bi+1 needed to make (ai, ai+1) admissible, or detects (after some number of flips) that Bi+1 ∪ (ai, ai+1) -- and therefore G ∪ (u, v) -- is nonplanar. 2. It finds at most one articulation flip at u(cid:48) and at most one articulation flip at v(cid:48), such that afterwards u shares a face with v(cid:48) = ai+1, and (if v(cid:48) (cid:54)= v) with at least one edge from Bi+2. 3. It finds the first aj with j ≥ i + 1 such that either: the next iteration of the loop finds at least one flip; or no more flips are needed and aj = v. It then sets u(cid:48) ← aj. The algorithm stops when u(cid:48) = v. By our invariant (u, v) is admissible if it reaches this point. Lemma 28. If G ∪ (u, v) is planar and H0 ∈ Emb(G), this algorithm finds a sequence of graphs H1, . . . , Hk ∈ Emb(G) such that Hk ∈ Emb(G; u, v). The main loop performs O(k) iterations. Proof. If G ∪ (u, v) is planar, then for every block Bi+1 there exists some (possibly empty) set of separation flips such that H ∪ (ai, ai+1) is planar. Thus, after line 8 we know that ai and ai+1 share a face. And by our invariant, we also know that u = a0 and u(cid:48) = ai share a face, incident to at least one edge from Bi+1. the invariant so u shares a face with v(cid:48) and (if v (cid:54)= v(cid:48)) with at least one edge in Bi+2. Now the call to do-articulation-flips in line 10 uses at most 2 articulation flips to update Finally, the call to find-next-flip-block in line 12, updates u(cid:48) to the largest aj so the invariant still holds. In particular, either a separation flip is needed in Bj+1, or an articulation flip is needed in aj+1 before the face shared by u = a0 and aj+1 is incident to an edge in Bj+2. Thus, in every iteration after (possibly) the first, at least one flip is performed. Thus if we stop We stop with H (cid:54)∈ Emb(G; u, v) only if there is a block Bi+1 where do-articulation- Otherwise we keep making progress, and will eventually have u(cid:48) = v. By our invariant (u, v) are after k flips, the number of iterations is at most k + 1. flips(ai, ai+1) returns "no" because we have detected that G ∪ (u, v) is nonplanar. now in the same face, and thus Hk ∈ Emb(G; u, v). 11 4.2 find-next-flip-block The simplest part of our algorithm is the find-next-flip-block function in Algorithm 2 we use to move to the next "interesting" articulation point, or to vertex v if we are done. By interesting is meant the following: it is an articulation point aj on the BC-path from u to v such that a flip in either aj, Bj+1, or aj+1 is necessary in order to bring u and v to the same face. (cid:46) u shares a face with v(cid:48), and (if v(cid:48) (cid:54)= v) with at least one edge in Bi+2. if v(cid:48) (cid:54)= v then (cid:46) fu is incident to u. Algorithm 2 1: function find-next-flip-block(u, u(cid:48), v(cid:48), v) 2: 3: 4: 5: 6: 7: 8: 9: 10: fu, c1 fv, c1 if fu = fv then u ← find-bounding-face(u, v(cid:48), v) v ← find-bounding-face(v, v(cid:48), u) return v(cid:48) u, c2 v, c2 if v incident to fu then return last internal node on u··· v touching fu on both sides. return v 11: function find-bounding-face(u, a, v) 12: 13: 14: 15: cu ← any corner incident to u; cv ← any corner incident to v f ← first face on the dual path cu ··· cv touching a on both sides. cL, cR ← first corners on left and right side of cu ··· cv that are incident to both a and f. return f, cL, cR Lemma 29. If a0 and ai+1 share a face containing at least one edge from Bi+2, then in worst case O(log2 n) time find-next-flip-block(a0, ai, ai+1, ak) either returns the last aj (i < j < k) such that a0 and aj share a face containing at least one edge from Bj+1; or ak if a0 and ak share a face. Proof. First note that the running time is O(log2 n) because the dominating subroutine is the mark- and-search algorithm from [11] called a constant number of times in Find-bounding-face(. . .), and once on line 9. For correctness, assume a = ai+1 is an articulation point separating u = a0 from v = ak. Then there is at least one articulation point in the dual graph incident to a, and all such articulation points lie on a path in the dual tree. By assumption, u lies in the bounding face of ai and ai+1, that is, in the face f returned by Find-bounding-face(u, ai, ai+1). Now there are four basic cases: 1. If ai+2 does not lie in f, then we have indeed reached a block where flips are necessary, and the algorithm returns ai+1 as desired. (See Figure 3) 2. On the other hand, if ai+2 lies in f but only has corners incident to f on one side, then we are in a case where a flip in ai+2 is necessary to bring u to the same face as v, and the algorithm returns ai+1 as desired. (See Figure 4) 3. Thirdly, it may be the case that ai+2 is incident to f on both sides of the path, in which case no flips in ai+1, Bi+1, or ai+2 are necessary. In this case there is a non-trivial segment of articulation points ai+1, ai+2, . . . that lie in f. Our algorithm will now return the last such aj incident to f on both sides of the path. Here, we have two sub-cases. If aj+1 is not incident to f, this indicates that either we have reached a point aj where an articulation flip is needed, or, 12 we have reached a block Bj where flips are needed. On the other hand, if aj+1 is incident to f but only on one side, we are in the case where an articulation flip in aj+1 is needed to bring u and v to the same face. In both cases, our algorithm returns aj as desired. (See Figure 5) 4. Finally, we may be in the case where v lies in the same face as u and we are done, but in this case, the face f must be the shared face: Namely, since u and v are separated by at least one articulation point a in the primal graph with a incident to some face f on both sides of the tree-path from u to v, then there is a 2-cycle through f and a in the vertex-face graph separating u from v, and thus, f must be the unique face shared by all articulation points on any path u··· v. (See Figure 6) a0 B1 a1 ai ai+1 Bi+2 ai+2 Bi+1 Figure 3: Lemma 29 case 1: ai+2 does not lie in f. find-next-flip-block(a0, ai, ai+1, ak) returns ai+1. a0 B1 a1 ai ai+1 Bi+2 Bi+1 ai+3 ai+2 Figure 4: Lemma 29 case 2: find-next-flip-block(a0, ai, ai+1, ak) returns ai+1. the path a0 ··· ak touches f on only one side in ai+2. a0 B1 a1 ai ai+1 Bi+2 Bi+1 ai+2 aj−1 aj Bj Bj+1 ak Figure 5: Lemma 29 case 3: find-next-flip-block(a0, ai, ai+1, ak) returns aj with i + 1 < j < k. a0 B1 a1 ai ai+1 Bi+2 Bi+1 ai+2 ak−1 ak Bk Figure 6: Lemma 29 case 4: find-next-flip-block(a0, ai, ai+1, ak) returns ak. 4.3 do-articulation-flips The next piece of our algorithm is the do-articulation-flips function in Algorithm 3. Lemma 30. If a0 and ai share a face containing at least one edge from Bi+1, and ai and ai+1 share a face, then in O(log2 n) time do-articulation-flips(a0, ai, ai+1, ak) does at most one articulation 13 if u = u(cid:48) then if v(cid:48) = v then (cid:46) Nothing to do else else if v(cid:48) = v then v ← find-bounding-face(v, v(cid:48), u) u ← find-bounding-face(u, u(cid:48), v) fv, c1 v, c2 if fv not incident to u(cid:48) then cu, cv ← linkable(u(cid:48), v(cid:48)) articulation-flip(c1 v, c2 Algorithm 3 Require: u(cid:48), v(cid:48) linkable 1: function do-articulation-flips(u, u(cid:48), v(cid:48), v) 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: (cid:46) Nothing to do cu ← any corner between u(cid:48) and fv articulation-flip(c1 cv ← any corner between v(cid:48) and fu articulation-flip(c1 v, c2 cu, cv ← linkable(u(cid:48), v(cid:48)) articulation-flip(c1 u, c2 articulation-flip(c1 v, c2 fu, c1 u, c2 if fu not incident to v(cid:48) then cu, cv ← linkable(u(cid:48), v(cid:48)) articulation-flip(c1 u, c2 v ← find-bounding-face(v, v(cid:48), u) u ← find-bounding-face(u, u(cid:48), v) v, c2 u, c2 fv, c1 fu, c1 if fu = fv then else if u(cid:48) incident to fv then u, c2 else if v(cid:48) incident to fu then u, cu) else u (cid:54)= u(cid:48) and v(cid:48) (cid:54)= v else v, cv) u, cu) v, cv) u, cu) v, cv) flip at each of ai and ai+1, each of which are critical. Afterwards, a0 shares a face with ai+1, and (if i ≤ k − 2) with at least one edge in Bi+2. Proof. The running time of do-articulation-flips(··· ) is O(log2 n) because it does a constant number of calls to find-bounding-face(··· ), linkable(··· ), and articulation-flip(··· ), which each take worst case O(log2 n) time. The number and location of the articulation flips done is likewise clear from the definition, and since each of the flips move exactly one of u and v, any flips done are critical. • If no articulation flips are done: u and v are already in the same face. (See Figure 7) • If an articulation flip is done at v(cid:48) = ai+1 but not at u(cid:48) = ai: Bi+2 is flipped into a face containing u in line 9 if u = u(cid:48), or a face containing u(cid:48) and Bi (and hence u) in line 26 otherwise. (See Figure 8) 14 • If an articulation flip is done at u(cid:48) = ai but not at v(cid:48) = ai+1: Bi (and hence u) is flipped into a face containing v(cid:48) in line 15 if v(cid:48) = v, or a face containing v(cid:48) and Bi+2 in line 23 otherwise. (See Figure 9) • If articulation flips are done at both u(cid:48) = ai and v(cid:48) = ai+1: Both Bi (and hence u) and Bi+2 are flipped into the same face in lines 29 -- 30. (See Figure 10) In each case the postcondition is satisfied. a0 ai−1 ai Bi Bi+1 ai+1 Bi+2 ai+2 Figure 7: do-articulation-flips(a0, ai, ai+1, ak): If fu = fv there is nothing to do. ai Bi ai−1 a0 fu ai+1 ai+2 Bi+2 fv Bi+1 Figure 8: do-articulation-flips(a0, ai, ai+1, ak): When fu (cid:54)= fv and ai+1 ∈ fu, we may use any corner between fu and ai+1 to flip Bi+2 into. a0 ai−1 Bi ai fv fu Bi+1 ai+2 ai+1 Bi+2 Figure 9: do-articulation-flips(a0, ai, ai+1, ak): When fu (cid:54)= fv and ai ∈ fv, we use any corner between fv and ai to flip Bi into. a0 ai−1 ai Bi fu Bi+1 ai+1 Bi+2 ai+2 fv Figure 10: do-articulation-flips(a0, ai, ai+1, ak): When ai+1 (cid:54)∈ fu and ai (cid:54)∈ fv, use a linkable(ai, ai+1) query to find the corners where (ai, ai+1) could be inserted, and flip into those corners. 15 Lemma 31. During execution of multi-flip-linkable(u, v), the pattern of articulation flips is as follows: • If do-articulation-flips(a0, ai, ai+1, ak) does a flip at ai, it is potential-decreasing. • If do-articulation-flips(a0, ai, ai+1, ak) does a flip at ai+1 that is not potential-decreasing, then it is potential-neutral, the following find-next-flip-block(a0, ai, ai+1, ak) returns ai+1, and in the next iteration either: -- do-separation-flips(ai+1, ai+2) returns "no"; or -- do-separation-flips(ai+1, ai+2) does at least one flip; or -- do-articulation-flips(a0, ai+1, ai+2, ak) does a potential-decreasing articulation flip at ai+1. Proof. If do-articulation-flips(a0, ai, ai+1, ak) does a flip at u(cid:48) = ai, it is because u and v(cid:48) does not yet share a face and at least one flip at ai is needed to bring them together. By our invariants, u does share a face with both ai and at least one edge of Bi+1. Observe that no amount of clean separation flips can help bringing them together, and thus any clean path in Emb(G) from H to H(cid:48) ∈ Emb(G; u, v) contains at least one separation flip at ai. In particular, any shortest path contains exactly one such flip, and thus this flip is potential-decreasing. On the other hand, if do-articulation-flips(a0, ai, ai+1, ak) does a flip at u(cid:48) = ai+1 because some other block B(cid:48) is incident to ai+1 on both sides of u··· v, then it can happen that (after all separation flips in Bi+2 are done) u is still not sharing a face with ai+2 even though ai+1 is (See Figure 11). In this case, a second articulation flip is needed at ai+1 (which will be potential- decreasing). However, if ai shares a face with B(cid:48), the first flip at ai+1 could have been skipped, and we would reach the invariant state with one fewer flips. In this case, and only this case, the first flip the algorithm does at ai+1 is potential-neutral. Now observe that if we do such a potential-neutral flip, the following find-next-flip-block(a0, ai, ai+1, ak) must return ai+1, because either ai+1 does not share a face with ai+2 and do-separation-flips(ai+1, ai+2) will behave as described, or ai+1 does share a face with ai+2 but a0 does not share a face with ai+2 so the second articulation flip at ai+1 is done as described. a0 B1 a1 ai Bi+1 ai+1 ai+2 B(cid:48) Bi+2 Figure 11: Example where do-articulation-flips makes a potential-neutral flip at ai+1, moving Bi+2 into the outer face. With or without this flip, we still need to flip B1 ··· Bi+1 into a face containing ai+2. If u, v are biconnected (do-separation-flips) 4.4 The remaining piece of our algorithm, and by far the most complicated, consists of the do- separation-flips function in Algorithm 4, and its subroutines. 16 The general idea in do-separation-flips(u, v) is to repeatedly find and apply a separation flip σ (uniquely described by a tuple of 4 corners forming a 4-cycle in the vertex-face graph), such that • The vertices incident to σ form a separation pair {s, t}, separating u from v. • u is incident to at least one of the faces fu, fv incident to σ. • σ partitions (the edges of) H into two subgraphs Hu, Hv, with u ∈ Hu\{s, t} and v ∈ Hv\{s, t}. We call such a flip a u-flip (w.r.t. v), and the corresponding Hu a u-flip-component (w.r.t. v). We call a u-flip maximal if it maximizes the size (e.g. edges plus vertices) of Hu. A given u-flip-component Hu remains a u-flip-component if we flip it, so we may require that each step flips a strictly larger subgraph than the previous. If no strictly larger Hu exists and u and v still do not share a face, we conclude that G ∪ (u, v) is nonplanar and stop. Algorithm 4 1: function do-separation-flips(u, v) 2: 3: 4: 5: 6: 7: 8: s ← 0 while not linkable(u, v) do s(cid:48), σ ← find-first-separation-flip(u, v) if s(cid:48) ≤ s then return "no" Execute separation flip σ s ← s(cid:48) return "yes" (cid:46) Separation flip needed in block bounded by u, v Lemma 32. Assume that find-first-separation-flip(u, v) runs in worst case O(log2 n) time, and in each step: • If G ∪ (u, v) is planar it finds a maximal u-flip. • If G ∪ (u, v) is non-planar it either: -- finds a maximal u-flip; or -- finds a u-flip such that the next u-flip-component found has the same size; or -- finds no u-flip. Then do-separation-flips(ai, ai+1) does only critical separation flips in worst case O(log2 n) time per flip, and: • If G ∪ (u, v) is planar, every flip is potential-decreasing. • If G ∪ (u, v) is nonplanar every flip except the last is potential-decreasing. Proof. The running time is worst case O(log2 n) per flip, by our assumption, and because the linkable(u, v) query and actually executing the flip takes O(log2 n) in the underlying data structure from [11]. By definition, any u-flip is a critical flip, so all the flips performed are critical. By assumption, each tuple of corners σ that we consider (except the last) bound a maximal u-flip- component. If the flip described by σ is a P flip, there may be two possible choices if the node containing u on the u, v-critical path in the SPQR tree is an S node. However, either choice is potential-decreasing, as it brings the two neighbors to the involved P node that are on the critical path together. If the flip described by σ is not a P flip, it is potential-decreasing unless the first node X that is not included in Hu on the u, v-critical path in the SPQR tree is an R node that is cross (i.e. the virtual edges in Γ(X) corresponding to the path do not share a face). If X is cross, G∪ (u, v) is nonplanar, and the flip will be the last we execute, since no larger Hu exists after the flip. 17 Let B = (VB, EB) be the biconnected component of G that contains u, v, and suppose u, v do not share a face in G (otherwise u and v would be linkable and find-first-separation-flip(u, v) would not be called). Consider the u, v-critical path X1 ··· Xk with u ∈ X1, v ∈ Xk in the SPQR tree for B. Observe that if k = 1 our assumption that u, v do not share a face means that X1 is an R node, and no flip exists that can make u and v linkable. Assume therefore that k > 1. Then X1 and Xk are distinct, and by definition of u, v-critical path none of them are P nodes. relationship with the SPQR nodes on the u, v-critical path X1 ··· Xk in the SPQR tree for B. Definition 33. Let eu and ev be the edges incident to u and v on the primal spanning tree path u··· v. For each i with 1 ≤ i ≤ k define: To aid in our discussion, we need to name certain subsets of the edges of EB based on their ∅ ∅ E<i := E>i := if i = 1 otherwise if i = k otherwise E≥i := EB \ E<i E≤i := EB \ E>i E(cid:54)=i := EB \ Ei the separation class of eu w.r.t. Xi−1∩Xi the separation class of ev w.r.t. Xi∩Xi+1 Ei := E≤i ∩ E≥i Now E1, . . . , Ek is a partition of EB, so for each e ∈ EB there is a unique index i = index(e) such that e ∈ Ei. Furthermore, for each 1 ≤ i ≤ k the set Ei is associated with the node Xi Since u and v are biconnected, there exists two internally vertex-disjoint paths between u and v. Let ps, pt be an arbitrary pair of internally vertex-disjoint paths from u to v. We will use ps and pt to define some further concepts, and then argue (e.g. in Lemmas 34 and 35) that these definitions do not depend on the particular choice of ps, pt. For 1 ≤ i ≤ k − 1 let {si, ti} = Xi ∩ Xi+1 such that si ∈ ps and ti ∈ pt, and let s0 = t0 = u and sk = tk = v. Let fu be any face maximizing the maximum i such that fu contains all of u, si, and ti. Note that the candidates for fu do not depend on the specific choice of ps and pt, but only on the structure of the SPQR tree and the current embedding. Together, ps ∪ pt form a simple cycle in G which we call a u, v-critical cycle. This cycle partitions the plane into two regions. Call the region containing fu the fu-side region and the other the anti-fu-side region. For each node Xi on the u, v-critical path in the SPQR tree, any u, v-critical cycle corresponds to a unique cycle in Γ(Xi), and the partition into fu-side and anti-fu-side regions carry over into Γ(Xi). • If Xi is a P node, we say that Xi is fu-blocking if the fu-side region of Γ(Xi) contains any • If Xi is an R node, we say that Xi is fu-blocking (resp. anti-fu-blocking) if the fu-side (resp. anti-fu-side) region of Γ(Xi) does not contain a face incident to all of si−1, ti−1, si, ti. (Note that this holds even for i = 1 and i = k). edges, and anti-fu-blocking if the anti-fu-side region contains any edges. • If Xi is an S node it is neither fu-blocking nor anti-fu-blocking. A node that is both fu-blocking and anti-fu-blocking is simply called blocking. A blocking R node is also called a cross node. Lemma 34. If G ∪ (u, v) is planar let r = k, otherwise let r be the minimum index such that Xr is a cross node. Then r is well-defined and depends only on G and the vertices u, v. 18 Proof. This is trivial if G ∪ (u, v) is planar, so suppose not. Then G ∪ (u, v) contains either a K5 subdivision containing (u, v) or a K3,3 subdivision containing (u, v). In particular, the SPQR tree for G ∪ (u, v) contains an R node whose skeleton graph contains such a subdivision. When deleting (u, v) from G∪ (u, v), this R node splits into the u, v-critical path X1 ··· Xk in G. This path contains at least one R node containing a K4 subdivision, and since G ∪ (u, v) is nonplanar, for at least one such R node Xi the vertices {si−1, ti−1, si, ti} = (Xi−1 ∩ Xi) ∪ (Xi ∩ Xi+1) do not all share a face in Γ(Xi). Lemma 35. Let r be defined as in Lemma 34. If u and v do not share a face, then for 1 ≤ i ≤ r whether Xi is (anti-)fu-blocking depends only on the choice of fu and the current embedding, and is independent of the particular choice of u, v-critical cycle. Proof. For any S or P node Xi with 2 ≤ i ≤ k, the vertices si and ti are completely determined by si−1 and ti−1, and do not depend on the particular choice of ps, pt. The same is true for every R node Xi with 2 ≤ i ≤ r − 1, since by definition of r these are not both fu- and anti-fu-blocking. Thus s2, . . . , sr−1 and t2, . . . , tr−1 are completely determined by s1, t1. There are only two possible ways to map {s1, t1} to the two vertices in X1 ∩ X2, so s1, . . . , sr−1 and t1, . . . , tr−1 are uniquely defined up to an exchange of every s and t with its opposite. Now consider any two u, v-critical cycles C1, C2, and a node Xi with 1 ≤ i ≤ r. • If Xi is an S node, it is by definition neiher fu- nor anti-fu-blocking, and this does not depend • If Xi is a P node, then 1 < i < r and the cycle in Γ(Xi) does not depend on which critical cycle is used, only on which neighbors Xi has on the u, v-critical path in the SPQR tree. Thus the definition of fu-side and anti-fu-side region, and hence Xis status as fu- or anti-fu-blocking does not depend on the choice of critical cycle, but only on the choice of fu and the current embedding. • If Xi is an R node, and is not cross there is a unique face of Γ(Xi) that contains all of si−1, si, ti−1, ti, and this face is in the fu-side region of C1 if and only if it is in the fu-side region of C2. Thus, Xi is fu- or anti-fu-blocking with respect to C1 if and only it is with respect to C2. • If Xi is a cross node, this does not depend on the choice of u, v-critical cycle but only on on the choice of critical cycle. G, u, v. By definition Xi is both fu- and anti-fu-blocking in both C1 and C2. Observation 36. Suppose u and v do not share a face, let fu be given, and let r be defined as in Lemma 34. Let b ∈ {1, . . . , r} be the minimum index such that Xb is fu-blocking. Then b depends only on u, v, the current embedding, and the choice of fu, and is independent of the particular choice of u, v-critical cycle. Since we assume k > 1, if b = 1 then by definition X1 is cross and no u-flip exists. For the remainder of this section, we will therefore assume that b > 1 (and thus 1 < b ≤ r ≤ k). In each step of our algorithm, to maximize the size of Hu we must find the face fu and the separation pair {sb−1, tb−1}. In addition, we must find a second face fv, such that Hu corresponds to the region on one side of the 4-cycle fu, sb−1, fv, tb−1 in the vertex-face graph. 4.4.1 choose-best-flip The first thing we observe is that if we can somehow guess (or compute) the faces fu and fv bounding (a candidate to) the maximal u-flip-component, then the function choose-best-flip(u, v, fu, fv) 19 from Algorithm 5 can compute the size and corners of the proposed flip. In addition, if a given pair of faces are "obviously not" bounding the maximal u-flip-component (either because no u-flip-component is bounded by these faces, or because a larger component can be easily found), this function can detect and report it. Definition 37. Define a u-flip-component Hu to be locally maximal if, given the corners σ, and the separation pair {sj, tj}, and faces f(cid:48) • No other u-flip-component bounded by f(cid:48) • No other u-flip-component incident to sj, tj and f(cid:48) Any maximal u-flip-component is also locally maximal, so any pair of faces that do not bound a v is larger than Hu; and u is larger than Hu. u, f(cid:48) u, f(cid:48) v incident to σ: locally maximal u-flip-component can be rejected. Lemma 38. Given vertices u, v that do not share a face and a 4-tuple of corners σ we can in worst case O(log2 n) time determine if σ bounds a locally maximal u-flip-component. Proof. Let fu, fv be the faces, and {sx, sy} the separation pair incident to σ. If u (cid:54)∈ fu or {u, v} ∩ {sx, sy} (cid:54)= ∅, σ does not bound a u-flip-component. Let Hu (cid:51) u, Hv be the subgraphs of H on the two sides of σ. If v (cid:54)∈ Hv then σ does not bound a u-flip-component, otherwise Hu is a u-flip-component and we must determine if it is locally maximal. Let C be the fundamental cycle in H closed by the first primal edge on the dual path fu ··· fv. Now C ∩ Hv is a path from sx to sy. If any internal node on this path is incident to both fu and fv, then Hu is not locally maximal. Let e∗ be the dual of the first edge on the primal tree path sx ··· sy, and let C∗ be the fundamental cycle closed by e∗ in the dual tree. Then σ cuts C∗ into an fu ··· fv path through each of Hu ∗ and ∗ that is incident to both sx and ∗. Let f(cid:48) Hv u (cid:51) u, H(cid:48) sy, and let σ(cid:48) be any 4 corners between (fv, sx), (fv, sy), (f(cid:48) v, sy). Let H(cid:48) v be the subgraphs of H on the two sides of σ(cid:48). If v (cid:54)∈ H(cid:48) v then Hu is not locally maximal. Otherwise Hu is locally maximal. Each step of this test can be done in worst case O(log2 n) time v be the first face on the path from fv to fu in C∗ ∩ Hv v, sx), (f(cid:48) using the data structure from [11]. Lemma 39. Let fu, fv be faces. If fu, fv are incident to the corners σ bounding a locally maximal u-flip-component Hu, then choose-best-flip(u, v, fu, fv) in Algorithm 5 returns a tuple (s, σ) where s is the size of Hu. Otherwise (0,⊥) is returned. In either case, the total time is worst case O(log2 n). Proof. If fu, fv are valid then by definition u ∈ fu and u (cid:54)∈ fv (and thus fu (cid:54)= fv). Let e be any primal edge on the dual tree path from fu to fv, and consider the fundamental cycle C closed by e. By construction, C has fu and fv on opposite sides, so any common vertex of fu and fv must be on C. In particular, we must have si, ti ∈ C, and if no vertex in C is incident to both fu and fv then fu and fv do not bound a valid u-flip-component. We want the flip-component containing u to be as large as possible, which means the flip-component containing v must be as small as possible. Let pv = πC(v) and let px, py be the neighbors of pv on C. Then at least one of the edges {(px, pv), (pv, py)} is in the flip-component of v. Suppose (x, y) is this edge, then the separation pair {sx, sy} we want will consist of the first vertex incident to both fu and fv in each direction on C away from (x, y). If G is not biconnected, there may be multiple corners between each of sx, sy and each of fu, fv. To truly minimize the size of the flip-component of v, we must choose the nearest 4 20 Algorithm 5 1: function choose-best-flip(u, v, fu, fv) (cid:46) Determine maximum u-flip in fu, fv 2: if u ∈ fu and u (cid:54)∈ fv then 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: return (0,⊥) x, cu y , cv s ← size of u-flip-component of σ return (s, σ) e ← the first primal edge on the dual tree path from fu to fv. C ← fundamental cycle of e if ∃w ∈ C incident to both fu and fv then pv ← πC(v); px, py ← neighbors of pv on C for (x, y) ∈ {(px, pv), (pv, py)} do y ← corners at sx, sy nearest to (x, y) on the fu side y ← corners at sx, sy nearest to (x, y) on the fv side sx, sy ← vertices on C incident to fu and fv closest to (x, y) in each direction cu x, cu cv x, cv σ ← (cu if σ bounds a locally maximal u-flip-component then y, cv x) (cid:46) σ is a valid u, v-flip corners to (x, y). This gives us 4 corners (cu x), and by Lemma 38 we can test if these bound a locally maximal u-flip-component and compute its size in worst case O(log2 n) time. Note that if both candidates for (x, y) are valid, they will give the same answer, so it is ok to stop as soon as we find one that is valid. If none of the two candidates for (x, y) give a valid flip, then fu, fv did not bound a locally maximal u-flip-component, and we return (0,⊥). x, cu y , cv y, cv find-single-flip-candidates 4.4.2 Our task is thus to compute (candidates for) fu and fv. In [11] we considered the special case where G ∪ (u, v) is planar and a single flip is needed to admit (u, v). The function find-single-flip- candidates in Algorithm 6 is essentially the same as is described in [11], but instrumented to return a bit more information which will become important later. Definition 40. A fundamental cycle C is separating if fu and fv are on opposite sides of C. If Xb is the first fu-blocking node on X1 . . . Xr then a fundamental cycle C is good when either C is separating or C intersects both E≤b and E>b. Definition 41. A tuple (f(cid:48) u, e(cid:48) cycle, and e(cid:48) index(e(cid:48) if furthermore f(cid:48) Lemma 42. find-single-flip-candidates(u, v) from Algorithm 6 runs in worst case O(log2 n) time and returns a set of at most 20 candidate tuples. v are faces, C is a fundamental u = fu, C is good as defined in Definition 40, v) = maxe∈C index(e). A good candidate tuple is correct v ∈ C. A candidate tuple is good if f(cid:48) u) = mine∈C index(e), and index(e(cid:48) v) is a candidate tuple if f(cid:48) u and f(cid:48) v, C, e(cid:48) v = fv. u, f(cid:48) u, e(cid:48) Proof. The result set starts empty and changes only by addition of elements, and simple counting shows that either exactly 2, or at most 2 · 2 · 2 + 2 · 2 · 2 + 2 · 2 = 20 elements are added, and by construction each element added is trivially a candidate tuple. 21 case constant time, and a constant number of the following operations: For each element added, we use a constant number of elementary operations each taking worst • Find the first or last edge on a path in the primal or dual tree. • Find the faces incident to an edge in the primal tree. • Compute the meet of 3 faces in the dual tree. • Determine if two faces are the same. • Find the primal edge corresponding to an edge in the dual tree. • Given a fundamental cycle C and a vertex w ∈ C, find the edges on C incident to w. • Given a fundamental cycle C and faces f1, f2 determine if they are on the same side of C. • Given a fundamental cycle C and a vertex w (cid:54)∈ C, find the projection πC(w) ∈ C. v,·,·,·) ∈ find-single-flip-candidates(u, v) from Algorithm 6 is correct. Using the data structure from [11], each of these operations can be done in worst case O(log n) time. Lemma 43. If G ∪ (u, v) is planar and only one flip is needed at fu, fv to admit (u, v), then at least one (f(cid:48) Proof. We consider the 4 cases for how the fundamental separating cycles may relate to u and v, and show that in each case we find at least one correct candidate tuple. If some fundamental separating cycle contains both u and v, then any such cycle C sepa- rates uL from uR and vL from vR. In particular a primal nontree edge e closes such a cycle if and only if it is on both uL ··· uR and vL ··· vR. But then we also have f L u and e ∈ f L u . We therefore execute Line 9 -- 16 exactly when such a separating cycle exists, and v ∈ Ek, and the cycle C is such a separating cycle. By definition, eu, e1 C separates uL from uR, so there exists an f ∈ {uL, uR} that is on the same side of C as fu. u ··· f 2 For this value of f, we must have fu ∈ f 1 v , and thus v ),·, C, eu, ev) is a good candidate tuple. Similarly, if fu = meet(f 1 u, f 1 u, f 2 only one flip is needed to admit (u, v) then fv is on the opposite side of C from f, and we must u, and fv ∈ ¯f 2 have that fv ∈ ¯f 1 u) and u, f 1 (meet(f 1 u, f 2 v ··· ¯f 1 u), C, eu, ev) is a correct candidate tuple. u, f 1 v ··· ¯f 2 v ), meet( ¯f 1 u, e2 u, fu ∈ f 1 u, and thus fv = meet( ¯f 1 u ∈ E1 and ev, e1 v , fv ∈ ¯f 1 v , ¯f 1 v , and fu ∈ f 2 v ) and (meet(f 1 u (cid:54)= f R u ··· f R u ··· f 1 v ··· ¯f 1 u ··· f 1 v , ¯f 2 v , ¯f 1 u, f(cid:48) v, e2 u, f 2 v , ¯f 2 v = f R u and f L In this case there must exist an f ∈ {uL, uR} \ {f (cid:63) If no fundamental separating cycle contains both u and v, but some contains u, then v and Line 19 -- 27 gets executed. Any such cycle must separate either f L u = f R uL or uR from the rest of {uL, uR, vL, vR}, and in particular it must separate uL or uR from u} that is on the opposite side of u. f (cid:63) u to f such a cycle from f (cid:63) u ∈ E1 and there exists e(cid:48) v} closes such a separating cycle C. By definition, eu, e1 v, e2 v incident to e(cid:48) with index(e(cid:48) v is on the same side of C as fu. Given this face f(cid:48) u on the v and the corresponding faces f 1 u, e2 u ··· f(cid:48) same side of C as f(cid:48) v, and thus u, f(cid:48) v) is a good candidate tuple. If only one fu = meet(f 1 flip is needed to admit (u, v) then fv is on all of vL ··· vR, vL ··· f (cid:63) u, and thus fv = f (cid:63) v u, f(cid:48) v) is a correct candidate tuple. and (meet(f 1 u, e2 v) = maxe∈C index(e). Exactly one face f(cid:48) u, fu ∈ f 1 u, and in fact the first primal edge on the dual tree path from f (cid:63) v ∈ {e1 u ··· f 2 v, we have fu ∈ f 1 v),·, C, eu, e(cid:48) u, f(cid:48) v) and (meet(f 1 u, f 2 u, f 2 v, and fu ∈ f 2 u, vR ··· f (cid:63) u incident to e1 u ··· f(cid:48) If no fundamental separating cycle contains both u and v, but some contains v, then v and Line 28 -- 36 gets executed. Any such cycle must separate either f L u = f R vL or vR from the rest of {uL, uR, vL, vR}, and in particular it must separate vL or vR from v} that is on the opposite side of such v . In this case there must exist an f ∈ {vL, vR} \ {f (cid:63) f (cid:63) a cycle from f (cid:63) v to f closes v , and in fact the first primal edge on the dual tree path from f (cid:63) v , C, eu, e(cid:48) u and f L v = f R v), f (cid:63) u, f 2 u, f 2 22 u and (f (cid:63) u,·, C, e(cid:48) v on the same side of C as f(cid:48) v ··· f 2 u), C, e(cid:48) If no fundamental separating cycle contains u or v, then f L v ∈ Ek and there exists e(cid:48) u) = mine∈C index(e). In this case, fu is on all of uL ··· uR, uL ··· f (cid:63) u, ev) is a good candidate tuple. Exactly one face f(cid:48) such a separating cycle C. By definition, ev, e1 index(e(cid:48) thus fu = f (cid:63) is on the same side of C as fv. Given this face f(cid:48) to e1 and thus fv = meet(f 1 u ∈ {e1 u} with u, e2 v , uR ··· f (cid:63) v , and u incident to e(cid:48) u v incident v , f 2 v , fv ∈ f 1 v ··· f(cid:48) u, u, ev) is a correct candidate tuple. v and Line 37 -- u = f R 44 gets executed. Assuming only one flip is needed to admit (u, v), then fu and fv are simply the f (cid:63) v found in the algorithm. Specifically, since u and v are not already linkable, u and f (cid:63) u (cid:54)= f (cid:63) v} v . Since there exists e(cid:48) v, e2 f (cid:63) with index(e(cid:48) u and the corresponding faces f 1 u, we have fv ∈ f 1 v , f(cid:48) u, meet(f 1 v) = maxe∈C index(e), at least one of the candidates is correct. u) = mine∈C index(e) and e(cid:48) u} with index(e(cid:48) u, and fv ∈ f 2 u) and (f (cid:63) u ∈ {e1 v ∈ {e1 u and f L v = f R v , f(cid:48) v , f 2 v, e2 v , f 2 v, e2 v ··· f(cid:48) u, e2 u, e(cid:48) u,·, C, e(cid:48) v) ∈ find-single-flip-candidates(u, v) from Algorithm 6 is good. Lemma 44. If Xb is the first fu-blocking node on X1 . . . Xr and 1 < b < r, then at least one of the candidates (f(cid:48) Proof. Since, for every cycle C, we try all relevant edges near πC(u) and πC(v), we need only argue that f(cid:48) u is fu and C is good; if one of the tuples contains a good cycle and the correct fu, then one of the tuples will be good. arguments as in Lemma 43) for some such cycle C, (fu,·, C, e(cid:48) Since C is separating, it is by definition good, and thus this tuple is clearly good. Otherwise no fundamental separating cycle contains any of u or v. Let f (cid:63) If there exists a fundamental separating cycle through at least one of u, v then (by the same v) is among the returned candidates. u and v . Thus, let e be the first f (cid:63) v = f L v , then that edge e closes primal edge on the dual tree path from f (cid:63) u ∈ fv ··· f (cid:63) v . a fundamental cycle that is separating and therefore good. Suppose therefore that f (cid:63) Then e ∈ Eb. Furthermore the path fv ··· f (cid:63) v cuts E≤b such that not all of sb−1, tb−1, sb, and tb are connected in E≤b \ (fv ··· f (cid:63) v ). Thus, the fundamental cycle closed by any primal edge on fv ··· f (cid:63) v must go through E>b. In particular the edge e closes a cycle C intersecting E>b. Thus C is good, since it intersects both Eb and E>b- v . Then, because 1 < b < r, it must be the case that f (cid:63) u (cid:54)= f (cid:63) u (cid:54)∈ fv ··· f (cid:63) v . Note that if f (cid:63) u = f R u to f (cid:63) u = f L v = f R u, e(cid:48) 23 u ← meet(uL, uR, vR) v ← meet(vL, vR, uR) eu, ev ← the first and last edge on the primal tree path from u to v. uL, uR ← left and right face indident to the first edge on the primal tree path from u to v. vL, vR ← left and right face indident to the first edge on the primal tree path from v to u. u ← meet(uL, uR, vL); f R f L v ← meet(vL, vR, uL); f R f L result ← ∅ u (cid:54)= f R if f L (cid:46) Handles case of a fundamental cycle through u and v. e ← primal edge corresponding to first edge on dual tree path f L C ← fundamental cycle closed by e e1 u, e2 for f ∈ {uL, uR} do v ← the edges incident to u, v on C u ··· f R u then u, e1 u u, e1 u, e1 v , f 2 v , ¯f 2 u, f 1 u, ¯f 1 f 1 u, f 2 u, ¯f 2 ¯f 1 result ← result ∪{(meet(f 1 u = f R u ← f L f (cid:63) (cid:46) Handles case of a fundamental separating cycle through u but none through u, v. for f ∈ {uL, uR} \ {f (cid:63) v on the same side of C as f. v on the opposite side of C from f. v , ¯f 2 v, e2 u, e2 v, e2 u, e2 v ), meet( ¯f 1 u and f L v = f R v v ← f L u ; f (cid:63) v u), C, eu, ev)} v , ¯f 1 e ← first primal edge on dual tree path from f (cid:63) C ← fundamental cycle closed by e e1 u, e2 for e(cid:48) u to f v ← the edges incident to u, πC(v) on C v, e2 u, e1 v ∈ {e1 v, e2 v ∈ faces incident to e(cid:48) for f(cid:48) v do u ← faces incident to e1 f 1 u, f 2 result ← result ∪{(meet(f 1 v} do u on the same side of C as f(cid:48) v. u, e2 u, f(cid:48) u, f 2 v , C, eu, e(cid:48) v), f (cid:63) v)} (cid:46) Handles case of a fundamental separating cycle through v but none through u, v. for f ∈ {vL, vR} \ {f (cid:63) v, e2 u, f 2 else f L u} do v ← faces incident to e1 v ← faces incident to e1 u, f 1 Algorithm 6 1: function find-single-flip-candidates(u, v) 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: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: return result v} do v then u, f (cid:63) e ← first primal edge on dual tree path from f (cid:63) C ← fundamental cycle closed by e u, e2 e1 for e(cid:48) v to f v ← the edges incident to πC(u), v on C v, e2 u, e1 u ∈ {e1 u, e2 u ∈ faces incident to e(cid:48) for f(cid:48) u do v ← faces incident to e1 f 1 v , f 2 result ← result ∪{(f (cid:63) v, e2 u, meet(f 1 u} do v on the same side of C as f(cid:48) u. v , f 2 u), C, e(cid:48) u, ev)} v , f(cid:48) (cid:46) Handles case of no fundamental separating cycle through u or v. if f (cid:63) u (cid:54)= f (cid:63) e ← first primal edge on dual tree path from f (cid:63) C ← fundamental cycle closed by e e1 u, e2 for e(cid:48) u to f (cid:63) v v ← the edges incident to πC(u), πC(v) on C v, e2 u, e1 u ∈ {e1 u, e2 v ∈ {e1 for e(cid:48) result ← result ∪{(f (cid:63) u} do v, e2 v} do v , C, e(cid:48) u, e(cid:48) v)} 24 4.4.3 find-first-separation-flip (cid:46) Assumes u, v are biconnected and do not share a face. candidates ← find-single-flip-candidates(u, v) (cid:46) Test for single flip for (fu, fv,·,·,·) ∈ candidates do Algorithm 7 1: function find-first-separation-flip(u, v) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: (s, σ) ← choose-best-flip(u, v, fu, fv) if s > 0 then if v ∈ fv then return (s, σ) u, e(cid:48) (cid:46) Assume fu is correct, C is good, and e(cid:48) (cid:46) Handle cases where E>b ∩ C (cid:54)= ∅. v ← face incident to e(cid:48) f(cid:48) if fu (cid:54)= f(cid:48) v then v on same side of C as fu. (cid:46) Not single flip. If first flip exists, then first fu-blocking node Xb has 1 < b < r. result ← (0,⊥) for (fu,·, C, e(cid:48) v) ∈ candidates do u, e(cid:48) v ∈ C are in the first/last Ej with Ej ∩ C (cid:54)= ∅. (x, y) ← first primal edge on dual tree path fu ··· f(cid:48) v. result ← max{result, find-sep-P11(u, v, fu, C, e(cid:48) find-sep-R11(u, v, fu, C, e(cid:48) find-sep-P10(u, v, fu, C, e(cid:48) find-sep-R10(u, v, fu, C, e(cid:48) u, e(cid:48) u, e(cid:48) u, e(cid:48) u, e(cid:48) v, x, y), v, x, y), v, x, y), v, x, y) } (cid:46) If fu = f(cid:48) v we are not in this case. (cid:46) C separating and P (cid:46) C separating and R (cid:46) C not separating and P (cid:46) C not separating and R 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: (cid:46) Handle cases where E>b ∩ C = ∅. v ← the edges on C incident to πC(v) v, e2 e1 v ← the faces incident to e1 ¯f 1 v , ¯f 2 v ← any face incident to v e.g. vL or vR ¯f 3 ¯f1 ← meet( ¯f 1 result ← max{result, choose-best-flip(u, v, fu, ¯f1)} for ¯f2 ∈ { ¯f 1 v , ¯f 3 v , ¯f 2 v ) v} \ { ¯f1} do v , ¯f 2 v, e2 (x, y) ← first primal edge on the dual tree path from ¯f1 to ¯f2 result ← max{result, v on the opposite side of C from fu. (cid:46) Otherwise ¯f2 can not be the right face find-sep-P0x(u, v, fu, C, e(cid:48) find-sep-R01(u, v, fu, C, e(cid:48) } (cid:46) P (cid:46) C separating and R (cid:46) In this case it is impossible to have C not separating and R v, x, y), v, x, y) u, e(cid:48) u, e(cid:48) 28: return result Lemma 45. Consider find-first-separation-flip in Algorithm 7. Suppose (fu,·, C, e(cid:48) good in Line 13, and E>b ∩ C (cid:54)= ∅ and C is separating. Then in Line 16, fu (cid:54)= f(cid:48) v) is v and the first primal u, e(cid:48) 25 u, e(cid:48) v , f 2 • if Xb is a P node the dual tree path fu ··· f(cid:48) v) is good and E>b ∩ C (cid:54)= ∅ we specifically have e(cid:48) v), that means fu (cid:54)= f(cid:48) edge (x, y) on the dual tree path from fu to f(cid:48) v is in Eb and closes a good fundamental cycle C(cid:48) such that C(cid:48)\C is a path πC(x)··· πC(y) in Eb. Furthermore, if Xb is a P node, {πC(x), πC(y)} = {sb−1, tb−1}. Proof. Since (fu,·, C, e(cid:48) v ∈ E>b. Since the first fu-blocking node on X1 ··· Xk has index b < index(e(cid:48) v. Let (x, y) be the first v. Since C is a fundamental cycle, the path fu ··· f(cid:48) primal edge on the dual tree path from fu to f(cid:48) v will stay on one side of C, thus (x, y) ∈ Eb and v cuts every separation class w.r.t. {sb−1, tb−1} on the fu side of C, separating sb−1 = sb from tb−1 = tb. Thus, (x, y) is in a different separation class w.r.t. {sb−1, tb−1} from any edge on C and we must have {sb−1, tb−1} = {πC(x), πX (y)}. v ∈ E>b. The cycle C(cid:48) closed by (x, y) is either separating (and contains e(cid:48) v cuts Eb, separating sb−1 and sb from tb−1 and tb. Thus, the fundamental cycle C(cid:48) closed by (x, y) must connect x to y via primal tree paths x··· πC(x) ⊆ Eb and y ··· πC(y) ⊆ Eb, and the primal tree path πC(x)··· πC(y) which (assuming Xb is not a cross node) must go via either sb−1 ··· tb−1 ⊆ E<b (thus C(cid:48) is separating and contains e(cid:48) • if Xb is an R node the dual tree path fu ··· f(cid:48) u) or sb ··· tb ⊆ E>b (and contains e(cid:48) v). u ∈ E≤b), or contains e(cid:48) v are on the same side of C, by construction, the dual tree path fu ··· f(cid:48) v) is v and the first v is in E≤b and closes a good fundamental cycle In either case, C(cid:48) is good. Lemma 46. Consider find-first-separation-flip in Algorithm 7. Suppose (fu,·, C, e(cid:48) good in Line 13, and E>b ∩ C (cid:54)= ∅ and C is not separating. Then in Line 16, fu (cid:54)= f(cid:48) primal edge (x, y) on the dual tree path from fu to f(cid:48) C(cid:48) intersecting E<b. Proof. Since fu and f(cid:48) v must contain fv. But then, the first edge (x, y) closes a separating fundamental cycle. If (x, y) is in E<b we are done, so suppose (x, y) ∈ Eb which is the only remaining case. Then, either x or y is separated from C in Eb \ (fu ··· f(cid:48) Lemma 47. Let C be a good cycle that is not separating, let e1, e2 be the edges incident to πC(u) on C, and let f 1 v and fv ∈ f 1 Proof. Since C is good and not separating, then by definition C intersects both E≤b and E>b but not E<b, and in particular Eb ∩ C consists of a path sb ··· tb. Since u, v are assumed to be biconnected, v are distinct. Furthermore let s(cid:48) be the first vertex on the primal tree path from πC(u) to v and f 2 f 1 u such that the remaining path s(cid:48) ··· u ⊆ E<b, then s(cid:48) ∈ {sb−1, tb−1}. v). But then, the primal tree path x··· y must go via sb−1 ··· tb−1 ⊆ E<b. v be the faces incident to e1, e2 on the same side of C as fu, then f 1 v ··· f 2 v . v (cid:54)= f 2 u, e(cid:48) Since sb and tb are distinct, at least one of them is different from πC(u), and thus at least one of v is incident to an edge on a path in Eb ∩ (C ∪ T ) from sb or tb to s(cid:48). Suppose without loss v and f 2 f 1 v is incident to the first edge on πC(u)··· tb. Since tb ∈ fv of generality that tb (cid:54)= πC(u) and that f 2 and s(cid:48) ∈ fv, the path s(cid:48) ··· tb in C ∪ T together with (an imaginary edge (tb, s(cid:48)) through) fv form a closed curve separating f 1 v does not cross it, and thus it must contain fv. Lemma 48. Let C be a good cycle with E>b ∩ C = ∅, let e1, e2 be the edges incident to πC(v) on C, and let ¯f 1 v and fv ∈ ¯f 1 v , ¯f 2 v be the faces incident to e1, e2 on the opposite side of C from fu, then ¯f 1 v ··· ¯f 2 v . v . Since s(cid:48) ··· tb is in C ∪ T , the path f 1 v from f 2 v ··· f 2 v (cid:54)= ¯f 2 26 Proof. Since C is good and does not intersect E>b, we must have that C is separating and Eb ∩ C contains a path sb−1 ··· tb−1. Since u, v are assumed to be biconnected ¯f 1 v are distinct. Furthermore let s(cid:48) be the first vertex on the primal tree path from πC(v) to v such that the remaining path s(cid:48) ··· v ⊆ E>b, then s(cid:48) ∈ {sb, tb}. v and ¯f 2 v and ¯f 2 v from ¯f 2 Since sb−1 and tb−1 are distinct, at least one of them is different from πC(v), and thus at least v is incident to an edge on a path in Eb ∩ (C ∪ T ) from sb−1 or tb−1 to s(cid:48). Suppose one of ¯f 1 without loss of generality that tb−1 (cid:54)= πC(v) and that ¯f 2 v is incident to the first edge on πC(v)··· tb−1. Since tb−1 ∈ fv and s(cid:48) ∈ fv, the path s(cid:48) ··· tb−1 in C ∪ T together with (an imaginary edge (tb−1, s(cid:48)) v . Since s(cid:48) ··· tb−1 is in C ∪ T , the path through) fv forms a closed curve separating ¯f 1 v ··· ¯f 2 ¯f 1 v does not cross it and so must contain fv. Lemma 49. Consider find-first-separation-flip in Algorithm 7. If (fu,·, C, e(cid:48) u, e(cid:48) v) is good in Line 13, and E>b ∩ C = ∅. Then in Line 23 if ¯f1 (cid:54)= fv then for at least one ¯f2 ∈ { ¯f 1 v} \ { ¯f1}, v , ¯f 2 the first primal edge (x, y) on the dual tree path from ¯f1 to ¯f2 closes a good fundamental cycle C(cid:48) intersecting E>b. Proof. By Lemma 48 ¯f 1 v are distinct. If ¯f1 = fv we are done, so suppose ¯f1 (cid:54)= fv. Then either fv (cid:54)∈ ¯f 1 v ··· ¯f1. Choose j ∈ {0, 1} such that fv (cid:54)∈ f 1+j ··· ¯f1, then the first primal edge (x, y) on the dual tree path from ¯f1 to f 2−j v ··· ¯f1 ··· fv cuts E≤b, separating sb from tb. But then the primal tree path from sb to tb is contained in E>b, and is part of C(cid:48). Thus C(cid:48) intersects both E≤b and E>b and is therefore good. v cuts E>b, separating sb from tb. But then the primal tree path from sb to tb is contained in E≤b, and is part of C(cid:48). Thus C(cid:48) intersects both E≤b and E>b and is therefore good. v . Furthermore, assuming v (cid:54)∈ fv also fv and ¯f 3 v ··· ¯f1 or fv (cid:54)∈ ¯f 2 If (x, y) ∈ E≤b then the path ¯f 3 Otherwise (x, y) ∈ E>b, and ¯f 1 closes a cycle C(cid:48) separating f 1+j v from fv ··· f 2−j v and fv ∈ ¯f 1 ··· ¯f1 ··· ¯f 3 v ··· ¯f 2 v (cid:54)= ¯f 2 v ··· ¯f 2 v v v . v u, e(cid:48) v, x, y) Algorithm 8 1: function find-sep-P11(u, v, fu, C, e(cid:48) 2: 3: 4: 5: 6: 7: 8: return (0,⊥) (cid:46) Handle cases where Xb is a P node and E>b ∩ C (cid:54)= ∅ and C is separating. ¯fu, ¯fv ← face incident to e(cid:48) px ← πC(x); py ← πC(y) if px (cid:54)= py then v on opposite side of C from fu. u, e(cid:48) fv ← first face on ¯fv ··· ¯fu incident to both px and py return choose-best-flip(u, v, fu, fv) (cid:46) If px = py we are not in this case. Lemma 50. If (fu,·, C, e(cid:48) v) is good, E>b ∩ C (cid:54)= ∅, C is separating, (x, y) closes a fundamental cycle C(cid:48) such that C(cid:48) \ C is a path πC(x)··· πC(y) in Eb with {πC(x), πC(y)} = {sb−1, tb−1}, and Xb is a P node, then find-sep-P11(u, v, fu, C, e(cid:48) v, x, y) in Algorithm 8 returns the size and corners of a maximal u-flip. u, e(cid:48) u, e(cid:48) Proof. Since C is separating, fv is on the opposite side of C from fu, and thus by construction ¯fu and ¯fv are on the same side of C as fv. The path sb−1 ··· tb−1 together with (an imaginary 27 edge (sb−1, tb−1) through) fv forms a closed curve separating ¯fu from ¯fv, so fv ∈ ¯fu ··· ¯fv. Since fv maximizes the size of the u-flip-component, it must be the first face on this path that defines a valid flip, which it does if and only if it contains sb−1, tb−1. Given the correct fv, the rest follows from Lemma 39. u, e(cid:48) v, x, y) Algorithm 9 1: function find-sep-P10(u, v, fu, C, e(cid:48) 2: 3: 4: 5: 6: 7: 8: (cid:46) Handle cases where Xb is a P node and E>b ∩ C (cid:54)= ∅ and C is not separating. v ← the face incodent to e(cid:48) f(cid:48) px ← πC(x); py ← πC(y) if px (cid:54)= py then fv ← first face on f(cid:48) return choose-best-flip(u, v, fu, fv) v ··· fu incident to both px and py v on the same side of C as fu. return (0,⊥) (cid:46) If px = py we are not in this case. u, e(cid:48) u, e(cid:48) v, so fv ∈ fu ··· f(cid:48) v) is good, E>b ∩ C (cid:54)= ∅, C is not separating, (x, y) closes a good v, x, y) Lemma 51. If (fu,·, C, e(cid:48) fundamental cycle intersecting E<b, and Xb is a P node, then find-sep-P10(u, v, fu, C, e(cid:48) in Algorithm 9 returns the size and corners of a maximal u-flip. Proof. Since C is good but not separating, C ∩ E<b = ∅, C ∩ Eb (cid:54)= ∅, and C ∩ E>b (cid:54)= ∅. Thus, C contains sb−1, tb−1 and since C is a fundamental cycle C contains the tree path sb−1 ··· tb−1. Since C(cid:48) is a good fundamental cycle through E<b it must also contain that tree path, and we must have (x, y) ∈ E<b and thus {πC(x), πC(y)} = {sb−1, tb−1}. Furthermore, since C is not separating fv is on the same side of C as fu, and thus by construction v is on the same side of C as fv. The path sb−1 ··· tb−1 together with (an imaginary edge (sb−1, tb−1) f(cid:48) through) fv forms a closed curve separating fu from f(cid:48) v. Since fv maximizes the size of the u-flip-component, it must be the first face on this path that defines a valid flip, which it does if and only if it contains sb−1, tb−1. Given the correct fv, the rest follows from Lemma 39. Lemma 52. Suppose Xb is an R node. Let C and C(cid:48) be good fundamental cycles such that C ∪ C(cid:48) consists of 3 internally vertex-disjoint paths P<, P=, P> between a pair of distinct vertices px, py, where P< ∩ E<b (cid:54)= ∅, P= ⊆ Eb, and P> ∩ E>b (cid:54)= ∅. Let C(cid:48)(cid:48) = P< ∪ P>, let e ∈ C(cid:48)(cid:48) \ Eb, and let e1 y be the faces incident to y} such x} and fy ∈ {f 1 e, e1 that fv = meet(f, fx, fy). Proof. Suppose that e ∈ E<b (the case e ∈ E>b is symmetric). Since Xb is an R node, at least one of sb−1 (cid:54)= sb and tb−1 (cid:54)= tb holds. We may assume without loss of generality that sb−1 (cid:54)= sb and that px is on the sb−1 ··· sb path in C(cid:48)(cid:48) ∩ Eb. Then there exists at least one ex ∈ {e1 x} ∩ Eb, and at least one ey ∈ {e1 Now fv ∈ f ··· fx and fv ∈ f ··· fy because C(cid:48)(cid:48) ∩ E<b consists of a path sb−1 ··· tb−1 which together with (an imaginary edge (sb−1, tb−1) through) fv forms a closed curve separating f from fx and fy. Similarly fv ∈ fx ··· fy because the path sb−1 ··· sb in C ∩ Eb together with (an imaginary edge y be the edges incident to px, py on C(cid:48)(cid:48). Let f, f 1 x , f 1 y, e2 y on the same side of C(cid:48)(cid:48) as fv. Then there exists fx ∈ {f 1 y, e2 y} be the corresponding faces. y} ∩ E≥b. Let fx ∈ {f 1 x}, fy ∈ {f 1 x, e1 x, e1 x, e2 x, e2 x , f 2 y , f 2 x , f 2 y, e2 x , f 2 y , f 2 y , f 2 x, e2 (sb−1, sb) through) fv forms a closed curve separating fx from fy. 28 u, e(cid:48) u, e(cid:48) v, x, y) v on opposite side of C from fu. (cid:46) Handle cases where Xb is an R node and E>b ∩ C (cid:54)= ∅ and C is separating. result ← (0,⊥) ¯fu, ¯fv ← face incident to e(cid:48) px ← πC(x); py ← πC(y) if px (cid:54)= py then y, e2 e1 x, e2 ¯f 1 y , ¯f 2 x , ¯f 2 for ¯fx ∈ { ¯f 1 y ← edges on C incident to px, py, with e1 x, e1 y ← faces incident to e1 x , ¯f 1 x , ¯f 2 for ¯fy ∈ { ¯f 1 Algorithm 10 1: function find-sep-R11(u, v, fu, C, e(cid:48) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: fv ← meet( ¯fu, ¯fx, ¯fy) result ← max{result, choose-best-flip(u, v, fu, fv)} y on the same side of C as ¯fu x} do y , ¯f 2 return result y} do x, e1 x, e2 y, e2 u (cid:46) If px = py we are not in this case. x, e1 y closest to e(cid:48) Since fv is on all 3 paths f ··· fx, f ··· fy, and fx ··· fy, we have fv = meet(f, fx, fy). x, e1 y, e2 x , f 2 x , f 1 y , f 2 Lemma 53. Suppose Xb is an R node. Let C≤ ⊆ E≤b and C≥ ⊆ E≥b be good fundamental cycles with at most one vertex in common. Let e ∈ (C≤∪ C≥)\ Eb, and let e1 y be the edges incident to px = πC≤(v), py = πC≥(u) on C≤, C≥. Let f, f 1 y, e2 x, e2 y on the same side of C≤, C≥ as fv. Then there exists fx ∈ {f 1 y} such that fv = meet(f, fx, fy). Proof. Suppose that e ∈ E<b (the case e ∈ E>b is symmetric). Then there exists at least one ex ∈ {e1 y and fv ∈ f 1 Now fv ∈ f ··· fx and fv ∈ f ··· fy because C≤ ∩ E<b consists of a path sb−1 ··· tb−1 which together with (an imaginary edge (sb−1, tb−1) through) fv forms a closed curve separating f from fx and fy. x} be the corresponding face. By Lemma 47 or 48 f 1 x} ∩ Eb. Let fx ∈ {f 1 y , so there exists fy ∈ {f 1 x, e2 x} and fy ∈ {f 1 y} such that fv ∈ fx ··· fy. y be the faces incident to e, e1 Since fv is on all 3 paths f ··· fx, f ··· fy, and fx ··· fy, we have fv = meet(f, fx, fy). x, e2 y ··· f 2 y (cid:54)= f 2 y , f 2 x , f 2 y , f 2 x , f 2 x, e1 Lemma 54. If (fu,·, C, e(cid:48) v) is good, E>b ∩ C (cid:54)= ∅, C is separating, (x, y) closes a funda- mental cycle C(cid:48) such that C(cid:48) \ C is a path πC(x)··· πC(y) in Eb, and Xb is an R node, then find-sep-R11(u, v, fu, C, e(cid:48) v, x, y) in Algorithm 10 returns the size and corners of a maximal u-flip. u, e(cid:48) u, e(cid:48) Proof. By Lemma 39 it is sufficient to show that at least one of the candidates to fv used in the calls to choose-best-flip(u, v, fu, fv) is correct. This follows directly from Lemma 52 with e = e(cid:48) u and the fact that ¯fu is on the same side of C as fv. Lemma 55. If (fu,·, C, e(cid:48) fundamental cycle intersecting E<b, and Xb is an R node, then find-sep-R10(u, v, fu, C, e(cid:48) in Algorithm 11 returns the size and corners of a maximal u-flip. v) is good, E>b ∩ C (cid:54)= ∅, C is not separating, (x, y) closes a good v, x, y) u, e(cid:48) u, e(cid:48) Proof. By Lemma 39 it is sufficient to show that at least one of the candidates to fv used in the calls to choose-best-flip(u, v, fu, fv) is correct. 29 (cid:46) Handle cases where Xb is an R node and E>b ∩ C (cid:54)= ∅ and C is not separating. result ← (0,⊥) v ← the face incodent to e(cid:48) f(cid:48) C(cid:48) ← fundamental cycle of (x, y) px ← πC(x); py ← πC(y) if px (cid:54)= py then v on the same side of C as fu. u, e(cid:48) v, x, y) Algorithm 11 1: function find-sep-R10(u, v, fu, C, e(cid:48) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: y ← edges on C(cid:48) \ C incident to px, py e1 x, e1 u ∈ C(cid:48) then if e(cid:48) y ← edges on C \ C(cid:48) incident to px, py e2 x, e2 u (cid:54)∈ C(cid:48) else e(cid:48) y ← edges on C ∩ C(cid:48) incident to px, py e2 x, e2 y ← faces incident to e1 f 1 x , f 2 x , f 1 y , f 2 y, e2 for fx ∈ {f 1 x , f 2 for fy ∈ {f 1 x, e2 x, e1 x} do y , f 2 fv ← meet(f(cid:48) result ← max{result, choose-best-flip(u, v, fu, fv)} y} do v, fx, fy) y on the same side of C, C(cid:48) as f(cid:48) v (cid:46) The two cycles have common edges (case I) 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: else px = py (cid:46) The two cycles have no common edges (case X or H) e1 u, e2 v, e2 e1 v , f 2 u, f 2 f 1 for fx ∈ {f 1 u ← edges incident to πC(cid:48)(v) on C(cid:48) v ← edges incident to πC(u) on C v ← faces incident to e1 u, e2 u, f 1 u, f 2 for fy ∈ {f 1 u} do v , f 2 fv ← meet(f(cid:48) result ← max{result, choose-best-flip(u, v, fu, fv)} v} do v, fx, fy) u, e1 v, e2 v on the same side of C, C(cid:48) as f(cid:48) v return result x , f 2 y , f 2 y , f 2 u, e(cid:48) y} such that fv = meet(f(cid:48) Lemma 52 with e = e(cid:48) e = e(cid:48) x} and fy ∈ {f 1 y} such that fv = meet(f(cid:48) v there exists fx ∈ {f 1 x , f 2 x} and fy ∈ {f 1 v) is good, E>b ∩ C = ∅, (x, y) closes a good fundamental cycle v, x, y) in Algorithm 12 If px (cid:54)= py then C ∪ C(cid:48) consists of 3 internally vertex-disjoint paths from px to py, and by v, fx, fy). Otherwise px = py, and C and C(cid:48) has at most one vertex in common, so by Lemma 53 with v there exists fx ∈ {f 1 Lemma 56. If (fu,·, C, e(cid:48) intersecting E>b, and Xb is a P node, then find-sep-P0x(u, v, fu, C, e(cid:48) returns the size and corners of a maximal u-flip. Proof. Since C is good and E>b ∩ C = ∅, C is separating and contains sb−1, tb−1 as well as the tree path sb−1 ··· tb−1. Since C(cid:48) is a good fundamental cycle through E>b it must also contain that tree path, and we must have (x, y) ∈ E>b and thus {πC(x), πC(y)} = {sb−1, tb−1}. Furthermore, since C is separating fv is on the opposite side of C from fu, and thus by construction ¯fu and ¯f are on the same side of C as fv. The path sb−1 ··· tb−1 together with (an imaginary edge (sb−1, tb−1) through) fv forms a closed curve separating ¯f from ¯fu, so fv ∈ ¯f ··· ¯fu. Since fv maximizes the size of the u-flip-component, it must be the first face on this path that v, fx, fy). u, e(cid:48) 30 u, e(cid:48) u, e(cid:48) v, x, y) (cid:46) Handle cases where Xb is a P node and E>b ∩ C = ∅. ¯fu, ¯fv ← face incident to e(cid:48) C(cid:48) ← fundamental cycle of (x, y) px ← πC(x); py ← πC(y) if px (cid:54)= py then Algorithm 12 1: function find-sep-P0x(u, v, fu, C, e(cid:48) 2: 3: 4: 5: 6: 7: 8: 9: 10: ¯f ← the face incident to (x, y) on the same side of C(cid:48) as ¯fu fv ← first face on ¯f ··· ¯fu incident to both px and py return choose-best-flip(u, v, fu, fv) v on opposite side of C from fu. return (0,⊥) (cid:46) If px = py we are not in this case. defines a valid flip, which it does if and only if it contains sb−1, tb−1. Given the correct fv, the rest follows from Lemma 39. u, e(cid:48) v, x, y) (cid:46) Handle cases where Xb is an R node and E>b ∩ C = ∅ and C is separating. result ← (0,⊥) ¯fu, ¯fv ← face incident to e(cid:48) C(cid:48) ← fundamental cycle of (x, y) px ← πC(x); py ← πC(y) if px (cid:54)= py then v on opposite side of C from fu. Algorithm 13 1: function find-sep-R01(u, v, fu, C, e(cid:48) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: u, e(cid:48) v ∈ C(cid:48) then if e(cid:48) y ← edges on C \ C(cid:48) incident to px, py x, e1 e1 v (cid:54)∈ C(cid:48) else e(cid:48) y ← edges on C ∩ C(cid:48) incident to px, py e1 x, e1 y ← edges on C(cid:48) \ C incident to px, py e2 x, e2 y ← faces incident to e1 x , ¯f 1 ¯f 1 y , ¯f 2 x , ¯f 2 x, e1 for ¯fx ∈ { ¯f 1 x , ¯f 2 for ¯fy ∈ { ¯f 1 x} do y , ¯f 2 y} do x, e2 y, e2 y on the same side of C, C(cid:48) as ¯fu (cid:46) The two cycles have common edges (case I) 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: else px = py (cid:46) The two cycles have no common edges (case X or H) fv ← meet( ¯fu, ¯fx, ¯fy) result ← max{result, choose-best-flip(u, v, fu, fv)} e1 u, e2 e1 v, e2 v , ¯f 2 ¯f 1 u, ¯f 2 for ¯fx ∈ { ¯f 1 u ← edges incident to πC(v) on C v ← edges incident to πC(cid:48)(u) on C(cid:48) v ← faces incident to e1 u, ¯f 1 u, e2 u, ¯f 2 for ¯fy ∈ { ¯f 1 u} do v , ¯f 2 v} do fv ← meet( ¯fu, ¯fx, ¯fy) result ← max{result, choose-best-flip(u, v, fu, fv)} u, e1 v, e2 v on the same side of C, C(cid:48) as ¯fu return result 31 Lemma 57. If (fu,·, C, e(cid:48) mental cycle intersecting E>b, and Xb is an R node, then find-sep-R01(u, v, fu, C, e(cid:48) Algorithm 13 returns the size and corners of a maximal u-flip. v) is good, E>b ∩ C = ∅, E<b ∩ C (cid:54)= ∅, (x, y) closes a good funda- v, x, y) in u, e(cid:48) u, e(cid:48) Proof. By Lemma 39 it is sufficient to show that at least one of the candidates to fv used in the calls to choose-best-flip(u, v, fu, fv) is correct. If px (cid:54)= py then C ∪ C(cid:48) consists of 3 internally vertex-disjoint paths from px to py, and by y} such that fv = meet( ¯fu, ¯fx, ¯fy). Lemma 52 with e = e(cid:48) Otherwise px = py, and C and C(cid:48) has at most one vertex in common, so by Lemma 53 with u there exists ¯fx ∈ { ¯f 1 e = e(cid:48) x , ¯f 2 Lemma 58. If (fu,·, C, e(cid:48) u, e(cid:48) Proof. Follows directly from the definition of fu, C, e(cid:48) Lemma 59. find-first-separation-flip(u, v) in Algorithm 7 runs in worst case O(log2 n) time, and: u there exists ¯fx ∈ { ¯f 1 x , ¯f 2 x} and ¯fy ∈ { ¯f 1 v) is good, E>b ∩ C = ∅, and E<b ∩ C = ∅, then Xb is a P node. x} and ¯fy ∈ { ¯f 1 y} such that fv = meet( ¯fu, ¯fx, ¯fy). y , ¯f 2 v being correct. u, e(cid:48) y , ¯f 2 • If G ∪ (u, v) is planar it always finds a maximal u-flip. • If G ∪ (u, v) is non-planar it either: -- finds a maximal u-flip; or -- finds a u-flip σ such that immediately calling find-first-separation-flip(u, v) again after executing σ will return a u-flip σ(cid:48) of the same size; or -- finds no u-flip. Proof. If G ∪ (u, v) is planar and only one flip is needed to admit (u, v), then by Lemma 43 our find-single-flip-candidates algorithm will find a correct candidate tuple, and then by Lemma 39 choose-best-flip will select the corresponding maximal u-flip, and this will be returned. Otherwise, let b be the minimum index of an fu-blocking node. If b = 1 then no u-flip exists and so no u-flip is found. If 1 < b < r, by Lemma 44 at least one of the candidate tuples is good. Let (fu,·, C, e(cid:48) v) be the good candidate tuple. Let E1, . . . , Ek be as in Definition 33. We will case by how C intersects E>b, and then by whether C separates fu from fv, and then, finally, by whether the Xb is a P or an R node. u, e(cid:48) • If C ∩ E>b (cid:54)= ∅ -- if C is separating, then by Lemma 45, (x, y) closes a good fundamental cycle C(cid:48), such that C(cid:48) \ C is a path in Eb, and: ∗ If Xb is a P node, {si, ti} = {πC(x), πC(y)} so by Lemma 50, we return the maximal ∗ If Xb is an R node, then by Lemma 54, we return the maximal u-flip. -- if C is not separating, then by Lemma 46, (x, y) closes a good fundamental cycle C(cid:48) u-flip. intersecting E<b, and: ∗ If Xb is a P node, then by Lemma 51, we return the maximal u-flip. ∗ If Xb is an R node, then by Lemma 55, we return the maximal u-flip. • If C ∩ E>b = ∅ then by Lemma 49 at least one of the (x, y) we try closes a cycle C(cid:48) intersecting E>b, and: -- If Xb is a P node, then by Lemma 56, we return the maximal u-flip. -- If Xb is an R node, then, by Lemma 58, C(cid:48) is separating. Then, by Lemma 57, we return the maximal u-flip. 32 Finally, if b = r and G ∪ (u, v) is nonplanar then we may find a non-maximal u-flip σ. This flip will be in some separation pair {sj, tj} with j < b − 1, and since every flip is chosen by a call choose-best-flip(u, v, fu, f(cid:48) v, Xj is not an S node. But then after performing the flip, Xj will be the first fu-blocking node, and since σ was locally maximal it will not be anti-fu-blocking. By the previous argument we are guaranteed that the next call to find-first-separation-flip(u, v) finds the unique (since Xj is not anti-fu-blocking) maximal u-flip, which is the inverse of σ and therefore has the same size. v) to be maximal for fu, f(cid:48) We are finally ready to prove a main theorem: Theorem 2. There is a data structure for maintaining a planar embedding of a fully-dynamic planar graph that handles edge-updates and planarity-compatibility queries in amortized O(log3 n) time, edge deletions in worst-case O(log2 n) time, and queries to the neighbors of a given existing edge in the current embedding in worst-case O(log2 n) time. Proof. Consider the function multi-flip-linkable(u, v) from Algorithm 1. By Lemma 59 and Lemma 32 each do-separation-flips(u, v) runs in O(log2 n) time per flip, and only does critical potential-decreasing flips (and at most one critical flip that is not potential-decreasing). Similarly, by Lemma 30 each do-articulation-flips(u, u(cid:48), v(cid:48), v) runs in O(log2 n) time and only does critical potential-decreasing or potential-neutral flips. By Lemma 31 any such potential-neutral flip is immediately followed by either a potential-decreasing flip (either a separation flip or an articulation flip) or by the final flip. Thus by Corollary 27 with r = 2, multi-flip-linkable(u, v) does amortized O(log n) flips. By Lemma 29, each find-next-flip-block(u, u(cid:48), v(cid:48), v) call also runs in O(log2 n) time. By Lemma 28 the main loop in multi-flip-linkable(u, v) iterates amortized O(log n) times, and we have shown that each iteration takes O(log2 n) time (in addition to the time taken by the separation flips). Thus the total amortized time for multi-flip-linkable(u, v) is O(log3 n). Using that, the remaining edge insertion and deletion is trivial. And the queries to the embedding are handled directly by the underlying data structure from [11]. 5 Allowing non-planar insertions In [7, p.12, proof of Corollary 1], Eppstein et al. give a reduction from any data structure that maintains a planar graph subject to deletions and planarity-preserving insertions and answers queries to the planarity-compatibility of edges, to a data structure that allows the graph to be non-planar and furthermore maintains whether the graph is presently planar, at the same amortized time. The reduction uses the following simple and elegant argument: If some component of the graph is non-planar, keep a pile of not-yet inserted edges, and upon a deletion, add edges from the pile until either the pile is empty or a new planarity-blocking certificate edge is found. To maintain not only whether the graph is planar but maintain for each component whether it is planar, it becomes necessary to keep a pile of not-yet inserted edges for each nonplanar connected component. To maintain the connected components, we run an auxiliary fully-dynamic connectivity structure for the entire graph [22], maintaining a spanning forest and the non-tree edges. We may mark the edges indicating whether they are inserted or not-yet inserted in the planar subgraph, and we may mark vertices indicating whether they are incident to not-yet inserted edges. When an edge deletion causes a non-planar component to break into two, a spanning tree breaks into two, say, Tu 33 and Tv. For each i ∈ {u, v}, we may efficiently find not-yet inserted edges incident to Ti, and insert them into the planar subgraph of the component spanned by Ti. We may continue until either all edges for that component are handled or until we find the first planarity violating edge. The method for efficiently finding not-yet inserted edges follows the exact same outline as the method for finding candidate replacement edges in the connectivity structure [22]. Thus, the time spent on each edge becomes O(log n/ log log n) worst-case for finding it, plus O(log3 n) amortized time for inserting it. We have thus shown Theorem 1. There is a data structure for fully-dynamic planarity testing that handles edge-insertions and edge-deletions in amortized O(log3 n) time, answers queries to planarity-compatibility of an edge in amortized O(log3 n) time, and answers queries to whether the graph is presently planar in worst case O(1) time, or to whether the component of a given vertex is presently planar in worst case O(log n/ log log n) time. It maintains an implicit representation of an embedding that is planar on each planar connected component, and may answer queries to the neighbors of a given existing edge in this current embedding, in O(log2 n) time. 6 Defining critical-cost and solid-cost The goal of this section is to properly define the two function families critical-costτ and solid-costτ mentioned earlier so we can prove the claimed properties. The general idea is for each function to define a set of struts, which are edges that can be inserted in G without violating planarity, and then measure the total number of flips needed to accommodate all of them. (cid:88) (cid:88) critical-costτ (H; u, v) = solid-costτ (H; u, v) = (x,y)∈critical-struts(G;u,v) (x,y)∈solid-struts(G;u,v) distτ (H, Emb(G; x, y)) distτ (H, Emb(G; x, y)) solid-struts(G; u, v) such that distclean(H, Emb(G; x, y)) (cid:54)= distclean(H(cid:48), Emb(G; x, y)). admits solid-struts(G; u(cid:48), v(cid:48)) such that distclean(H, H(cid:48)) ∈ O(log n). {(u, v)}. We want our struts to have the following properties for any planar graph G with vertices u, v: S1) G ∪ solid-struts(G; u, v) is simple and planar. S2) For any H, H(cid:48) ∈ Emb(G) with distclean(H, H(cid:48)) = 1, there is at most one strut (x, y) ∈ S3) If H ∈ Emb(G) admits solid-struts(G; u, v) then for any u(cid:48), v(cid:48) there exists H(cid:48) ∈ Emb(G) that S4) If G ∪ (u, v) is simple and planar, then solid-struts(G; u, v) = solid-struts(G ∪ (u, v); u, v) ∪ S5) critical-struts(G; u, v) ⊆ solid-struts(G; u, v). S6) For (u, v) ∈ G, critical-struts(G; u, v) = ∅. S7) For (u, v) (cid:54)∈ G, critical-struts(G; u, v) = {(u, v)} if and only if G ∪ (u, v) is planar. S8) If G ∪ (u, v) is nonplanar, and v = a0, B1, a1, . . . , Bk, ak = v are the endpoints, biconnected components/bridges, and articulation points on u··· v in G, then (a) For each Bi such that Bi ∪ (ai−1, ai) is nonplanar, critical-struts(G; u, v) contains a set Si of struts with both endpoints in Bi such that ai−1 and ai are triconnected in Bi ∪ Si and Bi ∪ Si is planar. 34 (b) For each maximal subsequence a(cid:96)−1, B(cid:96), a(cid:96), . . . , Bh, ah such that G ∪ (a(cid:96)−1, ah) is planar, and such that at least one Bi with (cid:96) ≤ i ≤ h is not a bridge, critical-struts(G; u, v) contains a strut (a(cid:96)−1, ah). Assuming our struts have these properties, we can now prove our Lemmas about the costs. Proof of Lemma 15. The inequality solid-costτ (G; u, v) ≥ critical-cost(G; u, v) ≥ 0 follows from property S5 and the definition of solid-costτ and critical-costτ . The inequalities solid-costclean ≥ solid-costsep ≥ solid-costP and critical-costclean ≥ critical-costsep ≥ critical-costP also follow, be- cause in general distclean ≥ distsep ≥ distP. Finally, if G ∪ (u, v) is planar, then by property S7, critical-struts(G; u, v) = {(u, v)} so critical-costclean(H; u, v) = distclean(H; Emb(G; u, v)), which is 0 if and only if H ∈ Emb(G; u, v). Proof of Lemma 16. Follows directly from properties S2 and S5, and the definition of critical flip. Proof of Lemma 17. From the definition of critical-costτ and solid-costτ as a sum over distτ , it is clear that if the cost is nonzero there exists a flip of type τ that decreases at least one of the terms. But by property S2, this is then the only term that changes so this flip also decreases the sum. Proof of Lemma 21. By definition of H ∈ Emb(cid:63)(G), there exists vertices umin, vmin such that solid-cost(H; umin, vmin) = 0. By definition of solid-costclean that means H admits solid-strutsclean(G; umin, vmin). Then by Property S3 there exists H(cid:48) ∈ Emb(G) that admits solid-struts(G; u, v) and has distclean(H, H(cid:48)) ∈ O(log n). Since H(cid:48) admits solid-struts(G; u, v), H(cid:48) ∈ Emb(cid:63)(G; u, v), and thus distclean(H, Emb(cid:63)(G; u, v)) ≤ distclean(H, H(cid:48)) ∈ O(log n). Proof of Lemma 23. By Property S4, the only difference between solid-struts(G; u, v) and solid-struts(G ∪ (u, v); u, v) is that the first includes the strut (u, v). Since H ∈ Emb(G; u, v), distclean(H, Emb(G; u, v)) = 0 so removing this term does not change the sum. By Property S2, the possible flips for every other strut (u(cid:48), v(cid:48)) is unaffected, meaning that dist(H, Emb(G; u(cid:48), v(cid:48))) = dist(H ∪ (u, v), Emb(G ∪ (u, v); u(cid:48), v(cid:48))). In other words, solid-cost(H; u, v) = solid-cost(H ∪ (u, v); u, v). Proof of Lemma 26. Follows directly from the definition of critical-costτ and solid-costτ as a sum (x,y) distτ (H; x, y), and the definition of distτ . By definition an SR flip can not change any distP, and an articulation flip can not change any distP or distsep. (cid:80) 6.1 Biconnected planar graphs Let SPQR(B; u, v) denote the solid paths in the pre-split SPQR tree for the biconnected component B with critical vertices u, v. Let β be a solid path in SPQR(B; u, v). The relevant part of β is the maximal subpath that does not end in a P node. Single solid SPQR path, simple case If β consists only of a P node, or the relevant part of β is only a single node, define the struts relevant for β as: (cid:40){(u, v)} if β is the critical path, (u, v) (cid:54)∈ B, and G ∪ (u, v) is planar struts(β) = ∅ otherwise 35 Single solid SPQR path, general case Otherwise let X1, . . . , Xd be the relevant part of β. For 1 ≤ j < d let {sj, tj} = Xj ∩ Xj+1 be the separation pair that separates Xj from Xj+1. For 1 < j < d we call the node Xj cross if Xj is an R node, and the virtual edges (sj−1, tj−1) and (sj, tj) do not share a face in Γ(Xj). If β is the critical path, we can assume without loss of generality that u ∈ X1 and v ∈ Xd, and we say that X1 (resp. Xd) is cross if it is an R node and u (resp. v) does not share a face with (s1, t1) (resp. (sd−1, td−1)). Let γ = X(cid:96), . . . , Xh be a maximal subpath of X1, . . . , Xd such that Xj is not a cross node for (cid:96) < j < h. Let uγ be the smallest-labelled vertex in Γ(X(cid:96)) − {s(cid:96), t(cid:96)} that shares a face with (s(cid:96), t(cid:96)) (counting u as having label −∞). Similarly let vγ be the smallest-labelled vertex in Γ(Xh) − {sh−1, th−1} that shares a face with (sh−1, th−1) (counting v as having label −∞). We can now define the struts relevant for β as struts(β) = {(uγ, vγ) γ is such a maximal subpath} Combining the struts for a SPQR tree critical-struts(B; u, v) = off-critical-struts(B; u, v) = struts(β) struts(β) (cid:91) (cid:91) β∈SPQR(B;u,v) β is critical β∈SPQR(B;u,v) β is not critical solid-struts(B; u, v) = critical-struts(B; u, v) ∪ off-critical-struts(B; u, v) 6.2 General planar graphs Let BC(G; u, v) denote the set of solid paths in the forest of pre-split BC trees for a planar graph G with critical vertices u, v. Let α be a solid path in BC(G; u, v). The relevant part of α is the maximal subpath that does not end in a C node. Single solid BC path, simple case If α consists only of a C node, define critical-struts(α) = ∅ off-critical-struts(α) = ∅ solid-struts(α) = ∅ Single solid BC path, general case In [12] we defined a set of struts for each such path and used it to choose a critical path in the SPQR tree for each biconnected component. Since those struts might make the graph non-planar, we need a new set; we want to substitute every non-planar strut with a family of "maximal" planar struts in the following sense. Let B1, . . . , Bk be the B nodes on α, for 1 < i < k let ai = Bi ∩ Bi+1, and let (a0, ak) be the strut defined for α in [12]. Note that if α is the critical path in BC(G; u, v) then we may assume without loss of generality that a0 = u and ak = v. 36 Now define critical-struts(α) = {critical-struts(Bi; ai−1, ai) G ∪ (ai−1, ai) is nonplanar } (a(cid:96)−1, ah) k(cid:91) ∪ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (a(cid:96)−1, ah) (cid:54)∈ G and B(cid:96), . . . , Bh is a maximal subpath of α such that G ∪ (a(cid:96)−1, ah) is planar  off-critical-struts(α) = off-critical-struts(Bi; ai−1, ai) solid-struts(α) = critical-struts(α) ∪ off-critical-struts(α) i=1 Combining the struts from a forest of BC trees Now define: critical-struts(G; u, v) = critical-struts(α) (cid:91)  (cid:91) α∈BC(G;u,v) α is critical  ∪  (cid:91)  solid-struts(α) off-critical-struts(G; u, v) = off-critical-struts(α) α∈BC(G;u,v) α is not critical solid-struts(G; u, v) = critical-struts(G; u, v) ∪ off-critical-struts(G; u, v) α∈BC(G;u,v) α is critical 6.3 Proving the required properties Lemma 60. The definition of critical-struts(G; u, v) and solid-struts(G; u, v) in Section 6.1 and 6.2 have property S1 -- S8. Proof. Every clean separation flip in Emb(G) corresponds to an edge or a P node in a SPQR tree for a biconnected component of G. The way the struts are chosen for biconnected graphs, means that no two struts "cover" the same edge or P node. Similarly, each possible articulation flip in Emb(G) correspond to a C node, and no two struts cover the same C node. Thus any flip in H ∈ Emb(G) can affect distτ (H, Emb(G; x, y)) for at most 1 strut (x, y) proving Property S2. Since each strut (x, y) is chosen so G ∪ (x, y) is simple and planar, and inserting one strut can not prevent the insertion of another, G ∪ solid-struts(G; u, v) is planar and Property S1 holds. In [12], we showed that it takes only O(log n) simple operations (merging or splitting S,P and C nodes, and changing edges between solid and dashed) to get from the pre-split BC/SPQR trees for G with respect to u, v to the trees with respect to u(cid:48), v(cid:48). Each of these operations affect only at most 2 solid paths, and by our definition, at most one strut on each of these paths. The total change in solid-costτ for each of these O(log n) operations is at most a con- stant, so solid-costτ (H; u, v) − solid-costτ (H; u(cid:48), v(cid:48)) ∈ O(log n). If H admits solid-struts(G; u, v) then solid-costclean(H; u, v) = 0, so solid-costclean(H; u(cid:48), v(cid:48)) ∈ O(log n). For each strut (x, y) ∈ solid-struts(G; u(cid:48), v(cid:48)) with distclean(H, Emb(x, y)) > 0 there exists some flip that will reduce this distance. After O(log n) such flips we arrive at a new embedding H(cid:48) ∈ Emb(G) with solid-costclean(H(cid:48); u(cid:48), v(cid:48)) = 0, which means H(cid:48) admits solid-struts(G; u(cid:48), v(cid:48)). By construction distclean(H, H(cid:48)) ∈ O(log n), so this proves Property S3. Property S5 follows trivially from the definition of solid-struts(G; u, v) as the (disjoint) union of critical-struts(G; u, v) and off-critical-struts(G; u, v). 37 Property S6 follows by noting that in the definition, every edge added as a strut is conditioned on the edge not being in the graph. Property S7 can be seen by considering the definition of critical-struts(α). If (u, v) (cid:54)∈ G and G ∪ (u, v) is planar, then for the critical path α ∈ BC(G; u, v), the maximal subpath found in the definition is exactly the one that starts in u and ends in v. So in this case, critical-struts = {(u, v)}. If G∪(u, v) is not planar (u, v) (cid:54)∈ solid-struts(G; u, v) by Property S1, and hence (u, v) (cid:54)∈ critical-struts(G; u, v) by Property S5, and in particular critical-struts(G; u, v) (cid:54)= {(u, v)}. If G ∪ (u, v) is simple and planar, our definition guarantees that (u, v) ∈ solid-struts(G; u, v). By definition of the pre-split BC/SPQR trees, the only change to the solid paths when inserting (u, v) is the contraction of the critical path in the BC tree, and in all the SPQR trees on the critical path. All other solid paths in the pre-split BC/SPQR tree remain unchanged. In partic- ular off-critical-struts(G; u, v) = off-critical-struts(G ∪ (u, v); u, v), and together with Property S6 and S7 and the fact that solid-struts(G; u, v) is the disjoint union of critical-struts(G; u, v) and off-critical-struts(G; u, v) this proves Property S4. Property S8 follows by simple inspection. Case S8a follows from using maximal subpaths in the definition in Section 6.1. Similarly, Case S8b follows from using maximal subpaths in the definition in Section 6.2. Proof of Lemma 24. If the clean separation flip at s, t changes solid-costτ or critical-costτ , it must be internal to a unique solid path β in some SPQR tree. Since it is internal, even if β is the critical path for some x, y, then {x, y} ∩ {s, t} = ∅. Thus, s, t are not internal to any solid path in the BC tree, and do not have any contribution to solid-costτ or critical-costτ that can change. If the clean separation flip does not change solid-costτ or critical-costτ , it may be incident to the end of a critical path m(x, y). However, at most 2 of the at most 4 articulation flips contain neighboring blocks on the solid path in the BC tree. If 2 of them do, then the flip does not change whether or not they share a face, and so solid-costτ and critical-costτ are unchanged. Otherwise at most 1 of the at most 4 articulation flips change solid-costτ or critical-costτ , as desired. 7 Conclusion We have given an amortized O(log3 n) time algorithm for updating whether a graph is still planar after the insertion or deletion of an edge. This is close but not equal to the theoretical lower bound of Ω(log n) [16]. An interesting open question is whether this time bound can be improved, or whether an algorithm with worst-case polylogarithmic update time exists. Acknowledgements. The authors would like to thank Mikkel Thorup, Kristian de Lichtenberg, and Christian Wulff-Nilsen for their interest and encouragement. References [1] Amir Abboud and Søren Dahlgaard. Popular conjectures as a barrier for dynamic planar graph algorithms. In IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS 2016, 9-11 October 2016, Hyatt Regency, New Brunswick, New Jersey, USA, pages 477 -- 486, 2016. doi:10.1109/FOCS.2016.58. 1 38 [2] Amir Abboud and Virginia Vassilevska Williams. Popular conjectures imply strong lower bounds for dynamic problems. In 55th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2014, Philadelphia, PA, USA, October 18-21, 2014, pages 434 -- 443, 2014. doi:10.1109/FOCS.2014.53. 1 [3] Samuel W. Bent, Daniel Dominic Sleator, and Robert Endre Tarjan. Biased search trees. SIAM J. Comput., 14(3):545 -- 568, 1985. doi:10.1137/0214041. 5 [4] Gerth Stølting Brodal and Rolf Fagerberg. Dynamic representation of sparse graphs. In Frank K. H. A. Dehne, Arvind Gupta, Jörg-Rüdiger Sack, and Roberto Tamassia, editors, Algorithms and Data Structures, 6th International Workshop, WADS '99, Vancouver, British Columbia, Canada, August 11-14, 1999, Proceedings, volume 1663 of Lecture Notes in Computer Science, pages 342 -- 351. Springer, 1999. doi:10.1007/3-540-48447-7\_34. 2 [5] Giuseppe Di Battista and Roberto Tamassia. On-line maintenance of triconnected components with SPQR-trees. Algorithmica, 15(4):302 -- 318, 1996. doi:10.1007/BF01961541. 1, 4 [6] David Eppstein. Dynamic generators of topologically embedded graphs. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, January 12-14, 2003, Baltimore, Maryland, USA., pages 599 -- 608. ACM/SIAM, 2003. URL: http://dl.acm.org/ citation.cfm?id=644108.644208. 1 [7] 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 Systems Sciences, 52(1):3 -- 27, February 1996. doi:10.1006/jcss.1996.0002. 1, 3, 33 [8] Zvi Galil, Giuseppe F. Italiano, and Neil Sarnak. Fully dynamic planarity testing with applica- tions. J. ACM, 46(1):28 -- 91, 1999. doi:10.1145/300515.300517. 1 [9] Frank Harary. Graph Theory. Addison-Wesley Series in Mathematics. Addison Wesley, 1969. 4 [10] Jacob Holm, Giuseppe F. Italiano, Adam Karczmarz, Jakub Lacki, and Eva Rotenberg. Decremental spqr-trees for planar graphs. In Yossi Azar, Hannah Bast, and Grzegorz Her- man, editors, 26th Annual European Symposium on Algorithms, ESA 2018, August 20-22, 2018, Helsinki, Finland, volume 112 of LIPIcs, pages 46:1 -- 46:16. Schloss Dagstuhl - Leibniz- Zentrum fuer Informatik, 2018. URL: http://www.dagstuhl.de/dagpub/978-3-95977-081-1, doi:10.4230/LIPIcs.ESA.2018.46. 4 [11] Jacob Holm and Eva Rotenberg. Dynamic planar embeddings of dynamic graphs. Theory Comput. Syst., 61(4):1054 -- 1083, 2017. doi:10.1007/s00224-017-9768-7. 1, 2, 5, 10, 12, 17, 20, 21, 22, 33 [12] Jacob Holm and Eva Rotenberg. Worst-case polylog incremental spqr-trees: Embeddings, planarity, and triconnectivity, 2019. Accepted for publication at SODA 2020. arXiv:1910.09005. 1, 2, 4, 5, 7, 36, 37 [13] John E. Hopcroft and Robert Endre Tarjan. Dividing a graph into triconnected components. SIAM J. Comput., 2(3):135 -- 158, 1973. doi:10.1137/0202012. 4 39 [14] John E. Hopcroft and Robert Endre Tarjan. Efficient planarity testing. J. ACM, 21(4):549 -- 568, 1974. doi:10.1145/321850.321852. 1 [15] Giuseppe F. Italiano, Johannes A. La Poutré, and Monika Rauch. Fully dynamic planarity testing in planar embedded graphs (extended abstract). In Thomas Lengauer, editor, Algorithms - ESA '93, First Annual European Symposium, Bad Honnef, Germany, September 30 - October 2, 1993, Proceedings, volume 726 of Lecture Notes in Computer Science, pages 212 -- 223. Springer, 1993. doi:10.1007/3-540-57273-2\_57. 1 [16] Mihai Patrascu and Erik D. Demaine. Lower bounds for dynamic connectivity. In László Babai, editor, Proceedings of the 36th Annual ACM Symposium on Theory of Computing, Chicago, IL, USA, June 13-16, 2004, pages 546 -- 553. ACM, 2004. doi:10.1145/1007352.1007435. 1, 38 [17] Johannes A. La Poutré. Alpha-algorithms for incremental planarity testing (preliminary version). In Frank Thomson Leighton and Michael T. Goodrich, editors, Proceedings of the Twenty-Sixth Annual ACM Symposium on Theory of Computing, 23-25 May 1994, Montréal, Québec, Canada, pages 706 -- 715. ACM, 1994. doi:10.1145/195058.195439. 1 [18] Daniel Dominic Sleator and Robert Endre Tarjan. A data structure for dynamic trees. J. Comput. Syst. Sci., 26(3):362 -- 391, 1983. doi:10.1016/0022-0000(83)90006-5. 5 [19] Roberto Tamassia. On-line planar graph embedding. J. Algorithms, 21(2):201 -- 239, 1996. doi:10.1006/jagm.1996.0044. 1 [20] Jeffery Westbrook. Fast incremental planarity testing. In Werner Kuich, editor, Automata, Languages and Programming, 19th International Colloquium, ICALP92, Vienna, Austria, July 13-17, 1992, Proceedings, volume 623 of Lecture Notes in Computer Science, pages 342 -- 353. Springer, 1992. doi:10.1007/3-540-55719-9\_86. 1 [21] Hassler Whitney. 2-isomorphic graphs. American Journal of Mathematics, 1933. 2 [22] Christian Wulff-Nilsen. Faster deterministic fully-dynamic graph connectivity. In Encyclopedia of Algorithms, pages 738 -- 741. 2016. doi:10.1007/978-1-4939-2864-4_569. 33, 34 40
1811.04596
2
1811
2019-02-18T05:29:30
MR-RePair: Grammar Compression based on Maximal Repeats
[ "cs.DS" ]
We analyze the grammar generation algorithm of the RePair compression algorithm and show the relation between a grammar generated by RePair and maximal repeats. We reveal that RePair replaces step by step the most frequent pairs within the corresponding most frequent maximal repeats. Then, we design a novel variant of RePair, called MR-RePair, which substitutes the most frequent maximal repeats at once instead of substituting the most frequent pairs consecutively. We implemented MR-RePair and compared the size of the grammar generated by MR-RePair to that by RePair on several text corpus. Our experiments show that MR-RePair generates more compact grammars than RePair does, especially for highly repetitive texts.
cs.DS
cs
MR-RePair: Grammar Compression based on Maximal Repeats Isamu Furuya∗, Takuya Takagi∗, Yuto Nakashima†, Shunsuke Inenaga†, Hideo Bannai†, Takuya Kida∗ ∗ Graduate School of IST, Hokkaido University, Japan [email protected] [email protected] [email protected] † Department of Informatics, Kyushu University, Japan [email protected] [email protected] [email protected] Abstract We analyze the grammar generation algorithm of the RePair compression algorithm, and show the relation between a grammar generated by RePair and maximal repeats. We reveal that RePair replaces step by step the most frequent pairs within the corresponding most frequent maximal re- peats. Then, we design a novel variant of RePair, called MR-RePair, which substitutes the most frequent maximal repeats at once instead of substituting the most frequent pairs consecutively. We implemented MR-RePair and compared the size of the grammar generated by MR-RePair to that by RePair on several text corpora. Our experiments show that MR-RePair generates more compact grammars than RePair does, especially for highly repetitive texts. 1 Introduction Grammar compression is a method of lossless data compression that reduces the size of a given text by constructing a small context free grammar that uniquely derives the text. While the problem of generating the smallest such grammar is NP-hard [6], several approximation techniques have been proposed. Among them, RePair [11] is known as an off-line method that achieves a high compression ratio in practice [7, 9, 20], despite its simple scheme. There have been many studies concerning RePair, such as extending it to an online algorithm [13], improving its practical working time or space [5, 17], applications to other fields [7, 12, 18], and analyzing the generated grammar size theoretically [6, 15, 16]. Recently, maximal repeats have been considered as a measure for estimating how repetitive a given string is: Belazzougui et al. [4] showed that the number of extensions of maximal repeats is an upper bound on the number of runs in the Burrows-Wheeler transform and the number of factors in the Lempel- Ziv parsing. Also, several index structures whose size is bounded by the number of extensions of maximal repeats have been proposed [2, 3, 19]. In this paper, we analyze the properties of RePair with regard to its relationship to maximal repeats. As stated above, several works have studied RePair, but, to the best of our knowledge, none of them associate RePair with maximal repeats. Moreover, we propose a grammar compression algorithm, called MR-RePair, that focuses on the property of maximal repeats. Ahead of this work, several off-line grammar compression schemes focusing on (non-maximal) repeats have been proposed [1, 10, 14]. Very recently, Ga´nczorz and Jez addressed to heuristically improve the compression ratio of RePair with regard to the grammar size [8]. However, none of these techniques use the properties of maximal repeats. We show that, under a specific condition, there is a theoretical guarantee that the size of the grammar generated by MR-RePair is smaller than or equal to that generated by RePair. We also confirmed the effectiveness of MR-RePair compared to RePair through computational experiments. Contributions: The primary contributions of this study are as follows. 1. We analyze RePair and show the relation between a grammar generated by RePair and maximal repeats. 2. We design a novel variant of RePair called MR-RePair, which is based on substituting the most frequent maximal repeats. 3. We implemented our MR-RePair algorithm and experimentally confirmed that MR-RePair reduces the size of the generated grammar compared to RePair; in particular, the size decreased to about 55% for a highly repetitive text that we used in our experiment. The remainder of this paper is organized as follows. In Section 2, we review the notations of strings and the definitions of maximal repeats, grammar compression, and RePair. In Section 3, we analyze RePair and show the relation between RePair and maximal repeats. In Section 4, we define MR-RePair, compare it with RePair, and describe the implementation of it. In Section 5, we present experimental results of comparison to RePair. Finally, we conclude the paper in Section 6. 2 Preliminaries In this sections, we provide some notations and definitions to be used in the following sections. addition, we recall grammar compression and review the RePair. In 2.1 Basic notations and terms Let Σ be an alphabet, which is an ordered finite set of symbols. An element T = t1 ··· tn of Σ∗ is called a string, where T = n denotes its length. We denote the empty string by  which is the string of length 0, namely,  = 0. Let Σ+ = Σ∗ \{}. A string is also called a text. Let T = t1 ··· tn ∈ Σn be any text of length n. If T = usw with u, s, w ∈ Σ∗, then s is called a substring of T . Then, for any 1 ≤ i ≤ j ≤ n, let T [i..j] = ti ··· tj denote the substring of T that begins and ends at positions i and j in T , and let T [i] = ti denote the ith symbol of T . For a finite set S of texts, text T is said a superstring of S, if T contains all texts of S as substrings. We call the number of occurrences of s in a text as a substring, the frequency of s, and denote it by #occ(s). Texts Σ∗ and Σ∗ are said to be isomorphic for alphabet Σ and Σ, if there exists an isomorphism from Σ to Σ. 2.2 Maximal repeats Let s be a substring of text T . If the frequency of s is greater than 1, s is called a repeat. A left (or right) extension of s is any substring of T with the form ws (or sw), where w ∈ Σ∗. We say that s is left (or right) maximal if left (or right) extensions of s occur strictly fewer times in T than s, and call s a maximal repeat of T if s is left and right maximal. We call s a maximal repeatg of T if both left- and right-extensions of s occur strictly fewer times in T than s. In this thesis, we consider only such strings with length more than 1 as maximal repeats. For example, substring abra of T =abracadabra is a maximal repeat, while br is not. 2.3 Grammar compression A context free grammar (CFG or grammar, simply) G is defined as a 4-tuple G = {V, Σ, S, R}, where V is an ordered finite set of variables, Σ is an ordered finite alphabet, R is a finite set of binary relations called production rules (or rules) between V and (V ∪ Σ)∗, and S ∈ V is a special variable called start form v → w with v ∈ V and w ∈ (V ∪ Σ)∗. Let X, Y ∈ V ∪ Σ . If there are xl, x, xr, y ∈ (V ∪ Σ)∗ such that X = xlxxr, Y = xlyxr, and x → y ∈ R, we write X ⇒ Y , and denote the reflexive transitive closure variable. A production rule represents the manner in which a variable is substituted and written in a ∗ 2 vα → α (α = a, b, r, c, d) v1 → vavb v2 → v1vr v3 → v2va S → v3vcvavdv3 a va v1 b vb v2 r vr vr v3 a va va va c vc vc vc vc a va va va va S d vd vd vd vd a va v1 b vb v2 r vr vr v3 a va va va Figure 1: An example of the grammar generation process of RePair for text abracadabra. The generated grammar is {{va, vb, vr, vc, vd, v1, v2, v3, S},{a, b, r, c, d}, S,{va → a, vb → b, vr → r, vc → c, vd → d, v1 → vavb, v2 → v1vc, v3 → v2vd, S → v3vcvavdv3}}, and the grammar size is 16. ∗ ∗ ⇒ val (v), and let [[w]] denote a variable that ⇒. Let val (v) be the string derived from v, i.e., v of ⇒ by ∗ ⇒ w. Note that [[w]] is not necessarily unique. We define grammar G = { V , Σ, S, R} derives w, i.e. [[w]] as a subgrammar of G if V ⊆ V , Σ ⊆ V ∪ Σ, and R ⊆ R. Given a text T , grammar compression is a method of lossless text data compression that constructs a restricted CFG, which uniquely derives the given text T . For G to be deterministic, a production rule for each variable v ∈ V must be unique. In what follows, we assume that every grammar is deterministic and each production rule is vi → expr i, where expri is an expression either expr i = a (a ∈ Σ) or expr i = vj1vj2 ··· vjn ( i > jk for all 1 ≤ k ≤ jn). We estimate the effectiveness of compression by the size of generated grammar, which is counted by the total length of the right-hand-side of all production rules of the generated grammar. 2.4 RePair RePair is a grammar compression algorithm proposed by Larsson and Moffat [11]. For input text T , let G = {V, Σ, S, R} be the grammar generated by RePair. RePair constructs G by the following steps: Step 1. Replace each symbol a ∈ Σ with a new variable va and add va → a to R. Step 2. Find the most frequent pair p in T . Step 3. Replace every occurrence (or, as many occurrences as possible, when p is a pair consisting of the same symbol) of p with a new variable v, then add v → p to R. Step 4. Re-evaluate the frequencies of pairs for the renewed text generated in Step 3. If the maximum frequency is 1, add S → (current text) to R, and terminate. Otherwise, return to Step 2. Figure 1 shows an example of the grammar generation process of RePair. Lemma 1 ([11]). RePair works in O(n) expected time and 5n + 4k2 + 4k(cid:48) +(cid:100)√n + 1(cid:101)− 1 words of space, where n is the length of the source text, k is the cardinality of the source alphabet, and k(cid:48) is the cardinality of the final dictionary. 3 Analyzing RePair In this section, we analyze RePair with regard to its relationship to maximal repeats, and introduce an important concept, called MR-order. 3.1 RePair and maximal repeats The following theorem shows an essential property of RePair. That is, RePair recursively replaces the most frequent maximal repeats. 3 Theorem 1. Let T be a given text, and assume that every most frequent maximal repeat of T does not appear with overlaps with itself. Let f be the frequency of the most frequent pairs of T , and t be a text obtained after all pairs with frequency f in T are replaced by variables. Then, there is a text s such that s is obtained after all maximal repeats with frequency f in T are replaced by variables, and s and t are isomorphic to each other. We need two lemmas and a corollary to prove Theorem 1. The following lemma shows a fundamental relation between the most frequent maximal repeats and the most frequent pairs in a text. Lemma 2. A pair p of variables is most frequent in text T if and only if p occurs once in exactly one of the most frequent maximal repeats of T . Proof. (⇒) Let r be a most frequent maximal repeat that contains p as a substring. It is clear that p can only occur once in r, since otherwise, #occ(p) > #occ(r) would hold, implying the existence of a frequent maximal repeat that is more frequent than r, contradicting the assumption that r is most frequent. Suppose there exists a different most frequent maximal repeat r(cid:48) that contains p as a substring. Similarly, p occurs only once in r(cid:48). Furthermore, since r and r(cid:48) can be obtained by left and right extensions to p, #occ(r) = #occ(r(cid:48)) = #occ(p), and any occurrence of p is contained in an occurrence of both r and r(cid:48). Since r(cid:48) cannot be a substring of r, there exists some string w that is a superstring of r and r(cid:48), such that #occ(w) = #occ(r) = #occ(r(cid:48)) = #occ(p). However, this contradicts that r and r(cid:48) are maximal repeats. (⇐) Let r be the most frequent maximal repeat such that p occurs once in. By definition, #occ(r) = #occ(p). If p is not the most frequent symbol pair in T , there exists some symbol pair p(cid:48) in T such that #occ(p(cid:48)) > #occ(p) = #occ(r). However, this implies that there is a maximal repeat r(cid:48) with #occ(r(cid:48)) = #occ(p(cid:48)) > #occ(r), contradicting that r is most frequent. The following corollary is directly derived from Lemma 2. Corollary 1. For a given text, the frequency of the most frequent pairs and that of the most frequent maximal repeats are the same. The following lemma shows an important property of the most frequent maximal repeats. Lemma 3. The length of overlap between any two occurrences of most frequent maximal repeats is at most 1. Proof. Let xw and wy be most frequent maximal repeats that have an overlapping occurrence xwy, where x, y, w ∈ Σ+. If w ≥ 2, then, since xw and wy are most frequent maximal repeats, it must be that #occ(w) = #occ(xw) = #occ(wy), i.e., every occurrence of w is preceded by x and followed by y. This implies that #occ(xwy) = #occ(xw) = #occ(wy) as well, but contradicts that xw and wy are maximal repeats. From the above lemmas and a corollary, now we can prove Theorem 1. Proof of Theorem 1. By Corollary 1, the frequency of the most frequent maximal repeats in T is f . Let p be one of the most frequent pairs in T . By Lemma 2, there is a unique maximal repeat that is most frequent and contains p once. We denote such maximal repeat by r. Assume that there is a substring zxpyw in T , where z, w ∈ Σ, x, y ∈ Σ∗, and xpy = r. We denote r[1] and r[r] by x and y, respectively. There are 2 cases to consider: (i) #occ(z x) < f and #occ( yw) < f . If r = 2, the replacement of p directly corresponds to the If r > 2, after p is replaced with a replacement of the most frequent maximal repeat, since p = r. variable v, r is changed to xvy. This occurs f times in the renewed text, and by Lemma 2, the frequency of every pair occurring in xvy is still f . Because the maximum frequency of pairs does not increase, f is still the maximum frequency. Therefore, we replace all pairs contained in xvy in the following steps, 4 and z x and yw are not replaced. This holds for every occurrence of p, implying that replacing the most frequent pairs while the maximum frequency does not change, corresponds to replacing all pairs contained (old and new) in most frequent maximal repeats of the same frequency until they are replaced by a single variable. Then, we can generate s by replacement of r. (ii) #occ(z x) = f or #occ( yw) = f . We consider the case where #occ(z x) = f . Note that #occ(zxpy) < f by assumption that xpy is a maximal repeat. Suppose RePair replaces z x by a variable v before p is replaced. Note that by Lemma 2, there is a maximal repeat occurring f times and including z x once (we denote the maximal repeat by r(cid:48)), and r(cid:48) (cid:54)= r by assumption. By Lemma 3, the length of overlap of r and r(cid:48) is at most 1, then only x is a symbol contained both r and r(cid:48). After that, xpy = r is no longer the most frequent maximal repeat because some of its occurrences are changed to vr[2..r]. However, r[2..r] still occurs f times in the renewed text. Since #occ(zxpy) < f and #occ(xpy) = f , #occ(vr[2]) < f and r[2..r] is a maximal repeat. Then, r[2..r] will become a variable in subsequent steps, similarly to (i). Here, r(cid:48) would also become a variable. Thus, we can generate s in the way that we replace r(cid:48) first, then we replace r[2..r]. This holds similarly for yw when #occ( yw) = f , and when #occ(z x) = #occ( yw) = f . 3.2 MR-order From Theorem 1, if the most frequent maximal repeat is unique in the current text, then all the oc- currences of it are replaced step by step by RePair. However, it is a problem if there are two or more most frequent maximal repeats and some of them overlap. In this case, which maximal repeat is first summarized up depends on the order in which the most frequent pairs are selected. Note, however, if there are multiple most frequent pairs, which pair is first replaced depends on the implementation of RePair. We call this order of selecting (summarizing) maximal repeats maximal repeat selection order (or MR-order, simply). For instance, consider a text abcdeabccde. abc and cde are the most frequent maximal repeats occurring 2 times. There are 2 MR-order, depending on which one is attached priority to the other. The results after replacement by RePair with the MR-order are (i) xyxcx with variables x and y such that ∗ ⇒ cde. More x precisely, there are 12 possible ways in which RePair can compress the text, and the generated rule sets are: ∗ ⇒ de, and (ii) zwzcw with variables z and w such that z ∗ ⇒ abc and y ∗ ⇒ ab and w 1. {v1 → ab, v2 → v1c, v3 → de, S → v2v3v2cv3}, 2. {v1 → ab, v2 → de, v3 → v1c, S → v3v2v3cv2}, 3. {v1 → bc, v2 → av1, v3 → de, S → v2v3v2cv3}, 4. {v1 → bc, v2 → de, v3 → av1, S → v3v2v3cv2}, 5. {v1 → ed, v2 → ab, v3 → v2c, S → v3v1v3cv1}, 6. {v1 → ed, v2 → bc, v3 → av2, S → v3v1v3cv1}, 7. {v1 → ab, v2 → cd, v3 → v2e, S → v1v3v1cv3}, 8. {v1 → ab, v2 → de, v3 → cv2, S → v1v3v1cv3}, 9. {v1 → cd, v2 → ab, v3 → v1e, S → v2v3v2cv3}, 10. {v1 → cd, v2 → v1e, v3 → ab, S → v3v2v3cv2}, 11. {v1 → ed, v2 → ab, v3 → cv1, S → v2v3v2cv3}, 5 12. {v1 → ed, v2 → cv1, v3 → ab, S → v3v2v3cv2}. Here, 1 - 6 have the same MR-order, because abc is prior to cde in all of them. On the other hand, 7 - 12 have the same MR-order for similar reason; cde is prior to abc. The size of the grammar generated by RePair varies according to how to select a pair when there are several distinct most frequent pairs that overlap. For instance, consider the text bcxdabcyabzdabvbcuda. There are 3 most frequent pairs, ab, bc, and da with 3 occurrences. If RePair takes ab first, the rule set of generated grammar may become {v1 → ab, v2 → bc, v3 → dv1, S → v2xv3cyv1zv3vv2uda} and the size of it is 19. On the other hand, if RePair takes da first, the rule set of generated grammar may become {v1 → da, v2 → bc, S → v2xv1v2yabzv1bvv2uv1} and the size of it is 18. Remark 1. If there are several distinct pairs with the same maximum frequency, the size of the grammar generated by RePair depends on the replacement order of them. However, the following theorem states that MR-order rather than the replacement order of pairs is essentially important for the size of the grammar generated by RePair. Theorem 2. The sizes of the grammars generated by RePair are the same if they are generated in the same MR-order. Proof. Let T be a variable sequence appearing in the grammar generation process of RePair, and f be the maximum frequency of pairs in T . Suppose that T (cid:48) is a variable sequence generated after RePair replaces every pair occurring f times. By Theorem 1, all generated T (cid:48) are isomorphic to one another, then the length of all of them is the same, regardless of the replacement order of pairs. Let r1 be the most frequent maximal repeats of T such that r1 is prior to all other ones in this MR-order. r1 is converted into a variable as a result, and by Lemma 2, all pairs included in r1 are distinct. Then, the size of the subgrammar which exactly derives r1 is 2(r1 − 1) + 1 = 2r1 − 1. This holds for the next prioritized maximal repeat (we denote it by r2) with a little difference; the pattern actually replaced would be a substring of r2 excluding the beginning or the end of it, if there are occurrences of overlap with r1. However, these strings are common in the same MR-order, then the sizes of generated subgrammars are the same, regardless of the selecting order of pairs. This similarly holds for all of the most frequent maximal repeats, for every maximum frequency of pairs, through the whole process of RePair. 3.3 Greatest size difference of RePair We consider the problem of how large the difference between possible outcomes of RePair can be. Definition 1 (Greatest Size Difference). Let g and g(cid:48) be sizes of any two possible grammars that can be generated by RePair for a given text. Then, the Greatest Size Difference of RePair (GSDRP) is max(g − g(cid:48) ). We show a lower bound of above GSDRP in the following theorem. Theorem 3. Given a text with length n, a lower bound of GSDRP is 1 6 (√6n + 1 + 13). Proof. Let B, L, and R be strings such that B = l1xyr1l2xyr2 ··· lf −1xyrf −1lf xyrf , L = ♦l1x♦l2x···♦lf x, R = ♦yr1♦yr2 ···♦yrf , where x, y, l1, . . . , lf , r1, . . . , rf denote distinct symbols, and each occurrence of ♦ denotes a distinct symbol. Consider text T = BLf−1Rf−1. Here, xy, l1x, ··· , lf x, yr1 , ··· , yrf are the most frequent 6 maximal repeats with frequency f in T . Let G and G(cid:48) be grammars generated by RePair for T in different MR-order, such that (i) xy is prior to all other maximal repeats, and (ii) xy is posterior to all other maximal repeats, respectively. We denote the sizes of G and G(cid:48) by g and g(cid:48), respectively. First, we consider G and how RePair generates it. The first rule generated by replacement is v1 → xy because of the MR-order. After replacement, L and R is unchanged but B becomes the following text: B1 = l1v1r1l2v1r2 ··· lf −1v1rf −1lf v1rf . Each pair in B1 occurs only once in the whole text B1Lf−1Rf−1. This means that B1 is never be shortened from the current length, 3f . In the remaining steps, each li x and yri (for i = 1,··· , f ) is replaced, and that is all. L and R changed to texts whose length are both 2f . Hence, the following holds: g = 3f + 2 · 2f + 2(1 + 2f ) = 11f + 2. (1) Next, we consider G(cid:48) and how RePair generates it. By its MR-order, l1x, ··· , lf x, yr1 , ··· , yrf are replaced before xy is selected. They do not overlap with each other, and after they are replaced, xy does not occur in the generated text. Therefore, in G(cid:48), there are 2f rules which derive each li x and yri (for i = 1,··· , f ), respectively, but the rule which derives xy is absent. L and R changed to texts whose length are both 2f , and B changed to a text with length 2f . Hence, the following holds: Let us denote the length of the original text T = BLf−1Rf−1 by n. Then, the following holds: (cid:48) g = 2f + 2 · 2f + 2 · 2f = 10f. Therefore, n = 4f + 2(3f )(f − 1) = 6f 2 − 2f. f = 1 6 (√6n + 1 + 1) holds. By (1), (2), and (3), (cid:48) g − g holds and the theorem follows. 4 MR-RePair = 11f + 2 − 10f = f + 2 = (√6n + 1 + 13) 1 6 (2) (3) The main strategy of our proposed method is to recursively replace the most frequent maximal repeats, instead of the most frequent pairs. In this section, first, we explain the naıve version of our method called Naıve-MR-RePair. While it can have bad performance in specific cases, it is simple and helpful to understand our main result. Then, we describe our proposed MR-RePair. 4.1 Naıve-MR-RePair Definition 2 (Naıve-MR-RePair). For input text T , let G = {V, Σ, S, R} be the grammar generated by Naıve-MR-RePair. Naıve-MR-RePair constructs G by the following steps: 7 vα → α (α = a, b, r, c, d) v1 → vavbvrva S → v1vcvavdv1 a va b vb r vr v1 a va c vc vc d vd vd a va va S a va b vb r vr a va v1 Figure 2: An example of the grammar generation process of Naıve-MR-RePair for text abracadabra. The generated grammar is {{va, vb, vr, vc, vd, v1, S},{a, b, r, c, d}, S,{va → a, vb → b, vr → r, vc → c, vd → d, v1 → vavbvrva, S → v1vcvavdv1}}, and the grammar size is 14. Step 1. Replace each symbol a ∈ Σ with a new variable va and add va → a to R. Step 2. Find the most frequent maximal repeat r in T . Step 3. Replace every occurrence (or, as many occurrences as possible, when there are overlaps) of r in T with a new variable v, and then add v → r to R. Step 4. Re-evaluate the frequencies of maximal repeats for the renewed text generated in Step 3. If the maximum frequency is 1, add S → (current text) to R, and terminate. Otherwise, return to Step 2. We can easily extend the concept of MR-order to this Naıve-MR-RePair. We show an example of the grammar generation process of Naıve-MR-RePair in Figure 2. Fig- ure 1 and 2 illustrates the intuitive reason why the strategy using maximal repeats is effective compared to that using pairs. When compressing text vavbvrvavcvavdvavbvrva, RePair and Naıve-MR-RePair both generate subgrammars which derive the most frequent maximal repeat vavbvrva. The rule set of the subgrammar of RePair is {v1 → vavb, v2 → v1vr, v3 → v2va}, and the size is 6. On the other hand, the rule set of subgrammar of Naıve-MR-RePair is {v1 → vavbvrva}, and the size is 4. However, the following theorem indicates that the size of the grammar generated by Naıve-MR-RePair is larger than that by RePair in particular cases, even when they work in the same MR-order. Theorem 4. Given a text T with length n, and assume that RePair and Naıve-MR-RePair work in the same MR-order. Let grp and gnmr be sizes of grammars generated by RePair and Naıve-MR-RePair for T , respectively. Then, there is a case where gnmr = grp + O(log n) holds.1 Proof. Assume that Grp = {Vrp, Σrp, Srp, Rrp} and Gnmr = {Vnmr , Σnmr , Snmr , Rnmr} are grammars generated by RePair and Naıve-MR-RePair, respectively. Let T (cid:48) = v1 ··· vn such that vi ∈ Vrp ∩ Vnmr and vi → T [i] ∈ Rrp ∩ Rnmr (for i = 1,··· , n), and Grp = { Vrp, Σrp, Srp, Rrp} (or Gnmr = { Vnmr , Σnmr , Snmr , Rnmr}) be a subgrammar of Grp (or Gnmr ) which derives T (cid:48). Assume that T (cid:48) = (uw)2m+1−1u, where u ∈ Vrp ∩ Vnmr , w ∈ (Vrp ∩ Vnmr )+ such that uwu is the most frequent maximal repeat of T (cid:48), and m ∈ N+. Note that 2m+1 − 1 =(cid:80)m i=0 2i. Here Rrp and Rnmr consist as follows: Rrp: Assume that xi ∈ Vrp for 1 ≤ i ≤ m and yj ∈ Vrp ∪ Σrp for 1 ≤ j ≤ w, then • w rules yj → ylyr with val (yw) = uw. • One rule x1 → ywyw and log2 (cid:98)2m+1 − 1(cid:99) − 1 = m − 1 rules xi → xi−1xi−1 for 2 ≤ i ≤ m. • One rule Srp → xmxm−1 ··· x1yw. Rnmr : Assume that d = Vnmr = Rnmr and zi ∈ Vnmr for 1 ≤ i ≤ d, then • One rule z1 → uwu. • d − 1 rules zi → zi−1wzi−1 for 2 ≤ i ≤ d and zd = Snmr . 1We show a concrete example of this theorem in Appendix. 8 vα → α (α = a, b, r, c, d) v1 → vavbvr v2 → v1va S → v2vcvavdv2 a va r vr b vb v1 v2 a va va c vc vc vc a va va va S d vd vd vd a va r vr b vb v1 v2 a va va Figure 3: An example of the grammar generation process of MR-RePair for text abracadabra. The generated grammar is {{va, vb, vr, vc, vd, v1, S},{a, b, r, c, d}, S,{va → a, vb → b, vr → r, vc → c, vd → d, v1 → vavbvr, v2 → v1va, S → v2vcvavdv2}}, and the grammar size is 15. Let grp and gnmr be sizes of Grp and Gnmr , respectively. Then, the following holds: grp = 2w + 2m + (m + 2) = 3m + 2w + 2 gnmr = w + 2 + (w + 2)(d − 1) = (w + 2)d Here, with regard to the length of T (cid:48), the following holds: (4) (5) (2d − 1)w + 2d = n = (2(2m − 1) + 1)(w + 1) + 1. Since the right-side results in 2m+1w + 2m+1, d = m + 1 follows it. Hence, by equation (4) and (5), the following holds: Therefore, gnmr > grp holds for some (m,w), and the proposition holds. gnmr − grp = (m − 1)(w − 1) − 1. 4.2 MR-RePair The reason why the grammar size of Naıve-MR-RePair becomes larger than that of RePair as seen in Theorem 4 is that Naıve-MR-RePair cannot replace all occurrences of the most frequent maximal repeats if it overlaps with another occurrence of itself. In the remainder of this section, we describe MR-RePair, which is an improved version of the above Naıve-MR-RePair. Definition 3 (MR-RePair). For input text T , let G = {V, Σ, S, R} be the grammar generated by MR- RePair. MR-RePair constructs T by the following steps: Step 1. Replace each symbol a ∈ Σ with a new variable va and add va → a to R. Step 2. Find the most frequent maximal repeat r in T . Step 3. Check if r > 2 and r[1] = r[r], and if so, replace r with r[2..r]. Step 4. Replace every occurrence of r with a new variable v, then add v → r to R. Step 5. Re-evaluate the frequencies of maximal repeats for the renewed text generated in Step 4. If the maximum frequency is 1, add S → (current text) to R, and terminate. Otherwise, return to Step 2. We show an example of the grammar generation process of MR-RePair in Figure 3. We can easily extend the concept of MR-order to this MR-RePair. We do not care if it uses r[1..r − 1] in Step 3, instead of r[2..r]. MR-RePair can replace all occurrences of r even if it overlaps with itself in some occurrences, since by Lemma 3, the length of overlaps of the most frequent maximal repeats is at most 1. If r[1] = r[r] but r does not overlap with itself, then r[1]v becomes the most frequent maximal repeat after r[2..r] is replaced by v, and r[1]v would be replaced immediately. MR-RePair still cannot replace all of them if r = 2, but the same is said to RePair. We show an example of the grammar generation process of MR-RePair in Figure 3. Although the size of the generated grammar in Figure 3 is larger than that of Naıve-MR-RePair shown in Figure 2, it is still smaller than that of RePair shown in Figure 1. 9 Theorem 5. Assume that RePair and MR-RePair work based on the same MR-order for a given text. Let grp and gmr be sizes of grammars generated by RePair and MR-RePair, respectively. Then, 1 2 grp < gmr ≤ grp holds. Proof. Assume that Grp = {Vrp, Σrp, Srp, Rrp} and Gmr = {Vmr , Σmr , Smr , Rmr} are grammars gener- ated by RePair and MR-RePair, respectively, for a given text T with length n. Let T (cid:48) = v1 ··· vn such that vi ∈ Vrp ∩ Vmr and vi → T [i] ∈ Rrp ∩ Rmr (for i = 1,··· , n). We start with T (cid:48). Let f1 be the maximum frequency of maximal repeats in T (cid:48). By Corollary 1, the maximum frequency of pairs in T (cid:48) is also f1. Let G(f1) (or G(f1) mr ) be a subgrammar of Grp (or Gmr ) which is generated while RePair (or MR-RePair) replaces pairs (or maximal repeats) with frequency f1, g(f1) mr ) be the renewed text after all pairs (or maximal rp m1 be maximal repeats with frequency f1 in T (cid:48), repeats) with frequency f1 are replaced. Let r(f1) ,··· , r(f1) and assume that they are prioritized in this order by the MR-order. Let each l(f1) (for i = 1,··· , m1) be the length of the longest substring of r(f1) such that there are variables that derive the substring in both G(f1) is at least 2. Then, by Lemma 2, the following holds: mr . Note that this substring is common to RePair and MR-RePair, and each l(f1) mr ) be the size of it, and T (f1) rp and G(f1) (or T (f1) (or g(f1) rp rp 1 i i i m1(cid:88) m1(cid:88) i=1 g(f1) rp = g(f1) mr = 2(l(f1) i − 1) , l(f1) i . Therefore, i=1 ∴ 1 2 g(f1) rp < g(f1) mr ≤ g(f1) rp (6) rp and T (f1) mr mr . Hence, 1 rp and G(f2) holds. The renewed texts T (f1) are isomorphic for Vrp and Vmr . Let f2 be the maximum frequency of maximal repeats in T (f1) mr ). Then, the similar discussion holds for G(f2) and T (f2) rp < g(f2) mr mr ≤ g(fi) are isomorphic. Inductively, for every maximum frequency of maximal repeats fi, 1 holds and the renewed texts T (fi) mr are isomorphic. Let k be a natural number such that fk > 1 and fk+1 = 1, which is the number of decreasing of maximum frequency through the whole process of RePair and MR-RePair. Then, rp holds similarly to (6), and the renewed texts T (f2) mr ≤ g(f2) and T (fi) (and this is the same in T (f1) rp < g(fi) 2 g(f2) 2 g(fi) rp rp rp rp k(cid:88) k(cid:88) j=1 j=1 k(cid:88) k(cid:88) j=1 mj(cid:88) mj(cid:88) i=1 j=1 i=1 grp = gmr = g(fj ) rp + Σ + T (fk) rp = g(fj ) mr + Σ + T (fk) mr = 2(l(fj ) i − 1) + Σ + T (fk) rp l(fj ) i + Σ + T (fk) mr , (7) (8) holds. Because every l(fj ) proposition holds. gmr = grp holds when every length of l(fj ) ≥ 2 and T (fk) = T (fk) mr , 1 rp i is 2. i 2 grp < gmr ≤ grp follows (7) and (8) and the The following theorem shows that unless the MR-order of RePair and MR-RePair are the same, the grammar generated by MR-RePair might be larger than that by RePair. Theorem 6. Unless the MR-order of RePair and MR-RePair are the same, there is a case where the size of the generated grammar by MR-RePair becomes larger than that by RePair. 10 Proof. As shown in Theorem 5, the size of grammar generated by MR-RePair would be strictly equal to that by RePair with the same MR-order. Thus, we can reduce this problem to the problem that there is a difference between sizes of possible grammars generated by RePair as stated in Remark 1. Hence, there are the cases stated in the proposition if the MR-order of MR-RePair matches with a MR-order of RePair which does not generate the smallest RePair grammar. We can implement MR-RePair by extending the original implementation of RePair stated in [11], holding the same complexity. Theorem 7. Let G = {V, Σ, S, R} be the generated grammar by MR-RePair for a given text with length n. Then, MR-RePair works in O(n) expected time and 5n + 4k2 + 4k(cid:48) + (cid:100)√n + 1(cid:101) − 1 word space, where k and k(cid:48) are the cardinalities of Σ and V , respectively. Proof. Compared with RePair, the additional operations which MR-RePair does in our implementation are (i) it extends the selected pair to left and right until it becomes a maximal repeat, and (ii) it checks and excludes either of the beginning or the end of the obtained maximal repeat if they are the same. They can be realized by only using the same data structures as that of RePair. Then, the space complexity of MR-RePair follows Lemma 1. We can clearly execute operation (ii) in constant time. So we consider how the time complexity is affected by operation (i). Let l be the length of the maximal repeat containing the focused pair, and f be the frequency of the pair. Then, when MR-RePair checks the left- and right-extensions for all occurrences of the focused pair, O(f l) excessive time is required compared with RePair. However, the length of entire text is shortened at least f (l − 1) by the replacement. Therefore, according to possible counts of replacement through the entire steps of the algorithm, MR-RePair works in O(n) expected time. Remark 2. We can convert a grammar of RePair to that of MR-RePair by repeating the following transform: If a variable v appears only once on the right-hand side of other rules, remove the rule for v and replace the one occurrence of v with the right-hand side of the removed rule. However, time and space complexity stated in Theorem 7 cannot be achieved in this manner, since additional operations and memory for searching and storing such variables are required. 5 Experiments We implemented MR-RePair and measured the number of generated rules and the execution time in order to compare it to existing RePair implementations and Re-PairImp2 proposed by Ga´nczorz and Jez [8]. As stated in Remark 1, the size of a generated grammar depends on the MR-order. In practice, the MR-order varies how we implement the priority queue managing symbol pairs. To see this, we used five RePair implementations in the comparison; they were implemented by Maruyama3, Navarro4, Prezza5 [5], Wan6, and Yoshida7. Table 1 summarizes the details of the texts we used in the comparison. We used three texts as highly repetitive texts; one is a randomly generated text (rand77.txt), and the others are a Fibonacci string (fib41) and a German text (einstein.de.txt) which were selected from Repetitive Corpus of Pizza&Chili Corpus8. The randomly generated text, rand77.txt, consists of alphanumeric symbols and some special 2https://bitbucket.org/IguanaBen/repairimproved 3https://code.google.com/archive/p/re-pair/ 4https://www.dcc.uchile.cl/~gnavarro/software/index.html 5https://github.com/nicolaprezza/Re-Pair 6https://github.com/rwanwork/Re-Pair; We ran it with level 0 (no heuristic option). 7https://github.com/syoshid/Re-Pair-VF; We removed a routine to find the best rule set. 8http://pizzachili.dcc.uchile.cl/repcorpus.html 11 Table 1: Text files used in our experiments. texts rand77.txt fib41 einstein.de.txt E.coli bible.txt world192.txt size (bytes) 2,097,152 267,914,296 92,758,441 4,638,690 4,047,392 2,473,400 Σ 77 2 Fibonacci string from Pizza&Chili Corpus 32 copies of 1024 random patterns of length 64 contents 117 Edit history of Wikipedia for Albert Einstein 4 Complete genome of the E. Coli bacterium 63 The King James version of the bible 94 The CIA world fact book symbols; and it is generated by concatenating 32 copies of a block that includes 1024 random patterns of length 64, i.e., the size is 64 × 1024 × 32 = 2, 097, 152 byte. In addition, we used three texts (E.coli, bible.txt, world192.txt) for real data selected from Large Corpus9. We executed each program seven times for each text and measured the elapsed CPU time only for grammar generation process. We calculated the average time of the five results excluding the minimum and maximum values among seven. We ran our experiments on a workstation equipped with an Intel(R) Xeon(R) E5-2670 2.30GHz dual CPU with 64GB RAM, running on Ubuntu 16.04LTS on Windows 10. All the programs are compiled by gcc version 7.3.0 with "-O3" option. Table 2 lists the experimental results. Here, we excluded the number of rules that generate a single terminal symbol from the number of rules because it is the same between MR-RePair and RePair. As shown in the table, for all texts except for fib41, the size of rules generated by each RePair implementation differs from each other.10. In any case, MR-RePair is not inferior to RePair in the size of rules. For rand77.txt in particular, the number of rules decreased to about 11% and the size of rules decreased to about 55%. For einstein.de.txt, moreover, the number of rules decreased to about 44% and the size of rules decreased to about 72%. On the other hand, for the texts of Large Corpus, which are not highly repetitive, it turned out that the effect of improvement was limited. Note that fib41 does not contain any maximal repeats longer than 2 without overlaps. Therefore, MR-RePair generates the same rules as RePair. Also note that MR-RePair runs at a speed comparable to the fastest implementation of RePair. 6 Conclusion In this thesis, we analyzed RePair and showed that RePair replaces step by step the most frequent pairs within the corresponding most frequent maximal repeats. Motivated by this analysis, we designed a novel variant of RePair, called MR-RePair, which is based on substituting the most frequent maximal repeats at once instead of substituting the most frequent pairs consecutively. Moreover, we implemented MR-RePair and compared the grammar generated by it to that by RePair for several texts, and confirmed the effectiveness of MR-RePair experimentally especially for highly repetitive texts. We defined the greatest size difference of any two possible grammars that can be generated by RePair for a given text, and named it as GSDRP. Moreover, we showed that a lower bound of GSDRP is 1 6 (√6n + 1 + 13) for a given text of length n. Improving the lower bound and showing a upper bound of GSDRP are our future works. Although we did not discuss how to encode grammars, it is a very important issue from a practical point of view. For MR-RePair, if we simply use delimiters to store the rule set, the number of rules may drastically affect the compressed data size. To develop an efficient encoding method for MR-RePair is one of our future works. 9http://corpus.canterbury.ac.nz/descriptions/#large 10We found that the results of Yoshida were the same as those of Maruyama because Yoshida utilized the code of Maruyama. 12 Acknowledgments The authors would like to thank the people who provided the source codes. This work was sup- ported by JSPS KAKENHI Grant Numbers JP17H06923, JP17H01697, JP16H02783, JP18H04098, and JP18K11149, Japan. This work was also supported by JST CREST Grant Number JPMJCR1402, Japan. 13 Table 2: The sizes of generated grammars and the execution times. Each cell in the table represents the number of generated rules, the total lengths of the right side of all the rules except for the start variable, the length of the right side of the start variable, and the total grammar size in order from the top row. The fifth row separated by a line represents the execution time with seconds. text file rand77.txt fib41 einstein.de.txt E.coli bible.txt world192.txt RePair Maruyama Navarro 41,642 83,284 2 83,286 0.37 38 76 3 79 23.94 49,949 99,898 12,665 112,563 43.45 66,757 133,514 649,660 783,174 1.02 81,169 162,338 386,381 548,719 1.21 55,798 111,596 213,962 325,558 0.80 41,651 83,302 9 83,311 0.41 38 76 3 79 26.75 49,968 99,936 12,734 112,670 30.08 66,664 133,328 651,875 785,203 1.20 81,193 162,386 386,514 548,900 1.33 55,552 111,104 213,131 324,235 0.59 Prezza Wan 41,632 83,264 7 83,271 4.76 38 76 3 79 96.05 50,218 100,436 13,419 113,855 216.74 66,660 133,320 650,538 783,858 14.67 80,999 161,998 386,992 548,990 13.00 55,409 110,812 213,245 324,057 7.57 41,675 83,350 2 83,352 4.27 38 76 3 79 483.86 50,057 100,114 12,610 112,724 213.15 67,368 134,736 652,664 787,400 10.37 81,229 162,458 386,094 548,552 9.12 55,473 110,946 212,647 323,593 4.89 Yoshida 41,651 83,302 9 83,311 0.40 38 76 3 79 25.04 49,968 99,936 12,734 112,670 30.76 66,664 133,328 651,875 785,203 1.56 81,193 162,386 386,514 548,900 1.47 55,552 111,104 213,131 324,235 0.56 Re-PairImp MR-RePair 41,661 83,322 2 83,324 3.95 37 74 23 97 1360.40 49,933 99,866 12,672 112,538 452.56 66,739 133,478 650,209 783,687 27.04 81,282 162,564 385,989 548,553 24.38 55,437 110,874 212,857 323,731 12.35 4,492 46,143 9 46,152 0.42 38 76 3 79 33.62 21,787 71,709 12,683 84,392 29.63 62,363 129,138 650,174 779,312 1.33 72,082 153,266 386,516 539,782 1.27 48,601 104,060 212,940 317,000 0.66 14 References [1] Alberto Apostolico and Stefano Lonardi. Off-line compression by greedy textual substitution. Pro- ceedings of the IEEE, 88(11):1733 -- 1744, 2000. [2] Djamal Belazzougui and Fabio Cunial. Fast label extraction in the CDAWG. In Proceedings of the 24th International Symposium on String Processing and Information Retrieval (SPIRE 2017), volume 10508 of Lecture Notes in Computer Science, pages 161 -- 175. Springer, 2017. [3] Djamal Belazzougui and Fabio Cunial. Representing the suffix tree with the CDAWG. In Proceedings of the 28th Annual Symposium on Combinatorial Pattern Matching (CPM 2017), volume 78 of Leibniz International Processings in Informatics, pages 7:1 -- 7:13, 2017. [4] Djamal Belazzougui, Fabio Cunial, Travis Gagie, Nicola Prezza, and Mathieu Raffinot. Composite repetition-aware data structures. In Proceedings of the 26th Annual Symposium on Combinatorial Pattern Matching (CPM 2015), volume 9133 of Lecture Notes in Computer Science, pages 26 -- 39. Springer, 2015. [5] Philip Bille, Inge Li Grtz, and Nicola Prezza. Space-efficient Re-Pair compression. In Proceedings of Data Compression Conference (DCC 2017), pages 171 -- 180. IEEE Press, 2017. [6] Moses Charikar, Eric Lehman, Ding Liu, Panigrahy Ring, Manoj Prabhakaran, Amit Sahai, and abhi shelat. The smallest grammar problem. IEEE Transactions on Information Theory, 51(7):2554 -- 2576, 2005. [7] Francisco Claude and Gonzalo Navarro. Fast and compact web graph representations. ACM Trans- actions on the Web, 4(4):16:1 -- 16 -- 31, 2010. [8] Micha(cid:32)l Ga´nczorz and Artur Jez. Improvements on Re-Pair grammar compressor. In Proceedings of Data Compression Conference (DCC 2017), pages 181 -- 190. IEEE Press, 2017. [9] Rodrigo Gonz´alez and Gonzalo Navarro. Compressed text indexes with fast locate. In Proceedings of the 18th Annual Symposium on Combinatorial Pattern Matching (CPM 2007), volume 4580 of Lecture Notes in Computer Science, pages 216 -- 227. [10] Shunsuke Inenaga, Takashi Funamoto, Masayuki Takeda, and Ayumi Shinohara. Linear-time off-line text compression by longest-first substitution. In Proceedings of the 10th International Symposium on String Processing and Information Retrieval (SPIRE 2003), volume 2857 of Lecture Notes in Computer Science, pages 137 -- 152. Springer, 2003. [11] N. Jesper Larsson and Alistair Moffat. Off-line dictionary-based compression. Proceedings of the IEEE, 88(11):1722 -- 1732, 2000. [12] Markus Lohrey, Sebastian Maneth, and Roy Mennicke. Xml tree structure compression using RePair. Information Systems, 38(8):1150 -- 1167, 2013. [13] Takuya Masaki and Takuya Kida. Online grammar transformation based on Re-Pair algorithm. In Proceedings of Data Compression Conference (DCC 2016), pages 349 -- 358. IEEE Press, 2016. [14] Ryosuke Nakamura, Hideo Bannai, Shunsuke Inenaga, and Masayuki Takeda. Simple linear-time off- line text compression by longest-first substitution. In Proceedings of Data Compression Conference (DCC 2007), pages 123 -- 132. IEEE Press, 2007. [15] Gonzalo Navarro and Lu´ıs MS Russo. Re-pair achieves high-order entropy. In Proceedings of the Data Compression Conference (DCC 2008), page 537. IEEE Press, 2008. 15 [16] Carlos Ochoa and Gonzalo Navarro. RePair and all irreducible grammars are upper bounded by high-order empirical entropy. IEEE Transactions on Information Theory, pages 1 -- 5, 2018. [17] Kei Sekine, Hirohito Sasakawa, Satoshi Yoshida, and Takuya Kida. Adaptive dictionary sharing method for Re-Pair algorithm. In Proceedings of Data Compression Conference (DCC 2014), pages 425 -- 425. IEEE Press, 2014. [18] Yasuo Tabei, Hiroto Saigo, Yoshihiro Yamanishi, and Simon J. Puglisi. Scalable partial least squares regression on grammar-compressed data matrices. In Proceedings of the 22nd ACM SIGKDD In- ternational Conference on Knowledge Discovery and Data Mining (KDD 2016), pages 1875 -- 1884. ACM, 2016. [19] Takuya Takagi, Keisuke Goto, Yuta Fujishige, Shunsuke Inenaga, and Hiroki Arimura. Linear-size In Proceedings of the 24th CDAWG: New repetition-aware indexing and grammar compression. International Symposium on String Processing and Information Retrieval (SPIRE 2017), volume 10508 of Lecture Notes in Computer Science, pages 304 -- 316. Springer, 2017. [20] Raymond Wan. Browsing and searching compressed documents. PhD thesis, The University of Melbourne, 2003. 16 A Appendix We show Figures 4, 5, and 6 to help for understanding Proof of Theorem 4. Let Grp, Gnmr , and Gmr be the grammars generated by RePair, Naıve-MR-RePair, and MR-RePair, respectively. For a given text T = a1 ··· an (ai ∈ Σ, 1 ≤ i ≤ n) of length T = n, let grp, gnmr , and gmr be the sizes of Grp, Gnmr , and Gmr , respectively. Here, assume that T = (aw)2(2m−1)+1a, where w ∈ Σ+ such that awa is the most frequent maximal repeat of T , and m ∈ N+. Then, by Proof of Theorem 4, gnmr > grp holds with some m and w such that (m − 1)(w − 1) > 1. We show a concrete example of the grammar generation process of RePair and Grp for T = (abcd)7a with m = 2 and w = 3 in Figure 4. The size grp is 18 for this example. We also show an example of the process of Naıve-MR-RePair and Gnmr for the same T in Figure 5. As we see, the size gnmr is 19, and thus gnmr > grp holds. As shown in Figure 5, in particular cases, Naıve-MR-RePair may fail to extract repetitive patterns (like abcd of (abcd)7a for the running example). However, this problem is solved by using MR-RePair. We show an example of the process of MR-RePair and Gmr for the same T = (abcd)7a in Figure 6. The size gmr is 16 and this is smaller than grp = 18. While the most frequent maximal repeat at the second replacement step is vavbvcvdva, MR-RePair replaces vavbvcvd with new variable v1 because of the additional Step 3 of Definition 3. 17 . 8 1 s i e z i s r a m m a r g e h T . a 7 ) d c b a ( t x e t r o f r a m m a r g d e t a r e n e g s t i d n a r i a P e R f o s s e c o r p n o i t a r e n e g r a m m a r G : 4 e r u g i F . 9 1 s i e z i s r a m m a r g e h T . a 7 ) d c b a ( t x e t r o f r a m m a r g d e t a r e n e g s t i d n a r i a P e R R M - - e v ı a N f o s s e c o r p n o i t a r e n e g r a m m a r G : 5 e r u g i F 18 . 6 1 s i e z i s r a m m a r g e h T . a 7 ) d c b a ( t x e t r o f r a m m a r g d e t a r e n e g s t i d n a r i a P e R R M - f o s s e c o r p n o i t a r e n e g r a m m a r G : 6 e r u g i F abcdabcdabcdabcdabcdabcdabcdavα→α(α=a,b,c,d)vavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvay1→vavby1vcvdy1vcvdy1vcvdy1vcvdy1vcvdy1vcvdy1vcvdvay2→y1vcy2vdy2vdy2vdy2vdy2vdy2vdy2vdvay3→y2vdy3y3y3y3y3y3y3vax1→y3y3x1x1x1y3vax2→x1x1x2x1y3vaSrp→x2x1y3vaSrpabcdabcdabcdabcdabcdabcdabcdavα→α(α=a,b,c,d)vavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvaz1→vavbvcvdvaz1vbvcvdz1vbvcvdz1vbvcvdz1z2→z1vbvcvdz1z2vbvcvdz2Snmr→z2vbvcvdz2Snmrabcdabcdabcdabcdabcdabcdabcdavα→α(α=a,b,c,d)vavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvavbvcvdvav1→vavbvcvdv1v1v1v1v1v1v1vav2→v1v1v2v2v2v1vav3→v2v2v3v2v1vaSmr→v3v2v1vaSmr
1804.01833
2
1804
2018-05-05T20:04:30
Permutative representations of the $2$-adic ring $C^*$-algebra
[ "math.OA" ]
The notion of permutative representation is generalized to the $2$-adic ring $C^*$-algebra $\mathcal{Q}_{2}$. Permutative representations of $\mathcal{Q}_2$ are then investigated with a particular focus on the inclusion of the Cuntz algebra $\mathcal{O}_2\subset\mathcal{Q}_2$. Notably, every permutative representation of $\mathcal{O}_2$ is shown to extend automatically to a permutative representation of $\mathcal{Q}_2$ provided that an extension whatever exists. Moreover, all permutative extensions of a given representation of $\mathcal{O}_2$ are proved to be unitarily equivalent to one another. Irreducible permutative representations of $\mathcal{Q}_2$ are classified in terms of irreducible permutative representations of the Cuntz algebra. Apart from the canonical representation of $\mathcal{Q}_2$, every irreducible representation of $\mathcal{Q}_2$ is the unique extension of an irreducible permutative representation of $\mathcal{O}_2$. Furthermore, a permutative representation of $\mathcal{Q}_2$ will decompose into a direct sum of irreducible permutative subrepresentations if and only if it restricts to $\mathcal{O}_2$ as a regular representation in the sense of Bratteli-Jorgensen. As a result, a vast class of pure states of $\mathcal{O}_2$ is shown to enjoy the unique pure extension property with respect to the inclusion $\mathcal{O}_2\subset\mathcal{Q}_2$.
math.OA
math
PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA VALERIANO AIELLO, ROBERTO CONTI, AND STEFANO ROSSI Abstract. The notion of permutative representation is generalized to the 2-adic ring C ∗-algebra Q2. Permutative representations of Q2 are then investigated with a partic- ular focus on the inclusion of the Cuntz algebra O2 ⊂ Q2. Notably, every permutative representation of O2 is shown to extend automatically to a permutative representation of Q2 provided that an extension whatever exists. Moreover, all permutative extensions of a given representation of O2 are proved to be unitarily equivalent to one another. Irreducible permutative representations of Q2 are classified in terms of irreducible per- mutative representations of the Cuntz algebra. Apart from the canonical representation of Q2, every irreducible representation of Q2 is the unique extension of an irreducible permutative representation of O2. Furthermore, a permutative representation of Q2 will decompose into a direct sum of irreducible permutative subrepresentations if and only if it restricts to O2 as a regular representation in the sense of Bratteli-Jorgensen. As a result, a vast class of pure states of O2 is shown to enjoy the unique pure extension property with respect to the inclusion O2 ⊂ Q2. Contents Introduction 1. 2. Preliminaries and notation 3. Extending permutative representations from O2 to Q2 4. General properties of permutative representations of Q2 5. Decomposition of permutative representations of Q2 6. A converse to a theorem of Bratteli-Jorgensen 7. 8. Pure states of O2 with the unique extension property 9. Extendible quadratic permutation endomorphisms References Irreducible representations of Q2 1 4 7 11 13 16 19 25 27 34 1. Introduction It is common knowledge that the Cuntz algebras display such a rich representation theory that any attempt at completely classifying even only their irreducible or facto- rial representations is bound to fail. Even so, the study of their representations has found striking applications in a wide range of seemingly distant fields such as fractals, multiresolutions, self-similarity, symbolic dynamics, and wavelet theory to name but few [Jor99, DJ11, DJ12, DPS14, BJ97, Nek04, KW05, KW06, Jor06, MSW07, AP09, MP11, Date: May 8, 2018. 1 2 V. AIELLO, R. CONTI, AND S. ROSSI DJ14, DHJ15, Tho17]. In addition, suitable classes of representations carefully selected to be studied thoroughly but still general enough to be of any interest at all do exist. Permutative representations are certainly a case in point. These are representations in which the generating isometries act in a rather simple way mapping the vectors of a given orthonormal basis of a separable Hilbert space to vectors of the same basis. In other terms, the action of the isometries is implemented by certain injective maps of N into itself. It is no wonder, therefore, that an in-depth analysis of such representations can and in fact do give access to interesting connections with the theory of discrete dy- namical systems as well as yielding examples where abstract aspects and notions from representation theory take concrete shape. Moreover, the general theory of permuta- tive representations is very well understood, so much so its description may safely be regarded as a more or less fully accomplished goal. Indeed, in their remarkable mono- graph [BJ99] Bratteli and Jorgensen provided an insightful analysis of all permutative representations, which is quite conclusive when the so-called regular representations are dealt with. Notably, in the emerging picture the inclusion of the canonical UHF subal- gebra F2 in O2 is looked at as a kind of Gelfand pair. A totally different approach which only slightly overlaps with part of the content of their analysis is taken in [DP99], where it is mostly von Neumann algebras to be focused on instead. The present work aims to extend this study to the 2-adic ring C ∗-algebra Q2, which the present authors have already addressed in a couple of recent papers, [ACR18, ACR]. The underlying idea is to exploit the far-reaching knowledge accumulated over the years on the representation theory for Cuntz algebras to shed light on broader classes of akin C ∗-algebras, on whose representations very little is known so far. This is certainly the case with the 2-adic ring C ∗-algebra, that is the universal C ∗-algebra generated by a unitary U and an isometry S2 satisfying the two relations S2U = U 2S2 and S2S∗ 2 U ∗ = 1. Notably, it contains a copy of the Cuntz algebra O2 in which the generating isometries are given by US2 and S2. The rather explicit character of the inclusion O2 ⊂ Q2 raises a good many questions, some of which have been completely answered. For instance, one may wonder whether an endomorphism of O2 extends to an endomorphism of Q2. To the best of our knowledge, it turns out that this is hardly ever the case, apart from the obvious examples, e.g. inner automorphisms, gauge automorphisms, the flip-flop automorphism, and the canonical endomorphism, see [ACR18]. On the other hand, representations of O2 are far more likely to extend to representations of Q2 on the same Hilbert space. Indeed, it is a result by Larsen and Li, [LL12], that a representation π : O2 → B(H) extends to a representation of Q2 if and only if the Wold unitaries of π(S1) and π(S2) are unitarily equivalent. In particular, all representations in which π(S1) and π(S2) are both pure automatically extend. It is then natural to ask oneself how this result specializes to permutative representations of O2. In this regard, we prove without mak- ing use of the above theorem that a permutative representation π of O2 extends to a permutative representation π of Q2, namely a representation in which the unitary π(U) acts permuting the basis vectors, if and only if the injective maps σ1, σ2 : N → N imple- menting the isometries π(S1) and π(S2) have the same orbit structure when restricted 2 (N) respectively. Still this does not answer the question of whether permutative extensions always exist as long as a pos- sibly non-permutative extension exists. So we go on to show that not only is this the to the invariant subsets T∞ 2 + US2S∗ n=1 σn 1 (N) and T∞ n=1 σn PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 3 situation that actually occurs, but also that all permutative extensions are unitarily equivalent to one another. Furthermore, we discuss how many permutative extensions a permutative representation of O2 may give rise to. We then shift our attention to irreducible permutative representations showing that these can be described in quite a satisfactory fashion. Indeed, apart from the canonical representation of Q2, every per- mutative representation of Q2 restricts to O2 as an irreducible representation of which it is the unique extension. Conversely, every irreducible permutative representation of O2 extends to a permutative representation of Q2, apart from π+ and π−, which are the irreducible components of the restriction to O2 of the canonical representation of Q2. Phrased differently, the irreducible permutative representations of the 2-adic ring C ∗-algebras are virtually the same as those of the Cuntz algebra, all of which are well [Kaw06]. In addition, a permutative representation of Q2 will decompose known, cf. into the direct sum of irreducible permutative subrepresentations if and only its restric- tion to O2 does, which is the same as asking that this restriction be regular in the sense of Bratteli-Jorgensen. In other words, the theory of permutative representations of Q2 is thus entirely reconducted to and described in terms of that of O2. These findings fur- ther substantiate the idea that the inclusion O2 ⊂ Q2 should be very rigid in more than one respect; for example, we had already proved in [ACR18] that every endomorphism of Q2 that fixes O2 pointwise must be trivial itself. In a similar spirit, we prove here as an application of our analysis that a great many pure states of the Cuntz algebra will admit exactly one pure extension to the 2-adic ring C ∗-algebra. Notably, all vector states associated with an irreducible permutative representation of O2 can be extended to Q2 in only one way. In an effort to keep the text to a reasonable length we have preferred to stick to the inclusion O2 ⊂ Q2, although we do not see any major obstacles to extending our analysis to the inclusions On ⊂ Qn, for any n ∈ N, as in the aforementioned references, cf. [ACRS]. In particular, in [ACRS] it is pointed out that the canonical representation of Qn is still irreducible for every n, while its restriction to On is not since it actually continues to decompose into the direct sum of two irreducible components. More importantly, a theorem `a la Larsen and Li is in fact still available for the inclusion On ⊂ Qn as well, which makes it possible to carry on a similar analysis. This, however, would entail much more work to do, which is why we have resolved to go back to this generalization elsewhere. The paper is organized in the following way. In Section 2, after recalling the notation and collecting some basic results needed throughout the text, we introduce the notion of permutative representation of Q2. Section 3 is mainly focused on the problem of extending a permutative representation of O2 to a permutative representation of Q2. Notably, Theorem 3.4 provides a necessary and sufficient condition for a permutative representation of O2 to extend to a permutative representation of Q2; Theorem 3.5 proves that the extension is unique up to unitary equivalence, and Theorem 3.6 shows that permutative extensions always exist as long as the representation extends. Section 4 highlights some general properties of permutative representations. In addition, Propo- sition 4.6 provides a characterization of the so-called canonical representation among all permutative representations. In Section 5 the analysis of permutative representation of O2 by Bratteli-Jorgensen is reread in terms of Q2. Section 6 spells out some properties of 4 V. AIELLO, R. CONTI, AND S. ROSSI the permutative representations of O2 not to be easily found elsewhere in the literature. In Section 7, Theorem 7.8 gives the list of all irreducible permutative representations of Q2: apart from the canonical representation, these can all be obtained as the unique extension to Q2 of an irreducible representation of the Cuntz algebra; conversely, every such irreducible representation automatically extends to Q2. General (i.e. possibly not irreducible) permutative representations are dealt with in Proposition 7.10, which shows the equivalence between complete reducibility in terms of permutative irreducibles and regularity of the restriction to O2 in the sense of Bratteli-Jorgensen. Section 8 discusses the unique pure extension property for certain pure states of O2 understood as a sub- algebra of Q2. Finally, Section 9 analyzes a class of permutative representations of Q2 arising from permutative endomorphisms of O2. 2. Preliminaries and notation We start by recalling the definition of the 2-adic ring C ∗-algebra. Definition 2.1. The 2-adic ring C ∗-algebra Q2 is the universal C ∗-algebra generated by a unitary U and a (proper) isometry S2 such that S2U = U 2S2 and S2S∗ 2 U ∗ = 1. 2 +US2S∗ . = ek+1 and ρc(S2)ek For a comprehensive account of its main properties the interested readers are referred to [ACR18] and the references therein. Here we limit ourselves to reminding them that Q2 is a simple, purely infinite C ∗-algebra. In particular, its representations are all faithful. The so-called canonical representation, which in this paper will be consistently denoted by ρc, plays a privileged role. This is the irreducible representation acting on the Hilbert space ℓ2(Z), with canonical orthonormal basis {ek : k ∈ Z}, given by . = e2k, k ∈ Z. More details are again given in [ACR18]. ρc(U)ek Note, however, that ρc(U) is a multiplicity-free unitary, that is W ∗(ρc(U)) ⊂ B(ℓ2(Z)) is a maximal abelian subalgebra. As already observed, the Cuntz algebra O2, namely the universal C ∗-algebra generated by two isometries X1, X2 such that X1X ∗ 2 = 1, embeds into Q2 through the injective ∗-homomorphism that sends X1 to US2 and X2 to S2. The restriction of the canonical representation ρc to O2, which will henceforth be denoted by πc, is no longer irreducible. In fact, it decomposes into the direct sum of two inequivalent irreducible subrepresentations π+ and π− given by the restriction . . of πc to the invariant subspaces H+ = span{ek : k ≥ 0} and H− = span{ek : k < 0} respectively, see [ACR18]. Both π+ and π− as well as πc are simple examples of permutative representations of O2. In general, a representation π : O2 → B(H) is said to be permutative if there exists an orthonormal basis {en : n ∈ N} such that π(S1)en = eσ1(n) and π(S2)en = eσ2(n), for every n ∈ N = {1, 2, 3, . . .}, where σ1, σ2 are two injections of N into itself such that σ1(N)∩σ2(N) = ∅ and N = σ1(N)∪σ2(N). A pair (σ1, σ2) of injections of N into itself satisfying the above properties is sometimes referred to as a branching function system of order 2, cf. [Kaw06]. Clearly, the two properties correspond to the fact that the ranges of π(S1) and π(S2) decompose H into their direct sum. It is also as clear that a similar definition can be given for representations of Q2, which is what we do next. 1 + X2X ∗ Definition 2.2. A representation ρ : Q2 → B(H) on a separable Hilbert space is said to be permutative if there exists an orthonormal basis {en : n ∈ N} of H such that PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 5 ρ(S2)en = eσ2(n) and ρ(U)en = eτ (n), where σ2 is an injection of N into itself and τ is a bijection of N. It is plain that ρ will be a representation if and only if σ and τ satisfy σ ◦ τ = τ 2 ◦ σ and the pair (σ, τ ◦ σ) is a branching function system of order 2. The canonical repre- sentation ρc is obviously a permutative representation of Q2. It is quite obvious that a permutative representation of Q2 restricts to a permutative representation of O2 whose branching function system is the pair (τ ◦ σ2, σ2). It is not quite so obvious, though, that an extendible permutative representation of O2 must also have permutative extensions. The next section is entirely devoted to tackling this and other related problems. Here, instead, we collect some more or less known facts, whose proofs are nonetheless included for the sake of completeness. For any injection f : N → N we denote by Sf the isometry acting on ℓ2(N) as Sf ek := ef (k), k ∈ N. Clearly, Sf is a proper isometry if and only if f is not surjective. More detailed information is given by the following results. Lemma 2.3. If f is an injection of N into itself, then the following set equality ∞\n=1 Ran(Sn f ) = span{ej : j ∈ ∞\n=1 f n(N)} holds. Proof. To begin with, we write down the following chain of equalities Ran(Sn f ) = Ran(Sf n) = span{ef n(i) : i ∈ N} = {x ∈ ℓ2(N) : (x, ej) = 0 if j /∈ f n(N)} which are all checked at once. Therefore, we also have the equalities Ran(Sn ∞\n=1 span{ei : i ∈ ∩nf n(N)} (cid:3) n=1 Ran(Sn) = 0. As a straightfor- ward consequence of the previous lemma, we can also state the following result, which is singled out for convenience. ∞\n=1 f ) = {x ∈ ℓ2(N) : (x, ej) = 0 if j /∈ ∪nf n(N)} = We recall that an isometry S is said to be pure ifT∞ Corollary 2.4. The isometry Sf is pure if and only ifT∞ Given an isometry S, the subspaceT∞ n=1 Ran(Sn) may of course be non-trivial. How- ever, it will always be invariant under the action of S, which in fact restricts to it as a unitary operator W (S), known as the Wold unitary of S. Lemma 2.3 also says that W (Sf ) is in fact a permutative unitary, since it operates as the restriction of Sf to a closed subspace that is still generated by a selected subset of the orthonormal basis one starts with. n=1 f n(N) = ∅. There follows a handful of results all to do with the point spectrum σp(Sf ), by which we mean the (possibly empty) set of all eigenvalues of Sf . Proposition 2.5. If f : N → N is an injection without periodic points, i.e. such that f h(k) 6= k for all k, h ∈ N, then σp(Sf ) = ∅. 6 V. AIELLO, R. CONTI, AND S. ROSSI Proof. If we set x . =Pj cjej, the eigenvalue equation Sf x = λx reads λajej ajej) =Xj∈N ajef (j) =Xj∈N Sf (Xj∈N for some λ ∈ T. Obviously, the equation says that cj = cf −1(j) and by iterating it also says cj = cf −k(j) ∀k ∈ N as long as j ∈ ∩k∈Nf k(N), otherwise we only have finite number equal coefficients. This in turn implies cj must be zero: in the first case because the vector is in ℓ2(N); in the second because cj = 0 if j is not in f (N). (cid:3) Proposition 2.6. Let f : N → N be an injection with a unique fixed point and without other periodic points, then σp(Sf ) = {1}. Proof. Denote by ¯j the fixed point. Sf x = λx reads = Pj cjej, the eigenvalue equation If we set x . Sf (Xj∈N cjej) =Xj∈N cjef (j) =Xj∈N λcjej for some λ ∈ T. Pick j 6= ¯j. Obviously, the equation says that cj = cf −1(j) and by iterating it also says cj = cf −k(j) ∀k ∈ N T∞ as long as j ∈ ∩k∈Nf k(N), otherwise we only have finitely many equal coefficients. As in the previous lemma, this leads to cj = 0. Therefore, we see that v = c¯je¯j and λ = 1. (cid:3) In the following, by an orbit O of any injective function f : N → N we will always mean a set of the form On0 = {f n(n0) : n ∈ N} ⊂ N, where n0 is a fixed natural number. When f is in addition surjective, as is the case with both τ and the restriction of f to n=1 f n(N) as long as this set is not empty, then all orbits will always be assumed to be of the form {f k(n0) : k ∈ Z} unless otherwise stated. At any rate, it is clear that N decomposes into the disjoint unions of orbits. Finite orbits yield eigenvalues, as shown below. Proposition 2.7. Let f : N → N be an injection with only one finite orbit F ⊂ N, then . = span{ek k ∈ F}. In particular, σp(Sf ) = {z : zn = 1}, σp(Sf ) = σp(Sf ↾VF ) where VF with n = F. Proof. Let j1, . . . , jn be the elements of F . If we set x Sf x = λx reads =Pj cjej, the eigenvalue equation . Sf (Xj∈N ajej) =Xj∈N ajef (j) =Xj∈N λajej for some λ ∈ T. Pick j 6= ¯j. Obviously, the equation says that cj = cf −1(j) and by iterating it also says cj = cf −k(j) ∀k ∈ N as long as j ∈ ∩k∈Nf k(N), otherwise we only have finitely many equal coefficients. As in h=1 cjhejh, that is x ∈ VF . (cid:3) the two previous lemmas, this leads to cj = 0. Therefore, we see that x =Pn PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 7 Proof. Just apply the same arguments as above. Proposition 2.8. Let f : N → N be an injective function with only finitely many finite orbits, say F1, . . . , Fk. Then σp(Sf ) =Sk It may be worth noting that any injection σ : N → N such thatTn σn(N) is empty cannot have finite orbits. However, the converse is by no means true, as shown by the next example. Example 2.9. The map f : N → N given by h=1 σp(Sf ↾Fh) =Sk h=1{z : zFh = 1}. (cid:3) 1 n + 2 n − 2 if n = 2 if n is odd if n is even, n 6= 2 n=1 f n(N) = N and yet f has no invariant subsets. f (n) . = is a bijection soT∞ 3. Extending permutative representations from O2 to Q2 We can now move on to the problem of deciding when a given permutative repre- sentation π : O2 → B(H) admits permutative extensions to Q2. We start by dealing with the case in which π(S1) and π(S2) are pure. In this situation, π certainly extends and moreover its extension is unique. Even so, it is not obvious that this extension is still permutative. This result, though, can be easily achieved by an application of the following lemma. section Tn σn Lemma 3.1. Let (σ1, σ2) be a branching function system of order 2 such that the iter- 1 (σ2(m)), 1 (N) is empty. Then every n ∈ σ1(N) can be written as n = σk where k, m ∈ N are uniquely determined by n. Proof. If n ∈ σ1(N), then n = σ1(i) for some i ∈ N. If now i belongs to σ2(N), say i = σ2(j) for some j ∈ N, then n = σ1(σ2(j)), and we are done. If it does not, then i = σ1(j) for some j ∈ N, and so n = σ2 1(j). We can now go on this way asking whether j 1 (N) is empty, this procedure must come . to an end in a finite number of steps, which means n = σk = min{l : n /∈ ∩l 1 (σ2(m2)). Without loss of generality, assume k1 > k2. By injectivity, we get σk1−k2 (σ2(m1)) = σ2(m2). As the ranges of σ1 and σ2 are disjoint, we see that k1 = k2. Finally the injectivity of σ2 gives m1 = m2. (cid:3) belongs to σ2(N) or not. As the intersectionT σn 1(N)}. As for the unicity, suppose σk1 1 (σ2(m1)) = σk2 1 (σ2(m)), with k i=1σi Now if we further assume that the itersectionT∞ intersection T∞ n=1 σn Corollary 3.2. Let (σ1, σ2) be a branching function system of order 2 as above. If the 2 (N) is empty as well, then there exists a unique bijection τ of N such that τ ◦ σ2 = σ1 and τ ◦ σ1 = σ2 ◦ τ . . Proof. The τ in the statement can be described explicitly by setting τ (σ2(n)) = σ1(n) for every n ∈ N and τ (σk 2 (σ1(m)), for every k > 0 and m ∈ N. The proposition above just guarantees that τ is defined everywhere. Let us check that the 1 (σ2(m))) . = σk 2 (N) is also empty, we uniquely recover a bijection τ : N → N that satisfies the needed commutation rules with σ1 and σ2. n=1 σn 1 8 V. AIELLO, R. CONTI, AND S. ROSSI condition τ ◦ σ1 = σ2 ◦ τ holds. We observe that by the previous proposition we have that τ ◦ σ1(n) = τ ◦ σk 1 ◦ σ2(m) = σk 2 ◦ σ1(m) for some k, m, n ∈ N. Now there are two case we have to deal with, one for k = 1 and one for k ≥ 2. In the first case, the relation σ1(n) = σ1 ◦ σ2(m) implies that n = σ2(m). The claim then follows by noticing that In the second case, we see that by the very definition of τ we have that σ2 ◦ τ (n) = σ2 ◦ τ ◦ σ2(m) = σ2 ◦ σ1(m) . σ2 ◦ τ (n) = σ2 ◦ τ ◦ σk−1 1 and we are done. ◦ σ2(m) = σ2 ◦ σk−1 2 ◦ σ1(m) = σk 2 ◦ σ1(m) (cid:3) The corollary above can now be reinterpreted in terms of permutative representations. Proposition 3.3. Let π be a permutative representation of O2 such that π(S1) and π(S2) are both pure. Then the necessarily unique extension π of π to Q2 is a permutative representation of Q2. Proof. Indeed, π(U) is implemented by the bijection τ : N → N produced in Corollary 3.3. (cid:3) When the isometries are not pure, a much more intriguing picture comes out. The resulting situation is fully covered by the next theorem. Theorem 3.4. Let π : O2 → B(H) be a permutative representation induced by the branching function system (σ1, σ2). Then the following conditions are equivalent: (1) the permutative representation π of O2 extends to a permutative representation (2) if Orb1 = {F 1 : j ∈ J} are the sets of all orbits of 2 (N) respectively, there exists a bijection Ψ : I → J σ1 ↾∩n≥1σn such that F 1 : i ∈ I} and Orb2 = {F 2 Ψ(i) for every i ∈ I. eπ of Q2; 1 (N) and σ2 ↾∩n≥1σn i = F 2 j = {σk 1 (nj ) = eσk+l i ∈ N, k ∈ N. Assuming for simplicity I = J and Ψ = id, F 1 Z}, F 2 In either case eπ(U) always satisfies eπ(U)eσ2(i) = eσ1(i) i ∈ N and eπ(U)eσk eπ(U)eσk 1 (nj) k ∈ 2 (mj) k ∈ Z}, all permutative extensions are obtained by the formulas Proof. The implication 1 ⇒ 2 is easily proved, for a bijective correspondence between even all orbits of σ1 and σ2 is provided by 1 (n0)}k) (mj ) for l ∈ N. 2 (τ −1(n0))}k j = {σk 1 σ2(i) = eσk . = {σk if τ is a bijection of N such that σ1 = τ ◦ σ2 and σ2 ◦ τ = τ ◦ σ1. That Φ is actually a bijection is immediately seen, as is the equality Φ({σk 1 (n0)}k) = {σk 2 (τ −1(n0))}k. Φ({σk 2 σ1(i) i j 2 τ ◦σ2 = σ1 and τ ◦σk The implication 2 ⇒ 1 requires slightly harder work. We need to determine a per- mutative unitary eπ(U) that satisfies the two defining relations of Q2, which rewrite as 2 ◦σ1, k ∈ N, if τ is a bijection of N implementingeπ(U), i.e. eπ(U)ek = eτ (k) for every k ∈ N. In other terms, the two relations uniquely determine 1 ◦σ2 = σk PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 9 n=0 σn n=1 σn n=0 σn what τ must be onS∞ for N\S∞ 1 ◦ σ2(N) is justT∞ 1 ◦ σ2(N). This is where our hypothesis starts playing its role, 1 (N) decomposes into the disjoint union of σ1-orbits by means of a standard application of Zorn's lemma. Now we can 1 (n0) : k ∈ N} by setting τ (σk define τ on any of such orbits {σk (m0), where l is any integer number, and {σk 2 (m0) : k ∈ Z} is the corresponding σ2-orbit. By doing so, we obviously get a now everywhere defined map τ , that is bijective by definition. We are thus left with the task of checking that σ2 ◦ τ = τ ◦ σ1 continues to hold on the whole N. This in turn is shown by the following computation 1 (N). ButT∞ . = σk+l n=1 σn 1 (n0)) 2 σ2(τ (σk 1 (n0))) = σ2(σk+l 2 (m0)) = σ1+k+l 2 (m0) = σk+1+l 2 (m0) = τ (σk+1 1 (n0)) = τ (σ1(σk 1 (n0))) (cid:3) n=1 σn extensions there can be. Firstly, if the restriction of σi toT∞ Interestingly, the theorem also gives full information to reckon how many permutative i (N) consists only of finitely many finite orbits, then the extensions will be finitely many as well. Secondly, if there are finitely many infinite orbits, the extentions will be countably many. Lastly, if there are infinitely many infinite orbits, the extensions will be uncountably many. Irrespective of how many permutative extensions exist, they turn out to be all unitarily equivalent to one another, as we prove next. Theorem 3.5. If π : O2 → B(H) is an extendible permutative representation, then all its permutative extensions (w.r.t. the same orthonormal basis in which π is permutative) are unitarily equivalent. Proof. Let π1 : Q2 → B(H) and π2 : Q2 → B(H) be two permutative representations extending π. We will show that there exists a unitary V : H → H such that Ad(V )◦π1 = π2. As usual we denote by {ek}k∈N the orthonormal basis and by {σ1, σ2} the branching function system of order 2. Consider the following subspace of H . = M2 Ran(π(S2)n) ∞\n=1 Suppose thateπ1(U)eσk 1 (nj ) = eσk tion of Theorem 3.4). We define V ↾M2: M2 → M2 as V eσk V ↾M ⊥ 2 (mj′ ) andeπ2(U)eσk 1 (nj ) = eσk = id ↾M ⊥ . 2 2 Clearly Ad(V ) ◦ π1(S2) ↾M ⊥ 2 = π2(S2) ↾M ⊥ 2 computation shows that Ad(V ) ◦ π1(S2) ↾M2= π2(S2) ↾M2 2 (mj′′ ) (we're using the nota- 2 (mj′′ ) and we set 2 (mj′ ) . = eσk because π(S2)(M ⊥ 2 ) ⊂ M ⊥ 2 . The following V π1(S2)V ∗eσk 2 (mj′′ ) = V π1(S2)eσk 2 (mj′ ) = V eσk+1 2 (mj′ ) = eσk+1 2 (mj′′ ) = π2(S2)eσk 2 (mj′′ ) Now it is enough to check that Ad(V ) ◦ π1(U ∗) = π2(U ∗). The following computation shows that Ad(V ) ◦ π1(U ∗) ↾M2= π2(U ∗) ↾M2 V π1(U ∗)V ∗eσk 2 (mj′′ ) = V π1(U ∗)eσk We observe that Ad(V )◦ π1(U ∗)eσk π1(U ∗) ↾Sk 2 S1(H)= π2(U ∗) ↾Sk 2 S1(H), which in turn implies 2 (mj′ ) = V eσk 2 (σ1(i)) = π2(U ∗)eσk 1 (nj ) = π2(U ∗)eσk 1 (nj) = eσk 2 (σ1(i)) for i, k ∈ N and thus Ad(V )◦ 2 (mj′′ ) Ad(V ) ◦ π1(U ∗) ↾S2(H)= π2(U ∗) ↾S2(H) . 10 V. AIELLO, R. CONTI, AND S. ROSSI We observe that Ad(V )◦ π1(U ∗)eσk π1(U ∗) ↾Sk 1 (σ2(i)) = π2(U ∗)eσk 1 S2(H). We also have that 1 S2(H)= π2(U ∗) ↾Sk Ad(V ) ◦ π1(U ∗)eσ1(nj) = V π1(U ∗)V ∗eσ1(nj) = V π1(U ∗)eσ1(nj) = V eσ2(nj ) 1 (σ2(i)) for i, k ∈ N and thus Ad(V )◦ = eσ2(nj ) = π1(U ∗)eσ1(nj ) where nj ∈ ∩kσk done. 1 (N). This shows that Ad(V ) ◦ π1(U ∗) ↾S1(H)= π2(U ∗) ↾S1(H) and we are (cid:3) . = T∞ n=1 Ran(π(Si)n) and W (Si) . = π(Si) ↾∩nπ(Si)n, i = 1, 2. However conclusive, Theorem 3.4 still leaves something to be desired, insofar as it does not exclude the possibility that an extendible permutative representation of O2 may have no permutative extensions. This gap is bridged by the theorem below, which says such a situation in fact never occurs. Theorem 3.6. If a permutative representation π of O2 extends to a representation of Q2, then it also admits a permutative extension. In Proof. Let us set Mi view of Theorem 3.4, all we have to make sure is that W (S1) and W (S2) are induced by permutations having the same orbit structure. What we already know is that W (S1) and W (S2) are unitarily equivalent. Therefore, it all boils down to proving that if two permutative unitaries are unitarily equivalent, then they are induced by orbit-equivalent bijections of N. This should be a known fact from multiplicity theory. Even so, we do include an argument for want of an exhaustive reference. Let σ be a bijection of N and let Uσ be the corresponding permutative unitary. The decomposition of N into sum of multiplicity-free components as Uσ =L∞ the disjoint union of σ-orbits, say N =Fi∈I Oi, yields a decomposition of ℓ2(N) into a direct sum of Uσ-cyclic subspaces. More explicitly, we have ℓ2(N) =Li∈I HOi, where . = span{el : l ∈ Oi}. Now if an orbit Oi is finite with Oi = k, then Uσ ↾HOi HOi is just (up to unitary equivalence) the k by k permutative matrix corresponding to the cycle of length k, which we denote by Vk. If it is infinite, then Uσ ↾HOi is (up to unitary equivalence) the operator V∞ acting on L2(T, µLeb) by multiplying by z, that is . = zf (z) µLeb a.e. Our unitary Uσ is thus seen to decompose into the direct (V∞f )(z) i=1 niVi ⊕ n∞V∞, where ni is an integer (possibly zero or infinite). As is well known, this decomposition is unique and depends In other words, if U1 = ⊕iniVi ⊕ n∞V∞ and only on the unitary equivalence class. U2 = ⊕imiVi ⊕ m∞V∞, then U1 and U2 are unitarily equivalent if and only if ni = mi, for every i ∈ N and n∞ = m∞. Indeed, the finite dimensional components are easily dealt with, that is U1 ∼= U2 immediately leads to ni = mi for every i ∈ N, since any unitary equivalence between U1 and U2 must preserve the finite dimensional blocks. This in turn implies n∞V∞ ∼= m∞V∞, which is possible only if n∞ = m∞, see e.g. [Dav96]. Phrased differently, it is clear that the unitary that intertwines U1 and U2 can now be assumed to be a permutative unitary. (cid:3) Remark 3.7. When either T∞ n=1 π(S2)n is finite dimensional we need hardly bother such an advanced instrument as multiplicity theory, for we have the if U ∈ Mn(C) is a permutation characteristic polynomial at our disposal. unitary, i.e. Uei = eσ(i), i = 1, 2, . . . , n, with {e1, e2, . . . , en} ⊂ Cn being a suitable orthonormal basis and σ a permutation of {1, 2, . . . n}, then its characteristic polynomial n=1 π(S1)n or T∞ Indeed, PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 11 pU , which is obviously a unitary invariant, uniquely factorizes as pU (λ) = (λn1 − 1)(λn2 − 1) . . . (λnk − 1) with n1 + n2 + . . . + nk = n, where k is the number of orbits of σ and ni is the cardinality of the i-th orbit. 4. General properties of permutative representations of Q2 . k=1 W k = S∞ We ended the previous section by remarking that in a permutative representation ρ : Q2 → B(H) induced by the pair (σ2, τ ) the bijection τ : N → N can only have (at most countably many) infinite orbits. In order to prove this, we need to make use of the following very simple result, which is nevertheless given a statement to itself for convenience. Before doing that, we take the opportunity to recall some very standard notation, of which we will have to make intensive use as of now to ease the computations. We donote by W k 2 the set of multi-indices of length k in the alphabet {1, 2} and by W2 2 . For any given the set of all multi-indices of any finite length, i.e. W2 α = (α1, α2, . . . , αn) ∈ W2, we denote the monomial Sα1Sα2 . . . Sαn ∈ O2 by Sα. The diagonal projection Pα is by definition SαS∗ α. Finally, the C ∗-subalgebra generated by all projections Pα is denoted by D2 and is often referred to as the diagonal subalgebra of O2. It is well known that D2 is a maximal abelian subalgebra of the Cuntz algebra O2. Lemma 4.1. The projections Ad(U h)(Pα) and Pα are orthogonal for any h ∈ N and α ∈ W2 such that 0 < h < 2α. Proof. In the canonical representation the range of Pα is easily seen to be the subspace of ℓ2(Z) generated by {e2αk+l k ∈ Z} for a certain l ∈ N, see e.g. the discussion before Lemma 6.22 in [ACR18]. The claim now follows at once. (cid:3) Theorem 4.2. The bijection τ : N → N implementing ρ(U) in a permutative repre- sentation ρ : Q2 → B(H) has no periodic points, i.e. for any given n0 ∈ N one has τ n(n0) 6= n0, n ∈ N. Proof. Without loss of generality we may suppose that ρ(U)ne1 = e1. We have to consider two cases separately: e1 = ρ(S1)ei and e1 = ρ(S2)ei. We start with the case e1 = ρ(S1)ei and suppose that n = 2k. We have that ρ(S1)ei = e1 = ρ(U n)e1 = ρ(U)nρ(S1)ei = ρ(U)2kρ(S1)ei = ρ(S1)ρ(U)kei which implies that ei = ρ(U)kei. Now choose a projection ρ(SαS∗ ei, α ≥ k + 1. By Lemma 4.1 we have that ρ(SαS∗ using the orthogonality of the projections we see that α) + ρ(U k)∗ρ(SαS∗ α) such that ρ(SαS∗ α)ei = α)ρ(U)k ≤ 1. By α)ei + ρ(U k)∗ρ(SαS∗ α)ρ(U)keik2 = kρ(SαS∗ = kρ(SαS∗ = kρ(SαS∗ α)ei + ρ(U k)∗ρ(SαS∗ α)eik2 + kρ(U k)∗ρ(SαS∗ α)eik2 = α)eik2 = 2 which is absurd. Now we deal with the case when n = 2k + 1 (and still e1 = ρ(S1)ei). We have that e1 = ρ(U n)e1 = ρ(U n)ρ(S1)ei = ρ(U)ρ(U)2kρ(S1)ei = ρ(U)ρ(S1)ρ(U)kei = ρ(S2)ρ(U)k+1ei 12 V. AIELLO, R. CONTI, AND S. ROSSI So we see that e1 = ρ(S1)ei = ρ(S2)ρ(U)k+1ei, which is absurd because the two gener- ating isometries have orthogonal ranges. Now we deal with the case e1 = ρ(S2)ei. Suppose that n = 2k. We have that ρ(S2)ei = e1 = ρ(U)ne1 = ρ(U)nρ(S2)ei = ρ(U)2kρ(S2)ei = ρ(S2)ρ(U)kei which implies that ei = ρ(U)kei. Now choose a projection ρ(SαS∗ ei, α ≥ k + 1. Clearly, we have that ρ(SαS∗ orthogonality of the projections we see that α) + ρ(U k)∗ρ(SαS∗ α) such that ρ(SαS∗ α)ei = α)ρ(U)k ≤ 1. By using the α)ei + ρ(U k)∗ρ(SαS∗ α)ρ(U)keik2 = α)ei + ρ(U k)∗ρ(SαS∗ α)eik2 + kρ(U k)∗ρ(SαS∗ α)eik2 = α)eik2 = 2 kρ(SαS∗ = kρ(SαS∗ = kρ(SαS∗ which is absurd. Now we deal with the case when n = 2k + 1 (and still e1 = ρ(S2)ei). We have that e1 = ρ(U n)e1 = ρ(U n)ρ(S2)ei = ρ(U)ρ(U)2kρ(S2)ei = ρ(U)ρ(S2)ρ(U)kei = ρ(S1)ρ(U)kei So we see that e1 = ρ(S2)ei = ρ(S1)ρ(U)kei, which is absurd because the two generating isometries have orthogonal ranges. (cid:3) A standard application of the above theorem also yields the following result. Corollary 4.3. Let ρ : Q2 → B(H) be a permutative representation. Then ρ(U) has no eigenvectors. Proof. Suppose on the contrary there does exist a non-zero x ∈ ℓ2(N) such that ρ(U)x = λx, for some λ ∈ T. With x =Pk ckek the eigenvalue equation reads asPk ckeτ (k) = Pk λckek, whence ck0 = cτ −1(k0) = cτ −2(k0) = . . . = cτ −n(k0) for every n. However, if ck0 is any non-zero coefficient of x the equalities found above say x is not in ℓ2(N), as the foregoing proposition says it has infinitely many coefficients with the same non-zero absolute value. (cid:3) Given a representation ρ of Q2 one might wonder whether there is a general method for ruling out the possibility that ρ may ever act as a permutative representation with respect to a certain orthonormal basis. In fact, answering such a question might prove to be a demanding task. Even so, Corollary 4.3 does offer a simple, albeit limited, answer to the problem. Indeed, any representation ρ : Q2 → B(H) in which the point spectrum of ρ(U) is not empty cannot be permutative with respect to any orthonormal basis. Notably, the so-called interval picture of Q2, see [ACRS], is an example of such a representation. In fact, the interval picture is not even permutative at the level of the Cuntz algebra. Corollary 4.4. The interval picture π : O2 → B(L2([0, 1])) is not a permutative repre- sentation with respect to any orthonormal basis. Proof. As is known, see e.g. [ACRS], π(S1) and π(S2) are pure, hence there is only one extension π to Q2, which is permutative if and only if π is. Now the operator π(U) does have an eigenvector (the constant function 1), which means π is not permutative. (cid:3) Remark 4.5. It is worth noting that the interval picture of O2 can also be realized as the GNS representation of the Cuntz state associated with the vector (1/√2, 1/√2) ∈ C⊕C. PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 13 The number of the (infinite) orbits of τ is certainly an invariant for a given per- mutative representation ρ, which coincides with the multiplicity of ρ(U). However, it is quite a weak invariant, which can by no means give a complete classification of all representations of Q2. Indeed, there are uncountably many irreducible permutative rep- resentations, as we shall show afterwords, whereas the values assumed by our invariant range in a countable set. Even so, the invariant does become unexpectedly fine when τ has only one orbit, in which case the corresponding representation must be the canonical representation. Proposition 4.6. Let ρ be a permutative representation of Q2 in which the bijection τ implementing ρ(U) has only one orbit, that is {τ k(0) : k ∈ Z} = N . Then ρ is unitarily equivalent to the canonical representation ρc. In particular, ρ is also irreducible. Proof. By hypothesis we can write ρ(U)en = eτ (n), n ∈ N. Furthermore, the set equality N = {τ k(0) : k ∈ Z} allows us to give an explicit bijection Ψ : N → Z by setting . = k if τ k(0) = n. We now claim that Ψ(τ (Ψ−1(k))) = k + 1, for every k ∈ Z. Ψ(n) Indeed, by definition, Ψ−1(k) = τ k(0). Therefore, we also have τ (Ψ−1(k)) = τ k+1(0). The last equality finally reads as Ψ(τ (Ψ−1(k))) = k + 1. Denoting by V the unitary from ℓ2(N) onto ℓ2(Z) that sends en to eΨ(n), the equality V ρ(U)V ∗ek = ek+1 = ρc(U)ek is immediately seen to hold for every k ∈ Z. Now V ρ(S2)V ∗ek = eσ(k), for a suitable injection σ of Z into itself. In terms of the maps τ and σ the commutation relation S2U = U 2S2 may be rewritten as σ(k + 1) = σ(k) + 2, k ∈ Z (just apply Ad(V ) ◦ ρ to the defining relation). All the solutions of this equation are easily checked to be of the form σ(k) = l + 2k, k ∈ Z, where l = σ(0) is any integer. In particular, the equality Ad(ρc(U −l))(V ρ(S2)V ∗) = ρc(S2) is got to at once. This concludes the proof, since Ad(ρc(U −l))(V ρ(U)V ∗) = Ad(ρc(U −l))(ρc(U)) = ρc(U). (cid:3) Although C ∗(U) is a maximal abelian subalgebra of Q2, [ACR18], it is not true that the von Neumann algebra generated by ρ(U) is maximal abelian in B(H) for any irre- ducible representation ρ : Q2 → B(H). Quite the opposite, permutative representations provide the easiest counterexamples we can think of. Indeed, thanks to the above re- sult, if ρ is a permutative representation inequivalent to the canonical representation, then the multiplicity of ρ(U) will be bigger than one, which is the same as saying that W ∗(ρ(U)) is not maximal. 5. Decomposition of permutative representations of Q2 As is known, any representation of a given C ∗-algebra decomposes into a direct sum of cyclic representations. In particular, this applies to permutative representations of both O2 and Q2. However, for these representations it is far more natural to seek decompositions into direct sums of cyclic representations that are still of the same type. By permutative invariant subspace of a permutative representation ρ : Q2 → B(ℓ2(N)), therefore, we shall always mean a closed invariant subspace M ⊂ ℓ2(N) given by M = span{ei : i ∈ I ⊂ N}, where I is a suitable subset of N. It is obvious that the restriction of ρ to such an invariant subspace is still a permutative representation. In this case, 14 V. AIELLO, R. CONTI, AND S. ROSSI we will also say that ρ restricts to M as a permutative subrepresentation, borrowing the terminology from [BJ99], where O2 is dealt with. A permutative representation is understood as cyclic if it not only has a cyclic vector in the usual sense, but this can in fact be picked up among those of the chosen orthonormal basis. It then turns out that every basis vector is cyclic. This is true of permutative representations of Q2 as well as O2. It takes a moment's reflection to realize the proof is exactly the same in the two cases, which means we might safely rely on the results already proved in [BJ99]. Yet many of those basic results we need are not really given a clear-cut statement there, so we have preferred to provide explicit proofs all the same. To begin with, permutative representations enjoy a type of symmetry property that is worthy of a statement to itself. Proposition 5.1. Let π : Q2 → B(ℓ2(N)) be a permutative representation. equality π(SαS∗ well. β)ek = eh holds for h, k ∈ N, then the equality π(SβS∗ If the α)eh = ek holds as Proof. Since π(Sα)π(S∗ In particular, π(Pβ)ek = SβS∗ βek is not zero either, meaning π(Pβ)ek = ek, in that π(Pβ) is a diagonal projection with respect to the canonical basis {en : n ∈ N}. But then we have ek = π(Pβ)ek = π(SβS∗ (cid:3) β)ek = eh 6= 0, π(S∗ α)eh are different from zero. β)ek = π(S∗ β)ek = π(Sβ)π(S∗ α)eh = π(SβS∗ α)eh, as claimed. Among other things, the above property allows for a straighforward proof that in a permutative cyclic representation all basis vectors are cyclic. Proposition 5.2. If π is a cyclic permutative representation of O2 or Q2, then all basis vectors are cyclic. Proof. We limit oursevels to treat O2 only. Let ei0 be a cyclic vector. We first show that for every k ∈ N there exists at least one monomial SαS∗ β)ei0 = ek. Indeed, if this were not the case, the linear subspace π(Oalg 2 being ν for µ, ν ∈ W 2, would fail to contain the dense subalgebra generated by monomials SµS∗ ek. More precisely, every vector x ∈ π(Oalg 2 ) would satisfy (x, ek) = 0. By density, we would finally find that every x ∈ π(O2)ei0 is such that (x, ek) = 0, which contradicts Indeed, thanks to the cyclicity of ei0. Proposition 5.1 we know π(SβS∗ α)ek = ei0 , which immediately makes it plain ek is also cyclic. (cid:3) It is now clear how to get to the conclusion. β ∈ O2 such that π(SαS∗ 2 )ei0 ⊂ H, with Oalg The above result might beguile the reader into thinking that cyclic permutative repre- sentations are automatically irreducible. The situation is in fact a shade more involved than that, and cyclic permutative representations will in general fail to be irreducible. Even so, the natural condition that prevents this from happening has been spotted by Bratteli and Jorgensen in [BJ99], where they introduce a suitable notion of multiplicity- free permutative representation of O2, which we next recall in some detail. To this aim, we first need to recall the definition of the so-called coding map as it is introduced in [BJ99]. If (σ1, σ2) is a branching function system of order 2, we can define a map σ : N → {1, 2}N in the following way. For any given n ∈ N, there is only one sequence (i1, i2, . . . , ik, . . .) ∈ {1, 2}N such that n lies in the range of σi1 ◦ σi2 ◦ . . . ◦ σik for any k ∈ N: by definition, the value σ(n) of the coding map on the integer n is just this PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 15 ik . . . S∗ i2S∗ sequence. In terms of the Cuntz isometries, if π is the representation associated with (σ1, σ2), the sequence σ(n) = (i1, i2, . . . , ik, . . .) is completely determined by the con- dition π(S∗ i1)en 6= 0 for every k ∈ N. Now a permutative representation is multiplicity-free in the sense of Bratteli-Jorgensen if the corresponding coding map is injective. More generally, our representation is said regular if its coding map is only partially injective, namely if σ(n) = σ(σii ◦ . . .◦ σik (n)) then n = σii ◦ . . .◦ σik (n), for any i1, i2, . . . ik ∈ {1, 2} and k ∈ N. Obviously, both definitions continue to make sense for a representation ρ of Q2 also, since it is quite natural to say ρ is multiplicity-free or regular if its restriction to the Cuntz algebra O2 is. At this point, it is already fairly clear that a permutative representation that decomposes into the direct sum of multiplicity-free permutative subrepresentations is regular. That said, we can move on to discuss the announced result. First, we single out in the following lemma a separation property enjoyed by multiplicity-free representations. Lemma 5.3. Let π : O2 → B(H) be a multiplicity-free permutative representation. Then forn any finite set of basis vector {en0, en1,, . . . , enk} there is a multi-index α ∈ W2 such that π(SαS∗ α)eni = 0 for every i = 1, 2, . . . , k. α)en0 = en0 and π(SαS∗ Proof. Let αl = (i1, i2, . . . , il) be the multi-index of length l obtained out of σ(n0) = (i1, i2, . . .) by taking its first l values. We have π(SαlS∗ αl)en0 = en0 for every l ∈ N by construction. We argue by induction on k. If k = 1, there must exist an l ∈ N such that π(SαlS∗ αl)en1 = 0, for otherwise σ(n1) would be the same as σ(n0), which is not possible by hypothesis. Finally, the inductive step can be taken in much the same way. (cid:3) Proposition 5.4. Any multiplicity-free cyclic permutative representation π of O2 or Q2 is irreducible. Proof. Again, we limit ourselves to dealing with O2 only. We need to prove that every non-zero vector is cyclic. To this end, it is enough to produce a dense subset of cyclic vectors, and this is given by finite linear combinations of the form x = λ1e1 + λ2e2 + . . . λnen, n ∈ N. If x is not zero, we may suppose λ1 6= 0 without loss of generality. By applying Lemma 5.3 we see there exists a certain α ∈ W2 such that π(SαS∗ α)e1 = e1 and π(SαS∗ α)x = e1, and so π(O2)x exhausts H, since it contains the cyclic vector e1. (cid:3) α)ej = 0 for every j = 2, 3, . . . , n. But then π( 1 SαS∗ λ1 Now by means of a standard application of Zorn's lemma one sees at once that any permutative representation decomposes into the direct sum of cyclic permutative repre- sentations. Proposition 5.5. Every permutative representation of O2 or Q2 decomposes into the direct sum of cyclic permutative representations. Proof. For instance, let π be a permutative representazion of the Cuntz algebra. We only need to show that π has a cyclic permutative subrepresentation. Now a subrep- resentation of this type can be produced at once by considering the closed subspace . = π(O2)e0. Indeed, M is cyclic and π invariant by construction. The conclusion is M then reached by realizing that there exists an orthonormal basis of M made up of basis vectors, that is M = span{ei : i ∈ I ⊂ N}, and this is easily seen by noting that M can also be described as span{π(SαS∗ (cid:3) β)e0 : α, β ∈ W2}. 16 V. AIELLO, R. CONTI, AND S. ROSSI Furthermore, if the representation π is also multiplicity-free, in the above decom- position all cyclic representations are actually irreducible thanks to Proposition 5.4. However, in [BJ99, Theorem 2.7] more is proved. Indeed, any multiplicity-free permuta- tive representation is shown to decompose into the direct sum of irreducible permutative subrepresentions that are in addition pairwise inequivalent. Notably, the representation is multiplicity-free in the usual sense as well, i.e. the commutant π(O2)′ is abelian. If the representation is only assumed to be regular, then it is still completely reducible, but permutative irreducible subrepresentations may appear with multiplicity greater than one. Curiously enough, it is nowhere explicitly said in their monograph that the converse, too, holds true, although the authors were perhaps fully aware of this fact. Be that as it may, this further confirms that the two definitions could not possibly have been any better. At any rate, it is not quite a matter of being nuanced about how good the definitions are; it is more that we do need the converse, see Therem 6.3, to prove our own results. Because the proof is not entirely obvious, it is postponed to the next section. 6. A converse to a theorem of Bratteli-Jorgensen in . . . S∗ i2S∗ Cyclic permutative representations of O2 are completely known. More precisely, they can all be classified in terms of a (possibly infinite) multi-index I in the alphabet {1, 2}. Associated with any such index I there is a unique cyclic permutative representation πI of O2 that is completely determined by the following properties. When the multi- index I is finite, say I = (i1, i2, . . . , ik), then there is a unique basis vector Ω such that πI(SI)Ω = Ω and the set of vectors {Ω, πI(SI1)Ω, πI(SI2)Ω, . . . , πI(SIk−1)Ω} is an orthonormal system, where Ij is the multi-index obtained out of I by considering its first j entries only. When the multi-index is an infinite sequence I = (i1, i2, . . . , in, . . .) instead, Ω is the only basis vector such that S∗ i1Ω 6= 0 for every n ∈ N and the set {Ω, πI(Ik)Ω : k ∈ N} is an orthonormal system. In [Kaw06] πI is referred to as the representation of type P (I), and so is it in the present work. More importantly, a representation of type P (I) is irreducible if and only if either the multi-index I is finite and cannot be written as JJ . . . J, where J is another finite multi-index such that J divides I, or it is infinite and is not eventually periodic, see e.g. [DP99, Theorem 3.4]. Interestingly, a representation rising from a multi-index whose length is an odd prime number is necessarily irreducible. Finally, note that P (1) and P (2) are respectively nothing but π− and π+. That said, we can move on to the announced result. In order to prove it, the first step to take is to ensure that irreducible representations are multiplicity-free in the sense of Bratteli-Jorgensen. To do that, we first need to give a ν is reduced if it cannot be written as Sµ′PβS∗ definition. We say that a monomial SµS∗ ν′ with µ = µ′β, ν = ν′β and Pβ = SβS∗ β a non-trivial standard diagonal projection. Note that if in a permutative representation SαPβS∗ γen. A couple of observations are now in order to better understand what the definition actually rules out. First, if either µ or ν is empty, the corresponding monomial is certainly reduced; in particular, the identity I is reduced. Second, none of the non- trivial standard diagonal projections are reduced. Theorem 6.1. Any irreducible permutative representation of O2 is multiplicity-free in the sense of Bratteli-Jorgensen. γen 6= 0 then SαPβS∗ γen = SαS∗ PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 17 ν , Sµ′S∗ . = SµS∗ ν en ν en = SiSµS∗ ν em = T SiSµS∗ ν en, i = 1, 2. ν ek = Sµ′S∗ ν en is zero then SµS∗ ν′ek 6= 0 with reduced SµS∗ Proof. There are two cases to deal with according to whether for any given k ∈ N the ν′ implies µ = µ′ and ν = ν′. equality SµS∗ If this is the case, the proof to the theorem is reached by contradiction. Assuming that the coding map fails to be injective, say σ(n) = σ(m) with n 6= m, a bounded linear operator T is well defined on the Hilbert space ℓ2(N) by T SµS∗ ν em, for any pair of (reduced) multi-indices µ, ν. Indeed, if SµS∗ ν em is also zero, since σ(n) = σ(m) by assumption. By irreducibility the linear spans of {SµS∗ ν en : µ, ν} and {SµS∗ ν em : µ, ν} are both dense, which means T is densely defined with dense range. Because it is clearly isometric as well, it extends to a unitary operator of ℓ2(N). Furthermore, sending en to em, T is not a multiple of the identity. The contradiction is finally arrived at if we show that T lies in the commutant of the representation. This is quickly verified. As T is unitary, we only need to make sure that SiT = T Si, i = 1, 2. These equalities are immediately seen to hold true at the level of span{SµS∗ ν en : µ, ν}, for SiT SµS∗ In the second case, it is not difficult to realize that the representation is of type P (I) in the sense of Kawamura, see [Kaw06], so that there exists Ω ∈ ℓ2(N) such that SIΩ = Ω for some finite multi-index I = (i1, i2, . . . , ik) ∈ W2. Moreover, the vector Ω is a suitable basis vector, say Ω = eh. In particular, the value of the coding map at h is given by σ(h) = i1i2 . . . ik = I, where we have adopted the convention that α is the periodic sequence in which (α1, α2, . . . αα) is repeated infinitely many times. We now want to prove that the coding map σ is injective. To this aim, it is useful to observe that H can be obtained as the closed span of the set {SαΩ : α ∈ W2}. In other words, for any n ∈ N there exists at least one multi-index α ∈ W2 such that SαΩ = en. As a result, we see that σ(n) is nothing but the sequence α ¯I. From this, the coding map is easily seen to be injective. Indeed, if for n, m ∈ N we have σ(n) = σ(m), then α ¯I = β ¯I, where α, β ∈ W2 are two multi-indeces such that en = SαΩ and em = SβΩ. Apart from the trivial case when α = β, the equality α ¯I = β ¯I is still possible if α and β differs by a multiple of I, i.e. β = α(kI), for some k ∈ N, since I is an irreducible block. But in this case em = SβΩ = SαSkIΩ = SαΩ = en, hence n = m. (cid:3) As an easy consequence, we now have the following result too. Corollary 6.2. A permutative representation π : O2 → B(H) that decomposes into the direct sum of irreducible permutative subrepresentations is regular in the sense Bratteli- Jorgensen. Proof. We need to check that the coding map σ associated with π is partially injective, namely if n ∈ N is such that σ(n) = σ(σi1◦σi2◦. . .◦σik (n)) then n = σi1◦σi2◦. . .◦σik (n). Under our hypotheses, N may be written as (at most countable) disjoint union of infinite . set Ai such that Hi = span{en : n ∈ Aj} ⊂ H is an irreducible π-invariant subspace. Now, given any n ∈ N there is a unique i0 such that n ∈ Ai0, that is en ∈ Hi0. If we do so, we see With a slight abuse of notation we write σ(en) instead of σ(n). that σ(σi1 ◦ σi2 ◦ . . . ◦ σik(n)) is nothing but σ(Si1Si2 . . . Siken), and the conclusion is immediately got to since Si1Si2 . . . Sik en is still in Hi0 and the restriction of σ to Ai0 is injective. (cid:3) Furthermore, if each irreducible component shows up at most once, i.e. our represen- tation is multiplicity-free in the general sense, then the coding map can be shown to be 18 V. AIELLO, R. CONTI, AND S. ROSSI injective. This finding is nothing but the sought converse to the theorem of Bratteli and Jorgensen that a multiplicity-free permutative representation decomposes into the di- rect sum of inequivalent irreducible permutative subrepresentations, cf. [BJ99, Theorem 2.7]. Theorem 6.3. Let π be a permutative representation of O2 such that π decomposes as a direct sum of inequivalent irreducible permutative subrepresentations. Then the coding map is injective, that is π is multiplicity-free in the sense of Bratteli-Jorgensen. Proof. By our assumptions, N decomposes into the disjoint union of (at most countably . = span{ej : j ∈ Ai} ⊂ ℓ2(N) are infinitely many) subsets Ai, i ∈ I, such that Hi inequivalent irreducible subspaces of the given representation π. Given two different integer numbers n, m ∈ N, there are two cases to deal with according to whether n and m both belong to an Ai, for some i ∈ I. If they do, there is not much to prove in view of the result above, since the restriction of σ to each of the Ai's has already been shown to be injective. Suppose this is not the case. Then n ∈ Ai and m ∈ Aj, with i 6= j. We now claim that σ(n) = σ(m) implies ωn = ωm, where ωk is the vector . = (π(x)ek, ek), x ∈ O2. But this state associated with the basis vector ek, i.e. ωk(x) leads to an absurd, because π ↾Hn and π ↾Hm are then unitarily equivalent, since they are two GNS representations arising from the same state. In order to prove the claim, we actually show a bit more. In fact, the sequence σ(k) contains full information about the state ωk. More precisely, knowing exactly what σ(k) is allows us to evaluate ωk at every monomial SµS∗ µek). There are now a few cases to treat. If one of µ or ν is not an initial word of σ(k), then ωk(SµS∗ ν ) is zero. If both µ and ν are initial words of σ(k), then either µ = ν or µ 6= ν. In the first case, we necessarily have µ = ν, which means ωk(SµS∗ ν ) = 1. In the second case, we can suppose µ > ν, which means µ = ν µ, and so ωk(SµS∗ ν ) is . = S∗ given by (S∗ µS∗ ν ek ν ek and el′ lie in the same irreducible subspace, namely Hi0 with k ∈ Ai0. Now ωk(SµS∗ ν ) = 1 if and only if l = l′ and 0 otherwise. But the injectivity of σ restricted to Ai0 says that ωk(SµS∗ ν ) is 1 if σ(l) = σ(l′) and 0 if σ(l) 6= σ(l′). But both σ(l) and σ(l′) are infinite subsequences of σ(k) by construction, obtained by removing the first ν and µ digits, respectively, which ends the proof. (cid:3) ν ek). To conclude, we need to note that el ν . Indeed, by definition ωk(SµS∗ ν ek, S∗ ν ) = (SµS∗ ν ek, ek) = (S∗ ν ek, S∗ µS∗ . = S∗ In particular, the restriction of the canonical representation of Q2 to O2 is multiplicity- free in the sense of Bratteli-Jorgensen, since it decomposes into the direct sum of two [ACR18, Sect. 2.2]. While π+ and π− are inequivalent representations π+ and π−, cf. inequivalent, they can still be obtained out of each other by composing with the flip-flop automorphism λf , which is given by λf (S1) = S2 and λf (S2) = S1. Indeed, we have the following result. Proposition 6.4. If V is the unitary between H− and H+ given by V ek V π− = (π+ ◦ λf )V . Proof. All we need to do is to make sure that the equalities V π−(S1) = π+(S2)V and V π−(S2) = π+(S1)V hold. But these are easily verified by a direct computation. (cid:3) . = e−k−1, then PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 19 It is also worth pointing out that the operator V is the unique permutative unitary that intertwines π− and π+ ◦ λf . At this point, it is useful to point out that representations of type P (I) may well fail to be regular when they are not irreducible, i.e. when the corresponding multi-index I is made up of a finite number of finite blocks or it is infinite but eventually periodic. In this situation, the theorem of Bratteli and Jorgensen does not apply as the coding map is no longer partially injective. Even so, a decomposition into irreducible components still exists, although some of these will not be permutative subrepresentations. It is then necessary to consider more general representations, where a phase can appear as well as a permutation of the basis vectors. These are the so-called representations of type P (J, zk), with J = k and z ∈ T, cf. [Kaw06] and the references therein, which can be simply described as the composition P(J) ◦ αz, where {αz : z ∈ T} are the gauge automorphisms of O2, namely αz(Si) = zSi, i = 1, 2. Obviously, a representation of type P (J, zk) is irreducible if and only if P (J) is. Moreover, it extends to a representation of Q2 if and only if P (J) does, for αz certainly extends, see [ACR18]. For instance, it can be seen that P (1212) decomposes as P (12) ⊕ P (12,−1). For what follows, we also need to remark that the representations P (1k) and P (2k) are completely reducible for every k ∈ N, where 1k and 2k are the multi-indices of length k whose entries are all 1's or 2's, respectively. Indeed, it is proved in [Kaw06] that P (1k) = P (1) ⊕ P (1, ζ) ⊕ . . . ⊕ P (1, ζ k−1) = P (1) ⊕ (P (1) ◦ αζ) ⊕ . . . ⊕ (P (1) ◦ αζ k−1) and P (2k) = P (2) ⊕ P (2, ζ) ⊕ . . . ⊕ P (2, ζ k−1) = P (2) ⊕ (P (2) ◦ αζ) ⊕ . . . ⊕ (P (2) ◦ αζ k−1), k . Now neither P (1k) nor P (2k) extends to Q2 because in P (1k) the point with ζ = e spectrum of S1 is the set of all k-th roots of unity, with each eigenvalue being simple, whereas the point spectrum of S2 is empty, and the other way round in P (2k). However, their direct sum P (1k) ⊕ P (2k) does extend by virtue of the equality P (1k) ⊕ P (2k) = πc ⊕ (πc ◦ αζ) ⊕ . . . ⊕ (πc ◦ αζ k−1) 2πi which holds up to equivalence. This also shows that there is at least one non-permutative extension of P (1k) ⊕ P (2k) to Q2 that is not irreducible, which is simply given by Yet this does not still say that the permutative extensions of P (1k)⊕P (2k) are reducible themselves. In fact, this is just the case. The proof, though, requires a more painstaking analysis, which is carried out in the next section. ρc ⊕ (ρc ◦eαζ) ⊕ . . . ⊕ (ρc ◦eαζ k−1) 7. Irreducible representations of Q2 We can now return to the discussion of permutative representations of Q2. In partic- ular, we would like to focus our attention on irreducible representations. To this aim, we need to improve our knowledge of the irreducible representations of type P (I) at the level of the Cuntz algebra. More precisely, we first need to answer the question of whether they extend to Q2 or not. It is somewhat surprising that they all do apart from P (1) and P (2). Not only do they extend, but their extension is also unique. 20 V. AIELLO, R. CONTI, AND S. ROSSI Proposition 7.1. In all irreducible representations of type P (I) with I ≥ 2 the gen- erating isometries are pure. In particular, apart from P (1) and P (2), all of these irre- ducible representations uniquely extend to Q2. Proof. We first handle the case of a finite multi-index J = (j1, j2, . . . , jk). Following Kawamura, cf. [Kaw06, Lemma 2.2], the isometries S1 and S2 can be realized concretely by the branching function system (σ1, σ2) given by j1 = 2 j1 = 1 , jl = 2 jl = 1 , 2 ≤ l ≤ k, f1(l) = 2l−1, l ≥ k +1 σ1(1) =(k + 1 σ2(1) =(k k σ1(l) =(k + l σ2(l) =(l − 1 l − 1 jl = 2 jl = 1 j1 = 2 k + 1 j1 = 1 , k + l 1 (l) and σn , 2 ≤ l ≤ k, f2(l) = 2l, l ≥ k + 1 To begin with, it is worth noting that SJ ek = ek, which follows from the equalities σjk(k) = k − 1 and σj1(1) = k. Proving that S1 and S2 are pure amounts to making sure that for any l ∈ N σn 2 (l) diverge as n → ∞. We only need to worry about the first sequence, as the second can be worked out with in much the same way. If for some l0 ∈ N the sequence {σn 1 (l0) : n ∈ N} were bounded, then there would exist an integer n0 such that σn0 1 el0 = el0, meaning our representation would be a representation of type P (11 . . . 1), which obviously is not the case, since the representation P (11 . . . 1) is irreducible only when k = 1. The case of an infinite multi-index is still easier to deal with. Again, following Kawa- mura, cf. [Kaw06, Lemma 2.3], the isometries S1 and S2 are now implemented by the two injective functions f1, f2 : Z × N → Z × N given by 1 (l0) = l0, whence Sn0 f1(n, 1) = (n − 1, pn(1)) f2(n, 1) = (n − 1, pn(2)) f1(n, m) = (n − 1, 2m − 1) for m ≥ 2 f2(n, m) = (n − 1, 2m) for m ≥ 2 where, for every n ∈ Z, pn is the permutation on {1, 2} such that pn = id if n ≤ 0 and pn(1) = jn otherwise. The pureness is then proved as soon as one realizes that neither f1 nor f2 has finite orbits. (cid:3) From now on we will denote the unique extension of P (I) to Q2 by eP (I). Although eP (I) is completely determined by its restriction to the Cuntz algebra, in general it is not an entirely trivial task to see explicitly how U acts in this representation. In addition, saying what its multiplicity is for any given multi-index I is far from obvious, not least because the formulas one obtains may be rather unwieldy to compute with. One can already get a better grasp of the problem by analysing the following elementary example, where as simple a case as eP (12) is looked at more closely. course yield two different yet unitarily equivalent realizations of eP (12). As usual, we Example 7.2. We discuss two different realizations of P (12) at the level of O2, which of consider the Hilbert space ℓ2(N) endowed with the canonical basis {en : n ∈ N}. In . = e2k, k ∈ N. In the first representation, both representations S2 simply acts as S2ek S1 acts as the usual isometry composed with a switch on the first two basis vectors, i.e. . = e2k−1, for every k ≥ 3. In the second, the switch S1e1 is performed pairwise on all vectors instead. More explicitly, S1 now takes the form . = e2k−3 if k is even. S1ek . = e2k+1 if k is odd, and S1ek . = e1, and S1ek . = e3, S1e2 PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 21 In the first, one easily sees that Ue2 = e3, Ue4 = e1 and Ue2k = e2k−1 for all k ≥ 3. For odd numbers one finds out Ue1 = e6, Ue11 = e10, and Ue2k−1 = e2k−2 for all k ≥ 8, with the exception of the two sequences Uek0 = eh0, Ue2nk0−Pn−1 i=0 2i = e2nh0 for all n = 1, 2, 3, . . . with (k0, h0) equal to (3, 12) and (7, 2), respectively. In the second, after making some computations one finds out that the action of U can be described rather easily on even numbers, and yet much less so on odd numbers. At any rate, the formulas arrived at are the following. Ue2n =(e2n+1 n odd e2n−3 n even Ue2k n−(2k−1+1) =(e2kn+(2k−2k−1) n odd e2kn−(2k+2k−1) n even where k is any integer bigger than or equal to 2. The above formula actually defines U on all odd vectors too, since every odd number can always be written as 2kn− (2k−1− 1) for suitable k ≥ 2 and n ∈ N. There would be no a priori reason to expect the representations eP (I) to exhaust all irreducible representations of Q2. In principle, there might be many irreducible permutative representations of Q2 that restrict to O2 as reducible representations. The canonical representation ρc is just such an example. However, that is the one example, for it turns out that any permutative irreducible representation ρ of Q2 restricts to O2 as an irreducible representation as long as ρ is not unitarily equivalent to ρc. In order to prove this, however, we are yet to fully analyze the permutative extensions of representation of O2 of the form P (1k) ⊕ P (2k), which is done in the next couple of propositions. In particular, what we aim to do is show every such representation is not irreducible in that it contains a copy of the canonical representation. Proposition 7.3. Let ρ : Q2 → B(H) be a permutative representation such that there exists a permutative O2-invariant subspace H(1k) ⊂ H on which ρ ↾O2 acts as a rep- resentation of type P (1k). Then there also exists a permutative O2-invariant subspace H(2k) ⊂ H on which ρ ↾O2 acts as a representation of type P (2k). Moreover, H(1k) . and H(2k) are orthogonal and their direct sum K = H(1k) ⊕ H(2k) is a Q2-invariant subspace, i.e. K is a permutative subspace that reduces ρ. Proof. By hypothesis there exists a basis vector Ω1 such that ρ(S1)kΩ1 = Ω1 and {Ω1, ρ(S1)Ω1, . . . , ρ(S1)k−1Ω1} is an orthonormal set. It is then easy to see that H(1k) is given by span{SµΩ1 : µ ∈ W2}. In other terms, in this situation there is actually no need to consider more general monomials of the form SµS∗ 2Ω1 = 0 and . (S∗ = ρ(U)Ω1. Obviously, Ω2 is still a basis vector. Furthermore, we also have ρ(Sk 1 Ω1 for every l = 1, 2, . . . , k. We now define Ω2 1)lΩ1 = Sk−l ν , since S∗ 2 )Ω2 = Ω2. Indeed, ρ(S2)kΩ2 = ρ(Sk 2 U)Ω1 = ρ(USk 1 )Ω1 = ρ(U)ρ(Sk 1 )Ω1 = ρ(U)Ω1 = Ω2 Since the set {Ω2, ρ(S2)Ω2, . . . , ρ(Sk−1 )Ω2} is clearly orthonormal, the O2-invariant sub- . space H(2k) = span{SµΩ2 : µ ∈ W2} yields a subrepresentation of type P (2k). Simple but tedious computations show that H(1k) ⊥ H(2k), i.e. (ρ(Sµ)Ω1, ρ(Sν)Ω2) = 0 for . every µ, ν ∈ W2. All is left to do is check that K = H(1k) ⊕ H(2k) is also invariant 2 22 V. AIELLO, R. CONTI, AND S. ROSSI 1 1 )Ω1 = Ω1 respectively. )Ω1, which can be proved starting by ρ(Sk for both ρ(U) and ρ(U ∗). After a moment's reflection, one easily realizes that verify- ing this invariance property amounts to showing that ρ(U)Ω2 and ρ(U ∗)Ω1 are still in K. But this is certainly the case thanks to the equalities ρ(U)Ω2 = ρ(S1)ρ(Sk−1 )Ω2 and ρ(U ∗)Ω1 = ρ(S2)ρ(Sk−1 2 )Ω2 = Ω2 and ρ(Sk (cid:3) Proposition 7.4. Let ρ : Q2 → B(H) be a permutative representation such that there exists an O2-invariant subspace H(1k) ⊂ H on which ρ ↾O2 acts as a representation of type P (1k). Then ρ contains a copy of the canonical representation. In particular, ρ is not irreducible. Proof. Let K = H(1k) ⊕ H(2k) ⊂ H the ρ-invariant subspace we produced above. If we define 2 . = Φ1 1 √k (Ω1+ρ(S1)Ω1+. . .+ρ(Sk−1 1 )Ω1) and Φ2 . = 1 √k (Ω2+ρ(S2)Ω2+. . .+ρ(Sk−1 2 )Ω2) we immediately see that ρ(Si)Φi = Φi, i = 1, 2, and UΦ1 = Φ2. Note that neither Φ1 nor Φ2 is a basis vector. However, if we set K(i) = span{SµΦi : µ ∈ W2}, i = 1, 2, the same proof as above shows that K(1) ⊕ K(2) is a (proper) ρ-invariant subspace, on which ρ restricts as the canonical representation. (cid:3) Remark 7.5. The subrepresentation produced above is not a permutative subrepresen- tation of the representation ρ in the statement since neither of Φi, i = 1, 2, is a basis vector. The last tool we need for the proof to the main result of the section is provided by the following lemma. Lemma 7.6. Let ρ : Q2 → B(H) be a representation in which ρ(S1) and ρ(S2) are pure isometries. If M ⊂ H is a ρ(O2)-invariant subspace, then it is also invariant under ρ(Q2). Proof. All we have to do is show ρ(U)M ⊂ M and ρ(U ∗)M ⊂ M. We only deal with the first inclusion, since the second inclusion can be handled analogously. The equality ρ(U)ρ(S2)ρ(S2)∗ = ρ(S1)ρ(S2)∗ says that ρ(S2S∗ 2)M is certainly invariant under ρ(U). As for ρ(S1S∗ 1), n ∈ N, whose ranges decompose ρ(S1S∗ 1)H into a direct sum as a consequence of ρ(S2) being pure. From the equality ρ(S2)ρ(U)ρ(Sn 1) we then see that ρ(U)ρ(S1Sn 1)M is contained in ρ(S2)M, which clearly concludes the proof. (cid:3) 1 )M, we need to make use of the projections ρ(S1Sn 1 ) = ρ(U)ρ(S1Sn 2)nS∗ 2)nS∗ 2 (S∗ 2)nS∗ 2 (S∗ 2 (S∗ 2)nS∗ 2 (S∗ Remark 7.7. Actually, the proof above also covers the slightly more general situation in which only the restriction of the isometries to the invariant subspace M are assumed to be pure, while the isometries are allowed not to be so on the whole H. We are finally in a position to prove the main result of this section, which not only says an irreducible permutative representation of Q2 is completely determined by its restriction to the Cuntz algebra O2 but also provides the complete classification of all irreducible permutative representations of Q2: as announced, apart from the canonical representation, every irreducible representation of Q2 is the unique extension of an irreducible representation of O2. PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 23 Theorem 7.8. If ρ is an irreducible permutative representation of Q2, then ρ ↾O2 is unitarily equivalent with either the restriction of the canonical representation to O2 or an irreducible representation of type P (I). In particular, ρ ↾O2 is multiplicity-free in the sense of Bratteli-Jorgensen. Proof. If we denote the restriction of ρ to O2 by π. we have π = ⊕j∈J πj, where each πj is a cyclic permutative representation of the Cuntz algebra O2. In particular, for every j ∈ J there is a (possibly infinite) multi-index Ij such that πj ∼= P (Ij). If a subrepresen- tation of type P (1k) shows up in the decomposition with a certain multiplicity, then a subrepresentation of type P (2k) must show up as well with the same multiplicity, since this is the only way for σp(ρ(S1)) and σp(ρ(S2)) to coincide along with the multiplicity of each eigenvalue. Therefore, the decomposition of π actually reads as π = n1(P (1) ⊕ P (2)) ⊕ n2(P (11) ⊕ P (22)) . . . ⊕ nk(P (1k) ⊕ P (2k)) ⊕ . . . ⊕ σ where σ is the direct sum of the pure components. Now σ uniquely extends to a representation σ of Q2 by pureness, as does every P (1k)⊕P (2k) thanks to the theorem of Larsen and Li. In view of Proposition 7.4 each ni must be 0 for every i ≥ 2, for otherwise ρ would properly contain a subrepresentation. In fact, P (1)⊕P (2) can appear. If it does, however, the pure part σ cannot appear, hence the above direct sum is the canonical representation up to equivalence. If it does not, then π must be a pure representation of type P (I), and we only need to show that P (I) is already irreducible. But this is indeed a straightforward application of Lemma 7.6. (cid:3) Remark 7.9. In light of the theorem we proved above, the canonical representation of Q2 can now be characterized as its sole irreducible permutative representation whose restriction to O2 is reducible. This raises the question of whether any (possibly non- permutative) irreducible representation of Q2 which is not the canonical representation is still irreducible when restricted to the Cuntz algebra O2. One might also wonder to what extent an irreducible representation of Q2 is determined by its restriction to O2. To better appreciate the reach of Theorem 7.8, it is worth stressing that in general a permutative representation of Q2 will not restrict to the Cuntz algebra as a repre- sentation that is regular at all. For instance, this is seen by considering any of the permutative extensions of P (1k)⊕ P (2k), where k is any integer greater than 1. Indeed, none of these representations can be regular, since they do not decompose into a direct sum of irreducible permutative components, as we have already remarked. However, there is only one way for a restriction to fail to be regular: the representation ρ itself must not decompose into permutative irreducibles at the level of Q2. This is spelled out in the next proposition. Roughly speaking, it says one cannot jettison the hypothesis that ρ ↾O2 is regular if ρ is to be decomposable at the level of Q2. Proposition 7.10. Let ρ : Q2 → B(H) be a permutative representation. The following are equivalent: (1) ρ ↾O2 is regular (multiplicity-free) in the sense of Bratteli-Jorgensen. (2) ρ decomposes into the direct sum of (distinct) irreducible permutative subrepre- sentations. 24 V. AIELLO, R. CONTI, AND S. ROSSI . = ρ ↾O2 is regular, then π takes on the form π = ⊕j∈J P (Ij) where each P (Ij) Proof. If π is irreducible. Furthermore, if a representation of type P (1) appears in the decomposi- tion, then a representation of type P (2) appears as well and with the same multiplicity, so π = n(P (1)⊕ P (2))⊕ (⊕kP (Ik)), where the P (Ik)'s are all pure as well as irreducible, equivalence thanks to Theorem 3.5. On the other hand, assuming that ρ decomposes as ⊕j∈J ρj, where each ρj is an irreducible permutative subrepresentation, immediately leads to π being a direct sum of a number (possibly zero) of copies of ρc ↾O2 and certain P (Ij)'s for suitable multi-indeces in view of Theorem 7.8. Finally such a π is regular by virtue of Corollary 6.2. To conclude, the same argument as above makes it plain that ρ ↾O2 is multiplicity-free if and only if ρ is. (cid:3) and n ∈ {0, 1, 2, . . . ,∞}. Therefore, ρ must coincide with nρc⊕(⊕keP (Ik)) up to unitary Simple instances of representations other than those above arise quite naturally by composing the canonical representation of Q2 with the endomorphisms χ2k+1 given by χ2k+1(S2) = S2 and χ2k+1(U) = U 2k+1, k ∈ Z, introduced in [ACR18]. If we do so, . = ρc ◦ χ2k+1 of Q2 acting on the Hilbert we obtain a family of representations ρ2k+1 space ℓ2(Z) as ρ2k+1(S2)el = e2l and ρ2k+1(U)el = el+2k+1, for every l ∈ Z. For example, this allows us to see that the multiplicity of U in a (reducible) representation of type ρ3 is the direct sum of the canonical representation with eP (12). Among other things, eP (12) is two. In general, every ρ2k+1 admits a similar decomposition into a direct sum of two irreducible components, one of which is always the canonical representation and the other is a representation of type P (I), with I being a periodic infinite multi-index. At the end of Section 4 we pointed out that for any permutative representation ρ of Q2 the von Neumann algebra generated by C ∗(U) is never maximal unless ρ is the canonical representation. In fact, the diagonal subalgebra D2 ⊂ O2 ⊂ Q2, which in [ACR18] was proved to be maximal abelian in Q2 as well as in O2, behaves in a dramatically different way: irrespective of what the irreducible permutative representation π of either O2 or Q2 is, the weak closure of π(D2) will always be the atomic MASA ℓ∞(N). Actually, much more is true, for π(D2)′′ is the atomic MASA for every multiplicity-free representation π of the Cuntz algebra. Proposition 7.11. For any multiplicity-free representation π : O2 → B(ℓ2(N)) the von Neumann algebra π(D2)′′ is ℓ∞(N). In particular, ρ(D2)′′ = ℓ∞(N) for every irreducible representation ρ of Q2. Proof. For every h ∈ N we denote the orthogonal projections onto Ceh by δh, i.e. δh(x) = (x, eh)eh for every x ∈ ℓ2(N). The statement is proved once we make sure each δh lies in the strong closure of π(D2). Let α = (i1, i2, . . .) ∈ {1, 2}N be the value of the coding map at h. We denote by αn the multi-index obtained out of α by taking the first n entries only. The conclusion is reached if we show that π(SαnS∗ αn) strongly converges to δh. To this aim, note that π(SαnS∗ αn)eh = eh for every n ∈ N by definition. Furthermore, for every k 6= h the sequence π(SαnS∗ αn)ek converges to zero in norm, for otherwise σ(k) should be α, which is not the case as σ is injective by hypothesis. (cid:3) PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 25 8. Pure states of O2 with the unique extension property The results we have obtained can also be reinterpreted in terms of extension of pure states. A pure state ω of the Cuntz algebra O2 may have more than one pure extension to Q2. However, if ω comes from an irreducible permutative representation, then it will have precisely one pure extension, which is proved in the present section. To begin with, we start by proving a general result that each pure state coming from an irreducible representations in which both Cuntz isometries are pure has a unique pure extension to Q2. Theorem 8.1. Every vector state associated with an irreducible representation π : O2 → B(H) in which π(S1) and π(S2) are both pure has the unique extension property with respect to the inclusion O2 ⊂ Q2. Proof. For a given ωx, with ωx(T ) = (π(T )x, x), for every T ∈ O2, where x ∈ H is a unit vector, let Ω ∈ P(Q2) be such that Ω ↾O2= ωx. Let (HΩ, πΩ, xΩ) be the GNS triple associated with Ω, that is πΩ : Q2 → B(HΩ) is the unique irreducible representation . such that Ω(T ) = (πΩ(T )xΩ, xΩ) for every T ∈ Q2. Let us define K = πΩ(O2)xΩ ⊂ HΩ. . Then the representation π′ : O2 → B(K), which is given by π′(T ) = πΩ(T ) ↾K for every T ∈ O2, is cyclic by definition and the cyclic vector xΩ satisfies (π′(T )xΩ, xΩ) = ωx(T ), for every T ∈ O2, hence π′ and π are unitarily equivalent. In particular, πΩ(Si) ↾K are both pure. But then K is also invariant under πΩ(Q2) thanks to Lemma 7.6, and so K = HΩ by irreducibility. In other terms, the restriction of πΩ to the Cuntz algebra O2 is nothing but π up to unitary equivalence. By pureness, though, π can only be extended in one way, which means πΩ is in fact π, the unique extension of π to Q2, up to unitary equivalence. If V : HΩ → H is any intertwining unitary, i.e. πΩ(T ) = V ∗π(T )V for every T ∈ Q2, then Ω(T ) = (πΩ(T )xΩ, xΩ) = (π(T )V xΩ, V xΩ). The last equality says that Ω is uniquely determined, since V xΩ must coincide up to a phase with x ∈ H. (cid:3) Corollary 8.2. Every vector state ω ∈ P(O2) associated with an irreducible permutative representation of type P (I) with I ≥ 2 has the unique extension property relative to the inclusion O2 ⊂ Q2. Still, the representations of type P (1) and P (2) are out of the reach of the above result, but nevertheless their vector states continue to enjoy the unique extension property. This, however, is a consequence of the following simple and yet instrumental result. Lemma 8.3. If ρ : Q2 → B(H) is a representation such that there exists an O2- invariant subspace on which ρ ↾O2 acts as either P (1) or P (2), then ρ contains the canonical representation of Q2. Proof. We only deal with P (2), since P (1) can be dealt with in a similar fashion. By hypothesis, there is an O2-invariant subspace K(2) ∼= ℓ2(N), with orthonormal basis {en : n = 0, 1, 2, . . .}, such that ρ(S1)en = e2n+1 and ρ(S2)en = e2n, n ∈ N ∪ {0}. It is then straighforward to verify that ρ(U)en = en+1, for every n ∈ N. Furthermore, we also have ρ(U)e0 = e1. Indeed, e1 = ρ(S1)e0 = ρ(U)ρ(S2)e0 = ρ(U)e0. It is now clear how . = span{e−n : n ∈ N}. to go on. We define e−n Clearly, {e−n : n ∈ N} is an orthonormal basis for K(1). It is also as clear that K(1) and K(2) are orthogonal. Moreover, the equality ρ(U)e−n = e−n+1, for n ∈ N, follows . = ρ(U ∗)ne0 for every k ∈ N and K(1) 26 V. AIELLO, R. CONTI, AND S. ROSSI at once from the very definition of the vectors e−n. Now ρ(S2)e−n = ρ(S2)ρ(U ∗)ne0 = ρ(U ∗)2nρ(S2)e0 = e−2n and ρ(S1)e−n = ρ(U)ρ(S2)e−n = e−2n+1, for every n ∈ N. This ends the proof, as K(1) ⊕ K(2) is the sought copy of the canonical representation of Q2. (cid:3) Theorem 8.4. Every vector state ω ∈ P(O2) associated with either P (1) or P (2) has the unique extension property. If Ω ∈ P(Q2) is Proof. We treat the case of a vector state ωx coming from P (2). any extension of ωx, we can consider its GNS triple (HΩ, πΩ, xΩ). We can then define . K = πΩ(O2)xΩ. By the uniqueness of the GNS triple, we see that O2 acts on K as P (2). But then πΩ must contain a copy of the canonical representation and is in fact the canonical representation by irreducibility. This shows that Ω is a vector state rising from the canonical representation of Q2 associated with a vector x ∈ span{ek : k ≥ 0}, which concludes our proof. (cid:3) Before leaving the section, we would like to point out that the problem of deciding whether a pure state has a unique pure extension has mostly been settled in a context where a maximal abelian subalgebra of a given C ∗-algebra is considered instead of any C ∗-subalgebra. A natural maximal abelian subalgebra of Q2 that immediately springs to mind is of course C ∗(U), not least because the diagonal D2 has already been given a good deal of attention in [Cun80] , where it is looked at in relation to the inclusion in the Cuntz algebra O2. Obviously, the pure states of C ∗(U) are nothing but the evaluations at the points of the spectrum of U, namely the states ωz, z ∈ T, given by . = f (z) for every f ∈ C(T). It might come as a surprise that for some values ωz(f (U)) of z the extension of ωz is unique whereas for others it is not. However, this closely resembles what happens with the inclusion D2 ⊂ O2, [Cun80, Proposition 3.1]. We begin with the following result, which shows that roots of unity of order a power of 2 give rise to as many extensions as possible. Proposition 8.5. If z ∈ T is a root of unity of order 2n, for some n ∈ N, then the pure state ωz has uncountably many pure extensions to Q2. Proof. We start with the case z = 1. As already remarked, in the interval picture U has eigenvalue 1 corresponding to the eigenfunction ψ ∈ L2([0, 1]), which is the function almost everywhere equal to 1. This clearly means that the vector state Ω given by Ω(T ) = (T ψ, ψ), T ∈ Q2, is a pure extension of ω1. Composing Ω with the gauge automorphisms eαw of Q2, that is to say the unique extension to Q2 of αw ∈ Aut(O2), w ∈ T, we obtain an uncountable family of pure states Ω ◦ eαw, w ∈ T, which all Ω ◦eαw(S2) = wΩ(S2) and Ω(S2) is different from zero. We can now move on to the extend ω1 since αw(U) = U for every w ∈ T. Finally, these are all distinct because more general situation in which z is a root of unity of order 2n, for some n ∈ N. In this case there exists a unitary Uz ∈ D2 ⊂ Q2 such that UzUU ∗ z = zU, see [ACR18] for more . details. Therefore, the composition Ω ◦ Ad(Uz) = Ωz is clearly a pure extension of ωz. However, we need to show there are in fact uncountably many extensions of ωz. Again, these can be produced by composing Ωz with the gauge automorphisms eαw, w ∈ T. All is left to do, therefore, is make sure the compositions Ωz ◦eαw are all distinct as w ranges in T. Now the equality Ωz ◦eαw = Ω ◦ Ad(Uz) ◦eαw = Ω ◦eαw ◦ Ad(Uz), where we used PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 27 (cid:3) only when w = w′. the fact that eαw and Ad(Uz) commute as eαw ◦ Ad(Uz) ◦eα−1 w = Ad(eαw(Uz)) = Ad(Uz), shows that Ωz ◦eαw = Ωz ◦eαw′ holds if and only if Ω ◦eαw = Ω ◦eαw′, which is possible At the other extreme, when z is not a root of unity of order (2h − 1)2k, the corre- sponding state ωz has precisely one extension instead. Proposition 8.6. If z ∈ N is not a root of unity of order (2h − 1)2k for any h, k ∈ N, then the pure state ωz has a unique pure extension to Q2. Proof. Let Ωz be an extension of ωz. We want to show that Ωz is completely determined on a dense subset of Q2. Thanks to [ACR18, Prop. 2.3] it is enough to evaluate Ωz on the elements of the form SαS∗ βU h. By using the GNS construction we may suppose that Ωz(T ) = (T v, v), where v is a vector such that Uv = zv. First of all we have that 2 v, while U 2k v = z2k v. Ωz(Sk Under our assumptions z2k 6= z and thus Sk We have that Ωz(Pα) = 2−α. This follows at once from the fact that Pα = U iSα (for a certain i) and thatP2k−1 2)kU −i = 1. Now let h, k ∈ N. For the elements of the form Sh+k 2 v, v) − 2 ) = 0 for all k ∈ N. Indeed, we have U 2k (Sk 2 v and v must be orthogonal. 2 )k we have that 2)kv, v) = (Sk 2)k) = (Sh+k 2)kU −iv, v) 2 Uv = zSk i=0 U iSk 2 v) = Sk Ωz(Sh+k 2 U iSk 2 (S∗ 2 (S∗ (Sh (S∗ (S∗ (S∗ 2 2 2 2 (S∗ 2)αU −i 2k−1Xi=1 2)kv, v) = − ¯zi(Sh 2 Sk 2 (S∗ 2 )kv, U −2hiv) 2k−1Xi=1 2 Sk 2 Sk 2 (S∗ = − = − z2hi−i(Sh ¯zi(U 2hiSh 2k−1Xi=1 2k−1Xi=1 (z2h−1)i = (Sh+k 2)kv, v) 2k−1Xi=0 2)kv, v) 2 (S∗ 2 which leads to (Sh+k 2 (S∗ (S∗ 2 )kv, v) · = 0 1 − z2h2k−2k 1 − z2h−1 (S∗ 2)kv, v) = 0. Under our hypotheses it follows that Ωz(Sh+k From this discussion we get that Ωz(SαS∗ 2 (S∗ 2)k) = (Sh+k 2 βU h) = δα,β2−αzh and we are done. (cid:3) Clearly, the case of a root of unity of order (2h − 1)2k, for some h and k ∈ N, is not covered by the results above, although we would be inclined to believe ωz does have a unique extension if h ≥ 2. However, we plan to return to this problem elsewhere. 9. Extendible quadratic permutation endomorphisms This section aims to intertwine the analysis carried out in [ACR18], where we ad- dressed the problem of extending endomorphisms of O2 to Q2, with the present analy- sis. Although a satisfactory answer to the problem is yet to come and might be elusive to get to, particular classes of automorphisms, such as Bogolubov automorphism and localized diagonal automorphisms, have been examined thoroughly. Given a permuta- tive representation ρ of Q2 and a permutative endomorphism λ of O2, the composition 28 V. AIELLO, R. CONTI, AND S. ROSSI ρ ↾O2 ◦λ is still a permutative representation of O2. Accordingly, one might ask whether it extends. Furthermore, one may want to go so far as to ask that the extension be of the form ρ ◦ λ, where λ is an endomorphism of Q2 that extends λ. In the sequel, we shall be dealing with the case in which ρ = ρc is the canonical representation and λ is a so-called quadratic permutative endomorphism of O2, that is an endomorphism 2 ∼= M4(C). In this case, the extension ρc ◦ λ is induced by a permutation matrix in F 2 automatically permutative when it exists. The quadratic permutative endomorphisms include the canonical endomorphism ϕ of O2 and the flip-flop λf . Both of them extend to Q2, as proved in [ACR18]. More interestingly, this family of endomorphisms offers a bunch of novel examples of endomorphisms that do extend to Q2, although the list of the extendible endomorphisms is still rather limited. It turns out that an effective way to prove that the classes of these endomorphisms are in fact distinct is to resort to permutative representations of Q2. For example, we will show that the representa- tions obtained by composing the canonical representation with two of the above new endomorphisms are inequivalent. We adopt the same notation as in [CS09], where the monomial sisjs∗ k is denoted by sij,k. The following table displays not only the definitions of the endomorphisms we are going to consider but also says in advance which ones extend and which ones do not extend. ρσ(s2) Extendible? ρσ ρid = id ρ12 ρ13 ρ14 ρ23(= ϕ) ρ24 ρ34 ρ123 ρ132 ρ124 ρ142 ρ134(≃ ρ142) ρ143 ρ234 ρ243(≃ ρ123) ρ1234(≃ ρ24) ρ1243 ρ1324(≃ ρ12) ρ1342 ρ1423(≃ ρ34) ρ1432(≃ ρ13) ρ(12)(34)(≃ ρ(13)(24)) ρ(13)(24) = λf ρ(14)(23)(≃ id) ρσ(s1) s1 s12,1 + s11,2 s21,1 + s12,2 s22,1 + s12,2 s11,1 + s21,2 s11,1 + s22,2 s1 s12,1 + s21,2 s21,1 + s11,2 s12,1 + s22,2 s22,1 + s11,2 s21,1 + s12,2 s22,1 + s12,2 s11,1 + s21,2 s11,1 + s22,2 s12,1 + s21,2 s12,1 + s22,2 s2 s21,1 + s11,2 s22,1 + s21,2 s22,1 + s11,2 s12,1 + s11,2 s2 s2 s2 s11,1 + s22,2 s21,1 + s11,2 s12,1 + s22,2 s21,1 + s12,2 s22,1 + s21,2 s11,1 + s22,2 s12,1 + s22,2 s21,1 + s11,2 s21,1 + s12,2 s22,1 + s11,2 s11,1 + s21,2 s22,1 + s12,2 s12,1 + s21,2 s22,1 + s11,2 s11,1 + s21,2 s12,1 + s11,2 s22,1 + s12,2 s1 s12,1 + s21,2 s22,1 + s21,2 s1 s22,1 + s21,2 s12,1 + s11,2 Yes No No Yes Yes No No Yes No No No No No No Yes No Yes No Yes No No Yes Yes Yes ρσ(u) u u−2 u2 u2s2s∗ 2 + u−2s1s∗ 1 u−2s2s∗ 2 + u2s1s∗ 1 u−2 u2 f u∗f u∗ f uf We start with ρ12. Note that ρ12(S1) = S1f , where f = S1S∗ 2 + S2S∗ observation will be crucial in the proof of the following result. 1 ∈ U(O2). This PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 29 Proposition 9.1. The endomorphism ρ12 does not extend. Proof. First of all we identify Q2 with the image of the canonical representation ρc : Q2 → B(ℓ2(Z)). We set Si = ρ12(Si) and we denote by U the element in B(ℓ2(Z)) that extends the representation ρc ◦ ρ12. It is easy to see that if ρ12 is extendible, then the extension is unique. This implies that U ∈ QT 1 for all k ∈ N, we have that 2 . Since Sk 2 U = U Sk U = U (S1f )k = U S1Sk−1 Sk 2 2 )k U USk 2 f . From [ACR18, Proposition 3.18] we know that the following f = U USk 2 f 2 and thus U = (S∗ limit exists lim k (S∗ 2)k UUSk 2 = c U U ∈ T Therefore, we have U = c U U f . It is easy to see that this unitary does not satisfy the defining relations of Q2. (cid:3) Proposition 9.2. The endomorphisms ρ34, ρ1324 and ρ1423 do not extend. Proof. As for the first, it is enough to rewrite it as ρ34 = λf ◦ ρ12 ◦ λf , whereas the last two are unitarily equivalent to ρ12 and ρ34 respectively, as pointed out in [CS09]. (cid:3) Proposition 9.3. The endomorphism ρ13 does not extend. . = S2 Proof. By definition ρ13(S1) 2. It is now a matter of straightforward computations that, in the canonical representation, the point spectrum of ρ13(S1) is empty whereas that of ρ13(S2) is not, since it is the set {1} with ker(ρ13(S2) − I) = span{e−1, e0}. (cid:3) Proposition 9.4. None of the endomorphisms ρ1432, ρ24, and ρ1234, extend. . = S2S1S∗ 1 + S1S2S∗ 2, ρ13(S2) 2S∗ 1S∗ 1 + S2 Proof. The first is unitarily equivalent to ρ13, see [CS09]. The second may be rewritten as ρ24 = λf ◦ ρ13 ◦ λf . Finally, ρ1234 does not extend, since it is unitarily equivalent to ρ24. (cid:3) Proposition 9.5. None of endomorphisms ρ132, ρ234, ρ124 and ρ143 extend. . = S2S1S∗ Proof. By definition ρ132(S1) 2. The conclusion is immediately arrived at by noting that ker(ρ132(S2) − I) = span{e0, e1} whilst ker(ρ132(S1) − I) = {0}. The endomorphism ρ234 is not extendible because ρ132 = λf ◦ ρ234 ◦ λf . Finally, being ρ124 = λf ◦ ρ234 and ρ143 = ρ124 ◦ λf , ρ124 and ρ143 are not extendible either. (cid:3) 2, ρ132(S2) 1 + S2 2S∗ 1 + S2 1 S∗ . = S1S2S∗ The next proposition recalls those endomorphisms that we already know do extend, without us needing to give any explanation, since the missing details are to be found in [ACR18]. Proposition 9.6. The automorphisms ρ(13)(24) = λf , ρ(14)(23) = Ad(f ), ρ(12)(34) = Ad(f ) ◦ λf all extend, as does the canonical endomorphism ϕ = ρ23. Moreover, they send U to U ∗, f Uf , f U ∗f and U 2, respectively. We can now move on to discuss the novel examples of extendible endomorphisms. We start with ρ123 and ρ243. 30 V. AIELLO, R. CONTI, AND S. ROSSI 1 + S2S1S∗ 2 2 + U 2S1S∗ 1 . . = S1 and ρ123(S2) 1 and ρ243(U) = U −2S2S∗ Proposition 9.7. Both ρ123 and ρ243 uniquely extend. Moreover, ρ123(U) = U 2S2S∗ U −2S1S∗ . Proof. Since ρ243 = ρ123◦λf , it is enough to deal only with ρ123. By definition ρ123(S1) = . S1S2S∗ = U 2S2S∗ 2 + 1. All we have to do is make sure the two equalities U S2 = S1 and S2 U = U S1 are U −2S1S∗ satisfied. Now this is a matter of easy but tedious computations. Finally, the uniqueness of the extension is proved once a representation ρ of Q2 is exhibited in which either S1 or S2 is pure. For instance, the interval picture is an example of such a representation. (cid:3) The endomorphism ρ14 extends as well. This is the content of the following proposi- . = S2. We define U 1 + S2 . = S2 1 S∗ 2S∗ 2 2 + tion, which is proved in full detail instead. Proposition 9.8. The endomorphism ρ14 is extendible. Moreover, its unique extension is determined by ρ14(U) Proof. Set S1 = ρ14(S1) = S2 We recall that U −2SiS∗ 1 + S1S2S∗ i U −2 for i = 1, 2. We have that 2 , S2 = ρ14(S2) = S2S1S∗ 2, and U = U −2. . = U −2. 1 + S2 1S∗ 2S∗ i = SiS∗ U S2 = U −2S2S1S∗ 1 + U −2S2 1S∗ 2 1 + U −2US2US2S∗ 2 1 + U −2UU 2S2S2S∗ 2 = U −2S2US2S∗ = U −2U 2S2S2S∗ = S2 2 S∗ 1 + US2 2 1 + S1S2S∗ = S2 2S∗ 2S∗ 2 = S1 and S2 U = S2S1S∗ 1 U −2 + S2 1S∗ 2U −2 1 + S1US2S∗ 2U −2 = S2U −2S1S∗ = S2U −2US2S∗ = S2U ∗S2S∗ = U −2S2S2S∗ = U −2 S1 . 1 + S1UU −2S2S∗ 2 1 + S1U ∗S2S∗ 2 1 + U −2S1S2S∗ 2 1 (S∗ 1 (S∗ 2 ( S∗ 1 )kS∗ 2 + Sk+1 2)k is 2−k. 2 )k = S2Sk Therefore, by universality an extension exists. In order to prove that the extension is unique, it is enough to exhibit a representation ρ of Q2 such that ρ( S2) is pure. First of all, we note that Sk 1)k+1 for all k ≥ 1. Now the claim follows at once by using the interval picture and the fact the evaluation of F2-trace on Sk 2 ( S∗ (cid:3) Proposition 9.9. The endomorphisms ρ1243 and ρ1342 both extend, mapping U into U −2 and U 2, respectively. Proof. Both ρ1243 and ρ1342 commute with the flip-flop. More precisely, we have λf ◦ ρ1243 = ρ1243 ◦ λf = ρ23 and λf ◦ ρ1342 = ρ1342 ◦ λf = ρ14. (cid:3) . = ρc ◦ ρ1243 are Proposition 9.10. The representations π1 both permutative and equivalent to ρc ⊕ ρc. . = ρc ◦ ρ23 = ρc ◦ ϕ and π2 PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 31 Proof. Thanks to the previous result, it is enough to prove the statement for π1. We recall that ρ23 is the canonical endomorphism, that is ρ23(x) = S1xS∗ 2 . Simple computations lead to these formulas 1 + S2xS∗ π1(S2)e2k = e4k π1(S2)e2k+1 = e4k+1 π1(S1)e2k = e4k+2 π1(S1)e2k+1 = e4k+3 . In particular, we find the equalities π1(S1)e−1 = e−1, π1(S2)e0 = e0, π1(S1)e−2 = e−2, π1(S2)e1 = e1. Therefore, the claim follows once we realize that the direct sum π1(O2)e−1 ⊕ π1(O2)e−1 ⊕ π1(O2)e0 ⊕ π1(O2)e−2 is the whole ℓ2(Z). (cid:3) . . = ρc ◦ ρ1342 are both = ρc ◦ ρ14 and π2 Proposition 9.11. The representations π1 permutative and equivalent to P (11)⊕ P (22). In particular, ρ14 cannot be obtained from ϕ = ρ23 by composing with inner automorphisms and the flip-flop. Proof. It is enough to prove the statement for π1. We have that π1(S2)e2k = e4k+3 π1(S2)e2k+1 = e4k+2 π1(S1)e2k = e4k+1 π1(S1)e2k+1 = e4k . 2 )e−1 = π1(S2)e−2 = e−1 and π1(S2 It follows that π1(S2 1)e0 = π1(S1)e1 = e0. Simple computations show that {ek : k ≤ −1} ⊂ π1(O2)e−1 and {ek : k ≥ 0} ⊂ π1(O2)e0. Now the last claim follows at once from the decomposition of ρc ◦ ρ23 shown in the previous proposition, and the fact that P (11) ⊕ P (22) is not regular, see Proposition 7.10. (cid:3) To complete our analysis, all is left to do is deal with the endomorphisms ρ134 and ρ142, which are defined by these formulas ρ134(S1) = S2S1S∗ ρ134(S2) = S2 ρ142(S1) = S2 ρ142(S2) = S2S1S∗ 2S∗ 2S∗ 1 + S2 1 + S2 1 S∗ 2 1 S∗ 2 1 + S1S2S∗ 2 1 + S1S2S∗ 2 Proposition 9.12. The endomorphisms ρ134 and ρ142 are not extendible. It is known that ρ134 ≃ ρ142, so it is enough to prove that ρ134 does not extend. The proof employs a strategy similar to the one used in [ACR18] to determine the extendible Bogolubov automorphisms, but the argument is actually more complicated and quite long. For the sake of clarity, our proof is thus divided into a series of preliminary lemmas. As usual we identify Q2 with its image in the canonical representation. 32 V. AIELLO, R. CONTI, AND S. ROSSI Lemma 9.13. In the canonical representation we have that ρ134(S1)e2k = e4k+1 ρ134(S1)e2k+1 = e4k+2 ρ134(S2)e2k = e4k+3 ρ134(S2)e2k+1 = e4k In particular, the two isometries ρ134(S1) and ρ134(S2) are pure. Lemma 9.14. If ρ134 is extendible, then the extension is unique. Moreover, in this case ρ134(U) ∈ QT 2 . Proof. The first part is an immediate consequence of the pureness of ρ134(S1) and ρ134(S2) in the canonical representation. The second part can be proved with the same strategy used in [ACR18, Lemma 4.10]. (cid:3) Lemma 9.15. If ρ134 is extendible, we have that ρ134(U)S2 2 (S∗ 2)2 = U 2S2 2(S∗ 2)2, ρ134(U)S2 1 (S∗ 1)2 = U −2S2 1 (S∗ 1)2 . Proof. By evaluating the equality ρ134(U)ρ134(S2) = ρ134(S1) at e2k and e2k+1 we get that ρ134(U)e4k = e4k+2 and ρ134(U)e4k+3 = e4k+1. Now the claim follows. (cid:3) Lemma 9.16. We have that ρ134(S1)2k = S2k ρ134(S2)2k = S2k 1 = S2(S1S2)kS∗ 2 = S2(S2S1)kS∗ 2 + S1(S2S1)kS∗ 1 2 + S1(S1S2)kS∗ 1 Proof. These equalities can be proved by induction. When k = 1, we have that ρ134(S1)2 = (S2S1S∗ 1 + S1S2S∗ 2)(S2S1S∗ 1 + S1S2S∗ 2) and = S2(S1S2)S∗ 2 + S1(S2S1)S∗ 1 ρ142(S2)2 = (S2 2S∗ 1 + S2 = S2(S2S1)S∗ 2S∗ 2)(S2 1 + S2 1 S∗ 1S∗ 2 ) 2 + S1(S1S2)S∗ 1 . Supposing that the formulas hold for k, we now prove that they are true for k + 1 too. We have that ρ134(S1)2(k+1) = ρ134(S1)2kρ134(S1)2 = (S2(S1S2)kS∗ = S2(S1S2)+1kS∗ 2 + S1(S2S1)k+1S∗ 1 2 + S1(S2S1)kS∗ 1)(S2(S1S2)S∗ 2 + S1(S2S1)S∗ 1) and ρ134(S2)2(k+1) = ρ134(S2)2kρ134(S2)2 = (S2(S2S1)kS∗ = S2(S2S1)k+1S∗ 2 + S1(S1S2)kS∗ 2 + S1(S1S2)k+1S∗ 1 1)(S2(S2S1)S∗ 2 + S1(S1S2)S∗ 1) (cid:3) PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 33 By using the defining relations of U and S2 we see that USk 1 = Sk 2 U. This leads to ( S∗ 2)2k U S2k 1 = (S2(S2S1)kS∗ 2 + S1(S1S2)kS∗ 2)kS∗ 2 + S1(S∗ 1)kS∗ U S2(S1S2)k]S∗ 2)kS∗ 2 U S2(S1S2)k]S∗ 1)kS∗ 1 = (S2(S∗ = S2[(S∗ + S1[(S∗ 1S∗ 1S∗ 2S∗ 1 )∗ U (S2(S1S2)kS∗ 2 + S1(S2S1)kS∗ 1) 1) U(S2(S1S2)kS∗ 2 + S1(S2S1)kS∗ 1 ) U S1(S2S1)k]S∗ 2)kS∗ 2 + S2[(S∗ 2 1 U S1(S2S1)k]S∗ 1)kS∗ 2 + S1[(S∗ 1 1S∗ 2S∗ 2S∗ 1 = U . If we set Ak Bk Ck Dk . = (S∗ . = (S∗ . = (S∗ . = (S∗ 1S∗ 1S∗ 2S∗ 2S∗ 2 )kS∗ 2 2 )kS∗ 2 1)kS∗ 1 1 )kS∗ 1 US2(S1S2)k U S1(S2S1)k U S2(S1S2)k U S1(S2S1)k we see that the sequence zk that Ak, Bk, Ck, Dk ∈ QT obtained by multiplying zk on the left by S∗ and j. 1 tends to U. Note 2 . The following result is an easy but useful fact which can be i and on the right by Sj for appropriate i 2 + S1DkS∗ 2 + S2BkS∗ 1 + S1CkS∗ . = S2AkS∗ Lemma 9.17. The sequences Ak, Bk, Ck, and Dk are convergent and the limits belong to QT 2 . 2 , i1, j1, i2, j2 ∈ {1, 2}, i1 6= j1, i2 6= j2, then (S∗ . = span{SαSβU h α = β = k, h ∈ Z}. j1)kx(Si2Sj2)k ∈ i1S∗ As in [ACR18, Section 3.3, p. 62] we set Bk 2 Lemma 9.18. If x ∈ Bk C[U]. Lemma 9.19. (cf. that the sequence (S∗ [ACR18, Lemma 4.12, p. 70]) Let x ∈ QT i1S∗ j1)kx(Si2Sj2)k converges to an element z. Then z ∈ C ∗(U). 2 , i1 6= j1, i2 6= j2 such Proof. Let {yk}k≥0 be a sequence such that yk ∈ Bk thesis follows from the inequality 2 and yk → x normwise. Then the kz − (S∗ i1S∗ j1)kyk(Si2Sj2)kk ≤ kz − (S∗ i1S∗ j1)kx(Si2Sj2)kk + k(S∗ i1S∗ j1)k(x − yk)(Si2Sj2)kk . (cid:3) By an immediate application of the previous lemma we get the following result. Lemma 9.20. We have that lim k Ak = f1(U) , lim k Bk = f2(U) , lim k Ck = f3(U) , lim k Dk = f4(U) where f1, f2, f3, f4 ∈ C(T). 34 V. AIELLO, R. CONTI, AND S. ROSSI This shows that, if ρ134 is extendible, then ρ143(U) has the following form ρ143(U) = lim k S2AkS∗ 1 + S1CkS∗ 2 + S1DkS∗ 1 2 + S2BkS∗ 2 + S2f2(U)S∗ 2 + f2(U 2)S2S∗ 2 + S1f4(U)S∗ 1 1 + S1f3(U)S∗ = S2f1(U)S∗ = f1(U 2)S2S∗ = (f1(U 2) + f3(U 2)U)P2 + (f2(U 2)U ∗ + f4(U 2))P1 = (f1(U 2) + f3(U 2)U)P22 + (f1(U 2) + f3(U 2)U)P21 + (f2(U 2)U ∗ + f4(U 2))P11 + (f2(U 2)U ∗ + f4(U 2))P12 1 + f3(U 2)S1S∗ 2 + f4(U 2)S1S∗ 1 By Lemma 9.15 we also know that U = U 2P22 + U −2P11 + U P21 + U P12. If we evaluate these two identities (in the canonical representation) on the vectors e4 = P22e4 and e7 = P11e7 we get (f1(U 2) + f3(U 2)U)e4 = U 2e4 (f2(U 2)U ∗ + f4(U 2))e7 = U −2e7 . The vectors of the canonical basis are separating vectors for C ∗(U) and this implies that f1(z2) + f3(z2)z = z2 f2(z2)z∗ + f4(z2) = ¯z2 . These equations immediately imply that f2(z) = f3(z) = 0 (it is enough to notice i=1 and z±2 are even), which in turn implies that f1(z) = z, that the functions {fi(z2)}4 f4(z) = ¯z. Therefore, we have that U = U 2P2 + U −2P1. However, by using the canonical representation it is easy to see that this operator does not verify the defining relations, as it does satisfy U S2 = S1 but it does not satisfy U S1 = S2 U. References [ACR18] Valeriano Aiello, Roberto Conti, and Stefano Rossi, A look at the inner structure of the 2-adic ring C ∗-algebra and its automorphism groups, Publ. Res. Inst. Math. Sci. 54 (2018), 45–87. , Diagonal automorphisms of the 2-adic ring C ∗-algebra, Q. J. Math. preprint, [ACR] arxiv:1701.04033. [ACRS] Valeriano Aiello, Roberto Conti, Stefano Rossi, and Nicolai Stammeier, Inner structure of boundary quotients of right LCM semigroups. preprint, arxiv:1709.08839. [AP09] Sergio Albeverio and Anna Maria Paolucci, Radial multiresolution, Cuntz algebras represen- tations and an application to fractals, Complex Anal. Oper. Theory 3 (2009), no. 1, 1–18, DOI 10.1007/s11785-008-0063-0. [BJ97] Ola Bratteli and Palle E.T. Jorgensen, Isometries, shifts, Cuntz algebras and multiresolution wavelet analysis of scale N , Integral Equations Operator Theory 28 (1997), no. 4, 382–443, DOI 10.1007/BF01309155. [BJ99] , Iterated function systems and permutation representations of the Cuntz algebra, Memoirs Amer. Math. Soc. 663 (1999). [CS09] Roberto Conti and Wojciech Szyma´nski, Computing the Jones index of quadratic permutation [Cun80] Joachim Cuntz, Automorphisms of certain simple C∗-algebras, Quantum fields-algebras- endomorphisms of O2, J. Math. Phys. 50 (2009), no. 1, 012705. processes, ed. L. Streit, Springer, 1980. [Dav96] Kenneth R. Davidson, C ∗-Algebras by Examples, Fields Institute Monographs, AMS, 1996. [DP99] Kenneth R. Davidson and David R. Pitts, Invariant subspaces and hyper-reflexivity for free semigroup algebras, Proc. London Math. Soc. 178 (1999), no. 2, 401–430. PERMUTATIVE REPRESENTATIONS OF THE 2-ADIC RING C ∗-ALGEBRA 35 [DHJ15] Dorin Ervin Dutkay, John Haussermann, and Palle E. T. Jorgensen, Atomic repre- sentations of Cuntz algebras, J. Math. Anal. Appl. 421 (2015), no. 1, 215–243, DOI 10.1016/j.jmaa.2014.07.005. [DJ11] Dorin Ervin Dutkay and Palle E. T. Jorgensen, Affine fractals as boundaries and their har- monic analysis, Proc. Amer. Math. Soc. 139 (2011), no. 9, 3291–3305, DOI 10.1090/S0002- 9939-2011-10752-4. [DJ12] , Spectral measures and Cuntz algebras, Math. Comp. 81 (2012), no. 280, 2275–2301, DOI 10.1090/S0025-5718-2012-02589-0. [DJ14] , Monic representations of the Cuntz algebra and Markov measures, J. Funct. Anal. 267 (2014), no. 4, 1011–1034, DOI 10.1016/j.jfa.2014.05.016. [DPS14] Dorin Ervin Dutkay, Gabriel Picioroaga, and Myung-Sin Song, Orthonormal bases gen- erated by Cuntz algebras, J. Math. Anal. Appl. 409 (2014), no. 2, 1128–1139, DOI 10.1016/j.jmaa.2013.07.012. [Jor99] Palle E. T. Jorgensen, Harmonic analysis of fractal processes via C ∗-algebras, Math. Nachr. 200 (1999), 77–117, DOI 10.1002/mana.19992000105. [Jor06] , Analysis and probability: wavelets, signals, fractals, Graduate Texts in Mathematics, vol. 234, Springer, New York, 2006. [KW05] Tsuyoshi Kajiwara and Yasuo Watatani, C ∗-algebras associated with complex dynamical sys- tems, Indiana Univ. Math. J. 54 (2005), no. 3, 755–778, DOI 10.1512/iumj.2005.54.2530. [KW06] , C ∗-algebras associated with self-similar sets, J. Operator Theory 56 (2006), no. 2, 225–247. [Kaw06] Katsunori Kawamura, Branching Laws for Polynomial Endomorphisms of Cuntz Algebras Arising from Permutations, Lett. Math. Phys. 77 (2006), 111–126. [LL12] Nadia S. Larsen and Xin Li, The 2-adic ring C ∗-algebra of the integers and its representations, J. Funct. Anal. 262 (2012), no. 4, 1392–1426. [MP11] Matilde Marcolli and Anna Maria Paolucci, Cuntz-Krieger algebras and wavelets on fractals, Complex Anal. Oper. Theory 5 (2011), no. 1, 41–81, DOI 10.1007/s11785-009-0044-y. [MSW07] Makoto Mori, Osamu Suzuki, and Yasuo Watatani, Representations of Cuntz algebras on fractal sets, Kyushu J. Math. 61 (2007), no. 2, 443–456, DOI 10.2206/kyushujm.61.443. [Nek04] Volodymyr V. Nekrashevych, Cuntz-Pimsner algebras of group actions, J. Operator Theory 52 (2004), no. 2, 223–249. [Tho17] Klaus Thomsen, Phase transition in O2, Comm. Math. Phys. 349 (2017), no. 2, 481–492, DOI 10.1007/s00220-016-2742-4. Department of Mathematics, Vanderbilt University, USA E-mail address: [email protected] Dipartimento di Scienze di Base e Applicate per l'Ingegneria, Sapienza Universit`a di Roma, Italy E-mail address: [email protected] Dipartimento di Matematica, Universit`a di Roma Tor Vergata, Italy E-mail address: [email protected]
1612.04371
1
1612
2016-12-13T18:44:04
On some topics of analysis on noncommutative spaces
[ "math.OA", "math.AP" ]
We consider a conservative Markov semigroup on a semi-finite $W^*$-algebra. It is known that under some reasonable assumptions it is enough to determine a kind of differential structure on such a 'noncommutative space'. We construct an analogue of a Riemannian metric in this setting, formulate a Poincar\'e-type inequality, provide existence and uniqueness results for quasi-linear elliptic and parabolic PDEs defined in terms of the constructed noncommutative calculus.
math.OA
math
ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES DANILA ZAEV Abstract. We consider a conservative Markov semigroup on a semi-finite W ∗-algebra. It is known that under some reasonable assumptions it is enough to determine a kind of differen- tial structure on such a "noncommutative space". We construct an analogue of a Riemannian metric in this setting, formulate a Poincar´e-type inequality, provide existence and unique- ness results for quasi-linear elliptic and parabolic PDEs defined in terms of the constructed noncommutative calculus. Contents Introduction 1. 2. An introduction to noncommutative analysis 3. Preliminaries: C ∗- and W ∗-algebras, L2-spaces 4. Preliminaries: Semigroups and Markovianity 5. Regularity and differential calculus 5.1. Examples of noncommutative differential calculi 6. Carr´e du Champ form 7. Riemannian metric 8. Poincar´e inequality 9. Quasilinear elliptic equations 10. Linear evolution equations References 1 3 5 7 10 12 12 14 16 17 20 22 1. Introduction The main goal of this paper is to establish a framework for the analysis of PDEs in a noncommutative setting. As was shown by J.-L. Sauvageout and F. Cipriani in [7], one can start with a Markov semigroup on a C ∗-algebra and construct in a natural way a noncommutative version of differential calculus, including square-integrable vector fields, gradient and divergence operators. In commutative case this construction corresponds to some kind of (possibly) non- local analysis, described e.g. in [18]. In finite-dimensional noncommutative situation it was considered by M.A. Rieffel in [25]. "What is a continuous function? It is an element of a commutative C ∗-algebra". This is the expression of the idea of the noncommutative analysis approach. Instead of characterizing an object itself, one provides a definition for the algebraic structure of the space of these objects. Date: November 21, 2018. Supported in part by the Simons Foundation. 1 2 DANILA ZAEV It is well-known that C ∗-algebras encode continuous functions (and their noncommutative operator-like analogues) and therefore, by duality, (nice enough) topological spaces; W ∗- (or von Neumann) algebras encode bounded measurable functions/operators. It is also possible to define unbounded measurable objects (operators or functions) in the similar manner, spaces of Lp- (p-absolutely integrable) objects and so on. The starting point of this paper is the following fascinating fact: it is possible to define abstractly a kind of Sobolev W 1,2-space (space of square integrable functions with square in- tegrable weak differential), which is called a Dirichlet space. In the following we show that a commutative C ∗- (or W ∗-) algebra in a pair with an appropriately defined Dirichlet space acts like a generalized "Riemannian manifold", which has a Sobolev (instead of a differen- tiable one) tangent bundle and a measurable measure-valued "metric tensor" defined on it. Moreover, being defined in the "functional analytic" way, it can be easily generalized to the noncommutative setting, leading to a beautiful unification of different mathematical concepts. Our novelty here is a construction of an analogue of a Riemannian metric in the setting of C ∗-Dirichlet forms. In fact, this concept fills the gap in the informal table of (determining one another) structures below: is scalar-valued defined on functions Dirichlet form defined on sections is measure-valued Carr´e du Champ form Symmetric differential calculus place for a "Riemannian metric" Then we formulate a Poincar´e-type inequality in the form appropriate to our goals. With its help we provide existence and uniqueness results for quasi-linear elliptic and some parabolic PDEs defined in terms of the constructed noncommutative calculus. In particular, we formulate a definition of continuity equation on a noncommutative space and deduce an existence result from the general theory of linear evolution PDEs. The paper is organized as follows. In Section 2 we review the current state of the area of our interest. Then, in preliminary Section 3 we describe some basic facts about C ∗- and W ∗-algebras, weights and traces on them, and the construction of corresponding L2-spaces. We restrict ourselves by considering only tracial case, though not necessarily finite. Note, that necessity for existence of a faithful normal semi-finite trace, that will be assumed throughout the paper, restricts us to the world of semi-finite W ∗-algebras. In Section 4 we introduce the notions of Markov map, C0-semigroup of Markov operators, its generator, and the key notion of Dirichlet form. The material is not new and rather standard, but our goal is to describe it for a reader not familiar with noncommutative geometry nor operator algebras. Sections 5 and 6 are dedicated to the construction of noncommutative differential calculus associated with a Dirichlet form and, hence, with a Markov semigroup. In Section 7 we describe our construction of noncommutative "Riemannian metric". In general it takes values in the Banach dual of the underlying C ∗-algebra. In the case of smooth Riemannian manifold it reduces to a measurable L1-valued bilinear form of L2-sections of the tangent bundle and extends the Riemannian metric tensor defined in the usual sense. In Section 8 we provide a definition of Poincar´e-like inequality, which differs from the usual one, but is appropriate for our following study of elliptic PDEs. We consider an example of noncommutative 2-torus equipped with the canonical Dirichlet form and come to a conclusion that it satisfies our version of the inequality. ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 3 In Section 9 we define and study linear and quasilinear elliptic PDEs. We mostly follow a standard approach involving Galerkin approximation and Browder-Minty monotonicity trick. Under the standard assumptions this technique allows us to prove existence and uniqueness results of weak solutions. Finally, in Section 10 we add time axis in our setting and consider parabolic PDEs. In particular, we show that it is possible to give a meaningful formulation of a continuity equation on noncommutative space and provide an existence result for its weak solution. 2. An introduction to noncommutative analysis There are basically two general approaches to noncommutative analysis. The first one generalizes abstract measure theory, and its starting point is a noncommutative analogue of L∞-space, that is a W ∗-algebra (it is also called von Neumann algebra, but usually a von Neumann algebra means a W ∗-algebra with a fixed Hilbert space representation). Following this approach one defines an L1-space as a Banach predual of a given W ∗-algebra and construct other Lp-spaces using a kind of Banach space interpolation theory. A good reference for that is Section 1 of [29]. The second approach generalizes topology, and its starting point is a C ∗-algebra, which is in the commutative case appears to be isomorphic (via a kind of Gelfand duality) to the algebra of all continuous functions vanishing at infinity on some locally compact space. As in the commutative case, given a C ∗-algebra and an appropriate analogue of a "reference measure", one can construct all the Lp-spaces, p ∈ [1, +∞]. They share many properties with their classic counterparts, e.g. Holder and Minkowski inequalities. This construction is described, for example, in Section 2 of [1]. One can generalize the notion of finite measure considering a positive linear functional on a C ∗-algebra (in a commutative case it corresponds to integration). If this functional has a unit norm, it is called a state. Thus, states are elements of the positive part of a unit sphere in the Banach dual of a C ∗-algebra. On W ∗-algebras, which are analogues of L∞-spaces, one is usually interested in normal states, which are elements of the space L1 (which is the Banach predual of L∞). Equivalently, normal states are weak∗-continuous states. The generalization of the notion of non-necessarily finite measure is called a weight. It is defined as an unbounded positive linear functional, which is lower semi-continuous and has a dense domain of definition. For the rigorous definition see, for example, Subsection 2.2. of [23] or Section 4 of this paper. A faithful weight (state) is such a functional, that the only positive element in its kernel is zero. In the case of commutative C ∗-algebras, faithful states correspond to Borel probability measures that have full domain. It is natural to choose a "reference" weight (state) to be faithful. The basic dictionary between commutative and noncommutative notions appears to be as follows: Noncommutative Commutative Algebra of continuous functions C ∗-algebra W ∗-algebra Algebra L∞ Weight on C ∗-algebra Borel measure Probability measure State and, as we see later, it can be continued in various directions. 4 DANILA ZAEV An important property of a weight is the trace property: τ (a · b) = τ (b · a), ∀a, b ∈ A+ (actually, trace of a matrix is a functional of this type on a matrix algebra). If our reference weight has this property, the consequent "analysis" is significantly simplified: we are still not too far from commutative world. In the constructions of Lp-spaces, described in [1] and [29], it is assumed that the reference weight has the trace property. For the construction of Lp-spaces in the case without this assumption, see Subsection 5 of [23]. Dirichlet forms in noncommutative setting were originally defined by Albeverio and Hoegh- Krohn in [1]. They started with a C ∗-algebra and a faithful trace defined on it. Then they consider a quadratic form on a dense domain of the associated L2-space (more precisely, the domain is dense in the "real" part of the L2-space). If a quadratic form is positive, closed, densely-defined, and has a quadratic Lipschitz contraction property: E(f (a)) ≤ kf k2 Lip0 · E(a), ∀f ∈ Lip0(R), a ∈ D(E), it is called a Dirichlet form. If this form is agree with the original C ∗-algebra in the sense that the intersection of the algebra with the domain of a form appears to be a form core dense in the algebra, it is called regular. Dirichlet forms are in one-to- one correspondence with symmetric completely Markov C0-semigroups on L2 (Th. 2.7, 2.8 of [1]). In addition, the notion of completely Dirichlet form and the corresponding notion of completely Markov semigroup were introduced in Section 3 of [1]. These notions make sense only in noncommutative context. Theorem 3.2 of [1] establishes a characterization of completely Dirichlet forms, which may serve as a technical tool for the study of forms with this property. The research of this topic was continued by B. Davies and M. Lindsay, see [12]. In particular, they proved an important technical result: the intersection of the domain of a completely Dirichlet form with the original C ∗-algebra is an involutive dense subalgebra. Based on the definitions introduced in [1], Sauvageout and Cipriani in the series of papers ([4], [5], [6], [7], [8], [9], [10], e.t.c.) made a huge breakthrough in the theory and established a bunch of new results. A short overview of their achievements is available in the form of slides (see [6] and [28]). Let us mention a few directions in the contemporary research. • Construction of a noncommutative calculus associated to a Dirichlet form. The main paper devoted to this topic is [7]. The main result there is an explicit construction of a "tangent" Hilbert bimodule, which is an analogue of the module of all L2-integrable sections of the tangent bundle of a manifold. It was shown, that there exists a linear map from the domain of the form into this bimodule that satisfies Leibniz property and appears to be an analogue of a "gradient" map. Such objects, like Dirichlet forms themselves, their associated Carr´e du Champ operators Γ, and infinitesimal generators of the corresponding Markov semigroups can be expressed via the "gradient" derivation into the "tangent" bimodule. • Noncommutative potential theory. It includes the notions of Carr´e du Champ oper- ators, finite-energy functionals, potentials, and multipliers of Dirichlet spaces appro- priate to the noncommutative context. Under the assumption of trace property of the "reference" weight this theory was described in [10]. An approach without this assumption was also developed: see [11] for the original description of the results and Sections 2 and 3 in [6] for a comprehensive review of the topic. ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 5 • Application to self-similar structures. Using the results about the existence of a "tan- gent" Hilbert bimodule associated to a Dirichlet form, it is possible to construct a potential theory of fractal spaces. The one paper devoted to this direction of research is [5]. See also the works of M. Hinz and A. Teplyaev (e.g. [17], [19]). 3. Preliminaries: C ∗- and W ∗-algebras, L2-spaces Definition 3.1 (C ∗-algebra). (1) An algebra A is called Banach algebra over field F iff it is a Banach space over F such that ka · bk ≤ kak · kbk. (2) An associative Banach algebra A over C is involutive Banach algebra iff it is equipped with operation ∗ : A → A, such that for all a, b ∈ A, t ∈ C (a) (a∗)∗ = a, (b) (ab)∗ = a∗b∗, (c) (ta + b)∗ = ta + b, (d) kak = ka∗k. (3) An involutive Banach algebra A is a C ∗-algebra iff kaa∗k = kak2 for any a ∈ A. If A is a unital algebra, the last property is equivalent to the following: where spec(a) is the spectrum of a: kak = sup{α : α ∈ spec(a)}, spec(a) := {z ∈ C : ∄b ∈ A s.t. (a − z · 1A)b = b(a − z · 1A) = 1A}. The spectrum of any element is a compact nonempty subset of the complex plane. An element a ∈ A is called positive iff ∃b ∈ A s.t. a = b∗b. Equivalently, it is an element with a nonnegative real spectrum. We denote the set of all positive elements in A as A+. Any C ∗-algebra is naturally equipped with the following order: a ≥ b ⇐⇒ a − b is positive. An a ∈ A is self-adjoint iff a = a∗, or, equivalently, a has a real spectrum. The set of all self-adjoint elements is denoted by As.a.. In general case As.a. is not closed under the inherited algebraic operation, but appears to be a Banach space over R. Any positive element is automatically self-adjoint: a = b∗b = (b∗b)∗ = a∗. For any positive element a ∈ A+ define its square root a 2 as a positive element a 1 2 ∈ A+, 2 ∈ A+. It is such that (a clear, that kak = kak. For a self-adjoint element a ∈ As.a., the element a − a is in A+. This fact allows the following decomposition 2 )2 = a. The modulus of an element a ∈ A is defined as a := (a∗a) 1 1 1 a = a+ − a−, ∀a ∈ As.a., a+ := a, a− := a − a, a+, a− ∈ A+. (1) Definition 3.2 (W ∗-algebra). A C ∗-algebra N is a W ∗-algebra iff it has a Banach predual space N∗. It is known that any W ∗-algebra has a unique Banach predual. Thus, along with the C ∗-norm topology any W ∗-algebra carry the natural weak∗-topology. Here is the essential dif- ference between topology and measure theory: the first is the world of the norm ("supremum") topology, and the second is the world of the weak∗-one. There is a set of representation results for C ∗- and W ∗-algebras motivating their definitions. Sometimes they are called Gelfand-Naimark type theorems. Theorem 3.3 (Gelfand-Naimark). In the following assertions "≃" is a ∗-isomorphism. 6 DANILA ZAEV • For every commutative unital C ∗-algebra A there exists a compact Hausdorff space X s.t. A ≃ C(X, C). • For every commutative C ∗-algebra A there exists a locally-compact Hausdorff space X s.t. A ≃ C0(X, C), where C0(X, C) is the uniform completion of the space Cc(X, C) of all compactly- supported continuous functions. • For every C ∗-algebra (W ∗-algebra) A there exists a complex Hilbert space H and an uniformly (ultraweakly) closed ∗-subalgebra π(A) of B(H) such that where B(H) is a W ∗-algebra of all bounded linear operators on H. • For every commutative W ∗-algebra A there exists a measure space (X, B, µ) s.t. A ≃ π(A) ⊆ B(H), A ≃ L∞ C (X, µ). Let A be a commutative C ∗-algebra. Instead of measures one can equivalently work with "integrations". It is a well-known Daniels approach to measure theory (see Section 5.6 of [23]). It is justified to adopt and generalize this approach to noncommutative algebras. It can be easily done for finite measures. Definition 3.4 (State and trace). A linear functional µ : A → C is called state on A iff • µ is continuous w.r.t. norm topology on A, • µ is positive: µ(a) ∈ [0, +∞) for any a ∈ A+, • kµk = 1, where kµk := supa∈A µ(a) kak . A state is a finite trace iff it has the trace property: • µ(a · b) = µ(b · a), ∀a, b ∈ A. In the case of commutative C ∗-algebra, there is a bijection between states, finite traces, and Borel probability measures on the Gelfand spectrum of the algebra (which is a compact Hausdorff space). In the case of not necessarily finite measure the situation is a bit more complicated. Definition 3.5 (Weight and trace). A map µ : A+ → R≥ ∪ ∞ is called semi-finite weight on A iff • µ(ta + b) = tµ(a) + µ(b) for a, b ∈ A+, t ∈ R≥, • µ is lower-semicontinuous w.r.t. norm topology on A+, A weight is called semi-finite iff • µ is finite on a norm-dense subspace: Dom(µ) := {a : µ(a) < ∞, a ∈ A+} is dense in A. A weight is a trace iff it satisfies the trace property: • µ(a · b) = µ(b · a), ∀a, b ∈ A. If a semi-finite weight is defined on a W ∗-algebra, it is natural to modify appropriately the definition of semi-finiteness. ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 7 Definition 3.6 (Normal weight and trace). A weight µ defined on a W ∗-algebra N is called iff it is lower-semicontinuous w.r.t. weak∗-topology on N . A weight µ is normally normal semi-finite iff it is normal and satisfies the property: • µ is finite on a weak∗-dense subspace: Dom(µ) := {a : µ(a) < ∞, a ∈ N +} is weak∗- dense in N . Example 3.7. Let µ on Z (countable set with discrete topology) be the counting measure, A := C0(Z), N := l∞(Z) = Cb(Z). It can be shown that integration with µ defines a weight, which is semi-finite on A, but not semi-finite on N . Nevertheless, it is normally semi-finite on N . Any state µ can be considered as a semi-finite weight with Dom(µ) = A. Since any element of C ∗-algebra can be represented as a linear combination of two self-adjoint elements: a = 1 2 (a∗ + a) + i 2 (ia∗ − ia), it follows that for any weight µ, µ(a∗) = µ(a), a ∈ Dom(µ). A weight is called faithful iff it has the following property: a ∈ A+, µ(a) = 0 =⇒ a = 0. In the commutative case any Borel measure corresponds to a faithful weight iff it has a full topological support. Let us define a ∗-subalgebra m := {a ∈ N : τ (a) < ∞} and a *-ideal n := {a ∈ N : τ (a∗a) < ∞} of N . By definition, L2(τ ) is a completion of n in the inner product topology: ha, biL2 := τ (a∗b) for a, b ∈ n(2). The space L1(τ ) is a completion of m := {a ∈ N : τ (a) < ∞} in the norm topology defined as kakL1 := τ (a). It is clear that m = N ∩ L2(τ ) is dense in both spaces as well as n = N ∩ L1(τ ). Let us define positive cones (L1(τ ))+ ⊂ L1(τ ) and (L2(τ ))+ ⊂ L2(τ ) as closures of m+ = {a ∈ m : a ∈ N +} and n+ = {a ∈ n : a ∈ N +} respectively. It can be checked that both L1(τ ) and L2(τ ) are bimodules over N if one defines a · f for a ∈ N , f ∈ L1(τ ) as a limit of a · fn, fn ∈ n, fn → f ; f · a as a limit of fn · a, fn ∈ n, fn → f ; and analogously for h ∈ L2(τ ). Noncommutative version of the Radon-Nikodym theorem (see section 5.1 of [23]) establishes isomorphism between L1(τ ) and N∗ via the correspondence: a(f ) := τ (a · f ) = τ (f · a), a ∈ N , f ∈ L1(τ ). The GNS construction (see section 2.3 of [23]) provides a canonical ∗-representation of N on L2(τ ) such that a(h) := a · h. 4. Preliminaries: Semigroups and Markovianity Let Mn be the algebra of all n × n matrices, tr : Mn → C be a usual matrix trace, N be some semi-finite W ∗-algebra. Definition 4.1 (Completely positive map). A linear map T : N → N is positive iff a ∈ N + implies T (a) ∈ N +. A linear map T : N → N is called completely positive iff for any n ∈ N the map Id ⊗ T : Mn ⊗ N → Mn ⊗ N is positive. Any completely positive map is obviously positive. If N is commutative, then any positive map is also completely positive. Thus the notions of positivity and complete positivity are coincide in the commutative case. For more information on complete positivity see [16]. Definition 4.2 (Markov map). A linear map P : N → N is called Markov iff 8 DANILA ZAEV (1) P is completely positive, (2) P is a contraction: kP k ≤ 1, (3) P is identity preserving: P (1N ) = 1. Here 1N ∈ N is an identity element of the algebra. It is clear that kP k = 1, and it is also known that 0 ≤ a ≤ 1 implies 0 ≤ P (a) ≤ 1 for any Markov map P on N . Remark 4.3. We call an operator T on N conservative iff T (1N ) = 1. Markov maps are always conservative as follows from our definition. Let Mark(N ) be the space of all Markov maps on N . Definition 4.4 (Markov semigroup). A family of Markov maps (Pt), Pt ∈ Mark(N ), t ∈ [0, ∞), is a Markov semigroup iff (1) t → Pt is a morphism of semigroups: Pt+s = Pt + Ps, P0 = 1, (2) it is element-wise weakly-∗ continuous: for any fixed elements a ∈ N , f ∈ N∗, Pt(a)(f ) → a(f ) as t → 0. Definition 4.5 (Symmetric trace). A normal faithful semi-finite (n.f.s.) trace τ on N is called symmetric w.r.t. Markov semigroup (Pt) iff for any a, b ∈ N + and any t ∈ [0, ∞). τ (aPt(b)) = τ (Pt(a)b) t ) ⊂ B(L2(τ )) as P (2) Let (Pt) be a Markov semigroup on N , τ be a symmetric n.f.s. trace. Define a semigroup (P (2) (f ) = Pt(f ) on n and extend each map by continuity. The resulting semigroup consists of positivity preserving self-adjoint operators of norm one. The semigroup is in fact strongly continuous w.r.t. k · kL2 -norm (e.g. Proposition 2.2 of [12]), i.e. for any fixed h ∈ L2(τ ) kP (2) (h) − hkL2 → 0 as t → 0. t t One can analogously define a semigroup (P (1) ) on L1(τ ). Both (P (2) t ) and (P (1) t ) are called t Markov semigroups. Definition 4.6 (Generator of Markov semigroup). Let (Pt), (P (2))t, (P (1))t be Markov semi- groups on N , L2(τ ), L1(τ ) as defined above. Then their respective generators are uniquely defined by the equalities: 1 t lim tց0 (Pt(a)(f ) − a(f )) − ∆(a)(f ) = 0, ∀a ∈ D(∆), f ∈ N∗, (2) (3) (4) lim tց0 lim tց0 1 1 t (cid:13)(cid:13)(cid:13) t (cid:13)(cid:13)(cid:13) (P (1) t (P (2) t (a) − a) − ∆(1)(a)(cid:13)(cid:13)(cid:13)L1(τ ) (a) − a) − ∆(2)(a)(cid:13)(cid:13)(cid:13)L2(τ ) = 0, ∀a ∈ D(∆(1)), = 0, ∀a ∈ D(∆(2)), where D(∆) ⊆ N , D(∆(1)) ⊆ L1(τ ), D(∆(2)) ⊆ L2(τ ) are the subspaces of all elements s.t. the corresponding limits in (2), (3), (4) exist. Proposition 4.7. ∆(1) = ∆ when restricted to D(∆) ∩ D(∆(1)) and ∆(2) = ∆ when they are restricted to D(∆) ∩ D(∆(2)). ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 9 It is clear that ∆(2) is a densely defined unbounded self-adjoint operator on L2(τ ), which is known to be closed. However, the complete characterization of L2-generators of Markov (2) be the unique closed self-adjoint semigroups is not known for the moment (see [20]). Let ∆ 2 1 square root of the ∆(2), D(∆ 2 (2)) be its domain of definition. 1 Definition 4.8 (Dirichlet form of a semigroup). Let us fix a W ∗-algebra N , Markov semigroup ). Define (Pt) and a n.f.s. (2)) ⊆ L2(τ ). A Dirichlet form associated with (N , (Pt), τ ) is a closed Hermitian symmetric trace τ on N . Let ∆(2) be the generator of (P (2) t D(E) := D(∆ form, uniquely defined on D(E) ⊗ D(E) via the equation: 2 1 E(a, b) := ha, ∆(2)(b)iL2(τ ), ∀a, b ∈ D(∆(2)) ⊆ D(E). The Dirichlet space is the Hilbert space D(E) equipped with the inner product: ha, biE := ha, biL2 + E(a, b). Definition 4.9 (Abstract Dirichlet form). Define an abstract Dirichlet form as a quadratic map E : L2 → R+ ∪ +∞, f → E[f ] that satisfies the conditions: • the set D(E) := {f ∈ L2 : E[f ] < ∞} is dense in L2, • D(E) is complete in the norm: kakE := (kak2 L + E[a])) 1 2 , • the associated Hermitian form E(f, g) := 1 2 ((1 + i)(E[f ] + E[g]) − E[f − g] − iE[f − ig]), defined on D(E) × D(E), is real: E(a, b) = E(a∗, b∗) for all a, b ∈ B := A ∩ D(E), • for all f ∈ Lip1 0(R), a ∈ Bs.a. (5) E[f (a)] ≤ E[a], where Lip1 0(R) is the space of all real 1-Lipschitz functions with a fixed point 0 ∈ R. For a densely defined Hermitian form E with domain D(E) ⊆ L2(τ ) let E (n) denote the Hermitian form on L2(τ ) ⊗ (Mn, tr) given by (6) (7) D(E (n)) := D(E) ⊗ Mn, E (n)({a}ij , {b}ij ) := E(ai,j, bi,j). n Xi,j Let E on L2(τ ) be a Dirichlet form associated with (N , (Pt), τ ). Then E (n) is an abstract Dirichlet form on L2(τ ) ⊗ Mn, τ (n) := τ ⊗ tr for every n ∈ N. Such forms are called completely Dirichlet forms. In fact, symmetric Markovian semigroup are in one-to-one correspondence with completely Dirichlet forms generating conservative semigroup (Theorem 3.3 of [12]). A pair (N , τ ) of a W ∗-algebra and a n.f.s. trace will be called noncommutative measure space throughout the paper. The quadriple (N , τ, E, D(E)), where E is a completely Dirichlet form generating Markov semigroup, is called (by a slight abuse of notation) by Dirichlet space. 10 DANILA ZAEV 5. Regularity and differential calculus Let us fix a triple (N , (Pt), τ ) of a W ∗-algebra, Markov semigroup and a symmetric n.f.s. trace. Let E be the associated completely Dirichlet form. Definition 5.1 (Regular subalgebra). An algebra A ⊆ N is called regular iff (1) restriction of τ on A is a faithful, k · k-semi-finite trace, (2) Aτ := A ∩ n is norm dense in A, (3) D(E) ∩ A is norm dense in A, (4) D(E) ∩ A is dense in D(E) w.r.t. the inner product h·, ·iE . It can be checked, that a C ∗-subalgebra generated by a regular subalgebra A ⊆ N is regular itself. The following statement allows one to find a regular C ∗-subalgebra. Proposition 5.2 (Proposition 2.7 of [12]). L1(τ ) ∩ D(E) ∩ N is a regular subalgebra. Definition 5.3. A completely Dirichlet form is called C ∗-Dirichlet form if a regular C ∗- subalgebra is given. Thus, every completely Dirichlet form is a C ∗-Dirichlet form for some C ∗-subalgebra. In fact, it is possible to start with a C ∗-algebra A and a faithful semi-finite trace on it, then construct an L2(τ )-space, the G.N.S. representation of A on L2(τ ), and set L∞(τ ) to be a weak∗-closure of the representation of A. It appears that if A = N is a W ∗-algebra, L∞(τ ) = N . Proposition 5.4 (Proposition 3.4 of [12], Proposition 2.2 of [7]). If E is a C ∗-Dirichlet form w.r.t. C ∗-algebra A, the space B := A∩D(E) is a ∗-algebra w.r.t. multiplication and involution induced from A. A Hilbert bimodule over C ∗-algebra A is a ∗-representation of A⊗max A◦ on a Hilbert space, where ⊗max is a maximal C ∗-tensor product and A◦ is an algebra opposite to A (the same algebra with reversed order of multiplication). Let A be a C ∗-algebra, τ be a faithful semi-finite trace on A, B ⊆ A ∩ L2(τ ) be a given ∗-subalgebra dense in both spaces. Definition 5.5 (Symmetric differential calculus). The triple (H, J, ∂) is called a symmetric differential calculus iff (1) H is a Hilbert bimodule over A, (2) J : H → H is an antilinear involution, (3) ∂ : B → H is a symmetric derivation: J(ahb) = b∗J(h)a∗, ∂(a∗) = J(∂(a)), ∂(ab) = ∂(a)b + a∂(b), which is closable as a linear operator from L2(τ ) to H. It follows, in particular, that (8) (9) kc(a ⊗ b)kH ≤ kckka ⊗ bkH, k(a ⊗ b)dkH ≤ kdkka ⊗ bkH, hha, giH = hh, ga∗iH, hah, giH = hh, a∗giH. for a, b, c ∈ B, h, g ∈ H. ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 11 Theorem 5.6 (Theorem 8.2 of [7]). For every Dirichlet space (N , τ, E, D(E)) and a regular C ∗- algebra A, B := D(E) ∩ A is a ∗-subalgebra dense in both spaces, and there exists a symmetric differential calculus (H, J, ∂) such that • H is the completion of B ⊗ B/ ker k · kH with respect to the norm: ka ⊗ bkH = 1 2 (E(a, abb∗) + E(abb∗, a) − E(bb∗, a∗a)), ker k · kH :=(Xi ai ⊗ bi ∈ B ⊗ B :(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) Xi = 0) , ai ⊗ bi(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)H • H is equipped with a Hilbert bimodule structure over A, defined on B by the formulas: c(a ⊗ b) := (ca) ⊗ b − c ⊗ (ab), for all a, b, c ∈ B. • (b ⊗ c)a := b ⊗ (ca), ∂(a)b = a ⊗ b, E(a, b) = h∂a, ∂biH. (10) (11) (12) (13) (14) (15) By abuse of notation an element a ⊗ b ∈ B ⊗ B and its image in H will be denoted by the same symbol. Definition 5.7. Let (A, τ ) and B be as above. Define a category of symmetric differential calculi with symmetric differential calculi as objects and bimodule isometric isomorphisms commuting with derivations and involutions as morphisms, i.e. morphisms are maps of the form T : (H1, J1, ∂1) 7→ (H2, J2, ∂2) T : H1 7→ H2, T1(ahb) = aT2(h)b, ∀a, b ∈ A T ◦ ∂1 = ∂2, J1 ◦ T = J2. Theorem 5.8 (Theorem 8.3 of [7]). For every Dirichlet space (N , τ, E, D(E)) and a regular C ∗-algebra A, the symmetric differential calculus (H, J, ∂) defined in (5.6) is an initial object in the full subcategory of all symmetric differential calculus satisfying E(a, b) = h∂a, ∂bi. The derivation ∂ constructed in (5.6) is called the gradient operator associated with Dirichlet form (E, D(E)). Since ∂ is a closable operator, it can be extended to a closed one, denoted by the same symbol: ∂ : L2(τ ) → H. It acts between Hilbert spaces, and one is able to define its adjoint: ∂∗ : H → L2(τ ). Since ∂ is thought of as a noncommutative analogue of gradient, it is reasonable to interpret ∂∗ as an analogue of divergence. Theorem 8.2 of [7] asserts that the generator ∆(2) of the semigroup associated with a Dirichlet form can be expressed as a composition ∆(2) = ∂∗ ◦ ∂ on D(∆(2)), and, hence, can be thought of as a generalization of a Laplace operator. 12 DANILA ZAEV 5.1. Examples of noncommutative differential calculi. 5.1.1. Group algebras with length functions. Consider a locally-compact group G that is uni- modular (it means that the left and the right Haar measures coincide). On the space of all continuous complex-valued function with compact support define multiplication "⋆" as the convolution and involution by the formula: f ∗(g) := f (g−1), f ∈ Cc(G), g ∈ G. The norm on Cc(G) is defined as follows: kf k := sup{kf ⋆ hkL2(χ) : h ∈ L2(χ), khkL2(χ) = 1}. Then one can consider the corresponding reduced C ∗-algebra C ∗ r (G), which is the completion of Cc(G) w.r.t. the defined norm. It is commutative iff G is abelian. A reference trace is defined as a continuous extension of τ (f ) := f (e), where f ∈ Cc(G) and e ∈ G is the identity element. Equip G with a continuous length function l : G → [0, +∞) that is conditionally of negative type. For the definition see, for example, Section 2.5 of [31], or Section 2.10 of [3]. The corresponding Dirichlet form is defined by the formula: E(f ) := RG f (g)2l(g)dχG(g). This a conservative regular completely Dirichlet form, as shown in Example 10.2 of [7]. This example is also described in [10] (Example 2.7 and Example 5.2), where an explicit construction of the "tangent" bimodule and the associated gradient derivation is provided. 5.1.2. Dynamical systems. When an action of a group is given by homeomorphisms of some topological space, it is possible to construct a convolution C ∗-algebra of the associated action groupoid. If the group is equipped with some kind of metric data, it is possible to define a Dirichlet space associated with the action and this data. Probably, there is no description of the construction in general case, but there are several well-studied examples. The first one is a classic example of noncommutative torus. In fact, a 2-dimensional noncom- mutative torus is the C ∗-algebra associated with the action of Z on S1 by irrational rotations. The canonical trace and a Dirichlet form is described in Example 2.8 of [10]. A description of the associated differential calculus can be found in Example 5.3 of [10] and Subsection 10.6 of [7]. Some results about concentration are described in Subsection 7.1.2 of [31]. Another example of this type, which appears in a physical model, is described in Example 5.4 of [10]. 5.1.3. Riemannian foliation. J.-L. Sauvageout in [26] described a construction of a transverse heat flow on a Riemannian foliation and the associated noncommutative Dirichlet space. 5.1.4. Clifford bundles. A classic example of a noncommutative Dirichlet space is the one associated with a Clifford C ∗-algebra. See Subsection 10.5 of [7] for the definition and the description of the associated "tangent" bimodule. More generally, one can consider a Dirichlet space associated to a Clifford bundle of a Riemannian manifold. The references are the paper [8], Example 2.6 in [10] and Subsection 10.7 of [7]. 6. Carr´e du Champ form As in the classic theory of Dirichlet spaces, a finer analysis requires a notion of a "Carr´e du Champ" (or gradient) form. In probability theory it is a measure-valued quadratic form In noncommutative setting Γ should have its values in the positive part of the Banach dual of a C ∗-algebra A and should be connected with E in the similar manner: E[a] = hΓ[a], 1A∗∗ i := with the same domain as the Dirichlet form, satisfying the equality E[a] = R 1dΓ[a]. ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 13 1A∗∗ (Γ[a]). It is worth to note, that the double dual of a C ∗-algebra is always a W ∗-algebra and, hence, has a multiplication identity 1A∗∗ . Let A∗ be Banach dual space of C ∗-algebra A, A∗ + ⊂ A be the closed cone of all positive functionals. The space A∗ can be naturally equipped with the structure of bimodule over A: (16) (17) (a ·l m)(b) := m(ab), a, b ∈ A, m ∈ A∗, (m ·r c)(b) := m(bc), c, b ∈ A, m ∈ A∗. Let σ : A∗ → A∗, σ(m)(a) := m(a∗) for any a ∈ A, m ∈ A∗. σ(amb) = b∗σ(m)a∗. It is easy to note, that Remark 6.1. When this does not lead to a confusion, we will omit symbols ·l and ·r in the notation of left and right bimodule multiplications. Fix some Dirichlet space (N , τ, E, D(E)). Let A be some regular C ∗-subalgebra of N . Then one can define a Carr´e du Champ form Γ as follows. For f, g ∈ D(E), a ∈ A: Γ(f, g)(a) := h∂(f ), ∂(g)aiH, where ∂ : D(E) → H is a gradient operator associated with Dirichlet form E. Since kahkH ≤ kak∞khkH, a Carr´e du Champ form takes values in A∗ (the Banach dual of A). One can reformulate inner product on H in the terms of Γ: ha ⊗ b, c ⊗ diH = 1A∗∗ (b∗Γ(a, c)d). (18) (19) Xi (cid:13)(cid:13)(cid:13)(cid:13)(cid:13) 1A∗∗ (b∗ i Γ(ai, ak)bk). =Xi Xk 2 H ai ⊗ bi(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) and also the Dirichlet form in terms of Γ: (20) E(a, b) = 1A∗∗ (Γ(a, b)). Here 1A∗∗ is the identity element of W ∗-algebra A∗∗. It is also possible to explicitly express Γ via E: (21) ΓE [a](b) := E(a, ab∗) + E(ab∗, a) − E(b∗, a∗a), ∀a, b ∈ B := A ∩ D(E). See Lemma 9.1 of [7] for the proof of the nontrivial part of the following statement. Proposition 6.2. A Carr´e du Champ (CdC) form Γ : L2(τ ) → {A∗ above, has the following properties: + ∪+∞}, f → Γ[f ], defined • the set D(Γ) := {f ∈ L2 : Γ[f ] ∈ A∗ • B := D(Γ) ∩ A is a ∗−subalgebra of A, • D(Γ) is complete in the norm: +} is dense in L2, L2(τ ) + 1A∗∗ (Γ[a]), where 1A∗∗ is the identity element of W ∗-algebra A∗∗, Γ := kak2 kak2 14 (22) (23) (24) DANILA ZAEV • the associated A∗-valued form Γ(f, g) := 1 2 ((1 + i)(Γ[f ] + Γ[g]) − Γ[f − g] − iΓ[f − ig]), defined on D(Γ) × D(Γ), is Hermitian over C: ∀t, s ∈ C, ∀a, b ∈ D(Γ) Γ(ta, sb) = t∗sΓ(a, b), Γ(a, b) = σ(Γ(b, a)), and satisfies • reality: Γ(a, b) = Γ(a∗, b∗) for all a, b ∈ B ⊆ A, • representability: for all a, b, c ∈ B Γ(ab, c) − Γ(b, ac) = b∗Γ(a, c) − Γ(b, a∗)c, • complete positivity: for any n ∈ N, {ai}n i=1 ⊂ A, {bi}n i=1 ⊂ A j Γ(aj, ak)bk ∈ A∗ b∗ +. n Xj,k=1 It is easy to check that an element f ∈ A∗ belongs to the subspace L1(τ ) ⊂ A∗ iff it is a continuous functional w.r.t. the topology on A induced by the inclusion A ⊆ (L∞(τ ), weak∗). In [31] a Markov semigroup on L2(τ ) is called a noncommutative diffusion semigroup iff the image of the associated form Γ is a subset of L1(τ ) (see Subsection 2.4 of [31] for details). In this case it is possible to define Γ(a) using the generator ∆(2) of a noncommutative diffusion semigroup: 2Γ[a] := L(a∗) · a + a∗ · L(a) − L(a∗a), a ∈ D(∆(2)). It is clear that in this case τ (Γ[a]) = E[a] for any a ∈ D(E). Under the assumption that the semigroup associated with a Dirichlet form is a noncommu- tative diffusion, one can formulate BE(K, ∞) condition for some K > 0: (25) Γ(Pt(a)) ≤ e−2KtPt(Γ(a)), ∀a ∈ L1(τ ) ∩ D(E) ∩ A, ∀t ≥ 0, It can be checked, that both the right and the left hand sides of this inequality are well-defined. If we do not assume that the form Γ has its values in L1(τ ), we may face some problems with the right-hand side of (25), which can be resolved under additional assumptions. In particular, one need to extend the operator Pt to A∗ (∀ t ≥ 0). The extension can be defined via duality: Pt(z)(a) := z(Pt(a)), a ∈ A, z ∈ A∗ in the case Pt has the following Feller-type property: a ∈ A =⇒ Pt(a) ∈ A. This property of semigroups on C ∗-algebras is studied in details in [27]. 7. Riemannian metric It is possible to construct an A∗-valued sesquilinear mapping on H that plays a role of Riemannian metric tensor in noncommutative geometry. In a finite-dimensional situation this idea was explored in details in the paper [25] of Marc A. Rieffel. For simple tensors a ⊗ b, c ⊗ d in H set The following theorem is a noncommutative generalization of Lemma 2.1 from [18]. R(a ⊗ b, c ⊗ d) := b∗Γ(a, c)d. hk =Pnk lim k R(hk)(f ) = lim ((b(k) i )∗Γ(a(k) i , a(k) j )b(k) j )(f ) = k Xi Xj = lim ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 15 Theorem 7.1. R can be uniquely extended to a well-defined C-sesquilinear mapping R : H × H → A∗ such that for any h ∈ H, R[h] ∈ A∗ +. For any h, g ∈ H one has 1A∗∗ (R(h, g)) = hg, hiH. (b∗ Proof. For any finite linear combination Pi ai ⊗ bi ∈ B ⊗ B and any f ∈ N+, ∗pf bk) = Xi Xk ipf ai ⊗ (pf bi)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) i Γ(ai, ak)bk)(f ) =Xi Xk =Xi Xk i Γ(ai, ak)bk) ∈ A∗ Γ(ai, ak))(b∗ Γ(ai, ak))(b∗ i f bk) =Xi Xk 1A∗∗ ((pf bi)∗Γ(ai, ak))pf bk) =(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) Xi + and kPi ai ⊗ bik = 0 =⇒ PiPk(b∗ ai ⊗ bi# :=Xi Xk bibkΓ(ai, ak) Hence PiPk(b∗ linear functional. Therefore R"Xi H 2 is a well-defined element of A∗ +. It coincides with R on simple tensors. ≥ 0. i Γ(ai, ak)bk) = 0 as a Let h ∈ H and (hk)∞ k=1 ⊂ H be a sequence of finite linear combinations of simple tensors i=1 f (k) i ⊗ g(k) i ∈ H approximating h in k · kH. For any f ∈ N+ i Γ(a(k) k Xi Xj 1A∗∗ ((pf b(k) i , a(k) j ))((b(k) i )∗Γ(a(k) i , a(k) j ) = ∗pf b(k) j ) = lim k )∗pf j )pf b(k) = lim k Xi Xj khkpf k2 H = khpf k2. Set R[h](f ) := limk R[hk](f ) for any f ∈ N+. Since one can decompose any element f ∈ N as a linear combination of positive elements: f = f1 − f2 + if3 − if4, where f1 :=(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12) R[h](f ) can be defined on N as follows: x + x∗ 2 , f2 := f1 − x + x∗ 2 x − x∗ 2i , f4 := f3 − x − x∗ 2i , , f3 :=(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12) (26) R[h](f ) := lim k R[hk](f1) − lim k R[hk](f2) + i lim k R[hk](f3) − i lim k R[hk](f4). It is well-defined continuous linear functional, since R[h](f ) = khpf1k2 − khpf2k2 + ikhpf3k2 − ikhpf4k2, R(h)(f ) ≤ 4kf k∞khkH It can be noted, that the map R : H × H → A∗ constructed above satisfies the following properties: • sesquilinear over C: ∀t, s ∈ C, ∀h, g ∈ H, R(ta, sb) = t∗sR(a, b), • R(h, ga) = R(h, g) ·r a (cid:3) 16 DANILA ZAEV • σ(R(h, g)) = R(g, h), • R(ah, g) = R(h, a∗g), • {h ∈ H : R(h, g) = 0 ∀g ∈ H} = 0. • positivity: R(h, h) ∈ A∗ +, for all h, g ∈ H, a ∈ A. It is a consequence of (6.2) and the very definition of R(·, ·). See also Section 3 of [25] and Corollary 2.1 in [18]. In this section we provide a definition of Poincar´e-like inequality, which differs from the 8. Poincar´e inequality usual one, but is appropriate for our following study of PDEs. Let us define a kernel of a Dirichlet form as follows. ker E := {u ∈ D(E) : E[u] = 0} . Let D(E) (which is a Hilbert space) be decomposed into orthogonal sum D(E) = ker E ⊕ D⊥(E). It is clear that D⊥(E) is a Hilbert space w.r.t. inner product E(·, ·). Definition 8.1. E is said to satisfy Poincar´e inequality iff for any a ∈ D⊥(E), (27) kak2 L2 ≤ CE[a], where C > 0 is some constant. The Poincar´e constant CP is defined as the infimum of all constants C such that the inequality (27) is satisfied. Assume that dim(ker E) ≤ 1, i.e. it is either trivial or one-dimensional. Then the dimension of ker ∆(2) is also not greater than one. Is such a case the Poincar´e constant can be interpreted as the inverse of the spectral gap g of ∆(2). 1 CP = g := {λ : λ > 0, λ ∈ σ(∆(2))} > 0. It should be noted, that in some classic definitions of Poincar´e inequality it is required for ker E to be one-dimensional. We do not assume that and we show that our formulation of the inequality is enough to establish existence/uniqueness results for many PDEs (see the next two sections). Let us consider a toy noncommutative example. Example 8.2 (noncommutative 2-torus). A noncommutative 2-torus can be defined in differ- ent equivalent ways. One of them is to define it as a universal C ∗-algebra generated by two unitaries U and V satisfying the relation V U = e2iπθU V for some fixed parameter θ ∈ R. The unique tracial state τ is defined by the equality: αn,mU nV m τ  Xn,m∈Z  := α0,0, n, m ∈ Z, αn,m ∈ C. If one equip noncommutative torus with the Markov semigroup of the form: Pt(U nV m) = e−t(n2+m2)U nV m, n, m ∈ Z, ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 17 the associated C ∗-Dirichlet form is the closure of the form defined by αn,mU nV m  = Xn,m∈Z (n2 + m2)αn,m2 E  Xn,m∈Z αn,mU nV m(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)L2(τ ) = Xn,m∈Z (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) Xn,m∈Z on the elements with finite number of non-zero components αn,m. It is clear, that the Poincar´e inequality is satisfied in this case, and CP = 1: αn,m2 ≤ Xn,m∈Z (n2 + m2)αn,m2 = E  Xn,m∈Z αn,mU nV m  . The ker E is one-dimensional and consists of constants. Hence the spectral gap of the corre- sponding operator ∆(2) is equal to one. For the alternative definitions of Poincar´e inequalities in noncommutative setting see the series of papers of M. Junge and Q. Zeng ([21], [22], [30], [31], e.t.c.), where they study relations between noncommutative analogues of various consentration-like inequalities. For the short review of their results see Subsection 1.2.2 of [31]. 9. Quasilinear elliptic equations Assume that a Dirichlet space (N , τ, E, D(E)) and a regular C ∗-algebra A are chosen and fixed throughout the section. We also assume D(E) to be a separable space. Let us first prove the existence of a weak solution for a linear Poisson equation: (28) ∂∗∂u = f, f ∈ D(E), Definition 9.1. An element u ∈ D(E) is called a weak solution for (28) iff for any g ∈ D(E). h∂u, ∂giH = hf, giL2(τ ) Theorem 9.2 (Dirichlet principle). Let E satisfies Poincar´e inequality (27). Then (28) has a weak solution. Proof. We are going to use a classic variational direct method, based on Poincar´e inequality. Let I : D(E) → R be defined as I(u) := 1 H − ℜhf, uiL2(τ ). Note that for any δ > 0 2 k∂uk2 I(u) ≥ 1 2(cid:18)k∂uk2 H − δkuk2 L2(τ ) − 1 4δ kf k2 L2(τ )(cid:19) . Hence it follows from Poincar´e inequality that I(u) has a finite infimum I∗. Let (un)∞ n=1 ⊂ D(E) be such that I(un) ց I∗. We need to show that there is a subsequence converging to a limit in D(E). By Holder and Poincar´e inequalities, (29) I(u) ≥ 1 2 k∂uk2 H − kukL2(τ )kf kL2(τ ) ≥ 1 2 Hence, the uniform bound on I(un) implies uniform boundedness of k∂ukH, and, hence, uniform boundedness of (un) in D(E). Thus (un) has a weakly convergent subsequence, denoted in the same way by (un). Denote its limit by u∞. k∂uk2 H − Ck∂ukH =(cid:18) 1 2 k∂ukH − C(cid:19) k∂uk2 H. 18 DANILA ZAEV Since I(u) is a convex functional, I(u∞) ≤ lim inf n I(un) = I∗. Thus u∞ is a minimizer. Let ω be some element of D(E). Consider a real function α 7→ I(u∞ + αω). Since I(u∞ + αω) = α2 1 2 E[ω] + αℜ(cid:0)E(u∞, ω) − hf, ωiL2(τ )(cid:1) + I[u∞], the value of E[ω] + αℜ(cid:0)E(u∞, ω) − hf, ωiL2(τ )(cid:1) α2 1 2 should be nonnegative for any α ∈ R. Hence u∞ satisfies ℜh∂u∞, ∂giH = ℜhf, giL2(τ ), and, since ℜ(αz) = 0, ∀α ∈ C implies z = 0, it is a solution of (28). (cid:3) Let us define quasilinear elliptic equation as an equation of the form: (30) ∂∗F (∂u) = f, f ∈ D(E), where F : H → H is some (possibly nonlinear) map. Definition 9.3. An element u ∈ D(E) is called a weak solution for (30) iff hF (∂u), ∂giH = hf, giL2(τ ) for any g ∈ D(E). The following theorem is an analogue of a classic Browder-Minty result. Theorem 9.4. Assume that F : H → H satisfies the following properties: (1) ℜhF (h) − F (v), h − viH ≥ 0, for any h, v ∈ H, (2) kF (h)kH ≤ c0(1 + khkH), for any h ∈ H, (3) ℜhF (h), hiH ≥ c1khkH − c2, for any h ∈ H, c0, c1 > 0, c2 ≥ 0 and E satisfies Poincar´e inequality (27). Then the equation (30) has a weak solution. Proof. Let D0(E) be a quotient Hilbert space D(E)/ ker E, where ker E := {u ∈ D(E) : E[u] = 0} , equipped with the inner product E(·, ·). It is clear that the equation (30) is well defined on D0(E), and if it has a solution u ∈ D0(E) then each representative u ∈ D(E) of u appears to be a solution of (30) in D(E). Consider an orthonormal basis {ωn} of D0(E). We will look for a sequence of elements (um) ⊂ D0(E) that has the form: (31) such that (32) um = dk mωk, m Xk=1 ℜhF (∂(um)), ∂(ωk)iH = ℜhf, ωkiL2(τ ). ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 19 Define the function V : Rm → Rm, V = (v1, . . . , vm) as follows: where d = (d1, . . . , dm) ∈ Rm. Then m m djωj + L2(τ ) − ℜhf, ωkiL2(τ ), m H H m Xj=1 dj∂ωj vk(d) := ℜ*F   , ∂(ωk)+ Xj=1  V (d) · d = ℜ*∂ dj∂ωj  , dj∂(ωj) − ℜ*f, + Xj=1 Xj=1    dj∂ωj(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) ≥ c1(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) − c2 − ℜ*f, djωj + Xj=1 Xj=1  Xj=1 Xj=1 = c1d2 − c2 − ℜhf, ωji2 L2(τ ). djℜhf, ωjiL2(τ ) d2 − c2 − C ≥ c1 2 2 H m L2(τ ) m m m Let u ∈ D0(E) be a equivalence class of a weak solution for (28). Then ℜh∂u, ∂ωjiH = ℜhf, ωjiL2(τ ), ∀j ∈ N, Hence m (ℜhf, ωjiL2(τ ))2 = ℜE(u, ωj)2 ≤ kuk2 H ≤ Ckf kL2(τ ), Xj=1 and V (d) · d ≥ c1 2 d2 − C for some C ∈ R. Thus V (d) · d ≥ 0 if d is large enough. One can use a standard application of Brouwer fixed-point theorem (see p.496 of [13]) to conclude that V (d) = 0 for some point d ∈ Rm. This point provides us with a "correct" set of coefficients in (31) to solve (32). Since ℜhF (∂um), ∂umiH = ℜhf, umiL2(τ ), ∀m ∈ N, 1 4δ c1k∂umk2 ≤ C + ℜhf, umiL2(τ ) ≤ C + δkumk2 L2(τ ) + kf k2 L2(τ ) for any δ > 0, and choosing δ small enough, one deduces: E[um] ≤ C(1 + kf kL2(τ )). Due to this uniform boundedness, one can extract a subsequence of (um) ⊂ D0(E) (denoted again by (um)) weakly convergent in D0(E) to some element u∞, and, due to Poincar´e inequal- ity, there is a sequence (uk) ⊂ D(E) of representatives, uk ∈ uk, ∀k ∈ N , such that it converges in D(E) to u∞ ∈ u∞. Using the assumption (2) of the theorem one obtains that there is a subsequence (um) such that F (∂um) → ξ weakly in H, ℜhξ, ∂ωmiH = ℜhf, ωmiL2(τ ). 20 Thus DANILA ZAEV ℜhξ, ∂ωiH = ℜhf, ωiL2(τ ), ∀ω ∈ D0(E). And, since by the assumption (1) of the theorem, ℜhF (∂um) − F (∂ω), ∂um − ∂ωiH ≥ 0 for any ω ∈ D0(E), one can conclude ℜhf, umiL2(τ ) − ℜhF (∂um), ∂ωiH − ℜhF (∂ω), ∂um − ∂ωiH ≥ 0, ℜhf, u∞iL2(τ ) − ℜhξ, ∂ωiH − ℜhF (∂ω), ∂u∞ − ∂ωiH ≥ 0. It follows that Fix any g ∈ D0(E) and set ω := u∞ − λg. One obtains ℜhξ − F (∂ω), ∂(u∞ − ω)iH ≥ 0, ∀ω ∈ D0(E). ℜh(ξ − F (∂u∞ − λ∂g)), ∂giH ≥ 0, ℜh(ξ − F (∂u∞)), ∂giH ≥ 0, ∀g ∈ D0(E). Replacing g by −g, one can deduce, that the equality ℜh(ξ − F (∂u∞)), ∂giH = 0, ∀g ∈ D0(E) holds. Since ℜhξ, ∂ωiH = ℜhf, ωiL2(τ ), ∀ω ∈ D0(E), u∞ is a weak solution of (30). Since ℜ(αz) = 0, ∀α ∈ C implies z = 0, a solution of is a solution of (30). ℜhF (∂u), ∂giH = ℜhf, giL2(τ ) Theorem 9.5. Assume that F : H → H satisfies the property: ℜhF (h) − F (v), h − viH ≥ θkh − vk2 H, for any h, v ∈ H, θ > 0. Then the equation (30) has at most one solution in D0(E). Proof. Assume that u1 and u2 are both weak solutions of (30), i.e. hF (∂u1), ∂giH = hF (∂u2), ∂giH = hf, giL2(τ ) Thus By the assumption of the theorem, ℜhF (∂u1) − F (∂u2), ∂giH = 0, ∀g ∈ D(E). 0 = ℜhF (∂u1) − F (∂u2), ∂u1 − ∂u2iH ≥ θk∂u1 − ∂u2k2 H ≥ 0. (cid:3) (cid:3) 10. Linear evolution equations One can consider in our setting not only elliptic, but also evolution equations, e.g. continuity equation. To establish an existence result it is convenient to use the Bochner space formulation of equations and solutions. Let V be a Banach space, p ∈ [1, ∞) Lp([0, T ]; V ) := {[u] : u : [0, T ] → V,Z T 0 kukpdt < ∞}, where the integral is understood in the sense of Bochner integration, [u] is an equivalence class of a.e. coinciding functions. The norm on Lp([0, T ]; V ) is defined as follows kukp Lp([0,T ];V ) := 0 ku(t)kp V dt. R T ON SOME TOPICS OF ANALYSIS ON NONCOMMUTATIVE SPACES 21 The pair j : V → H, j∗ : H → V ∗ is called Gelfand triple iff V is a Banach space, H is a Hilbert space, V ∗ is a Banach dual of B, the map j : V → H is linear, continuous, injective, with dense image, and j∗ : H → V is defined by j∗(h)(v) = hh, j(v)iH , It follows that j∗ is also linear, continuous, injective and with dense image. Example 10.1. Assume that a Dirichlet space (N , τ, E, D(E)) and a regular C ∗-algebra A are chosen s.t. D(E) is a separable space. Then V := D(E) equipped with the inner product h·, ·iE := h·, ·iL2(τ ) + E(·, ·), H := L2(τ ), j(f ) := f , is an example of a Gelfand triple. Definition 10.2 (Weak derivative). Let u ∈ L2([0, T ]; V ). An element ω ∈ L2([0, T ], V ∗) is called a weak derivative iff Z T 0 ¯ω(t)φ(t)dt = −Z T 0 ¯u(t) φ(t)dt, for any φ ∈ C ∞ 0 ([0, T ], C). The integrals are understood in Bochner sense. It is standard that if a weak derivative exists it is unique (see e.g. Proposition 11.10 in [2]). We denote it by u. Theorem 10.3 (Theorem 11.13 of [2]). Let j : V → H, j∗ : H → V ∗ be a Gelfand triple, If F : V × V × [0, T ] → R is a where V is a separable infinite-dimensional Banach space. bilinear form for every t ∈ [0, T ] satisfying (1) F (v, v; t) ≥ c0kvk2 V − c1kvk2 H , (2) F (v, w; t) ≤ c2kvkV kwkV . for any v, w ∈ V , t ∈ [0, ∞], some c0, c1, c2 > 0, which is Lebesgue measurable in t. Then there is a function u ∈ L2([0, T ], V ) such that u ∈ L2([0, T ], V ∗) and it satisfies the equation (33) (34) u(t)(v) + F (u(t), v; t) = b(t)(v), ∀v ∈ V, u(0) = u0 for every t ∈ [0, T ]. Here u0 ∈ V , b ∈ L2([0, T ]; V ∗). Definition 10.4 (Continuity equation). Let V := D(E), H := L2(τ ), j(f ) := f as in the Example (10.1). A continuity equation is an equation of the form (33) with F (u, v, t) := ℜhh(t)u, ∂viH, where h : [0, T ] → H is a measurable flow of vector fields, H, ∂ are the elements of the sym- metric differential calculus associated with E. A flow b ∈ L2([0, T ]; D(E)∗) can be interpreted as a source/sink that depends on time. Corollary 10.5. If h : [0, T ] → H is such that for any u ∈ B := D(E) ∩ A (1) ℜhh(t)u, ∂uiH ≥ c0E[u] − c1kuk2 (2) ℜhh(t)u, ∂ωiH ≤ c2ku1kE ku2kE , L2(τ ), where c0, c2 > 0, c1 ∈ R, k · kE := (E[·] + k · k2 sense of Theorem (10.3). L2(τ )) 1 2 , then there is a solution of (10.4) in the 22 DANILA ZAEV References [1] Sergio Albeverio, Raphael Hoegh-Krohn, Dirichlet Forms and Markov Semigroups on C ∗-Algebras, 1977. [2] Martin Brokate, Lecture notes. Partial Differential Equations 2. Variational Methods, 2016. [3] B. Bekka, P. de la Harpe and A. Valette Kazhdan's Property (T), 2007. [4] Fabio Cipriani, The variational approach to the Dirichlet problem in C ∗-algebras, 1998. [5] Fabio Cipriani, Dirichlet Forms on Noncommutative Spaces, 2008. [6] Fabio Cipriani Noncommutative Potential Theory, (slides), 2014. [7] Fabio Cipriani, Jean-Luc Sauvageot, Derivations as square roots of Dirichlet forms, 2003. [8] Fabio Cipriani, Jean-Luc Sauvageot, Noncommutative potential theory and the sign of the curvature operator in Riemannian geometry, 2003. [9] Fabio Cipriani, Jean-Luc Sauvageot, Fredholm Modules on P.C.F. Self-Similar Fractals and their Conformal Geometry, 2007. [10] Fabio Cipriani, Jean-Luc Sauvageot, Variations in noncommutative potential theory: finite energy states, potentials and multipliers, 2012. [11] Fabio Cipriani, Uwe Franz, Anna Kula, Symmetries of L´evy processes on compact quantum groups, their Markov semigroups and potential theory, 2012. [12] E. Brian Davies, J. Martin Lindsay Non-commutative symmetric Markov semigroups, 1992. [13] Lawrence C. Evans, Partial Differential Equations: Second Edition, Graduate Series in Mathematics, vol. 19.R, 2010. [14] Marius Ionescu, Luke G. Rogers, and Alexander Teplyaev, Derivations, Dirichlet forms and Spectral analysis, 2011. [15] Marius Ionescu, Luke G. Rogers, and Alexander Teplyaev, Derivations and Dirichlet forms on fractals, 2011. [16] A. Ya. Helemskii, Quantum Functional Analysis: Non-Coordinate Approach, University Lecture Series Volume: 56; 2010. [17] Michael Hinz, Alexander Teplyaev Vector analysis on fractals and applications, 2012. [18] Michael Hinz, Michael R´'ockner, Alexander Teplyaev, Vector analysis for Dirichlet forms and quasilinear PDE and SPDE on metric measure spaces, 2013. [19] Michael Hinz, Alexander Teplyaev Local Dirichlet forms, Hodge theory, and the Navier-Stokes equations on topologically one-dimensional fractals, 2013. [20] Alexander S. Holevo, Covariant Quantum Dynamical Semigroups: Unbounded generators, 1997. [21] Marius Junge, Qiang Zeng, Noncommutative martingale deviation and Poincar´e type inequalities with applications, 2013. [22] Marius Junge, Qiang Zeng, Subgaussian 1-cocycles on discrete groups, 2013. [23] Ryszard Pawe l Kostecki, W*-algebras and noncommutative integration, 2013. [24] D´enes Petz, A variational expression for the relative entropy, 1988. [25] D´enes Petz, Non-Commutative Resistance Networks, 2014. [26] Jean-Luc Sauvageot, Semi-groupe de la chaleur transverse sur la C*-alg`ebre d'un feuilletage riemannien, 1996. [27] Jean-Luc Sauvageot, Strong Feller semigroups on C ∗-algebras, 1999. [28] Jean-Luc Sauvageot, Dirichlet Forms on C ∗-algebras. A Review, 2007. [29] Qunahua Xu, Operator spaces and noncommutative Lp, 2007. [30] Qiang Zeng, Poincar´e type inequalities for group measure spaces and related transportation cost inequalities, 2013. [31] Qiang Zeng, Poincar´e inequalities in noncommutative Lp spaces, (thesis), 2014. Faculty of Mathematics, Higher School of Economics, Moscow E-mail address: [email protected]